📄 bsp_uart.h
字号:
#ifndef __UART_H__
#define __UART_H__
#include "71x_lib.h"
#define UART_GPRS 4
#define UART_IRDA 3
#define UART_RS232 0
#define UART_RS485_1 1
#define UART_RS485_2 2
#define MAX_UART_RXDBUF_SIZE 4096 // 定义最大的缓冲区长度
#define MC_COMBUF_BLKNUM 8 // 定义临时缓冲区的数量
#define UART_PARITY_EVEN 0x00
#define UART_PARITY_ODD 0x01
#define UART_PARITY_NO 0x02
#define UART_STOPBITS_0_5 0x00
#define UART_STOPBITS_1 0x01
#define UART_STOPBITS_1_5 0x02
#define UART_STOPBITS_2 0x03
#define UART_MODE_8D 0x00
#define UART_MODE_7D_P 0x01
#define UART_MODE_9D 0x02
#define UART_MODE_8D_W 0x03
#define UART_MODE_8D_P 0x04
#define UART0_Rx_Pin (0x0001<<8) /* TQFP 64: pin N?63 , TQFP 144 pin N?143 */
#define UART0_Tx_Pin (0x0001<<9) /* TQFP 64: pin N?64 , TQFP 144 pin N?144 */
#define UART1_Rx_Pin (0x0001<<10) /* TQFP 64: pin N?1 , TQFP 144 pin N?1 */
#define UART1_Tx_Pin (0x0001<<11) /* TQFP 64: pin N?2 , TQFP 144 pin N?3 */
#define UART2_Rx_Pin (0x0001<<13) /* TQFP 64: pin N?5 , TQFP 144 pin N?9 */
#define UART2_Tx_Pin (0x0001<<14) /* TQFP 64: pin N?6 , TQFP 144 pin N?10 */
//#define UART3_Rx_Pin (0x0001<<1) /* TQFP 64: pin N?52 , TQFP 144 pin N?123 */
//#define UART3_Tx_Pin (0x0001<<0) /* TQFP 64: pin N?53 , TQFP 144 pin N?124 */
// ========================= <<<<<<<< For TCP Protocl Stack >>>>>>> ========================= //
#pragma arm section rwdata = "SRAM",zidata = "SRAM"
typedef struct _sr_RXD_buf
{
u16 in;
u16 out;
u8 msg[MAX_UART_RXDBUF_SIZE];
}sr_RXD_buf;
#pragma arm section
// ============================================= <<<<<<< Added by likazhou on 07-04-28>>>>>>> //
void UART_open( u8 UARTn, u32 BaudRate, u8 S_parity, u8 S_stopbits, u8 S_mode );
void Discard_nbyte_rxdbuf( u8 UARTn, u16 num );
void clear_rxdbuf( u8 UARTn );
u16 query_rxdbuf_received_byte( u8 UARTn );
u8 read_byte_from_UARTbuf( u8 UARTn, u16 position );
u16 UART_send_mbytes( u8 UARTn, u8 *send_msg, u16 len );
u16 UART_get_line( u8 UARTn, u8 *msg, u16 max_len, u16 timeout );
void UART_rxd_data( void );
void ISR_RXD_read(u8 channel);
void RS485_MUT_wait(u8 port);
void RS485_MUT_release(u8 port);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -