m2mb API docs  30.00.007
m2mb API sets documentation
m2mb_uart.h
Go to the documentation of this file.
1 /*===============================================================================================*/
2 /* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
28 #ifndef M2M_M2MB_UART_API_H
29 #define M2M_M2MB_UART_API_H
30 
31 /* Global declarations ==========================================================================*/
32 #ifndef NULL
33 #define NULL 0
34 #endif
35 
36 /* Global enums ==============================================================================*/
37 
44 {
74  M2MB_UART_IOCTL_NOF_REQ
75 };
76 
77 /* Global typedefs ==============================================================================*/
78 
85 typedef enum
86 {
89  M2MB_UART_FCTL_MAX
91 
98 typedef enum
99 {
104  M2MB_UART_PARITY_MAX
106 
113 typedef enum
114 {
119  M2MB_UART_STOP_BITS_MAX
121 
128 typedef enum
129 {
134  M2MB_UART_BITS_PER_CHAR_MAX
136 
142 typedef enum
143 {
148 
155 typedef enum
156 {
159  ENUM_TO_INT( M2MB_UART_PIN_VALUE_E )
161 
162 
163 
170 typedef void ( *m2mb_uart_ind_callback )( INT32 fd, M2MB_UART_IND_E uart_event, UINT16 resp_size, void *resp_struct, void *userdata );
171 
178 typedef struct
179 {
180  UINT32 baud_rate;
185  BOOLEAN loopback_mode;
186  UINT16 tx_timeout_ms;
187  UINT16 rx_timeout_ms;
189  void *cb_data;
191 
192 /* Global functions =============================================================================*/
193 
194 /*-----------------------------------------------------------------------------------------------*/
239 /*-----------------------------------------------------------------------------------------------*/
240 INT32 m2mb_uart_open( const CHAR *path, INT32 flags, ... );
241 
242 /*-----------------------------------------------------------------------------------------------*/
276 /*-----------------------------------------------------------------------------------------------*/
277 INT32 m2mb_uart_close( INT32 fd );
278 
279 /*-----------------------------------------------------------------------------------------------*/
510 /*-----------------------------------------------------------------------------------------------*/
511 INT32 m2mb_uart_ioctl( INT32 fd, INT32 request, ... );
512 
513 /*-----------------------------------------------------------------------------------------------*/
560 /*-----------------------------------------------------------------------------------------------*/
561 SSIZE_T m2mb_uart_read( INT32 fd, void *buf, SIZE_T nbyte );
562 
563 /*-----------------------------------------------------------------------------------------------*/
612 /*-----------------------------------------------------------------------------------------------*/
613 SSIZE_T m2mb_uart_write( INT32 fd, const void *buf, SIZE_T nbyte );
614 
615 #endif /* M2M_M2MB_UART_API_H */
616 
m2mb_uart_close
INT32 m2mb_uart_close(INT32 fd)
m2mb_uart_close closes a UART device.
M2MB_UART_CFG_T
UART ioctl configuration.
Definition: m2mb_uart.h:178
M2MB_UART_CFG_T::loopback_mode
BOOLEAN loopback_mode
Definition: m2mb_uart.h:185
M2MB_UART_6_BITS_PER_CHAR
Definition: m2mb_uart.h:131
M2MB_UART_CFG_T::parity_mode
M2MB_UART_PARITY_E parity_mode
Definition: m2mb_uart.h:182
M2MB_UART_BITS_PER_CHAR_E
M2MB_UART_BITS_PER_CHAR_E
UART number of bits per character.
Definition: m2mb_uart.h:128
M2MB_UART_IOCTL_REQUEST
M2MB_UART_IOCTL_REQUEST
UART configuration requests.
Definition: m2mb_uart.h:43
M2MB_UART_LOW_VALUE
Definition: m2mb_uart.h:157
M2MB_UART_IOCTL_GET_RTS_STATE
Definition: m2mb_uart.h:68
M2MB_UART_IOCTL_SET_CFG
Definition: m2mb_uart.h:45
M2MB_UART_IOCTL_SET_DSR
Definition: m2mb_uart.h:71
M2MB_UART_CTSRFR_AUTO_FCTL
Definition: m2mb_uart.h:88
m2mb_uart_open
INT32 m2mb_uart_open(const CHAR *path, INT32 flags,...)
m2mb_uart_open opens a UART device.
M2MB_UART_HIGH_VALUE
Definition: m2mb_uart.h:158
M2MB_UART_5_BITS_PER_CHAR
Definition: m2mb_uart.h:130
M2MB_UART_IOCTL_SET_CB_FN
Definition: m2mb_uart.h:61
M2MB_UART_IOCTL_GET_CFG
Definition: m2mb_uart.h:46
M2MB_UART_IOCTL_GET_BITS_PER_CHAR
Definition: m2mb_uart.h:56
M2MB_UART_FCTL_OFF
Definition: m2mb_uart.h:87
m2mb_uart_read
SSIZE_T m2mb_uart_read(INT32 fd, void *buf, SIZE_T nbyte)
m2mb_uart_read reads data from an open UART device.
M2MB_UART_CFG_T::stop_bits
M2MB_UART_STOP_BITS_E stop_bits
Definition: m2mb_uart.h:183
M2MB_UART_CFG_T::bits_per_char
M2MB_UART_BITS_PER_CHAR_E bits_per_char
Definition: m2mb_uart.h:184
M2MB_UART_CFG_T::rx_timeout_ms
UINT16 rx_timeout_ms
Definition: m2mb_uart.h:187
M2MB_UART_IOCTL_GET_PARITY_MODE
Definition: m2mb_uart.h:52
M2MB_UART_PIN_VALUE_E
M2MB_UART_PIN_VALUE_E
UART pin voltage value.
Definition: m2mb_uart.h:155
M2MB_UART_RX_EV
Definition: m2mb_uart.h:145
M2MB_UART_STOP_BITS_E
M2MB_UART_STOP_BITS_E
UART number of stop bits.
Definition: m2mb_uart.h:113
M2MB_UART_IOCTL_GET_RX_TIMEOUT
Definition: m2mb_uart.h:60
M2MB_UART_1_0_STOP_BITS
Definition: m2mb_uart.h:116
M2MB_UART_CFG_T::cb_data
void * cb_data
Definition: m2mb_uart.h:189
M2MB_UART_2_0_STOP_BITS
Definition: m2mb_uart.h:118
M2MB_UART_CFG_T::flow_control
M2MB_UART_FCTL_E flow_control
Definition: m2mb_uart.h:181
M2MB_UART_1_5_STOP_BITS
Definition: m2mb_uart.h:117
M2MB_UART_TX_EV
Definition: m2mb_uart.h:144
m2mb_uart_ind_callback
void(* m2mb_uart_ind_callback)(INT32 fd, M2MB_UART_IND_E uart_event, UINT16 resp_size, void *resp_struct, void *userdata)
Transmit and receive operation callback type.
Definition: m2mb_uart.h:170
M2MB_UART_NO_PARITY
Definition: m2mb_uart.h:100
M2MB_UART_ODD_PARITY
Definition: m2mb_uart.h:101
M2MB_UART_IOCTL_SET_RX_TIMEOUT
Definition: m2mb_uart.h:59
M2MB_UART_IOCTL_SET_CB_USERDATA
Definition: m2mb_uart.h:63
M2MB_UART_IOCTL_SET_STOP_BITS
Definition: m2mb_uart.h:53
M2MB_UART_CFG_T::cb_fn
m2mb_uart_ind_callback cb_fn
Definition: m2mb_uart.h:188
M2MB_UART_CFG_T::tx_timeout_ms
UINT16 tx_timeout_ms
Definition: m2mb_uart.h:186
M2MB_UART_IOCTL_SET_CTS
Definition: m2mb_uart.h:70
m2mb_uart_write
SSIZE_T m2mb_uart_write(INT32 fd, const void *buf, SIZE_T nbyte)
m2mb_uart_write writes data to an open UART device.
m2mb_uart_ioctl
INT32 m2mb_uart_ioctl(INT32 fd, INT32 request,...)
m2mb_uart_ioctl configures an open UART device.
M2MB_UART_IOCTL_SET_FCTL
Definition: m2mb_uart.h:49
M2MB_UART_IOCTL_GET_CB_FN
Definition: m2mb_uart.h:62
M2MB_UART_IND_E
M2MB_UART_IND_E
UART event type.
Definition: m2mb_uart.h:142
M2MB_UART_IOCTL_SET_BITS_PER_CHAR
Definition: m2mb_uart.h:55
M2MB_UART_SPACE_PARITY
Definition: m2mb_uart.h:103
M2MB_UART_IOCTL_SET_TX_TIMEOUT
Definition: m2mb_uart.h:57
M2MB_UART_8_BITS_PER_CHAR
Definition: m2mb_uart.h:133
M2MB_UART_IOCTL_GET_DTR_STATE
Definition: m2mb_uart.h:69
M2MB_UART_IOCTL_SET_PARITY_MODE
Definition: m2mb_uart.h:51
M2MB_UART_0_5_STOP_BITS
Definition: m2mb_uart.h:115
M2MB_UART_7_BITS_PER_CHAR
Definition: m2mb_uart.h:132
M2MB_UART_IOCTL_SET_RING
Definition: m2mb_uart.h:73
M2MB_UART_IOCTL_SET_POWER_STATE
Definition: m2mb_uart.h:65
M2MB_UART_EVEN_PARITY
Definition: m2mb_uart.h:102
M2MB_UART_FCTL_E
M2MB_UART_FCTL_E
UART flow control type.
Definition: m2mb_uart.h:85
M2MB_UART_IOCTL_GET_OP_MODE
Definition: m2mb_uart.h:67
M2MB_UART_IOCTL_GET_POWER_STATE
Definition: m2mb_uart.h:66
M2MB_UART_IOCTL_GET_BR
Definition: m2mb_uart.h:48
M2MB_UART_IOCTL_SET_DCD
Definition: m2mb_uart.h:72
M2MB_UART_IOCTL_SET_BR
Definition: m2mb_uart.h:47
M2MB_UART_IOCTL_GET_FCTL
Definition: m2mb_uart.h:50
M2MB_UART_DTR_EV
Definition: m2mb_uart.h:146
M2MB_UART_IOCTL_GET_TX_TIMEOUT
Definition: m2mb_uart.h:58
M2MB_UART_CFG_T::baud_rate
UINT32 baud_rate
Definition: m2mb_uart.h:180
M2MB_UART_IOCTL_GET_CB_USERDATA
Definition: m2mb_uart.h:64
M2MB_UART_IOCTL_GET_STOP_BITS
Definition: m2mb_uart.h:54
M2MB_UART_PARITY_E
M2MB_UART_PARITY_E
UART parity mode.
Definition: m2mb_uart.h:98