NuMaker tickless example

Committer:
cyliang
Date:
Wed Mar 01 03:53:04 2023 +0000
Revision:
25:51d3dccddd8b
Parent:
20:759aab916d47
Update os v6.17.0 for M467 target

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ccli8 1:eb1da9d36e12 1 #include "mbed.h"
ccli8 1:eb1da9d36e12 2 #include "wakeup.h"
ccli8 1:eb1da9d36e12 3
ccli8 10:d2e2c79389e1 4
ccli8 20:759aab916d47 5 #if defined(TARGET_NANO100)
ccli8 10:d2e2c79389e1 6 /* Power-down wake-up interrupt handler */
ccli8 10:d2e2c79389e1 7 /* This target doesn't support relocating vector table and requires overriding
ccli8 10:d2e2c79389e1 8 * vector handler at link-time. */
ccli8 10:d2e2c79389e1 9 extern "C" void PDWU_IRQHandler(void)
ccli8 10:d2e2c79389e1 10 {
ccli8 10:d2e2c79389e1 11 CLK->WK_INTSTS = CLK_WK_INTSTS_PD_WK_IS_Msk;
ccli8 10:d2e2c79389e1 12
ccli8 10:d2e2c79389e1 13 wakeup_eventflags.set(EventFlag_Wakeup_UnID);
ccli8 10:d2e2c79389e1 14 }
ccli8 10:d2e2c79389e1 15
ccli8 10:d2e2c79389e1 16 void config_pwrctl(void)
ccli8 10:d2e2c79389e1 17 {
ccli8 10:d2e2c79389e1 18 SYS_UnlockReg();
ccli8 10:d2e2c79389e1 19 CLK->PWRCTL |= CLK_PWRCTL_PD_WK_IE_Msk;
ccli8 10:d2e2c79389e1 20 SYS_LockReg();
ccli8 10:d2e2c79389e1 21 /* NOTE: The name of symbol PDWU_IRQHandler is mangled in C++ and cannot override that in startup file in C.
ccli8 10:d2e2c79389e1 22 * So the NVIC_SetVector call cannot be left out. */
ccli8 10:d2e2c79389e1 23 NVIC_SetVector(PDWU_IRQn, (uint32_t) PDWU_IRQHandler);
ccli8 10:d2e2c79389e1 24 NVIC_EnableIRQ(PDWU_IRQn);
ccli8 10:d2e2c79389e1 25 }
ccli8 10:d2e2c79389e1 26
ccli8 10:d2e2c79389e1 27 #else
ccli8 10:d2e2c79389e1 28
ccli8 1:eb1da9d36e12 29 /* Power-down wake-up interrupt handler */
ccli8 1:eb1da9d36e12 30 void PWRWU_IRQHandler(void)
ccli8 1:eb1da9d36e12 31 {
ccli8 1:eb1da9d36e12 32 CLK->PWRCTL |= CLK_PWRCTL_PDWKIF_Msk;
ccli8 1:eb1da9d36e12 33
ccli8 1:eb1da9d36e12 34 wakeup_eventflags.set(EventFlag_Wakeup_UnID);
ccli8 1:eb1da9d36e12 35 }
ccli8 1:eb1da9d36e12 36
ccli8 1:eb1da9d36e12 37 void config_pwrctl(void)
ccli8 1:eb1da9d36e12 38 {
ccli8 1:eb1da9d36e12 39 SYS_UnlockReg();
ccli8 1:eb1da9d36e12 40 CLK->PWRCTL |= CLK_PWRCTL_PDWKIEN_Msk;
ccli8 1:eb1da9d36e12 41 SYS_LockReg();
ccli8 1:eb1da9d36e12 42 /* NOTE: The name of symbol PWRWU_IRQHandler is mangled in C++ and cannot override that in startup file in C.
ccli8 1:eb1da9d36e12 43 * So the NVIC_SetVector call cannot be left out. */
ccli8 1:eb1da9d36e12 44 NVIC_SetVector(PWRWU_IRQn, (uint32_t) PWRWU_IRQHandler);
ccli8 1:eb1da9d36e12 45 NVIC_EnableIRQ(PWRWU_IRQn);
ccli8 1:eb1da9d36e12 46 }
ccli8 10:d2e2c79389e1 47
ccli8 10:d2e2c79389e1 48 #endif