1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:32:45 +01:00

sys/pm_layered: rename val_u8 -> blockers

This commit is contained in:
Benjamin Valentin 2022-04-04 13:47:36 +02:00
parent ed9f740edd
commit 7fb8f3b7c5
4 changed files with 11 additions and 11 deletions

View File

@ -54,7 +54,7 @@ extern "C" {
* @brief Power Management mode blocker typedef
*/
typedef struct {
uint8_t val_u8[PM_NUM_MODES]; /**< power mode blockers u8 */
uint8_t blockers[PM_NUM_MODES]; /**< number of blockers for the mode */
} pm_blocker_t;
/**

View File

@ -54,7 +54,7 @@
/**
* @brief Global variable for keeping track of blocked modes
*/
static pm_blocker_t pm_blocker = { .val_u8 = PM_BLOCKER_INITIAL };
static pm_blocker_t pm_blocker = { .blockers = PM_BLOCKER_INITIAL };
void pm_set_lowest(void)
{
@ -63,7 +63,7 @@ void pm_set_lowest(void)
/* set lowest mode if blocker is still the same */
unsigned state = irq_disable();
while (mode) {
if (pm_blocker.val_u8[mode-1]) {
if (pm_blocker.blockers[mode - 1]) {
break;
}
mode--;
@ -77,19 +77,19 @@ void pm_set_lowest(void)
void pm_block(unsigned mode)
{
assert(pm_blocker.val_u8[mode] != 255);
assert(pm_blocker.blockers[mode] != 255);
unsigned state = irq_disable();
pm_blocker.val_u8[mode]++;
pm_blocker.blockers[mode]++;
irq_restore(state);
}
void pm_unblock(unsigned mode)
{
assert(pm_blocker.val_u8[mode] > 0);
assert(pm_blocker.blockers[mode] > 0);
unsigned state = irq_disable();
pm_blocker.val_u8[mode]--;
pm_blocker.blockers[mode]--;
irq_restore(state);
}

View File

@ -107,7 +107,7 @@ static int cmd_unblock(char *arg)
}
pm_blocker_t pm_blocker = pm_get_blocker();
if (pm_blocker.val_u8[mode] == 0) {
if (pm_blocker.blockers[mode] == 0) {
printf("Mode %d is already unblocked.\n", mode);
return 1;
}
@ -127,8 +127,8 @@ static int cmd_show(char *arg)
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.val_u8[i]);
if (pm_blocker.val_u8[i]) {
printf("mode %u blockers: %u \n", i, pm_blocker.blockers[i]);
if (pm_blocker.blockers[i]) {
lowest_allowed_mode = i + 1;
}
}

View File

@ -105,7 +105,7 @@ static int cmd_unblock_rtc(int argc, char **argv)
}
pm_blocker_t pm_blocker = pm_get_blocker();
if (pm_blocker.val_u8[mode] == 0) {
if (pm_blocker.blockers[mode] == 0) {
printf("Mode %d is already unblocked.\n", mode);
return 1;
}