no-OS
no_os_uart.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef _NO_OS_UART_H_
40 #define _NO_OS_UART_H_
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 
46 #include <stdint.h>
47 #include <stdbool.h>
48 #include "no_os_lf256fifo.h"
49 
50 /******************************************************************************/
51 /*************************** Types Declarations *******************************/
52 /******************************************************************************/
53 
69 };
70 
86 };
87 
97 };
98 
105  uint8_t device_id;
107  uint32_t irq_id;
111  uint32_t baud_rate;
119  void *extra;
120 };
121 
128  uint8_t device_id;
130  uint32_t irq_id;
132  struct lf256fifo *rx_fifo;
134  uint32_t baud_rate;
136  void *extra;
137 };
138 
139 /******************************************************************************/
140 /************************ Functions Declarations ******************************/
141 /******************************************************************************/
142 
143 /* Read data from UART. Blocking function */
144 int32_t no_os_uart_read(struct no_os_uart_desc *desc, uint8_t *data,
145  uint32_t bytes_number);
146 
147 /* Write data to UART. Blocking function */
148 int32_t no_os_uart_write(struct no_os_uart_desc *desc, const uint8_t *data,
149  uint32_t bytes_number);
150 
151 /* Read data from UART. Non blocking function */
152 int32_t no_os_uart_read_nonblocking(struct no_os_uart_desc *desc, uint8_t *data,
153  uint32_t bytes_number);
154 
155 /* Write data to UART. Non blocking function*/
156 int32_t no_os_uart_write_nonblocking(struct no_os_uart_desc *desc,
157  const uint8_t *data,
158  uint32_t bytes_number);
159 
160 /* Initialize the UART communication peripheral. */
161 int32_t no_os_uart_init(struct no_os_uart_desc **desc,
162  struct no_os_uart_init_param *param);
163 
164 /* Free the resources allocated by no_os_uart_init(). */
165 int32_t no_os_uart_remove(struct no_os_uart_desc *desc);
166 
167 /* Check if UART errors occurred. */
168 uint32_t no_os_uart_get_errors(struct no_os_uart_desc *desc);
169 
170 #endif // _NO_OS_UART_H_
no_os_uart_init_param::parity
enum no_os_uart_parity parity
Definition: no_os_uart.h:115
no_os_uart_write
int32_t no_os_uart_write(struct no_os_uart_desc *desc, const uint8_t *data, uint32_t bytes_number)
Write data to UART. Blocking function.
Definition: aducm3029_uart.c:211
no_os_uart_init_param::extra
void * extra
Definition: no_os_uart.h:119
NO_OS_UART_STOP_1_BIT
@ NO_OS_UART_STOP_1_BIT
Definition: no_os_uart.h:94
no_os_uart_init_param::size
enum no_os_uart_size size
Definition: no_os_uart.h:113
no_os_uart_read
int32_t no_os_uart_read(struct no_os_uart_desc *desc, uint8_t *data, uint32_t bytes_number)
Read data from UART. Blocking function.
Definition: aducm3029_uart.c:155
no_os_uart_desc::baud_rate
uint32_t baud_rate
Definition: no_os_uart.h:134
NO_OS_UART_CS_5
@ NO_OS_UART_CS_5
Definition: no_os_uart.h:60
no_os_uart_size
no_os_uart_size
UART character size (number of data bits) options.
Definition: no_os_uart.h:58
no_os_uart_init_param::irq_id
uint32_t irq_id
Definition: no_os_uart.h:107
no_os_uart_desc::device_id
uint8_t device_id
Definition: no_os_uart.h:128
no_os_uart_parity
no_os_uart_parity
UART parity options.
Definition: no_os_uart.h:75
no_os_uart_remove
int32_t no_os_uart_remove(struct no_os_uart_desc *desc)
Free the resources allocated by no_os_uart_init().
Definition: aducm3029_uart.c:460
no_os_uart_get_errors
uint32_t no_os_uart_get_errors(struct no_os_uart_desc *desc)
Free the resources allocated by no_os_uart_init().
Definition: aducm3029_uart.c:488
no_os_uart_desc
Stucture holding the UART descriptor.
Definition: no_os_uart.h:126
no_os_uart_init_param::asynchronous_rx
bool asynchronous_rx
Definition: no_os_uart.h:109
no_os_uart_desc::extra
void * extra
Definition: no_os_uart.h:136
NO_OS_UART_STOP_2_BIT
@ NO_OS_UART_STOP_2_BIT
Definition: no_os_uart.h:96
no_os_uart_desc::rx_fifo
struct lf256fifo * rx_fifo
Definition: no_os_uart.h:132
NO_OS_UART_PAR_SPACE
@ NO_OS_UART_PAR_SPACE
Definition: no_os_uart.h:81
no_os_uart_init_param::baud_rate
uint32_t baud_rate
Definition: no_os_uart.h:111
no_os_uart_init_param::stop
enum no_os_uart_stop stop
Definition: no_os_uart.h:117
NO_OS_UART_CS_9
@ NO_OS_UART_CS_9
Definition: no_os_uart.h:68
NO_OS_UART_PAR_EVEN
@ NO_OS_UART_PAR_EVEN
Definition: no_os_uart.h:85
no_os_lf256fifo.h
SPSC lock-free fifo of fixed size (256), specialized for UART.
no_os_uart_read_nonblocking
int32_t no_os_uart_read_nonblocking(struct no_os_uart_desc *desc, uint8_t *data, uint32_t bytes_number)
Submit reading buffer to the UART driver.
Definition: aducm3029_uart.c:258
no_os_uart_desc::irq_id
uint32_t irq_id
Definition: no_os_uart.h:130
NO_OS_UART_CS_7
@ NO_OS_UART_CS_7
Definition: no_os_uart.h:64
NO_OS_UART_CS_6
@ NO_OS_UART_CS_6
Definition: no_os_uart.h:62
no_os_uart_init
int32_t no_os_uart_init(struct no_os_uart_desc **desc, struct no_os_uart_init_param *param)
Initialize the UART communication peripheral.
Definition: aducm3029_uart.c:331
no_os_uart_init_param
Structure holding the parameters for UART initialization.
Definition: no_os_uart.h:103
NO_OS_UART_PAR_NO
@ NO_OS_UART_PAR_NO
Definition: no_os_uart.h:77
no_os_uart_stop
no_os_uart_stop
UART number of stop bits options.
Definition: no_os_uart.h:92
no_os_uart_init_param::device_id
uint8_t device_id
Definition: no_os_uart.h:105
NO_OS_UART_PAR_MARK
@ NO_OS_UART_PAR_MARK
Definition: no_os_uart.h:79
NO_OS_UART_PAR_ODD
@ NO_OS_UART_PAR_ODD
Definition: no_os_uart.h:83
no_os_uart_write_nonblocking
int32_t no_os_uart_write_nonblocking(struct no_os_uart_desc *desc, const uint8_t *data, uint32_t bytes_number)
Submit writting buffer to the UART driver.
Definition: aducm3029_uart.c:295
NO_OS_UART_CS_8
@ NO_OS_UART_CS_8
Definition: no_os_uart.h:66