LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
uart_11xx.h
Go to the documentation of this file.
1 /*
2  * @brief LPC11xx UART chip driver
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * All rights reserved.
7  *
8  * @par
9  * Software that is described herein is for illustrative purposes only
10  * which provides customers with programming information regarding the
11  * LPC products. This software is supplied "AS IS" without any warranties of
12  * any kind, and NXP Semiconductors and its licensor disclaim any and
13  * all warranties, express or implied, including all implied warranties of
14  * merchantability, fitness for a particular purpose and non-infringement of
15  * intellectual property rights. NXP Semiconductors assumes no responsibility
16  * or liability for the use of the software, conveys no license or rights under any
17  * patent, copyright, mask work right, or any other intellectual property rights in
18  * or to any products. NXP Semiconductors reserves the right to make changes
19  * in the software without notification. NXP Semiconductors also makes no
20  * representation or warranty that such application will be suitable for the
21  * specified use without further testing or modification.
22  *
23  * @par
24  * Permission to use, copy, modify, and distribute this software and its
25  * documentation is hereby granted, under NXP Semiconductors' and its
26  * licensor's relevant copyrights in the software, without fee, provided that it
27  * is used in conjunction with NXP Semiconductors microcontrollers. This
28  * copyright, permission, and disclaimer notice must appear in all copies of
29  * this code.
30  */
31 
32 #ifndef __UART_11XX_H_
33 #define __UART_11XX_H_
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
49 void Chip_UART_Init(LPC_USART_T *pUART);
50 
56 void Chip_UART_DeInit(LPC_USART_T *pUART);
57 
64 {
65  IP_UART_TXEnable(pUART);
66 }
67 
74 {
75  IP_UART_TXDisable(pUART);
76 }
77 
86 STATIC INLINE void Chip_UART_SendByte(LPC_USART_T *pUART, uint8_t data)
87 {
88  IP_UART_SendByte(pUART, data);
89 }
90 
100 {
101  return IP_UART_ReadByte(pUART);
102 }
103 
115 int Chip_UART_Send(LPC_USART_T *pUART, const void *data, int numBytes);
116 
127 int Chip_UART_Read(LPC_USART_T *pUART, void *data, int numBytes);
128 
140 {
141  IP_UART_IntEnable(pUART, intMask);
142 }
143 
155 {
156  IP_UART_IntDisable(pUART, intMask);
157 }
158 
165 {
166  return IP_UART_ReadIntIDReg(pUART);
167 }
168 
180 {
181  IP_UART_SetupFIFOS(pUART, fcr);
182 }
183 
195  uint32_t config)
196 {
197  IP_UART_SetMode(pUART, config);
198 }
199 
206 {
208 }
209 
216 {
218 }
219 
230 STATIC INLINE void Chip_UART_SetDivisorLatches(LPC_USART_T *pUART, uint8_t dll, uint8_t dlm)
231 {
232  IP_UART_SetDivisorLatches(pUART, dll, dlm);
233 }
234 
243 {
244  return IP_UART_ReadModemControl(pUART);
245 }
246 
256 {
257  IP_UART_SetModemControl(pUART, mcr);
258 }
259 
269 {
270  IP_UART_ClearModemControl(pUART, mcr);
271 }
272 
281 {
282  return IP_UART_ReadLineStatus(pUART);
283 }
284 
293 {
294  return IP_UART_ReadModemStatus(pUART);
295 }
296 
303 STATIC INLINE void Chip_UART_SetScratch(LPC_USART_T *pUART, uint8_t data)
304 {
305  IP_UART_SetScratch(pUART, data);
306 }
307 
314 {
315  return IP_UART_ReadScratch(pUART);
316 }
317 
327 {
328  IP_UART_SetAutoBaudReg(pUART, acr);
329 }
330 
340 {
341  IP_UART_ClearAutoBaudReg(pUART, acr);
342 }
343 
353 {
354  IP_UART_SetRS485Flags(pUART, ctrl);
355 }
356 
366 {
367  IP_UART_ClearRS485Flags(pUART, ctrl);
368 }
369 
377 {
378  IP_UART_SetRS485Addr(pUART, addr);
379 }
380 
387 {
388  return IP_UART_GetRS485Addr(pUART);
389 }
390 
400 {
401  IP_UART_SetRS485Delay(pUART, dly);
402 }
403 
412 {
413  return IP_UART_GetRS485Delay(pUART);
414 }
415 
423 
431 {
432  return IP_UART_SetBaud(pUART, baudrate, Chip_Clock_GetMainClockRate());
433 }
434 
451 int Chip_UART_SendBlocking(LPC_USART_T *pUART, const void *data, int numBytes);
452 
463 int Chip_UART_ReadBlocking(LPC_USART_T *pUART, void *data, int numBytes);
464 
485 
496 
508 uint32_t Chip_UART_SendRB(LPC_USART_T *pUART, RINGBUFF_T *pRB, const void *data, int bytes);
509 
521 int Chip_UART_ReadRB(LPC_USART_T *pUART, RINGBUFF_T *pRB, void *data, int bytes);
522 
533 void Chip_UART_IRQRBHandler(LPC_USART_T *pUART, RINGBUFF_T *pRXRB, RINGBUFF_T *pTXRB);
534 
543 #ifdef __cplusplus
544 }
545 #endif
546 
547 #endif /* __UART_11XX_H_ */