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

4.104.114.84.95
Last change on this file since 73b5bd5d was 3239698, checked in by Ralf Corsepius <ralf.corsepius@…>, on Apr 15, 2004 at 1:26:21 PM

Remove stray white spaces.

  • Property mode set to 100644
File size: 991 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  uint32_t   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  uint32_t   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}
Note: See TracBrowser for help on using the repository browser.