OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [Common/] [drivers/] [LuminaryMicro/] [uart.h] - Blame information for rev 615

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 610 jeremybenn
//*****************************************************************************
2
//
3
// uart.h - Defines and Macros for the UART.
4
//
5
// Copyright (c) 2005-2008 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 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.  You may not combine
14
// this software with "viral" open-source software in order to form a larger
15
// program.  Any use in violation of the foregoing restrictions may subject
16
// the user to criminal sanctions under applicable laws, as well as to civil
17
// liability for the breach of the terms and conditions of this license.
18
// 
19
// THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
20
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
21
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
22
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
23
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
24
// 
25
// This is part of revision 2523 of the Stellaris Peripheral Driver Library.
26
//
27
//*****************************************************************************
28
 
29
#ifndef __UART_H__
30
#define __UART_H__
31
 
32
//*****************************************************************************
33
//
34
// If building with a C++ compiler, make all of the definitions in this header
35
// have a C binding.
36
//
37
//*****************************************************************************
38
#ifdef __cplusplus
39
extern "C"
40
{
41
#endif
42
 
43
//*****************************************************************************
44
//
45
// Values that can be passed to UARTIntEnable, UARTIntDisable, and UARTIntClear
46
// as the ulIntFlags parameter, and returned from UARTIntStatus.
47
//
48
//*****************************************************************************
49
#define UART_INT_OE             0x400       // Overrun Error Interrupt Mask
50
#define UART_INT_BE             0x200       // Break Error Interrupt Mask
51
#define UART_INT_PE             0x100       // Parity Error Interrupt Mask
52
#define UART_INT_FE             0x080       // Framing Error Interrupt Mask
53
#define UART_INT_RT             0x040       // Receive Timeout Interrupt Mask
54
#define UART_INT_TX             0x020       // Transmit Interrupt Mask
55
#define UART_INT_RX             0x010       // Receive Interrupt Mask
56
 
57
//*****************************************************************************
58
//
59
// Values that can be passed to UARTConfigSetExpClk as the ulConfig parameter
60
// and returned by UARTConfigGetExpClk in the pulConfig parameter.
61
// Additionally, the UART_CONFIG_PAR_* subset can be passed to
62
// UARTParityModeSet as the ulParity parameter, and are returned by
63
// UARTParityModeGet.
64
//
65
//*****************************************************************************
66
#define UART_CONFIG_WLEN_MASK   0x00000060  // Mask for extracting word length
67
#define UART_CONFIG_WLEN_8      0x00000060  // 8 bit data
68
#define UART_CONFIG_WLEN_7      0x00000040  // 7 bit data
69
#define UART_CONFIG_WLEN_6      0x00000020  // 6 bit data
70
#define UART_CONFIG_WLEN_5      0x00000000  // 5 bit data
71
#define UART_CONFIG_STOP_MASK   0x00000008  // Mask for extracting stop bits
72
#define UART_CONFIG_STOP_ONE    0x00000000  // One stop bit
73
#define UART_CONFIG_STOP_TWO    0x00000008  // Two stop bits
74
#define UART_CONFIG_PAR_MASK    0x00000086  // Mask for extracting parity
75
#define UART_CONFIG_PAR_NONE    0x00000000  // No parity
76
#define UART_CONFIG_PAR_EVEN    0x00000006  // Even parity
77
#define UART_CONFIG_PAR_ODD     0x00000002  // Odd parity
78
#define UART_CONFIG_PAR_ONE     0x00000086  // Parity bit is one
79
#define UART_CONFIG_PAR_ZERO    0x00000082  // Parity bit is zero
80
 
81
//*****************************************************************************
82
//
83
// Values that can be passed to UARTFIFOLevelSet as the ulTxLevel parameter and
84
// returned by UARTFIFOLevelGet in the pulTxLevel.
85
//
86
//*****************************************************************************
87
#define UART_FIFO_TX1_8         0x00000000  // Transmit interrupt at 1/8 Full
88
#define UART_FIFO_TX2_8         0x00000001  // Transmit interrupt at 1/4 Full
89
#define UART_FIFO_TX4_8         0x00000002  // Transmit interrupt at 1/2 Full
90
#define UART_FIFO_TX6_8         0x00000003  // Transmit interrupt at 3/4 Full
91
#define UART_FIFO_TX7_8         0x00000004  // Transmit interrupt at 7/8 Full
92
 
93
//*****************************************************************************
94
//
95
// Values that can be passed to UARTFIFOLevelSet as the ulRxLevel parameter and
96
// returned by UARTFIFOLevelGet in the pulRxLevel.
97
//
98
//*****************************************************************************
99
#define UART_FIFO_RX1_8         0x00000000  // Receive interrupt at 1/8 Full
100
#define UART_FIFO_RX2_8         0x00000008  // Receive interrupt at 1/4 Full
101
#define UART_FIFO_RX4_8         0x00000010  // Receive interrupt at 1/2 Full
102
#define UART_FIFO_RX6_8         0x00000018  // Receive interrupt at 3/4 Full
103
#define UART_FIFO_RX7_8         0x00000020  // Receive interrupt at 7/8 Full
104
 
105
//*****************************************************************************
106
//
107
// Values that can be passed to UARTDMAEnable() and UARTDMADisable().
108
//
109
//*****************************************************************************
110
#define UART_DMA_ERR_RXSTOP     0x00000004  // Stop DMA receive if UART error
111
#define UART_DMA_TX             0x00000002  // Enable DMA for transmit
112
#define UART_DMA_RX             0x00000001  // Enable DMA for receive
113
 
114
//*****************************************************************************
115
//
116
// API Function prototypes
117
//
118
//*****************************************************************************
119
extern void UARTParityModeSet(unsigned long ulBase, unsigned long ulParity);
120
extern unsigned long UARTParityModeGet(unsigned long ulBase);
121
extern void UARTFIFOLevelSet(unsigned long ulBase, unsigned long ulTxLevel,
122
                             unsigned long ulRxLevel);
123
extern void UARTFIFOLevelGet(unsigned long ulBase, unsigned long *pulTxLevel,
124
                             unsigned long *pulRxLevel);
125
extern void UARTConfigSetExpClk(unsigned long ulBase, unsigned long ulUARTClk,
126
                                unsigned long ulBaud, unsigned long ulConfig);
127
extern void UARTConfigGetExpClk(unsigned long ulBase, unsigned long ulUARTClk,
128
                                unsigned long *pulBaud,
129
                                unsigned long *pulConfig);
130
extern void UARTEnable(unsigned long ulBase);
131
extern void UARTDisable(unsigned long ulBase);
132
extern void UARTEnableSIR(unsigned long ulBase, tBoolean bLowPower);
133
extern void UARTDisableSIR(unsigned long ulBase);
134
extern tBoolean UARTCharsAvail(unsigned long ulBase);
135
extern tBoolean UARTSpaceAvail(unsigned long ulBase);
136
extern long UARTCharGetNonBlocking(unsigned long ulBase);
137
extern long UARTCharGet(unsigned long ulBase);
138
extern tBoolean UARTCharPutNonBlocking(unsigned long ulBase,
139
                                       unsigned char ucData);
140
extern void UARTCharPut(unsigned long ulBase, unsigned char ucData);
141
extern void UARTBreakCtl(unsigned long ulBase, tBoolean bBreakState);
142
extern void UARTIntRegister(unsigned long ulBase, void(*pfnHandler)(void));
143
extern void UARTIntUnregister(unsigned long ulBase);
144
extern void UARTIntEnable(unsigned long ulBase, unsigned long ulIntFlags);
145
extern void UARTIntDisable(unsigned long ulBase, unsigned long ulIntFlags);
146
extern unsigned long UARTIntStatus(unsigned long ulBase, tBoolean bMasked);
147
extern void UARTIntClear(unsigned long ulBase, unsigned long ulIntFlags);
148
extern void UARTDMAEnable(unsigned long ulBase, unsigned long ulDMAFlags);
149
extern void UARTDMADisable(unsigned long ulBase, unsigned long ulDMAFlags);
150
 
151
//*****************************************************************************
152
//
153
// Several UART APIs have been renamed, with the original function name being
154
// deprecated.  These defines provide backward compatibility.
155
//
156
//*****************************************************************************
157
#ifndef DEPRECATED
158
#include "sysctl.h"
159
#define UARTConfigSet(a, b, c)                         \
160
        UARTConfigSetExpClk(a, SysCtlClockGet(), b, c)
161
#define UARTConfigGet(a, b, c)                         \
162
        UARTConfigGetExpClk(a, SysCtlClockGet(), b, c)
163
#define UARTCharNonBlockingGet(a) \
164
        UARTCharGetNonBlocking(a)
165
#define UARTCharNonBlockingPut(a, b) \
166
        UARTCharPutNonBlocking(a, b)
167
#endif
168
 
169
//*****************************************************************************
170
//
171
// Mark the end of the C bindings section for C++ compilers.
172
//
173
//*****************************************************************************
174
#ifdef __cplusplus
175
}
176
#endif
177
 
178
#endif //  __UART_H__

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.