OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [devs/] [serial/] [arm/] [integrator/] [v2_0/] [src/] [integrator_serial.h] - Blame information for rev 27

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

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_ARM_INTEGRATOR_SERIAL_H
2
#define CYGONCE_ARM_INTEGRATOR_SERIAL_H
3
 
4
// ====================================================================
5
//
6
//      integrator_serial.h
7
//
8
//      Device I/O - Description of ARM INTEGRATOR serial hardware
9
//
10
// ====================================================================
11
//####ECOSGPLCOPYRIGHTBEGIN####
12
// -------------------------------------------
13
// This file is part of eCos, the Embedded Configurable Operating System.
14
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
15
//
16
// eCos is free software; you can redistribute it and/or modify it under
17
// the terms of the GNU General Public License as published by the Free
18
// Software Foundation; either version 2 or (at your option) any later version.
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23
// for more details.
24
//
25
// You should have received a copy of the GNU General Public License along
26
// with eCos; if not, write to the Free Software Foundation, Inc.,
27
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28
//
29
// As a special exception, if other files instantiate templates or use macros
30
// or inline functions from this file, or you compile this file and link it
31
// with other works to produce a work based on this file, this file does not
32
// by itself cause the resulting work to be covered by the GNU General Public
33
// License. However the source code for this file must still be made available
34
// in accordance with section (3) of the GNU General Public License.
35
//
36
// This exception does not invalidate any other reasons why a work based on
37
// this file might be covered by the GNU General Public License.
38
//
39
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
40
// at http://sources.redhat.com/ecos/ecos-license/
41
// -------------------------------------------
42
//####ECOSGPLCOPYRIGHTEND####
43
// ====================================================================
44
//#####DESCRIPTIONBEGIN####
45
//
46
// Author(s):           David A Rusling
47
// Contributors:        Philippe Robin
48
// Date:                November 7, 2000
49
// Purpose:             Internal interfaces for serial I/O drivers
50
// Description:
51
//
52
//####DESCRIPTIONEND####
53
//
54
// ====================================================================
55
 
56
// Description of serial ports on ARM INTEGRATOR7T
57
 
58
struct serial_port {
59
    unsigned char _byte[32];
60
};
61
 
62
// Little-endian version
63
#if (CYG_BYTEORDER == CYG_LSBFIRST)
64
 
65
#define reg(n) _byte[n*4]
66
 
67
#else // Big-endian version
68
 
69
#define reg(n) _byte[(n*4)^3]
70
 
71
#endif
72
 
73
/* -------------------------------------------------------------------------------
74
 *  From AMBA UART (PL010) Block Specification (ARM-0001-CUST-DSPC-A03)
75
 * -------------------------------------------------------------------------------
76
 *  UART Register Offsets.
77
 *
78
 */
79
#define AMBA_UARTDR                     0x00     /*  Data read or written from the interface. */
80
#define AMBA_UARTRSR                    0x04     /*  Receive status register (Read). */
81
#define AMBA_UARTECR                    0x04     /*  Error clear register (Write). */
82
#define AMBA_UARTLCR_H                  0x08     /*  Line control register, high byte. */
83
#define AMBA_UARTLCR_M                  0x0C     /*  Line control register, middle byte. */
84
#define AMBA_UARTLCR_L                  0x10     /*  Line control register, low byte. */
85
#define AMBA_UARTCR                     0x14     /*  Control register. */
86
#define AMBA_UARTFR                     0x18     /*  Flag register (Read only). */
87
#define AMBA_UARTIIR                    0x1C     /*  Interrupt indentification register (Read). */
88
#define AMBA_UARTICR                    0x1C     /*  Interrupt clear register (Write). */
89
#define AMBA_UARTILPR                   0x20     /*  IrDA low power counter register. */
90
 
91
#define AMBA_UARTRSR_OE                 0x08
92
#define AMBA_UARTRSR_BE                 0x04
93
#define AMBA_UARTRSR_PE                 0x02
94
#define AMBA_UARTRSR_FE                 0x01
95
 
96
#define AMBA_UARTFR_TXFF                0x20
97
#define AMBA_UARTFR_RXFE                0x10
98
#define AMBA_UARTFR_BUSY                0x08
99
#define AMBA_UARTFR_TMSK                (AMBA_UARTFR_TXFF + AMBA_UARTFR_BUSY)
100
 
101
#define AMBA_UARTCR_RTIE                0x40
102
#define AMBA_UARTCR_TIE                 0x20
103
#define AMBA_UARTCR_RIE                 0x10
104
#define AMBA_UARTCR_MSIE                0x08
105
#define AMBA_UARTCR_IIRLP               0x04
106
#define AMBA_UARTCR_SIREN               0x02
107
#define AMBA_UARTCR_UARTEN              0x01
108
 
109
#define AMBA_UARTLCR_H_WLEN_8           0x60
110
#define AMBA_UARTLCR_H_WLEN_7           0x40
111
#define AMBA_UARTLCR_H_WLEN_6           0x20
112
#define AMBA_UARTLCR_H_WLEN_5           0x00
113
#define AMBA_UARTLCR_H_FEN              0x10
114
#define AMBA_UARTLCR_H_STP2             0x08
115
#define AMBA_UARTLCR_H_EPS              0x04
116
#define AMBA_UARTLCR_H_PEN              0x02
117
#define AMBA_UARTLCR_H_BRK              0x01
118
 
119
#define AMBA_UARTIIR_RTIS               0x08
120
#define AMBA_UARTIIR_TIS                0x04
121
#define AMBA_UARTIIR_RIS                0x02
122
#define AMBA_UARTIIR_MIS                0x01
123
 
124
#define ARM_BAUD_460800                 1
125
#define ARM_BAUD_230400                 3
126
#define ARM_BAUD_115200                 7
127
#define ARM_BAUD_57600                  15
128
#define ARM_BAUD_38400                  23
129
#define ARM_BAUD_19200                  47
130
#define ARM_BAUD_14400                  63
131
#define ARM_BAUD_9600                   95
132
#define ARM_BAUD_4800                   191
133
#define ARM_BAUD_2400                   383
134
#define ARM_BAUD_1200                   767
135
 
136
// Interrupt Enable Register
137
#define IER_RCV 0x01
138
#define IER_XMT 0x02
139
#define IER_LS  0x04
140
#define IER_MS  0x08
141
 
142
// Line Control Register
143
#define LCR_WL5 0x00    // Word length
144
#define LCR_WL6 0x20
145
#define LCR_WL7 0x40
146
#define LCR_WL8 0x60
147
 
148
#define LCR_SB1 0x00    // Number of stop bits
149
#define LCR_SB1_5 0x00  // 1.5 -> only valid with 5 bit words
150
#define LCR_SB2 0x08
151
 
152
#define LCR_PN  0x00    // Parity mode - none
153
#define LCR_PE  0x06    // Parity mode - even
154
#define LCR_PO  0x02    // Parity mode - odd
155
#define LCR_PM  0x00    // Forced "mark" parity
156
#define LCR_PS  0x00    // Forced "space" parity
157
 
158
// Line Status Register
159
#define LSR_RSR 0x01
160
#define LSR_THE 0x20
161
 
162
// Modem Control Register
163
#define MCR_DTR 0x01
164
#define MCR_RTS 0x02
165
#define MCR_INT 0x08   // Enable interrupts
166
 
167
static unsigned short select_baud[] = {
168
    0,               // Unused
169
    0,               // 50
170
    0,               // 75
171
    0,               // 110
172
    0,               // 134.5
173
    0,               // 150
174
    0,               // 200
175
    0,               // 300
176
    0,               // 600
177
    ARM_BAUD_1200,   // 1200
178
    0,               // 1800
179
    ARM_BAUD_2400,   // 2400
180
    0,               // 3600
181
    ARM_BAUD_4800,   // 4800
182
    0,               // 7200
183
    ARM_BAUD_9600,   // 9600
184
    ARM_BAUD_14400,  // 14400
185
    ARM_BAUD_19200,  // 19200
186
    ARM_BAUD_38400,  // 38400
187
    ARM_BAUD_57600,  // 57600
188
    ARM_BAUD_115200, // 115200
189
    ARM_BAUD_230400, // 230400
190
};
191
 
192
static unsigned char select_word_length[] = {
193
    LCR_WL5,    // 5 bits / word (char)
194
    LCR_WL6,
195
    LCR_WL7,
196
    LCR_WL8
197
};
198
 
199
static unsigned char select_stop_bits[] = {
200
    0,
201
    LCR_SB1,    // 1 stop bit
202
    LCR_SB1_5,  // 1.5 stop bit
203
    LCR_SB2     // 2 stop bits
204
};
205
 
206
static unsigned char select_parity[] = {
207
    LCR_PN,     // No parity
208
    LCR_PE,     // Even parity
209
    LCR_PO,     // Odd parity
210
    LCR_PM,     // Mark parity
211
    LCR_PS,     // Space parity
212
};
213
 
214
#endif // CYGONCE_ARM_INTEGRATOR_SERIAL_H

powered by: WebSVN 2.1.0

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