Xenomai  3.0.5
serial.h
Go to the documentation of this file.
1 
23 #ifndef _RTDM_UAPI_SERIAL_H
24 #define _RTDM_UAPI_SERIAL_H
25 
26 #define RTSER_PROFILE_VER 3
27 
32 #define RTSER_DEF_BAUD 9600
33 
39 #define RTSER_NO_PARITY 0x00
40 #define RTSER_ODD_PARITY 0x01
41 #define RTSER_EVEN_PARITY 0x03
42 #define RTSER_DEF_PARITY RTSER_NO_PARITY
43 
49 #define RTSER_5_BITS 0x00
50 #define RTSER_6_BITS 0x01
51 #define RTSER_7_BITS 0x02
52 #define RTSER_8_BITS 0x03
53 #define RTSER_DEF_BITS RTSER_8_BITS
54 
60 #define RTSER_1_STOPB 0x00
61 
62 #define RTSER_1_5_STOPB 0x01
63 #define RTSER_2_STOPB 0x01
64 #define RTSER_DEF_STOPB RTSER_1_STOPB
65 
71 #define RTSER_NO_HAND 0x00
72 #define RTSER_RTSCTS_HAND 0x01
73 #define RTSER_DEF_HAND RTSER_NO_HAND
74 
80 #define RTSER_RS485_DISABLE 0x00
81 #define RTSER_RS485_ENABLE 0x01
82 #define RTSER_DEF_RS485 RTSER_RS485_DISABLE
83 
89 #define RTSER_FIFO_DEPTH_1 0x00
90 #define RTSER_FIFO_DEPTH_4 0x40
91 #define RTSER_FIFO_DEPTH_8 0x80
92 #define RTSER_FIFO_DEPTH_14 0xC0
93 #define RTSER_DEF_FIFO_DEPTH RTSER_FIFO_DEPTH_1
94 
100 #define RTSER_TIMEOUT_INFINITE RTDM_TIMEOUT_INFINITE
101 #define RTSER_TIMEOUT_NONE RTDM_TIMEOUT_NONE
102 #define RTSER_DEF_TIMEOUT RTDM_TIMEOUT_INFINITE
103 
109 #define RTSER_RX_TIMESTAMP_HISTORY 0x01
110 #define RTSER_DEF_TIMESTAMP_HISTORY 0x00
111 
117 #define RTSER_EVENT_RXPEND 0x01
118 #define RTSER_EVENT_ERRPEND 0x02
119 #define RTSER_EVENT_MODEMHI 0x04
120 #define RTSER_EVENT_MODEMLO 0x08
121 #define RTSER_EVENT_TXEMPTY 0x10
122 #define RTSER_DEF_EVENT_MASK 0x00
123 
130 #define RTSER_SET_BAUD 0x0001
131 #define RTSER_SET_PARITY 0x0002
132 #define RTSER_SET_DATA_BITS 0x0004
133 #define RTSER_SET_STOP_BITS 0x0008
134 #define RTSER_SET_HANDSHAKE 0x0010
135 #define RTSER_SET_FIFO_DEPTH 0x0020
136 #define RTSER_SET_TIMEOUT_RX 0x0100
137 #define RTSER_SET_TIMEOUT_TX 0x0200
138 #define RTSER_SET_TIMEOUT_EVENT 0x0400
139 #define RTSER_SET_TIMESTAMP_HISTORY 0x0800
140 #define RTSER_SET_EVENT_MASK 0x1000
141 #define RTSER_SET_RS485 0x2000
142 
149 #define RTSER_LSR_DATA 0x01
150 #define RTSER_LSR_OVERRUN_ERR 0x02
151 #define RTSER_LSR_PARITY_ERR 0x04
152 #define RTSER_LSR_FRAMING_ERR 0x08
153 #define RTSER_LSR_BREAK_IND 0x10
154 #define RTSER_LSR_THR_EMTPY 0x20
155 #define RTSER_LSR_TRANSM_EMPTY 0x40
156 #define RTSER_LSR_FIFO_ERR 0x80
157 #define RTSER_SOFT_OVERRUN_ERR 0x0100
158 
165 #define RTSER_MSR_DCTS 0x01
166 #define RTSER_MSR_DDSR 0x02
167 #define RTSER_MSR_TERI 0x04
168 #define RTSER_MSR_DDCD 0x08
169 #define RTSER_MSR_CTS 0x10
170 #define RTSER_MSR_DSR 0x20
171 #define RTSER_MSR_RI 0x40
172 #define RTSER_MSR_DCD 0x80
173 
180 #define RTSER_MCR_DTR 0x01
181 #define RTSER_MCR_RTS 0x02
182 #define RTSER_MCR_OUT1 0x04
183 #define RTSER_MCR_OUT2 0x08
184 #define RTSER_MCR_LOOP 0x10
185 
192 #define RTSER_BREAK_CLR 0x00
193 #define RTSER_BREAK_SET 0x01
194 
195 
199 typedef struct rtser_config {
202 
205 
207  int parity;
208 
211 
214 
217 
220 
221  int reserved;
222 
226 
230 
233 
236 
240 
242  int rs485;
244 
248 typedef struct rtser_status {
251 
255 
259 typedef struct rtser_event {
261  int events;
262 
265 
268 
271 } rtser_event_t;
272 
273 
274 #define RTIOC_TYPE_SERIAL RTDM_CLASS_SERIAL
275 
276 
280 #define RTDM_SUBCLASS_16550A 0
281 
298 #define RTSER_RTIOC_GET_CONFIG \
299  _IOR(RTIOC_TYPE_SERIAL, 0x00, struct rtser_config)
300 
320 #define RTSER_RTIOC_SET_CONFIG \
321  _IOW(RTIOC_TYPE_SERIAL, 0x01, struct rtser_config)
322 
338 #define RTSER_RTIOC_GET_STATUS \
339  _IOR(RTIOC_TYPE_SERIAL, 0x02, struct rtser_status)
340 
351 #define RTSER_RTIOC_GET_CONTROL \
352  _IOR(RTIOC_TYPE_SERIAL, 0x03, int)
353 
363 #define RTSER_RTIOC_SET_CONTROL \
364  _IOW(RTIOC_TYPE_SERIAL, 0x04, int)
365 
381 #define RTSER_RTIOC_WAIT_EVENT \
382  _IOR(RTIOC_TYPE_SERIAL, 0x05, struct rtser_event)
383 
397 #define RTSER_RTIOC_BREAK_CTL \
398  _IOR(RTIOC_TYPE_SERIAL, 0x06, int)
399 
407 #endif /* !_RTDM_UAPI_SERIAL_H */
nanosecs_rel_t tx_timeout
transmission timeout, see RTSER_TIMEOUT_xxx for special values
Definition: serial.h:229
int event_mask
event mask to be used with RTSER_RTIOC_WAIT_EVENT, see RTSER_EVENT_xxx
Definition: serial.h:239
nanosecs_rel_t rx_timeout
reception timeout, see RTSER_TIMEOUT_xxx for special values
Definition: serial.h:225
Serial device configuration.
Definition: serial.h:199
int64_t nanosecs_rel_t
RTDM type for representing relative intervals.
Definition: rtdm.h:49
struct rtser_status rtser_status_t
Serial device status.
Serial device status.
Definition: serial.h:248
nanosecs_abs_t last_timestamp
last interrupt timestamp
Definition: serial.h:267
int handshake
handshake mechanisms, see RTSER_xxx_HAND
Definition: serial.h:216
int modem_status
modem status register, see RTSER_MSR_xxx
Definition: serial.h:253
int stop_bits
number of stop bits, see RTSER_xxx_STOPB
Definition: serial.h:213
nanosecs_rel_t event_timeout
event timeout, see RTSER_TIMEOUT_xxx for special values
Definition: serial.h:232
int fifo_depth
reception FIFO interrupt threshold, see RTSER_FIFO_xxx
Definition: serial.h:219
uint64_t nanosecs_abs_t
RTDM type for representing absolute dates.
Definition: rtdm.h:43
int config_mask
mask specifying valid fields, see RTSER_SET_xxx
Definition: serial.h:201
nanosecs_abs_t rxpend_timestamp
reception timestamp of oldest character in input queue
Definition: serial.h:270
int data_bits
number of data bits, see RTSER_xxx_BITS
Definition: serial.h:210
int events
signalled events, see RTSER_EVENT_xxx
Definition: serial.h:261
struct rtser_event rtser_event_t
Additional information about serial device events.
int timestamp_history
enable timestamp history, see RTSER_xxx_TIMESTAMP_HISTORY
Definition: serial.h:235
struct rtser_config rtser_config_t
Serial device configuration.
int parity
number of parity bits, see RTSER_xxx_PARITY
Definition: serial.h:207
int rs485
enable RS485 mode, see RTSER_RS485_xxx
Definition: serial.h:242
int line_status
line status register, see RTSER_LSR_xxx
Definition: serial.h:250
int rx_pending
number of pending input characters
Definition: serial.h:264
Additional information about serial device events.
Definition: serial.h:259
int baud_rate
baud rate, default RTSER_DEF_BAUD
Definition: serial.h:204