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/GCC/ARMCMx/chcore.h | 6 ++++++ os/ports/GCC/ARMCMx/chcore_v6m.h | 9 +++++++++ os/ports/GCC/ARMCMx/chcore_v7m.h | 11 +++++++++-- os/ports/IAR/ARMCMx/chcore.h | 8 +++++++- os/ports/IAR/ARMCMx/chcore_v6m.h | 9 +++++++++ os/ports/IAR/ARMCMx/chcore_v7m.h | 13 ++++++++++--- os/ports/RVCT/ARMCMx/chcore.h | 8 +++++++- os/ports/RVCT/ARMCMx/chcore_v6m.h | 9 +++++++++ os/ports/RVCT/ARMCMx/chcore_v7m.h | 13 ++++++++++--- 9 files changed, 76 insertions(+), 10 deletions(-) (limited to 'os/ports') diff --git a/os/ports/GCC/ARMCMx/chcore.h b/os/ports/GCC/ARMCMx/chcore.h index 18ee5a364..ec534fdb2 100644 --- a/os/ports/GCC/ARMCMx/chcore.h +++ b/os/ports/GCC/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. */ diff --git a/os/ports/GCC/ARMCMx/chcore_v6m.h b/os/ports/GCC/ARMCMx/chcore_v6m.h index b36e405ea..76bfbf184 100644 --- a/os/ports/GCC/ARMCMx/chcore_v6m.h +++ b/os/ports/GCC/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/GCC/ARMCMx/chcore_v7m.h b/os/ports/GCC/ARMCMx/chcore_v7m.h index 6fdfd44d6..ea9b8dab5 100644 --- a/os/ports/GCC/ARMCMx/chcore_v7m.h +++ b/os/ports/GCC/ARMCMx/chcore_v7m.h @@ -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 diff --git a/os/ports/IAR/ARMCMx/chcore.h b/os/ports/IAR/ARMCMx/chcore.h index fd21b92ac..a3e9733f0 100644 --- a/os/ports/IAR/ARMCMx/chcore.h +++ b/os/ports/IAR/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. */ @@ -170,7 +176,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/IAR/ARMCMx/chcore_v6m.h b/os/ports/IAR/ARMCMx/chcore_v6m.h index 1b79f2b25..a63bd1f18 100644 --- a/os/ports/IAR/ARMCMx/chcore_v6m.h +++ b/os/ports/IAR/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/IAR/ARMCMx/chcore_v7m.h b/os/ports/IAR/ARMCMx/chcore_v7m.h index 24145d409..413f36707 100644 --- a/os/ports/IAR/ARMCMx/chcore_v7m.h +++ b/os/ports/IAR/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 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