source: rtems/c/src/lib/libcpu/arm/at91rm9200/include/at91rm9200.h @ 4e545aaa

4.104.115
Last change on this file since 4e545aaa was 4e545aaa, checked in by Joel Sherrill <joel.sherrill@…>, on Nov 30, 2009 at 10:13:03 PM

2009-11-30 Fernando Nicodemos <fgnicodemos@…>

  • at91rm9200/include/at91rm9200.h: Update to match development version.
  • Property mode set to 100644
File size: 16.7 KB
Line 
1/*
2 * Atmel AT91RM9200 Register definitions, used in KIT637_V6 (CSB637)
3 *
4 * Copyright (c) 2003 by Cogent Computer Systems
5 * Written by Mike Kelly <mike@cogcomp.com>
6 *
7 * Modified by Fernando Nicodemos <fgnicodemos@terra.com.br>
8 * from NCB - Sistemas Embarcados Ltda. (Brazil)
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *
13 *  http://www.rtems.com/license/LICENSE.
14 *
15 *  $Id$
16*/
17
18
19#ifndef __AT91RM9200_H__
20#define __AT91RM9200_H__
21
22#include "bits.h"
23
24typedef volatile unsigned long vulong;
25
26/* Source Mode Register - 32 of them */
27#define AIC_SMR_BASE            0xFFFFF000
28#define AIC_SMR_REG(_x_)        *(vulong *)(AIC_SMR_BASE + (_x_ & 0x7c))
29
30/* Source Vector Register - 32 of them */
31#define AIC_SVR_BASE            0xFFFFF080
32#define AIC_SVR_REG(_x_)        *(vulong *)(AIC_SVR_BASE + (_x_ & 0x7c))
33
34/* Control Register - 32 of them */
35#define AIC_CTL_BASE            0xFFFFF100
36#define AIC_CTL_REG(_x_)        *(vulong *)(AIC_CTL_BASE + (_x_ & 0x7f))
37
38/* Register Offsets */
39/* offsets from AIC_SMR_BASE and AIC_SVR_BASE */
40#define AIC_SMR_FIQ             0x00    /* Advanced Interrupt Controller FIQ */
41#define AIC_SMR_SYSIRQ          0x04    /* Advanced Interrupt Controller SYSIRQ */
42#define AIC_SMR_PIOA            0x08    /* Parallel I/O Controller A */
43#define AIC_SMR_PIOB            0x0c    /* Parallel I/O Controller B */
44#define AIC_SMR_PIOC            0x10    /* Parallel I/O Controller C */
45#define AIC_SMR_PIOD            0x14    /* Parallel I/O Controller D */
46#define AIC_SMR_US0             0x18    /* USART 0 */
47#define AIC_SMR_US1             0x1c    /* USART 1 */
48#define AIC_SMR_US2             0x20    /* USART 2 */
49#define AIC_SMR_US3             0x24    /* USART 3 */
50#define AIC_SMR_MCI             0x28    /* Multimedia Card Interface */
51#define AIC_SMR_UDP             0x2c    /* USB Device Port */
52#define AIC_SMR_TWI             0x30    /* Two-wire Interface */
53#define AIC_SMR_SPI             0x34    /* Serial Peripheral Interface */
54#define AIC_SMR_SSC0            0x38    /* Synchronous Serial Controller 0 */
55#define AIC_SMR_SSC1            0x3c    /* Synchronous Serial Controller 1 */
56#define AIC_SMR_SSC2            0x40    /* Synchronous Serial Controller 2 */
57#define AIC_SMR_TC0             0x44    /* Timer/Counter 0 */
58#define AIC_SMR_TC1             0x48    /* Timer/Counter 1 */
59#define AIC_SMR_TC2             0x4c    /* Timer/Counter 2 */
60#define AIC_SMR_TC3             0x50    /* Timer/Counter 3 */
61#define AIC_SMR_TC4             0x54    /* Timer/Counter 4 */
62#define AIC_SMR_TC5             0x58    /* Timer/Counter 5 */
63#define AIC_SMR_UHP             0x5c    /* USB Host Port */
64#define AIC_SMR_EMAC            0x60    /* Ethernet MAC */
65#define AIC_SMR_IRQ0            0x64    /* Advanced Interrupt Controller IRQ0 */
66#define AIC_SMR_IRQ1            0x68    /* Advanced Interrupt Controller IRQ1 */
67#define AIC_SMR_IRQ2            0x6c    /* Advanced Interrupt Controller IRQ2 */
68#define AIC_SMR_IRQ3            0x70    /* Advanced Interrupt Controller IRQ3 */
69#define AIC_SMR_IRQ4            0x74    /* Advanced Interrupt Controller IRQ4 */
70#define AIC_SMR_IRQ5            0x78    /* Advanced Interrupt Controller IRQ5 */
71#define AIC_SMR_IRQ6            0x7c    /* Advanced Interrupt Controller IRQ6 */
72
73/* from AIC_CTL_BASE */
74#define AIC_IVR                 0x00    /* IRQ Vector Register */
75#define AIC_FVR                 0x04    /* FIQ Vector Register */
76#define AIC_ISR                 0x08    /* Interrupt Status Register */
77#define AIC_IPR                 0x0C    /* Interrupt Pending Register */
78#define AIC_IMR                 0x10    /* Interrupt Mask Register */
79#define AIC_CISR                0x14    /* Core Interrupt Status Register */
80#define AIC_IECR                0x20    /* Interrupt Enable Command Register */
81#define AIC_IDCR                0x24    /* Interrupt Disable Command Register */
82#define AIC_ICCR                0x28    /* Interrupt Clear Command Register */
83#define AIC_ISCR                0x2C    /* Interrupt Set Command Register */
84#define AIC_EOICR               0x30    /* End of Interrupt Command Register */
85#define AIC_SPU                 0x34    /* Spurious Vector Register */
86#define AIC_DCR                 0x38    /* Debug Control Register (Protect) */
87#define AIC_FFER                0x40    /* Fast Forcing Enable Register */
88#define AIC_FFDR                0x44    /* Fast Forcing Disable Register */
89#define AIC_FFSR                0x48    /* Fast Forcing Status Register */
90
91/* Bit Defines */
92/* AIC_ISR - Interrupt Status Register */
93#define AIC_ISR_IRQID_MASK      0x1f    /* current interrupt ID          */
94
95/* AIC_CISR - Core Interrupt Status Register */
96#define AIC_CISR_IRQ            BIT1    /* 1 = Core IRQ is active */
97#define AIC_CISR_FIQ            BIT0    /* 1 = Core FIQ is active */
98
99/* AIC_DCR - Debug Control Register (Protect) */
100#define AIC_DCR_GMSK            BIT1    /* 0 = AIC controls IRQ and FIQ */
101#define AIC_DCR_PROT            BIT0    /* 1 = enable protection mode */
102
103/* AIC_SMR */
104#define AIC_SMR_PRIOR(_x_)      ((_x_ & 0x07) << 0)
105#define AIC_SMR_SRC_LVL_LOW     (0 << 5)        /* Are these right? docs don't say which is high/low     */
106#define AIC_SMR_SRC_EDGE_LOW    (1 << 5)
107#define AIC_SMR_SRC_LVL_HI      (2 << 5)
108#define AIC_SMR_SRC_EDGE_HI     (3 << 5)
109
110/**************************************************************************/
111/* Debug Unit                                                             */
112/**************************************************************************/
113#define DBGU_BASE               0xFFFFF200
114#define DBGU_REG(_x_)   *(vulong *)(DBGU_BASE + _x_)
115
116/* Register Offsets */
117#define DBGU_CR                 0x00    /* Control Register */
118#define DBGU_MR                 0x04    /* Mode Register */
119#define DBGU_IER                0x08    /* Interrupt Enable Register */
120#define DBGU_IDR                0x0C    /* Interrupt Disable Register */
121#define DBGU_IMR                0x10    /* Interrupt Mask Register */
122#define DBGU_CSR                0x14    /* Channel Status Register */
123#define DBGU_RHR                0x18    /* Receiver Holding Register */
124#define DBGU_THR                0x1C    /* Transmitter Holding Register */
125#define DBGU_BRGR               0x20    /* Baud Rate Generator Register */
126#define DBGU_C1R                0x40    /* Chip ID1 Register */
127#define DBGU_C2R                0x44    /* Chip ID2 Register */
128#define DBGU_FNTR               0x48    /* Force NTRST Register */
129
130/**************************************************************************/
131/* USART 0-3                                                              */
132/**************************************************************************/
133#define USART0_BASE             0xFFFC0000
134#define USART1_BASE             0xFFFC4000
135#define USART2_BASE             0xFFFC8000
136#define USART3_BASE             0xFFFCC000
137/*
138 *  WARNING: The USART3_BASE at the AT91RM9200 Manual is wrong!!!
139 *  Manual revision: Rev. 1768H-ATARM–16-Jun-09
140 *  USART3_BASE is NOT 0xFFECC000
141 */
142
143/****************/
144/* System Timer */
145/****************/
146#define ST_BASE                 0xFFFFFD00
147#define ST_REG(_x_)             *(vulong *)(ST_BASE + _x_)
148
149/* Register Offsets */
150#define ST_CR                   0x00    /* Control Register */
151#define ST_PIMR                 0x04    /* Period Interval Mode Register */
152#define ST_WDMR                 0x08    /* Watchdog Mode Register */
153#define ST_RTMR                 0x0C    /* Real-time Mode Register */
154#define ST_SR                   0x10    /* Status Register */
155#define ST_IER                  0x14    /* Interrupt Enable Register */
156#define ST_IDR                  0x18    /* Interrupt Disable Register */
157#define ST_IMR                  0x1C    /* Interrupt Mask Register */
158#define ST_RTAR                 0x20    /* Real-time Alarm Register */
159#define ST_CRTR                 0x24    /* Current Real-time Register */
160
161/* Bit Defines */
162/* ST_CR - Control Register */
163#define ST_CR_WDRST                     BIT0    /* write 1 to reload WD counter  */
164
165/* ST_PIMR - Period Interval Mode Register */
166#define ST_PIMR_PIV_MASK        0x0000ffff
167
168/* ST_WDMR - Watchdog Mode Register */
169#define ST_WDMR_EXTEN           BIT17   /* WDOVF is not implemented on AT91RM9200 */
170#define ST_WDMR_RSTEN           BIT16   /* 1 = reset the AT91RM9200 when WD overflows */
171#define ST_WDMR_WDV_MASK        0x0000ffff      /* WD counter is in the lower 16-bits */
172
173/* ST_RTMR - Real-time Mode Register */
174#define ST_RTMR_RTPRES_MASK     0x0000ffff      /* Real-Time Prescaler */
175
176/* ST_SR - Status Register - Read Only */
177/* ST_IER - Interrupt Enable Register - Write Only */
178/* ST_IDR - Interrupt Disable Register - Write Only */
179/* ST_IMR - Interrupt Mask Register - Read Only */
180#define ST_SR_ALMS                      BIT3
181#define ST_SR_RTTINC            BIT2
182#define ST_SR_WDOVF                     BIT1
183#define ST_SR_PITS                      BIT0
184
185/* ST_RTAR - Real-time Alarm Register */
186#define ST_RTAR_ALMV_MASK       0x000fffff
187
188/* ST_CRTR - Current Real-time Register */
189#define ST_CRTR_CRTV_MASK       0x000fffff
190
191
192/**************************************************************************
193 * Peripheral Data Control (DMA)
194 * Note that each of the following peripherals has it's own
195 * set of these registers starting at offset 0x100 from it's
196 * base address: DBGU, SPI, USART and SSC
197 * To access the DMA for a peripheral, use the macro for that
198 * peripheral but with these register offsets
199 **************************************************************************/
200/* Register Offsets */
201#define PDC_RPR         0x100   /* Receive Pointer Register */
202#define PDC_RCR         0x104   /* Receive Counter Register */
203#define PDC_TPR         0x108   /* Transmit Pointer Register */
204#define PDC_TCR         0x10c   /* Transmit Counter Register */
205#define PDC_RNPR        0x110   /* Receive Next Pointer Register */
206#define PDC_RNCR        0x114   /* Receive Next Counter Register */
207#define PDC_TNPR        0x118   /* Transmit Next Pointer Register */
208#define PDC_TNCR        0x11c   /* Transmit Next Counter Register */
209#define PDC_PTCR        0x120   /* PDC Transfer Control Register */
210#define PDC_PTSR        0x124   /* PDC Transfer Status Register */
211
212/**************************************************************************
213 * Parallel I/O Unit
214 * There are four PIO blocks - A, B, C and D.  They all have the
215 * same register set, but different base addresses
216 **************************************************************************/
217/* Port A */
218#define PIOA_BASE               0xFFFFF400
219#define PIOA_REG(_x_)   *(vulong *)(PIOA_BASE + _x_)
220
221/* Port B */
222#define PIOB_BASE               0xFFFFF600
223#define PIOB_REG(_x_)   *(vulong *)(PIOB_BASE + _x_)
224
225/* Port C */
226#define PIOC_BASE               0xFFFFF800
227#define PIOC_REG(_x_)   *(vulong *)(PIOC_BASE + _x_)
228
229/* Port D */
230#define PIOD_BASE               0xFFFFFA00
231#define PIOD_REG(_x_)   *(vulong *)(PIOD_BASE + _x_)
232
233/**************************************************************************
234 * Power Management and Clock Control
235 *************************************************************************/
236#define PMC_BASE                0xFFFFFC00
237#define PMC_REG(_x_)    *(vulong *)(PMC_BASE + _x_)
238
239/**************************************************************************
240 * MAC Unit
241 *************************************************************************/
242#define EMAC_BASE               0xFFFBC000
243#define EMAC_REG(_x_)   *(vulong *)(EMAC_BASE + _x_)
244
245/**************************************************************************
246 * Timer/Counter Unit
247 **************************************************************************/
248#define TC_BASE         0xFFFA0000
249#define TC_REG(_x_)     *(vulong *)(TC_BASE + 0x00 + _x_)
250#define TC_TC0_REG(_x_) *(vulong *)(TC_BASE + 0x00 + _x_)
251#define TC_TC1_REG(_x_) *(vulong *)(TC_BASE + 0x40 + _x_)
252#define TC_TC2_REG(_x_) *(vulong *)(TC_BASE + 0x80 + _x_)
253
254/* Offsets from TC_TC?_REG  */
255#define TC_CCR      0x00    /* Channel Control Register  */
256#define TC_CMR      0x04    /* Channel Mode Register  */
257#define TC_CV       0x10    /* Counter Value  */
258#define TC_RA       0x14    /* Register A  */
259#define TC_RB       0x18    /* Register B  */
260#define TC_RC       0x1C    /* Register C  */
261#define TC_SR       0x20    /* Status Register  */
262#define TC_IER      0x24    /* Interrupt Enable Register  */
263#define TC_IDR      0x28    /* Interrupt Disable Register  */
264#define TC_IMR      0x2C    /* Interrupt Mask Register  */
265
266/* Offsets from TC_BASE */
267#define TC_BCR      0xc0    /* Channel Control Register  */
268#define TC_BMR      0xc4    /* Channel Control Register  */
269
270/* Block control register */
271#define TC_BCR_SYNC    BIT1       /* Set to syncronize channels */
272
273/* Block mode register */
274#define TC_BMR_TC0(_x_)    ((_x_ & 0x3) << 0)   /* TC0 clock source */
275#define TC_BMR_TC1(_x_)    ((_x_ & 0x3) << 2)   /* TC1 clock source */
276#define TC_BMR_TC2(_x_)    ((_x_ & 0x3) << 4)   /* TC2 clock source */
277
278/* Channel Control register */
279#define TC_CCR_CLKEN     BIT0       /* Enable clock */
280#define TC_CCR_CLKDIS    BIT1       /* Disable clock */
281#define TC_CCR_SWTRG     BIT2       /* Software trigger command */
282
283/* Channel mode register */
284#define TC_CMR_TCCLKS(_x_)   ((_x_ & 0x7) << 0)  /* Clock source */
285#define TC_CMR_CLKI          BIT3                /* Clock invert */
286#define TC_BURST(_x_)        ((_x_ & 0x3 << 4)   /* Burst signal selection */
287#define TC_WAVE              BIT15               /* 0 for catpure, 1 for wave */
288
289/* Channel mode register - capture mode (TC_WAVE = 0) */
290#define TC_CMR_LDBSTOP       BIT6                /* Set to stop clock when RB loads */
291#define TC_CMR_LDBDIS        BIT7                /* Set to disable clock when RB loads */
292#define TC_CMR_ETRGEDG(_x_)  ((_x_ & 0x3) << 8)  /* Select edge triggering mode */
293#define TC_CMR_ABETRG        BIT10               /* Select ext trigger source */
294#define TC_CMR_CPCTRG        BIT14               /* RC Compare trigger enable */
295#define TC_CMR_LDRA(_x_)     ((_x_ & 0x3) << 16) /* RA loading selection */
296#define TC_CMR_LDRB(_x_)     ((_x_ & 0x3) << 18) /* RB loading selection */
297
298/* Channel mode register - wave mode (TC_WAVE = 1) */
299#define TC_CMR_CPCSTOP       BIT6                 /* Clock stopped w/ RC compare */
300#define TC_CMR_CPCDIS        BIT7                 /* Clock disabled w/ RC compare */
301#define TC_CMR_EEVTEDG(_x_)  ((_x_ & 0x3) << 8)   /* Ext event edge selection */
302#define TC_CMR_EEVT(_x_)     ((_x_ & 0x3) << 10)  /* Ext event selection */
303#define TC_CMR_ENETRG        BIT12                /* Ext event trigger enable */
304#define TC_CMR_WAVESEL(_x_)  ((_x_ & 0x3) << 13)  /* Waveform selection */
305#define TC_CMR_ACPA(_x_)     ((_x_ & 0x3) << 16)  /* RA compare effect on TIOA */
306#define TC_CMR_ACPC(_x_)     ((_x_ & 0x3) << 18)  /* RC compare effect on TIOA */
307#define TC_CMR_AEEVT(_x_)    ((_x_ & 0x3) << 20)  /* Ext event effect on TIOA */
308#define TC_CMR_ASWTRG(_x_)   ((_x_ & 0x3) << 22)  /* SW trigger effect on TIOA */
309#define TC_CMR_BCPB(_x_)     ((_x_ & 0x3) << 24)  /* RB compare effect on TIOB */
310#define TC_CMR_BCPC(_x_)     ((_x_ & 0x3) << 26)  /* RC compare effect on TIOB */
311#define TC_CMR_BEEVT(_x_)    ((_x_ & 0x3) << 28)  /* Ext event effect on TIOB */
312#define TC_CMR_BSWTRG(_x_)   ((_x_ & 0x3) << 30)  /* SW trigger effect on TIOB */
313
314/* Counter value */
315#define TC_CV_MASK            0xffff              /* Timer counter mask */
316
317/* Status, Interrupt enable, Interrupt disable, and Interrupt mask registers */
318#define TC_SR_COVFS     BIT0        /* Counter overflow status */
319#define TC_SR_LOVRS     BIT1        /* Load overrun status */
320#define TC_SR_CPAS      BIT2        /* RA compare status */
321#define TC_SR_CPBS      BIT3        /* RB compare status */
322#define TC_SR_CPCS      BIT4        /* RC compare status */
323#define TC_SR_LDRAS     BIT5        /* RA loading status */
324#define TC_SR_LDRBS     BIT6        /* RB loading  status */
325#define TC_SR_ETRGS     BIT7        /* External trigger status */
326#define TC_SR_CLKSTA    BIT16       /* Clock enabling status */
327#define TC_SR_MTIOA     BIT17       /* TIOA Mirror */
328#define TC_SR_MTIOB     BIT18       /* TIOB Mirror */
329
330/***************************************************************************
331 * External Bus Interface Unit
332 **************************************************************************/
333#define EBI_BASE                        0xFFFFFF60
334#define EBI_REG(_x_)            *(vulong *)(EBI_BASE + _x_)
335
336/***************************************************************************
337 * Static Memory Interface Unit
338 ***************************************************************************/
339#define SMC_REG(_x_)            *(vulong *)(EBI_BASE + 0x10 + _x_)
340
341/**************************************************************************
342 * SDRAM Memory Interface Unit
343 **************************************************************************/
344#define SDRC_REG(_x_)           *(vulong *)(EBI_BASE + 0x30 + _x_)
345
346#endif /* __AT91RM9200_H__ */
347
Note: See TracBrowser for help on using the repository browser.