Go to the documentation of this file.
35 # pragma GCC diagnostic ignored "-Wsign-conversion"
36 # pragma GCC diagnostic ignored "-Wconversion"
37 # pragma GCC diagnostic ignored "-Wmissing-declarations"
38 # pragma GCC diagnostic ignored "-Wunused-parameter"
86 while ((sent < numBytes) &&
102 while (numBytes > 0) {
119 while ((readBytes < numBytes) &&
132 int pass, readBytes = 0;
135 while (readBytes < numBytes) {
152 div = clkin / (baudrate * 16);
156 divl = div - (divh * 256);
253 dval = uClk % rate16;
264 mval = rate16 / dval;
276 dl = uClk / (rate16 + rate16 *dval / mval);
287 actualRate = uClk / (16 * dl + 16 * dl * dval / mval);
void Chip_UART_DeInit(LPC_USART_T *pUART)
De-initializes the pUART peripheral.
int RingBuffer_PopMult(RINGBUFF_T *RingBuff, void *data, int num)
Pop an array of items from the ring buffer.
STATIC INLINE void Chip_UART_DisableDivisorAccess(LPC_USART_T *pUART)
Disable access to Divisor Latches.
USART register block structure.
STATIC INLINE uint8_t Chip_UART_ReadByte(LPC_USART_T *pUART)
Read a single byte data from the UART peripheral.
#define UART_FDR_DIVADDVAL(n)
Macro defines for UART Fractional Divider Register.
#define UART_LCR_SBS_1BIT
int RingBuffer_InsertMult(RINGBUFF_T *RingBuff, const void *data, int num)
Insert an array of items into ring buffer.
#define UART_LCR_PARITY_DIS
STATIC INLINE int RingBuffer_IsEmpty(RINGBUFF_T *RingBuff)
Return empty status of ring buffer.
void Chip_UART_IRQRBHandler(LPC_USART_T *pUART, RINGBUFF_T *pRXRB, RINGBUFF_T *pTXRB)
UART receive/transmit interrupt handler for ring buffers.
STATIC INLINE void Chip_UART_SendByte(LPC_USART_T *pUART, uint8_t data)
Transmit a single data byte through the UART peripheral.
STATIC INLINE void Chip_UART_IntDisable(LPC_USART_T *pUART, uint32_t intMask)
Disable UART interrupts.
int Chip_UART_ReadRB(LPC_USART_T *pUART, RINGBUFF_T *pRB, void *data, int bytes)
Copy data from a receive ring buffer.
STATIC INLINE void Chip_UART_EnableDivisorAccess(LPC_USART_T *pUART)
Enable access to Divisor Latches.
#define UART_FCR_FIFO_EN
Macro defines for UART FIFO Control Register.
STATIC INLINE void Chip_UART_IntEnable(LPC_USART_T *pUART, uint32_t intMask)
Enable UART interrupts.
#define UART_FDR_MULVAL(n)
#define UART_LSR_RDR
Macro defines for UART Line Status Register.
STATIC INLINE void Chip_Clock_EnablePeriphClock(CHIP_SYSCTL_CLOCK_T clk)
Enable a system or peripheral clock.
STATIC INLINE void Chip_Clock_SetUARTClockDiv(uint32_t div)
Set UART divider clock.
void Chip_UART_TXIntHandlerRB(LPC_USART_T *pUART, RINGBUFF_T *pRB)
UART transmit-only interrupt handler for ring buffers.
#define UART_LOAD_DLM(div)
Macro defines for UART Divisor Latch MSB register.
#define UART_LOAD_DLL(div)
Macro defines for UART Divisor Latch LSB register.
void Chip_UART_RXIntHandlerRB(LPC_USART_T *pUART, RINGBUFF_T *pRB)
UART receive-only interrupt handler for ring buffers.
STATIC INLINE void Chip_UART_SetDivisorLatches(LPC_USART_T *pUART, uint8_t dll, uint8_t dlm)
Set LSB and MSB divisor latch registers.
STATIC INLINE uint32_t Chip_UART_ReadLineStatus(LPC_USART_T *pUART)
Return Line Status register/status (LSR)
STATIC INLINE void Chip_UART_ConfigData(LPC_USART_T *pUART, uint32_t config)
Configure data width, parity and stop bits.
uint32_t Chip_Clock_GetMainClockRate(void)
Return main clock rate.
int RingBuffer_Insert(RINGBUFF_T *RingBuff, const void *data)
Insert a single item into ring buffer.
uint32_t Chip_UART_SetBaud(LPC_USART_T *pUART, uint32_t baudrate)
Sets best dividers to get a target bit rate (without fractional divider)
void Chip_UART_Init(LPC_USART_T *pUART)
Initializes the pUART peripheral.
int Chip_UART_Read(LPC_USART_T *pUART, void *data, int numBytes)
Read data through the UART peripheral (non-blocking)
int Chip_UART_Send(LPC_USART_T *pUART, const void *data, int numBytes)
Transmit a byte array through the UART peripheral (non-blocking)
int Chip_UART_ReadBlocking(LPC_USART_T *pUART, void *data, int numBytes)
Read data through the UART peripheral (blocking)
uint32_t Chip_UART_SetBaudFDR(LPC_USART_T *pUART, uint32_t baudrate)
Sets best dividers to get a target bit rate (with fractional divider)
uint32_t Chip_UART_SendRB(LPC_USART_T *pUART, RINGBUFF_T *pRB, const void *data, int bytes)
Populate a transmit ring buffer and start UART transmit.
int RingBuffer_Pop(RINGBUFF_T *RingBuff, void *data)
Pop an item from the ring buffer.
STATIC INLINE void Chip_UART_SetupFIFOS(LPC_USART_T *pUART, uint32_t fcr)
Setup the UART FIFOs.
STATIC INLINE void Chip_Clock_DisablePeriphClock(CHIP_SYSCTL_CLOCK_T clk)
Disable a system or peripheral clock.
int Chip_UART_SendBlocking(LPC_USART_T *pUART, const void *data, int numBytes)
Transmit a byte array through the UART peripheral (blocking)