在msp432e401y中关于UART中断是不是只要使能了UART中断就已经默认启用FIFO?
xyz549040622:
也不一定,你最好还是手动开启和关闭FIFO。
gaoyang9992006:
extern void UARTFIFOEnable(uint32_t ui32Base);
gaoyang9992006:
下载的头文件里面有介绍
//***************************************************************************** // // uart.h - Defines and Macros for the UART. // // Copyright (c) 2005-2017 Texas Instruments Incorporated.All rights reserved. // Software License Agreement // //Redistribution and use in source and binary forms, with or without //modification, are permitted provided that the following conditions //are met: // //Redistributions of source code must retain the above copyright //notice, this list of conditions and the following disclaimer. // //Redistributions in binary form must reproduce the above copyright //notice, this list of conditions and the following disclaimer in the //documentation and/or other materials provided with the //distribution. // //Neither the name of Texas Instruments Incorporated nor the names of //its contributors may be used to endorse or promote products derived //from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // //*****************************************************************************#ifndef __DRIVERLIB_UART_H__ #define __DRIVERLIB_UART_H__#include <stdint.h> #include <stdbool.h>//***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif//***************************************************************************** // // Values that can be passed to UARTIntEnable, UARTIntDisable, and UARTIntClear // as the ui32IntFlags parameter, and returned from UARTIntStatus. // //***************************************************************************** #define UART_INT_DMATX0x20000// DMA TX interrupt #define UART_INT_DMARX0x10000// DMA RX interrupt #define UART_INT_9BIT0x1000// 9-bit address match interrupt #define UART_INT_OE0x400// Overrun Error Interrupt Mask #define UART_INT_BE0x200// Break Error Interrupt Mask #define UART_INT_PE0x100// Parity Error Interrupt Mask #define UART_INT_FE0x080// Framing Error Interrupt Mask #define UART_INT_RT0x040// Receive Timeout Interrupt Mask #define UART_INT_TX0x020// Transmit Interrupt Mask #define UART_INT_RX0x010// Receive Interrupt Mask #define UART_INT_DSR0x008// DSR Modem Interrupt Mask #define UART_INT_DCD0x004// DCD Modem Interrupt Mask #define UART_INT_CTS0x002// CTS Modem Interrupt Mask #define UART_INT_RI0x001// RI Modem Interrupt Mask//***************************************************************************** // // Values that can be passed to UARTConfigSetExpClk as the ui32Config parameter // and returned by UARTConfigGetExpClk in the pui32Config parameter. // Additionally, the UART_CONFIG_PAR_* subset can be passed to // UARTParityModeSet as the ui32Parity parameter, and are returned by // UARTParityModeGet. // //***************************************************************************** #define UART_CONFIG_WLEN_MASK0x00000060// Mask for extracting word length #define UART_CONFIG_WLEN_80x00000060// 8 bit data #define UART_CONFIG_WLEN_70x00000040// 7 bit data #define UART_CONFIG_WLEN_60x00000020// 6 bit data #define UART_CONFIG_WLEN_50x00000000// 5 bit data #define UART_CONFIG_STOP_MASK0x00000008// Mask for extracting stop bits #define UART_CONFIG_STOP_ONE0x00000000// One stop bit #define UART_CONFIG_STOP_TWO0x00000008// Two stop bits #define UART_CONFIG_PAR_MASK0x00000086// Mask for extracting parity #define UART_CONFIG_PAR_NONE0x00000000// No parity #define UART_CONFIG_PAR_EVEN0x00000006// Even parity #define UART_CONFIG_PAR_ODD0x00000002// Odd parity #define UART_CONFIG_PAR_ONE0x00000082// Parity bit is one #define UART_CONFIG_PAR_ZERO0x00000086// Parity bit is zero//***************************************************************************** // // Values that can be passed to UARTFIFOLevelSet as the ui32TxLevel parameter // and returned by UARTFIFOLevelGet in the pui32TxLevel. // //***************************************************************************** #define UART_FIFO_TX1_80x00000000// Transmit interrupt at 1/8 Full #define UART_FIFO_TX2_80x00000001// Transmit interrupt at 1/4 Full #define UART_FIFO_TX4_80x00000002// Transmit interrupt at 1/2 Full #define UART_FIFO_TX6_80x00000003// Transmit interrupt at 3/4 Full #define UART_FIFO_TX7_80x00000004// Transmit interrupt at 7/8 Full//***************************************************************************** // // Values that can be passed to UARTFIFOLevelSet as the ui32RxLevel parameter // and returned by UARTFIFOLevelGet in the pui32RxLevel. // //***************************************************************************** #define UART_FIFO_RX1_80x00000000// Receive interrupt at 1/8 Full #define UART_FIFO_RX2_80x00000008// Receive interrupt at 1/4 Full #define UART_FIFO_RX4_80x00000010// Receive interrupt at 1/2 Full #define UART_FIFO_RX6_80x00000018// Receive interrupt at 3/4 Full #define UART_FIFO_RX7_80x00000020// Receive interrupt at 7/8 Full//***************************************************************************** // // Values that can be passed to UARTDMAEnable() and UARTDMADisable(). // //***************************************************************************** #define UART_DMA_ERR_RXSTOP0x00000004// Stop DMA receive if UART error #define UART_DMA_TX0x00000002// Enable DMA for transmit #define UART_DMA_RX0x00000001// Enable DMA for receive//***************************************************************************** // // Values returned from UARTRxErrorGet(). // //***************************************************************************** #define UART_RXERROR_OVERRUN0x00000008 #define UART_RXERROR_BREAK0x00000004 #define UART_RXERROR_PARITY0x00000002 #define UART_RXERROR_FRAMING0x00000001//***************************************************************************** // // Values that can be passed to UARTHandshakeOutputsSet() or returned from // UARTHandshakeOutputGet(). // //***************************************************************************** #define UART_OUTPUT_RTS0x00000800 #define UART_OUTPUT_DTR0x00000400//***************************************************************************** // // Values that can be returned from UARTHandshakeInputsGet(). // //***************************************************************************** #define UART_INPUT_RI0x00000100 #define UART_INPUT_DCD0x00000004 #define UART_INPUT_DSR0x00000002 #define UART_INPUT_CTS0x00000001//***************************************************************************** // // Values that can be passed to UARTFlowControl() or returned from // UARTFlowControlGet(). // //***************************************************************************** #define UART_FLOWCONTROL_TX0x00008000 #define UART_FLOWCONTROL_RX0x00004000 #define UART_FLOWCONTROL_NONE0x00000000//***************************************************************************** // // Values that can be passed to UARTTxIntModeSet() or returned from // UARTTxIntModeGet(). // //***************************************************************************** #define UART_TXINT_MODE_FIFO0x00000000 #define UART_TXINT_MODE_EOT0x00000010//***************************************************************************** // // Values that can be passed to UARTClockSourceSet() or returned from // UARTClockSourceGet(). // //***************************************************************************** #define UART_CLOCK_SYSTEM0x00000000 #define UART_CLOCK_ALTCLK0x00000005//***************************************************************************** // // API Function prototypes // //***************************************************************************** extern void UARTParityModeSet(uint32_t ui32Base, uint32_t ui32Parity); extern uint32_t UARTParityModeGet(uint32_t ui32Base); extern void UARTFIFOLevelSet(uint32_t ui32Base, uint32_t ui32TxLevel,uint32_t ui32RxLevel); extern void UARTFIFOLevelGet(uint32_t ui32Base, uint32_t *pui32TxLevel,uint32_t *pui32RxLevel); extern void UARTConfigSetExpClk(uint32_t ui32Base, uint32_t ui32UARTClk,uint32_t ui32Baud, uint32_t ui32Config); extern void UARTConfigGetExpClk(uint32_t ui32Base, uint32_t ui32UARTClk,uint32_t *pui32Baud, uint32_t *pui32Config); extern void UARTEnable(uint32_t ui32Base); extern void UARTDisable(uint32_t ui32Base); extern void UARTFIFOEnable(uint32_t ui32Base); extern void UARTFIFODisable(uint32_t ui32Base); extern void UARTEnableSIR(uint32_t ui32Base, bool bLowPower); extern void UARTDisableSIR(uint32_t ui32Base); extern bool UARTCharsAvail(uint32_t ui32Base); extern bool UARTSpaceAvail(uint32_t ui32Base); extern int32_t UARTCharGetNonBlocking(uint32_t ui32Base); extern int32_t UARTCharGet(uint32_t ui32Base); extern bool UARTCharPutNonBlocking(uint32_t ui32Base, unsigned char ucData); extern void UARTCharPut(uint32_t ui32Base, unsigned char ucData); extern void UARTBreakCtl(uint32_t ui32Base, bool bBreakState); extern bool UARTBusy(uint32_t ui32Base); extern void UARTIntRegister(uint32_t ui32Base, void (*pfnHandler)(void)); extern void UARTIntUnregister(uint32_t ui32Base); extern void UARTIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags); extern void UARTIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags); extern uint32_t UARTIntStatus(uint32_t ui32Base, bool bMasked); extern void UARTIntClear(uint32_t ui32Base, uint32_t ui32IntFlags); extern void UARTDMAEnable(uint32_t ui32Base, uint32_t ui32DMAFlags); extern void UARTDMADisable(uint32_t ui32Base, uint32_t ui32DMAFlags); extern uint32_t UARTRxErrorGet(uint32_t ui32Base); extern void UARTRxErrorClear(uint32_t ui32Base); extern void UARTSmartCardEnable(uint32_t ui32Base); extern void UARTSmartCardDisable(uint32_t ui32Base); extern void UARTModemControlSet(uint32_t ui32Base, uint32_t ui32Control); extern void UARTModemControlClear(uint32_t ui32Base, uint32_t ui32Control); extern uint32_t UARTModemControlGet(uint32_t ui32Base); extern uint32_t UARTModemStatusGet(uint32_t ui32Base); extern void UARTFlowControlSet(uint32_t ui32Base, uint32_t ui32Mode); extern uint32_t UARTFlowControlGet(uint32_t ui32Base); extern void UARTTxIntModeSet(uint32_t ui32Base, uint32_t ui32Mode); extern uint32_t UARTTxIntModeGet(uint32_t ui32Base); extern void UARTClockSourceSet(uint32_t ui32Base, uint32_t ui32Source); extern uint32_t UARTClockSourceGet(uint32_t ui32Base); extern void UART9BitEnable(uint32_t ui32Base); extern void UART9BitDisable(uint32_t ui32Base); extern void UART9BitAddrSet(uint32_t ui32Base, uint8_t ui8Addr,uint8_t ui8Mask); extern void UART9BitAddrSend(uint32_t ui32Base, uint8_t ui8Addr); extern void UARTLoopbackEnable(uint32_t ui32Base);//***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif#endif // __DRIVERLIB_UART_H__
Susan Yang:
在TRM内有相关的说明
Out of reset, both FIFOs are disabled and act as 1-byte-deep holding registers. The FIFOs are enabled by setting the FEN bit in UARTLCRH
您可以通过 UARTFIFOEnable 以及 UARTFIFODisable 来启用和禁用FIFO
dev.ti.com/…/group__uart__api.html