mtkernel_3/kernel/sysdepend/cpu/core/rxv2/cpu_task.h | bare source | permlink (0.02 seconds) |
1: /* 2: *---------------------------------------------------------------------- 3: * micro T-Kernel 3.00.01 4: * 5: * Copyright (C) 2006-2020 by Ken Sakamura. 6: * This software is distributed under the T-License 2.2. 7: *---------------------------------------------------------------------- 8: * 9: * Released by TRON Forum(http://www.tron.org) at 2020/05/29. 10: * 11: *---------------------------------------------------------------------- 12: */ 13: 14: /* 15: * cpu_task.h (RXv2) 16: * CPU-Dependent Task Start Processing 17: */ 18: 19: #ifndef _SYSDEPEND_CPU_CORE_CPUTASK_ 20: #define _SYSDEPEND_CPU_CORE_CPUTASK_ 21: 22: /* 23: * System stack configuration at task startup 24: */ 25: typedef struct { 26: #if USE_DSP 27: UW acc0lo; 28: UW acc0hi; 29: VW acc0gu; /* Saved ACC0 */ 30: UW acc1lo; 31: UW acc1hi; 32: VW acc1gu; /* Saved ACC1 */ 33: #endif 34: #if USE_FPU 35: VW fpsw; /* Saved FPSW */ 36: #endif 37: VW r[15]; /* R1-R15 */ 38: void *spc; /* Saved return PC */ 39: VW spsw; /* Saved PSW */ 40: } SStackFrame; 41: 42: /* 43: * Size of system stack area destroyed by 'make_dormant()' 44: * In other words, the size of area required to write by 'setup_context().' 45: */ 46: #if USE_FPU && USE_DSP 47: #define DORMANT_STACK_SIZE ( sizeof(VW) * 24 ) /* To 'spsw', 'spc', 'acc0', 'acc1', 'fpsw' position */ 48: #elif USE_DSP 49: #define DORMANT_STACK_SIZE ( sizeof(VW) * 23 ) /* To 'spsw', 'spc', 'acc0', 'acc1' position */ 50: #elif USE_FPU 51: #define DORMANT_STACK_SIZE ( sizeof(VW) * 18 ) /* To 'spsw', 'spc', 'fpsw' position */ 52: #else 53: #define DORMANT_STACK_SIZE ( sizeof(VW) * 2 ) /* To 'spsw' and 'spc' position */ 54: #endif 55: 56: /* 57: * Create stack frame for task startup 58: * Call from 'make_dormant()' 59: */ 60: Inline void knl_setup_context( TCB *tcb ) 61: { 62: SStackFrame *ssp; 63: void *pc; 64: VW psw; 65: 66: ssp = (SStackFrame*)((UB*)(tcb->isstack) - (UB*)(sizeof(SStackFrame))); 67: 68: psw = 0x00010000UL; 69: pc = (void*)tcb->task; 70: 71: /* CPU context initialization */ 72: ssp->spsw = psw; /* Initial PSW */ 73: ssp->spc = pc; /* Task startup address */ 74: #if USE_FPU 75: ssp->fpsw = FPSW_VAL; 76: #endif 77: tcb->tskctxb.ssp = ssp; /* System stack */ 78: } 79: 80: /* 81: * Set task startup code 82: * Called by 'tk_sta_tsk()' processing. 83: */ 84: Inline void knl_setup_stacd( TCB *tcb, INT stacd ) 85: { 86: SStackFrame *ssp = tcb->tskctxb.ssp; 87: 88: ssp->r[0] = stacd; /* R1 */ 89: ssp->r[1] = (VW)tcb->exinf; /* R2 */ 90: } 91: 92: /* 93: * Delete task contexts 94: */ 95: Inline void knl_cleanup_context( TCB *tcb ) 96: { 97: } 98: 99: #endif /* _SYSDEPEND_CPU_CORE_CPUTASK_ */