rtserial.h

Go to the documentation of this file.
00001 
00077 #ifndef _RTSERIAL_H
00078 #define _RTSERIAL_H
00079 
00080 #include <asm/types.h>
00081 #include <rtdm/rtdm.h>
00082 
00087 #define RTSER_50_BAUD               2304
00088 #define RTSER_75_BAUD               1536
00089 #define RTSER_110_BAUD              1047
00090 #define RTSER_134_5_BAUD            857
00091 #define RTSER_150_BAUD              768
00092 #define RTSER_300_BAUD              384
00093 #define RTSER_600_BAUD              192
00094 #define RTSER_1200_BAUD             96
00095 #define RTSER_2400_BAUD             48
00096 #define RTSER_3600_BAUD             32
00097 #define RTSER_4800_BAUD             24
00098 #define RTSER_7200_BAUD             16
00099 #define RTSER_9600_BAUD             12
00100 #define RTSER_19200_BAUD            6
00101 #define RTSER_38400_BAUD            3
00102 #define RTSER_57600_BAUD            2
00103 #define RTSER_115200_BAUD           1
00104 #define RTSER_DEF_BAUD              RTSER_9600_BAUD
00105 
00110 #define RTSER_CUSTOM_BAUD(base, rate) \
00111     ((base + (rate >> 1)) / rate)
00112 
00118 #define RTSER_NO_PARITY             0x00
00119 #define RTSER_ODD_PARITY            0x01
00120 #define RTSER_EVEN_PARITY           0x03
00121 #define RTSER_DEF_PARITY            RTSER_NO_PARITY
00122 
00128 #define RTSER_5_BITS                0x00
00129 #define RTSER_6_BITS                0x01
00130 #define RTSER_7_BITS                0x02
00131 #define RTSER_8_BITS                0x03
00132 #define RTSER_DEF_BITS              RTSER_8_BITS
00133 
00139 #define RTSER_1_STOPB               0x00
00140 
00141 #define RTSER_1_5_STOPB             0x01
00142 #define RTSER_2_STOPB               0x01
00143 #define RTSER_DEF_STOPB             RTSER_1_STOPB
00144 
00150 #define RTSER_NO_HAND               0x00
00151 #define RTSER_RTSCTS_HAND           0x01
00152 #define RTSER_DEF_HAND              RTSER_NO_HAND
00153 
00159 #define RTSER_FIFO_DEPTH_1          0x00
00160 #define RTSER_FIFO_DEPTH_4          0x40
00161 #define RTSER_FIFO_DEPTH_8          0x80
00162 #define RTSER_FIFO_DEPTH_14         0xC0
00163 #define RTSER_DEF_FIFO_DEPTH        RTSER_FIFO_DEPTH_1
00164 
00170 #define RTSER_TIMEOUT_INFINITE      0
00171 #define RTSER_TIMEOUT_NONE          (-1)
00172 #define RTSER_DEF_TIMEOUT           RTSER_TIMEOUT_INFINITE
00173 
00179 #define RTSER_RX_TIMESTAMP_HISTORY  0x01
00180 #define RTSER_DEF_TIMESTAMP_HISTORY 0x00
00181 
00188 #define RTSER_SET_BAUD              0x0001
00189 #define RTSER_SET_PARITY            0x0002
00190 #define RTSER_SET_DATA_BITS         0x0004
00191 #define RTSER_SET_STOP_BITS         0x0008
00192 #define RTSER_SET_HANDSHAKE         0x0010
00193 #define RTSER_SET_FIFO_DEPTH        0x0020
00194 #define RTSER_SET_TIMEOUT_RX        0x0100
00195 #define RTSER_SET_TIMEOUT_TX        0x0200
00196 #define RTSER_SET_TIMEOUT_EVENT     0x0400
00197 #define RTSER_SET_TIMESTAMP_HISTORY 0x0800
00198 
00205 #define RTSER_LSR_DATA              0x01
00206 #define RTSER_LSR_OVERRUN_ERR       0x02
00207 #define RTSER_LSR_PARITY_ERR        0x04
00208 #define RTSER_LSR_FRAMING_ERR       0x08
00209 #define RTSER_LSR_BREAK_IND         0x10
00210 #define RTSER_LSR_THR_EMTPY         0x20
00211 #define RTSER_LSR_TRANSM_EMPTY      0x40
00212 #define RTSER_LSR_FIFO_ERR          0x80
00213 #define RTSER_SOFT_OVERRUN_ERR      0x0100
00214 
00221 #define RTSER_MSR_DCTS              0x01
00222 #define RTSER_MSR_DDSR              0x02
00223 #define RTSER_MSR_TERI              0x04
00224 #define RTSER_MSR_DDCD              0x08
00225 #define RTSER_MSR_CTS               0x10
00226 #define RTSER_MSR_DSR               0x20
00227 #define RTSER_MSR_RI                0x40
00228 #define RTSER_MSR_DCD               0x80
00229 
00236 #define RTSER_MCR_DTR               0x01
00237 #define RTSER_MCR_RTS               0x02
00238 #define RTSER_MCR_OUT1              0x04
00239 #define RTSER_MCR_OUT2              0x08
00240 #define RTSER_MCR_LOOP              0x10
00241 
00248 #define RTSER_EVENT_RXPEND          0x01
00249 #define RTSER_EVENT_ERRPEND         0x02
00250 #define RTSER_EVENT_MODEMHI         0x04
00251 #define RTSER_EVENT_MODEMLO         0x08
00252 
00258 typedef struct rtser_config {
00259     int     config_mask;        
00261     int     baud_rate;          
00262     int     parity;             
00264     int     data_bits;          
00266     int     stop_bits;          
00268     int     handshake;          
00270     int     fifo_depth;         
00272     __s64   rx_timeout;         
00275     __s64   tx_timeout;         
00278     __s64   event_timeout;      
00281     int     timestamp_history;  
00283 } rtser_config_t;
00284 
00288 typedef struct rtser_status {
00289     int     line_status;    
00291     int     modem_status;   
00293 } rtser_status_t;
00294 
00298 typedef struct rtser_event {
00299     int     events;             
00301     int     rx_pending;         
00302     __u64   last_timestamp;     
00304     __u64   rxpend_timestamp;   
00306 } rtser_event_t;
00307 
00308 
00309 #define RTIOC_TYPE_SERIAL           RTDM_CLASS_SERIAL
00310 
00311 
00315 #define RTDM_SUBCLASS_16550A        0
00316 
00341 #define RTSER_RTIOC_GET_CONFIG      \
00342     _IOR(RTIOC_TYPE_SERIAL, 0x00, struct rtser_config)
00343 
00371 #define RTSER_RTIOC_SET_CONFIG      \
00372     _IOW(RTIOC_TYPE_SERIAL, 0x01, struct rtser_config)
00373 
00391 #define RTSER_RTIOC_GET_STATUS      \
00392     _IOR(RTIOC_TYPE_SERIAL, 0x02, struct rtser_status)
00393 
00412 #define RTSER_RTIOC_GET_CONTROL     \
00413     _IOR(RTIOC_TYPE_SERIAL, 0x03, int)
00414 
00432 #define RTSER_RTIOC_SET_CONTROL     \
00433     _IOW(RTIOC_TYPE_SERIAL, 0x04, int)
00434 
00452 #define RTSER_RTIOC_SET_EVENT_MASK  \
00453     _IOW(RTIOC_TYPE_SERIAL, 0x05, int)
00454 
00477 #define RTSER_RTIOC_WAIT_EVENT      \
00478     _IOR(RTIOC_TYPE_SERIAL, 0x06, struct rtser_event)
00479 
00483 #endif /* _RTSERIAL_H */

Generated on Sat Sep 3 12:32:47 2005 for RTAI Fusion API by  doxygen 1.4.2