1 |
786 |
skrzyp |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// gps4020.h
|
4 |
|
|
//
|
5 |
|
|
// GPS-4020 Platform specific registers, etc
|
6 |
|
|
//
|
7 |
|
|
//==========================================================================
|
8 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
9 |
|
|
// -------------------------------------------
|
10 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
11 |
|
|
// Copyright (C) 2003 Free Software Foundation, Inc.
|
12 |
|
|
//
|
13 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
14 |
|
|
// the terms of the GNU General Public License as published by the Free
|
15 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
16 |
|
|
// version.
|
17 |
|
|
//
|
18 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
19 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
20 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
21 |
|
|
// for more details.
|
22 |
|
|
//
|
23 |
|
|
// You should have received a copy of the GNU General Public License
|
24 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
25 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
|
|
//
|
27 |
|
|
// As a special exception, if other files instantiate templates or use
|
28 |
|
|
// macros or inline functions from this file, or you compile this file
|
29 |
|
|
// and link it with other works to produce a work based on this file,
|
30 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
31 |
|
|
// the GNU General Public License. However the source code for this file
|
32 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
33 |
|
|
// General Public License v2.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based
|
36 |
|
|
// on this file might be covered by the GNU General Public License.
|
37 |
|
|
// -------------------------------------------
|
38 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
39 |
|
|
//==========================================================================
|
40 |
|
|
//#####DESCRIPTIONBEGIN####
|
41 |
|
|
//
|
42 |
|
|
// Author(s): gthomas
|
43 |
|
|
// Contributors: gthomas
|
44 |
|
|
// Date: 2003-10-01
|
45 |
|
|
// Purpose: Platform specific registers, etc
|
46 |
|
|
// Description:
|
47 |
|
|
//
|
48 |
|
|
//####DESCRIPTIONEND####
|
49 |
|
|
//
|
50 |
|
|
//========================================================================*/
|
51 |
|
|
|
52 |
|
|
#ifndef _GPS4020_H_
|
53 |
|
|
#define _GPS4020_H_
|
54 |
|
|
|
55 |
|
|
#define GPS4020_WATCHDOG 0xE0004000
|
56 |
|
|
#define GPS4020_INTC 0xE0006000
|
57 |
|
|
#define GPS4020_TC1 0xE000E000
|
58 |
|
|
#define GPS4020_TC2 0xE000F000
|
59 |
|
|
#define GPS4020_UART1 0xE0018000
|
60 |
|
|
#define GPS4020_UART2 0xE0019000
|
61 |
|
|
|
62 |
|
|
#ifndef __ASSEMBLER__
|
63 |
|
|
struct _gps4020_watchdog {
|
64 |
|
|
unsigned long control;
|
65 |
|
|
unsigned long period;
|
66 |
|
|
unsigned long current; // Only accessible in TEST mode
|
67 |
|
|
unsigned long reset;
|
68 |
|
|
};
|
69 |
|
|
#endif
|
70 |
|
|
#define GPS4020_WATCHDOG_RESET 0xECD9F7BD
|
71 |
|
|
|
72 |
|
|
#ifndef __ASSEMBLER__
|
73 |
|
|
struct _gps4020_uart {
|
74 |
|
|
unsigned char control;
|
75 |
|
|
unsigned char _fill0[3];
|
76 |
|
|
unsigned char mode;
|
77 |
|
|
unsigned char _fill1[3];
|
78 |
|
|
unsigned char baud;
|
79 |
|
|
unsigned char _fill2[3];
|
80 |
|
|
unsigned char status;
|
81 |
|
|
unsigned char _fill3[3];
|
82 |
|
|
unsigned char TxRx;
|
83 |
|
|
unsigned char _fill4[3];
|
84 |
|
|
unsigned char modem_control;
|
85 |
|
|
unsigned char _fill5[3+8];
|
86 |
|
|
unsigned char modem_status;
|
87 |
|
|
unsigned char _fill6[3];
|
88 |
|
|
};
|
89 |
|
|
#endif
|
90 |
|
|
|
91 |
|
|
// Serial control
|
92 |
|
|
#define SCR_MIE 0x80 // Modem interrupt enable
|
93 |
|
|
#define SCR_EIE 0x40 // Error interrupt enable
|
94 |
|
|
#define SCR_TIE 0x20 // Transmit interrupt enable
|
95 |
|
|
#define SCR_RIE 0x10 // Receive interrupt enable
|
96 |
|
|
#define SCR_FCT 0x08 // Flow type 0=>software, 1=>hardware
|
97 |
|
|
#define SCR_CLK 0x04 // Clock source 0=internal, 1=external
|
98 |
|
|
#define SCR_TEN 0x02 // Transmitter enabled
|
99 |
|
|
#define SCR_REN 0x01 // Receiver enabled
|
100 |
|
|
// Serial mode
|
101 |
|
|
#define SMR_DIV(x) ((x)<<4) // Clock divisor
|
102 |
|
|
#define SMR_STOP 0x08 // Stop bits 0=>one, 1=>two
|
103 |
|
|
#define SMR_STOP_1 0x00
|
104 |
|
|
#define SMR_STOP_2 0x08
|
105 |
|
|
#define SMR_PARITY 0x04 // Parity mode 0=>even, 1=odd
|
106 |
|
|
#define SMR_PARITY_EVEN 0x00
|
107 |
|
|
#define SMR_PARITY_ODD 0x04
|
108 |
|
|
#define SMR_PARITY_ON 0x02 // Parity checked
|
109 |
|
|
#define SMR_PARITY_OFF 0x00
|
110 |
|
|
#define SMR_LENGTH 0x01 // Character length
|
111 |
|
|
#define SMR_LENGTH_8 0x00
|
112 |
|
|
#define SMR_LENGTH_7 0x01
|
113 |
|
|
// Serial status
|
114 |
|
|
#define SSR_MSS 0x80 // Modem status has changed
|
115 |
|
|
#define SSR_OE 0x40 // Overrun error
|
116 |
|
|
#define SSR_FE 0x20 // Framing error
|
117 |
|
|
#define SSR_PE 0x10 // Parity error
|
118 |
|
|
#define SSR_TxActive 0x08 // Transmitter is active
|
119 |
|
|
#define SSR_RxActive 0x04 // Receiver is active
|
120 |
|
|
#define SSR_TxEmpty 0x02 // Tx buffer is empty
|
121 |
|
|
#define SSR_RxFull 0x01 // Rx buffer contains data
|
122 |
|
|
// Modem control
|
123 |
|
|
#define SMR_CFG 0x08 // Configuration 0=>normal, 1=>null
|
124 |
|
|
#define SMR_MSU 0x04 // Modem status update 1=>enable
|
125 |
|
|
#define SMR_DTR 0x02 // Assert DTR
|
126 |
|
|
#define SMR_RTS 0x01 // Assert RTS
|
127 |
|
|
|
128 |
|
|
#ifndef __ASSEMBLER__
|
129 |
|
|
struct _gps4020_timer {
|
130 |
|
|
struct {
|
131 |
|
|
unsigned long control;
|
132 |
|
|
unsigned long reload;
|
133 |
|
|
unsigned long current;
|
134 |
|
|
unsigned long _reserved[5];
|
135 |
|
|
} tc[2];
|
136 |
|
|
};
|
137 |
|
|
#endif
|
138 |
|
|
|
139 |
|
|
// Timer/counter control
|
140 |
|
|
#define TC_CTL_IE (1<<22) // Interrupt enable
|
141 |
|
|
#define TC_CTL_OS (1<<21) // Overflow (count through 0)
|
142 |
|
|
#define TC_CTL_MODE (3<<19) // Timer/counter mode
|
143 |
|
|
#define TC_CTL_MODE_HALT (0<<19)
|
144 |
|
|
#define TC_CTL_MODE_FREE (1<<19)
|
145 |
|
|
#define TC_CTL_MODE_RELOAD (2<<19)
|
146 |
|
|
#define TC_CTL_MODE_PWM (3<<19)
|
147 |
|
|
#define TC_CTL_SCR (1<<18) // Software control request
|
148 |
|
|
#define TC_CTL_SCR_HALT (0<<18)
|
149 |
|
|
#define TC_CTL_SCR_COUNT (1<<18)
|
150 |
|
|
#define TC_CTL_HEP (1<<17) // Hardware enable polarity
|
151 |
|
|
#define TC_CTL_STAT (1<<16) // Current status
|
152 |
|
|
|
153 |
|
|
#define TC_CLOCK_BASE 20 // Assumes 20MHz system clock
|
154 |
|
|
|
155 |
|
|
#ifndef __ASSEMBLER__
|
156 |
|
|
struct _gps4020_intc {
|
157 |
|
|
unsigned long sources; // Active interrupt sources
|
158 |
|
|
unsigned long polarity; // 0=>active low
|
159 |
|
|
unsigned long active;
|
160 |
|
|
unsigned long trigger; // 0=>level, 1=>edge
|
161 |
|
|
unsigned long reset; // reset edge triggers
|
162 |
|
|
unsigned long enable; // 1=>enable
|
163 |
|
|
unsigned long status; // masked (active and enabled)
|
164 |
|
|
unsigned long type; // 0=>IRQ, 1=>FIQ
|
165 |
|
|
unsigned long FIQ_status;
|
166 |
|
|
unsigned long IRQ_status;
|
167 |
|
|
unsigned long FIQ_encoded;
|
168 |
|
|
unsigned long IRQ_encoded;
|
169 |
|
|
};
|
170 |
|
|
#endif
|
171 |
|
|
|
172 |
|
|
#ifndef __ASSEMBLER__
|
173 |
|
|
externC void _gps4020_watchdog(bool is_idle);
|
174 |
|
|
#endif
|
175 |
|
|
#endif // _GPS4020_H_
|