mtkernel_3/include/tk/sysdepend/cpu/core/armv7m/syslib.h | bare source | permlink (0.00 seconds) |
1: /* 2: *---------------------------------------------------------------------- 3: * micro T-Kernel 3.00.03 4: * 5: * Copyright (C) 2006-2021 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 2021/03/31. 10: * 11: *---------------------------------------------------------------------- 12: */ 13: 14: /* 15: * syslib.h 16: * 17: * micro T-Kernel System Library (ARMv7-M core depended) 18: */ 19: 20: #ifndef __TK_SYSLIB_DEPEND_CORE_H__ 21: #define __TK_SYSLIB_DEPEND_CORE_H__ 22: 23: #include <tk/errno.h> 24: #include <sys/sysdef.h> 25: 26: /*----------------------------------------------------------------------*/ 27: /* 28: * CPU interrupt control for ARMv7-M. 29: * As armv7-m architecture does not support disable interrupt in 30: * xpsr register, we have to raise the excution priority to 31: * that the interrupt group have. Write the BASEPRI to implement 32: * disint. 33: */ 34: 35: IMPORT void set_basepri(UW intsts); /* Set Base Priority register */ 36: IMPORT UW get_basepri(void); /* Get Base Priority register */ 37: IMPORT UW disint(void); /* Disable interrupt */ 38: 39: 40: #define DI(intsts) ( (intsts) = disint() ) 41: #define EI(intsts) ( set_basepri(intsts) ) 42: #define isDI(intsts) ( (intsts) != 0 ) 43: 44: #define INTLEVEL_DI (0) 45: #define INTLEVEL_EI (255) 46: 47: /* 48: * Interrupt priority grouping 49: * 50: * PRIGROUP in the AIRCR register determins the split of group 51: * priority from subpriority. PRIGROUP is initialized to 3 52: * (pri:subpri = 4:4)) in the boot sequence. 53: */ 54: #define INTPRI_GROUP(pri, subpri) (((pri) << (8-INTPRI_BITWIDTH)) | (subpri)) 55: 56: 57: /* ------------------------------------------------------------------------ */ 58: /* 59: * Convert to interrupt definition number 60: * 61: * For backward compatibility. 62: * INTVEC has been obsoleted since micro T-Kernel 2.0. 63: */ 64: #define DINTNO(intvec) (intvec) 65: 66: #endif /* __TK_SYSLIB_DEPEND_CORE_H__ */