14#ifndef __DEV_SERIAL_H__
15#define __DEV_SERIAL_H__
117#define BAUD_RATE_2400 2400
118#define BAUD_RATE_4800 4800
119#define BAUD_RATE_9600 9600
120#define BAUD_RATE_19200 19200
121#define BAUD_RATE_38400 38400
122#define BAUD_RATE_57600 57600
123#define BAUD_RATE_115200 115200
124#define BAUD_RATE_230400 230400
125#define BAUD_RATE_460800 460800
126#define BAUD_RATE_500000 500000
127#define BAUD_RATE_576000 576000
128#define BAUD_RATE_921600 921600
129#define BAUD_RATE_1000000 1000000
130#define BAUD_RATE_1152000 1152000
131#define BAUD_RATE_1500000 1500000
132#define BAUD_RATE_2000000 2000000
133#define BAUD_RATE_2500000 2500000
134#define BAUD_RATE_3000000 3000000
135#define BAUD_RATE_3500000 3500000
136#define BAUD_RATE_4000000 4000000
157#define BIT_ORDER_LSB 0
158#define BIT_ORDER_MSB 1
161#define NRZ_INVERTED 1
163#ifndef RT_SERIAL_RB_BUFSZ
164#define RT_SERIAL_RB_BUFSZ 64
167#define RT_SERIAL_EVENT_RX_IND 0x01
168#define RT_SERIAL_EVENT_TX_DONE 0x02
169#define RT_SERIAL_EVENT_RX_DMADONE 0x03
170#define RT_SERIAL_EVENT_TX_DMADONE 0x04
171#define RT_SERIAL_EVENT_RX_TIMEOUT 0x05
173#define RT_SERIAL_DMA_RX 0x01
174#define RT_SERIAL_DMA_TX 0x02
176#define RT_SERIAL_RX_INT 0x01
177#define RT_SERIAL_TX_INT 0x02
179#define RT_SERIAL_ERR_OVERRUN 0x01
180#define RT_SERIAL_ERR_FRAMING 0x02
181#define RT_SERIAL_ERR_PARITY 0x03
183#define RT_SERIAL_TX_DATAQUEUE_SIZE 2048
184#define RT_SERIAL_TX_DATAQUEUE_LWM 30
186#define RT_SERIAL_FLOWCONTROL_CTSRTS 1
187#define RT_SERIAL_FLOWCONTROL_NONE 0
190#define RT_SERIAL_CONFIG_DEFAULT \
198 RT_SERIAL_RB_BUFSZ, \
199 RT_SERIAL_FLOWCONTROL_NONE, \
267#ifdef RT_USING_SERIAL_BYPASS
struct rt_device * rt_device_t
#define RT_OBJECT_HOOKLIST_DECLARE(handler_type, name)
rt_err_t rt_hw_serial_register(struct rt_serial_device *serial, const char *name, rt_uint32_t flag, void *data)
Register a serial device to device list
void(* rt_hw_serial_rxind_hookproto_t)(rt_device_t dev, rt_size_t size)
Sets a hook function when RX indicate is called
rt_err_t rt_hw_serial_register_tty(struct rt_serial_device *serial)
register a serial device to system device list and add a device object to system object list
struct rt_serial_device rt_serial_t
void rt_hw_serial_isr(struct rt_serial_device *serial, int event)
Serial interrupt service routine
unsigned short rt_uint16_t
const struct rt_uart_ops * ops
struct rt_device_notify rx_notify
struct rt_spinlock spinlock
struct serial_configure config
struct rt_data_queue data_queue
Serial Transmit FIFO mode
struct rt_completion completion
Configure the serial device
rt_err_t(* configure)(struct rt_serial_device *serial, struct serial_configure *cfg)
rt_err_t(* control)(struct rt_serial_device *serial, int cmd, void *arg)
rt_ssize_t(* dma_transmit)(struct rt_serial_device *serial, rt_uint8_t *buf, rt_size_t size, int direction)
int(* getc)(struct rt_serial_device *serial)
int(* putc)(struct rt_serial_device *serial, char c)