pm: Use fixed cpu id in single core case
When there are no multiple cores than fixing id to 0 saves few cycles. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
committed by
Benjamin Cabé
parent
49337973e0
commit
29d9405036
@@ -62,7 +62,7 @@ static inline void pm_state_notify(bool entering_state)
|
||||
}
|
||||
|
||||
if (callback) {
|
||||
callback(z_cpus_pm_state[_current_cpu->id].state);
|
||||
callback(z_cpus_pm_state[CPU_ID].state);
|
||||
}
|
||||
}
|
||||
k_spin_unlock(&pm_notifier_lock, pm_notifier_key);
|
||||
@@ -93,7 +93,7 @@ static inline int32_t ticks_expiring_sooner(int32_t ticks1, int32_t ticks2)
|
||||
|
||||
void pm_system_resume(void)
|
||||
{
|
||||
uint8_t id = _current_cpu->id;
|
||||
uint8_t id = CPU_ID;
|
||||
|
||||
/*
|
||||
* This notification is called from the ISR of the event
|
||||
@@ -142,7 +142,7 @@ bool pm_state_force(uint8_t cpu, const struct pm_state_info *info)
|
||||
|
||||
bool pm_system_suspend(int32_t kernel_ticks)
|
||||
{
|
||||
uint8_t id = _current_cpu->id;
|
||||
uint8_t id = CPU_ID;
|
||||
k_spinlock_key_t key;
|
||||
int32_t ticks, events_ticks;
|
||||
|
||||
|
||||
@@ -53,17 +53,17 @@ SYS_INIT(pm_stats_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
||||
|
||||
void pm_stats_start(void)
|
||||
{
|
||||
time_start[_current_cpu->id] = k_cycle_get_32();
|
||||
time_start[CPU_ID] = k_cycle_get_32();
|
||||
}
|
||||
|
||||
void pm_stats_stop(void)
|
||||
{
|
||||
time_stop[_current_cpu->id] = k_cycle_get_32();
|
||||
time_stop[CPU_ID] = k_cycle_get_32();
|
||||
}
|
||||
|
||||
void pm_stats_update(enum pm_state state)
|
||||
{
|
||||
uint8_t cpu = _current_cpu->id;
|
||||
uint8_t cpu = CPU_ID;
|
||||
uint32_t time_total = time_stop[cpu] - time_start[cpu];
|
||||
|
||||
STATS_INC(stats[cpu][state], state_count);
|
||||
|
||||
Reference in New Issue
Block a user