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

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

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