PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
com.h File Reference
#include <stdint.h>
Include dependency graph for com.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  com_port_t {
  COM1 = 0x3F8 , COM2 = 0x2F8 , COM3 = 0x3E8 , COM4 = 0x2E8 ,
  COM5 = 0x5F8 , COM6 = 0x4F8 , COM7 = 0x5E8 , COM8 = 0x48E
}
 
enum  com_reg_t {
  COM_REG_RECEIVE = 0 , COM_REG_TRANSMIT = 0 , COM_REG_INTERRUPT_ENABLE = 1 , COM_REG_BAUD_LOW = 0 ,
  COM_REG_BAUD_HIGH = 1 , COM_REG_INTERRUPT_ID = 2 , COM_REG_FIFO_CONTROL = 2 , COM_REG_LINE_CONTROL = 3 ,
  COM_REG_MODEM_CONTROL = 4 , COM_REG_LINE_STATUS = 5 , COM_REG_MODEM_STATUS = 6 , COM_REG_SCRATCH = 7
}
 
enum  com_line_control_t {
  COM_LINE_SIZE_5 = 0 , COM_LINE_SIZE_6 = 1 , COM_LINE_SIZE_7 = 2 , COM_LINE_SIZE_8 = 3 ,
  COM_LINE_DLAB = 1 << 7
}
 
enum  com_modem_control_t {
  COM_MODEM_DTR = 1 << 0 , COM_MODEM_RTS = 1 << 1 , COM_MODEM_OUT1 = 1 << 2 , COM_MODEM_OUT2 = 1 << 3 ,
  COM_MODEM_LOOP = 1 << 4
}
 
enum  com_line_status_t { COM_LINE_READ_READY = 1 << 0 , COM_LINE_WRITE_READY = 1 << 5 }
 

Functions

void com_init (com_port_t port)
 
uint8_t com_read (com_port_t port)
 
void com_write (com_port_t port, uint8_t value)
 
uint8_t com_reg_read (com_port_t port, com_reg_t reg)
 
void com_reg_write (com_port_t port, com_reg_t reg, uint8_t value)
 

Enumeration Type Documentation

◆ com_port_t

enum com_port_t
Enumerator
COM1 
COM2 
COM3 
COM4 
COM5 
COM6 
COM7 
COM8 

Definition at line 5 of file com.h.

◆ com_reg_t

enum com_reg_t
Enumerator
COM_REG_RECEIVE 
COM_REG_TRANSMIT 
COM_REG_INTERRUPT_ENABLE 
COM_REG_BAUD_LOW 
COM_REG_BAUD_HIGH 
COM_REG_INTERRUPT_ID 
COM_REG_FIFO_CONTROL 
COM_REG_LINE_CONTROL 
COM_REG_MODEM_CONTROL 
COM_REG_LINE_STATUS 
COM_REG_MODEM_STATUS 
COM_REG_SCRATCH 

Definition at line 17 of file com.h.

◆ com_line_control_t

Enumerator
COM_LINE_SIZE_5 
COM_LINE_SIZE_6 
COM_LINE_SIZE_7 
COM_LINE_SIZE_8 
COM_LINE_DLAB 

Definition at line 33 of file com.h.

◆ com_modem_control_t

Enumerator
COM_MODEM_DTR 
COM_MODEM_RTS 
COM_MODEM_OUT1 
COM_MODEM_OUT2 
COM_MODEM_LOOP 

Definition at line 42 of file com.h.

◆ com_line_status_t

Enumerator
COM_LINE_READ_READY 
COM_LINE_WRITE_READY 

Definition at line 51 of file com.h.

Function Documentation

◆ com_init()

void com_init ( com_port_t  port)

Definition at line 4 of file com.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ com_read()

uint8_t com_read ( com_port_t  port)

Definition at line 14 of file com.c.

Here is the call graph for this function:

◆ com_write()

void com_write ( com_port_t  port,
uint8_t  value 
)

Definition at line 23 of file com.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ com_reg_read()

uint8_t com_reg_read ( com_port_t  port,
com_reg_t  reg 
)

Definition at line 32 of file com.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ com_reg_write()

void com_reg_write ( com_port_t  port,
com_reg_t  reg,
uint8_t  value 
)

Definition at line 37 of file com.c.

Here is the call graph for this function:
Here is the caller graph for this function: