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
This commit is contained in:
Rocco Marco Guglielmi 2017-09-17 17:08:12 +00:00
parent 65874b21bd
commit 11e716fc01
2 changed files with 17 additions and 3 deletions

View File

@ -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 */

View File

@ -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; \
}
/*===========================================================================*/