m2mb API docs  25.21.002
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 {
76  M2MB_UART_IOCTL_NOF_REQ
77 };
78 
79 /* Global typedefs ==============================================================================*/
80 
87 typedef enum
88 {
91  M2MB_UART_FCTL_MAX
93 
100 typedef enum
101 {
106  M2MB_UART_PARITY_MAX
108 
115 typedef enum
116 {
121  M2MB_UART_STOP_BITS_MAX
123 
130 typedef enum
131 {
136  M2MB_UART_BITS_PER_CHAR_MAX
138 
144 typedef enum
145 {
150 
157 typedef enum
158 {
161  ENUM_TO_INT( M2MB_UART_PIN_VALUE_E )
163 
164 
165 
172 typedef void ( *m2mb_uart_ind_callback )( INT32 fd, M2MB_UART_IND_E uart_event, UINT16 resp_size, void *resp_struct, void *userdata );
173 
180 typedef struct
181 {
182  UINT32 baud_rate;
187  BOOLEAN loopback_mode;
188  UINT16 tx_timeout_ms;
189  UINT16 rx_timeout_ms;
191  void *cb_data;
193 
194 /* Global functions =============================================================================*/
195 
196 /*-----------------------------------------------------------------------------------------------*/
241 /*-----------------------------------------------------------------------------------------------*/
242 INT32 m2mb_uart_open( const CHAR *path, INT32 flags, ... );
243 
244 /*-----------------------------------------------------------------------------------------------*/
278 /*-----------------------------------------------------------------------------------------------*/
279 INT32 m2mb_uart_close( INT32 fd );
280 
281 /*-----------------------------------------------------------------------------------------------*/
542 /*-----------------------------------------------------------------------------------------------*/
543 INT32 m2mb_uart_ioctl( INT32 fd, INT32 request, ... );
544 
545 /*-----------------------------------------------------------------------------------------------*/
592 /*-----------------------------------------------------------------------------------------------*/
593 SSIZE_T m2mb_uart_read( INT32 fd, void *buf, SIZE_T nbyte );
594 
595 /*-----------------------------------------------------------------------------------------------*/
644 /*-----------------------------------------------------------------------------------------------*/
645 SSIZE_T m2mb_uart_write( INT32 fd, const void *buf, SIZE_T nbyte );
646 
647 #endif /* M2M_M2MB_UART_API_H */
648 
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:180
M2MB_UART_CFG_T::loopback_mode
BOOLEAN loopback_mode
Definition: m2mb_uart.h:187
M2MB_UART_6_BITS_PER_CHAR
Definition: m2mb_uart.h:133
M2MB_UART_CFG_T::parity_mode
M2MB_UART_PARITY_E parity_mode
Definition: m2mb_uart.h:184
M2MB_UART_BITS_PER_CHAR_E
M2MB_UART_BITS_PER_CHAR_E
UART number of bits per character.
Definition: m2mb_uart.h:130
M2MB_UART_IOCTL_REQUEST
M2MB_UART_IOCTL_REQUEST
UART configuration requests.
Definition: m2mb_uart.h:43
M2MB_UART_LOW_VALUE
Definition: m2mb_uart.h:159
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:90
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:160
M2MB_UART_5_BITS_PER_CHAR
Definition: m2mb_uart.h:132
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:89
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:185
M2MB_UART_CFG_T::bits_per_char
M2MB_UART_BITS_PER_CHAR_E bits_per_char
Definition: m2mb_uart.h:186
M2MB_UART_CFG_T::rx_timeout_ms
UINT16 rx_timeout_ms
Definition: m2mb_uart.h:189
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:157
M2MB_UART_RX_EV
Definition: m2mb_uart.h:147
M2MB_UART_STOP_BITS_E
M2MB_UART_STOP_BITS_E
UART number of stop bits.
Definition: m2mb_uart.h:115
M2MB_UART_IOCTL_GET_RX_TIMEOUT
Definition: m2mb_uart.h:60
M2MB_UART_1_0_STOP_BITS
Definition: m2mb_uart.h:118
M2MB_UART_CFG_T::cb_data
void * cb_data
Definition: m2mb_uart.h:191
M2MB_UART_2_0_STOP_BITS
Definition: m2mb_uart.h:120
M2MB_UART_CFG_T::flow_control
M2MB_UART_FCTL_E flow_control
Definition: m2mb_uart.h:183
M2MB_UART_1_5_STOP_BITS
Definition: m2mb_uart.h:119
M2MB_UART_TX_EV
Definition: m2mb_uart.h:146
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:172
M2MB_UART_NO_PARITY
Definition: m2mb_uart.h:102
M2MB_UART_ODD_PARITY
Definition: m2mb_uart.h:103
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:190
M2MB_UART_CFG_T::tx_timeout_ms
UINT16 tx_timeout_ms
Definition: m2mb_uart.h:188
M2MB_UART_IOCTL_SET_DTR_FCTL
Definition: m2mb_uart.h:74
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:144
M2MB_UART_IOCTL_SET_BITS_PER_CHAR
Definition: m2mb_uart.h:55
M2MB_UART_SPACE_PARITY
Definition: m2mb_uart.h:105
M2MB_UART_IOCTL_SET_TX_TIMEOUT
Definition: m2mb_uart.h:57
M2MB_UART_8_BITS_PER_CHAR
Definition: m2mb_uart.h:135
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:117
M2MB_UART_7_BITS_PER_CHAR
Definition: m2mb_uart.h:134
M2MB_UART_IOCTL_SET_RING
Definition: m2mb_uart.h:73
M2MB_UART_IOCTL_SET_POWER_STATE
Definition: m2mb_uart.h:65
M2MB_UART_IOCTL_GET_DTR_FCTL
Definition: m2mb_uart.h:75
M2MB_UART_EVEN_PARITY
Definition: m2mb_uart.h:104
M2MB_UART_FCTL_E
M2MB_UART_FCTL_E
UART flow control type.
Definition: m2mb_uart.h:87
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:148
M2MB_UART_IOCTL_GET_TX_TIMEOUT
Definition: m2mb_uart.h:58
M2MB_UART_CFG_T::baud_rate
UINT32 baud_rate
Definition: m2mb_uart.h:182
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:100