source: rtems/c/src/lib/libcpu/powerpc/old-exceptions/ppccache.c @ acc25ee

4.104.114.84.95
Last change on this file since acc25ee was acc25ee, checked in by Joel Sherrill <joel.sherrill@…>, on 12/02/99 at 14:31:19

Merged of mcp750 and mvme2307 BSP by Eric Valette <valette@…>.
As part of this effort, the mpc750 libcpu code is now shared with the
ppc6xx.

  • Property mode set to 100644
File size: 992 bytes
Line 
1/*
2 *  PowerPC Cache enable routines
3 *
4 *  $Id$
5 */
6
7#include <rtems/system.h>
8
9#define PPC_Get_HID0( _value ) \
10  do { \
11      _value = 0;        /* to avoid warnings */ \
12      asm volatile( \
13          "mfspr %0, 0x3f0;"     /* get HID0 */ \
14          "isync" \
15          : "=r" (_value) \
16          : "0" (_value) \
17      ); \
18  } while (0)
19
20#define PPC_Set_HID0( _value ) \
21  do { \
22      asm volatile( \
23          "isync;" \
24          "mtspr 0x3f0, %0;"     /* load HID0 */ \
25          "isync" \
26          : "=r" (_value) \
27          : "0" (_value) \
28      ); \
29  } while (0)
30
31
32void powerpc_instruction_cache_enable ()
33{
34  unsigned32 value;
35
36  /*
37   * Enable the instruction cache
38   */
39
40  PPC_Get_HID0( value );
41
42  value |= 0x00008000;       /* Set ICE bit */
43
44  PPC_Set_HID0( value );
45}
46
47void powerpc_data_cache_enable ()
48{
49  unsigned32 value;
50
51  /*
52   * enable data cache
53   */
54
55  PPC_Get_HID0( value );
56
57  value |= 0x00004000;        /* set DCE bit */
58
59  PPC_Set_HID0( value );
60}
61
Note: See TracBrowser for help on using the repository browser.