aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorchrysn2012-04-29 00:18:03 +0200
committerchrysn2012-04-29 00:18:03 +0200
commit9324f00038c48e9522559c6e936e6d35aca65fad (patch)
treed493085a338a02861385489abb230b63d3cdc2f4 /include
parent4a36d23d8c35a564337ac0dcf9de4f80ced0990b (diff)
enhanced cmsis again for other efm32tg examples
Diffstat (limited to 'include')
-rw-r--r--include/libopencmsis/core_cm3.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/include/libopencmsis/core_cm3.h b/include/libopencmsis/core_cm3.h
index 8de7c8b..1f68464 100644
--- a/include/libopencmsis/core_cm3.h
+++ b/include/libopencmsis/core_cm3.h
@@ -127,10 +127,21 @@ typedef struct
* the generic cm3 functionality is moved out from stm32 and can be used here
* easily (systick_set_reload, systick_interrupt_enable, systick_counter_enable
* and systick_set_clocksource).
+ *
+ * modified for CMSIS style array as the powertest example needs it.
* */
#define SYS_TICK_BASE (SCS_BASE + 0x0010)
-#define STK_LOAD MMIO32(SYS_TICK_BASE + 0x04)
-#define STK_CTRL MMIO32(SYS_TICK_BASE + 0x00)
+
+/* from d0002_efm32_cortex-m3_reference_manual.pdf section 4.4 */
+typedef struct
+{
+ uint32_t CTRL;
+ uint32_t LOAD;
+ uint32_t VAL;
+ uint32_t CALIB;
+} SysTick_TypeDef;
+#define SysTick ((SysTick_TypeDef *) SYS_TICK_BASE)
+
#define STK_CTRL_TICKINT (1 << 1)
#define STK_CTRL_ENABLE (1 << 0)
@@ -139,13 +150,13 @@ typedef struct
static inline uint32_t SysTick_Config(uint32_t n_ticks)
{
if (n_ticks & ~0x00FFFFFF) return 1;
- STK_LOAD = n_ticks;
+ SysTick->LOAD = n_ticks;
- STK_CTRL |= (STK_CTRL_CLKSOURCE_AHB << STK_CTRL_CLKSOURCE_LSB);
+ SysTick->CTRL |= (STK_CTRL_CLKSOURCE_AHB << STK_CTRL_CLKSOURCE_LSB);
- STK_CTRL |= STK_CTRL_TICKINT;
+ SysTick->CTRL |= STK_CTRL_TICKINT;
- STK_CTRL |= STK_CTRL_ENABLE;
+ SysTick->CTRL |= STK_CTRL_ENABLE;
return 0;
}
@@ -172,4 +183,9 @@ typedef struct
#define ADC0_IRQHandler adc0_isr
+/* for the lightsense example */
+
+#define LESENSE_IRQHandler lesense_isr
+#define PCNT0_IRQHandler pcnt0_isr
+
#endif