mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
tests/periph_pm: avoid abusing shell command
To allow marking the shell command static, add a trivial _show_blockers() function that lists the current pm layered blocker state.
This commit is contained in:
parent
e819b9054e
commit
9b0cf39312
@ -34,8 +34,6 @@
|
|||||||
#include "pm_layered.h"
|
#include "pm_layered.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int _pm_handler(int argc, char **argv);
|
|
||||||
|
|
||||||
#include "shell.h"
|
#include "shell.h"
|
||||||
|
|
||||||
#ifndef BTN0_INT_FLANK
|
#ifndef BTN0_INT_FLANK
|
||||||
@ -172,6 +170,23 @@ static const shell_command_t shell_commands[] = {
|
|||||||
{ NULL, NULL, NULL }
|
{ NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if IS_USED(MODULE_PM_LAYERED)
|
||||||
|
static void _show_blockers(void)
|
||||||
|
{
|
||||||
|
uint8_t lowest_allowed_mode = 0;
|
||||||
|
|
||||||
|
pm_blocker_t pm_blocker = pm_get_blocker();
|
||||||
|
for (unsigned i = 0; i < PM_NUM_MODES; i++) {
|
||||||
|
printf("mode %u blockers: %u \n", i, pm_blocker.blockers[i]);
|
||||||
|
if (pm_blocker.blockers[i]) {
|
||||||
|
lowest_allowed_mode = i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Lowest allowed mode: %u\n", lowest_allowed_mode);
|
||||||
|
}
|
||||||
|
#endif /* MODULE_PM_LAYERED */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Application entry point.
|
* @brief Application entry point.
|
||||||
*/
|
*/
|
||||||
@ -191,8 +206,7 @@ int main(void)
|
|||||||
* the state of PM blockers so that the user will know which power mode has
|
* the state of PM blockers so that the user will know which power mode has
|
||||||
* been entered and is presumably responsible for the unresponsive shell.
|
* been entered and is presumably responsible for the unresponsive shell.
|
||||||
*/
|
*/
|
||||||
_pm_handler(2, (char *[]){"pm", "show"});
|
_show_blockers();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
puts("This application allows you to test the CPU power management.\n"
|
puts("This application allows you to test the CPU power management.\n"
|
||||||
"Layered support is not unavailable for this CPU. Reset the CPU if\n"
|
"Layered support is not unavailable for this CPU. Reset the CPU if\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user