no-OS
uart_extra.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifndef UART_EXTRA_H_
41 #define UART_EXTRA_H_
42 
43 /******************************************************************************/
44 /***************************** Include Files **********************************/
45 /******************************************************************************/
46 
47 #include <drivers/uart/adi_uart.h>
48 #include <stdbool.h>
49 #include <stdint.h>
50 #include "no_os_error.h"
51 #include "no_os_irq.h"
52 
54 #define NO_OS_UART_MAX_BYTES 1024u
55 
56 /******************************************************************************/
57 /*************************** Types Declarations *******************************/
58 /******************************************************************************/
59 
64 enum UART_ERROR {
66  NO_ERR = 0x00,
77  HW_ERR_PARITY = 0x20,
94 };
95 
109 };
110 
126 };
127 
140 };
141 
149 enum UART_BAUD {
151  BD_9600 = 9600,
153  BD_19200 = 19200,
155  BD_38400 = 38400,
157  BD_57600 = 57600,
159  BD_115200 = 115200,
161  BD_230400 = 230400,
163  BD_460800 = 460800,
165  BD_921600 = 921600,
167  BD_1000000 = 1000000,
169  BD_1500000 = 1500000
170 };
171 
184 };
185 
194  uint32_t baud_rate;
196  uint16_t div_n;
198  uint8_t div_m;
200  uint16_t div_c;
202  uint8_t osr;
203 };
204 
213  uint8_t *buff;
215  uint32_t pending;
216 };
217 
225  ADI_UART_HANDLE uart_handler;
234  uint8_t *adi_uart_buffer;
248 };
249 
250 #endif /* UART_H_ */
UART_ONE_STOPBIT
@ UART_ONE_STOPBIT
Definition: uart_extra.h:134
HW_ERR_RX_CHAN_DMA_INVALID_DESCR
@ HW_ERR_RX_CHAN_DMA_INVALID_DESCR
Definition: uart_extra.h:87
no_os_aducm_uart_desc::read_desc
struct no_os_op_desc read_desc
Definition: uart_extra.h:243
HW_ERR_PARITY
@ HW_ERR_PARITY
Definition: uart_extra.h:77
UART_WORDLEN
UART_WORDLEN
Values for word_length in aducm_uart_init_param.
Definition: uart_extra.h:100
no_os_aducm_uart_desc::rx_callback
struct no_os_callback_desc rx_callback
Definition: uart_extra.h:247
HW_ERR_TX_CHAN_DMA_BUS_FAULT
@ HW_ERR_TX_CHAN_DMA_BUS_FAULT
Definition: uart_extra.h:85
NO_ERR
@ NO_ERR
Definition: uart_extra.h:66
BD_460800
@ BD_460800
Definition: uart_extra.h:163
no_os_callback_desc
Structure describing a callback to be registered.
Definition: no_os_irq.h:136
no_os_irq.h
Header file of IRQ interface.
no_os_aducm_uart_desc::uart_handler
ADI_UART_HANDLE uart_handler
Definition: uart_extra.h:225
no_os_op_desc
It stores the state of a operation.
Definition: uart_extra.h:209
no_os_op_desc::buff
uint8_t * buff
Definition: uart_extra.h:213
no_os_baud_desc::baud_rate
uint32_t baud_rate
Definition: uart_extra.h:194
BD_9600
@ BD_9600
Definition: uart_extra.h:151
no_os_aducm_uart_desc::adi_uart_buffer
uint8_t * adi_uart_buffer
Definition: uart_extra.h:234
UART_STOPBITS
UART_STOPBITS
Values for stop_bits in aducm_uart_init_param.
Definition: uart_extra.h:132
BD_19200
@ BD_19200
Definition: uart_extra.h:153
UART_WORDLEN_5BITS
@ UART_WORDLEN_5BITS
Definition: uart_extra.h:102
BD_230400
@ BD_230400
Definition: uart_extra.h:161
UART_WORDLEN_7BITS
@ UART_WORDLEN_7BITS
Definition: uart_extra.h:106
HW_ERR_RX_CHAN_DMA_UNKNOWN_ERROR
@ HW_ERR_RX_CHAN_DMA_UNKNOWN_ERROR
Definition: uart_extra.h:91
no_os_op_desc::is_nonblocking
bool is_nonblocking
Definition: uart_extra.h:211
no_os_aducm_uart_desc::callback_enabled
bool callback_enabled
Definition: uart_extra.h:229
no_os_aducm_uart_desc::errors
enum UART_ERROR errors
Definition: uart_extra.h:227
no_os_error.h
Error codes definition.
BD_921600
@ BD_921600
Definition: uart_extra.h:165
UART_PARITY
UART_PARITY
Values for parity in aducm_uart_init_param.
Definition: uart_extra.h:115
BREAK_INTERRUPT
@ BREAK_INTERRUPT
Definition: uart_extra.h:81
UART_WORDLEN_6BITS
@ UART_WORDLEN_6BITS
Definition: uart_extra.h:104
HW_ERR_TX_CHAN_DMA_UNKNOWN_ERROR
@ HW_ERR_TX_CHAN_DMA_UNKNOWN_ERROR
Definition: uart_extra.h:93
aducm_uart_init_param
Stores specific parameter needed to initialize the UART driver for the ADuCM3029 platform.
Definition: uart_extra.h:177
BD_115200
@ BD_115200
Definition: uart_extra.h:159
no_os_baud_desc
Structure of an element from baud_rates_26MHz. The baud rate is calculated with the formula: Baudrate...
Definition: uart_extra.h:192
BD_38400
@ BD_38400
Definition: uart_extra.h:155
UART_BAUD
UART_BAUD
Values for baud_rate in aducm_uart_init_param The values are only valid if the ADuCM3029 runs at 26MH...
Definition: uart_extra.h:149
HW_ERR_RX_CHAN_DMA_BUS_FAULT
@ HW_ERR_RX_CHAN_DMA_BUS_FAULT
Definition: uart_extra.h:83
BD_1500000
@ BD_1500000
Definition: uart_extra.h:169
HW_ERR_OVERRUN
@ HW_ERR_OVERRUN
Definition: uart_extra.h:79
BD_1000000
@ BD_1000000
Definition: uart_extra.h:167
WAITING_FOR_CALLBACK
@ WAITING_FOR_CALLBACK
Definition: uart_extra.h:73
no_os_aducm_uart_desc::adi_uart_buffer_offset
uint32_t adi_uart_buffer_offset
Definition: uart_extra.h:239
no_os_baud_desc::div_m
uint8_t div_m
Definition: uart_extra.h:198
no_os_baud_desc::osr
uint8_t osr
Definition: uart_extra.h:202
UART_ONE_AND_HALF_TWO_STOPBITS
@ UART_ONE_AND_HALF_TWO_STOPBITS
Definition: uart_extra.h:139
UART_WORDLEN_8BITS
@ UART_WORDLEN_8BITS
Definition: uart_extra.h:108
no_os_op_desc::pending
uint32_t pending
Definition: uart_extra.h:215
UART_EVEN_PARITY_STICKY
@ UART_EVEN_PARITY_STICKY
Definition: uart_extra.h:125
no_os_aducm_uart_desc::write_desc
struct no_os_op_desc write_desc
Definition: uart_extra.h:241
no_os_baud_desc::div_n
uint16_t div_n
Definition: uart_extra.h:196
BAD_INPUT_PARAMETERS
@ BAD_INPUT_PARAMETERS
Definition: uart_extra.h:71
UART_ERROR
UART_ERROR
Values returned by no_os_uart_get_errors. Multiple values can be set.
Definition: uart_extra.h:64
aducm_uart_init_param::word_length
enum UART_WORDLEN word_length
Definition: uart_extra.h:183
UART_ODD_PARITY
@ UART_ODD_PARITY
Definition: uart_extra.h:119
UART_NO_PARITY
@ UART_NO_PARITY
Definition: uart_extra.h:117
HW_ERR_TX_CHAN_DMA_INVALID_DESCR
@ HW_ERR_TX_CHAN_DMA_INVALID_DESCR
Definition: uart_extra.h:89
no_os_aducm_uart_desc::nvic
struct no_os_irq_ctrl_desc * nvic
Definition: uart_extra.h:245
HW_ERR_FRAMING
@ HW_ERR_FRAMING
Definition: uart_extra.h:75
aducm_uart_init_param::stop_bits
enum UART_STOPBITS stop_bits
Definition: uart_extra.h:181
no_os_baud_desc::div_c
uint16_t div_c
Definition: uart_extra.h:200
UART_EVEN_PARITY
@ UART_EVEN_PARITY
Definition: uart_extra.h:121
no_os_irq_ctrl_desc
Definition: no_os_irq.h:119
UART_ODD_PARITY_STICKY
@ UART_ODD_PARITY_STICKY
Definition: uart_extra.h:123
no_os_aducm_uart_desc
Stores specific parameter needed by the UART driver for internal operations.
Definition: uart_extra.h:223
BD_57600
@ BD_57600
Definition: uart_extra.h:157
aducm_uart_init_param::parity
enum UART_PARITY parity
Definition: uart_extra.h:179