18#define ro(...) __attribute__((access(read_only, __VA_ARGS__)))
19#define rw(...) __attribute__((access(read_write, __VA_ARGS__)))
20#define wo(...) __attribute__((access(write_only, __VA_ARGS__)))
31 SERIAL_BITRATE_300 = 0,
32 SERIAL_BITRATE_1200 = 1,
33 SERIAL_BITRATE_2400 = 2,
34 SERIAL_BITRATE_4800 = 3,
35 SERIAL_BITRATE_9600 = 5,
36 SERIAL_BITRATE_19200 = 6,
37 SERIAL_BITRATE_38400 = 7,
38 SERIAL_BITRATE_57600 = 8,
39 SERIAL_BITRATE_115200 = 9
43 SERIAL_PARITY_NONE = 0,
44 SERIAL_PARITY_ODD = 1,
45 SERIAL_PARITY_EVEN = 2
48enum Serial_Data_Length {
49 SERIAL_DATA_LENGTH_8BIT = 0,
50 SERIAL_DATA_LENGTH_7BIT = 1
53enum Serial_Stop_Bits {
54 SERIAL_STOP_BITS_1 = 0,
55 SERIAL_STOP_BITS_2 = 1
58struct __attribute__((packed)) Serial_Settings {
60 enum Serial_Bitrate bitrate : 8;
61 enum Serial_Parity parity : 8;
62 enum Serial_Data_Length data_length : 8;
63 enum Serial_Stop_Bits stop_bits : 8;
83extern int (*
Serial_Open)(
const struct Serial_Settings *mode) ro(1);
85extern int (*Serial_IsOpen)(void);
87extern int (*Serial_Close)(
bool abortPending);
89extern int (*Serial_Read)(
unsigned char *out,
int sz,
short *count) wo(1, 2) wo(3);
91extern int (*Serial_ReadSingle)(
unsigned char *out) wo(1);
93extern int (*Serial_Peek)(
int idx,
unsigned char *out) wo(1);
95extern int (*Serial_PollRX)(void);
97extern int (*Serial_ClearRX)(void);
106extern int (*
Serial_Write)(
const unsigned char *buf,
int count) ro(1, 2);
108extern int (*Serial_WriteSingle)(
unsigned char x);
110extern int (*Serial_WriteUnbuffered)(
unsigned char x);
112extern int (*Serial_PollTX)(void);
114extern int (*Serial_ClearTX)(void);
int(* Serial_Write)(const unsigned char *buf, int count) ro(1
int(* Serial_Open)(const struct Serial_Settings *mode) ro(1)