tkernel_2/kernel/sysdepend/cpu/em1d/cpu_insn.h | bare source | permlink (0.09 seconds) |
1: /* 2: *---------------------------------------------------------------------- 3: * T-Kernel 2.0 Software Package 4: * 5: * Copyright 2011 by Ken Sakamura. 6: * This software is distributed under the latest version of T-License 2.x. 7: *---------------------------------------------------------------------- 8: * 9: * Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17. 10: * Modified by TRON Forum(http://www.tron.org/) at 2015/06/01. 11: * 12: *---------------------------------------------------------------------- 13: */ 14: 15: /* 16: * cpu_insn.h (EM1-D512) 17: * EM1-D512 Dependent Operation 18: */ 19: 20: #ifndef _CPU_INSN_ 21: #define _CPU_INSN_ 22: 23: #include <sys/sysinfo.h> 24: 25: /* ------------------------------------------------------------------------ */ 26: /* 27: * Control register operation 28: */ 29: 30: /* 31: * Get CPSR 32: */ 33: Inline UINT getCPSR( void ) 34: { 35: UINT cpsr; 36: Asm("mrs %0, cpsr": "=r"(cpsr)); 37: return cpsr; 38: } 39: 40: /* 41: * TLB disable 42: */ 43: Inline void PurgeTLB( void ) 44: { 45: Asm("mcr p15, 0, %0, cr8, c7, 0":: "r"(0)); 46: DSB(); ISB(); 47: } 48: 49: /* ------------------------------------------------------------------------ */ 50: /* 51: * EIT-related 52: */ 53: 54: /* 55: * Vector numbers used by the T-Monitor 56: */ 57: #define VECNO_DEFAULT EIT_DEFAULT /* default handler */ 58: #define VECNO_IDEBUG EIT_IDEBUG /* debug abort instruction */ 59: #define VECNO_DDEBUG EIT_DDEBUG /* debug abort data */ 60: #define VECNO_MONITOR SWI_MONITOR /* monitor service call */ 61: #define VECNO_ABORTSW EIT_GPIO(8) /* abort switch */ 62: 63: #define VECNO_GIO0 EIT_IRQ(50) /* Generic handler for GPIO interrupt */ 64: #define VECNO_GIO1 EIT_IRQ(51) 65: #define VECNO_GIO2 EIT_IRQ(52) 66: #define VECNO_GIO3 EIT_IRQ(53) 67: #define VECNO_GIO4 EIT_IRQ(79) 68: #define VECNO_GIO5 EIT_IRQ(80) 69: #define VECNO_GIO6 EIT_IRQ(26) 70: #define VECNO_GIO7 EIT_IRQ(27) 71: 72: /* 73: * To save monitor exception handler 74: */ 75: typedef struct monhdr { 76: FP default_hdr; /* default handler */ 77: FP idebug_hdr; /* debug abort instruction */ 78: FP ddebug_hdr; /* debug abort data */ 79: FP monitor_hdr; /* monitor service call */ 80: FP abortsw_hdr; /* abort swiitch */ 81: FP gio_hdr[8]; /* Generic handler for GPIO interrupt */ 82: } MONHDR; 83: 84: /* For saving monitor exception handler */ 85: IMPORT MONHDR SaveMonHdr; 86: 87: /* 88: * Set interrupt handler 89: */ 90: Inline void define_inthdr( INT vecno, FP inthdr ) 91: { 92: SCArea->intvec[vecno] = inthdr; 93: } 94: 95: /* 96: * If it is the task-independent part, TRUE 97: */ 98: Inline BOOL isTaskIndependent( void ) 99: { 100: return ( SCInfo.taskindp > 0 )? TRUE: FALSE; 101: } 102: 103: /* 104: * Move to/Restore task independent part 105: */ 106: Inline void EnterTaskIndependent( void ) 107: { 108: SCInfo.taskindp++; 109: } 110: Inline void LeaveTaskIndependent( void ) 111: { 112: SCInfo.taskindp--; 113: } 114: 115: /* ------------------------------------------------------------------------ */ 116: 117: #endif /* _CPU_INSN_ */