11#ifndef __DEV_SERIAL_V2_H__
12#define __DEV_SERIAL_V2_H__
132#define BAUD_RATE_2400 2400
133#define BAUD_RATE_4800 4800
134#define BAUD_RATE_9600 9600
135#define BAUD_RATE_19200 19200
136#define BAUD_RATE_38400 38400
137#define BAUD_RATE_57600 57600
138#define BAUD_RATE_115200 115200
139#define BAUD_RATE_230400 230400
140#define BAUD_RATE_460800 460800
141#define BAUD_RATE_500000 500000
142#define BAUD_RATE_921600 921600
143#define BAUD_RATE_2000000 2000000
144#define BAUD_RATE_2500000 2500000
145#define BAUD_RATE_3000000 3000000
166#define BIT_ORDER_LSB 0
167#define BIT_ORDER_MSB 1
170#define NRZ_INVERTED 1
172#define RT_DEVICE_FLAG_RX_BLOCKING 0x1000
173#define RT_DEVICE_FLAG_RX_NON_BLOCKING 0x2000
175#define RT_DEVICE_FLAG_TX_BLOCKING 0x4000
176#define RT_DEVICE_FLAG_TX_NON_BLOCKING 0x8000
178#define RT_SERIAL_RX_BLOCKING RT_DEVICE_FLAG_RX_BLOCKING
179#define RT_SERIAL_RX_NON_BLOCKING RT_DEVICE_FLAG_RX_NON_BLOCKING
180#define RT_SERIAL_TX_BLOCKING RT_DEVICE_FLAG_TX_BLOCKING
181#define RT_SERIAL_TX_NON_BLOCKING RT_DEVICE_FLAG_TX_NON_BLOCKING
183#define RT_DEVICE_CHECK_OPTMODE 0x20
185#define RT_SERIAL_EVENT_RX_IND 0x01
186#define RT_SERIAL_EVENT_TX_DONE 0x02
187#define RT_SERIAL_EVENT_RX_DMADONE 0x03
188#define RT_SERIAL_EVENT_TX_DMADONE 0x04
189#define RT_SERIAL_EVENT_RX_TIMEOUT 0x05
191#define RT_SERIAL_ERR_OVERRUN 0x01
192#define RT_SERIAL_ERR_FRAMING 0x02
193#define RT_SERIAL_ERR_PARITY 0x03
195#define RT_SERIAL_TX_DATAQUEUE_SIZE 2048
196#define RT_SERIAL_TX_DATAQUEUE_LWM 30
198#define RT_SERIAL_RX_MINBUFSZ 64
199#define RT_SERIAL_TX_MINBUFSZ 64
201#define RT_SERIAL_TX_BLOCKING_BUFFER 1
202#define RT_SERIAL_TX_BLOCKING_NO_BUFFER 0
204#define RT_SERIAL_FLOWCONTROL_CTSRTS 1
205#define RT_SERIAL_FLOWCONTROL_NONE 0
208#define RT_SERIAL_CONFIG_DEFAULT \
216 RT_SERIAL_RX_MINBUFSZ, \
217 RT_SERIAL_TX_MINBUFSZ, \
218 RT_SERIAL_FLOWCONTROL_NONE, \
249 struct rt_ringbuffer
rb;
265 struct rt_ringbuffer
rb;
301 struct serial_configure *cfg);
307 int (*
putc)(
struct rt_serial_device *serial,
char c);
308 int (*
getc)(
struct rt_serial_device *serial);
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
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
void rt_hw_serial_isr(struct rt_serial_device *serial, int event)
Serial interrupt service routine
void(* rt_hw_serial_rxind_hookproto_t)(rt_device_t dev, rt_size_t size)
Sets a hook function when RX indicate is called
unsigned short rt_uint16_t
const struct rt_uart_ops * ops
struct rt_device_notify rx_notify
struct serial_configure config
struct rt_completion rx_cpt
Serial Transmit FIFO mode
struct rt_completion tx_cpt
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)
int(* getc)(struct rt_serial_device *serial)
int(* putc)(struct rt_serial_device *serial, char c)
rt_ssize_t(* transmit)(struct rt_serial_device *serial, rt_uint8_t *buf, rt_size_t size, rt_uint32_t tx_flag)