diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2022-07-21 12:44:43 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2022-07-21 12:44:43 +0200 |
commit | e2d191ebe69745fe658df8c56be2f8d3c4e7af47 (patch) | |
tree | 321fb7db3a557d4eb60e92932480466e707d3c66 /src/arch/infineon-tc1796-mock/arch.cc | |
parent | 68f92431e5706b4bed64ad37f0f26e8eef57c11e (diff) |
tc1796: it's working!
Diffstat (limited to 'src/arch/infineon-tc1796-mock/arch.cc')
-rw-r--r-- | src/arch/infineon-tc1796-mock/arch.cc | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/arch/infineon-tc1796-mock/arch.cc b/src/arch/infineon-tc1796-mock/arch.cc index 8905f9c..73ebd2d 100644 --- a/src/arch/infineon-tc1796-mock/arch.cc +++ b/src/arch/infineon-tc1796-mock/arch.cc @@ -22,6 +22,9 @@ extern "C" { #define OF_VCOSEL 6 #define OF_SYSFS 2 +#define STM_CLC (*(volatile unsigned int*)0xf0000200) +#define STM_TIM5 (*(volatile unsigned int*)0xf0000224) + void Arch::setup(void) { /* @@ -30,17 +33,13 @@ void Arch::setup(void) */ unlock_wdtcon(); (*(unsigned int*)0xf0000040) = (29 << OF_NDIV) | (0 << OF_PDIV) | (3 << OF_KDIV) | (2 << OF_VCOSEL); - //PMI_CON0.bits.CCBYP = 0; + STM_CLC = 0x00000100; lock_wdtcon(); } -#ifdef CONFIG_wakeup -extern void wakeup(); -#endif - #if defined(CONFIG_loop) extern void loop(); -volatile char run_loop = 0; +unsigned int old_tim5 = 0; #endif volatile bool sleep_done = false; @@ -71,22 +70,17 @@ void Arch::idle_loop(void) { while (1) { #if defined(CONFIG_loop) - if (run_loop) { + // STM_TIM5 will overflow once every 1.9 years. + if ((STM_TIM5 - old_tim5 > 70) || (old_tim5 > STM_TIM5)) { + old_tim5 = STM_TIM5; loop(); - run_loop = 0; } #endif -#ifdef CONFIG_wakeup - wakeup(); -#endif } } void Arch::idle(void) { -#ifdef CONFIG_wakeup - wakeup(); -#endif } Arch arch; |