aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-04-22 14:05:22 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-04-22 14:05:22 +0000
commit1b12b909635477ebe6ff2b273cfbcd7247473740 (patch)
treea09bafea0a53e7c63f26cec497a6f1efb4b1c4cd /os
parentf0152ab13b753d4e0ebfacc9afa7c574e5c6979a (diff)
downloadChibiOS-1b12b909635477ebe6ff2b273cfbcd7247473740.tar.gz
ChibiOS-1b12b909635477ebe6ff2b273cfbcd7247473740.tar.bz2
ChibiOS-1b12b909635477ebe6ff2b273cfbcd7247473740.zip
PRIGROUP setting is now configurable.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4121 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/ports/GCC/ARMCMx/chcore_v7m.c2
-rw-r--r--os/ports/GCC/ARMCMx/chcore_v7m.h11
-rw-r--r--os/ports/IAR/ARMCMx/chcore_v7m.c2
-rw-r--r--os/ports/IAR/ARMCMx/chcore_v7m.h9
-rw-r--r--os/ports/RVCT/ARMCMx/chcore_v7m.c2
-rw-r--r--os/ports/RVCT/ARMCMx/chcore_v7m.h9
-rw-r--r--os/ports/common/ARMCMx/nvic.h2
7 files changed, 32 insertions, 5 deletions
diff --git a/os/ports/GCC/ARMCMx/chcore_v7m.c b/os/ports/GCC/ARMCMx/chcore_v7m.c
index 8c650a202..a661bb60a 100644
--- a/os/ports/GCC/ARMCMx/chcore_v7m.c
+++ b/os/ports/GCC/ARMCMx/chcore_v7m.c
@@ -112,7 +112,7 @@ void _port_init(void) {
/* Initialization of the vector table and priority related settings.*/
SCB_VTOR = CORTEX_VTOR_INIT;
- SCB_AIRCR = AIRCR_VECTKEY | AIRCR_PRIGROUP(0);
+ SCB_AIRCR = AIRCR_VECTKEY | AIRCR_PRIGROUP(CORTEX_PRIGROUP_INIT);
/* Initialization of the system vectors used by the port.*/
nvicSetSystemHandlerPriority(HANDLER_SVCALL,
diff --git a/os/ports/GCC/ARMCMx/chcore_v7m.h b/os/ports/GCC/ARMCMx/chcore_v7m.h
index 10edcc45b..6fdfd44d6 100644
--- a/os/ports/GCC/ARMCMx/chcore_v7m.h
+++ b/os/ports/GCC/ARMCMx/chcore_v7m.h
@@ -129,7 +129,16 @@
* @brief NVIC VTOR initialization expression.
*/
#if !defined(CORTEX_VTOR_INIT) || defined(__DOXYGEN__)
-#define CORTEX_VTOR_INIT 0x00000000
+#define CORTEX_VTOR_INIT 0x00000000
+#endif
+
+/**
+ * @brief NVIC PRIGROUP initialization expression.
+ * @details The default assigns all available priority bits as preemption
+ * priority with no sub-priority.
+ */
+#if !defined(CORTEX_PRIGROUP_INIT) || defined(__DOXYGEN__)
+#define CORTEX_PRIGROUP_INIT (7 - CORTEX_PRIORITY_BITS)
#endif
/*===========================================================================*/
diff --git a/os/ports/IAR/ARMCMx/chcore_v7m.c b/os/ports/IAR/ARMCMx/chcore_v7m.c
index 2db2d1dd2..ce7f44243 100644
--- a/os/ports/IAR/ARMCMx/chcore_v7m.c
+++ b/os/ports/IAR/ARMCMx/chcore_v7m.c
@@ -112,7 +112,7 @@ void _port_init(void) {
/* Initialization of the vector table and priority related settings.*/
SCB_VTOR = CORTEX_VTOR_INIT;
- SCB_AIRCR = AIRCR_VECTKEY | AIRCR_PRIGROUP(0);
+ SCB_AIRCR = AIRCR_VECTKEY | AIRCR_PRIGROUP(CORTEX_PRIGROUP_INIT);
#if CORTEX_USE_FPU
{
diff --git a/os/ports/IAR/ARMCMx/chcore_v7m.h b/os/ports/IAR/ARMCMx/chcore_v7m.h
index b46ef22f0..24145d409 100644
--- a/os/ports/IAR/ARMCMx/chcore_v7m.h
+++ b/os/ports/IAR/ARMCMx/chcore_v7m.h
@@ -132,6 +132,15 @@
#define CORTEX_VTOR_INIT 0x00000000
#endif
+/**
+ * @brief NVIC PRIGROUP initialization expression.
+ * @details The default assigns all available priority bits as preemption
+ * priority with no sub-priority.
+ */
+#if !defined(CORTEX_PRIGROUP_INIT) || defined(__DOXYGEN__)
+#define CORTEX_PRIGROUP_INIT (7 - CORTEX_PRIORITY_BITS)
+#endif
+
/*===========================================================================*/
/* Port derived parameters. */
/*===========================================================================*/
diff --git a/os/ports/RVCT/ARMCMx/chcore_v7m.c b/os/ports/RVCT/ARMCMx/chcore_v7m.c
index 90dcbf32e..fb11547c6 100644
--- a/os/ports/RVCT/ARMCMx/chcore_v7m.c
+++ b/os/ports/RVCT/ARMCMx/chcore_v7m.c
@@ -114,7 +114,7 @@ void _port_init(void) {
/* Initialization of the vector table and priority related settings.*/
SCB_VTOR = CORTEX_VTOR_INIT;
- SCB_AIRCR = AIRCR_VECTKEY | AIRCR_PRIGROUP(0);
+ SCB_AIRCR = AIRCR_VECTKEY | AIRCR_PRIGROUP(CORTEX_PRIGROUP_INIT);
#if CORTEX_USE_FPU
{
diff --git a/os/ports/RVCT/ARMCMx/chcore_v7m.h b/os/ports/RVCT/ARMCMx/chcore_v7m.h
index 98bbb6358..c31bbcffe 100644
--- a/os/ports/RVCT/ARMCMx/chcore_v7m.h
+++ b/os/ports/RVCT/ARMCMx/chcore_v7m.h
@@ -132,6 +132,15 @@
#define CORTEX_VTOR_INIT 0x00000000
#endif
+/**
+ * @brief NVIC PRIGROUP initialization expression.
+ * @details The default assigns all available priority bits as preemption
+ * priority with no sub-priority.
+ */
+#if !defined(CORTEX_PRIGROUP_INIT) || defined(__DOXYGEN__)
+#define CORTEX_PRIGROUP_INIT (7 - CORTEX_PRIORITY_BITS)
+#endif
+
/*===========================================================================*/
/* Port derived parameters. */
/*===========================================================================*/
diff --git a/os/ports/common/ARMCMx/nvic.h b/os/ports/common/ARMCMx/nvic.h
index e4b6757a0..7188c4bcd 100644
--- a/os/ports/common/ARMCMx/nvic.h
+++ b/os/ports/common/ARMCMx/nvic.h
@@ -189,7 +189,7 @@ typedef struct {
#define AIRCR_VECTKEY 0x05FA0000U
#define AIRCR_PRIGROUP_MASK (0x7U << 8)
-#define AIRCR_PRIGROUP(n) ((n##U) << 8)
+#define AIRCR_PRIGROUP(n) ((n) << 8)
/**
* @brief Structure representing the FPU I/O space.