aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports
diff options
context:
space:
mode:
authorRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2017-09-17 17:08:12 +0000
committerRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2017-09-17 17:08:12 +0000
commit11e716fc01279f46672b849f24b76415baeda15f (patch)
tree0365cea7f07998a4542a2c462759e22ecadd3c0b /os/hal/ports
parent65874b21bdef35bb11bde0316b7b788005b14f5c (diff)
downloadChibiOS-11e716fc01279f46672b849f24b76415baeda15f.tar.gz
ChibiOS-11e716fc01279f46672b849f24b76415baeda15f.tar.bz2
ChibiOS-11e716fc01279f46672b849f24b76415baeda15f.zip
Improved AIC to work with both secure and non secure mode.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10621 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports')
-rw-r--r--os/hal/ports/SAMA/SAMA5D2x/aic.c10
-rw-r--r--os/hal/ports/SAMA/SAMA5D2x/aic.h10
2 files changed, 17 insertions, 3 deletions
diff --git a/os/hal/ports/SAMA/SAMA5D2x/aic.c b/os/hal/ports/SAMA/SAMA5D2x/aic.c
index a63b533c3..9c0ef2a57 100644
--- a/os/hal/ports/SAMA/SAMA5D2x/aic.c
+++ b/os/hal/ports/SAMA/SAMA5D2x/aic.c
@@ -82,7 +82,17 @@
*/
void aicInit(void) {
+#if SAMA_HAL_IS_SECURE
Aic *aic = SAIC;
+ /* Redirect interrupts */
+ uint32_t aicredir = SFR_AICREDIR_AICREDIRKEY(AIC_REDIR_KEY);
+ SFR->SFR_AICREDIR = (aicredir ^ SFR->SFR_SN1);
+#else
+ Aic *aic = AIC;
+ /* Redirect interrupts */
+ uint32_t aicredir = SFR_AICREDIR_AICREDIRKEY(AIC_REDIR_KEY);
+ SFR->SFR_AICREDIR = (aicredir ^ SFR->SFR_SN1) | SFR_AICREDIR_NSAIC;
+#endif
unsigned i;
/* Disable all interrupts */
diff --git a/os/hal/ports/SAMA/SAMA5D2x/aic.h b/os/hal/ports/SAMA/SAMA5D2x/aic.h
index 92a924b31..defee9d30 100644
--- a/os/hal/ports/SAMA/SAMA5D2x/aic.h
+++ b/os/hal/ports/SAMA/SAMA5D2x/aic.h
@@ -29,6 +29,11 @@
/* Driver constants. */
/*===========================================================================*/
+/**
+ * @brief AIC unique redirect key.
+ */
+#define AIC_REDIR_KEY 0x5B6C0E26U
+
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@@ -47,10 +52,9 @@
/**
* @brief Acknowledge the current interrupt.
- *
*/
-#define aicAckInt() { \
- SAIC->AIC_EOICR = AIC_EOICR_ENDIT; \
+#define aicAckInt() { \
+ SAIC->AIC_EOICR = AIC_EOICR_ENDIT; \
}
/*===========================================================================*/