mirror of
https://gitee.com/Vancouver2017/luban-lite.git
synced 2025-12-17 17:48:55 +00:00
v1.2.1
This commit is contained in:
@@ -18,6 +18,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <aic_io.h>
|
||||
|
||||
#ifdef PM_ENABLE_DEBUG
|
||||
#include <aic_osal.h>
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_PM
|
||||
|
||||
/* tickless threshold time */
|
||||
@@ -399,6 +403,37 @@ RT_WEAK rt_uint8_t pm_get_sleep_threshold_mode(rt_uint8_t cur_mode, rt_tick_t ti
|
||||
return cur_mode;
|
||||
}
|
||||
|
||||
#ifdef PM_ENABLE_DEBUG
|
||||
void pm_dump_wakeup_source(void)
|
||||
{
|
||||
uint32_t i;
|
||||
uint32_t pending;
|
||||
uint32_t enable;
|
||||
|
||||
#ifdef ARCH_RISCV32
|
||||
for (i = 0; i < MAX_IRQn; i++)
|
||||
{
|
||||
pending = csi_vic_get_pending_irq(i);
|
||||
enable = csi_vic_get_enabled_irq(i);
|
||||
if (pending && enable)
|
||||
{
|
||||
rt_kprintf("The wakeup source interrupt ID: %d\n", i);
|
||||
}
|
||||
}
|
||||
#elif defined(ARCH_RISCV64)
|
||||
for (i = 0; i < MAX_IRQn; i++)
|
||||
{
|
||||
pending = csi_plic_get_pending_irq(PLIC_BASE, i);
|
||||
enable = csi_plic_get_enabled_irq(PLIC_BASE, i);
|
||||
if (pending && enable)
|
||||
{
|
||||
rt_kprintf("The wakeup source interrupt ID: %d\n", i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This function changes the power sleep mode base on the result of selection
|
||||
*/
|
||||
@@ -453,6 +488,7 @@ static void _pm_change_sleep_mode(struct rt_pm *pm)
|
||||
#else
|
||||
_pm_device_suspend(pm->sleep_mode);
|
||||
#endif
|
||||
|
||||
/* Tickless*/
|
||||
if (pm->timer_mask & (0x01 << pm->sleep_mode))
|
||||
{
|
||||
@@ -489,6 +525,10 @@ static void _pm_change_sleep_mode(struct rt_pm *pm)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PM_ENABLE_DEBUG
|
||||
pm_dump_wakeup_source();
|
||||
#endif
|
||||
|
||||
/* resume all device */
|
||||
_pm_device_resume(pm->sleep_mode);
|
||||
|
||||
@@ -922,6 +962,16 @@ void rt_pm_default_set(rt_uint8_t sleep_mode)
|
||||
_pm_default_deepsleep = sleep_mode;
|
||||
}
|
||||
|
||||
rt_uint8_t rt_pm_read_mode_cnt(rt_uint8_t sleep_mode)
|
||||
{
|
||||
if (sleep_mode >= PM_SLEEP_MODE_MAX)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _pm.modes[sleep_mode];
|
||||
}
|
||||
|
||||
/**
|
||||
* RT-Thread device interface for PM device
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user