From 7a6a1679a413987ffa47f2f9892e241f3448f5f0 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 24 May 2012 18:31:34 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4232 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/ports/RVCT/ARMCMx/chcore.h | 8 +++++++- os/ports/RVCT/ARMCMx/chcore_v6m.h | 9 +++++++++ os/ports/RVCT/ARMCMx/chcore_v7m.h | 13 ++++++++++--- 3 files changed, 26 insertions(+), 4 deletions(-) (limited to 'os/ports/RVCT/ARMCMx') diff --git a/os/ports/RVCT/ARMCMx/chcore.h b/os/ports/RVCT/ARMCMx/chcore.h index 950cc571f..ef3bc623c 100644 --- a/os/ports/RVCT/ARMCMx/chcore.h +++ b/os/ports/RVCT/ARMCMx/chcore.h @@ -86,6 +86,12 @@ #define CORTEX_IS_VALID_PRIORITY(n) \ (((n) >= 0) && ((n) < CORTEX_PRIORITY_LEVELS)) +/** + * @brief Priority level verification macro. + */ +#define CORTEX_IS_VALID_KERNEL_PRIORITY(n) \ + (((n) >= CORTEX_MAX_KERNEL_PRIORITY) && ((n) < CORTEX_PRIORITY_LEVELS)) + /** * @brief Priority level to priority mask conversion macro. */ @@ -169,7 +175,7 @@ struct intctx {}; */ #define chSchIsPreemptionRequired() \ (currp->p_preempt ? firstprio(&rlist.r_queue) > currp->p_prio : \ - firstprio(&rlist.r_queue) >= currp->p_prio) + firstprio(&rlist.r_queue) >= currp->p_prio) #else /* CH_TIME_QUANTUM == 0 */ #define chSchIsPreemptionRequired() \ (firstprio(&rlist.r_queue) > currp->p_prio) diff --git a/os/ports/RVCT/ARMCMx/chcore_v6m.h b/os/ports/RVCT/ARMCMx/chcore_v6m.h index e659912ee..685eddaef 100644 --- a/os/ports/RVCT/ARMCMx/chcore_v6m.h +++ b/os/ports/RVCT/ARMCMx/chcore_v6m.h @@ -107,6 +107,15 @@ /* Port derived parameters. */ /*===========================================================================*/ +/** + * @brief Maximum usable priority for normal ISRs. + */ +#if CORTEX_ALTERNATE_SWITCH || defined(__DOXYGEN__) +#define CORTEX_MAX_KERNEL_PRIORITY 1 +#else +#define CORTEX_MAX_KERNEL_PRIORITY 0 +#endif + /*===========================================================================*/ /* Port exported info. */ /*===========================================================================*/ diff --git a/os/ports/RVCT/ARMCMx/chcore_v7m.h b/os/ports/RVCT/ARMCMx/chcore_v7m.h index c31bbcffe..8ff4f630f 100644 --- a/os/ports/RVCT/ARMCMx/chcore_v7m.h +++ b/os/ports/RVCT/ARMCMx/chcore_v7m.h @@ -129,7 +129,7 @@ * @brief NVIC VTOR initialization expression. */ #if !defined(CORTEX_VTOR_INIT) || defined(__DOXYGEN__) -#define CORTEX_VTOR_INIT 0x00000000 +#define CORTEX_VTOR_INIT 0x00000000 #endif /** @@ -145,14 +145,21 @@ /* Port derived parameters. */ /*===========================================================================*/ +#if !CORTEX_SIMPLIFIED_PRIORITY || defined(__DOXYGEN__) +/** + * @brief Maximum usable priority for normal ISRs. + */ +#define CORTEX_MAX_KERNEL_PRIORITY (CORTEX_PRIORITY_SVCALL + 1) + /** * @brief BASEPRI level within kernel lock. * @note In compact kernel mode this constant value is enforced to zero. */ -#if !CORTEX_SIMPLIFIED_PRIORITY || defined(__DOXYGEN__) #define CORTEX_BASEPRI_KERNEL \ - CORTEX_PRIORITY_MASK(CORTEX_PRIORITY_SVCALL+1) + CORTEX_PRIORITY_MASK(CORTEX_MAX_KERNEL_PRIORITY) #else + +#define CORTEX_MAX_KERNEL_PRIORITY 1 #define CORTEX_BASEPRI_KERNEL 0 #endif -- cgit v1.2.3