2022-03-26 20:51:40 +08:00

411 lines
8.6 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/********************************** (C) COPYRIGHT *******************************
* File Name : CH57x_uart.h
* Author : WCH
* Version : V1.2
* Date : 2021/11/17
* Description
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* SPDX-License-Identifier: Apache-2.0
*******************************************************************************/
#ifndef __CH58x_UART_H__
#define __CH58x_UART_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief LINE error and status define
*/
#define STA_ERR_BREAK RB_LSR_BREAK_ERR // <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define STA_ERR_FRAME RB_LSR_FRAME_ERR // <20><><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>
#define STA_ERR_PAR RB_LSR_PAR_ERR // <20><>żУ<C5BC><D0A3>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
#define STA_ERR_FIFOOV RB_LSR_OVER_ERR // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define STA_TXFIFO_EMP RB_LSR_TX_FIFO_EMP // <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>FIFO<46>գ<EFBFBD><D5A3><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4B7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define STA_TXALL_EMP RB_LSR_TX_ALL_EMP // <20><>ǰ<EFBFBD><C7B0><EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define STA_RECV_DATA RB_LSR_DATA_RDY // <20><>ǰ<EFBFBD>н<EFBFBD><D0BD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>
/**
* @brief Configuration UART TrigByte num
*/
typedef enum
{
UART_1BYTE_TRIG = 0, // 1<>ֽڴ<D6BD><DAB4><EFBFBD>
UART_2BYTE_TRIG, // 2<>ֽڴ<D6BD><DAB4><EFBFBD>
UART_4BYTE_TRIG, // 4<>ֽڴ<D6BD><DAB4><EFBFBD>
UART_7BYTE_TRIG, // 7<>ֽڴ<D6BD><DAB4><EFBFBD>
} UARTByteTRIGTypeDef;
/**
* @brief <20><><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
void UART0_DefInit(void);
/**
* @brief <20><><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* @param baudrate - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
void UART0_BaudRateCfg(uint32_t baudrate);
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD>ֽڴ<D6BD><DAB4><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
*
* @param b - <20><><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD> refer to UARTByteTRIGTypeDef
*/
void UART0_ByteTrigCfg(UARTByteTRIGTypeDef b);
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
*
* @param s - <20>жϿ<D0B6><CFBF><EFBFBD>״̬<D7B4><CCAC><EFBFBD>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>Ӧ<EFBFBD>ж<EFBFBD>
* @param i - <20>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
* RB_IER_MODEM_CHG - <20><><EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><EFBFBD>ж<EFBFBD>ʹ<EFBFBD><CAB9>λ<EFBFBD><CEBB><EFBFBD><EFBFBD> UART0 ֧<>֣<EFBFBD>
* RB_IER_LINE_STAT - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·״̬<D7B4>ж<EFBFBD>
* RB_IER_THR_EMPTY - <20><><EFBFBD>ͱ<EFBFBD><CDB1>ּĴ<D6BC><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
* RB_IER_RECV_RDY - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
*/
void UART0_INTCfg(FunctionalState s, uint8_t i);
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
*/
void UART0_Reset(void);
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>FIFO
*/
#define UART0_CLR_RXFIFO() (R8_UART0_FCR |= RB_FCR_RX_FIFO_CLR)
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>FIFO
*/
#define UART0_CLR_TXFIFO() (R8_UART0_FCR |= RB_FCR_TX_FIFO_CLR)
/**
* @brief <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD>жϱ<D0B6>־
*
* @return <20><>ǰ<EFBFBD>жϱ<D0B6>־
*/
#define UART0_GetITFlag() (R8_UART0_IIR & RB_IIR_INT_MASK)
/**
* @brief <20><>ȡ<EFBFBD><C8A1>ǰͨѶ״̬
*
* @return refer to LINE error and status define
*/
#define UART0_GetLinSTA() (R8_UART0_LSR)
/**
* @brief <20><><EFBFBD>ڵ<EFBFBD><DAB5>ֽڷ<D6BD><DAB7><EFBFBD>
*
* @param b <20><><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5>ֽ<EFBFBD>
*/
#define UART0_SendByte(b) (R8_UART0_THR = b)
/**
* @brief <20><><EFBFBD>ڶ<EFBFBD><DAB6>ֽڷ<D6BD><DAB7><EFBFBD>
*
* @param buf - <20><><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׵<EFBFBD>ַ
* @param l - <20><><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
*/
void UART0_SendString(uint8_t *buf, uint16_t l);
/**
* @brief <20><><EFBFBD>ڶ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ֽ<EFBFBD>
*
* @return <20><>ȡ<EFBFBD><C8A1><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD>
*/
#define UART0_RecvByte() (R8_UART0_RBR)
/**
* @brief <20><><EFBFBD>ڶ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ֽ<EFBFBD>
*
* @param buf - <20><>ȡ<EFBFBD><C8A1><EFBFBD>ݴ<EFBFBD><DDB4>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׵<EFBFBD>ַ
*
* @return <20><>ȡ<EFBFBD><C8A1><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
*/
uint16_t UART0_RecvString(uint8_t *buf);
/**
* @brief <20><><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
void UART1_DefInit(void);
/**
* @brief <20><><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* @param baudrate - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
void UART1_BaudRateCfg(uint32_t baudrate);
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD>ֽڴ<D6BD><DAB4><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
*
* @param b - <20><><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD> refer to UARTByteTRIGTypeDef
*/
void UART1_ByteTrigCfg(UARTByteTRIGTypeDef b);
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
*
* @param s - <20>жϿ<D0B6><CFBF><EFBFBD>״̬<D7B4><CCAC><EFBFBD>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>Ӧ<EFBFBD>ж<EFBFBD>
* @param i - <20>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
* RB_IER_MODEM_CHG - <20><><EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><EFBFBD>ж<EFBFBD>ʹ<EFBFBD><CAB9>λ<EFBFBD><CEBB><EFBFBD><EFBFBD> UART0 ֧<>֣<EFBFBD>
* RB_IER_LINE_STAT - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·״̬<D7B4>ж<EFBFBD>
* RB_IER_THR_EMPTY - <20><><EFBFBD>ͱ<EFBFBD><CDB1>ּĴ<D6BC><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
* RB_IER_RECV_RDY - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
*/
void UART1_INTCfg(FunctionalState s, uint8_t i);
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
*/
void UART1_Reset(void);
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>FIFO
*/
#define UART1_CLR_RXFIFO() (R8_UART1_FCR |= RB_FCR_RX_FIFO_CLR)
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>FIFO
*/
#define UART1_CLR_TXFIFO() (R8_UART1_FCR |= RB_FCR_TX_FIFO_CLR)
/**
* @brief <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD>жϱ<D0B6>־
*
* @return <20><>ǰ<EFBFBD>жϱ<D0B6>־
*/
#define UART1_GetITFlag() (R8_UART1_IIR & RB_IIR_INT_MASK)
/**
* @brief <20><>ȡ<EFBFBD><C8A1>ǰͨѶ״̬
*
* @return refer to LINE error and status define
*/
#define UART1_GetLinSTA() (R8_UART1_LSR)
/**
* @brief <20><><EFBFBD>ڵ<EFBFBD><DAB5>ֽڷ<D6BD><DAB7><EFBFBD>
*
* @param b <20><><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5>ֽ<EFBFBD>
*/
#define UART1_SendByte(b) (R8_UART1_THR = b)
/**
* @brief <20><><EFBFBD>ڶ<EFBFBD><DAB6>ֽڷ<D6BD><DAB7><EFBFBD>
*
* @param buf - <20><><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׵<EFBFBD>ַ
* @param l - <20><><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
*/
void UART1_SendString(uint8_t *buf, uint16_t l);
/**
* @brief <20><><EFBFBD>ڶ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ֽ<EFBFBD>
*
* @return <20><>ȡ<EFBFBD><C8A1><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD>
*/
#define UART1_RecvByte() (R8_UART1_RBR)
/**
* @brief <20><><EFBFBD>ڶ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ֽ<EFBFBD>
*
* @param buf - <20><>ȡ<EFBFBD><C8A1><EFBFBD>ݴ<EFBFBD><DDB4>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׵<EFBFBD>ַ
*
* @return <20><>ȡ<EFBFBD><C8A1><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
*/
uint16_t UART1_RecvString(uint8_t *buf);
/**
* @brief <20><><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
void UART2_DefInit(void);
/**
* @brief <20><><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* @param baudrate - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
void UART2_BaudRateCfg(uint32_t baudrate);
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD>ֽڴ<D6BD><DAB4><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
*
* @param b - <20><><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD> refer to UARTByteTRIGTypeDef
*/
void UART2_ByteTrigCfg(UARTByteTRIGTypeDef b);
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
*
* @param s - <20>жϿ<D0B6><CFBF><EFBFBD>״̬<D7B4><CCAC><EFBFBD>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>Ӧ<EFBFBD>ж<EFBFBD>
* @param i - <20>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
* RB_IER_MODEM_CHG - <20><><EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><EFBFBD>ж<EFBFBD>ʹ<EFBFBD><CAB9>λ<EFBFBD><CEBB><EFBFBD><EFBFBD> UART0 ֧<>֣<EFBFBD>
* RB_IER_LINE_STAT - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·״̬<D7B4>ж<EFBFBD>
* RB_IER_THR_EMPTY - <20><><EFBFBD>ͱ<EFBFBD><CDB1>ּĴ<D6BC><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
* RB_IER_RECV_RDY - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
*/
void UART2_INTCfg(FunctionalState s, uint8_t i);
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
*/
void UART2_Reset(void);
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>FIFO
*/
#define UART2_CLR_RXFIFO() (R8_UART2_FCR |= RB_FCR_RX_FIFO_CLR)
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>FIFO
*/
#define UART2_CLR_TXFIFO() (R8_UART2_FCR |= RB_FCR_TX_FIFO_CLR)
/**
* @brief <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD>жϱ<D0B6>־
*
* @return <20><>ǰ<EFBFBD>жϱ<D0B6>־
*/
#define UART2_GetITFlag() (R8_UART2_IIR & RB_IIR_INT_MASK)
/**
* @brief <20><>ȡ<EFBFBD><C8A1>ǰͨѶ״̬
*
* @return refer to LINE error and status define
*/
#define UART2_GetLinSTA() (R8_UART2_LSR)
/**
* @brief <20><><EFBFBD>ڵ<EFBFBD><DAB5>ֽڷ<D6BD><DAB7><EFBFBD>
*
* @param b <20><><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5>ֽ<EFBFBD>
*/
#define UART2_SendByte(b) (R8_UART2_THR = b)
/**
* @brief <20><><EFBFBD>ڶ<EFBFBD><DAB6>ֽڷ<D6BD><DAB7><EFBFBD>
*
* @param buf - <20><><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׵<EFBFBD>ַ
* @param l - <20><><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
*/
void UART2_SendString(uint8_t *buf, uint16_t l);
/**
* @brief <20><><EFBFBD>ڶ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ֽ<EFBFBD>
*
* @return <20><>ȡ<EFBFBD><C8A1><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD>
*/
#define UART2_RecvByte() (R8_UART2_RBR)
/**
* @brief <20><><EFBFBD>ڶ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ֽ<EFBFBD>
*
* @param buf - <20><>ȡ<EFBFBD><C8A1><EFBFBD>ݴ<EFBFBD><DDB4>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׵<EFBFBD>ַ
*
* @return <20><>ȡ<EFBFBD><C8A1><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
*/
uint16_t UART2_RecvString(uint8_t *buf);
/**
* @brief <20><><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
void UART3_DefInit(void);
/**
* @brief <20><><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* @param baudrate - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
void UART3_BaudRateCfg(uint32_t baudrate);
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD>ֽڴ<D6BD><DAB4><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
*
* @param b - <20><><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD> refer to UARTByteTRIGTypeDef
*/
void UART3_ByteTrigCfg(UARTByteTRIGTypeDef b);
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
*
* @param s - <20>жϿ<D0B6><CFBF><EFBFBD>״̬<D7B4><CCAC><EFBFBD>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>Ӧ<EFBFBD>ж<EFBFBD>
* @param i - <20>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
* RB_IER_MODEM_CHG - <20><><EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><EFBFBD>ж<EFBFBD>ʹ<EFBFBD><CAB9>λ<EFBFBD><CEBB><EFBFBD><EFBFBD> UART0 ֧<>֣<EFBFBD>
* RB_IER_LINE_STAT - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·״̬<D7B4>ж<EFBFBD>
* RB_IER_THR_EMPTY - <20><><EFBFBD>ͱ<EFBFBD><CDB1>ּĴ<D6BC><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
* RB_IER_RECV_RDY - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
*/
void UART3_INTCfg(FunctionalState s, uint8_t i);
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
*/
void UART3_Reset(void);
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>FIFO
*/
#define UART3_CLR_RXFIFO() (R8_UART3_FCR |= RB_FCR_RX_FIFO_CLR)
/**
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>FIFO
*/
#define UART3_CLR_TXFIFO() (R8_UART3_FCR |= RB_FCR_TX_FIFO_CLR)
/**
* @brief <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD>жϱ<D0B6>־
*
* @return <20><>ǰ<EFBFBD>жϱ<D0B6>־
*/
#define UART3_GetITFlag() (R8_UART3_IIR & RB_IIR_INT_MASK)
/**
* @brief <20><>ȡ<EFBFBD><C8A1>ǰͨѶ״̬
*
* @return refer to LINE error and status define
*/
#define UART3_GetLinSTA() (R8_UART3_LSR)
/**
* @brief <20><><EFBFBD>ڵ<EFBFBD><DAB5>ֽڷ<D6BD><DAB7><EFBFBD>
*
* @param b <20><><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5>ֽ<EFBFBD>
*/
#define UART3_SendByte(b) (R8_UART3_THR = b)
/**
* @brief <20><><EFBFBD>ڶ<EFBFBD><DAB6>ֽڷ<D6BD><DAB7><EFBFBD>
*
* @param buf - <20><><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׵<EFBFBD>ַ
* @param l - <20><><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
*/
void UART3_SendString(uint8_t *buf, uint16_t l);
/**
* @brief <20><><EFBFBD>ڶ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ֽ<EFBFBD>
*
* @return <20><>ȡ<EFBFBD><C8A1><EFBFBD>ĵ<EFBFBD><C4B5>ֽ<EFBFBD>
*/
#define UART3_RecvByte() (R8_UART3_RBR)
/**
* @brief <20><><EFBFBD>ڶ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ֽ<EFBFBD>
*
* @param buf - <20><>ȡ<EFBFBD><C8A1><EFBFBD>ݴ<EFBFBD><DDB4>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׵<EFBFBD>ַ
*
* @return <20><>ȡ<EFBFBD><C8A1><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
*/
uint16_t UART3_RecvString(uint8_t *buf);
#ifdef __cplusplus
}
#endif
#endif // __CH58x_UART_H__