MOS Source Code
Loading...
Searching...
No Matches
serial.c File Reference
#include "mos/device/serial.h"
#include <mos/mos_global.h>
#include <mos/syslog/printk.h>
+ Include dependency graph for serial.c:

Go to the source code of this file.

Enumerations

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
}
 

Functions

static void set_baudrate_divisor (serial_device_t *dev)
 
static void set_data_bits (serial_device_t *dev)
 
static void set_stop_bits (serial_device_t *dev)
 
static void set_parity (serial_device_t *dev, serial_parity_t parity)
 
static void serial_set_interrupts (serial_device_t *dev, int interrupts)
 
static void serial_set_modem_options (serial_device_t *dev, serial_modem_control_t control, bool enable)
 
static char serial_get_line_status (serial_device_t *dev)
 
static __maybe_unused char serial_get_modem_status (serial_device_t *dev)
 
bool serial_device_setup (serial_device_t *device)
 
bool serial_dev_get_data_ready (serial_device_t *device)
 
static void serial_dev_wait_ready_to_read (serial_device_t *device)
 
static void serial_dev_wait_ready_to_write (serial_device_t *device)
 
int serial_device_write (serial_device_t *device, const char *data, size_t length)
 
int serial_device_read (serial_device_t *device, char *data, size_t length)
 

Enumeration Type Documentation

◆ serial_modem_status_t

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 8 of file serial.c.

◆ serial_modem_control_t

Enumerator
MODEM_DTR 
MODEM_RTS 
MODEM_UNUSED_PIN1 
MODEM_IRQ 
MODEM_LOOP 

Definition at line 20 of file serial.c.

◆ serial_line_status_t

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 29 of file serial.c.

Function Documentation

◆ set_baudrate_divisor()

static void set_baudrate_divisor ( serial_device_t * dev)
static

Definition at line 41 of file serial.c.

Referenced by serial_device_setup().

◆ set_data_bits()

static void set_data_bits ( serial_device_t * dev)
static

Definition at line 60 of file serial.c.

Referenced by serial_device_setup().

◆ set_stop_bits()

static void set_stop_bits ( serial_device_t * dev)
static

Definition at line 67 of file serial.c.

Referenced by serial_device_setup().

◆ set_parity()

static void set_parity ( serial_device_t * dev,
serial_parity_t parity )
static

Definition at line 74 of file serial.c.

Referenced by serial_device_setup().

◆ serial_set_interrupts()

static void serial_set_interrupts ( serial_device_t * dev,
int interrupts )
static

Definition at line 81 of file serial.c.

Referenced by serial_device_setup().

◆ serial_set_modem_options()

static void serial_set_modem_options ( serial_device_t * dev,
serial_modem_control_t control,
bool enable )
static

Definition at line 88 of file serial.c.

Referenced by serial_device_setup().

◆ serial_get_line_status()

static char serial_get_line_status ( serial_device_t * dev)
static

Definition at line 102 of file serial.c.

Referenced by serial_dev_get_data_ready(), and serial_dev_wait_ready_to_write().

◆ serial_get_modem_status()

static __maybe_unused char serial_get_modem_status ( serial_device_t * dev)
static

Definition at line 107 of file serial.c.

◆ serial_device_setup()

bool serial_device_setup ( serial_device_t * device)

Definition at line 112 of file serial.c.

Referenced by serial_console_setup().

+ Here is the call graph for this function:

◆ serial_dev_get_data_ready()

bool serial_dev_get_data_ready ( serial_device_t * device)

Definition at line 141 of file serial.c.

Referenced by serial_console_irq_handler(), and serial_dev_wait_ready_to_read().

+ Here is the call graph for this function:

◆ serial_dev_wait_ready_to_read()

static void serial_dev_wait_ready_to_read ( serial_device_t * device)
static

Definition at line 146 of file serial.c.

Referenced by serial_device_read().

+ Here is the call graph for this function:

◆ serial_dev_wait_ready_to_write()

static void serial_dev_wait_ready_to_write ( serial_device_t * device)
static

Definition at line 152 of file serial.c.

Referenced by serial_device_write().

+ Here is the call graph for this function:

◆ serial_device_write()

int serial_device_write ( serial_device_t * device,
const char * data,
size_t length )

Definition at line 158 of file serial.c.

Referenced by serial_console_clear(), serial_console_irq_handler(), serial_console_set_color(), serial_console_write(), and serial_device_setup().

+ Here is the call graph for this function:

◆ serial_device_read()

int serial_device_read ( serial_device_t * device,
char * data,
size_t length )

Definition at line 169 of file serial.c.

Referenced by serial_console_irq_handler(), and serial_device_setup().

+ Here is the call graph for this function: