Serial Line Driver

The serial line driver is implemented in os/drivers/serial/serial_line.c

Implements a simple serial line driver. It provides means for outputting data via serial port, and it provides an interrupt handler to pass received data as an EV_SERIAL to the input subsystem.

Initialization

This driver is initialized by calling

void serial_line_init(void)

Initialize the serial line.

^ Back to top.

Allocating a Serial Line

A serial line is allocated by calling

serial_line_t *serial_line_alloc(void)

Allocate a serial line data structure.

^ Back to top.

Serial Line Operations

This driver implements the serial line operations (serial_line_operations_t):

Open

Implements the operation serial_line_operations_t.open:

static int __serial_line_open(serial_line_t *sl)

Open the serial line sl.

Returns:

0 on success

Returns:

-EIO on failure

^ Back to top.

Put Character

Implements the operation serial_line_operations_t.putc:

static int __serial_line_putc(serial_line_t *sl, char c)

Write a byte c to the serial line sl.

Returns:

0

^ Back to top.

Input Handling

The serial line registers an interrupt handler on opening the line:

static void __serial_line_isr(void)

Handle interrupts from the serial port.

This handler passes received input as EV_SERIAL events to the input subsystem.

^ Back to top.