Public Types | Public Member Functions | Static Public Member Functions
serial_port_intel_x64 Class Reference

Public Types

enum  baud_rate_t {
  baud_rate_50 = 0x0900, baud_rate_75 = 0x0600, baud_rate_110 = 0x0417, baud_rate_150 = 0x0300,
  baud_rate_300 = 0x0180, baud_rate_600 = 0x00C0, baud_rate_1200 = 0x0060, baud_rate_1800 = 0x0040,
  baud_rate_2000 = 0x003A, baud_rate_2400 = 0x0030, baud_rate_3600 = 0x0020, baud_rate_4800 = 0x0018,
  baud_rate_7200 = 0x0010, baud_rate_9600 = 0x000C, baud_rate_19200 = 0x0006, baud_rate_38400 = 0x0003,
  baud_rate_57600 = 0x0002, baud_rate_115200 = 0x0001
}
 
enum  data_bits_t { char_length_5 = 0x00, char_length_6 = 0x01, char_length_7 = 0x02, char_length_8 = 0x03 }
 
enum  stop_bits_t { stop_bits_1 = 0x00, stop_bits_2 = 0x04 }
 
enum  parity_bits_t {
  parity_none = 0x00, parity_odd = 0x08, parity_even = 0x18, parity_mark = 0x28,
  parity_space = 0x38
}
 
using port_type = x64::portio::port_addr_type
 
using value_type = x64::portio::port_8bit_type
 

Public Member Functions

 serial_port_intel_x64 (port_type port=DEFAULT_COM_PORT) noexcept
 
 ~serial_port_intel_x64 ()=default
 
void set_baud_rate (baud_rate_t rate) noexcept
 
baud_rate_t baud_rate () const noexcept
 
void set_data_bits (data_bits_t bits) noexcept
 
data_bits_t data_bits () const noexcept
 
void set_stop_bits (stop_bits_t bits) noexcept
 
stop_bits_t stop_bits () const noexcept
 
void set_parity_bits (parity_bits_t bits) noexcept
 
parity_bits_t parity_bits () const noexcept
 
port_type port () const noexcept
 
void write (char c) noexcept
 
void write (const std::string &str) noexcept
 
 serial_port_intel_x64 (serial_port_intel_x64 &&) noexcept=default
 
serial_port_intel_x64operator= (serial_port_intel_x64 &&) noexcept=default
 
 serial_port_intel_x64 (const serial_port_intel_x64 &)=delete
 
serial_port_intel_x64operator= (const serial_port_intel_x64 &)=delete
 

Static Public Member Functions

static serial_port_intel_x64instance () noexcept
 

Detailed Description

Serial Port (Intel x64)

This class implements the serial device for Intel specific archiectures. All of the serial devices start off with the same default settings (minus the port). There are no checks on the port # (in case a custom port number is needed), and there are no checks to ensure that only one port is used at a time. If custom port settings are required, once the serial port is created, the custom settings can be setup by using the set_xxx functions. The user should ensure that the settings worked by checking the result.

Also note, that by default, a FIFO is used / required, and interrupts are disabled.

Definition at line 74 of file serial_port_intel_x64.h.

Member Typedef Documentation

◆ port_type

Definition at line 78 of file serial_port_intel_x64.h.

◆ value_type

Definition at line 79 of file serial_port_intel_x64.h.

Member Enumeration Documentation

◆ baud_rate_t

Enumerator
baud_rate_50 
baud_rate_75 
baud_rate_110 
baud_rate_150 
baud_rate_300 
baud_rate_600 
baud_rate_1200 
baud_rate_1800 
baud_rate_2000 
baud_rate_2400 
baud_rate_3600 
baud_rate_4800 
baud_rate_7200 
baud_rate_9600 
baud_rate_19200 
baud_rate_38400 
baud_rate_57600 
baud_rate_115200 

Definition at line 81 of file serial_port_intel_x64.h.

◆ data_bits_t

Enumerator
char_length_5 
char_length_6 
char_length_7 
char_length_8 

Definition at line 103 of file serial_port_intel_x64.h.

◆ stop_bits_t

Enumerator
stop_bits_1 
stop_bits_2 

Definition at line 111 of file serial_port_intel_x64.h.

◆ parity_bits_t

Enumerator
parity_none 
parity_odd 
parity_even 
parity_mark 
parity_space 

Definition at line 117 of file serial_port_intel_x64.h.

Constructor & Destructor Documentation

◆ serial_port_intel_x64() [1/3]

serial_port_intel_x64::serial_port_intel_x64 ( serial_port_intel_x64::port_type  port = DEFAULT_COM_PORT)
noexcept

Default Constructor

Precondition
expects: none
Postcondition
ensures: none

Definition at line 27 of file serial_port_intel_x64.cpp.

◆ ~serial_port_intel_x64()

serial_port_intel_x64::~serial_port_intel_x64 ( )
default

Destructor

Precondition
expects: none
Postcondition
ensures: none

◆ serial_port_intel_x64() [2/3]

serial_port_intel_x64::serial_port_intel_x64 ( serial_port_intel_x64 &&  )
defaultnoexcept

◆ serial_port_intel_x64() [3/3]

serial_port_intel_x64::serial_port_intel_x64 ( const serial_port_intel_x64 )
delete

Member Function Documentation

◆ instance()

serial_port_intel_x64 * serial_port_intel_x64::instance ( )
staticnoexcept

Get Instance

Get an instance to the class.

Precondition
expects: none
Postcondition
ensures: ret != nullptr

Definition at line 48 of file serial_port_intel_x64.cpp.

◆ set_baud_rate()

void serial_port_intel_x64::set_baud_rate ( baud_rate_t  rate)
noexcept

Set Baud Rate

Sets the rate at which the serial device will operate. Note that the rate paramter is actually the divisor that is used, and a custom one can be used if desired. If 0 is provided, the default baud rate is used instead.

Precondition
expects: none
Postcondition
ensures: none
Parameters
ratedesired baud rate

Definition at line 55 of file serial_port_intel_x64.cpp.

◆ baud_rate()

serial_port_intel_x64::baud_rate_t serial_port_intel_x64::baud_rate ( ) const
noexcept

Buad Rate

Returns the baud rate of the serial device. If the serial device is set to a baud rate that this code does not recognize, unknown is returned.

Precondition
expects: none
Postcondition
ensures: none
Returns
the baud rate

Definition at line 69 of file serial_port_intel_x64.cpp.

◆ set_data_bits()

void serial_port_intel_x64::set_data_bits ( data_bits_t  bits)
noexcept

Set Data Bits

Sets the size of the data that is transmitted. For more information on the this field, please see http://wiki.osdev.org/Serial_Ports.

Precondition
expects: none
Postcondition
ensures: none
Parameters
bitsthe desired data bits

Definition at line 120 of file serial_port_intel_x64.cpp.

◆ data_bits()

serial_port_intel_x64::data_bits_t serial_port_intel_x64::data_bits ( ) const
noexcept

Data Bits

Precondition
expects: none
Postcondition
ensures: none
Returns
the serial device's data bits

Definition at line 131 of file serial_port_intel_x64.cpp.

◆ set_stop_bits()

void serial_port_intel_x64::set_stop_bits ( stop_bits_t  bits)
noexcept

Set Stop Bits

Sets the stop bits used for transmission. For more information on the this field, please see http://wiki.osdev.org/Serial_Ports.

Precondition
expects: none
Postcondition
ensures: none
Parameters
bitsthe desired stop bits

Definition at line 149 of file serial_port_intel_x64.cpp.

◆ stop_bits()

serial_port_intel_x64::stop_bits_t serial_port_intel_x64::stop_bits ( ) const
noexcept

Stop Bits

Precondition
expects: none
Postcondition
ensures: none
Returns
the serial device's stop bits

Definition at line 160 of file serial_port_intel_x64.cpp.

◆ set_parity_bits()

void serial_port_intel_x64::set_parity_bits ( parity_bits_t  bits)
noexcept

Set Parity Bits

Sets the parity bits used for transmission. For more information on the this field, please see http://wiki.osdev.org/Serial_Ports.

Precondition
expects: none
Postcondition
ensures: none
Parameters
bitsthe desired parity bits

Definition at line 174 of file serial_port_intel_x64.cpp.

◆ parity_bits()

serial_port_intel_x64::parity_bits_t serial_port_intel_x64::parity_bits ( ) const
noexcept

Parity Bits

Precondition
expects: none
Postcondition
ensures: none
Returns
the serial device's parity bits

Definition at line 185 of file serial_port_intel_x64.cpp.

◆ port()

port_type serial_port_intel_x64::port ( ) const
inlinenoexcept

Port

Precondition
expects: none
Postcondition
ensures: none
Returns
the serial device's port

Definition at line 248 of file serial_port_intel_x64.h.

◆ write() [1/2]

void serial_port_intel_x64::write ( char  c)
noexcept

Write Character

Writes a character to the serial device.

Precondition
expects: none
Postcondition
ensures: none
Parameters
ccharacter to write

Definition at line 205 of file serial_port_intel_x64.cpp.

◆ write() [2/2]

void serial_port_intel_x64::write ( const std::string &  str)
inlinenoexcept

Write String

Writes a string to the serial device.

Precondition
expects: none
Postcondition
ensures: none
Parameters
strstring to write

Definition at line 271 of file serial_port_intel_x64.h.

◆ operator=() [1/2]

serial_port_intel_x64& serial_port_intel_x64::operator= ( serial_port_intel_x64 &&  )
defaultnoexcept

◆ operator=() [2/2]

serial_port_intel_x64& serial_port_intel_x64::operator= ( const serial_port_intel_x64 )
delete

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