1 /*
2  * Copyright (C) 2018 Alibaba Group Holding Limited
3  */
4 
5 /*
6 DESCRIPTION
7 This file provides two fundtions systick_suspend()/systick_resume()
8 which is used by cpu tickless module to suspend/resume system tick
9 interrupt.
10 
11 Differrent board may has different way to suspend/resume system tick
12 interrupt, please reference your board/soc user manual to find the
13 detail for how to implement these two functions.
14 */
15 
16 #include <k_api.h>
17 
18 #if (AOS_COMP_PWRMGMT > 0)
19 
20 #include "ameba_soc.h"
21 
22 #define NVIC_SYSTICK_CTRL_REG (*((volatile uint32_t *) 0xe000e010))
23 
systick_suspend(void)24 void systick_suspend(void)
25 {
26     pmu_yield_os_set(0);
27     NVIC_SYSTICK_CTRL_REG &= ~(SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_TICKINT_Msk);
28 }
29 
systick_resume(void)30 void systick_resume(void)
31 {
32     NVIC_SYSTICK_CTRL_REG |= (SysTick_CTRL_TICKINT_Msk | SysTick_CTRL_ENABLE_Msk);
33     pmu_yield_os_set(1);
34 }
35 
36 #endif /* AOS_COMP_PWRMGMT */
37