[32f415d] | 1 | /* mips.h |
---|
[f198c63] | 2 | * |
---|
[32f415d] | 3 | * COPYRIGHT (c) 1989-2000. |
---|
[f198c63] | 4 | * On-Line Applications Research Corporation (OAR). |
---|
| 5 | * |
---|
[98e4ebf5] | 6 | * The license and distribution terms for this file may be |
---|
| 7 | * found in the file LICENSE in this distribution or at |
---|
[03f2154e] | 8 | * http://www.OARcorp.com/rtems/license.html. |
---|
[f198c63] | 9 | * |
---|
[cda277f] | 10 | * $Id$ |
---|
[f198c63] | 11 | */ |
---|
| 12 | /* @(#)mips64orion.h 08/29/96 1.3 */ |
---|
| 13 | |
---|
[fda47cd] | 14 | #ifndef _INCLUDE_MIPS_h |
---|
| 15 | #define _INCLUDE_MIPS_h |
---|
[f198c63] | 16 | |
---|
| 17 | #ifdef __cplusplus |
---|
| 18 | extern "C" { |
---|
| 19 | #endif |
---|
| 20 | |
---|
| 21 | /* |
---|
| 22 | * This file contains the information required to build |
---|
| 23 | * RTEMS for a particular member of the "no cpu" |
---|
| 24 | * family when executing in protected mode. It does |
---|
| 25 | * this by setting variables to indicate which implementation |
---|
| 26 | * dependent features are present in a particular member |
---|
| 27 | * of the family. |
---|
| 28 | */ |
---|
| 29 | |
---|
[fda47cd] | 30 | #if defined(__mips_soft_float) |
---|
| 31 | #define MIPS_HAS_FPU 0 |
---|
| 32 | #else |
---|
| 33 | #define MIPS_HAS_FPU 1 |
---|
| 34 | #endif |
---|
[f198c63] | 35 | |
---|
[fda47cd] | 36 | #if (__mips == 1) |
---|
| 37 | #define CPU_MODEL_NAME "ISA Level 1 or 2" |
---|
| 38 | #elif (__mips == 3) |
---|
| 39 | #if defined(__mips64) |
---|
| 40 | #define CPU_MODEL_NAME "ISA Level 4" |
---|
[f198c63] | 41 | #else |
---|
[fda47cd] | 42 | #define CPU_MODEL_NAME "ISA Level 3" |
---|
| 43 | #endif |
---|
| 44 | #else |
---|
| 45 | #error "Unknown MIPS ISA level" |
---|
[f198c63] | 46 | #endif |
---|
| 47 | |
---|
| 48 | /* |
---|
| 49 | * Define the name of the CPU family. |
---|
| 50 | */ |
---|
| 51 | |
---|
[fda47cd] | 52 | #define CPU_NAME "MIPS" |
---|
[f198c63] | 53 | |
---|
[32f415d] | 54 | /* |
---|
| 55 | * Some macros to access registers |
---|
| 56 | */ |
---|
| 57 | |
---|
| 58 | #define mips_get_sr( _x ) \ |
---|
| 59 | do { \ |
---|
| 60 | asm volatile( "mfc0 %0, $12; nop" : "=g" (_x) : ); \ |
---|
| 61 | } while (0) |
---|
| 62 | |
---|
| 63 | #define mips_set_sr( _x ) \ |
---|
| 64 | do { \ |
---|
| 65 | unsigned int __x = (_x); \ |
---|
| 66 | asm volatile( "mtc0 %0, $12; nop" : : "r" (__x) ); \ |
---|
| 67 | } while (0) |
---|
| 68 | |
---|
| 69 | /* |
---|
| 70 | * Manipulate interrupt mask |
---|
| 71 | * |
---|
| 72 | * mips_unmask_interrupt( _mask) |
---|
| 73 | * enables interrupts - mask is positioned so it only needs to be or'ed |
---|
| 74 | * into the status reg. This also does some other things !!!! Caution |
---|
| 75 | * should be used if invoking this while in the middle of a debugging |
---|
| 76 | * session where the client may have nested interrupts. |
---|
| 77 | * |
---|
| 78 | * mips_mask_interrupt( _mask ) |
---|
| 79 | * disable the interrupt - mask is the complement of the bits to be |
---|
| 80 | * cleared - i.e. to clear ext int 5 the mask would be - 0xffff7fff |
---|
| 81 | * |
---|
| 82 | * |
---|
| 83 | * NOTE: mips_mask_interrupt() used to be disable_int(). |
---|
| 84 | * mips_unmask_interrupt() used to be enable_int(). |
---|
| 85 | * |
---|
| 86 | */ |
---|
| 87 | |
---|
| 88 | #define mips_enable_in_interrupt_mask( _mask ) \ |
---|
| 89 | do { \ |
---|
| 90 | unsigned int _sr; \ |
---|
| 91 | mips_get_sr( _sr ); \ |
---|
| 92 | _sr |= (_mask) | SR_IEC; \ |
---|
| 93 | mips_set_sr( _sr ); \ |
---|
| 94 | } while (0) |
---|
| 95 | |
---|
| 96 | #define mips_disable_in_interrupt_mask( _mask ) \ |
---|
| 97 | do { \ |
---|
| 98 | unsigned int _sr; \ |
---|
| 99 | mips_get_sr( _sr ); \ |
---|
| 100 | _sr &= ~(_mask); \ |
---|
| 101 | mips_set_sr( _sr ); \ |
---|
| 102 | } while (0) |
---|
| 103 | |
---|
[f198c63] | 104 | #ifdef __cplusplus |
---|
| 105 | } |
---|
| 106 | #endif |
---|
| 107 | |
---|
[fda47cd] | 108 | #endif /* ! _INCLUDE_MIPS_h */ |
---|
[f198c63] | 109 | /* end of include file */ |
---|