Added macros Enabled/Disabled write protection
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10398 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
a152d4e545
commit
b2bd02f3df
|
@ -83,7 +83,7 @@ void aicConfigureInt(uint32_t source, uint8_t prior) {
|
||||||
Aic *aic = SAIC;
|
Aic *aic = SAIC;
|
||||||
|
|
||||||
/* Disable write protection */
|
/* Disable write protection */
|
||||||
aic->AIC_WPMR = AIC_WPMR_WPKEY_PASSWD;
|
aicDisableWP(aic);
|
||||||
/* Set source id */
|
/* Set source id */
|
||||||
aic->AIC_SSR = source;
|
aic->AIC_SSR = source;
|
||||||
/* Disable the interrupt first */
|
/* Disable the interrupt first */
|
||||||
|
@ -93,7 +93,7 @@ void aicConfigureInt(uint32_t source, uint8_t prior) {
|
||||||
/* Clear interrupt */
|
/* Clear interrupt */
|
||||||
aic->AIC_ICCR = AIC_ICCR_INTCLR;
|
aic->AIC_ICCR = AIC_ICCR_INTCLR;
|
||||||
/* Enable write protection */
|
/* Enable write protection */
|
||||||
aic->AIC_WPMR = AIC_WPMR_WPKEY_PASSWD | AIC_WPMR_WPEN;
|
aicEnableWP(aic);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,12 +107,12 @@ void aicSetSourceVector(uint32_t source, bool (*handler)(void)) {
|
||||||
Aic *aic = SAIC;
|
Aic *aic = SAIC;
|
||||||
|
|
||||||
/* Disable write protection */
|
/* Disable write protection */
|
||||||
aic->AIC_WPMR = AIC_WPMR_WPKEY_PASSWD;
|
aicDisableWP(aic);
|
||||||
/* Select source and assign handler */
|
/* Select source and assign handler */
|
||||||
aic->AIC_SSR = AIC_SSR_INTSEL(source);
|
aic->AIC_SSR = AIC_SSR_INTSEL(source);
|
||||||
aic->AIC_SVR = (uint32_t)handler;
|
aic->AIC_SVR = (uint32_t)handler;
|
||||||
/* Enable write protection */
|
/* Enable write protection */
|
||||||
aic->AIC_WPMR = AIC_WPMR_WPKEY_PASSWD | AIC_WPMR_WPEN;
|
aicEnableWP(aic);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -125,11 +125,11 @@ void aicSetSpuriousVector(bool (*handler)(void)) {
|
||||||
Aic *aic = SAIC;
|
Aic *aic = SAIC;
|
||||||
|
|
||||||
/* Disable write protection */
|
/* Disable write protection */
|
||||||
aic->AIC_WPMR = AIC_WPMR_WPKEY_PASSWD;
|
aicDisableWP(aic);
|
||||||
/* Assign handler */
|
/* Assign handler */
|
||||||
aic->AIC_SPU = (uint32_t)handler;
|
aic->AIC_SPU = (uint32_t)handler;
|
||||||
/* Enable write protection */
|
/* Enable write protection */
|
||||||
aic->AIC_WPMR = AIC_WPMR_WPKEY_PASSWD | AIC_WPMR_WPEN;
|
aicEnableWP(aic);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -44,7 +44,25 @@
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver macros. */
|
/* Driver macros. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
/**
|
||||||
|
* @brief Enable write protection on AIC registers block.
|
||||||
|
*
|
||||||
|
* @param[in] aicx pointer to a AIC register block
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
#define aicEnableWP(aic) { \
|
||||||
|
aic->AIC_WPMR = AIC_WPMR_WPKEY_PASSWD | AIC_WPMR_WPEN; \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disable write protection on AIC registers block.
|
||||||
|
*
|
||||||
|
* @param[in] aicx pointer to a AIC register block
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
#define aicDisableWP(aic) { \
|
||||||
|
aic->AIC_WPMR = AIC_WPMR_WPKEY_PASSWD; \
|
||||||
|
}
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* External declarations. */
|
/* External declarations. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
Loading…
Reference in New Issue