TMPM4G9  V1.0.0.0
bsp_uart_io.h
Go to the documentation of this file.
1 
13 /*------------------------------------------------------------------------------*/
14 /* Define to prevent recursive inclusion */
15 /*------------------------------------------------------------------------------*/
16 #ifndef __BSP_UART_IO_H
17 #define __BSP_UART_IO_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 /*------------------------------------------------------------------------------*/
24 /* Includes */
25 /*------------------------------------------------------------------------------*/
26 #include <stdarg.h>
27 #include "txz_sample_def.h"
28 
38 /*------------------------------------------------------------------------------*/
39 /* Macro Function */
40 /*------------------------------------------------------------------------------*/
46 /* no define */
47  /* End of group BSP_UTILITIES_Exported_macro */
51 
52 
53 /*------------------------------------------------------------------------------*/
54 /* Configuration */
55 /*------------------------------------------------------------------------------*/
61 /* no define */
62  /* End of group BSP_UTILITIES_Exported_define */
66 
67 
68 /*------------------------------------------------------------------------------*/
69 /* Macro Definition */
70 /*------------------------------------------------------------------------------*/
76 #define UART_IO_SEND_MAX ((uint32_t)32)
77 #define UART_IO_RECEIVE_MAX ((uint32_t)32) /* End of group BSP_UTILITIES_Exported_define */
81 
82 /*------------------------------------------------------------------------------*/
83 /* Enumerated Type Definition */
84 /*------------------------------------------------------------------------------*/
90 /*----------------------------------*/
94 /*----------------------------------*/
95 typedef enum {
100 } UartIOTxState;
101 
102 /*----------------------------------*/
106 /*----------------------------------*/
107 typedef enum {
111 } UartIORxState;
112  /* End of group BSP_UTILITIES_Exported_define */
116 
117 
118 /*------------------------------------------------------------------------------*/
119 /* Structure Definition */
120 /*------------------------------------------------------------------------------*/
125 /*----------------------------------*/
130 /*----------------------------------*/
131 typedef struct
132 {
133  uint32_t id;
135  uint32_t boudrate;
136  struct
137  {
141  } irq;
143 
144 /*----------------------------------*/
149 /*----------------------------------*/
150 typedef struct
151 {
152  volatile UartIOTxState state;
153  uint32_t wp;
154  uint32_t rp;
155  uint8_t buff[UART_IO_SEND_MAX];
157 
158 /*----------------------------------*/
163 /*----------------------------------*/
164 typedef struct
165 {
166  volatile UartIORxState state;
167  volatile uint32_t wp;
168  volatile uint32_t rp;
169  volatile uint32_t length;
170  volatile uint8_t buff[UART_IO_RECEIVE_MAX];
172 
173 /*----------------------------------*/
177 /*----------------------------------*/
178 typedef struct
179 {
183  uint8_t work[UART_RX_FIFO_MAX];
185 
186 /*----------------------------------*/
190 /*----------------------------------*/
191 typedef struct
192 {
195 } uart_io_t;
196  /* End of group BSP_UTILITIES_Exported_typedef */
200 
201 /*------------------------------------------------------------------------------*/
202 /* Functions */
203 /*------------------------------------------------------------------------------*/
210 void uart_io_finalize(void);
211 void uart_io_tx_irq_handler(void);
212 void uart_io_rx_irq_handler(void);
213 void uart_io_err_irq_handler(void);
214 int get_char_once(void); /* End of group BSP_UTILITIES_Exported_functions */
218  /* End of group BSP_UTILITIES */
222  /* End of group Example */
226 
227 #ifdef __cplusplus
228 }
229 #endif /* __cplusplus */
230 #endif /* __BSP_UART_IO_H */
231 
volatile uint32_t length
Definition: bsp_uart_io.h:169
Definition: bsp_uart_io.h:99
UartIOTxState
Send state.
Definition: bsp_uart_io.h:95
enum IRQn IRQn_Type
uint32_t boudrate
Definition: bsp_uart_io.h:135
#define UART_RX_FIFO_MAX
Definition: txz_uart.h:52
uint32_t wp
Definition: bsp_uart_io.h:153
volatile UartIOTxState state
Definition: bsp_uart_io.h:152
#define UART_IO_RECEIVE_MAX
Definition: bsp_uart_io.h:77
TXZ_Result uart_io_initialize(uart_io_initial_setting_t *p_param)
Initialize.
Definition: bsp_uart_io.c:446
uart_io_initial_setting_t init
Definition: bsp_uart_io.h:193
TXZ_Result
Definition: txz_driver_def.h:43
volatile uint32_t wp
Definition: bsp_uart_io.h:167
Receive information.
Definition: bsp_uart_io.h:164
UART handle structure definition.
Definition: txz_uart.h:745
Definition: bsp_uart_io.h:109
volatile UartIORxState state
Definition: bsp_uart_io.h:166
Definition: bsp_uart_io.h:97
uart_io_private_info_t info
Definition: bsp_uart_io.h:194
Send information.
Definition: bsp_uart_io.h:150
Private Member.
Definition: bsp_uart_io.h:178
IRQn_Type tx
Definition: bsp_uart_io.h:138
Initial setting. User must be set.
Definition: bsp_uart_io.h:131
uint32_t id
Definition: bsp_uart_io.h:133
IRQn_Type rx
Definition: bsp_uart_io.h:139
TXZ_Result uart_io_rx_restart(void)
Definition: bsp_uart_io.c:535
uint32_t rp
Definition: bsp_uart_io.h:154
Definition: bsp_uart_io.h:108
#define UART_IO_SEND_MAX
Definition: bsp_uart_io.h:76
Definition: bsp_uart_io.h:96
void uart_io_rx_irq_handler(void)
RX IRQ Handler.
Definition: bsp_uart_io.c:613
void uart_io_finalize(void)
Finalize.
Definition: bsp_uart_io.c:565
Definition: bsp_uart_io.h:98
UART.
Definition: TMPM4G6.h:1071
volatile uint32_t rp
Definition: bsp_uart_io.h:168
IRQn_Type err
Definition: bsp_uart_io.h:140
TSB_UART_TypeDef * p_reg
Definition: bsp_uart_io.h:134
UartIORxState
Receive state.
Definition: bsp_uart_io.h:107
int get_char_once(void)
The character is acquired from an input stream.
Definition: bsp_uart_io.c:290
void uart_io_tx_irq_handler(void)
TX IRQ Handler.
Definition: bsp_uart_io.c:598
uart_io_private_tx_t tx
Definition: bsp_uart_io.h:181
void uart_io_err_irq_handler(void)
ERR IRQ Handler.
Definition: bsp_uart_io.c:628
USB UART class.
Definition: bsp_uart_io.h:191
Definition: bsp_uart_io.h:110
uart_io_private_rx_t rx
Definition: bsp_uart_io.h:182
uart_t uart
Definition: bsp_uart_io.h:180