source: rtems/c/src/lib/libbsp/powerpc/ppcn_60x/include/bsp.h @ 4906d72f

4.104.114.84.95
Last change on this file since 4906d72f was 4906d72f, checked in by Joel Sherrill <joel.sherrill@…>, on 06/18/01 at 17:02:30

2001-05-26 Ralf Corsepius <corsepiu@…>

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