Merge branch 'feature/wifi_get_tsf_time_api' into 'master'

esp_wifi: Add esp_wifi_get_tsf_time() API to get the tsf time on esp32.

Closes WIFI-2532

See merge request espressif/esp-idf!9535
This commit is contained in:
Jiang Jiang Jian 2020-07-14 19:53:52 +08:00
commit 1fa7454f5e
5 changed files with 28 additions and 2 deletions

View File

@ -211,6 +211,11 @@ static void IRAM_ATTR wifi_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp)
}
}
static bool IRAM_ATTR is_from_isr_wrapper(void)
{
return xPortInIsrContext();
}
static void IRAM_ATTR task_yield_from_isr_wrapper(void)
{
portYIELD_FROM_ISR();
@ -636,6 +641,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_condition_set = coex_condition_set_wrapper,
._coex_wifi_request = coex_wifi_request_wrapper,
._coex_wifi_release = coex_wifi_release_wrapper,
._is_from_isr = is_from_isr_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};

View File

@ -201,6 +201,11 @@ static void IRAM_ATTR wifi_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp)
}
}
static bool IRAM_ATTR is_from_isr_wrapper(void)
{
return xPortInIsrContext();
}
static void IRAM_ATTR task_yield_from_isr_wrapper(void)
{
portYIELD_FROM_ISR();
@ -635,6 +640,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._coex_condition_set = coex_condition_set_wrapper,
._coex_wifi_request = coex_wifi_request_wrapper,
._coex_wifi_release = coex_wifi_release_wrapper,
._is_from_isr = is_from_isr_wrapper,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};

View File

@ -21,7 +21,7 @@
extern "C" {
#endif
#define ESP_WIFI_OS_ADAPTER_VERSION 0x00000006
#define ESP_WIFI_OS_ADAPTER_VERSION 0x00000007
#define ESP_WIFI_OS_ADAPTER_MAGIC 0xDEADBEAF
#define OSI_FUNCS_TIME_BLOCKING 0xffffffff
@ -133,6 +133,7 @@ typedef struct {
void (* _coex_condition_set)(uint32_t type, bool dissatisfy);
int32_t (* _coex_wifi_request)(uint32_t event, uint32_t latency, uint32_t duration);
int32_t (* _coex_wifi_release)(uint32_t event);
bool (* _is_from_isr)(void);
int32_t _magic;
} wifi_osi_funcs_t;

View File

@ -1093,6 +1093,19 @@ esp_err_t esp_wifi_set_ant(const wifi_ant_config_t *config);
*/
esp_err_t esp_wifi_get_ant(wifi_ant_config_t *config);
/**
* @brief Get the TSF time
* In Station mode or SoftAP+Station mode if station is not connected or station doesn't receive at least
* one beacon after connected, will return 0
*
* @attention Enabling power save may cause the return value inaccurate, except WiFi modem sleep
*
* @param interface The interface whose tsf_time is to be retrieved.
*
* @return 0 or the TSF time
*/
int64_t esp_wifi_get_tsf_time(wifi_interface_t interface);
#ifdef __cplusplus
}
#endif

@ -1 +1 @@
Subproject commit fad0f87b2c31d0ff2779bbf834ad0edc6e2a99a7
Subproject commit 3258b4cd3044326ce2d75062f0944ea5cfc41bd6