aboutsummaryrefslogtreecommitdiffstats
path: root/os/common/ports/e200/compilers/GCC
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-07-22 09:01:53 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-07-22 09:01:53 +0000
commit46d8d011afb9669404c0295ae0846261b8355859 (patch)
treee0a138c2c778860bcae713987ffad302da004e11 /os/common/ports/e200/compilers/GCC
parentd28344062e3e277fc2bfba54566f99a83ae11ef0 (diff)
downloadChibiOS-46d8d011afb9669404c0295ae0846261b8355859.tar.gz
ChibiOS-46d8d011afb9669404c0295ae0846261b8355859.tar.bz2
ChibiOS-46d8d011afb9669404c0295ae0846261b8355859.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7055 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/common/ports/e200/compilers/GCC')
-rw-r--r--os/common/ports/e200/compilers/GCC/vectors.h63
1 files changed, 52 insertions, 11 deletions
diff --git a/os/common/ports/e200/compilers/GCC/vectors.h b/os/common/ports/e200/compilers/GCC/vectors.h
index 60241864e..e1693a66e 100644
--- a/os/common/ports/e200/compilers/GCC/vectors.h
+++ b/os/common/ports/e200/compilers/GCC/vectors.h
@@ -35,15 +35,17 @@
/* Module constants. */
/*===========================================================================*/
-/* The following code is not processed when the file is included from an
- asm module.*/
-#if !defined(_FROM_ASM_)
+#if PPC_INTC_TYPE == 0
+#define INTC_IACKR_ADDR (PPC_INTC_BASE + 0x10)
+#define INTC_EOIR_ADDR (PPC_INTC_BASE + 0x18)
-#define INTC_MCR *((volatile uint32_t *)0xfff48000)
-#define INTC_CPR *((volatile uint32_t *)0xfff48008)
-#define INTC_IACKR *((volatile uint32_t *)0xfff48010)
+#elif PPC_INTC_TYPE == 1
+#define INTC_IACKR_ADDR (PPC_INTC_BASE + 0x20)
+#define INTC_EOIR_ADDR (PPC_INTC_BASE + 0x30)
-#endif /* !defined(_FROM_ASM_) */
+#else
+#error "unknown INTC type"
+#endif
/*===========================================================================*/
/* Module pre-compile time settings. */
@@ -61,6 +63,40 @@
/* Module macros. */
/*===========================================================================*/
+/* The following code is not processed when the file is included from an
+ asm module.*/
+#if !defined(_FROM_ASM_)
+
+/**
+ * @name INTC-related macros
+ * @{
+ */
+#if PPC_INTC_TYPE == 0
+#define INTC_BCR (*((volatile uint32_t *)(PPC_INTC_BASE + 0)))
+#define INTC_CPR(n) (*((volatile uint32_t *)(PPC_INTC_BASE + 8 + ((n) * sizeof (uint32_t)))))
+#define INTC_IACKR(n) (*((volatile uint32_t *)(PPC_INTC_BASE + 0x10 + ((n) * sizeof (uint32_t)))))
+#define INTC_EOIR(n) (*((volatile uint32_t *)(PPC_INTC_BASE + 0x18 + ((n) * sizeof (uint32_t)))))
+#define INTC_PSR(n) (*((volatile uint8_t *)(PPC_INTC_BASE + 0x40 + ((n) * sizeof (uint8_t)))))
+
+#elif PPC_INTC_TYPE == 1
+#define INTC_BCR (*((volatile uint32_t *)(PPC_INTC_BASE + 0)))
+#define INTC_MPROT (*((volatile uint32_t *)(PPC_INTC_BASE + 4)))
+#define INTC_CPR(n) (*((volatile uint32_t *)(PPC_INTC_BASE + 0x10 + ((n) * sizeof (uint32_t)))))
+#define INTC_IACKR(n) (*((volatile uint32_t *)(PPC_INTC_BASE + 0x20 + ((n) * sizeof (uint32_t)))))
+#define INTC_EOIR(n) (*((volatile uint32_t *)(PPC_INTC_BASE + 0x30 + ((n) * sizeof (uint32_t)))))
+#define INTC_PSR(n) (*((volatile uint16_t *)(PPC_INTC_BASE + 0x60 + ((n) * sizeof (uint16_t)))))
+
+#else
+#error "unknown INTC type"
+#endif
+
+/**
+ * @brief PSR register content helper
+ */
+#define INTC_PSR_ENABLE(cores, prio) ((uint32_t)(cores) | (uint32_t)(prio))
+
+#endif /* !defined(_FROM_ASM_) */
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
@@ -92,10 +128,15 @@ extern "C" {
#if !defined(_FROM_ASM_)
static inline void intc_init(void) {
-
- INTC_MCR = 0;
- INTC_CPR = 0;
- INTC_IACKR = (uint32_t)_vectors;
+ unsigned i;
+
+ /* INTC initialization, software vector mode, 4 bytes vectors, starting
+ at priority 0.*/
+ INTC_BCR = 0;
+ for (i = 0; i < PPC_CORE_NUMBER; i++) {
+ INTC_CPR(i) = 0;
+ INTC_IACKR(i) = (uint32_t)_vectors;
+ }
}
#endif /* !defined(_FROM_ASM_) */