MOS Source Code
Loading...
Searching...
No Matches
ISerialDevice Class Referenceabstract

#include <serial.hpp>

Inheritance diagram for ISerialDevice:

Public Member Functions

virtual ~ISerialDevice ()=default
virtual u8 ReadByte ()=0
virtual int WriteByte (u8 byte)=0
virtual bool get_data_ready ()=0
virtual u8 read_register (serial_register_t offset)=0
virtual void write_register (serial_register_t offset, u8 value)=0
bool setup ()
int read_data (char *data, size_t length)
int write_data (const char *data, size_t length)

Protected Attributes

serial_baudrate_t baudrate_divisor
serial_charlength_t char_length
serial_stopbits_t stop_bits
serial_parity_t parity

Private Types

enum  serial_modem_status_t {
  MODEM_DCTS = 1 << 0 , MODEM_DDSR = 1 << 1 , MODEM_TERI = 1 << 2 , MODEM_DDCD = 1 << 3 ,
  MODEM_CLEAR_TO_SEND = 1 << 4 , MODEM_DATA_SET_READY = 1 << 5 , MODEM_RING_INDICATOR = 1 << 6 , MODEM_DATA_CARRIER_DETECT = 1 << 7
}
enum  serial_modem_control_t {
  MODEM_DTR = 1 << 0 , MODEM_RTS = 1 << 1 , MODEM_UNUSED_PIN1 = 1 << 2 , MODEM_IRQ = 1 << 3 ,
  MODEM_LOOP = 1 << 4
}
enum  serial_line_status_t {
  LINE_DATA_READY = 1 << 0 , LINE_ERR_OVERRUN = 1 << 1 , LINE_ERR_PARITY = 1 << 2 , LINE_ERR_FRAMING = 1 << 3 ,
  LINE_ERR_BREAK = 1 << 4 , LINE_TRANSMITR_BUF_EMPTY = 1 << 5 , LINE_TRANSMITR_EMPTY = 1 << 6 , LINE_ERR_IMPENDING = 1 << 7
}

Private Member Functions

void SetBaudrateDivisor ()
void SetDataBits ()
void SetStopBits ()
void SetParity ()
void SetInterrupts (int interrupts)
void SetModemOptions (serial_modem_control_t control, bool enable)
char GetLineStatus ()
__maybe_unused char GetModelStatus ()
bool GetDataReady ()
void WaitReadyToRead ()
void WaitReadyToWrite ()

Detailed Description

Definition at line 71 of file serial.hpp.

Member Enumeration Documentation

◆ serial_modem_status_t

enum serial_modem_status_t
private
Enumerator
MODEM_DCTS 
MODEM_DDSR 
MODEM_TERI 
MODEM_DDCD 
MODEM_CLEAR_TO_SEND 
MODEM_DATA_SET_READY 
MODEM_RING_INDICATOR 
MODEM_DATA_CARRIER_DETECT 

Definition at line 94 of file serial.hpp.

◆ serial_modem_control_t

enum serial_modem_control_t
private
Enumerator
MODEM_DTR 
MODEM_RTS 
MODEM_UNUSED_PIN1 
MODEM_IRQ 
MODEM_LOOP 

Definition at line 106 of file serial.hpp.

◆ serial_line_status_t

enum serial_line_status_t
private
Enumerator
LINE_DATA_READY 
LINE_ERR_OVERRUN 
LINE_ERR_PARITY 
LINE_ERR_FRAMING 
LINE_ERR_BREAK 
LINE_TRANSMITR_BUF_EMPTY 
LINE_TRANSMITR_EMPTY 
LINE_ERR_IMPENDING 

Definition at line 115 of file serial.hpp.

Constructor & Destructor Documentation

◆ ~ISerialDevice()

virtual ~ISerialDevice ( )
virtualdefault

Member Function Documentation

◆ ReadByte()

virtual u8 ReadByte ( )
pure virtual

Implemented in RiscV64UartDevice, and x86SerialDevice.

Referenced by read_data(), and setup().

◆ WriteByte()

virtual int WriteByte ( u8 byte)
pure virtual

Implemented in RiscV64UartDevice, and x86SerialDevice.

Referenced by setup(), and write_data().

◆ get_data_ready()

virtual bool get_data_ready ( )
pure virtual

Implemented in RiscV64UartDevice, and x86SerialDevice.

◆ read_register()

◆ write_register()

virtual void write_register ( serial_register_t offset,
u8 value )
pure virtual

◆ setup()

bool setup ( )

Definition at line 8 of file serial.cpp.

Here is the call graph for this function:

◆ read_data()

int read_data ( char * data,
size_t length )

Definition at line 36 of file serial.cpp.

Here is the call graph for this function:

◆ write_data()

int write_data ( const char * data,
size_t length )

Definition at line 47 of file serial.cpp.

Here is the call graph for this function:

◆ SetBaudrateDivisor()

void SetBaudrateDivisor ( )
private

Definition at line 58 of file serial.cpp.

Referenced by setup().

Here is the call graph for this function:

◆ SetDataBits()

void SetDataBits ( )
private

Definition at line 77 of file serial.cpp.

Referenced by setup().

Here is the call graph for this function:

◆ SetStopBits()

void SetStopBits ( )
private

Definition at line 84 of file serial.cpp.

Referenced by setup().

Here is the call graph for this function:

◆ SetParity()

void SetParity ( )
private

Definition at line 91 of file serial.cpp.

Referenced by setup().

Here is the call graph for this function:

◆ SetInterrupts()

void SetInterrupts ( int interrupts)
private

Definition at line 98 of file serial.cpp.

Referenced by setup().

Here is the call graph for this function:

◆ SetModemOptions()

void SetModemOptions ( serial_modem_control_t control,
bool enable )
private

Definition at line 105 of file serial.cpp.

Referenced by setup().

Here is the call graph for this function:

◆ GetLineStatus()

char GetLineStatus ( )
private

Definition at line 119 of file serial.cpp.

Referenced by GetDataReady(), and WaitReadyToWrite().

Here is the call graph for this function:

◆ GetModelStatus()

__maybe_unused char GetModelStatus ( )
private

Definition at line 124 of file serial.cpp.

Here is the call graph for this function:

◆ GetDataReady()

bool GetDataReady ( )
private

Definition at line 129 of file serial.cpp.

Referenced by WaitReadyToRead().

Here is the call graph for this function:

◆ WaitReadyToRead()

void WaitReadyToRead ( )
private

Definition at line 134 of file serial.cpp.

Referenced by read_data().

Here is the call graph for this function:

◆ WaitReadyToWrite()

void WaitReadyToWrite ( )
private

Definition at line 140 of file serial.cpp.

Referenced by write_data().

Here is the call graph for this function:

Member Data Documentation

◆ baudrate_divisor

serial_baudrate_t baudrate_divisor
protected

◆ char_length

serial_charlength_t char_length
protected

◆ stop_bits

serial_stopbits_t stop_bits
protected

◆ parity


The documentation for this class was generated from the following files: