esp_system: introduce system time functions

- Introduce system time function and concept of system time provider.
esp_timer is system time provider when present.
- Set the reference point for system time, g_startup_time.
- Use the system time functions in newlib instead of calling esp_timer
functions directly
This commit is contained in:
Renz Bagaporo
2020-06-23 16:46:06 +08:00
parent 5785e4dfb6
commit 346cf4430d
14 changed files with 172 additions and 31 deletions

View File

@@ -97,7 +97,6 @@ static StaticQueue_t s_timer_semaphore_memory;
static portMUX_TYPE s_timer_lock = portMUX_INITIALIZER_UNLOCKED;
esp_err_t esp_timer_create(const esp_timer_create_args_t* args,
esp_timer_handle_t* out_handle)
{
@@ -349,7 +348,6 @@ static IRAM_ATTR bool is_initialized(void)
return s_timer_task != NULL;
}
esp_err_t esp_timer_init(void)
{
esp_err_t err;
@@ -380,6 +378,11 @@ esp_err_t esp_timer_init(void)
goto out;
}
err = esp_timer_timekeeping_impl_init();
if (err != ESP_OK) {
goto out;
}
return ESP_OK;
out:
@@ -505,4 +508,4 @@ int64_t IRAM_ATTR esp_timer_get_next_alarm(void)
}
timer_list_unlock();
return next_alarm;
}
}