aboutsummaryrefslogtreecommitdiff
path: root/include/libopencm3/efm32
diff options
context:
space:
mode:
authorchrysn2012-02-25 18:57:11 +0100
committerchrysn2012-02-25 23:22:37 +0100
commit2180a02e2f79b8ee77780ea11be188c0faaa8866 (patch)
tree835991491d74d9626cf362ff52b0bcfc6eed4886 /include/libopencm3/efm32
parent2b3f07ee08c722f28cbf480dbcc5276707f78ec4 (diff)
first attempt at porting libopencm3 to energymicro
unless sources are explicitly given, the linker scripts and make files were copied over from the stm32/f1 port.
Diffstat (limited to 'include/libopencm3/efm32')
-rw-r--r--include/libopencm3/efm32/tinygecko/devicerevision.h26
-rw-r--r--include/libopencm3/efm32/tinygecko/vector.h11
-rw-r--r--include/libopencm3/efm32/vector.h34
3 files changed, 71 insertions, 0 deletions
diff --git a/include/libopencm3/efm32/tinygecko/devicerevision.h b/include/libopencm3/efm32/tinygecko/devicerevision.h
new file mode 100644
index 0000000..83e0e0d
--- /dev/null
+++ b/include/libopencm3/efm32/tinygecko/devicerevision.h
@@ -0,0 +1,26 @@
+/* this implements d0034_efm32tg_reference_manual.pdf's 7.3.4 "Device Revision"
+ * section */
+
+#ifndef LIBOPENCM3_EFM32_TINYGECKO_DEVICEREVISION_H
+#define LIBOPENCM3_EFM32_TINYGECKO_DEVICEREVISION_H
+
+#include <libopencm3/cm3/common.h>
+
+#define DEVICEREVISION_PID2 MMIO32(0xE00FFFE8)
+#define DEVICEREVISION_PID3 MMIO32(0xE00FFFEC)
+
+/* devicerevision_revision_get has a comment that would make these definitions
+ * obsolete; i'm not sure how far it is reasonable to parameterize everythin
+ * g*/
+#define DEVICEREVISION_REVISION_LENGTH 4
+#define DEVICEREVISION_REVISION_SHIFT 4
+#define DEVICEREVISION_REVISION_MASK (~(~0<<DEVICEREVISION_REVISION_LENGTH)<<DEVICEREVISION_REVISION_SHIFT) /* 0x000000f0, bits 7:4 */
+
+#define DEVICEREVISION_REVISION_A 0x00
+
+/* Read the device's hardcoded Revision. Return values can be compared against
+ * the DEVICEREVISION_REVISION_A constant, the only value given in the current
+ * specification. */
+extern u8 devicerevision_revision_get(void);
+
+#endif
diff --git a/include/libopencm3/efm32/tinygecko/vector.h b/include/libopencm3/efm32/tinygecko/vector.h
new file mode 100644
index 0000000..c609da3
--- /dev/null
+++ b/include/libopencm3/efm32/tinygecko/vector.h
@@ -0,0 +1,11 @@
+/* this implements d0002_efm32_cortex-m3_reference_manual.pdf's table 1.1's "number of interrupts" line. */
+
+
+#ifndef LIBOPENCM3_EFM32_TINYGECKO_VECTOR_H
+#define LIBOPENCM3_EFM32_TINYGECKO_VECTOR_H
+
+#define EFM32_VECTOR_NIRQ 23
+
+#include "../vector.h"
+
+#endif
diff --git a/include/libopencm3/efm32/vector.h b/include/libopencm3/efm32/vector.h
new file mode 100644
index 0000000..96ca301
--- /dev/null
+++ b/include/libopencm3/efm32/vector.h
@@ -0,0 +1,34 @@
+/* this implements d0002_efm32_cortex-m3_reference_manual.pdf's figure 2.2.
+ *
+ * the structure of the vector table is implemented independently of the vector
+ * table, as it can be relocated to other memory locations too.
+ *
+ * don't include this file directly; rather, include the family's vector.h
+ * file, which defines the number of interrupts (EFM_VECTOR_NIRQ) from table
+ * 1.1 */
+
+#ifndef LIBOPENCM3_EFM32_VECTOR_H
+#define LIBOPENCM3_EFM32_VECTOR_H
+
+#include <libopencm3/cm3/common.h>
+
+typedef void (*efm32_vector_table_entry_t)(void);
+
+typedef struct {
+ unsigned int *initial_sp_value;
+ efm32_vector_table_entry_t reset;
+ efm32_vector_table_entry_t nmi;
+ efm32_vector_table_entry_t hard_fault;
+ efm32_vector_table_entry_t memory_manage_fault;
+ efm32_vector_table_entry_t bus_fault;
+ efm32_vector_table_entry_t usage_fault;
+ efm32_vector_table_entry_t reserved_x001c[4];
+ efm32_vector_table_entry_t sv_call;
+ efm32_vector_table_entry_t reserved_debug;
+ efm32_vector_table_entry_t reserved_x0034;
+ efm32_vector_table_entry_t pend_sv;
+ efm32_vector_table_entry_t systick;
+ efm32_vector_table_entry_t irq[EFM32_VECTOR_NIRQ];
+} efm32_vector_table_t;
+
+#endif