Minor changes in AIC pseudo driver.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10402 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
Rocco Marco Guglielmi 2017-08-11 17:15:04 +00:00
parent 22ad7e95ef
commit 701c73b0ca
2 changed files with 39 additions and 29 deletions

View File

@ -44,6 +44,32 @@
/* Driver local functions. */ /* Driver local functions. */
/*===========================================================================*/ /*===========================================================================*/
/*===========================================================================*/
/* Driver local macros. */
/*===========================================================================*/
/**
* @brief Enable write protection on AIC registers block.
*
* @param[in] aicp pointer to a AIC register block
*
* @notapi
*/
#define aicEnableWP(aicp) { \
aicp->AIC_WPMR = AIC_WPMR_WPKEY_PASSWD | AIC_WPMR_WPEN; \
}
/**
* @brief Disable write protection on AIC registers block.
*
* @param[in] aicp pointer to a AIC register block
*
* @notapi
*/
#define aicDisableWP(aicp) { \
aicp->AIC_WPMR = AIC_WPMR_WPKEY_PASSWD; \
}
/*===========================================================================*/ /*===========================================================================*/
/* Driver exported functions. */ /* Driver exported functions. */
/*===========================================================================*/ /*===========================================================================*/
@ -73,15 +99,17 @@ void aicInit(void) {
/** /**
* @brief Configures an interrupt in the AIC. * @brief Configures an interrupt in the AIC.
* @note Source cannot be ID_SAIC_FIQ (0).
* *
* @param[in] source interrupt source to configure * @param[in] source interrupt source to configure
* @param[in] prior priority level of the source selected * @param[in] priority priority level of the selected source.
* by INTSEL except FIQ source (source 0).
*/ */
void aicConfigureInt(uint32_t source, uint8_t prior) { void aicSetSourcePriority(uint32_t source, uint8_t priority) {
Aic *aic = SAIC; Aic *aic = SAIC;
osalDbgCheck(source != ID_SAIC_FIQ);
/* Disable write protection */ /* Disable write protection */
aicDisableWP(aic); aicDisableWP(aic);
/* Set source id */ /* Set source id */
@ -89,7 +117,7 @@ void aicConfigureInt(uint32_t source, uint8_t prior) {
/* Disable the interrupt first */ /* Disable the interrupt first */
aic->AIC_IDCR = AIC_IDCR_INTD; aic->AIC_IDCR = AIC_IDCR_INTD;
/* Configure priority */ /* Configure priority */
aic->AIC_SMR = AIC_SMR_PRIOR(prior); aic->AIC_SMR = AIC_SMR_PRIOR(priority);
/* Clear interrupt */ /* Clear interrupt */
aic->AIC_ICCR = AIC_ICCR_INTCLR; aic->AIC_ICCR = AIC_ICCR_INTCLR;
/* Enable write protection */ /* Enable write protection */
@ -97,12 +125,12 @@ void aicConfigureInt(uint32_t source, uint8_t prior) {
} }
/** /**
* @brief Sets the source vector of an interrupt. * @brief Sets the source handler of an interrupt.
* *
* @param[in] source interrupt source to configure * @param[in] source interrupt source to configure
* @param[in] handler handler for the interrupt source selected * @param[in] handler handler for the interrupt source selected
*/ */
void aicSetSourceVector(uint32_t source, bool (*handler)(void)) { void aicSetSourceHandler(uint32_t source, bool (*handler)(void)) {
Aic *aic = SAIC; Aic *aic = SAIC;
@ -116,11 +144,11 @@ void aicSetSourceVector(uint32_t source, bool (*handler)(void)) {
} }
/** /**
* @brief Sets the spurious vector of an interrupt. * @brief Sets the spurious handler of an interrupt.
* *
* @param[in] handler handler for the interrupt * @param[in] handler handler for the interrupt
*/ */
void aicSetSpuriousVector(bool (*handler)(void)) { void aicSetSpuriousHandler(bool (*handler)(void)) {
Aic *aic = SAIC; Aic *aic = SAIC;

View File

@ -44,25 +44,7 @@
/*===========================================================================*/ /*===========================================================================*/
/* 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. */
/*===========================================================================*/ /*===========================================================================*/
@ -71,9 +53,9 @@
extern "C" { extern "C" {
#endif #endif
void aicInit(void); void aicInit(void);
void aicConfigureInt(uint32_t source, uint8_t prior); void aicSetSourcePriority(uint32_t source, uint8_t priority);
void aicSetSourceVector(uint32_t source, bool (*handler)(void)); void aicSetSourceHandler(uint32_t source, bool (*handler)(void));
void aicSetSpuriousVector(bool (*handler)(void)); void aicSetSpuriousHandler(bool (*handler)(void));
void aicEnableInt(uint32_t source); void aicEnableInt(uint32_t source);
void aicDisableInt(uint32_t source); void aicDisableInt(uint32_t source);
void aicClearInt(uint32_t source); void aicClearInt(uint32_t source);