ESP8266 Centre + NB
结构体 | 宏定义 | 枚举 | 函数
include/driver/uart.h 文件参考
#include "uart_register.h"
#include "eagle_soc.h"
#include "c_types.h"
include/driver/uart.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

结构体

struct  RcvMsgBuff
 
struct  TrxMsgBuff
 
struct  UartDevice
 
struct  UartBuffer
 
struct  UartRxBuff
 

宏定义

#define UART_TX_BUFFER_SIZE   256
 
#define UART_RX_BUFFER_SIZE   256
 
#define UART_BUFF_EN   1
 
#define UART_SELFTEST   1
 
#define UART_HW_RTS   0
 
#define UART_HW_CTS   0
 
#define UART0   0
 
#define UART1   1
 
#define UART_FIFO_LEN   128
 
#define UART_TX_EMPTY_THRESH_VAL   0x10
 
#define FUNC_UART0_CTS   4
 
#define FUNC_U0CTS   4
 
#define FUNC_U1TXD_BK   2
 
#define UART_LINE_INV_MASK   (0x3f<<19)
 

枚举

enum  UartBitsNum4Char {
  FIVE_BITS = 0x0, SIX_BITS = 0x1, SEVEN_BITS = 0x2, EIGHT_BITS = 0x3,
  FIVE_BITS = 0x0, SIX_BITS = 0x1, SEVEN_BITS = 0x2, EIGHT_BITS = 0x3
}
 
enum  UartStopBitsNum {
  ONE_STOP_BIT = 0x1, ONE_HALF_STOP_BIT = 0x2, TWO_STOP_BIT = 0x3, ONE_STOP_BIT = 0x1,
  ONE_HALF_STOP_BIT = 0x2, TWO_STOP_BIT = 0x3
}
 
enum  UartParityMode {
  NONE_BITS = 0x2, ODD_BITS = 1, EVEN_BITS = 0, NONE_BITS = 0x2,
  ODD_BITS = 1, EVEN_BITS = 0
}
 
enum  UartExistParity { STICK_PARITY_DIS = 0, STICK_PARITY_EN = 1, STICK_PARITY_DIS = 0, STICK_PARITY_EN = 1 }
 
enum  UART_LineLevelInverse {
  UART_None_Inverse = 0x0, UART_Rxd_Inverse = UART_RXD_INV, UART_CTS_Inverse = UART_CTS_INV, UART_Txd_Inverse = UART_TXD_INV,
  UART_RTS_Inverse = UART_RTS_INV, UART_None_Inverse = 0x0, UART_Rxd_Inverse = UART_RXD_INV, UART_CTS_Inverse = UART_CTS_INV,
  UART_Txd_Inverse = UART_TXD_INV, UART_RTS_Inverse = UART_RTS_INV
}
 
enum  UartBautRate {
  BIT_RATE_300 = 300, BIT_RATE_600 = 600, BIT_RATE_1200 = 1200, BIT_RATE_2400 = 2400,
  BIT_RATE_4800 = 4800, BIT_RATE_9600 = 9600, BIT_RATE_19200 = 19200, BIT_RATE_38400 = 38400,
  BIT_RATE_57600 = 57600, BIT_RATE_74880 = 74880, BIT_RATE_115200 = 115200, BIT_RATE_230400 = 230400,
  BIT_RATE_460800 = 460800, BIT_RATE_921600 = 921600, BIT_RATE_1843200 = 1843200, BIT_RATE_3686400 = 3686400,
  BIT_RATE_300 = 300, BIT_RATE_600 = 600, BIT_RATE_1200 = 1200, BIT_RATE_2400 = 2400,
  BIT_RATE_4800 = 4800, BIT_RATE_9600 = 9600, BIT_RATE_19200 = 19200, BIT_RATE_38400 = 38400,
  BIT_RATE_57600 = 57600, BIT_RATE_74880 = 74880, BIT_RATE_115200 = 115200, BIT_RATE_230400 = 230400,
  BIT_RATE_460800 = 460800, BIT_RATE_921600 = 921600, BIT_RATE_1843200 = 1843200, BIT_RATE_3686400 = 3686400
}
 
enum  UartFlowCtrl {
  NONE_CTRL, HARDWARE_CTRL, XON_XOFF_CTRL, NONE_CTRL,
  HARDWARE_CTRL, XON_XOFF_CTRL
}
 
enum  UART_HwFlowCtrl {
  USART_HardwareFlowControl_None = 0x0, USART_HardwareFlowControl_RTS = 0x1, USART_HardwareFlowControl_CTS = 0x2, USART_HardwareFlowControl_CTS_RTS = 0x3,
  USART_HardwareFlowControl_None = 0x0, USART_HardwareFlowControl_RTS = 0x1, USART_HardwareFlowControl_CTS = 0x2, USART_HardwareFlowControl_CTS_RTS = 0x3
}
 
enum  RcvMsgBuffState {
  EMPTY, UNDER_WRITE, WRITE_OVER, EMPTY,
  UNDER_WRITE, WRITE_OVER
}
 
enum  RcvMsgState {
  BAUD_RATE_DET, WAIT_SYNC_FRM, SRCH_MSG_HEAD, RCV_MSG_BODY,
  RCV_ESC_CHAR, BAUD_RATE_DET, WAIT_SYNC_FRM, SRCH_MSG_HEAD,
  RCV_MSG_BODY, RCV_ESC_CHAR
}
 
enum  TCPState { RUN = 0, BLOCK = 1, RUN = 0, BLOCK = 1 }
 

函数

void uart_init (UartBautRate uart0_br, UartBautRate uart1_br)
 
void uart0_sendStr (const char *str)
 
STATUS uart_tx_one_char (uint8 uart, uint8 TxChar)
 
STATUS uart_tx_one_char_no_wait (uint8 uart, uint8 TxChar)
 
void uart1_sendStr_no_wait (const char *str)
 
struct UartBufferUart_Buf_Init ()
 
LOCAL void Uart_Buf_Cpy (struct UartBuffer *pCur, char *pdata, uint16 data_len)
 
void uart_buf_free (struct UartBuffer *pBuff)
 
void tx_buff_enq (char *pdata, uint16 data_len)
 
LOCAL void tx_fifo_insert (struct UartBuffer *pTxBuff, uint8 data_len, uint8 uart_no)
 
void tx_start_uart_buffer (uint8 uart_no)
 
uint16 rx_buff_deq (char *pdata, uint16 data_len)
 
void Uart_rx_buff_enq ()
 
void uart_rx_intr_enable (uint8 uart_no)
 
void uart_rx_intr_disable (uint8 uart_no)
 
void uart0_tx_buffer (uint8 *buf, uint16 len)
 
void UART_SetWordLength (uint8 uart_no, UartBitsNum4Char len)
 
void UART_SetStopBits (uint8 uart_no, UartStopBitsNum bit_num)
 
void UART_SetLineInverse (uint8 uart_no, UART_LineLevelInverse inverse_mask)
 
void UART_SetParity (uint8 uart_no, UartParityMode Parity_mode)
 
void UART_SetBaudrate (uint8 uart_no, uint32 baud_rate)
 
void UART_SetFlowCtrl (uint8 uart_no, UART_HwFlowCtrl flow_ctrl, uint8 rx_thresh)
 
void UART_WaitTxFifoEmpty (uint8 uart_no, uint32 time_out_us)
 
void UART_ResetFifo (uint8 uart_no)
 
void UART_ClearIntrStatus (uint8 uart_no, uint32 clr_mask)
 
void UART_SetIntrEna (uint8 uart_no, uint32 ena_mask)
 
void UART_SetPrintPort (uint8 uart_no)
 
bool UART_CheckOutputFinished (uint8 uart_no, uint32 time_out_us)
 

宏定义说明

#define UART_TX_BUFFER_SIZE   256
#define UART_RX_BUFFER_SIZE   256
#define UART_BUFF_EN   1
#define UART_SELFTEST   1
#define UART_HW_RTS   0
#define UART_HW_CTS   0
#define UART0   0
#define UART1   1
#define UART_FIFO_LEN   128
#define UART_TX_EMPTY_THRESH_VAL   0x10
#define FUNC_UART0_CTS   4
#define FUNC_U0CTS   4
#define FUNC_U1TXD_BK   2
#define UART_LINE_INV_MASK   (0x3f<<19)

枚举类型说明

枚举值
FIVE_BITS 
SIX_BITS 
SEVEN_BITS 
EIGHT_BITS 
FIVE_BITS 
SIX_BITS 
SEVEN_BITS 
EIGHT_BITS 
48  {
49  FIVE_BITS = 0x0,
50  SIX_BITS = 0x1,
51  SEVEN_BITS = 0x2,
52  EIGHT_BITS = 0x3
Definition: include/driver/uart.h:49
Definition: include/driver/uart.h:52
UartBitsNum4Char
Definition: include/driver/uart.h:48
Definition: include/driver/uart.h:50
Definition: include/driver/uart.h:51
枚举值
ONE_STOP_BIT 
ONE_HALF_STOP_BIT 
TWO_STOP_BIT 
ONE_STOP_BIT 
ONE_HALF_STOP_BIT 
TWO_STOP_BIT 
55  {
56  ONE_STOP_BIT = 0x1,
57  ONE_HALF_STOP_BIT = 0x2,
58  TWO_STOP_BIT = 0x3
Definition: include/driver/uart.h:56
UartStopBitsNum
Definition: include/driver/uart.h:55
Definition: include/driver/uart.h:58
Definition: include/driver/uart.h:57
枚举值
NONE_BITS 
ODD_BITS 
EVEN_BITS 
NONE_BITS 
ODD_BITS 
EVEN_BITS 
61  {
62  NONE_BITS = 0x2,
63  ODD_BITS = 1,
64  EVEN_BITS = 0
Definition: include/driver/uart.h:64
Definition: include/driver/uart.h:62
Definition: include/driver/uart.h:63
UartParityMode
Definition: include/driver/uart.h:61
枚举值
STICK_PARITY_DIS 
STICK_PARITY_EN 
STICK_PARITY_DIS 
STICK_PARITY_EN 
67  {
68  STICK_PARITY_DIS = 0,
69  STICK_PARITY_EN = 1
UartExistParity
Definition: include/driver/uart.h:67
Definition: include/driver/uart.h:68
Definition: include/driver/uart.h:69
枚举值
UART_None_Inverse 
UART_Rxd_Inverse 
UART_CTS_Inverse 
UART_Txd_Inverse 
UART_RTS_Inverse 
UART_None_Inverse 
UART_Rxd_Inverse 
UART_CTS_Inverse 
UART_Txd_Inverse 
UART_RTS_Inverse 
72  {
73  UART_None_Inverse = 0x0,
#define UART_RXD_INV
Definition: driver/uart_register.h:106
UART_LineLevelInverse
Definition: include/driver/uart.h:72
Definition: include/driver/uart.h:76
Definition: include/driver/uart.h:74
Definition: include/driver/uart.h:73
Definition: include/driver/uart.h:77
#define UART_CTS_INV
Definition: driver/uart_register.h:105
Definition: include/driver/uart.h:75
#define UART_TXD_INV
Definition: driver/uart_register.h:103
#define UART_RTS_INV
Definition: driver/uart_register.h:102
枚举值
BIT_RATE_300 
BIT_RATE_600 
BIT_RATE_1200 
BIT_RATE_2400 
BIT_RATE_4800 
BIT_RATE_9600 
BIT_RATE_19200 
BIT_RATE_38400 
BIT_RATE_57600 
BIT_RATE_74880 
BIT_RATE_115200 
BIT_RATE_230400 
BIT_RATE_460800 
BIT_RATE_921600 
BIT_RATE_1843200 
BIT_RATE_3686400 
BIT_RATE_300 
BIT_RATE_600 
BIT_RATE_1200 
BIT_RATE_2400 
BIT_RATE_4800 
BIT_RATE_9600 
BIT_RATE_19200 
BIT_RATE_38400 
BIT_RATE_57600 
BIT_RATE_74880 
BIT_RATE_115200 
BIT_RATE_230400 
BIT_RATE_460800 
BIT_RATE_921600 
BIT_RATE_1843200 
BIT_RATE_3686400 
81  {
82  BIT_RATE_300 = 300,
83  BIT_RATE_600 = 600,
84  BIT_RATE_1200 = 1200,
85  BIT_RATE_2400 = 2400,
86  BIT_RATE_4800 = 4800,
87  BIT_RATE_9600 = 9600,
88  BIT_RATE_19200 = 19200,
89  BIT_RATE_38400 = 38400,
90  BIT_RATE_57600 = 57600,
91  BIT_RATE_74880 = 74880,
92  BIT_RATE_115200 = 115200,
93  BIT_RATE_230400 = 230400,
94  BIT_RATE_460800 = 460800,
95  BIT_RATE_921600 = 921600,
96  BIT_RATE_1843200 = 1843200,
97  BIT_RATE_3686400 = 3686400,
98 } UartBautRate;
UartBautRate
Definition: include/driver/uart.h:81
Definition: include/driver/uart.h:92
Definition: include/driver/uart.h:95
Definition: include/driver/uart.h:84
Definition: include/driver/uart.h:83
Definition: include/driver/uart.h:97
Definition: include/driver/uart.h:89
Definition: include/driver/uart.h:82
Definition: include/driver/uart.h:91
Definition: include/driver/uart.h:86
Definition: include/driver/uart.h:94
Definition: include/driver/uart.h:88
Definition: include/driver/uart.h:93
Definition: include/driver/uart.h:85
Definition: include/driver/uart.h:90
Definition: include/driver/uart.h:96
Definition: include/driver/uart.h:87
枚举值
NONE_CTRL 
HARDWARE_CTRL 
XON_XOFF_CTRL 
NONE_CTRL 
HARDWARE_CTRL 
XON_XOFF_CTRL 
100  {
101  NONE_CTRL,
104 } UartFlowCtrl;
Definition: include/driver/uart.h:103
Definition: include/driver/uart.h:101
Definition: include/driver/uart.h:102
UartFlowCtrl
Definition: include/driver/uart.h:100
枚举值
USART_HardwareFlowControl_None 
USART_HardwareFlowControl_RTS 
USART_HardwareFlowControl_CTS 
USART_HardwareFlowControl_CTS_RTS 
USART_HardwareFlowControl_None 
USART_HardwareFlowControl_RTS 
USART_HardwareFlowControl_CTS 
USART_HardwareFlowControl_CTS_RTS 
106  {
UART_HwFlowCtrl
Definition: include/driver/uart.h:106
Definition: include/driver/uart.h:109
Definition: include/driver/uart.h:107
Definition: include/driver/uart.h:110
Definition: include/driver/uart.h:108
枚举值
EMPTY 
UNDER_WRITE 
WRITE_OVER 
EMPTY 
UNDER_WRITE 
WRITE_OVER 
113  {
114  EMPTY,
115  UNDER_WRITE,
116  WRITE_OVER
Definition: include/driver/uart.h:115
RcvMsgBuffState
Definition: include/driver/uart.h:113
Definition: include/driver/uart.h:116
Definition: include/driver/uart.h:114
枚举值
BAUD_RATE_DET 
WAIT_SYNC_FRM 
SRCH_MSG_HEAD 
RCV_MSG_BODY 
RCV_ESC_CHAR 
BAUD_RATE_DET 
WAIT_SYNC_FRM 
SRCH_MSG_HEAD 
RCV_MSG_BODY 
RCV_ESC_CHAR 
133  {
137  RCV_MSG_BODY,
138  RCV_ESC_CHAR,
139 } RcvMsgState;
Definition: include/driver/uart.h:137
Definition: include/driver/uart.h:138
Definition: include/driver/uart.h:136
Definition: include/driver/uart.h:135
RcvMsgState
Definition: include/driver/uart.h:133
Definition: include/driver/uart.h:134
enum TCPState
枚举值
RUN 
BLOCK 
RUN 
BLOCK 
184  {
185  RUN = 0,
186  BLOCK = 1,
187 } TCPState;
TCPState
Definition: include/driver/uart.h:184
Definition: include/driver/uart.h:185
Definition: include/driver/uart.h:186

函数说明

void uart_init ( UartBautRate  uart0_br,
UartBautRate  uart1_br 
)
354 {
355  /*this is a example to process uart data from task,please change the priority to fit your application task if exists*/
356  system_os_task(uart_recvTask, uart_recvTaskPrio, uart_recvTaskQueue, uart_recvTaskQueueLen); //demo with a task to process the uart data
357 
358  UartDev.baut_rate = uart0_br;
360  UartDev.baut_rate = uart1_br;
363 
364  #if UART_BUFF_EN
367  #endif
368 
369 
370  /*option 1: use default print, output from uart0 , will wait some time if fifo is full */
371  //do nothing...
372 
373  /*option 2: output from uart1,uart1 output will not wait , just for output debug info */
374  /*os_printf output uart data via uart1(GPIO2)*/
375  //os_install_putc1((void *)uart1_write_char); //use this one to output debug information via uart1 //
376 
377  /*option 3: output from uart0 will skip current byte if fifo is full now... */
378  /*see uart0_write_char_no_wait:you can output via a buffer or output directly */
379  /*os_printf output uart data via uart0 or uart buffer*/
380  //os_install_putc1((void *)uart0_write_char_no_wait); //use this to print via uart0
381 
382  #if UART_SELFTEST&UART_BUFF_EN
383  os_timer_disarm(&buff_timer_t);
384  os_timer_setfn(&buff_timer_t, uart_test_rx , NULL); //a demo to process the data in uart rx buffer
385  os_timer_arm(&buff_timer_t,10,1);
386  #endif
387 }
#define os_timer_disarm
Definition: osapi.h:51
#define UART_TX_BUFFER_SIZE
Definition: driver/uart.h:47
#define ETS_UART_INTR_ENABLE()
Definition: ets_sys.h:93
UartBautRate baut_rate
Definition: driver/uart.h:153
#define UART_RX_BUFFER_SIZE
Definition: driver/uart.h:48
os_event_t uart_recvTaskQueue[uart_recvTaskQueueLen]
Definition: uart.c:52
#define uart_recvTaskQueueLen
Definition: uart.c:51
#define os_timer_setfn
Definition: osapi.h:52
bool system_os_task(os_task_t task, uint8 prio, os_event_t *queue, uint8 qlen)
LOCAL void ICACHE_FLASH_ATTR uart_config(uint8 uart_no)
Definition: uart.c:70
struct UartBuffer * Uart_Buf_Init()
#define UART0
Definition: driver/uart.h:56
#define NULL
Definition: c_types.h:73
LOCAL struct UartBuffer * pRxBuffer
Definition: uart.c:45
LOCAL void ICACHE_FLASH_ATTR uart_recvTask(os_event_t *events)
Definition: uart.c:326
#define uart_recvTaskPrio
Definition: uart.c:50
#define os_timer_arm(a, b, c)
Definition: osapi.h:50
UartDevice UartDev
#define UART1
Definition: driver/uart.h:57
LOCAL struct UartBuffer * pTxBuffer
Definition: uart.c:44

函数调用图:

这是这个函数的调用关系图:

void uart0_sendStr ( const char *  str)
232 {
233  while(*str){
234  uart_tx_one_char(UART0, *str++);
235  }
236 }
STATUS uart_tx_one_char(uint8 uart, uint8 TxChar)
Definition: uart.c:128
#define UART0
Definition: driver/uart.h:56

函数调用图:

STATUS uart_tx_one_char ( uint8  uart,
uint8  TxChar 
)
129 {
130  while (true){
132  if ((fifo_cnt >> UART_TXFIFO_CNT_S & UART_TXFIFO_CNT) < 126) {
133  break;
134  }
135  }
136  WRITE_PERI_REG(UART_FIFO(uart) , TxChar);
137  return OK;
138 }
#define UART_TXFIFO_CNT_S
Definition: driver/uart_register.h:93
#define READ_PERI_REG(addr)
Definition: eagle_soc.h:68
#define UART_TXFIFO_CNT
Definition: driver/uart_register.h:92
#define WRITE_PERI_REG(addr, val)
Definition: eagle_soc.h:69
Definition: c_types.h:78
#define UART_STATUS(i)
Definition: driver/uart_register.h:88
unsigned int uint32
Definition: c_types.h:52
#define UART_FIFO(i)
Definition: driver/uart_register.h:31

这是这个函数的调用关系图:

STATUS uart_tx_one_char_no_wait ( uint8  uart,
uint8  TxChar 
)
403 {
405  if (fifo_cnt < 126) {
406  WRITE_PERI_REG(UART_FIFO(uart) , TxChar);
407  }
408  return OK;
409 }
#define UART_TXFIFO_CNT_S
Definition: driver/uart_register.h:93
#define READ_PERI_REG(addr)
Definition: eagle_soc.h:68
#define UART_TXFIFO_CNT
Definition: driver/uart_register.h:92
#define WRITE_PERI_REG(addr, val)
Definition: eagle_soc.h:69
unsigned char uint8
Definition: c_types.h:43
Definition: c_types.h:78
#define UART_STATUS(i)
Definition: driver/uart_register.h:88
#define UART_FIFO(i)
Definition: driver/uart_register.h:31

这是这个函数的调用关系图:

void uart1_sendStr_no_wait ( const char *  str)
428 {
429  while(*str){
431  }
432 }
STATUS uart_tx_one_char_no_wait(uint8 uart, uint8 TxChar)
Definition: uart.c:402
#define UART1
Definition: driver/uart.h:57

函数调用图:

struct UartBuffer* Uart_Buf_Init ( )
LOCAL void Uart_Buf_Cpy ( struct UartBuffer pCur,
char *  pdata,
uint16  data_len 
)
void uart_buf_free ( struct UartBuffer pBuff)
void tx_buff_enq ( char *  pdata,
uint16  data_len 
)
LOCAL void tx_fifo_insert ( struct UartBuffer pTxBuff,
uint8  data_len,
uint8  uart_no 
)
void tx_start_uart_buffer ( uint8  uart_no)
uint16 rx_buff_deq ( char *  pdata,
uint16  data_len 
)
void Uart_rx_buff_enq ( )
void uart_rx_intr_enable ( uint8  uart_no)
659 {
660 #if 1
662 #else
664 #endif
665 }
#define UART_RXFIFO_FULL_INT_ENA
Definition: driver/uart_register.h:66
#define ETS_UART_INTR_ENABLE()
Definition: ets_sys.h:93
#define UART_INT_ENA(i)
Definition: driver/uart_register.h:57
#define SET_PERI_REG_MASK(reg, mask)
Definition: eagle_soc.h:71
#define UART_RXFIFO_TOUT_INT_ENA
Definition: driver/uart_register.h:58

这是这个函数的调用关系图:

void uart_rx_intr_disable ( uint8  uart_no)
650 {
651 #if 1
653 #else
655 #endif
656 }
#define UART_RXFIFO_FULL_INT_ENA
Definition: driver/uart_register.h:66
#define UART_INT_ENA(i)
Definition: driver/uart_register.h:57
#define CLEAR_PERI_REG_MASK(reg, mask)
Definition: eagle_soc.h:70
#define ETS_UART_INTR_DISABLE()
Definition: ets_sys.h:96
#define UART_RXFIFO_TOUT_INT_ENA
Definition: driver/uart_register.h:58

这是这个函数的调用关系图:

void uart0_tx_buffer ( uint8 buf,
uint16  len 
)
198 {
199  uint16 i;
200  for (i = 0; i < len; i++)
201  {
202  uart_tx_one_char(UART0, buf[i]);
203  }
204 }
unsigned short uint16
Definition: c_types.h:48
STATUS uart_tx_one_char(uint8 uart, uint8 TxChar)
Definition: uart.c:128
#define UART0
Definition: driver/uart.h:56

函数调用图:

void UART_SetWordLength ( uint8  uart_no,
UartBitsNum4Char  len 
)
683 {
685 }
#define UART_CONF0(i)
Definition: driver/uart_register.h:100
#define UART_BIT_NUM
Definition: driver/uart_register.h:122
#define UART_BIT_NUM_S
Definition: driver/uart_register.h:123
#define SET_PERI_REG_BITS(reg, bit_map, value, shift)
Definition: eagle_soc.h:73
void UART_SetStopBits ( uint8  uart_no,
UartStopBitsNum  bit_num 
)
689 {
691 }
#define UART_CONF0(i)
Definition: driver/uart_register.h:100
#define UART_STOP_BIT_NUM_S
Definition: driver/uart_register.h:121
#define UART_STOP_BIT_NUM
Definition: driver/uart_register.h:120
#define SET_PERI_REG_BITS(reg, bit_map, value, shift)
Definition: eagle_soc.h:73
void UART_SetLineInverse ( uint8  uart_no,
UART_LineLevelInverse  inverse_mask 
)
695 {
697  SET_PERI_REG_MASK(UART_CONF0(uart_no), inverse_mask);
698 }
#define UART_CONF0(i)
Definition: driver/uart_register.h:100
#define CLEAR_PERI_REG_MASK(reg, mask)
Definition: eagle_soc.h:70
#define UART_LINE_INV_MASK
Definition: driver/uart.h:225
#define SET_PERI_REG_MASK(reg, mask)
Definition: eagle_soc.h:71
void UART_SetParity ( uint8  uart_no,
UartParityMode  Parity_mode 
)
702 {
704  if(Parity_mode==NONE_BITS){
705  }else{
706  SET_PERI_REG_MASK(UART_CONF0(uart_no), Parity_mode|UART_PARITY_EN);
707  }
708 }
#define UART_CONF0(i)
Definition: driver/uart_register.h:100
#define CLEAR_PERI_REG_MASK(reg, mask)
Definition: eagle_soc.h:70
#define UART_PARITY
Definition: driver/uart_register.h:127
Definition: driver/uart.h:73
#define UART_PARITY_EN
Definition: driver/uart_register.h:124
#define SET_PERI_REG_MASK(reg, mask)
Definition: eagle_soc.h:71
void UART_SetBaudrate ( uint8  uart_no,
uint32  baud_rate 
)
712 {
713  uart_div_modify(uart_no, UART_CLK_FREQ /baud_rate);
714 }
#define UART_CLK_FREQ
Definition: eagle_soc.h:78
void UART_SetFlowCtrl ( uint8  uart_no,
UART_HwFlowCtrl  flow_ctrl,
uint8  rx_thresh 
)
718 {
719  if(flow_ctrl&USART_HardwareFlowControl_RTS){
723  }else{
725  }
726  if(flow_ctrl&USART_HardwareFlowControl_CTS){
729  }else{
731  }
732 }
#define PIN_FUNC_SELECT(PIN_NAME, FUNC)
Definition: eagle_soc.h:270
#define UART_CONF0(i)
Definition: driver/uart_register.h:100
#define FUNC_U0RTS
Definition: eagle_soc.h:227
#define UART_RX_FLOW_EN
Definition: driver/uart_register.h:135
#define PERIPHS_IO_MUX_MTCK_U
Definition: eagle_soc.h:221
#define UART_TX_FLOW_EN
Definition: driver/uart_register.h:110
#define CLEAR_PERI_REG_MASK(reg, mask)
Definition: eagle_soc.h:70
#define UART_RX_FLOW_THRHD
Definition: driver/uart_register.h:136
#define UART_CONF1(i)
Definition: driver/uart_register.h:131
#define PERIPHS_IO_MUX_MTDO_U
Definition: eagle_soc.h:225
#define FUNC_UART0_CTS
Definition: driver/uart.h:222
Definition: driver/uart.h:120
#define SET_PERI_REG_MASK(reg, mask)
Definition: eagle_soc.h:71
#define SET_PERI_REG_BITS(reg, bit_map, value, shift)
Definition: eagle_soc.h:73
Definition: driver/uart.h:119
#define UART_RX_FLOW_THRHD_S
Definition: driver/uart_register.h:137
void UART_WaitTxFifoEmpty ( uint8  uart_no,
uint32  time_out_us 
)
736 {
737  uint32 t_s = system_get_time();
739 
740  if(( system_get_time() - t_s )> time_out_us){
741  break;
742  }
743  WRITE_PERI_REG(0X60000914, 0X73);//WTD
744 
745  }
746 }
#define UART_TXFIFO_CNT_S
Definition: driver/uart_register.h:93
#define READ_PERI_REG(addr)
Definition: eagle_soc.h:68
#define UART_TXFIFO_CNT
Definition: driver/uart_register.h:92
uint32 system_get_time(void)
#define WRITE_PERI_REG(addr, val)
Definition: eagle_soc.h:69
#define UART_STATUS(i)
Definition: driver/uart_register.h:88
unsigned int uint32
Definition: c_types.h:52

函数调用图:

void UART_ResetFifo ( uint8  uart_no)
776 {
779 }
#define UART_CONF0(i)
Definition: driver/uart_register.h:100
#define CLEAR_PERI_REG_MASK(reg, mask)
Definition: eagle_soc.h:70
#define UART_RXFIFO_RST
Definition: driver/uart_register.h:108
#define SET_PERI_REG_MASK(reg, mask)
Definition: eagle_soc.h:71
#define UART_TXFIFO_RST
Definition: driver/uart_register.h:107
void UART_ClearIntrStatus ( uint8  uart_no,
uint32  clr_mask 
)
783 {
784  WRITE_PERI_REG(UART_INT_CLR(uart_no), clr_mask);
785 }
#define WRITE_PERI_REG(addr, val)
Definition: eagle_soc.h:69
#define UART_INT_CLR(i)
Definition: driver/uart_register.h:68
void UART_SetIntrEna ( uint8  uart_no,
uint32  ena_mask 
)
789 {
790  SET_PERI_REG_MASK(UART_INT_ENA(uart_no), ena_mask);
791 }
#define UART_INT_ENA(i)
Definition: driver/uart_register.h:57
#define SET_PERI_REG_MASK(reg, mask)
Definition: eagle_soc.h:71
void UART_SetPrintPort ( uint8  uart_no)
796 {
797  if(uart_no==1){
799  }else{
800  /*option 1: do not wait if uart fifo is full,drop current character*/
802  /*option 2: wait for a while if uart fifo is full*/
804  }
805 }
LOCAL void ICACHE_FLASH_ATTR uart1_write_char(char c)
Definition: uart.c:148
LOCAL void uart0_write_char(char c)
Definition: uart.c:670
#define os_install_putc1
Definition: osapi.h:33
LOCAL void ICACHE_FLASH_ATTR uart0_write_char_no_wait(char c)
Definition: uart.c:162

函数调用图:

bool UART_CheckOutputFinished ( uint8  uart_no,
uint32  time_out_us 
)
751 {
752  uint32 t_start = system_get_time();
753  uint8 tx_fifo_len;
754  uint32 tx_buff_len;
755  while(1){
756  tx_fifo_len =( (READ_PERI_REG(UART_STATUS(uart_no))>>UART_TXFIFO_CNT_S)&UART_TXFIFO_CNT);
757  if(pTxBuffer){
758  tx_buff_len = ((pTxBuffer->UartBuffSize)-(pTxBuffer->Space));
759  }else{
760  tx_buff_len = 0;
761  }
762 
763  if( tx_fifo_len==0 && tx_buff_len==0){
764  return TRUE;
765  }
766  if( system_get_time() - t_start > time_out_us){
767  return FALSE;
768  }
769  WRITE_PERI_REG(0X60000914, 0X73);//WTD
770  }
771 }
#define UART_TXFIFO_CNT_S
Definition: driver/uart_register.h:93
#define READ_PERI_REG(addr)
Definition: eagle_soc.h:68
#define UART_TXFIFO_CNT
Definition: driver/uart_register.h:92
#define FALSE
Definition: c_types.h:109
#define TRUE
Definition: c_types.h:108
uint32 system_get_time(void)
#define WRITE_PERI_REG(addr, val)
Definition: eagle_soc.h:69
uint16 Space
Definition: driver/uart.h:181
unsigned char uint8
Definition: c_types.h:43
#define UART_STATUS(i)
Definition: driver/uart_register.h:88
unsigned int uint32
Definition: c_types.h:52
LOCAL struct UartBuffer * pTxBuffer
Definition: uart.c:44
uint32 UartBuffSize
Definition: driver/uart.h:176

函数调用图: