Changeset 151
- Timestamp:
- Jul 5, 2017, 3:43:50 PM (7 years ago)
- Location:
- trunk/hal
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/generic/hal_context.h
r17 r151 28 28 // Generic Thread Context API definition (implementation in hal_context.c) 29 29 // 30 // A thread context is defined by the two (core specific) structures hal_c ontext_t31 // and hal_ uzone_t, defined in hal_context.c file, that are accessed with generic30 // A thread context is defined by the two (core specific) structures hal_cpu_context_t 31 // and hal_fpu_context_t, defined in hal_context.c file, that are accessed with generic 32 32 // void* pointers stored in the thread descriptor. 33 33 // - the "hal_context_t" structure is used to store the CPU registers values that 34 34 // have not been saved in the stack by the interrupt handler. 35 // - the "hal_ uzone_t" structure is used to save the FPU registers when required.35 // - the "hal_fpu_context_t" structure is used to save the FPU registers when required. 36 36 ////////////////////////////////////////////////////////////////////////////////////////// 37 37 … … 39 39 40 40 struct thread_s; 41 42 /****************************************************************************************43 * Define various SR values for TSAR-MIPS3244 ***************************************************************************************/45 46 #define SR_USR_MODE 0xFC1147 #define SR_USR_MODE_FPU 0x2000FC1148 #define SR_SYS_MODE 0xFC0049 50 /****************************************************************************************51 * This structure defines the cpu_context for TSAR MIPS32.52 * These registers are saved/restored at each context switch.53 * WARNING : update the hal_cpu_context_save() and hal_cpu_context_restore()54 * functions when modifying this structure.55 ***************************************************************************************/56 57 typedef struct hal_cpu_context_s58 {59 uint32_t s0_16; // slot 060 uint32_t s1_17; // slot 161 uint32_t s2_18; // slot 262 uint32_t s3_19; // slot 363 uint32_t s4_20; // slot 464 uint32_t s5_21; // slot 565 uint32_t s6_22; // slot 666 uint32_t s7_23; // slot 767 uint32_t sp_29; // slot 868 uint32_t fp_30; // slot 969 uint32_t ra_31; // slot 1070 uint32_t c0_sr; // slot 1171 uint32_t c0_th; // slot 1272 uint32_t c2_ptpr; // slot 1373 uint32_t c2_mode; // slot 1474 }75 hal_cpu_context_t;76 77 /****************************************************************************************78 * This structure defines the fpu_context for TSAR MIPS32.79 ***************************************************************************************/80 81 typedef struct hal_fpu_context_s82 {83 uint32_t fpu_regs[32];84 }85 hal_fpu_context_t;86 41 87 42 /**************************************************************************************** -
trunk/hal/tsar_mips32/core/hal_context.c
r62 r151 33 33 34 34 #include <hal_context.h> 35 36 ///////////////////////////////////////////////////////////////////////////////////////// 37 // Define various SR values for TSAR-MIPS32 38 ///////////////////////////////////////////////////////////////////////////////////////// 39 40 #define SR_USR_MODE 0xFC11 41 #define SR_USR_MODE_FPU 0x2000FC11 42 #define SR_SYS_MODE 0xFC00 43 44 ///////////////////////////////////////////////////////////////////////////////////////// 45 // This structure defines the cpu_context for TSAR MIPS32. 46 // These registers are saved/restored at each context switch. 47 // WARNING : update the hal_cpu_context_save() and hal_cpu_context_restore() 48 // functions when modifying this structure. 49 ///////////////////////////////////////////////////////////////////////////////////////// 50 51 typedef struct hal_cpu_context_s 52 { 53 uint32_t s0_16; // slot 0 54 uint32_t s1_17; // slot 1 55 uint32_t s2_18; // slot 2 56 uint32_t s3_19; // slot 3 57 uint32_t s4_20; // slot 4 58 uint32_t s5_21; // slot 5 59 uint32_t s6_22; // slot 6 60 uint32_t s7_23; // slot 7 61 uint32_t sp_29; // slot 8 62 uint32_t fp_30; // slot 9 63 uint32_t ra_31; // slot 10 64 uint32_t c0_sr; // slot 11 65 uint32_t c0_th; // slot 12 66 uint32_t c2_ptpr; // slot 13 67 uint32_t c2_mode; // slot 14 68 } 69 hal_cpu_context_t; 70 71 ///////////////////////////////////////////////////////////////////////////////////////// 72 // This structure defines the fpu_context for TSAR MIPS32. 73 ///////////////////////////////////////////////////////////////////////////////////////// 74 75 typedef struct hal_fpu_context_s 76 { 77 uint32_t fpu_regs[32]; 78 } 79 hal_fpu_context_t; 35 80 36 81 //////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.