aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2017-08-11 17:15:04 +0000
committerRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2017-08-11 17:15:04 +0000
commit701c73b0ca1aafa02fc43d32856f3c103ad8a430 (patch)
treeb09ee458226f74c6dd102eef1498a261b007e5bf
parent22ad7e95efbba79b75155d3718c2578255d19378 (diff)
downloadChibiOS-701c73b0ca1aafa02fc43d32856f3c103ad8a430.tar.gz
ChibiOS-701c73b0ca1aafa02fc43d32856f3c103ad8a430.tar.bz2
ChibiOS-701c73b0ca1aafa02fc43d32856f3c103ad8a430.zip
Minor changes in AIC pseudo driver.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10402 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/hal/ports/SAMA/SAMA5D2x/aic.c44
-rw-r--r--os/hal/ports/SAMA/SAMA5D2x/aic.h24
2 files changed, 39 insertions, 29 deletions
diff --git a/os/hal/ports/SAMA/SAMA5D2x/aic.c b/os/hal/ports/SAMA/SAMA5D2x/aic.c
index 311324a10..a63b533c3 100644
--- a/os/hal/ports/SAMA/SAMA5D2x/aic.c
+++ b/os/hal/ports/SAMA/SAMA5D2x/aic.c
@@ -45,6 +45,32 @@
/*===========================================================================*/
/*===========================================================================*/
+/* 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. */
/*===========================================================================*/
@@ -73,15 +99,17 @@ void aicInit(void) {
/**
* @brief Configures an interrupt in the AIC.
+ * @note Source cannot be ID_SAIC_FIQ (0).
*
* @param[in] source interrupt source to configure
- * @param[in] prior priority level of the source selected
- * by INTSEL except FIQ source (source 0).
+ * @param[in] priority priority level of the selected source.
*/
-void aicConfigureInt(uint32_t source, uint8_t prior) {
+void aicSetSourcePriority(uint32_t source, uint8_t priority) {
Aic *aic = SAIC;
+ osalDbgCheck(source != ID_SAIC_FIQ);
+
/* Disable write protection */
aicDisableWP(aic);
/* Set source id */
@@ -89,7 +117,7 @@ void aicConfigureInt(uint32_t source, uint8_t prior) {
/* Disable the interrupt first */
aic->AIC_IDCR = AIC_IDCR_INTD;
/* Configure priority */
- aic->AIC_SMR = AIC_SMR_PRIOR(prior);
+ aic->AIC_SMR = AIC_SMR_PRIOR(priority);
/* Clear interrupt */
aic->AIC_ICCR = AIC_ICCR_INTCLR;
/* 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] 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;
@@ -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
*/
-void aicSetSpuriousVector(bool (*handler)(void)) {
+void aicSetSpuriousHandler(bool (*handler)(void)) {
Aic *aic = SAIC;
diff --git a/os/hal/ports/SAMA/SAMA5D2x/aic.h b/os/hal/ports/SAMA/SAMA5D2x/aic.h
index efecaf6bb..eff492e66 100644
--- a/os/hal/ports/SAMA/SAMA5D2x/aic.h
+++ b/os/hal/ports/SAMA/SAMA5D2x/aic.h
@@ -44,25 +44,7 @@
/*===========================================================================*/
/* 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. */
/*===========================================================================*/
@@ -71,9 +53,9 @@
extern "C" {
#endif
void aicInit(void);
- void aicConfigureInt(uint32_t source, uint8_t prior);
- void aicSetSourceVector(uint32_t source, bool (*handler)(void));
- void aicSetSpuriousVector(bool (*handler)(void));
+ void aicSetSourcePriority(uint32_t source, uint8_t priority);
+ void aicSetSourceHandler(uint32_t source, bool (*handler)(void));
+ void aicSetSpuriousHandler(bool (*handler)(void));
void aicEnableInt(uint32_t source);
void aicDisableInt(uint32_t source);
void aicClearInt(uint32_t source);