1 |
581 |
jeremybenn |
//*****************************************************************************
|
2 |
|
|
//
|
3 |
|
|
// uart.h - Defines and Macros for the UART.
|
4 |
|
|
//
|
5 |
|
|
// Copyright (c) 2005,2006 Luminary Micro, Inc. All rights reserved.
|
6 |
|
|
//
|
7 |
|
|
// Software License Agreement
|
8 |
|
|
//
|
9 |
|
|
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
|
10 |
|
|
// exclusively on LMI's Stellaris Family of microcontroller products.
|
11 |
|
|
//
|
12 |
|
|
// The software is owned by LMI and/or its suppliers, and is protected under
|
13 |
|
|
// applicable copyright laws. All rights are reserved. Any use in violation
|
14 |
|
|
// of the foregoing restrictions may subject the user to criminal sanctions
|
15 |
|
|
// under applicable laws, as well as to civil liability for the breach of the
|
16 |
|
|
// terms and conditions of this license.
|
17 |
|
|
//
|
18 |
|
|
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
19 |
|
|
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
20 |
|
|
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
21 |
|
|
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
|
22 |
|
|
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
23 |
|
|
//
|
24 |
|
|
// This is part of revision 523 of the Stellaris Driver Library.
|
25 |
|
|
//
|
26 |
|
|
//*****************************************************************************
|
27 |
|
|
|
28 |
|
|
#ifndef __UART_H__
|
29 |
|
|
#define __UART_H__
|
30 |
|
|
|
31 |
|
|
#ifdef __cplusplus
|
32 |
|
|
extern "C"
|
33 |
|
|
{
|
34 |
|
|
#endif
|
35 |
|
|
|
36 |
|
|
//*****************************************************************************
|
37 |
|
|
//
|
38 |
|
|
// Values that can be passed to UARTIntEnable, UARTIntDisable, and UARTIntClear
|
39 |
|
|
// as the ulIntFlags parameter, and returned from UARTIntStatus.
|
40 |
|
|
//
|
41 |
|
|
//*****************************************************************************
|
42 |
|
|
#define UART_INT_OE 0x400 // Overrun Error Interrupt Mask
|
43 |
|
|
#define UART_INT_BE 0x200 // Break Error Interrupt Mask
|
44 |
|
|
#define UART_INT_PE 0x100 // Parity Error Interrupt Mask
|
45 |
|
|
#define UART_INT_FE 0x080 // Framing Error Interrupt Mask
|
46 |
|
|
#define UART_INT_RT 0x040 // Receive Timeout Interrupt Mask
|
47 |
|
|
#define UART_INT_TX 0x020 // Transmit Interrupt Mask
|
48 |
|
|
#define UART_INT_RX 0x010 // Receive Interrupt Mask
|
49 |
|
|
|
50 |
|
|
//*****************************************************************************
|
51 |
|
|
//
|
52 |
|
|
// Values that can be passed to UARTConfigSet as the ulConfig parameter and
|
53 |
|
|
// returned by UARTConfigGet in the pulConfig parameter. Additionally, the
|
54 |
|
|
// UART_CONFIG_PAR_* subset can be passed to UARTParityModeSet as the ulParity
|
55 |
|
|
// parameter, and are returned by UARTParityModeGet.
|
56 |
|
|
//
|
57 |
|
|
//*****************************************************************************
|
58 |
|
|
#define UART_CONFIG_WLEN_8 0x00000060 // 8 bit data
|
59 |
|
|
#define UART_CONFIG_WLEN_7 0x00000040 // 7 bit data
|
60 |
|
|
#define UART_CONFIG_WLEN_6 0x00000020 // 6 bit data
|
61 |
|
|
#define UART_CONFIG_WLEN_5 0x00000000 // 5 bit data
|
62 |
|
|
#define UART_CONFIG_STOP_ONE 0x00000000 // One stop bit
|
63 |
|
|
#define UART_CONFIG_STOP_TWO 0x00000008 // Two stop bits
|
64 |
|
|
#define UART_CONFIG_PAR_NONE 0x00000000 // No parity
|
65 |
|
|
#define UART_CONFIG_PAR_EVEN 0x00000006 // Even parity
|
66 |
|
|
#define UART_CONFIG_PAR_ODD 0x00000002 // Odd parity
|
67 |
|
|
#define UART_CONFIG_PAR_ONE 0x00000086 // Parity bit is one
|
68 |
|
|
#define UART_CONFIG_PAR_ZERO 0x00000082 // Parity bit is zero
|
69 |
|
|
|
70 |
|
|
//*****************************************************************************
|
71 |
|
|
//
|
72 |
|
|
// API Function prototypes
|
73 |
|
|
//
|
74 |
|
|
//*****************************************************************************
|
75 |
|
|
extern void UARTParityModeSet(unsigned long ulBase, unsigned long ulParity);
|
76 |
|
|
extern unsigned long UARTParityModeGet(unsigned long ulBase);
|
77 |
|
|
extern void UARTConfigSet(unsigned long ulBase, unsigned long ulBaud,
|
78 |
|
|
unsigned long ulConfig);
|
79 |
|
|
extern void UARTConfigGet(unsigned long ulBase, unsigned long *pulBaud,
|
80 |
|
|
unsigned long *pulConfig);
|
81 |
|
|
extern void UARTEnable(unsigned long ulBase);
|
82 |
|
|
extern void UARTDisable(unsigned long ulBase);
|
83 |
|
|
extern tBoolean UARTCharsAvail(unsigned long ulBase);
|
84 |
|
|
extern tBoolean UARTSpaceAvail(unsigned long ulBase);
|
85 |
|
|
extern long UARTCharNonBlockingGet(unsigned long ulBase);
|
86 |
|
|
extern long UARTCharGet(unsigned long ulBase);
|
87 |
|
|
extern tBoolean UARTCharNonBlockingPut(unsigned long ulBase,
|
88 |
|
|
unsigned char ucData);
|
89 |
|
|
extern void UARTCharPut(unsigned long ulBase, unsigned char ucData);
|
90 |
|
|
extern void UARTBreakCtl(unsigned long ulBase, tBoolean bBreakState);
|
91 |
|
|
extern void UARTIntRegister(unsigned long ulBase, void(*pfnHandler)(void));
|
92 |
|
|
extern void UARTIntUnregister(unsigned long ulBase);
|
93 |
|
|
extern void UARTIntEnable(unsigned long ulBase, unsigned long ulIntFlags);
|
94 |
|
|
extern void UARTIntDisable(unsigned long ulBase, unsigned long ulIntFlags);
|
95 |
|
|
extern unsigned long UARTIntStatus(unsigned long ulBase, tBoolean bMasked);
|
96 |
|
|
extern void UARTIntClear(unsigned long ulBase, unsigned long ulIntFlags);
|
97 |
|
|
|
98 |
|
|
#ifdef __cplusplus
|
99 |
|
|
}
|
100 |
|
|
#endif
|
101 |
|
|
|
102 |
|
|
#endif // __UART_H__
|