PebbleOS v4.47.0-512-g5285d4236
Loading...
Searching...
No Matches
uart.h File Reference
#include <stdatomic.h>
#include <stdbool.h>
#include <stdint.h>
#include <pbl/device.h>

Data Structures

struct  pbl_uart_config
 Line settings. More...
 
struct  pbl_uart_ops
 Port driver operations. More...
 
struct  pbl_uart
 A serial port. More...
 

Macros

#define PBL_UART_STATE_DEFINE(sym)
 Define the class state of port sym, for the PBL_UART_*_DEFINE() macro of a driver.
 
#define PBL_UART_INIT(sym, _name, _parent, _ops, _baudrate)
 Initializer for the struct pbl_uart of port sym.
 

Typedefs

typedef void(* pbl_uart_rx_callback_t) (const struct pbl_uart *uart, uint8_t c, void *arg)
 Receive callback, called from the port's interrupt for each received byte.
 

Enumerations

enum  pbl_uart_parity { PBL_UART_PARITY_NONE , PBL_UART_PARITY_ODD , PBL_UART_PARITY_EVEN }
 Parity. More...
 
enum  pbl_uart_flow_ctrl { PBL_UART_FLOW_CTRL_NONE , PBL_UART_FLOW_CTRL_RTS_CTS }
 Flow control. More...
 

Functions

int pbl_uart_dev_init (const struct pbl_device *dev)
 Device init of every port: calls the driver's init, then applies the line settings, the early console's if the port was one.
 
bool pbl_uart_receive (const struct pbl_uart *uart, uint8_t c)
 Hand a received byte to the receive callback.
 
int pbl_uart_early_init (const struct pbl_uart *uart, const struct pbl_uart_config *cfg)
 Set a port up as an early console, for polled transmission before its device init.
 
int pbl_uart_configure (const struct pbl_uart *uart, const struct pbl_uart_config *cfg)
 Apply line settings.
 
int pbl_uart_config_get (const struct pbl_uart *uart, struct pbl_uart_config *cfg)
 Get the line settings.
 
void pbl_uart_poll_out (const struct pbl_uart *uart, uint8_t c)
 Send a byte, waiting for room.
 
void pbl_uart_flush (const struct pbl_uart *uart)
 Wait until the bytes sent have left the port.
 
int pbl_uart_rx_enable (const struct pbl_uart *uart, pbl_uart_rx_callback_t cb, void *arg)
 Enable reception.
 
int pbl_uart_rx_disable (const struct pbl_uart *uart)
 Disable reception.
 

Variables

const struct pbl_device_class pbl_uart_class
 Class of the serial ports.
 
const struct pbl_uart *const CONSOLE_UART
 The board's console port.
 
const struct pbl_uart *const QEMU_UART
 The board's port to the host of the QEMU serial protocol.
 
const struct pbl_uart *const BT_HCI_UART
 The board's Bluetooth HCI port, with CONFIG_NIMBLE_HCI_UART.