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

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

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
IP: USART register block and driver (004)
IP drivers: Common drivers used on multiple NXP devices

## Detailed Description

## Data Structures
struct | IP_USART_001_T
| USART register block structure. More...

## Macros
#define | UART_RBR_MASKBIT (0xFF)
#define | UART_IER_RBRINT (1 << 0)
| Macro defines for UART interrupt enable register.
#define | UART_IER_THREINT (1 << 1)
#define | UART_IER_RLSINT (1 << 2)
#define | UART_IER_MSINT (1 << 3)
#define | UART_IER_CTSINT (1 << 7)
#define | UART_IER_ABEOINT (1 << 8)
#define | UART_IER_ABTOINT (1 << 9)
#define | UART_IER_BITMASK (0x307)
#define | UART1_IER_BITMASK (0x38F)
#define | UART_IIR_INTSTAT_PEND (1 << 0)
| Macro defines for UART interrupt identification register.
#define | UART_IIR_INTID_RLS (3 << 1)
#define | UART_IIR_INTID_RDA (2 << 1)
#define | UART_IIR_INTID_CTI (6 << 1)
#define | UART_IIR_INTID_THRE (1 << 1)
#define | UART_IIR_INTID_MODEM (0 << 1)
#define | UART_IIR_INTID_MASK (7 << 1)
#define | UART_IIR_FIFO_EN (3 << 6)
#define | UART_IIR_ABEO_INT (1 << 8)
#define | UART_IIR_ABTO_INT (1 << 9)
#define | UART_IIR_BITMASK (0x3CF)
#define | UART_FCR_FIFO_EN (1 << 0)
| Macro defines for UART FIFO control register.
#define | UART_FCR_RX_RS (1 << 1)
#define | UART_FCR_TX_RS (1 << 2)
#define | UART_FCR_DMAMODE_SEL (1 << 3)
#define | UART_FCR_TRG_LEV0 (0)
#define | UART_FCR_TRG_LEV1 (1 << 6)
#define | UART_FCR_TRG_LEV2 (2 << 6)
#define | UART_FCR_TRG_LEV3 (3 << 6)
#define | UART_FCR_BITMASK (0xCF)
#define | UART_TX_FIFO_SIZE (16)
#define | UART_LCR_WLEN5 (0)
| Macro defines for UART line control register.
#define | UART_LCR_WLEN6 (1 << 0)
#define | UART_LCR_WLEN7 (2 << 0)
#define | UART_LCR_WLEN8 (3 << 0)
#define | UART_LCR_SBS_1BIT (0 << 2)
#define | UART_LCR_SBS_2BIT (1 << 2)
#define | UART_LCR_PARITY_EN (1 << 3)
#define | UART_LCR_PARITY_DIS (0 << 3)
#define | UART_LCR_PARITY_ODD (0)
#define | UART_LCR_PARITY_EVEN (1 << 4)
#define | UART_LCR_PARITY_F_1 (2 << 4)
#define | UART_LCR_PARITY_F_0 (3 << 4)
#define | UART_LCR_BREAK_EN (1 << 6)
#define | UART_LCR_DLAB_EN (1 << 7)
#define | UART_LCR_BITMASK (0xFF)
#define | UART_DLL_MASKBIT (0xFF)
#define | UART_DLM_MASKBIT (0xFF)
#define | UART_MCR_DTR_CTRL (1 << 0)
| Macro defines for UART Modem control register.
#define | UART_MCR_RTS_CTRL (1 << 1)
#define | UART_MCR_LOOPB_EN (1 << 4)
#define | UART_MCR_AUTO_RTS_EN (1 << 6)
#define | UART_MCR_AUTO_CTS_EN (1 << 7)
#define | UART_MCR_BITMASK (0x0F3)
#define | UART_LSR_RDR (1 << 0)
| Macro defines for UART line status register.
#define | UART_LSR_OE (1 << 1)
#define | UART_LSR_PE (1 << 2)
#define | UART_LSR_FE (1 << 3)
#define | UART_LSR_BI (1 << 4)
#define | UART_LSR_THRE (1 << 5)
#define | UART_LSR_TEMT (1 << 6)
#define | UART_LSR_RXFE (1 << 7)
#define | UART_LSR_BITMASK (0xFF)
#define | UART_MSR_DELTA_CTS (1 << 0)
| Macro defines for UART Modem status register.
#define | UART_MSR_DELTA_DSR (1 << 1)
#define | UART_MSR_LO2HI_RI (1 << 2)
#define | UART_MSR_DELTA_DCD (1 << 3)
#define | UART_MSR_CTS (1 << 4)
#define | UART_MSR_DSR (1 << 5)
#define | UART_MSR_RI (1 << 6)
#define | UART_MSR_DCD (1 << 7)
#define | UART_MSR_BITMASK (0xFF)
#define | UART_ACR_START (1 << 0)
| Macro defines for UART Auto baudrate control register.
#define | UART_ACR_MODE (1 << 1)
#define | UART_ACR_AUTO_RESTART (1 << 2)
#define | UART_ACR_ABEOINT_CLR (1 << 8)
#define | UART_ACR_ABTOINT_CLR (1 << 9)
#define | UART_ACR_BITMASK (0x307)
#define | UART_RS485CTRL_NMM_EN (1 << 0)
| Macro defines for UART1 RS485 Control register.
#define | UART_RS485CTRL_RX_DIS (1 << 1)
#define | UART_RS485CTRL_AADEN (1 << 2)
#define | UART_RS485CTRL_SEL_DTR (1 << 3)
#define | UART_RS485CTRL_DCTRL_EN (1 << 4)
#define | UART_RS485CTRL_OINV_1 (1 << 5)
#define | UART_RS485CTRL_BITMASK (0x3F)

## Functions
void | IP_UART_Init (IP_USART_001_T *pUART)
| Basic UART initialization.
STATIC INLINE void | IP_UART_DeInit (IP_USART_001_T *pUART)
| UART de-initialization.
STATIC INLINE void | IP_UART_SendByte (IP_USART_001_T *pUART, const uint8_t data)
| Transmit a single byte through the UART peripheral.
STATIC INLINE uint8_t | IP_UART_ReadByte (IP_USART_001_T *pUART)
| Get a single data from UART peripheral.
STATIC INLINE void | IP_UART_IntEnable (IP_USART_001_T *pUART, uint32_t intMask)
| Enable UART interrupts.
STATIC INLINE void | IP_UART_IntDisable (IP_USART_001_T *pUART, uint32_t intMask)
| Disable UART interrupts.
STATIC INLINE uint32_t | IP_UART_ReadIntIDReg (IP_USART_001_T *pUART)
| Read the Interrupt Identification Register (IIR)
STATIC INLINE void | IP_UART_SetupFIFOS (IP_USART_001_T *pUART, uint32_t fcr)
| Setup the UART FIFOs.
STATIC INLINE void | IP_UART_SetMode (IP_USART_001_T *pUART, uint32_t lcr)
| Setup the UART operation mode in the Line Control Register (LCR)
STATIC INLINE void | IP_UART_EnableDivisorAccess (IP_USART_001_T *pUART)
| Enable access to Divisor Latches.
STATIC INLINE void | IP_UART_DisableDivisorAccess (IP_USART_001_T *pUART)
| Disable access to Divisor Latches.
STATIC INLINE void | IP_UART_SetDivisorLatches (IP_USART_001_T *pUART, uint8_t dll, uint8_t dlm)
| Set LSB and MSB divisor latch registers.
STATIC INLINE uint32_t | IP_UART_ReadModemControl (IP_USART_001_T *pUART)
| Return modem control register/status.
STATIC INLINE void | IP_UART_SetModemControl (IP_USART_001_T *pUART, uint32_t mcr)
| Set modem control register/status.
STATIC INLINE void | IP_UART_ClearModemControl (IP_USART_001_T *pUART, uint32_t mcr)
| Clear modem control register/status.
STATIC INLINE uint32_t | IP_UART_ReadLineStatus (IP_USART_001_T *pUART)
| Return Line Status register/status (LSR)
STATIC INLINE uint32_t | IP_UART_ReadModemStatus (IP_USART_001_T *pUART)
| Return Modem Status register/status (MSR)
STATIC INLINE void | IP_UART_SetScratch (IP_USART_001_T *pUART, uint8_t data)
| Write a byte to the scratchpad register.
STATIC INLINE uint8_t | IP_UART_ReadScratch (IP_USART_001_T *pUART)
| Returns current byte value in the scratchpad register.
STATIC INLINE void | IP_UART_SetAutoBaudReg (IP_USART_001_T *pUART, uint32_t acr)
| Set autobaud register options.
STATIC INLINE void | IP_UART_ClearAutoBaudReg (IP_USART_001_T *pUART, uint32_t acr)
| Clear autobaud register options.
STATIC INLINE void | IP_UART_TXEnable (IP_USART_001_T *pUART)
| Enable transmission on UART TxD pin.
STATIC INLINE void | IP_UART_TXDisable (IP_USART_001_T *pUART)
| Disable transmission on UART TxD pin.
STATIC INLINE void | IP_UART_SetRS485Flags (IP_USART_001_T *pUART, uint32_t ctrl)
| Set RS485 control register options.
STATIC INLINE void | IP_UART_ClearRS485Flags (IP_USART_001_T *pUART, uint32_t ctrl)
| Clear RS485 control register options.
STATIC INLINE void | IP_UART_SetRS485Addr (IP_USART_001_T *pUART, uint8_t addr)
| Set RS485 address match value.
STATIC INLINE uint8_t | IP_UART_GetRS485Addr (IP_USART_001_T *pUART)
| Read RS485 address match value.
STATIC INLINE void | IP_UART_SetRS485Delay (IP_USART_001_T *pUART, uint8_t dly)
| Set RS485 direction control (RTS or DTR) delay value.
STATIC INLINE uint8_t | IP_UART_GetRS485Delay (IP_USART_001_T *pUART)
| Read RS485 direction control (RTS or DTR) delay value.
uint32_t | IP_UART_SetBaud (IP_USART_001_T *pUART, uint32_t baudrate, uint32_t uClk)
| Determines and sets best dividers to get a target bit rate.

## Macro Definition Documentation

#define UART1_IER_BITMASK (0x38F)

UART1 interrupt enable register bit mask

Definition at line 149 of file usart_004.h.

#define UART_ACR_ABEOINT_CLR (1 << 8)

UART End of auto-baud interrupt clear

Definition at line 432 of file usart_004.h.

#define UART_ACR_ABTOINT_CLR (1 << 9)

UART Auto-baud time-out interrupt clear

Definition at line 433 of file usart_004.h.

#define UART_ACR_AUTO_RESTART (1 << 2)

UART Auto baudrate restart

Definition at line 431 of file usart_004.h.

#define UART_ACR_BITMASK (0x307)

UART Auto Baudrate register bit mask

Definition at line 434 of file usart_004.h.

#define UART_ACR_MODE (1 << 1)

UART Auto baudrate Mode 1

Definition at line 430 of file usart_004.h.

#define UART_ACR_START (1 << 0)

Macro defines for UART Auto baudrate control register.

UART Auto-baud start

Definition at line 429 of file usart_004.h.

#define UART_DLL_MASKBIT (0xFF)

Divisor latch LSB (DLL) bit mask

Definition at line 288 of file usart_004.h.

#define UART_DLM_MASKBIT (0xFF)

Divisor latch MSB (DLM) bit mask

Definition at line 289 of file usart_004.h.

#define UART_FCR_BITMASK (0xCF)

UART FIFO control bit mask

Definition at line 217 of file usart_004.h.

#define UART_FCR_DMAMODE_SEL (1 << 3)

UART DMA mode selection

Definition at line 212 of file usart_004.h.

#define UART_FCR_FIFO_EN (1 << 0)

Macro defines for UART FIFO control register.

UART FIFO enable

Definition at line 209 of file usart_004.h.

#define UART_FCR_RX_RS (1 << 1)

UART FIFO RX reset

Definition at line 210 of file usart_004.h.

#define UART_FCR_TRG_LEV0 (0)

UART FIFO trigger level 0: 1 character

Definition at line 213 of file usart_004.h.

#define UART_FCR_TRG_LEV1 (1 << 6)

UART FIFO trigger level 1: 4 character

Definition at line 214 of file usart_004.h.

#define UART_FCR_TRG_LEV2 (2 << 6)

UART FIFO trigger level 2: 8 character

Definition at line 215 of file usart_004.h.

#define UART_FCR_TRG_LEV3 (3 << 6)

UART FIFO trigger level 3: 14 character

Definition at line 216 of file usart_004.h.

#define UART_FCR_TX_RS (1 << 2)

UART FIFO TX reset

Definition at line 211 of file usart_004.h.

#define UART_IER_ABEOINT (1 << 8)

Enables the end of auto-baud interrupt

Definition at line 146 of file usart_004.h.

#define UART_IER_ABTOINT (1 << 9)

Enables the auto-baud time-out interrupt

Definition at line 147 of file usart_004.h.

#define UART_IER_BITMASK (0x307)

UART interrupt enable register bit mask

Definition at line 148 of file usart_004.h.

#define UART_IER_CTSINT (1 << 7)

CTS1 signal transition interrupt enable

Definition at line 145 of file usart_004.h.

#define UART_IER_MSINT (1 << 3)

Modem status interrupt enable

Definition at line 144 of file usart_004.h.

#define UART_IER_RBRINT (1 << 0)

Macro defines for UART interrupt enable register.

RBR Interrupt enable

Definition at line 141 of file usart_004.h.

#define UART_IER_RLSINT (1 << 2)

RX line status interrupt enable

Definition at line 143 of file usart_004.h.

#define UART_IER_THREINT (1 << 1)

THR Interrupt enable

Definition at line 142 of file usart_004.h.

#define UART_IIR_ABEO_INT (1 << 8)

End of auto-baud interrupt

Definition at line 192 of file usart_004.h.

#define UART_IIR_ABTO_INT (1 << 9)

Auto-baud time-out interrupt

Definition at line 193 of file usart_004.h.

#define UART_IIR_BITMASK (0x3CF)

UART interrupt identification register bit mask

Definition at line 194 of file usart_004.h.

#define UART_IIR_FIFO_EN (3 << 6)

These bits are equivalent to UnFCR[0]

Definition at line 191 of file usart_004.h.

#define UART_IIR_INTID_CTI (6 << 1)

Interrupt identification: Character time-out indicator

Definition at line 187 of file usart_004.h.

#define UART_IIR_INTID_MASK (7 << 1)

Interrupt identification: Interrupt ID mask

Definition at line 190 of file usart_004.h.

#define UART_IIR_INTID_MODEM (0 << 1)

Interrupt identification: Modem interrupt

Definition at line 189 of file usart_004.h.

#define UART_IIR_INTID_RDA (2 << 1)

Interrupt identification: Receive data available

Definition at line 186 of file usart_004.h.

#define UART_IIR_INTID_RLS (3 << 1)

Interrupt identification: Receive line status

Definition at line 185 of file usart_004.h.

#define UART_IIR_INTID_THRE (1 << 1)

Interrupt identification: THRE interrupt

Definition at line 188 of file usart_004.h.

#define UART_IIR_INTSTAT_PEND (1 << 0)

Macro defines for UART interrupt identification register.

Interrupt Status - Active low

Definition at line 184 of file usart_004.h.

#define UART_LCR_BITMASK (0xFF)

UART line control bit mask

Definition at line 250 of file usart_004.h.

#define UART_LCR_BREAK_EN (1 << 6)

UART Transmission Break enable

Definition at line 248 of file usart_004.h.

#define UART_LCR_DLAB_EN (1 << 7)

UART Divisor Latches Access bit enable

Definition at line 249 of file usart_004.h.

#define UART_LCR_PARITY_DIS (0 << 3)

UART Parity Disable

Definition at line 243 of file usart_004.h.

#define UART_LCR_PARITY_EN (1 << 3)

UART Parity Enable

Definition at line 242 of file usart_004.h.

#define UART_LCR_PARITY_EVEN (1 << 4)

UART Even Parity Select

Definition at line 245 of file usart_004.h.

#define UART_LCR_PARITY_F_0 (3 << 4)

UART force 0 stick parity

Definition at line 247 of file usart_004.h.

#define UART_LCR_PARITY_F_1 (2 << 4)

UART force 1 stick parity

Definition at line 246 of file usart_004.h.

#define UART_LCR_PARITY_ODD (0)

UART Odd Parity Select

Definition at line 244 of file usart_004.h.

#define UART_LCR_SBS_1BIT (0 << 2)

UART One Stop Bit Select

Definition at line 240 of file usart_004.h.

#define UART_LCR_SBS_2BIT (1 << 2)

UART Two Stop Bits Select

Definition at line 241 of file usart_004.h.

#define UART_LCR_WLEN5 (0)

Macro defines for UART line control register.

UART 5 bit data mode

Definition at line 236 of file usart_004.h.

#define UART_LCR_WLEN6 (1 << 0)

UART 6 bit data mode

Definition at line 237 of file usart_004.h.

#define UART_LCR_WLEN7 (2 << 0)

UART 7 bit data mode

Definition at line 238 of file usart_004.h.

#define UART_LCR_WLEN8 (3 << 0)

UART 8 bit data mode

Definition at line 239 of file usart_004.h.

#define UART_LSR_BI (1 << 4)

Line status register: Break interrupt

Definition at line 362 of file usart_004.h.

#define UART_LSR_BITMASK (0xFF)

UART Line status bit mask

Definition at line 366 of file usart_004.h.

#define UART_LSR_FE (1 << 3)

Line status register: Framing error

Definition at line 361 of file usart_004.h.

#define UART_LSR_OE (1 << 1)

Line status register: Overrun error

Definition at line 359 of file usart_004.h.

#define UART_LSR_PE (1 << 2)

Line status register: Parity error

Definition at line 360 of file usart_004.h.

#define UART_LSR_RDR (1 << 0)

Macro defines for UART line status register.

Line status register: Receive data ready

Definition at line 358 of file usart_004.h.

#define UART_LSR_RXFE (1 << 7)

Error in RX FIFO

Definition at line 365 of file usart_004.h.

#define UART_LSR_TEMT (1 << 6)

Line status register: Transmitter empty

Definition at line 364 of file usart_004.h.

#define UART_LSR_THRE (1 << 5)

Line status register: Transmit holding register empty

Definition at line 363 of file usart_004.h.

#define UART_MCR_AUTO_CTS_EN (1 << 7)

Enable Auto CTS flow-control

Definition at line 314 of file usart_004.h.

#define UART_MCR_AUTO_RTS_EN (1 << 6)

Enable Auto RTS flow-control

Definition at line 313 of file usart_004.h.

#define UART_MCR_BITMASK (0x0F3)

UART1 bit mask value

Definition at line 315 of file usart_004.h.

#define UART_MCR_DTR_CTRL (1 << 0)

Macro defines for UART Modem control register.

Source for modem output pin DTR

Definition at line 310 of file usart_004.h.

#define UART_MCR_LOOPB_EN (1 << 4)

Loop back mode select

Definition at line 312 of file usart_004.h.

#define UART_MCR_RTS_CTRL (1 << 1)

Source for modem output pin RTS

Definition at line 311 of file usart_004.h.

#define UART_MSR_BITMASK (0xFF)

MSR register bit-mask value

Definition at line 391 of file usart_004.h.

#define UART_MSR_CTS (1 << 4)

Clear To Send State

Definition at line 387 of file usart_004.h.

#define UART_MSR_DCD (1 << 7)

Data Carrier Detect State

Definition at line 390 of file usart_004.h.

#define UART_MSR_DELTA_CTS (1 << 0)

Macro defines for UART Modem status register.

Set upon state change of input CTS

Definition at line 383 of file usart_004.h.

#define UART_MSR_DELTA_DCD (1 << 3)

Set upon state change of input DCD

Definition at line 386 of file usart_004.h.

#define UART_MSR_DELTA_DSR (1 << 1)

Set upon state change of input DSR

Definition at line 384 of file usart_004.h.

#define UART_MSR_DSR (1 << 5)

Data Set Ready State

Definition at line 388 of file usart_004.h.

#define UART_MSR_LO2HI_RI (1 << 2)

Set upon low to high transition of input RI

Definition at line 385 of file usart_004.h.

#define UART_MSR_RI (1 << 6)

Ring Indicator State

Definition at line 389 of file usart_004.h.

#define UART_RBR_MASKBIT (0xFF)

UART Received Buffer mask bit (8 bits)

Definition at line 96 of file usart_004.h.

#define UART_RS485CTRL_AADEN (1 << 2)

Auto Address Detect (AAD) is enabled

Definition at line 487 of file usart_004.h.

#define UART_RS485CTRL_BITMASK (0x3F)

RS485 control bit-mask value

Definition at line 494 of file usart_004.h.

#define UART_RS485CTRL_DCTRL_EN (1 << 4)

Enable Auto Direction Control

Definition at line 490 of file usart_004.h.

#define UART_RS485CTRL_NMM_EN (1 << 0)

Macro defines for UART1 RS485 Control register.

RS-485/EIA-485 Normal Multi-drop Mode (NMM) is disabled

Definition at line 485 of file usart_004.h.

#define UART_RS485CTRL_OINV_1 (1 << 5)

This bit reverses the polarity of the direction control signal on the RTS (or DTR) pin. The direction control pin will be driven to logic "1" when the transmitter has data to be sent

Definition at line 491 of file usart_004.h.

#define UART_RS485CTRL_RX_DIS (1 << 1)

The receiver is disabled

Definition at line 486 of file usart_004.h.

#define UART_RS485CTRL_SEL_DTR (1 << 3)

If direction control is enabled (bit DCTRL = 1), pin DTR is used for direction control

Definition at line 488 of file usart_004.h.

#define UART_TX_FIFO_SIZE (16)

Definition at line 218 of file usart_004.h.

## Function Documentation

STATIC INLINE void IP_UART_ClearAutoBaudReg | ( | IP_USART_001_T * | pUART,
|  | uint32_t | acr
| ) |  |

Clear autobaud register options.

Parameters

  pUART | : Pointer to selected UART peripheral
  acr | : Or'ed values to clear for ACR register

Returns
  Nothing

Note
  Use an Or'ed value of UART_ACR_* definitions with this call to clear specific options.

Definition at line 457 of file usart_004.h.

STATIC INLINE void IP_UART_ClearModemControl | ( | IP_USART_001_T * | pUART,
|  | uint32_t | mcr
| ) |  |

Clear modem control register/status.

Parameters

  pUART | : Pointer to selected UART peripheral
  mcr | : Modem control register flags to clear

Returns
  Nothing

Note
  Use an Or'ed value of UART_MCR_* definitions with this call to clear specific options.

Definition at line 350 of file usart_004.h.

STATIC INLINE void IP_UART_ClearRS485Flags | ( | IP_USART_001_T * | pUART,
|  | uint32_t | ctrl
| ) |  |

Clear RS485 control register options.

Parameters

  pUART | : Pointer to selected UART peripheral
  ctrl | : Or'ed values to clear for RS485 control register

Returns
  Nothing

Note
  Use an Or'ed value of UART_RS485CTRL_* definitions with this call to clear specific options.

Definition at line 517 of file usart_004.h.

STATIC INLINE void IP_UART_DeInit | ( | IP_USART_001_T * | pUART | ) |

UART de-initialization.

Parameters

  pUART | : Pointer to selected UART peripheral

Returns
  Nothing

Definition at line 111 of file usart_004.h.

STATIC INLINE void IP_UART_DisableDivisorAccess | ( | IP_USART_001_T * | pUART | ) |

Disable access to Divisor Latches.

Parameters

  pUART | : Pointer to selected UART peripheral

Returns
  Nothing

Definition at line 283 of file usart_004.h.

STATIC INLINE void IP_UART_EnableDivisorAccess | ( | IP_USART_001_T * | pUART | ) |

Enable access to Divisor Latches.

Parameters

  pUART | : Pointer to selected UART peripheral

Returns
  Nothing

Definition at line 273 of file usart_004.h.

STATIC INLINE uint8_t IP_UART_GetRS485Addr | ( | IP_USART_001_T * | pUART | ) |

Read RS485 address match value.

Parameters

  pUART | : Pointer to selected UART peripheral

Returns
  Address match value for RS-485/EIA-485 mode

Definition at line 538 of file usart_004.h.

STATIC INLINE uint8_t IP_UART_GetRS485Delay | ( | IP_USART_001_T * | pUART | ) |

Read RS485 direction control (RTS or DTR) delay value.

Parameters

  pUART | : Pointer to selected UART peripheral

Returns
  direction control (RTS or DTR) delay value

Note
  This delay time is in periods of the baud clock. Any delay time from 0 to 255 bit times may be programmed.

Definition at line 563 of file usart_004.h.

void IP_UART_Init | ( | IP_USART_001_T * | pUART | ) |

Basic UART initialization.

Parameters

  pUART | : Pointer to selected UART peripheral

Returns
  Nothing

Note
  This function performs very basic UART initialization

Definition at line 57 of file usart_004.c.

STATIC INLINE void IP_UART_IntDisable | ( | IP_USART_001_T * | pUART,
|  | uint32_t | intMask
| ) |  |

Disable UART interrupts.

Parameters

  pUART | : Pointer to selected UART peripheral
  intMask | : Or'ed Interrupts to disable in the Interrupt Enable Register (IER)

Returns
  Nothing

Note
  Use an Or'ed value of UART_IER_* definitions with this call to disable specific UART interrupts. The Divisor Latch Access Bit (DLAB) in LCR must be cleared in order to access the IER register. This function doesn't alter the DLAB state.

Definition at line 176 of file usart_004.h.

STATIC INLINE void IP_UART_IntEnable | ( | IP_USART_001_T * | pUART,
|  | uint32_t | intMask
| ) |  |

Enable UART interrupts.

Parameters

  pUART | : Pointer to selected UART peripheral
  intMask | : Or'ed Interrupts to enable in the Interrupt Enable Register (IER)

Returns
  Nothing

Note
  Use an Or'ed value of UART_IER_* definitions with this call to enable specific UART interrupts. The Divisor Latch Access Bit (DLAB) in LCR must be cleared in order to access the IER register. This function doesn't alter the DLAB state.

Definition at line 161 of file usart_004.h.

STATIC INLINE uint8_t IP_UART_ReadByte | ( | IP_USART_001_T * | pUART | ) |

Get a single data from UART peripheral.

Parameters

  pUART | : Pointer to selected UART peripheral

Returns
  A single byte of data read

Note
  This function reads a byte from the UART receive FIFO or receive hold register regard regardless of UART state.

Definition at line 133 of file usart_004.h.

STATIC INLINE uint32_t IP_UART_ReadIntIDReg | ( | IP_USART_001_T * | pUART | ) |

Read the Interrupt Identification Register (IIR)

Parameters

  pUART | : Pointer to selected UART peripheral

Returns
  Current pending interrupt status per the IIR register

Definition at line 201 of file usart_004.h.

STATIC INLINE uint32_t IP_UART_ReadLineStatus | ( | IP_USART_001_T * | pUART | ) |

Return Line Status register/status (LSR)

Parameters

  pUART | : Pointer to selected UART peripheral

Returns
  Line Status register (status)

Note
  Mask bits of the returned status value with UART_LSR_* definitions for specific statuses.

Definition at line 375 of file usart_004.h.

STATIC INLINE uint32_t IP_UART_ReadModemControl | ( | IP_USART_001_T * | pUART | ) |

Return modem control register/status.

Parameters

  pUART | : Pointer to selected UART peripheral

Returns
  Modem control register (status)

Note
  Mask bits of the returned status value with UART_MCR_* definitions for specific statuses.

Definition at line 324 of file usart_004.h.

STATIC INLINE uint32_t IP_UART_ReadModemStatus | ( | IP_USART_001_T * | pUART | ) |

Return Modem Status register/status (MSR)

Parameters

  pUART | : Pointer to selected UART peripheral

Returns
  Modem Status register (status)

Note
  Mask bits of the returned status value with UART_MSR_* definitions for specific statuses.

Definition at line 400 of file usart_004.h.

STATIC INLINE uint8_t IP_UART_ReadScratch | ( | IP_USART_001_T * | pUART | ) |

Returns current byte value in the scratchpad register.

Parameters

  pUART | : Pointer to selected UART peripheral

Returns
  Byte value read from scratchpad register

Definition at line 421 of file usart_004.h.

STATIC INLINE void IP_UART_SendByte | ( | IP_USART_001_T * | pUART,
|  | const uint8_t | data
| ) |  |

Transmit a single byte through the UART peripheral.

Transmit a single data through UART peripheral.

Parameters

  pUART | : Pointer to selected UART peripheral
  data | : Byte to transmit

Returns
  Nothing

Note
  This function attempts to place a byte into the UART transmit FIFO or transmit hold register regard regardless of UART state.

Definition at line 121 of file usart_004.h.

STATIC INLINE void IP_UART_SetAutoBaudReg | ( | IP_USART_001_T * | pUART,
|  | uint32_t | acr
| ) |  |

Set autobaud register options.

Parameters

  pUART | : Pointer to selected UART peripheral
  acr | : Or'ed values to set for ACR register

Returns
  Nothing

Note
  Use an Or'ed value of UART_ACR_* definitions with this call to set specific options.

Definition at line 444 of file usart_004.h.

uint32_t IP_UART_SetBaud | ( | IP_USART_001_T * | pUART,
|  | uint32_t | baudrate,
|  | uint32_t | uClk
| ) |  |

Determines and sets best dividers to get a target bit rate.

Parameters

  pUART | : Pointer to selected UART peripheral
  baudrate | : Target baud rate (baud rate = bit rate)
  uClk | : Clock rate into UART peripheral

Returns
  The actual baud rate, or 0 if no rate can be found

Note
  Once you've computed your baud rate, you can remove this function to make your image smaller.

Determines and sets best dividers to get a target bit rate.

Parameters

  pUART | : Pointer to selected UARTx peripheral
  baudrate | : Desired UART baud rate.
  uClk | : Current Uart Block Clock.

Returns
  Error status, could be SUCCESS or ERROR

Definition at line 153 of file usart_001.c.

STATIC INLINE void IP_UART_SetDivisorLatches | ( | IP_USART_001_T * | pUART,
|  | uint8_t | dll,
|  | uint8_t | dlm
| ) |  |

Set LSB and MSB divisor latch registers.

Parameters

  pUART | : Pointer to selected UART peripheral
  dll | : Divisor Latch LSB value
  dlm | : Divisor Latch MSB value

Returns
  Nothing

Note
  The Divisor Latch Access Bit (DLAB) in LCR must be set in order to access the USART Divisor Latches. This function doesn't alter the DLAB state.

Definition at line 301 of file usart_004.h.

STATIC INLINE void IP_UART_SetMode | ( | IP_USART_001_T * | pUART,
|  | uint32_t | lcr
| ) |  |

Setup the UART operation mode in the Line Control Register (LCR)

Parameters

  pUART | : Pointer to selected UART peripheral
  lcr | : OR'ed flags

Returns
  Nothing

Note
  Sets up the UART transmit mode (data bits, stop bits, parity, and break). Use an Or'ed value of UART_LCR_* definitions with this call to select specific options. Unless the UART_LCR_DLAB_EN option is passed in lcd, DLAB will be cleared and divisor access will be disabled.

Definition at line 263 of file usart_004.h.

STATIC INLINE void IP_UART_SetModemControl | ( | IP_USART_001_T * | pUART,
|  | uint32_t | mcr
| ) |  |

Set modem control register/status.

Parameters

  pUART | : Pointer to selected UART peripheral
  mcr | : Modem control register flags to set

Returns
  Nothing

Note
  Use an Or'ed value of UART_MCR_* definitions with this call to set specific options.

Definition at line 337 of file usart_004.h.

STATIC INLINE void IP_UART_SetRS485Addr | ( | IP_USART_001_T * | pUART,
|  | uint8_t | addr
| ) |  |

Set RS485 address match value.

Parameters

  pUART | : Pointer to selected UART peripheral
  addr | : Address match value for RS-485/EIA-485 mode

Returns
  Nothing

Definition at line 528 of file usart_004.h.

STATIC INLINE void IP_UART_SetRS485Delay | ( | IP_USART_001_T * | pUART,
|  | uint8_t | dly
| ) |  |

Set RS485 direction control (RTS or DTR) delay value.

Parameters

  pUART | : Pointer to selected UART peripheral
  dly | : direction control (RTS or DTR) delay value

Returns
  Nothing

Note
  This delay time is in periods of the baud clock. Any delay time from 0 to 255 bit times may be programmed.

Definition at line 551 of file usart_004.h.

STATIC INLINE void IP_UART_SetRS485Flags | ( | IP_USART_001_T * | pUART,
|  | uint32_t | ctrl
| ) |  |

Set RS485 control register options.

Parameters

  pUART | : Pointer to selected UART peripheral
  ctrl | : Or'ed values to set for RS485 control register

Returns
  Nothing

Note
  Use an Or'ed value of UART_RS485CTRL_* definitions with this call to set specific options.

Definition at line 504 of file usart_004.h.

STATIC INLINE void IP_UART_SetScratch | ( | IP_USART_001_T * | pUART,
|  | uint8_t | data
| ) |  |

Write a byte to the scratchpad register.

Parameters

  pUART | : Pointer to selected UART peripheral
  data | : Byte value to write

Returns
  Nothing

Definition at line 411 of file usart_004.h.

STATIC INLINE void IP_UART_SetupFIFOS | ( | IP_USART_001_T * | pUART,
|  | uint32_t | fcr
| ) |  |

Setup the UART FIFOs.

Parameters

  pUART | : Pointer to selected UART peripheral
  fcr | : FIFO control register setup OR'ed flags

Returns
  Nothing

Note
  Use an Or'ed value of UART_FCR_* definitions with this call to select specific options.

Definition at line 228 of file usart_004.h.

STATIC INLINE void IP_UART_TXDisable | ( | IP_USART_001_T * | pUART | ) |

Disable transmission on UART TxD pin.

Parameters

  pUART | : Pointer to selected UART peripheral

Returns
  Nothing

Definition at line 477 of file usart_004.h.

STATIC INLINE void IP_UART_TXEnable | ( | IP_USART_001_T * | pUART | ) |

Enable transmission on UART TxD pin.

Parameters

  pUART | : Pointer to selected UART peripheral

Returns
  Nothing

Definition at line 467 of file usart_004.h.