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
uart_13xx.h
Go to the documentation of this file.
1
/*
2
* @brief LPC13xx 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_13XX_H_
33
#define __UART_13XX_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
63
STATIC
INLINE
void
Chip_UART_TXEnable
(
LPC_USART_T
*pUART)
64
{
65
IP_UART_TXEnable
(pUART);
66
}
67
73
STATIC
INLINE
void
Chip_UART_TXDisable
(
LPC_USART_T
*pUART)
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
99
STATIC
INLINE
uint8_t
Chip_UART_ReadByte
(
LPC_USART_T
*pUART)
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
139
STATIC
INLINE
void
Chip_UART_IntEnable
(
LPC_USART_T
*pUART,
uint32_t
intMask
)
140
{
141
IP_UART_IntEnable
(pUART, intMask);
142
}
143
154
STATIC
INLINE
void
Chip_UART_IntDisable
(
LPC_USART_T
*pUART,
uint32_t
intMask
)
155
{
156
IP_UART_IntDisable
(pUART, intMask);
157
}
158
164
STATIC
INLINE
uint32_t
Chip_UART_ReadIntIDReg
(
LPC_USART_T
*pUART)
165
{
166
return
IP_UART_ReadIntIDReg
(pUART);
167
}
168
179
STATIC
INLINE
void
Chip_UART_SetupFIFOS
(
LPC_USART_T
*pUART,
uint32_t
fcr)
180
{
181
IP_UART_SetupFIFOS
(pUART, fcr);
182
}
183
194
STATIC
INLINE
void
Chip_UART_ConfigData
(
LPC_USART_T
*pUART,
195
uint32_t
config)
196
{
197
IP_UART_SetMode
(pUART, config);
198
}
199
205
STATIC
INLINE
void
Chip_UART_EnableDivisorAccess
(
LPC_USART_T
*pUART)
206
{
207
IP_UART_EnableDivisorAccess
(pUART);
208
}
209
215
STATIC
INLINE
void
Chip_UART_DisableDivisorAccess
(
LPC_USART_T
*pUART)
216
{
217
IP_UART_EnableDivisorAccess
(pUART);
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
242
STATIC
INLINE
uint32_t
Chip_UART_ReadModemControl
(
LPC_USART_T
*pUART)
243
{
244
return
IP_UART_ReadModemControl
(pUART);
245
}
246
255
STATIC
INLINE
void
Chip_UART_SetModemControl
(
LPC_USART_T
*pUART,
uint32_t
mcr)
256
{
257
IP_UART_SetModemControl
(pUART, mcr);
258
}
259
268
STATIC
INLINE
void
Chip_UART_ClearModemControl
(
LPC_USART_T
*pUART,
uint32_t
mcr)
269
{
270
IP_UART_ClearModemControl
(pUART, mcr);
271
}
272
280
STATIC
INLINE
uint32_t
Chip_UART_ReadLineStatus
(
LPC_USART_T
*pUART)
281
{
282
return
IP_UART_ReadLineStatus
(pUART);
283
}
284
292
STATIC
INLINE
uint32_t
Chip_UART_ReadModemStatus
(
LPC_USART_T
*pUART)
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
313
STATIC
INLINE
uint8_t
Chip_UART_ReadScratch
(
LPC_USART_T
*pUART)
314
{
315
return
IP_UART_ReadScratch
(pUART);
316
}
317
326
STATIC
INLINE
void
Chip_UART_SetAutoBaudReg
(
LPC_USART_T
*pUART,
uint32_t
acr)
327
{
328
IP_UART_SetAutoBaudReg
(pUART, acr);
329
}
330
339
STATIC
INLINE
void
Chip_UART_ClearAutoBaudReg
(
LPC_USART_T
*pUART,
uint32_t
acr)
340
{
341
IP_UART_ClearAutoBaudReg
(pUART, acr);
342
}
343
352
STATIC
INLINE
void
Chip_UART_SetRS485Flags
(
LPC_USART_T
*pUART,
uint32_t
ctrl)
353
{
354
IP_UART_SetRS485Flags
(pUART, ctrl);
355
}
356
365
STATIC
INLINE
void
Chip_UART_ClearRS485Flags
(
LPC_USART_T
*pUART,
uint32_t
ctrl)
366
{
367
IP_UART_ClearRS485Flags
(pUART, ctrl);
368
}
369
376
STATIC
INLINE
void
Chip_UART_SetRS485Addr
(
LPC_USART_T
*pUART, uint8_t addr)
377
{
378
IP_UART_SetRS485Addr
(pUART, addr);
379
}
380
386
STATIC
INLINE
uint8_t
Chip_UART_GetRS485Addr
(
LPC_USART_T
*pUART)
387
{
388
return
IP_UART_GetRS485Addr
(pUART);
389
}
390
399
STATIC
INLINE
void
Chip_UART_SetRS485Delay
(
LPC_USART_T
*pUART, uint8_t dly)
400
{
401
IP_UART_SetRS485Delay
(pUART, dly);
402
}
403
411
STATIC
INLINE
uint8_t
Chip_UART_GetRS485Delay
(
LPC_USART_T
*pUART)
412
{
413
return
IP_UART_GetRS485Delay
(pUART);
414
}
415
422
uint32_t
Chip_UART_SetBaud
(
LPC_USART_T
*pUART,
uint32_t
baudrate);
423
430
STATIC
INLINE
uint32_t
Chip_UART_SetBaudFDR
(
LPC_USART_T
*pUART,
uint32_t
baudrate)
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
484
void
Chip_UART_RXIntHandlerRB
(
LPC_USART_T
*pUART,
RINGBUFF_T
*pRB);
485
495
void
Chip_UART_TXIntHandlerRB
(
LPC_USART_T
*pUART,
RINGBUFF_T
*pRB);
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
544
// FIXME DMA support
545
554
#ifdef __cplusplus
555
}
556
#endif
557
558
#endif
/* __UART_13XX_H_ */
software
lpc_core
lpc_chip
chip_13xx
uart_13xx.h
Generated on Fri May 10 2013 10:42:13 for LPCOpen Platform by
1.8.2