InPlay API
hal_uart.h
1 
13 #ifndef HAL_UART_H
14 #define HAL_UART_H
15 
25 #include <stdint.h>
26 #include "in_mmap.h"
27 
28 /*
29  * Defines
30  ****************************************************************************************
31  */
32 
33 #define UART_REG_RBR_OFS 0x00000000UL
34 #define UART_REG_THR_OFS 0x00000000UL
35 #define UART_REG_DLL_OFS 0x000000D0UL
36 #define UART_REG_DLH_OFS 0x000000D4UL
37 #define UART_REG_IER_OFS 0x00000004UL
38 #define UART_REG_IIR_OFS 0x000000E0UL
39 #define UART_REG_FCR_OFS 0x00000008UL
40 #define UART_REG_LCR_OFS 0x0000000CUL
41 #define UART_REG_MCR_OFS 0x00000010UL
42 #define UART_REG_LSR_OFS 0x00000014UL
43 #define UART_REG_MSR_OFS 0x00000018UL
44 #define UART_REG_USR_OFS 0x0000007CUL
45 #define UART_REG_TFL_OFS 0x00000080UL
46 #define UART_REG_RFL_OFS 0x00000084UL
47 #define UART_REG_DLF_OFS 0x000000C0UL
48 #define UART_REG_CTO_OFS 0x00000028UL
49 
50 #define UART_FIFO_DEPTH 16
51 
52 #define UART_LSR_RFE (1<<7) /* RX FIFO Error */
53 #define UART_LSR_TEMT (1<<6) /* TX Empty */
54 #define UART_LSR_THRE (1<<5) /* THR Empty */
55 #define UART_LSR_BI (1<<4) /* Break Interrupt */
56 #define UART_LSR_FE (1<<3) /* Framing Error */
57 #define UART_LSR_PE (1<<2) /* Parity Error */
58 #define UART_LSR_OE (1<<1) /* Overrun Error */
59 #define UART_LSR_DR (1<<0) /* Data Ready */
60 
61 #define UART_MSR_DCD (1<<7) /* Data Carrier Detect */
62 #define UART_MSR_RI (1<<6) /* Ring Indicator */
63 #define UART_MSR_DSR (1<<5) /* Data Set Ready */
64 #define UART_MSR_CTS (1<<4) /* Clear To Send */
65 #define UART_MSR_DDCD (1<<3)
66 #define UART_MSR_TERI (1<<2)
67 #define UART_MSR_DDSR (1<<1)
68 #define UART_MSR_DCTS (1<<0)
69 
70 #define UART_MCR_SIRE 0x00000040UL /* SIR Mode Enable */
71 #define UART_MCR_AFCE 0x00000020UL /* Auto Flow Control Enbale */
72 #define UART_MCR_LOOPBACK 0x00000010UL /* Loopback */
73 #define UART_MCR_OUT2 0x00000008UL /* OUT2 */
74 #define UART_MCR_OUT1 0x00000004UL /* OUT1 */
75 #define UART_MCR_RTS 0x00000002UL /* RTS */
76 #define UART_MCR_DTR 0x00000001UL /* Data Terminal Ready */
77 
78 #define UART_LCR_DLAB 0x00000080UL /* Divisor Latch Access */
79 #define UART_LCR_BC 0x00000040UL /* Break Control */
80 #define UART_LCR_SPS 0x00000020UL /* Stick Parity */
81 #define UART_LCR_EPS 0x00000010UL /* Even Parity Select */
82 #define UART_LCR_PEN 0x00000008UL /* Parity Enable */
83 #define UART_LCR_STOP 0x00000004UL /* Number of stop bits */
84 #define UART_LCR_DLS 0x00000003UL /* Data Length Select */
85 
86 #define UART_IER_EDSSI 0x00000008UL
87 #define UART_IER_ELSI 0x00000004UL
88 #define UART_IER_ETBEI 0x00000002UL
89 #define UART_IER_ERBFI 0x00000001UL
90 #define UART_IER_PTIME 0x00000080UL
91 #define UART_IER_CTO 0x00000010UL
92 #define UART_IER_ALL 0x0000001FUL
93 
94 #define UART_IT_ID_NONE 0x1
95 #define UART_IT_ID_LINE_STATUS 0x6 /* Highest */
96 #define UART_IT_ID_RCVR_DATA 0x4 /* Second */
97 #define UART_IT_ID_CHAR_TIME_OUT 0xC /* Second */
98 #define UART_IT_ID_THR_EMPTY 0x2 /* Third */
99 #define UART_IT_ID_MODEM_STATUS 0x0 /* Fourth */
100 #define UART_IT_ID_BUSY_DET 0x7 /* Fifth */
101 #define UART_IT_ID_CTO_DET 0x10
102 
103 #define UART_FCR_RT 0x000000C0UL
104 #define UART_FCR_TET 0x00000030UL
105 #define UART_FCR_DMAM 0x00000008UL
106 #define UART_FCR_XFIFOR 0x00000004UL
107 #define UART_FCR_RFIFOR 0x00000002UL
108 #define UART_FCR_FIFOE 0x00000001UL
109 
110 #define UART_TET_EMPTY 0
111 #define UART_TET_2_CHARS 1
112 #define UART_TET_QUARTER_FULL 2
113 #define UART_TET_HALF_FULL 3
114 
115 #define UART_USR_BUSY 0x00000001UL
116 #define UART_USR_TFNF 0x00000002UL
117 #define UART_USR_TFE 0x00000004UL
118 #define UART_USR_RFNE 0x00000008UL
119 #define UART_USR_RFF 0x00000010UL
120 
121 #define UART_CTO_STATUS 0x00000010UL
122 #define UART_CTO_EN 0x00000008UL
123 #define UART_CTO_CYCLES 0x00000007UL
124 #define UART_CTO_WAIT 0x00000020UL
125 #define UART_CTO_AUTO_DEASSERT 0x00000040UL
126 #define UART_CTO_AUTO_CLEAR 0x00000080UL
127 #define UART_RTS_ASSERT_BELOW_TH 0x00000100UL
128 #define UART_RTS_STANDALONE_THRSH 0x00000200UL
129 
130 /*
131  * Enumeration
132  ****************************************************************************************
133  */
134 
135 enum uart_id {
136  UART0_ID = 0,
137  UART1_ID,
138 };
139 
140 enum uart_err {
141  UART_ERR_PEND = 1,
142  UART_ERR_OK = 0,
143  UART_ERR_INVALID_PARAM = -1,
144  UART_ERR_DEV_BAD_STATE = -2,
145  UART_ERR_FE = -3, /* Frame Error */
146  UART_ERR_PE = -4, /* Parity Error */
147  UART_ERR_OE = -5, /* Overrun Error */
148  UART_ERR_BI = -6, /* Break Error */
149  UART_DMA_NOT_AVAIL = -7,
150  UART_DMA_TX_FAIL = -8,
151  UART_DMA_RX_FAIL = -9,
152  UART_OS_FAIL = -10,
153  UART_ERR_CFG = -11,
154  UART_ERR_DMA = -12,
155  UART_ERR_TMO = -13,
156  UART_ERR_BUSY = -14,
157 } ;
158 
159 enum uart_len {
160  UART_LENGTH_5BITS = 0,
161  UART_LENGTH_6BITS,
162  UART_LENGTH_7BITS,
163  UART_LENGTH_8BITS,
164 };
165 
166 enum uart_rt {
167  UART_RT_1_CHAR = 0,
168  UART_RT_QUARTER_FULL,
169  UART_RT_HALF_FULL,
170  UART_RT_2_LESS_FULL,
171 };
172 enum uart_stop_bit {
173  UART_STOP_1BIT = 0,
174  UART_STOP_2BITS,
175 };
176 
177 typedef enum uart_rts_fifo_th {
178  UART_RTS_TH_FIFO_1_BYTE = 0,
179  UART_RTS_TH_FIFO_DEPTH_QUARTER,
180  UART_RTS_TH_FIFO_DEPTH_HALF,
181  UART_RTS_TH_FIFO_DEPTH_LESS_2,
182 } uart_rts_fifo_th_t;
183 
184 typedef struct uart_init {
185  int baud_rate;
186  int data_len;
187  int stop_bit;
188  int parity_en;
190  int fc;
191  int no_intr;
192  int prio;
193  void *rx_arg;
194  void (*rx_cb)(void* arg, int length, int error);
195  void *tx_arg;
196  void (*tx_cb)(void* arg, int length, int error);
197 } uart_init_t;
198 /*
199  * Inline Functions
200  ****************************************************************************************
201  */
202 
203 static __inline uint8_t uart_read_data(uint32_t uart_base)
204 {
205  return ((uint8_t)RD_WORD(uart_base + UART_REG_RBR_OFS));
206 }
207 
208 static __inline void uart_write_data(uint32_t uart_base, uint8_t byte)
209 {
210  WR_WORD(uart_base + UART_REG_THR_OFS, byte);
211 }
212 
213 static __inline void uart_set_baud(uint32_t uart_base, int pclk, int baud)
214 {
215  float div = ((float)pclk/(float)baud)/16.0f;
216  uint16_t div_i = div;
217  uint8_t div_f = (div - div_i) *64; /* 6 bits for fraction */
218 
219  WR_WORD(uart_base + UART_REG_LCR_OFS, (RD_WORD(uart_base + UART_REG_LCR_OFS) |UART_LCR_DLAB)); /* Latch */
220  WR_WORD(uart_base + UART_REG_DLF_OFS, (div_f & 0x3F)); /* Fractional Part */
221  WR_WORD(uart_base + UART_REG_DLL_OFS, (div_i & 0xFF)); /* Low */
222  WR_WORD(uart_base + UART_REG_DLH_OFS, ((div_i>>8) & 0xFF)); /* High */
223  WR_WORD(uart_base + UART_REG_LCR_OFS, (RD_WORD(uart_base + UART_REG_LCR_OFS) & ~UART_LCR_DLAB)); /* Unlatch */
224 }
225 
226 static __inline void uart_set_lcr(uint32_t uart_base, int stop_bit, int par_en, int ev_par, int data_len)
227 {
228  uint32_t reg = RD_WORD(uart_base + UART_REG_LCR_OFS);
229 
230  if (stop_bit) {
231  reg |= UART_LCR_STOP;
232  } else {
233  reg &= ~UART_LCR_STOP;
234  }
235 
236  if (par_en) {
237  reg |= UART_LCR_PEN;
238  } else {
239  reg &= ~UART_LCR_PEN;
240  }
241 
242  if (ev_par) {
243  reg |= UART_LCR_EPS;
244  } else {
245  reg &= ~UART_LCR_EPS;
246  }
247 
248  reg &= ~UART_LCR_DLS;
249  if (data_len == 5) {
250  reg |= UART_LENGTH_5BITS;
251  } else if (data_len == 6) {
252  reg |= UART_LENGTH_6BITS;
253  } else if (data_len == 7) {
254  reg |= UART_LENGTH_7BITS;
255  } else {
256  reg |= UART_LENGTH_8BITS;
257  }
258 
259  WR_WORD(uart_base + UART_REG_LCR_OFS, reg);
260 }
261 
262 static __inline void uart_set_stop_bits(uint32_t uart_base, int bits)
263 {
264  uint32_t reg = RD_WORD(uart_base + UART_REG_LCR_OFS);
265 
266  if (bits == 1) {
267  reg &= ~UART_LCR_STOP;
268  } else {
269  reg |= UART_LCR_STOP;
270  }
271 
272  WR_WORD(uart_base + UART_REG_LCR_OFS, reg);
273 }
274 
275 static __inline void uart_set_parity(uint32_t uart_base, int enable)
276 {
277  uint32_t reg = RD_WORD(uart_base + UART_REG_LCR_OFS);
278 
279  if (enable)
280  reg |= UART_LCR_PEN;
281  else
282  reg &= ~UART_LCR_PEN;
283 
284  WR_WORD(uart_base + UART_REG_LCR_OFS, reg);
285 }
286 
287 static __inline void uart_set_even_parity(uint32_t uart_base, int even)
288 {
289  uint32_t reg = RD_WORD(uart_base + UART_REG_LCR_OFS);
290 
291  if (even) {
292  reg |= UART_LCR_EPS;
293  } else {
294  reg &= ~UART_LCR_EPS;
295  }
296 
297  WR_WORD(uart_base + UART_REG_LCR_OFS, reg);
298 }
299 
300 static __inline void uart_set_data_len(uint32_t uart_base, int data_len)
301 {
302  uint32_t reg = RD_WORD(uart_base + UART_REG_LCR_OFS);
303 
304  reg &= ~UART_LCR_DLS;
305 
306  if (data_len == 5) {
307  reg |= UART_LENGTH_5BITS;
308  } else if (data_len == 6) {
309  reg |= UART_LENGTH_6BITS;
310  } else if (data_len == 7) {
311  reg |= UART_LENGTH_7BITS;
312  } else {
313  reg |= UART_LENGTH_8BITS;
314  }
315 
316  WR_WORD(uart_base + UART_REG_LCR_OFS, reg);
317 }
318 
319 static __inline void uart_intr_enable(uint32_t uart_base, uint32_t bits)
320 {
321  WR_WORD(uart_base + UART_REG_IER_OFS, (RD_WORD(uart_base + UART_REG_IER_OFS) |bits));
322 }
323 
324 static __inline uint32_t uart_intr_enable_get(uint32_t uart_base)
325 {
326  return (RD_WORD(uart_base + UART_REG_IER_OFS));
327 }
328 
329 static __inline void uart_intr_disable(uint32_t uart_base, uint32_t bits)
330 {
331  WR_WORD(uart_base + UART_REG_IER_OFS, (RD_WORD(uart_base + UART_REG_IER_OFS) & ~bits));
332 }
333 
334 static __inline uint32_t uart_intr_status(uint32_t uart_base)
335 {
336  return (RD_WORD(uart_base + UART_REG_IIR_OFS) & 0x1F);
337 }
338 
339 static __inline int uart_fifo_enable_status(uint32_t uart_base)
340 {
341  return ((RD_WORD(uart_base + UART_REG_IIR_OFS) & 0xC0) == 0xC0);
342 }
343 
344 static __inline void uart_fcr(uint32_t uart_base, int fifo_enable, int fifo_tx_thold, int fifo_rx_thold, int dma_mode, int xfifo_reset, int rfifo_reset)
345 {
346  // This is a write only register.
347  uint32_t reg = 0;
348 
349  if (fifo_enable) {
350  reg |= UART_FCR_FIFOE;
351  }
352 
353  reg |= (fifo_tx_thold & 0x3) << 4;
354  reg |= (fifo_rx_thold & 0x3) << 6;
355  if (dma_mode) // DMA mode is not used
356  reg |= UART_FCR_DMAM;
357 
358  if (xfifo_reset)
359  reg |= UART_FCR_XFIFOR;
360 
361  if (rfifo_reset)
362  reg |= UART_FCR_RFIFOR;
363 
364  WR_WORD(uart_base + UART_REG_FCR_OFS, reg);
365 }
366 
367 static __inline void uart_fifo_disable(uint32_t uart_base)
368 {
369  WR_WORD(uart_base + UART_REG_FCR_OFS, 0);
370 }
371 
372 static __inline void uart_auto_fc(uint32_t uart_base, int fc)
373 {
374  WR_WORD(uart_base + UART_REG_MCR_OFS, (fc ? (RD_WORD(uart_base + UART_REG_MCR_OFS)|UART_MCR_AFCE) : (RD_WORD(uart_base + UART_REG_MCR_OFS)&~UART_MCR_AFCE)));
375 }
376 
377 
378 static __inline void uart_xmit_ready(uint32_t uart_base)
379 {
380  do {
381  uint32_t reg = RD_WORD(uart_base + UART_REG_LSR_OFS);
382  if (reg & UART_LSR_THRE)
383  break;
384  } while (1);
385 }
386 
387 static __inline void uart_rcvd_ready(uint32_t uart_base)
388 {
389  do {
390  uint32_t reg = RD_WORD(uart_base + UART_REG_LSR_OFS);
391  if (reg & UART_LSR_DR)
392  break;
393  } while (1);
394 
395 }
396 
397 static __inline uint32_t uart_line_status(uint32_t uart_base)
398 {
399  return (RD_WORD(uart_base + UART_REG_LSR_OFS));
400 }
401 
402 static __inline uint32_t uart_modem_status(uint32_t uart_base)
403 {
404  return (RD_WORD(uart_base + UART_REG_MSR_OFS));
405 }
406 
407 static __inline void uart_rts_off(uint32_t uart_base)
408 {
409  WR_WORD(uart_base + UART_REG_MCR_OFS, (RD_WORD(uart_base + UART_REG_MCR_OFS) & ~UART_MCR_RTS));
410 }
411 
412 static __inline void uart_rts_on(uint32_t uart_base)
413 {
414  WR_WORD(uart_base + UART_REG_MCR_OFS, (RD_WORD(uart_base + UART_REG_MCR_OFS) | UART_MCR_RTS));
415 }
416 
417 static __inline void uart_rts_off_clear_cto_count_enable(uint32_t uart_base)
418 {
419  WR_WORD(uart_base + UART_REG_MCR_OFS, (RD_WORD(uart_base + UART_REG_MCR_OFS) | (1 << 7u)));
420 }
421 
422 static __inline void uart_rts_off_clear_cto_count_disable(uint32_t uart_base)
423 {
424  WR_WORD(uart_base + UART_REG_MCR_OFS, (RD_WORD(uart_base + UART_REG_MCR_OFS) & ~(1 << 7u)));
425 }
426 
427 static __inline uint32_t uart_tfl(uint32_t uart_base)
428 {
429  return RD_WORD(uart_base + UART_REG_TFL_OFS);
430 }
431 
432 static __inline uint32_t uart_rfl(uint32_t uart_base)
433 {
434  return RD_WORD(uart_base + UART_REG_RFL_OFS);
435 }
436 
437 static __inline uint32_t uart_usr(uint32_t uart_base)
438 {
439  return RD_WORD(uart_base + UART_REG_USR_OFS);
440 }
441 
442 static __inline void uart_cto_enable(uint32_t uart_base)
443 {
444  WR_WORD(uart_base + UART_REG_CTO_OFS, (RD_WORD(uart_base + UART_REG_CTO_OFS) | UART_CTO_EN));
445  //WR_WORD(uart_base + UART_REG_CTO_OFS, (RD_WORD(uart_base + UART_REG_CTO_OFS) & ~0x20));
446 }
447 
448 static __inline void uart_cto_disable(uint32_t uart_base)
449 {
450  WR_WORD(uart_base + UART_REG_CTO_OFS, (RD_WORD(uart_base + UART_REG_CTO_OFS) & ~UART_CTO_EN));
451 }
452 
453 static __inline int uart_cto_status(uint32_t uart_base)
454 {
455  return ((RD_WORD(uart_base + UART_REG_CTO_OFS) >> 4) & 1);
456 }
457 
458 /* timeout = (1 + cycle) << 9u / pclk */
459 static __inline void uart_cto_cycles(uint32_t uart_base, int cycle)
460 {
461  WR_WORD(uart_base + UART_REG_CTO_OFS, ((RD_WORD(uart_base + UART_REG_CTO_OFS) & ~UART_CTO_CYCLES) | (cycle & 0x7)));
462 }
463 
464 static __inline void uart_cto_wait_enable(uint32_t uart_base)
465 {
466  WR_WORD(uart_base + UART_REG_CTO_OFS, (RD_WORD(uart_base + UART_REG_CTO_OFS) | UART_CTO_WAIT));
467 }
468 
469 static __inline void uart_cto_wait_disable(uint32_t uart_base)
470 {
471  WR_WORD(uart_base + UART_REG_CTO_OFS, (RD_WORD(uart_base + UART_REG_CTO_OFS) & ~UART_CTO_WAIT));
472 }
473 
474 static __inline void uart_cto_auto_rts_deassert_enable(uint32_t uart_base)
475 {
476  WR_WORD(uart_base + UART_REG_CTO_OFS, (RD_WORD(uart_base + UART_REG_CTO_OFS) | UART_CTO_AUTO_DEASSERT));
477 }
478 
479 static __inline void uart_cto_auto_deassert_rts_disable(uint32_t uart_base)
480 {
481  WR_WORD(uart_base + UART_REG_CTO_OFS, (RD_WORD(uart_base + UART_REG_CTO_OFS) & ~UART_CTO_AUTO_DEASSERT));
482 }
483 
484 static __inline void uart_rts_below_th_assert_enable(uint32_t uart_base)
485 {
486  WR_WORD(uart_base + UART_REG_CTO_OFS, (RD_WORD(uart_base + UART_REG_CTO_OFS) | UART_RTS_ASSERT_BELOW_TH));
487 }
488 
489 static __inline void uart_rts_below_th_assert_disable(uint32_t uart_base)
490 {
491  WR_WORD(uart_base + UART_REG_CTO_OFS, (RD_WORD(uart_base + UART_REG_CTO_OFS) & ~UART_RTS_ASSERT_BELOW_TH));
492 }
493 
494 static __inline void uart_cto_auto_rts_manu_clear(uint32_t uart_base)
495 {
496  WR_WORD(uart_base + UART_REG_CTO_OFS, (RD_WORD(uart_base + UART_REG_CTO_OFS) | UART_CTO_AUTO_CLEAR));
497  WR_WORD(uart_base + UART_REG_CTO_OFS, (RD_WORD(uart_base + UART_REG_CTO_OFS) & ~UART_CTO_AUTO_CLEAR));
498 }
499 
500 static __inline void uart_rts_standalone_th_enable(uint32_t uart_base, uart_rts_fifo_th_t th)
501 {
502  WR_WORD(uart_base + UART_REG_CTO_OFS, (RD_WORD(uart_base + UART_REG_CTO_OFS) | (UART_RTS_STANDALONE_THRSH | ((th & 0x03) << 10u))));
503 }
504 
505 static __inline void uart_rts_standalone_th_disable(uint32_t uart_base)
506 {
507  WR_WORD(uart_base + UART_REG_CTO_OFS, (RD_WORD(uart_base + UART_REG_CTO_OFS) & ~UART_RTS_STANDALONE_THRSH));
508 }
509 
510 
511 /*
512  * APIs
513  ****************************************************************************************
514  */
515 
526 void *hal_uart_open(int id, uart_init_t *init);
527 
537 void hal_uart_close(void *hdl);
538 
550 void hal_uart_putc(void *hdl, char c);
551 
563 int hal_uart_xmit_poll(void *hdl, uint8_t *buffer, uint32_t buffer_len);
564 
576 int hal_uart_rcvd_poll(void *hdl, uint8_t *buffer, uint32_t buffer_len);
577 
596 int hal_uart_xmit_intr(void *hdl, uint8_t *buffer, uint32_t buffer_len);
597 
612 int hal_uart_xmit_intr_hci(void* hdl, uint8_t* buffer, uint32_t buffer_len, void* cb_arg, void (*callback)(void* arg, int length, int error));
631 int hal_uart_rcvd_intr(void *hdl, uint8_t *buffer, uint32_t buffer_len, uint32_t tmo, uint32_t *actual_rx_len);
632 
647 int hal_uart_rcvd_intr_hci(void* hdl, uint8_t* buffer, uint32_t buffer_len, void* cb_arg, void (*callback)(void* arg, int length, int error));
657 int hal_uart_flow_on(void *hdl);
658 
668 int hal_uart_flow_off(void *hdl);
669 
681 int hal_uart_xmit_dma(void *hdl, uint8_t *buffer, uint32_t buffer_len);
682 
696 int hal_uart_rcvd_dma(void *hdl, uint8_t *buffer, uint32_t buffer_len, uint32_t tmo, uint32_t *actual_rx_len);
697 
698 
699 
708 void hal_uart_cancel(void* hdl);
709 
710 
722 int hal_uart_en_break(void* hdl, char en, void (*cb)(void*), void* arg);
723 
732 int hal_uart_en_unbreak_int(void *hdl);
733 
734 
735 
736 #endif // HAL_UART_H
737 
int hal_uart_rcvd_intr_hci(void *hdl, uint8_t *buffer, uint32_t buffer_len, void *cb_arg, void(*callback)(void *arg, int length, int error))
HCI Uart RX by interrupt.
int hal_uart_en_break(void *hdl, char en, void(*cb)(void *), void *arg)
enable uart break feature. Use uart break signal to wake chip.
int hal_uart_rcvd_intr(void *hdl, uint8_t *buffer, uint32_t buffer_len, uint32_t tmo, uint32_t *actual_rx_len)
Uart RX by interrupt.
int hal_uart_xmit_dma(void *hdl, uint8_t *buffer, uint32_t buffer_len)
Uart TX by DMA.
int fc
Uart controller flow control enable, 1: enable, 0: disable.
Definition: hal_uart.h:190
int baud_rate
Uart baud rate.
Definition: hal_uart.h:185
void * hal_uart_open(int id, uart_init_t *init)
Open the uart driver.
int hal_uart_flow_off(void *hdl)
Manually turn off RTS request.
int parity_en
Uart parity enable, 0: disable, 1: enable.
Definition: hal_uart.h:188
void * rx_arg
rx callback argument
Definition: hal_uart.h:193
int hal_uart_xmit_poll(void *hdl, uint8_t *buffer, uint32_t buffer_len)
Uart TX by polling.
int hal_uart_flow_on(void *hdl)
Manually turn on RTS request.
void hal_uart_close(void *hdl)
Close the uart driver.
int hal_uart_xmit_intr_hci(void *hdl, uint8_t *buffer, uint32_t buffer_len, void *cb_arg, void(*callback)(void *arg, int length, int error))
HCI Uart TX by interrupt.
int data_len
Uart char length,.
Definition: hal_uart.h:186
int stop_bit
Uart stop bits, 0: 1 stop bit, 1: 2 stop bits.
Definition: hal_uart.h:187
int prio
interrupt priority
Definition: hal_uart.h:192
int hal_uart_rcvd_poll(void *hdl, uint8_t *buffer, uint32_t buffer_len)
Uart RX by polling.
int hal_uart_rcvd_dma(void *hdl, uint8_t *buffer, uint32_t buffer_len, uint32_t tmo, uint32_t *actual_rx_len)
Uart RX by DMA.
void hal_uart_putc(void *hdl, char c)
Output 1 char.
void * tx_arg
tx callback argument
Definition: hal_uart.h:195
void hal_uart_cancel(void *hdl)
cancel uart rx
int hal_uart_en_unbreak_int(void *hdl)
enable uart break interrupt
int no_intr
Uart don&#39;t generate interrupt.
Definition: hal_uart.h:191
int even_parity
Uart even parity, 0: odd parity, 1: even parity.
Definition: hal_uart.h:189
int hal_uart_xmit_intr(void *hdl, uint8_t *buffer, uint32_t buffer_len)
Uart TX by interrupt.