uart.h

来自「嵌入式系统」· C头文件 代码 · 共 849 行 · 第 1/3 页

H
849
字号
@@ [END]
******************************************************************************/

#define apd_UARTStopBreak(uart_num)     \
    apd_UARTClrHiLineCtrlReg(uart_num, APD_UARTHUBRLCR_BREAK)

/******************************************************************************
@@
@@ [Name]       : apd_UARTIsRISet
@@
@@ [Summary]    : This function checks if Ring Indicator (RI) is set
@@
@@ [Argument]   : uart_num: Specify the UART channel number
@@                APD_UART_CH0 for channel 0
@@                APD_UART_CH1 for channel 1
@@
@@ [Return]     : TRUE if RI is set; FALSE if RI is not set
@@
@@ [Desc]       : Checks if RI is set for the selected UART channel
@@
@@ [END]
******************************************************************************/

#define apd_UARTIsRISet(uart_num)       \
    apd_UARTIsBitSetInFlag(uart_num, APD_UARTFLG_RI)

/******************************************************************************
@@
@@ [Name]       : apd_UARTIsTxFIFOFull
@@
@@ [Summary]    : This function checks if the transmit FIFO is full
@@
@@ [Argument]   : uart_num: Specify the UART channel number
@@                APD_UART_CH0 for channel 0
@@                APD_UART_CH1 for channel 1
@@
@@ [Return]     : TRUE if the transmit holding register is full;
@@                FALSE if the transmit holding register is not full
@@
@@ [Desc]       : Checks if transmit FIFO is full for the selected UART channel
@@
@@ [END]
******************************************************************************/

#define apd_UARTIsTxFIFOFull(uart_num)      \
    apd_UARTIsBitSetInFlag(uart_num, APD_UARTFLG_UTXFF)

/******************************************************************************
@@
@@ [Name]       : apd_UARTIsRxFIFOEmpty
@@
@@ [Summary]    : This function checks if the receive FIFO is empty
@@
@@ [Argument]   : uart_num: Specify the UART channel number
@@                APD_UART_CH0 for channel 0
@@                APD_UART_CH1 for channel 1
@@
@@ [Return]     : TRUE if the receive holding register is empty;
@@                FALSE if the receive holding register is not empty
@@
@@ [Desc]       : Checks if the receive FIFO is empty for the selected UART channel
@@
@@ [END]
******************************************************************************/

#define apd_UARTIsRxFIFOEmpty(uart_num)     \
    apd_UARTIsBitSetInFlag(uart_num, APD_UARTFLG_URXFE)

/******************************************************************************
@@
@@ [Name]       : apd_UARTIsUARTBusy
@@
@@ [Summary]    : This function checks if the selected UART is busy transmitting data
@@
@@ [Argument]   : uart_num: Specify the UART channel number
@@                APD_UART_CH0 for channel 0
@@                APD_UART_CH1 for channel 1
@@
@@ [Return]     : TRUE if the UART is busy transmitting data;
@@                FLASE if the UART is not busy transmitting data
@@
@@ [Desc]       : Checks if the selected UART channel is busy transmitting data
@@
@@ [END]
******************************************************************************/

#define apd_UARTIsUARTBusy(uart_num)        \
    apd_UARTIsBitSetInFlag(uart_num, APD_UARTFLG_UBUSY)

/******************************************************************************
@@
@@ [Name]       : apd_UARTIsClearToSend
@@
@@ [Summary]    : This function checks if Clear to Send (CTS) signal is set
@@
@@ [Argument]   : uart_num: Specify the UART channel number
@@                APD_UART_CH0 for channel 0
@@                APD_UART_CH1 for channel 1
@@
@@ [Return]     : TRUE if MODEM input CTS is set;
@@                FLASE if MODEM input CTS is not set
@@
@@ [Desc]       : Checks if MODEM input CTS is set for the selected UART channel
@@
@@ [END]
******************************************************************************/

#define apd_UARTIsClearToSend(uart_num)     \
    apd_UARTIsBitSetInFlag(uart_num, APD_UARTFLG_CTS)

/******************************************************************************
@@
@@ [Name]       : apd_UARTIsDataCarrierDetected
@@
@@ [Summary]    : This function checks if Data Carrier Detected (DCD) signal is set
@@
@@ [Argument]   : uart_num: Specify the UART channel number
@@                APD_UART_CH0 for channel 0
@@                APD_UART_CH1 for channel 1
@@
@@ [Return]     : TRUE if MODEM input DCD is set;
@@                FLASE if MODEM input DCD is not set
@@
@@ [Desc]       : Checks if MODEM input DCD is set for the selected UART channel
@@
@@ [END]
******************************************************************************/

#define apd_UARTIsDataCarrierDetected(uart_num) \
    apd_UARTIsBitSetInFlag(uart_num, APD_UARTFLG_DCD)

/******************************************************************************
@@
@@ [Name]       : apd_UARTIsDataSetReady
@@ [Summary]    : This function checks if Data Set Ready (DSR) signal is set
@@ [Argument]   : uart_num: Specify the UART channel number
@@                APD_UART_CH0 for channel 0
@@                APD_UART_CH1 for channel 1
@@ [Return]     : TRUE if MODEM input DSR is set;
@@                FLASE if MODEM input DSR is not set
@@ [Desc]       : Checks if MODEM input DSR is set for the selected UART channel
@@ [Note]       : APD_UART_CH2 is not used in LH79532 and LH79533.
@@
@@ [END]
******************************************************************************/

#define apd_UARTIsDataSetReady(uart_num)        \
    apd_UARTIsBitSetInFlag(uart_num, APD_UARTFLG_DSR)

/******************************************************************************
@@
@@ [Name]       : apd_UARTSetReadyToSend
@@
@@ [Summary]    : This function sets the Ready to Send (RTS) output to high
@@
@@ [Argument]   : uart_num: Specify the UART channel number
@@                APD_UART_CH0 for channel 0
@@                APD_UART_CH1 for channel 1
@@
@@ [Return]     : None
@@
@@ [Desc]       : Sets the RTS output as high for the selected UART channel
@@
@@ [END]
******************************************************************************/

#define apd_UARTSetReadyToSend(uart_num)        \
    apd_UARTSetModemCtrlReg(uart_num, APD_UARTMCR_RTS)

/******************************************************************************
@@
@@ [Name]       : apd_UARTClrReadyToSend
@@
@@ [Summary]    : This function clears the Ready to Send (RTS) output to low
@@
@@ [Argument]   : uart_num: Specify the UART channel number
@@                APD_UART_CH0 for channel 0
@@                APD_UART_CH1 for channel 1
@@
@@ [Return]     : None
@@
@@ [Desc]       : Clears the RTS output to low for the selected UART channel
@@
@@ [END]
******************************************************************************/

#define apd_UARTClrReadyToSend(uart_num)        \
    apd_UARTClrModemCtrlReg(uart_num, APD_UARTMCR_RTS)

/******************************************************************************
@@
@@ [Name]       : apd_UARTSetDataTerminalReady
@@
@@ [Summary]    : This function sets the Data Terminal Ready (DTR) output to high
@@
@@ [Argument]   : uart_num: Specify the UART channel number
@@                APD_UART_CH0 for channel 0
@@                APD_UART_CH1 for channel 1
@@
@@ [Return]     : None
@@
@@ [Desc]       : Sets the DTR output as high for the selected UART channel
@@
@@ [END]
******************************************************************************/

#define apd_UARTSetDataTerminalReady(uart_num)  \
    apd_UARTSetModemCtrlReg(uart_num, APD_UARTMCR_DTR)

/******************************************************************************
@@
@@ [Name]       : apd_UARTClrDataTerminalReady
@@
@@ [Summary]    : This function clears the Data Terminal Ready (DTR) output to low
@@
@@ [Argument]   : uart_num: Specify the UART channel number
@@                APD_UART_CH0 for channel 0
@@                APD_UART_CH1 for channel 1
@@
@@ [Return]     : None
@@
@@ [Desc]       : Clears the DTR output to low for the selected UART channel
@@
@@ [END]
******************************************************************************/

#define apd_UARTClrDataTerminalReady(uart_num)  \
    apd_UARTClrModemCtrlReg(uart_num, APD_UARTMCR_DTR)

/******************************************************************************
@@
@@ [Name]       : apd_UARTEnableUARTDisableIntr
@@
@@ [Summary]    : This function enables the detection of data sent to UART when
@@                UART is disabled
@@
@@ [Argument]   : uart_num: Specify the UART channel number
@@                APD_UART_CH0 for channel 0
@@                APD_UART_CH1 for channel 1
@@
@@ [Return]     : None
@@
@@ [Desc]       : Enables the detection of data sent to the specified UART when
@@                UART is disabled
@@
@@ [END]
******************************************************************************/

#define apd_UARTEnableUARTDisableIntr(uart_num) \
    apd_UARTClrIntrReg(uart_num, APD_UARTINTMSK_UDINT)

/******************************************************************************
@@
@@ [Name]       : apd_UARTDisableUARTDisableIntr
@@
@@ [Summary]    : This function disables the detection of data sent to UART when
@@                UART is disabled
@@
@@ [Argument]   : uart_num: Specify the UART channel number
@@                APD_UART_CH0 for channel 0
@@                APD_UART_CH1 for channel 1
@@
@@ [Return]     : None
@@
@@ [Desc]       : Disables the detection of data sent to the specified UART when
@@                UART is disabled
@@
@@ [END]
******************************************************************************/

#define apd_UARTDisableUARTDisableIntr(uart_num)    \
    apd_UARTSetIntrReg(uart_num, APD_UARTINTMSK_UDINT)

/******************************************************************************
@@
@@ [Name]       : apd_UARTEnableModemStatusIntr
@@
@@ [Summary]    : This function enables the detection of any changes in the MODEM status
@@
@@ [Argument]   : uart_num: Specify the UART channel number
@@                APD_UART_CH0 for channel 0
@@                APD_UART_CH1 for channel 1
@@

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?