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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [powerpc/] [ppcn_60x/] [include/] [bsp.h] - Blame information for rev 30

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

Line No. Rev Author Line
1 30 unneback
/*  bsp.h
2
 *
3
 *  This include file contains all board IO definitions.
4
 *
5
 *  COPYRIGHT (c) 1998 by Radstone Technology
6
 *
7
 *
8
 * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY
9
 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
10
 * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK
11
 * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU.
12
 *
13
 * You are hereby granted permission to use, copy, modify, and distribute
14
 * this file, provided that this notice, plus the above copyright notice
15
 * and disclaimer, appears in all copies. Radstone Technology will provide
16
 * no support for this code.
17
 *
18
 *  COPYRIGHT (c) 1989-1997.
19
 *  On-Line Applications Research Corporation (OAR).
20
 *  Copyright assigned to U.S. Government, 1994.
21
 *
22
 *  The license and distribution terms for this file may in
23
 *  the file LICENSE in this distribution or at
24
 *  http:www.OARcorp.com/rtems/license.html.
25
 *
26
 *  $Id: bsp.h,v 1.2 2001-09-27 12:00:50 chris Exp $
27
 */
28
 
29
#ifndef __BSP_h
30
#define __BSP_h
31
 
32
#ifdef __cplusplus
33
extern "C" {
34
#endif
35
 
36
/*
37
 *  confdefs.h overrides for this BSP:
38
 *   - termios serial ports (defaults to 1)
39
 *   - Interrupt stack space is not minimum if defined.
40
 */
41
 
42
#define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2
43
#define CONFIGURE_INTERRUPT_STACK_MEMORY  (32 * 1024)
44
 
45
/*  Define processor identification. */
46
 
47
#define MPC601  1
48
#define MPC603  3
49
#define MPC604  4
50
#define MPC603e 6
51
#define MPC603ev 7
52
#define MPC604e 9
53
 
54
#ifdef ASM
55
/* Definition of where to store registers in alignment handler */
56
#define ALIGN_REGS 0x0140
57
 
58
/*  BAT register definitions for the MPC603 and MPC604. */
59
/*  Define bit fields for upper MPC603/4 BAT registers. */
60
 
61
#define BEPI_FIELD_60X      0xFFFE0000
62
#define VALID_SUPERVISOR    0x2
63
#define VALID_PROBLEM       0x1
64
#define KEY_USER_60X        0x1
65
#define BL_128K        0x0
66
#define BL_256K        (0x1<2)
67
#define BL_512K        (0x3<2)
68
#define BL_1M          (0x7<2)
69
#define BL_2M          (0xF<2)
70
#define BL_4M          (0x1F<2)
71
#define BL_8M          (0x3F<2)
72
#define BL_16M         (0x7F<2)
73
#define BL_32M         (0xFF<2)
74
#define BL_64M         (0x1FF<2)
75
#define BL_128M        (0x3FF<2)
76
#define BL_256M        (0x7FF<2)
77
 
78
 
79
/*  Define bit fields for lower MPC603/4 BAT registers. */
80
 
81
#define BRPN_FIELD_60X      0xFFFE0000
82
 
83
/*  Common defines for BAT registers. */
84
/*  Depending on the processor, the following may be in the upper */
85
/*  and lower BAT register. */
86
 
87
#define WRITE_THRU      0x40
88
#define WRITE_BK        0x0
89
#define COHERE_EN       0x10
90
#define COHERE_DIS      0x0
91
#define CACHE_DIS       0x20
92
#define CACHE_EN        0x0
93
#define GUARDED_EN      0x8
94
#define GUARDED_DIS     0x0
95
#define PP_00           0x0
96
#define PP_01           0x1
97
#define PP_10           0x2
98
#define PP_11           0x3
99
 
100
/*  HID0 definitions for MPC603 and MPC604 */
101
#define HID0            0x3f0      /*  HID0 Special Purpose Register # */
102
/*  HID1 definitions for MPC603e and MPC604e */
103
#define HID1            0x3f1      /*  HID1 Special Purpose Register # */
104
 
105
#define H0_603_ICFI     0x0800     /*  HID0 I-Cache Flash Invalidate */
106
#define H0_603_DCI      0x0400     /*  HID0 D-Cache Flash Invalidate */
107
 
108
#define H0_60X_ICE      0x8000     /*  HID0 I-Cache Enable */
109
#define H0_60X_DCE      0x4000     /*  HID0 D-Cache Enable */
110
 
111
#define H0_604_BHTE     0x0004     /*  HID0 Branch History Table enable */
112
#define H0_604_SIED     0x0080     /*  HID0 Serial Instruction Execution */
113
#define H0_604_ICIA     0x0800     /*  HID0 I-Cache Invalidate All */
114
#define H0_604_DCIA     0x0400     /*  HID0 D-Cache Invalidate All */
115
 
116
#define BAT0U           528
117
#define BAT0L           529
118
#define BAT1U           530
119
#define BAT1L           531
120
#define BAT2U           532
121
#define BAT2L           533
122
#define BAT3U           534
123
#define BAT3L           535
124
#define SPRG0           272
125
#define SPRG1           273
126
 
127
/* MSR bit settings */
128
#define MSR_LE          0x0001
129
#define MSR_RI          0x0002
130
#define MSR_DR          0x0010
131
#define MSR_IR          0x0020
132
#define MSR_IP          0x0040
133
#define MSR_FE1         0x0100
134
#define MSR_BE          0x0200
135
#define MSR_SE          0x0400
136
#define MSR_FE0         0x0800
137
#define MSR_ME          0x1000
138
#define MSR_FP          0x2000
139
#define MSR_PR          0x4000
140
#define MSR_EE          0x8000
141
#define MSR_ILE         0x0001  /* Upper 16 bits */
142
#define MSR_POW         0x0004  /* Upper 16 bits */
143
#else
144
#include <rtems.h>
145
#include <console.h>
146
#include <clockdrv.h>
147
#include <iosupp.h>
148
#include <tod.h>
149
#include <nvram.h>
150
 
151
/*
152
 *  PPCn_60x Interupt Definations.
153
 */
154
#define PPCN_60X_8259_IRQ_BASE ( PPC_IRQ_LAST +  1 )
155
 
156
/*
157
 * 8259 IRQ definations.
158
 */
159
#define PPCN_60X_IRQ_SYS_TIMER  (PPCN_60X_8259_IRQ_BASE +  0)  
160
#define PPCN_60X_IRQ_KBD                (PPCN_60X_8259_IRQ_BASE +  1)  
161
#define PPCN_60X_IRQ_COM2               (PPCN_60X_8259_IRQ_BASE +  3)
162
#define PPCN_60X_IRQ_COM1               (PPCN_60X_8259_IRQ_BASE +  4)
163
#define PPCN_60X_IRQ_CIO                (PPCN_60X_8259_IRQ_BASE +  5)
164
#define PPCN_60X_IRQ_FDC                (PPCN_60X_8259_IRQ_BASE +  6)
165
#define PPCN_60X_IRQ_LPT                (PPCN_60X_8259_IRQ_BASE +  7)
166
#define PPCN_60X_IRQ_RTC                (PPCN_60X_8259_IRQ_BASE +  8)
167
#define PPCN_60X_IRQ_COM3_4             (PPCN_60X_8259_IRQ_BASE + 10)
168
#define PPCN_60X_IRQ_MSE                (PPCN_60X_8259_IRQ_BASE + 12)
169
#define PPCN_60X_IRQ_SCSI               (PPCN_60X_8259_IRQ_BASE + 13)
170
 
171
/*
172
 * PCI interrupts as read from line register map directly to
173
 * ISA interrupt lines 9, 11, 14 and 15.
174
 */
175
#define PPCN_60X_IRQ_PCI(n)             (PPCN_60X_8259_IRQ_BASE +  (n))
176
 
177
#define MAX_BOARD_IRQS          (PPCN_60X_8259_IRQ_BASE + 15)
178
 
179
#define ISA8259_M_CTRL 0x20
180
#define ISA8259_S_CTRL 0xa0
181
#define ISA8259_M_MASK 0x21
182
#define ISA8259_S_MASK 0xa1
183
#define ISA8259_M_ELCR 0x4d0
184
#define ISA8259_S_ELCR 0x4d1
185
 
186
#define ELCRS_INT15_LVL         0x80
187
#define ELCRS_INT14_LVL         0x40
188
#define ELCRS_INT12_LVL         0x10
189
#define ELCRS_INT11_LVL         0x08
190
#define ELCRS_INT10_LVL         0x04
191
#define ELCRS_INT9_LVL          0x02
192
#define ELCRS_INT8_LVL          0x01
193
#define ELCRM_INT7_LVL          0x80
194
#define ELCRM_INT5_LVL          0x20
195
 
196
 
197
#define NONSPECIFIC_EOI 0x20
198
 
199
extern void En_Ext_Interrupt(int level);
200
extern void Dis_Ext_Interrupt(int level);
201
 
202
#define IRQ_VECTOR_BASE 0xbffffff0
203
 
204
/*
205
 * i8042 addresses
206
 */
207
#define I8042_DATA      0x60
208
#define I8042_CS        0x64
209
 
210
/*
211
 * ns16550 addresses
212
 */
213
#define NS16550_PORT_A  0x3f8
214
#define NS16550_PORT_B  0x2f8
215
 
216
/*
217
 * z85c30 addresses
218
 */
219
#define Z85C30_CTRL_B   0x840
220
#define Z85C30_DATA_B   0x841
221
#define Z85C30_CTRL_A   0x842
222
#define Z85C30_DATA_A   0x843
223
 
224
/*
225
 *  Z85C30 Definations for the 422 interface.
226
 */
227
#define Z85C30_CLOCK     14745600
228
 
229
#define PCI_SYS_MEM_BASE        0x80000000
230
#define PCI_MEM_BASE            0xc0000000
231
#define PCI_IO_BASE             0x80000000
232
 
233
#define EIEIO asm volatile("eieio")
234
 
235
/*
236
 * As ports are all little endian we will perform swaps here on 16 and 32
237
 * bit transfers
238
 */
239
extern unsigned16 Swap16(unsigned16 usVal);
240
extern unsigned32 Swap32(unsigned32 ulVal);
241
 
242
#define outport_byte(port, val)                 \
243
        EIEIO;                                  \
244
        *(volatile unsigned8 *)(PCI_IO_BASE+    \
245
                                (unsigned long)(port))=(val)
246
 
247
#define outport_16(port, val)                   \
248
        EIEIO;                                  \
249
        *(volatile unsigned16 *)(PCI_IO_BASE+   \
250
                                 (unsigned long)(port))=Swap16(val)
251
 
252
#define outport_32(port, val)                   \
253
        EIEIO;                                  \
254
        *(volatile unsigned32 *)(PCI_IO_BASE+   \
255
                                 (unsigned long)(port))=Swap32(val)
256
 
257
#define inport_byte(port, val)                          \
258
        EIEIO;                                          \
259
        (val)=*(volatile unsigned8 *)(PCI_IO_BASE+      \
260
                                      (unsigned long)(port))
261
 
262
#define inport_16(port, val)                                    \
263
        EIEIO;                                                  \
264
        (val)=Swap16(*(volatile unsigned16 *)(PCI_IO_BASE+      \
265
                                              (unsigned long)(port)))
266
 
267
#define inport_32(port, val)                                    \
268
        EIEIO;                                                  \
269
        (val)=Swap32(*(volatile unsigned32 *)(PCI_IO_BASE+      \
270
                                              (unsigned long)(port)))
271
 
272
/*
273
 *  System Planar Board Registers
274
 */
275
typedef volatile struct _PLANARREGISTERS{
276
    unsigned8 Reserved0[0x803];     /* Offset 0x000 */
277
    unsigned8 SimmId;               /* Offset 0x803 */
278
    unsigned8 SimmPresent;          /* Offset 0x804 */
279
    unsigned8 Reserved1[3];
280
    unsigned8 HardfileLight;        /* Offset 0x808 */
281
    unsigned8 Reserved2[3];
282
    unsigned8 EquipmentPresent1;    /* Offset 0x80C */
283
    unsigned8 Reserved3;
284
    unsigned8 EquipmentPresent2;    /* Offset 0x80e */
285
    unsigned8 Reserved4;
286
    unsigned8 PasswordProtect1;     /* Offset 0x810 */
287
    unsigned8 Reserved5;
288
    unsigned8 PasswordProtect2;     /* Offset 0x812 */
289
    unsigned8 Reserved6;
290
    unsigned8 L2Flush;              /* Offset 0x814 */
291
    unsigned8 Reserved7[3];
292
    unsigned8 Keylock;              /* Offset 0x818 */
293
    unsigned8 Reserved8[0x3c];
294
    unsigned8 BoardRevision;            /* Offset 0x854 */
295
    unsigned8 Reserved9[0xf];
296
    unsigned8 BoardID;                          /* Offset 0x864 */
297
    unsigned8 Reserved10;
298
    unsigned8 MotherboardMemoryType; /* Offset 0x866 */
299
    unsigned8 Reserved11;
300
    unsigned8 MezzanineMemoryType;  /* Offset 0x868 */
301
} PLANARREGISTERS, *PPLANARREGISTERS;
302
 
303
extern unsigned char ucSystemType;
304
extern unsigned char ucBoardRevMaj;
305
extern unsigned char ucBoardRevMin;
306
extern unsigned long ulMemorySize;
307
extern unsigned long ulCpuBusClock;
308
 
309
#define SYS_TYPE_PPC1   0
310
#define SYS_TYPE_PPC2   1
311
#define SYS_TYPE_PPC1a  2
312
#define SYS_TYPE_PPC2a  3
313
#define SYS_TYPE_PPC4   4
314
 
315
/*
316
 * PCI initialisation
317
 */
318
void InitializePCI(void);
319
 
320
/*
321
 * VME initiaisation
322
 */
323
void InitializeUniverse();
324
 
325
/*
326
 * RTC initialisation
327
 */
328
void InitializeRTC(void);
329
 
330
/*
331
 * NvRAM initialisation
332
 */
333
void InitializeNvRAM(void);
334
 
335
/*
336
 *  BSP_TIMER_AVG_OVERHEAD and BSP_TIMER_LEAST_VALID for the shared timer
337
 *  driver.
338
 */
339
 
340
#define BSP_TIMER_AVG_OVERHEAD   4  /* It typically takes xx clicks        */
341
                                    /*     to start/stop the timer.        */
342
#define BSP_TIMER_LEAST_VALID    1  /* Don't trust a value lower than this */
343
 
344
/*
345
 *  Convert decrement value to tenths of microsecnds (used by
346
 *  shared timer driver).
347
 *
348
 *    + There are 4 bus cycles per click
349
 *    + We return value in 1/10 microsecond units.
350
 *   Modified following equation to integer equation to remove
351
 *   floating point math.
352
 *   (int) ((float)(_value) / ((66.67 * 0.1) / 4.0))
353
 */
354
 
355
#define BSP_Convert_decrementer( _value ) \
356
  (int) (((_value) * 4000) / (ulCpuBusClock/10000))
357
 
358
/*
359
 *  Define the time limits for RTEMS Test Suite test durations.
360
 *  Long test and short test duration limits are provided.  These
361
 *  values are in seconds and need to be converted to ticks for the
362
 *  application.
363
 *
364
 */
365
 
366
#define MAX_LONG_TEST_DURATION       300 /* 5 minutes = 300 seconds */
367
#define MAX_SHORT_TEST_DURATION      3   /* 3 seconds */
368
 
369
/*
370
 *  Stuff for Time Test 27
371
 */
372
 
373
#define MUST_WAIT_FOR_INTERRUPT 1
374
 
375
#define Install_tm27_vector( _handler ) \
376
  set_vector( (_handler), PPC_IRQ_DECREMENTER, 1 )
377
 
378
#define Cause_tm27_intr()  \
379
  do { \
380
    unsigned32 _clicks = 8; \
381
    asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
382
  } while (0)
383
 
384
 
385
#define Clear_tm27_intr() \
386
  do { \
387
    unsigned32 _clicks = 0xffffffff; \
388
    asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \
389
  } while (0)
390
 
391
#define Lower_tm27_intr() \
392
  do { \
393
    unsigned32 _msr = 0; \
394
    _ISR_Set_level( 0 ); \
395
    asm volatile( "mfmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \
396
    _msr |=  0x8002; \
397
    asm volatile( "mtmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \
398
  } while (0)
399
 
400
 
401
/* Constants */
402
 
403
/*
404
 *  Device Driver Table Entries
405
 */
406
 
407
/*
408
 * NOTE: Use the standard Console driver entry
409
 */
410
 
411
/*
412
 * NOTE: Use the standard Clock driver entry
413
 */
414
 
415
/*
416
 * How many libio files we want
417
 */
418
 
419
#define BSP_LIBIO_MAX_FDS       20
420
 
421
/* functions */
422
 
423
void bsp_start( void );
424
 
425
void bsp_cleanup( void );
426
 
427
rtems_isr_entry set_vector(                    /* returns old vector */
428
  rtems_isr_entry     handler,                  /* isr routine        */
429
  rtems_vector_number vector,                   /* vector number      */
430
  int                 type                      /* RTEMS or RAW intr  */
431
);
432
 
433
/*
434
 * spurious.c
435
 */
436
rtems_isr bsp_stub_handler(
437
   rtems_vector_number trap
438
);
439
rtems_isr bsp_spurious_handler(
440
   rtems_vector_number trap
441
);
442
void bsp_spurious_initialize();
443
 
444
/*
445
 * genvec.c
446
 */
447
void set_EE_vector(
448
  rtems_isr_entry     handler,                  /* isr routine        */
449
  rtems_vector_number vector                    /* vector number      */
450
);
451
void initialize_external_exception_vector();
452
 
453
/*
454
 * console.c
455
 */
456
void DEBUG_puts( char *string );
457
void DEBUG_puth( unsigned32 ulHexNum );
458
 
459
void BSP_fatal_return( void );
460
 
461
extern rtems_configuration_table BSP_Configuration;     /* owned by BSP */
462
 
463
extern rtems_cpu_table           Cpu_table;             /* owned by BSP */
464
 
465
extern unsigned32          bsp_isr_level;
466
 
467
#endif /* ASM */
468
 
469
#ifdef __cplusplus
470
}
471
#endif
472
 
473
#endif
474
/* end of include file */

powered by: WebSVN 2.1.0

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