| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
usart_001.h File Reference
`#include "sys_config.h"`
`#include "cmsis.h"`

Go to the source code of this file.

## Data Structures
struct | IP_USART_001_T
| USART register block structure. More...
struct | UART_RingBuffer_T
| UART Ring buffer structure. More...
struct | UART_AB_CFG_T
| Auto Baudrate mode configuration type definition. More...
struct | UART_FIFO_CFG_T
| UART FIFO Configuration Structure definition. More...

## Macros
#define | UART_BLOCKING_TIMEOUT (0xFFFFFFFFUL)
#define | UART_ACCEPTED_BAUDRATE_ERROR (3)
#define | UART_RBR_MASKBIT ((uint8_t) 0xFF)
| Macro defines for UARTn Receiver Buffer Register.
#define | UART_THR_MASKBIT ((uint8_t) 0xFF)
| Macro defines for UARTn Transmit Holding Register.
#define | UART_LOAD_DLL(div) ((div) & 0xFF)
| Macro defines for UARTn Divisor Latch LSB register.
#define | UART_DLL_MASKBIT ((uint8_t) 0xFF)
#define | UART_DLM_MASKBIT ((uint8_t) 0xFF)
| Macro defines for UARTn Divisor Latch MSB register.
#define | UART_LOAD_DLM(div) (((div) >> 8) & 0xFF)
#define | UART_IER_RBRINT_EN ((uint32_t) (1 << 0))
| Macro defines for UART interrupt enable register.
#define | UART_IER_THREINT_EN ((uint32_t) (1 << 1))
#define | UART_IER_RLSINT_EN ((uint32_t) (1 << 2))
#define | UART_IER_MSINT_EN ((uint32_t) (1 << 3))
#define | UART_IER_CTSINT_EN ((uint32_t) (1 << 7))
#define | UART_IER_ABEOINT_EN ((uint32_t) (1 << 8))
#define | UART_IER_ABTOINT_EN ((uint32_t) (1 << 9))
#define | UART_IER_BITMASK ((uint32_t) (0x307))
#define | UART1_IER_BITMASK ((uint32_t) (0x38F))
#define | UART_IIR_INTSTAT_PEND ((uint32_t) (1 << 0))
| Macro defines for UART interrupt identification register.
#define | UART_IIR_INTID_RLS ((uint32_t) (3 << 1))
#define | UART_IIR_INTID_RDA ((uint32_t) (2 << 1))
#define | UART_IIR_INTID_CTI ((uint32_t) (6 << 1))
#define | UART_IIR_INTID_THRE ((uint32_t) (1 << 1))
#define | UART_IIR_INTID_MODEM ((uint32_t) (0 << 1))
#define | UART_IIR_INTID_MASK ((uint32_t) (7 << 1))
#define | UART_IIR_FIFO_EN ((uint32_t) (3 << 6))
#define | UART_IIR_ABEO_INT ((uint32_t) (1 << 8))
#define | UART_IIR_ABTO_INT ((uint32_t) (1 << 9))
#define | UART_IIR_BITMASK ((uint32_t) (0x3CF))
#define | UART_FCR_FIFO_EN ((uint8_t) (1 << 0))
| Macro defines for UART FIFO control register.
#define | UART_FCR_RX_RS ((uint8_t) (1 << 1))
#define | UART_FCR_TX_RS ((uint8_t) (1 << 2))
#define | UART_FCR_DMAMODE_SEL ((uint8_t) (1 << 3))
#define | UART_FCR_TRG_LEV0 ((uint8_t) (0))
#define | UART_FCR_TRG_LEV1 ((uint8_t) (1 << 6))
#define | UART_FCR_TRG_LEV2 ((uint8_t) (2 << 6))
#define | UART_FCR_TRG_LEV3 ((uint8_t) (3 << 6))
#define | UART_FCR_BITMASK ((uint8_t) (0xCF))
#define | UART_TX_FIFO_SIZE (16)
#define | UART_LCR_WLEN5 ((uint8_t) (0))
| Macro defines for UART line control register.
#define | UART_LCR_WLEN6 ((uint8_t) (1 << 0))
#define | UART_LCR_WLEN7 ((uint8_t) (2 << 0))
#define | UART_LCR_WLEN8 ((uint8_t) (3 << 0))
#define | UART_LCR_SBS_1BIT ((uint8_t) (0 << 2))
#define | UART_LCR_SBS_2BIT ((uint8_t) (1 << 2))
#define | UART_LCR_PARITY_EN ((uint8_t) (1 << 3))
#define | UART_LCR_PARITY_DIS ((uint8_t) (0 << 3))
#define | UART_LCR_PARITY_ODD ((uint8_t) (0))
#define | UART_LCR_PARITY_EVEN ((uint8_t) (1 << 4))
#define | UART_LCR_PARITY_F_1 ((uint8_t) (2 << 4))
#define | UART_LCR_PARITY_F_0 ((uint8_t) (3 << 4))
#define | UART_LCR_BREAK_EN ((uint8_t) (1 << 6))
#define | UART_LCR_DLAB_EN ((uint8_t) (1 << 7))
#define | UART_LCR_BITMASK ((uint8_t) (0xFF))
#define | UART_MCR_DTR_CTRL ((uint8_t) (1 << 0))
| Macro defines for UART Modem control register.
#define | UART_MCR_RTS_CTRL ((uint8_t) (1 << 1))
#define | UART_MCR_LOOPB_EN ((uint8_t) (1 << 4))
#define | UART_MCR_AUTO_RTS_EN ((uint8_t) (1 << 6))
#define | UART_MCR_AUTO_CTS_EN ((uint8_t) (1 << 7))
#define | UART_MCR_BITMASK ((uint8_t) (0x0F3))
#define | UART_LSR_RDR ((uint8_t) (1 << 0))
| Macro defines for UART line status register.
#define | UART_LSR_OE ((uint8_t) (1 << 1))
#define | UART_LSR_PE ((uint8_t) (1 << 2))
#define | UART_LSR_FE ((uint8_t) (1 << 3))
#define | UART_LSR_BI ((uint8_t) (1 << 4))
#define | UART_LSR_THRE ((uint8_t) (1 << 5))
#define | UART_LSR_TEMT ((uint8_t) (1 << 6))
#define | UART_LSR_RXFE ((uint8_t) (1 << 7))
#define | UART_LSR_BITMASK ((uint8_t) (0xFF))
#define | UART_MSR_DELTA_CTS ((uint8_t) (1 << 0))
| Macro defines for UART Modem status register.
#define | UART_MSR_DELTA_DSR ((uint8_t) (1 << 1))
#define | UART_MSR_LO2HI_RI ((uint8_t) (1 << 2))
#define | UART_MSR_DELTA_DCD ((uint8_t) (1 << 3))
#define | UART_MSR_CTS ((uint8_t) (1 << 4))
#define | UART_MSR_DSR ((uint8_t) (1 << 5))
#define | UART_MSR_RI ((uint8_t) (1 << 6))
#define | UART_MSR_DCD ((uint8_t) (1 << 7))
#define | UART_MSR_BITMASK ((uint8_t) (0xFF))
#define | UART_SCR_BIMASK ((uint8_t) (0xFF))
| Macro defines for UART Scratch Pad register.
#define | UART_ACR_START ((uint32_t) (1 << 0))
| Macro defines for UART Auto baudrate control register.
#define | UART_ACR_MODE ((uint32_t) (1 << 1))
#define | UART_ACR_AUTO_RESTART ((uint32_t) (1 << 2))
#define | UART_ACR_ABEOINT_CLR ((uint32_t) (1 << 8))
#define | UART_ACR_ABTOINT_CLR ((uint32_t) (1 << 9))
#define | UART_ACR_BITMASK ((uint32_t) (0x307))
#define | UART_ICR_IRDAEN ((uint32_t) (1 << 0))
| Macro defines for UART IrDA control register.
#define | UART_ICR_IRDAINV ((uint32_t) (1 << 1))
#define | UART_ICR_FIXPULSE_EN ((uint32_t) (1 << 2))
#define | UART_ICR_PULSEDIV(n) ((uint32_t) ((n & 0x07) << 3))
#define | UART_ICR_BITMASK ((uint32_t) (0x3F))
#define | UART_HDEN_HDEN ((uint32_t) (1 << 0))
| Macro defines for UART half duplex register.
#define | UART_SCICTRL_SCIEN ((uint32_t) (1 << 0))
| Macro defines for UART smart card interface control register.
#define | UART_SCICTRL_NACKDIS ((uint32_t) (1 << 1))
#define | UART_SCICTRL_PROTSEL_T1 ((uint32_t) (1 << 2))
#define | UART_SCICTRL_TXRETRY(n) ((uint32_t) ((n & 0x07) << 5))
#define | UART_SCICTRL_GUARDTIME(n) ((uint32_t) ((n & 0xFF) << 8))
#define | UART_SYNCCTRL_SYNC ((uint32_t) (1 << 0))
| Macro defines for UART synchronous control register.
#define | UART_SYNCCTRL_CSRC_MASTER ((uint32_t) (1 << 1))
#define | UART_SYNCCTRL_FES ((uint32_t) (1 << 2))
#define | UART_SYNCCTRL_TSBYPASS ((uint32_t) (1 << 3))
#define | UART_SYNCCTRL_CSCEN ((uint32_t) (1 << 4))
#define | UART_SYNCCTRL_STARTSTOPDISABLE ((uint32_t) (1 << 5))
#define | UART_SYNCCTRL_CCCLR ((uint32_t) (1 << 6))
#define | UART_FDR_DIVADDVAL(n) ((uint32_t) (n & 0x0F))
| Macro defines for UART Fractional divider register.
#define | UART_FDR_MULVAL(n) ((uint32_t) ((n << 4) & 0xF0))
#define | UART_FDR_BITMASK ((uint32_t) (0xFF))
#define | UART_TER1_TXEN ((uint8_t) (1 << 7))
| Macro defines for UART Tx Enable register.
#define | UART_TER1_BITMASK ((uint8_t) (0x80))
#define | UART_TER2_TXEN ((uint8_t) (1 << 0))
#define | UART_TER2_BITMASK ((uint8_t) (0x01))
#define | UART_RS485CTRL_NMM_EN ((uint32_t) (1 << 0))
| Macro defines for UART1 RS485 Control register.
#define | UART_RS485CTRL_RX_DIS ((uint32_t) (1 << 1))
#define | UART_RS485CTRL_AADEN ((uint32_t) (1 << 2))
#define | UART_RS485CTRL_SEL_DTR ((uint32_t) (1 << 3))
#define | UART_RS485CTRL_DCTRL_EN ((uint32_t) (1 << 4))
#define | UART_RS485CTRL_OINV_1 ((uint32_t) (1 << 5))
#define | UART_RS485CTRL_BITMASK ((uint32_t) (0x3F))
#define | UART_RS485ADRMATCH_BITMASK ((uint8_t) (0xFF))
| Macro defines for UART1 RS-485 Address Match register.
#define | UART_RS485DLY_BITMASK ((uint8_t) (0xFF))
| Macro defines for UART1 RS-485 Delay value register.
#define | UART_FIFOLVL_RXFIFOLVL(n) ((uint32_t) (n & 0x0F))
| Macro defines for UART FIFO Level register.
#define | UART_FIFOLVL_TXFIFOLVL(n) ((uint32_t) ((n >> 8) & 0x0F))
#define | UART_FIFOLVL_BITMASK ((uint32_t) (0x0F0F))
#define | UART_RING_BUFSIZE 256
| Macro defines for Ring Buffer.

## Enumerations
enum | IP_UART_LS_T { UART_LINESTAT_RDR = UART_LSR_RDR, UART_LINESTAT_OE = UART_LSR_OE, UART_LINESTAT_PE = UART_LSR_PE, UART_LINESTAT_FE = UART_LSR_FE, UART_LINESTAT_BI = UART_LSR_BI, UART_LINESTAT_THRE = UART_LSR_THRE, UART_LINESTAT_TEMT = UART_LSR_TEMT, UART_LINESTAT_RXFE = UART_LSR_RXFE }
| UART Line Status Type definition. More...
enum | IP_UART_SIGNAL_STATE_T { INACTIVE = 0, ACTIVE = !INACTIVE }
| UART Full modem - Signal states definition. More...
enum | IP_UART_MODEM_STAT_T { UART_MODEM_STAT_DELTA_CTS = UART_MSR_DELTA_CTS, UART_MODEM_STAT_DELTA_DSR = UART_MSR_DELTA_DSR, UART_MODEM_STAT_LO2HI_RI = UART_MSR_LO2HI_RI, UART_MODEM_STAT_DELTA_DCD = UART_MSR_DELTA_DCD, UART_MODEM_STAT_CTS = UART_MSR_CTS, UART_MODEM_STAT_DSR = UART_MSR_DSR, UART_MODEM_STAT_RI = UART_MSR_RI, UART_MODEM_STAT_DCD = UART_MSR_DCD }
| UART modem status type definition. More...
enum | IP_UART_MODEM_PIN_T { UART_MODEM_PIN_DTR = 0, UART_MODEM_PIN_RTS }
| Modem output pin type definition. More...
enum | IP_UART_MODEM_MODE_T { UART_MODEM_MODE_LOOPBACK = 0, UART_MODEM_MODE_AUTO_RTS, UART_MODEM_MODE_AUTO_CTS }
| UART Modem mode type definition. More...
enum | IP_UART_INT_T { UART_INTCFG_RBR = 0, UART_INTCFG_THRE, UART_INTCFG_RLS, UART_INTCFG_MS, UART_INTCFG_CTS, UART_INTCFG_ABEO, UART_INTCFG_ABTO }
| UART Interrupt Type definitions. More...
enum | IP_UART_PARITY_T { UART_PARITY_NONE = 0, UART_PARITY_ODD = (4 << 3), UART_PARITY_EVEN = (5 << 3), UART_PARITY_SP_1 = (6 << 3), UART_PARITY_SP_0 = (7 << 3) }
| UART Parity type definitions. More...
enum | IP_UART_FITO_LEVEL_T { UART_FIFO_TRGLEV0 = 0, UART_FIFO_TRGLEV1, UART_FIFO_TRGLEV2, UART_FIFO_TRGLEV3 }
| FIFO Level type definitions. More...
enum | IP_UART_STOPBIT_T { UART_STOPBIT_1 = 0, UART_STOPBIT_2 = (1 << 2) }
| UART Stop bit type definitions. More...
enum | IP_UART_DATABIT_T { UART_DATABIT_5 = 0, UART_DATABIT_6, UART_DATABIT_7, UART_DATABIT_8 }
| UART Databit type definitions. More...
enum | IP_UART_ID_T { UART_0 = 0, UART_1, UART_2, UART_3, UART_4 }
| UART ID. More...
enum | IP_UART_INT_STATUS_T { UART_INTSTS_ERROR = 1 << 0, UART_INTSTS_RTS = 1 << 1, UART_INTSTS_RTR = 1 << 2, UART_INTSTS_ABEO = UART_IIR_ABEO_INT, UART_INTSTS_ABTO = UART_IIR_ABTO_INT }
| UART Interrupt Status. More...
enum | IP_UART_AB_MODE_T { UART_AUTOBAUD_MODE0 = 0, UART_AUTOBAUD_MODE1 }
| UART Auto-baudrate mode type definition. More...

## Functions
void | IP_UART_Init (IP_USART_001_T *pUART, IP_UART_ID_T UARTPort)
| Initializes the UARTx peripheral according to the specified parameters in the UART_ConfigStruct.
void | IP_UART_DeInit (IP_USART_001_T *pUART, IP_UART_ID_T UARTPort)
| De-initializes the UARTx peripheral registers to their default reset values.
Status | IP_UART_SetBaud (IP_USART_001_T *pUART, uint32_t baudrate, uint32_t uClk)
| Determines best dividers to get a target clock rate.
void | IP_UART_ConfigData (IP_USART_001_T *pUART, IP_UART_DATABIT_T Databits, IP_UART_PARITY_T Parity, IP_UART_STOPBIT_T Stopbits)
| Configure data width, parity mode and stop bits.
Status | IP_UART_SendByte (IP_USART_001_T *pUART, uint8_t data)
| Transmit a single data through UART peripheral.
Status | IP_UART_ReceiveByte (IP_USART_001_T *pUART, uint8_t *Data)
| Receive a single data from UART peripheral.
uint32_t | IP_UART_Send (IP_USART_001_T *pUART, uint8_t *txbuf, uint32_t buflen, TRANSFER_BLOCK_T flag)
| Send a block of data via UART peripheral.
uint32_t | IP_UART_Receive (IP_USART_001_T *pUART, uint8_t *rxbuf, uint32_t buflen, TRANSFER_BLOCK_T flag)
| Receive a block of data via UART peripheral.
void | IP_UART_IntConfig (IP_USART_001_T *pUART, IP_UART_INT_T UARTIntCfg, FunctionalState NewState)
| Enable or disable specified UART interrupt.
uint32_t | IP_UART_IntGetStatus (IP_USART_001_T *pUART)
| Get Source Interrupt.
void | IP_UART_ForceBreak (IP_USART_001_T *pUART)
| Force BREAK character on UART line, output pin UARTx TXD is forced to logic 0.
uint8_t | IP_UART_GetLineStatus (IP_USART_001_T *pUART)
| Get current value of Line Status register in UART peripheral.
FlagStatus | IP_UART_CheckBusy (IP_USART_001_T *pUART)
| Check whether if UART is busy or not.
void | IP_UART_TxCmd (IP_USART_001_T *pUART, IP_UART_ID_T UARTPort, FunctionalState NewState)
| Enable/Disable transmission on UART TxD pin.
void | IP_UART_FIFOConfig (IP_USART_001_T *pUART, UART_FIFO_CFG_T *FIFOCfg)
| Configure FIFO function on selected UART peripheral.
void | IP_UART_FIFOConfigStructInit (UART_FIFO_CFG_T *UART_FIFOInitStruct)
| Fills each UART_FIFOInitStruct member with its default value:
void | IP_UART_ABCmd (IP_USART_001_T *pUART, UART_AB_CFG_T *ABConfigStruct, FunctionalState NewState)
| Start/Stop Auto Baudrate activity.
void | IP_UART_ABClearIntPending (IP_USART_001_T *pUART, IP_UART_INT_STATUS_T ABIntType)
| Clear Autobaud Interrupt.