1 |
27 |
unneback |
#ifndef CYGONCE_HAL_VAR_REGS_H
|
2 |
|
|
#define CYGONCE_HAL_VAR_REGS_H
|
3 |
|
|
|
4 |
|
|
//==========================================================================
|
5 |
|
|
//
|
6 |
|
|
// var_regs.h
|
7 |
|
|
//
|
8 |
|
|
// PowerPC 40x variant CPU definitions
|
9 |
|
|
//
|
10 |
|
|
//==========================================================================
|
11 |
|
|
//####ECOSGPLCOPYRIGHTBEGIN####
|
12 |
|
|
// -------------------------------------------
|
13 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
14 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
15 |
|
|
//
|
16 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
17 |
|
|
// the terms of the GNU General Public License as published by the Free
|
18 |
|
|
// Software Foundation; either version 2 or (at your option) any later version.
|
19 |
|
|
//
|
20 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
21 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
22 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
23 |
|
|
// for more details.
|
24 |
|
|
//
|
25 |
|
|
// You should have received a copy of the GNU General Public License along
|
26 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
27 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
28 |
|
|
//
|
29 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
30 |
|
|
// or inline functions from this file, or you compile this file and link it
|
31 |
|
|
// with other works to produce a work based on this file, this file does not
|
32 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
33 |
|
|
// License. However the source code for this file must still be made available
|
34 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
35 |
|
|
//
|
36 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
37 |
|
|
// this file might be covered by the GNU General Public License.
|
38 |
|
|
//
|
39 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
40 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
41 |
|
|
// -------------------------------------------
|
42 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
43 |
|
|
//==========================================================================
|
44 |
|
|
//#####DESCRIPTIONBEGIN####
|
45 |
|
|
//
|
46 |
|
|
// Author(s): jskov
|
47 |
|
|
// Contributors: jskov,gthomas
|
48 |
|
|
// Date: 2000-08-27
|
49 |
|
|
// Purpose: Provide PPC40x register definitions
|
50 |
|
|
// Description: Provide PPC40x register definitions
|
51 |
|
|
// The short difinitions (sans CYGARC_REG_) are exported only
|
52 |
|
|
// if CYGARC_HAL_COMMON_EXPORT_CPU_MACROS is defined.
|
53 |
|
|
// Usage: Included via the acrhitecture register header:
|
54 |
|
|
// #include <cyg/hal/ppc_regs.h>
|
55 |
|
|
// ...
|
56 |
|
|
//
|
57 |
|
|
//
|
58 |
|
|
//####DESCRIPTIONEND####
|
59 |
|
|
//
|
60 |
|
|
//==========================================================================
|
61 |
|
|
|
62 |
|
|
//--------------------------------------------------------------------------
|
63 |
|
|
// Cache
|
64 |
|
|
#define CYGARC_REG_HID0 1008
|
65 |
|
|
|
66 |
|
|
#ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS
|
67 |
|
|
#define HID0 CYGARC_REG_HID0
|
68 |
|
|
#endif // ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS
|
69 |
|
|
|
70 |
|
|
//--------------------------------------------------------------------------
|
71 |
|
|
// MMU control.
|
72 |
|
|
#ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS
|
73 |
|
|
|
74 |
|
|
#define SPR_EVPR 982 // Exception vector prefix
|
75 |
|
|
#define SPR_PID 945 // Process ID
|
76 |
|
|
|
77 |
|
|
#define M_EPN_EPNMASK 0xfffff000 // effective page no mask
|
78 |
|
|
#define M_EPN_EV 0x00000040 // entry valid
|
79 |
|
|
#define M_EPN_SIZE(n) (n<<7) // entry size (0=1K, 1=4K, ... 7=16M)
|
80 |
|
|
|
81 |
|
|
#define M_RPN_RPNMASK 0xfffff000 // real page no mask
|
82 |
|
|
#define M_RPN_EX 0x00000200 // execute enable
|
83 |
|
|
#define M_RPN_WR 0x00000100 // write enable
|
84 |
|
|
#define M_RPN_W 0x00000008 // write-through (when cache enabled)
|
85 |
|
|
#define M_RPN_I 0x00000004 // cache inhibited
|
86 |
|
|
#define M_RPN_M 0x00000002 // memory coherent (not implemented)
|
87 |
|
|
#define M_RPN_G 0x00000001 // guarded
|
88 |
|
|
|
89 |
|
|
#define CYGARC_TLBWE(_id_, _hi_, _lo_) \
|
90 |
|
|
asm volatile ("tlbwe %1,%0,0; tlbwe %2,%0,1" :: "r"(_id_), "r"(_hi_), "r"(_lo_));
|
91 |
|
|
|
92 |
|
|
#define CYGARC_TLBRE(_id_, _hi_, _lo_) \
|
93 |
|
|
asm volatile ("tlbre %0,%2,0; tlbre %1,%2,1" : "=r"(_hi_), "=r"(_lo_) : "r"(_id_));
|
94 |
|
|
|
95 |
|
|
#endif // ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS
|
96 |
|
|
|
97 |
|
|
//--------------------------------------------------------------------------
|
98 |
|
|
// Device control register access macros.
|
99 |
|
|
#define CYGARC_MTDCR(_tbr_, _v_) \
|
100 |
|
|
asm volatile ("mtdcr %0, %1;" :: "I" (_tbr_), "r" (_v_));
|
101 |
|
|
#define CYGARC_MFDCR(_tbr_, _v_) \
|
102 |
|
|
asm volatile ("mfdcr %0, %1;" : "=r" (_v_) : "I" (_tbr_));
|
103 |
|
|
|
104 |
|
|
#ifdef CYGARC_HAL_COMMON_EXPORT_CPU_MACROS
|
105 |
|
|
|
106 |
|
|
// Interrupt control (device) registers
|
107 |
|
|
#define DCR_EXIER 66
|
108 |
|
|
#define DCR_EXISR 64
|
109 |
|
|
#define DCR_IOCR 160
|
110 |
|
|
|
111 |
|
|
// Timer control (special) registers
|
112 |
|
|
#define SPR_PIT 987
|
113 |
|
|
#define SPR_TCR 986
|
114 |
|
|
#define SPR_TSR 984
|
115 |
|
|
|
116 |
|
|
// Interval and watchdog timer control
|
117 |
|
|
#define TCR_WP 0xC0000000 // Watchdog timer period
|
118 |
|
|
#define TCR_WP_17 0x00000000 // 2^17 clocks
|
119 |
|
|
#define TCR_WP_21 0x40000000 // 2^21 clocks
|
120 |
|
|
#define TCR_WP_25 0x80000000 // 2^25 clocks
|
121 |
|
|
#define TCR_WP_29 0xC0000000 // 2^29 clocks
|
122 |
|
|
#define TCR_WRC 0x30000000 // Reset control
|
123 |
|
|
#define TCR_WRC_None 0x00000000 // No reset on timeout
|
124 |
|
|
#define TCR_WRC_Core 0x10000000 // Reset core on timeout
|
125 |
|
|
#define TCR_WRC_Chip 0x20000000 // Reset chip on timeout
|
126 |
|
|
#define TCR_WRC_System 0x30000000 // Reset system on timeout
|
127 |
|
|
#define TCR_WIE 0x08000000 // Watchdog interrupt enable
|
128 |
|
|
#define TCR_PIE 0x04000000 // Programmable timer interrupt
|
129 |
|
|
#define TCR_FP 0x03000000 // Fixed timer interval
|
130 |
|
|
#define TCR_FP_9 0x00000000 // 2^9 clocks
|
131 |
|
|
#define TCR_FP_13 0x01000000 // 2^13 clocks
|
132 |
|
|
#define TCR_FP_17 0x02000000 // 2^17 clocks
|
133 |
|
|
#define TCR_FP_21 0x03000000 // 2^21 clocks
|
134 |
|
|
#define TCR_FIE 0x00800000 // Fixed timer interrupt
|
135 |
|
|
#define TCR_ARE 0x00400000 // Auto-reload enable
|
136 |
|
|
|
137 |
|
|
// Interval and watchdog status
|
138 |
|
|
#define TSR_ENW 0x80000000 // Enable next watchdog
|
139 |
|
|
#define TSR_WIS 0x40000000 // Watchdog interrupt pending
|
140 |
|
|
#define TSR_WRS 0x30000000 // Watchdog reset state
|
141 |
|
|
#define TSR_WRS_None 0x00000000 // No watchdog reset
|
142 |
|
|
#define TSR_WRS_Core 0x10000000 // Core reset by watchdog
|
143 |
|
|
#define TSR_WRS_Chip 0x20000000 // Chip reset by watchdog
|
144 |
|
|
#define TSR_WRS_System 0x30000000 // System reset by watchdog
|
145 |
|
|
#define TSR_PIS 0x08000000 // Programmable timer interrupt
|
146 |
|
|
#define TSR_FIS 0x04000000 // Fixed timer interrupt
|
147 |
|
|
|
148 |
|
|
// Debug registers
|
149 |
|
|
#define SPR_DBSR 1008
|
150 |
|
|
#define SPR_DBCR 1010
|
151 |
|
|
|
152 |
|
|
#define DBCR_IDM 0x40000000 // Internal debug enable
|
153 |
|
|
#define DBCR_IC 0x08000000 // Instruction completion
|
154 |
|
|
|
155 |
|
|
#endif // CYGARC_HAL_COMMON_EXPORT_CPU_MACROS
|
156 |
|
|
|
157 |
|
|
//-----------------------------------------------------------------------------
|
158 |
|
|
#endif // ifdef CYGONCE_HAL_VAR_REGS_H
|
159 |
|
|
// End of var_regs.h
|