summaryrefslogtreecommitdiffstats
path: root/cpukit/score/cpu/bfin/rtems/bfin/bf52x.h
blob: 3c5bf7b3ef63dc0dd77b0242a01c78d2c0e9fc95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
/**
 *@file bf52x.h
 *
 *  This file defines basic MMR for the Blackfin 52x CPU.
 *  The MMR have been taken from the ADSP-BF52x Blackfin Processor
 *  Hardware Reference from Analog Devices. Mentioned Chapters
 *  refer to this Documentation.
 *
 *	Based on bf533.h
 *
 *  COPYRIGHT (c) 2006.
 *  Atos Automacao Industrial LTDA.
 *             modified by Alain Schaefer <alain.schaefer@easc.ch>
 *                     and Antonio Giovanini <antonio@atos.com.br>
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.com/license/LICENSE.
 *
 *
 * @author    Rohan Kangralkar, ECE Department Northeastern University
 * @date	  02/15/2011
 *
 * HISTORY:
 *
 */

#ifndef _RTEMS_BFIN_52x_H
#define _RTEMS_BFIN_52x_H

#include <rtems/bfin/bfin.h>

#ifdef __cplusplus
extern "C" {
#endif


/* Clock and System Control  Chapter 8 */
#define PLL_CTL                0xFFC00000L
#define PLL_DIV                0xFFC00004L
#define VR_CTL                 0xFFC00008L
#define PLL_STAT               0xFFC0000CL
#define PLL_LOCKCNT            0xFFC00010L
#define SWRST                  0xFFC00100L
#define SYSCR                  0xFFC00104L

/* SPI Controller           Chapter 10 */
#define SPI_CTL                0xFFC00500L
#define SPI_FLG                0xFFC00504L
#define SPI_STAT               0xFFC00508L
#define SPI_TDBR               0xFFC0050CL
#define SPI_RDBR               0xFFC00510L
#define SPI_BAUD               0xFFC00514L
#define SPI_SHADOW             0xFFC00518L

/* SPORT0 Controller */
#define SPORT0_TCR1            0xFFC00800L
#define SPORT0_TCR2            0xFFC00804L
#define SPORT0_TCLKDIV         0xFFC00808L
#define SPORT0_TFSDIV          0xFFC0080CL
#define SPORT0_TX              0xFFC00810L
#define SPORT0_RX              0xFFC00818L
#define SPORT0_RCR1            0xFFC00820L
#define SPORT0_RCR2            0xFFC00824L
#define SPORT0_RCLKDIV         0xFFC00828L
#define SPORT0_RFSDIV          0xFFC0082CL
#define SPORT0_STAT            0xFFC00830L
#define SPORT0_CHNL            0xFFC00834L
#define SPORT0_MCMC1           0xFFC00838L
#define SPORT0_MCMC2           0xFFC0083CL
#define SPORT0_MTCS0           0xFFC00840L
#define SPORT0_MTCS1           0xFFC00844L
#define SPORT0_MTCS2           0xFFC00848L
#define SPORT0_MTCS3           0xFFC0084CL
#define SPORT0_MRCS0           0xFFC00850L
#define SPORT0_MRCS1           0xFFC00854L
#define SPORT0_MRCS2           0xFFC00858L
#define SPORT0_MRCS3           0xFFC0085CL

/* Parallel Peripheral Interface (PPI) Chapter 11 */

#define PPI_CONTROL            0xFFC01000L
#define PPI_STATUS             0xFFC01004L
#define PPI_COUNT              0xFFC01008L
#define PPI_DELAY              0xFFC0100CL
#define PPI_FRAME              0xFFC01010L

/*********  PPI MASKS ***********/
/*  PPI_CONTROL Masks */
#define PORT_EN                0x00000001
#define PORT_DIR               0x00000002
#define XFR_TYPE               0x0000000C
#define PORT_CFG               0x00000030
#define FLD_SEL                0x00000040
#define PACK_EN                0x00000080
#define DMA32                  0x00000100
#define SKIP_EN                0x00000200
#define SKIP_EO                0x00000400
#define DLENGTH                0x00003800
#define DLEN_8                 0x0
#define DLEN(x)                (((x-9) & 0x07) << 11)
#define POL                    0x0000C000

/* PPI_STATUS Masks */
#define FLD                    0x00000400
#define FT_ERR                 0x00000800
#define OVR                    0x00001000
#define UNDR                   0x00002000
#define ERR_DET                0x00004000
#define ERR_NCOR               0x00008000

/* SPORT1 Controller        Chapter 12 */
#define SPORT1_TCR1            0xFFC00900L
#define SPORT1_TCR2            0xFFC00904L
#define SPORT1_TCLKDIV         0xFFC00908L
#define SPORT1_TFSDIV          0xFFC0090CL
#define SPORT1_TX              0xFFC00910L
#define SPORT1_RX              0xFFC00918L
#define SPORT1_RCR1            0xFFC00920L
#define SPORT1_RCR2            0xFFC00924L
#define SPORT1_RCLKDIV         0xFFC00928L
#define SPORT1_RFSDIV          0xFFC0092CL
#define SPORT1_STAT            0xFFC00930L
#define SPORT1_CHNL            0xFFC00934L
#define SPORT1_MCMC1           0xFFC00938L
#define SPORT1_MCMC2           0xFFC0093CL
#define SPORT1_MTCS0           0xFFC00940L
#define SPORT1_MTCS1           0xFFC00944L
#define SPORT1_MTCS2           0xFFC00948L
#define SPORT1_MTCS3           0xFFC0094CL
#define SPORT1_MRCS0           0xFFC00950L
#define SPORT1_MRCS1           0xFFC00954L
#define SPORT1_MRCS2           0xFFC00958L
#define SPORT1_MRCS3           0xFFC0095CL

/* SPORTx_TCR1 Masks */
#define TSPEN                  0x0001
#define ITCLK                  0x0002
#define TDTYPE                 0x000C
#define TLSBIT                 0x0010
#define ITFS                   0x0200
#define TFSR                   0x0400
#define DITFS                  0x0800
#define LTFS                   0x1000
#define LATFS                  0x2000
#define TCKFE                  0x4000

/* SPORTx_TCR2 Masks */
#define SLEN                   0x001F
#define TXSE                   0x0100
#define TSFSE                  0x0200
#define TRFST                  0x0400

/* SPORTx_RCR1 Masks */
#define RSPEN                  0x0001
#define IRCLK                  0x0002
#define RDTYPE                 0x000C
#define RULAW                  0x0008
#define RALAW                  0x000C
#define RLSBIT                 0x0010
#define IRFS                   0x0200
#define RFSR                   0x0400
#define LRFS                   0x1000
#define LARFS                  0x2000
#define RCKFE                  0x4000

/* SPORTx_RCR2 Masks */
#define SLEN                   0x001F
#define RXSE                   0x0100
#define RSFSE                  0x0200
#define RRFST                  0x0400

/* SPORTx_STAT Masks */
#define RXNE                   0x0001
#define RUVF                   0x0002
#define ROVF                   0x0004
#define TXF                    0x0008
#define TUVF                   0x0010
#define TOVF                   0x0020
#define TXHRE                  0x0040

/* SPORTx_MCMC1 Masks */
#define WSIZE                  0x0000F000
#define WOFF                   0x000003FF

/* SPORTx_MCMC2 Masks */
#define MCCRM                  0x00000003
#define MCDTXPE                0x00000004
#define MCDRXPE                0x00000008
#define MCMEN                  0x00000010
#define FSDR                   0x00000080
#define MFD                    0x0000F000

/* UART Controller          Chapter 13 */
#define UART_THR               0xFFC00400L
#define UART_RBR               0xFFC00400L
#define UART_DLL               0xFFC00400L
#define UART_IER               0xFFC00404L
#define UART_DLH               0xFFC00404L
#define UART_IIR               0xFFC00408L
#define UART_LCR               0xFFC0040CL
#define UART_MCR               0xFFC00410L
#define UART_LSR               0xFFC00414L
#define UART_SCR               0xFFC0041CL
#define UART_GCTL              0xFFC00424L

/*
 * UART CONTROLLER MASKS
 */

/* UART_LCR */
#define DLAB                   0x80
#define SB                     0x40
#define STP                    0x20
#define EPS                    0x10
#define PEN                    0x08
#define STB                    0x04
#define WLS(x)                 ((x-5) & 0x03)

#define DLAB_P                 0x07
#define SB_P                   0x06
#define STP_P                  0x05
#define EPS_P                  0x04
#define PEN_P                  0x03
#define STB_P                  0x02
#define WLS_P1                 0x01
#define WLS_P0                 0x00

/* UART_MCR */
#define LOOP_ENA               0x10
#define LOOP_ENA_P             0x04

/* UART_LSR */
#define TEMT                   0x40
#define THRE                   0x20
#define BI                     0x10
#define FE                     0x08
#define PE                     0x04
#define OE                     0x02
#define DR                     0x01

#define TEMP_P                 0x06
#define THRE_P                 0x05
#define BI_P                   0x04
#define FE_P                   0x03
#define PE_P                   0x02
#define OE_P                   0x01
#define DR_P                   0x00

/* UART_IER */
#define ELSI                   0x04
#define ETBEI                  0x02
#define ERBFI                  0x01

#define ELSI_P                 0x02
#define ETBEI_P                0x01
#define ERBFI_P                0x00

/* UART_IIR */
#define STATUS(x)              ((x << 1) & 0x06)
#define NINT                   0x01
#define STATUS_P1              0x02
#define STATUS_P0              0x01
#define NINT_P                 0x00

/* UART_GCTL */
#define FFE                    0x20
#define FPE                    0x10
#define RPOLC                  0x08
#define TPOLC                  0x04
#define IREN                   0x02
#define UCEN                   0x01

#define FFE_P                  0x05
#define FPE_P                  0x04
#define RPOLC_P                0x03
#define TPOLC_P                0x02
#define IREN_P                 0x01
#define UCEN_P                 0x00

/* General Purpose IO        Chapter 14*/
#define FIO_FLAG_D             0xFFC00700L
#define FIO_FLAG_C             0xFFC00704L
#define FIO_FLAG_S             0xFFC00708L
#define FIO_FLAG_T             0xFFC0070CL
#define FIO_MASKA_D            0xFFC00710L
#define FIO_MASKA_C            0xFFC00714L
#define FIO_MASKA_S            0xFFC00718L
#define FIO_MASKA_T            0xFFC0071CL
#define FIO_MASKB_D            0xFFC00720L
#define FIO_MASKB_C            0xFFC00724L
#define FIO_MASKB_S            0xFFC00728L
#define FIO_MASKB_T            0xFFC0072CL
#define FIO_DIR                0xFFC00730L
#define FIO_POLAR              0xFFC00734L
#define FIO_EDGE               0xFFC00738L
#define FIO_BOTH               0xFFC0073CL
#define FIO_INEN               0xFFC00740L


/* General Purpose IO        Chapter 9*/
#define PORTH_FER              0xFFC03208
#define PORTH_MUX              0xFFC03218
#define PORTHIO_DIR            0xFFC01730
#define PORTHIO_INEN           0xFFC01740
#define PORTHIO                0xFFC01700
#define PORTHIO_SET            0xFFC01708
#define PORTHIO_CLEAR          0xFFC01704
#define PORTHIO_TOGGLE         0xFFC0170C


#define FIO_INEN               0xFFC00740L
#define FIO_POLAR              0xFFC00734L
#define FIO_EDGE               0xFFC00738L
#define FIO_BOTH               0xFFC0073CL



#define FIO_FLAG_C             0xFFC00704L
#define FIO_FLAG_S             0xFFC00708L
#define FIO_FLAG_T             0xFFC0070CL
#define FIO_MASKA_D            0xFFC00710L
#define FIO_MASKA_C            0xFFC00714L
#define FIO_MASKA_S            0xFFC00718L
#define FIO_MASKA_T            0xFFC0071CL
#define FIO_MASKB_D            0xFFC00720L
#define FIO_MASKB_C            0xFFC00724L
#define FIO_MASKB_S            0xFFC00728L
#define FIO_MASKB_T            0xFFC0072CL


/*  General Purpose IO Masks */
#define PF0                    0x0001
#define PF1                    0x0002
#define PF2                    0x0004
#define PF3                    0x0008
#define PF4                    0x0010
#define PF5                    0x0020
#define PF6                    0x0040
#define PF7                    0x0080
#define PF8                    0x0100
#define PF9                    0x0200
#define PF10                   0x0400
#define PF11                   0x0800
#define PF12                   0x1000
#define PF13                   0x2000
#define PF14                   0x4000
#define PF15                   0x8000


/* TIMER 0, 1, 2            Chapter 15 */
#define TIMER0_CONFIG          0xFFC00600L
#define TIMER0_COUNTER         0xFFC00604L
#define TIMER0_PERIOD          0xFFC00608L
#define TIMER0_WIDTH           0xFFC0060CL

#define TIMER1_CONFIG          0xFFC00610L
#define TIMER1_COUNTER         0xFFC00614L
#define TIMER1_PERIOD          0xFFC00618L
#define TIMER1_WIDTH           0xFFC0061CL

#define TIMER2_CONFIG          0xFFC00620L
#define TIMER2_COUNTER         0xFFC00624L
#define TIMER2_PERIOD          0xFFC00628L
#define TIMER2_WIDTH           0xFFC0062CL

#define TIMER_ENABLE           0xFFC00640L
#define TIMER_DISABLE          0xFFC00644L
#define TIMER_STATUS           0xFFC00648L

/* Real Time Clock          Chapter 16 */
#define RTC_STAT               0xFFC00300L
#define RTC_ICTL               0xFFC00304L
#define RTC_ISTAT              0xFFC00308L
#define RTC_SWCNT              0xFFC0030CL
#define RTC_ALARM              0xFFC00310L
#define RTC_FAST               0xFFC00314L
#define RTC_PREN               0xFFC00314L

/* RTC_FAST Mask (RTC_PREN Mask) */
#define ENABLE_PRESCALE        0x00000001
#define PREN                   0x00000001

/* Asynchronous Memory Controller EBUI, Chapter 17*/
#define EBIU_AMGCTL            0xFFC00A00L
#define EBIU_AMBCTL0           0xFFC00A04L
#define EBIU_AMBCTL1           0xFFC00A08L

/* SDRAM Controller External Bus Interface Unit */

#define EBIU_SDGCTL            0xFFC00A10L
#define EBIU_SDBCTL            0xFFC00A14L
#define EBIU_SDRRC             0xFFC00A18L
#define EBIU_SDSTAT            0xFFC00A1CL




/* DCPLB_DATA and ICPLB_DATA Registers */
/*** Bit Positions */
#define CPLB_VALID_P            0x00000000  /* 0=invalid entry, 1=valid entry */
#define CPLB_LOCK_P             0x00000001  /* 0=entry may be replaced, 1=entry locked */
#define CPLB_USER_RD_P          0x00000002  /* 0=no read access, 1=read access allowed (user mode) */
/*** Masks */
#define CPLB_VALID             0x00000001  /* 0=invalid entry, 1=valid entry */
#define CPLB_LOCK              0x00000002  /* 0=entry may be replaced, 1=entry locked */
#define CPLB_USER_RD           0x00000004  /* 0=no read access, 1=read access allowed (user mode) */
#define PAGE_SIZE_1KB          0x00000000  /* 1 KB page size */
#define PAGE_SIZE_4KB          0x00010000  /* 4 KB page size */
#define PAGE_SIZE_1MB          0x00020000  /* 1 MB page size */
#define PAGE_SIZE_4MB          0x00030000  /* 4 MB page size */
#define CPLB_PORTPRIO             0x00000200  /* 0=low priority port, 1= high priority port */
#define CPLB_L1_CHBL           0x00001000  /* 0=non-cacheable in L1, 1=cacheable in L1 */
/*** ICPLB_DATA only */
#define CPLB_LRUPRIO              0x00000100  /* 0=can be replaced by any line, 1=priority for non-replacement */
/*** DCPLB_DATA only */
#define CPLB_USER_WR           0x00000008  /* 0=no write access, 0=write access allowed (user mode) */
#define CPLB_SUPV_WR           0x00000010  /* 0=no write access, 0=write access allowed (supervisor mode) */
#define CPLB_DIRTY             0x00000080  /* 1=dirty, 0=clean */
#define CPLB_L1_AOW                       0x00008000  /* 0=do not allocate cache lines on write-through writes,  */
                                                                                  /* 1= allocate cache lines on write-through writes. */
#define CPLB_WT                0x00004000  /* 0=write-back, 1=write-through */


#ifdef __cplusplus
}
#endif

#endif /* _RTEMS_SCORE_BFIN_H */