source: rtems/c/src/lib/libbsp/powerpc/score603e/startup/Hwr_init.c @ 56e12a17

4.9
Last change on this file since 56e12a17 was 978eba3, checked in by Joel Sherrill <joel.sherrill@…>, on 09/30/08 at 23:17:15

2008-09-30 Jennifer Averett <jennifer.averett@…>

  • Makefile.am, preinstall.am, PCI_bus/universe.c, console/console.c, include/bsp.h, irq/FPGA.c, irq/irq.c, startup/Hwr_init.c, startup/bspstart.c, startup/vmeintr.c: Modifications required to run on hardware. Some cleanup.
  • include/irq-config.h: New file.
  • startup/spurious.c: Removed.
  • Property mode set to 100644
File size: 3.3 KB
Line 
1/*  Hwr_init.c
2 *
3 *  $Id$
4 */
5
6#include <bsp.h>
7
8#define PPC603e_SPR_HID0        1008
9#define PPC603e_SPR_HID1        1009
10#define PPC603e_SPR_IBAT0U       528
11#define PPC603e_SPR_IBAT0L       529
12#define PPC603e_SPR_DBAT0U       536
13#define PPC603e_SPR_DBAT0L       537
14#define PPC603e_SPR_IBAT1U       530
15#define PPC603e_SPR_IBAT1L       531
16#define PPC603e_SPR_DBAT1U       538
17#define PPC603e_SPR_DBAT1L       539
18#define PPC603e_SPR_IBAT2U       532
19#define PPC603e_SPR_IBAT2L       533
20#define PPC603e_SPR_DBAT2U       540
21#define PPC603e_SPR_DBAT2L       541
22#define PPC603e_SPR_IBAT3U       534
23#define PPC603e_SPR_IBAT3L       535
24#define PPC603e_SPR_DBAT3U       542
25#define PPC603e_SPR_DBAT3L       543
26#define PPC603e_SPR_DMISS        976
27#define PPC603e_SPR_DCMP         977
28#define PPC603e_SPR_HASH1        978
29#define PPC603e_SPR_HASH2        979
30#define PPC603e_SPR_IMISS        980
31#define PPC603e_SPR_ICMP         981
32#define PPC603e_SPR_RPA          982
33#define PPC603e_SPR_SDR1          25
34#define PPC603e_SPR_PVR          287
35#define PPC603e_SPR_DAR           19
36#define PPC603e_SPR_SPRG0        272
37#define PPC603e_SPR_SPRG1        273
38#define PPC603e_SPR_SPRG2        274
39#define PPC603e_SPR_SPRG3        275
40#define PPC603e_SPR_DSISR         18
41#define PPC603e_SPR_SRR0          26
42#define PPC603e_SPR_SRR1          27
43#define PPC603e_SPR_TBL_WRITE    284
44#define PPC603e_SPR_TBU_WRITE    285
45#define PPC603e_SPR_DEC           22
46#define PPC603e_SPR_IABR        1010
47#define PPC603e_SPR_EAR          282
48
49#define PCI_MEM_CMD   (SCORE603E_PCI_MEM_BASE >> 16)
50
51typedef struct {
52  uint32_t          counter_1_100;
53  uint32_t          counter_hours;
54  uint32_t          counter_min;
55  uint32_t          counter_sec;
56  uint32_t          counter_month;
57  uint32_t          counter_date;
58  uint32_t          counter_year;
59  uint32_t          counter_day_of_week;
60
61  uint32_t          RAM_1_100;
62  uint32_t          RAM_hours;
63  uint32_t          RAM_month;
64  uint32_t          RAM_date;
65  uint32_t          RAM_year;
66  uint32_t          RAM_day_of_week;
67
68  uint32_t          interupt_status_mask;
69  uint32_t          command_register;
70}Harris_RTC;
71
72void init_RTC(void)
73{
74  volatile Harris_RTC *the_RTC;
75
76  the_RTC = (volatile Harris_RTC *)BSP_RTC_ADDRESS;
77
78  the_RTC->command_register = 0x0;
79}
80
81void init_PCI(void)
82{
83  /* DINK Monitor setsup and uses all 4 BAT registers.  */
84  /* The fourth BAT register can be modified to access this area */
85
86  printk("init_PCI:\n");
87}
88
89#define PPC_Get_HID0( _value ) \
90  do { \
91      _value = 0;        /* to avoid warnings */ \
92      asm volatile( \
93          "mfspr %0, 0x3f0;"     /* get HID0 */ \
94          "isync" \
95          : "=r" (_value) \
96          : "0" (_value) \
97      ); \
98  } while (0)
99
100#define PPC_Set_HID0( _value ) \
101  do { \
102      asm volatile( \
103          "isync;" \
104          "mtspr 0x3f0, %0;"     /* load HID0 */ \
105          "isync" \
106          : "=r" (_value) \
107          : "0" (_value) \
108      ); \
109  } while (0)
110
111void instruction_cache_enable ()
112{
113  uint32_t         value;
114
115  /*
116   * Enable the instruction cache
117   */
118
119  PPC_Get_HID0( value );
120
121  value |= 0x00008000;       /* Set ICE bit */
122
123  PPC_Set_HID0( value );
124}
125
126void data_cache_enable ()
127{
128  uint32_t         value;
129
130  /*
131   * enable data cache
132   */
133
134  PPC_Get_HID0( value );
135
136  value |= 0x00004000;        /* set DCE bit */
137
138  PPC_Set_HID0( value );
139}
Note: See TracBrowser for help on using the repository browser.