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
@@ -28,6 +28,8 @@
extern "C" {
#endif
typedef int64_t (*esp_system_time_fn_t)(void);
typedef enum {
ESP_MAC_WIFI_STA,
ESP_MAC_WIFI_SOFTAP,
@@ -286,6 +288,20 @@ typedef struct {
*/
void esp_chip_info(esp_chip_info_t* out_info);
/**
* @brief Get the time in microseconds since startup
*
* @returns time since startup in microseconds
*/
int64_t esp_system_get_time(void);
/**
* @brief Get the resolution of the time returned by `esp_system_get_time`.
*
* @returns the resolution in microseconds
*/
uint32_t esp_system_get_time_resolution(void);
#if CONFIG_ESP32_ECO3_CACHE_LOCK_FIX
/**
* @brief Cache lock bug exists or not