source: rtems/cpukit/score/cpu/mips/rtems/score/mips.h @ 4246571b

4.104.114.84.95
Last change on this file since 4246571b was 4246571b, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/03/04 at 00:00:20

2004-04-02 Ralf Corsepius <ralf_corsepius@…>

  • Makefile.am: Install iregdefs.h and idtcpu.h to $(includedir)/rtems/mips.
  • cpu_asm.S: Include <rtems/mips/iregdef.h> instead of <iregdef.h>.
  • rtems/score/mips.h, cpu_asm.S: Include <rtems/mips/idtcpu.h> instead of <idtcpu.h>.
  • Property mode set to 100644
File size: 6.2 KB
Line 
1/*  mips.h
2 *
3 *  COPYRIGHT (c) 1989-2001.
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.com/license/LICENSE.
9 *
10 *  $Id$
11 */
12
13#ifndef _INCLUDE_MIPS_h
14#define _INCLUDE_MIPS_h
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#ifndef ASM
21#include <rtems/mips/idtcpu.h>
22#endif
23
24/*
25 *  SR bits that enable/disable interrupts
26 *
27 *  NOTE: XXX what about SR_ERL?
28 */
29
30#if __mips == 3
31#ifdef ASM
32#define SR_INTERRUPT_ENABLE_BITS 0x01
33#else
34#define SR_INTERRUPT_ENABLE_BITS SR_IE
35#endif
36
37#elif __mips == 1
38#define SR_INTERRUPT_ENABLE_BITS SR_IEC
39
40#else
41#error "mips interrupt enable bits: unknown architecture level!"
42#endif
43
44/*
45 *  This file contains the information required to build
46 *  RTEMS for a particular member of the "no cpu"
47 *  family when executing in protected mode.  It does
48 *  this by setting variables to indicate which implementation
49 *  dependent features are present in a particular member
50 *  of the family.
51 */
52 
53#if defined(__mips_soft_float)
54#define MIPS_HAS_FPU 0
55#else
56#define MIPS_HAS_FPU 1
57#endif
58
59#if (__mips == 1)
60#define CPU_MODEL_NAME  "ISA Level 1 or 2"
61#elif (__mips == 3)
62#if defined(__mips64)
63#define CPU_MODEL_NAME  "ISA Level 4"
64#else
65#define CPU_MODEL_NAME  "ISA Level 3"
66#endif
67#else
68#error "Unknown MIPS ISA level"
69#endif
70
71/*
72 *  Define the name of the CPU family.
73 */
74
75#define CPU_NAME "MIPS"
76
77/*
78 *  RTEMS Vector numbers for exception conditions.  This is a direct
79 *  map to the causes.
80 */
81
82#define MIPS_EXCEPTION_BASE 0
83
84#define MIPS_EXCEPTION_INT              MIPS_EXCEPTION_BASE+0
85#define MIPS_EXCEPTION_MOD              MIPS_EXCEPTION_BASE+1
86#define MIPS_EXCEPTION_TLBL             MIPS_EXCEPTION_BASE+2
87#define MIPS_EXCEPTION_TLBS             MIPS_EXCEPTION_BASE+3
88#define MIPS_EXCEPTION_ADEL             MIPS_EXCEPTION_BASE+4
89#define MIPS_EXCEPTION_ADES             MIPS_EXCEPTION_BASE+5
90#define MIPS_EXCEPTION_IBE              MIPS_EXCEPTION_BASE+6
91#define MIPS_EXCEPTION_DBE              MIPS_EXCEPTION_BASE+7
92#define MIPS_EXCEPTION_SYSCALL          MIPS_EXCEPTION_BASE+8
93#define MIPS_EXCEPTION_BREAK            MIPS_EXCEPTION_BASE+9
94#define MIPS_EXCEPTION_RI               MIPS_EXCEPTION_BASE+10
95#define MIPS_EXCEPTION_CPU              MIPS_EXCEPTION_BASE+11
96#define MIPS_EXCEPTION_OVERFLOW         MIPS_EXCEPTION_BASE+12
97#define MIPS_EXCEPTION_TRAP             MIPS_EXCEPTION_BASE+13
98#define MIPS_EXCEPTION_VCEI             MIPS_EXCEPTION_BASE+14
99/* FPE only on mips2 and higher */
100#define MIPS_EXCEPTION_FPE              MIPS_EXCEPTION_BASE+15
101#define MIPS_EXCEPTION_C2E              MIPS_EXCEPTION_BASE+16
102/* 17-22 reserved */
103#define MIPS_EXCEPTION_WATCH            MIPS_EXCEPTION_BASE+23
104/* 24-30 reserved */
105#define MIPS_EXCEPTION_VCED             MIPS_EXCEPTION_BASE+31
106
107#define MIPS_INTERRUPT_BASE             MIPS_EXCEPTION_BASE+32
108
109/*
110 *  Some macros to access registers
111 */
112
113#define mips_get_sr( _x ) \
114  do { \
115    asm volatile( "mfc0 %0, $12; nop" : "=r" (_x) : ); \
116  } while (0)
117
118#define mips_set_sr( _x ) \
119  do { \
120    register unsigned int __x = (_x); \
121    asm volatile( "mtc0 %0, $12; nop" : : "r" (__x) ); \
122  } while (0)
123
124
125/*
126 *  Access the Cause register
127 */
128
129#define mips_get_cause( _x ) \
130  do { \
131    asm volatile( "mfc0 %0, $13; nop" : "=r" (_x) : ); \
132  } while (0)
133
134
135#define mips_set_cause( _x ) \
136  do { \
137    register unsigned int __x = (_x); \
138    asm volatile( "mtc0 %0, $13; nop" : : "r" (__x) ); \
139  } while (0)
140
141
142
143
144/*
145 *  Access the Debug Cache Invalidate Control register
146 */
147
148#define mips_get_dcic( _x ) \
149  do { \
150    asm volatile( "mfc0 %0, $7; nop" : "=r" (_x) : ); \
151  } while (0)
152
153
154#define mips_set_dcic( _x ) \
155  do { \
156    register unsigned int __x = (_x); \
157    asm volatile( "mtc0 %0, $7; nop" : : "r" (__x) ); \
158  } while (0)
159
160
161
162
163/*
164 *  Access the Breakpoint Program Counter & Mask registers
165 *  (_x for BPC, _y for mask)
166 */
167
168#define mips_get_bpcrm( _x, _y ) \
169  do { \
170    asm volatile( "mfc0 %0, $3; nop" : "=r" (_x) : ); \
171    asm volatile( "mfc0 %0, $11; nop" : "=r" (_y) : ); \
172  } while (0)
173
174
175#define mips_set_bpcrm( _x, _y ) \
176  do { \
177    register unsigned int __x = (_x); \
178    register unsigned int __y = (_y); \
179    asm volatile( "mtc0 %0, $11; nop" : : "r" (__y) ); \
180    asm volatile( "mtc0 %0, $3; nop" : : "r" (__x) ); \
181  } while (0)
182
183
184
185
186
187
188/*
189 *  Access the Breakpoint Data Address & Mask registers
190 *  (_x for BDA, _y for mask)
191 */
192
193#define mips_get_bdarm( _x, _y ) \
194  do { \
195    asm volatile( "mfc0 %0, $5; nop" : "=r" (_x) : ); \
196    asm volatile( "mfc0 %0, $9; nop" : "=r" (_y) : ); \
197  } while (0)
198
199
200#define mips_set_bdarm( _x, _y ) \
201  do { \
202    register unsigned int __x = (_x); \
203    register unsigned int __y = (_y); \
204    asm volatile( "mtc0 %0, $9; nop" : : "r" (__y) ); \
205    asm volatile( "mtc0 %0, $5; nop" : : "r" (__x) ); \
206  } while (0)
207
208
209
210
211
212
213
214/*
215 *  Access FCR31
216 */
217
218#define mips_get_fcr31( _x ) \
219  do { \
220    asm volatile( "cfc1 %0, $31; nop" : "=r" (_x) : ); \
221  } while(0)
222
223
224#define mips_set_fcr31( _x ) \
225  do { \
226    register unsigned int __x = (_x); \
227    asm volatile( "ctc1 %0, $31; nop" : : "r" (__x) ); \
228  } while(0)
229
230
231/*
232 *  Manipulate interrupt mask
233 *
234 *  mips_unmask_interrupt( _mask)
235 *    enables interrupts - mask is positioned so it only needs to be or'ed
236 *    into the status reg. This also does some other things !!!! Caution
237 *    should be used if invoking this while in the middle of a debugging
238 *    session where the client may have nested interrupts.
239 *
240 *  mips_mask_interrupt( _mask )
241 *    disable the interrupt - mask is the complement of the bits to be
242 *    cleared - i.e. to clear ext int 5 the mask would be - 0xffff7fff
243 *
244 *
245 *  NOTE: mips_mask_interrupt() used to be disable_int().
246 *        mips_unmask_interrupt() used to be enable_int().
247 *
248 */
249
250#define mips_enable_in_interrupt_mask( _mask ) \
251  do { \
252    unsigned int _sr; \
253    mips_get_sr( _sr ); \
254    _sr |= (_mask); \
255    mips_set_sr( _sr ); \
256  } while (0)
257
258#define mips_disable_in_interrupt_mask( _mask ) \
259  do { \
260    unsigned int _sr; \
261    mips_get_sr( _sr ); \
262    _sr &= ~(_mask); \
263    mips_set_sr( _sr ); \
264  } while (0)
265
266#ifdef __cplusplus
267}
268#endif
269
270#endif /* ! _INCLUDE_MIPS_h */
271/* end of include file */
Note: See TracBrowser for help on using the repository browser.