mirror of
https://github.com/pvvx/RTL00_WEB.git
synced 2025-07-31 20:31:05 +00:00
update
This commit is contained in:
parent
b8c699eb1c
commit
3a865fb51d
40 changed files with 293 additions and 463 deletions
|
|
@ -241,11 +241,11 @@ MON_RAM_TEXT_SECTION void RtlConsolTaskRam(void *Data) {
|
|||
}
|
||||
if(flg) DiagPrintf("cmd: %s - nothing!\n", ArgvArray[0]);
|
||||
#if defined(configUSE_WAKELOCK_PMU) && (configUSE_WAKELOCK_PMU == 1)
|
||||
pmu_release_wakelock(WAKELOCK_LOGUART);
|
||||
release_wakelock(WAKELOCK_LOGUART);
|
||||
#endif
|
||||
}
|
||||
#if defined(configUSE_WAKELOCK_PMU) && (configUSE_WAKELOCK_PMU == 1)
|
||||
else pmu_acquire_wakelock(WAKELOCK_LOGUART);
|
||||
else acquire_wakelock(WAKELOCK_LOGUART);
|
||||
#endif
|
||||
p->pTmpLogBuf->BufCount = 0;
|
||||
p->pTmpLogBuf->UARTLogBuf[0] = 0;
|
||||
|
|
|
|||
|
|
@ -37,9 +37,12 @@ static uint8_t last_wakelock_state[32] = {
|
|||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
#if (configGENERATE_RUN_TIME_STATS == 1)
|
||||
static uint32_t last_acquire_wakelock_time[32] = {0};
|
||||
static uint32_t hold_wakelock_time[32] = {0};
|
||||
static uint32_t base_sys_time = 0;
|
||||
#endif
|
||||
|
||||
static uint32_t sys_sleep_time = 0;
|
||||
|
||||
|
|
@ -164,10 +167,48 @@ int freertos_ready_to_sleep() {
|
|||
return wakelock == 0;
|
||||
}
|
||||
|
||||
|
||||
void acquire_wakelock(uint32_t lock_id) {
|
||||
|
||||
wakelock |= lock_id;
|
||||
|
||||
#if (configGENERATE_RUN_TIME_STATS == 1)
|
||||
u32 i;
|
||||
u32 current_timestamp = osKernelSysTick();
|
||||
for (i=0; i<32; i++) {
|
||||
if ( (1<<i & lock_id) && (last_wakelock_state[i] == 0) ) {
|
||||
last_acquire_wakelock_time[i] = current_timestamp;
|
||||
last_wakelock_state[i] = 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void release_wakelock(uint32_t lock_id) {
|
||||
wakelock &= ~lock_id;
|
||||
|
||||
#if (configGENERATE_RUN_TIME_STATS == 1)
|
||||
u32 i;
|
||||
u32 current_timestamp = osKernelSysTick();
|
||||
for (i=0; i<32; i++) {
|
||||
if ( (1<<i & lock_id) && (last_wakelock_state[i] == 1) ) {
|
||||
hold_wakelock_time[i] += current_timestamp - last_acquire_wakelock_time[i];
|
||||
last_wakelock_state[i] = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t get_wakelock_status() {
|
||||
return wakelock;
|
||||
}
|
||||
|
||||
#if 0 // SDK3.5 compatible
|
||||
void pmu_acquire_wakelock(uint32_t lock_id) {
|
||||
|
||||
wakelock |= BIT(lock_id);
|
||||
|
||||
#if (configGENERATE_RUN_TIME_STATS == 1)
|
||||
if (generate_wakelock_stats) {
|
||||
uint32_t i;
|
||||
uint32_t current_timestamp = osKernelSysTick();
|
||||
|
|
@ -178,11 +219,13 @@ void pmu_acquire_wakelock(uint32_t lock_id) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void pmu_release_wakelock(uint32_t lock_id) {
|
||||
wakelock &= ~BIT(lock_id);
|
||||
|
||||
#if (configGENERATE_RUN_TIME_STATS == 1)
|
||||
if (generate_wakelock_stats) {
|
||||
uint32_t i;
|
||||
uint32_t current_timestamp = osKernelSysTick();
|
||||
|
|
@ -193,16 +236,20 @@ void pmu_release_wakelock(uint32_t lock_id) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t pmu_get_wakelock_status() {
|
||||
return wakelock;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void pmu_enable_wakelock_stats(unsigned char enable) {
|
||||
generate_wakelock_stats = enable;
|
||||
}
|
||||
|
||||
#if (configGENERATE_RUN_TIME_STATS == 1)
|
||||
void pmu_get_wakelock_hold_stats( char *pcWriteBuffer ) {
|
||||
uint32_t i;
|
||||
uint32_t current_timestamp = osKernelSysTick();
|
||||
|
|
@ -239,6 +286,7 @@ void pmu_clean_wakelock_stat() {
|
|||
}
|
||||
sys_sleep_time = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void pmu_add_wakeup_event(uint32_t event) {
|
||||
wakeup_event |= event;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue