esp_wifi: Add esp_wifi_get_tsf_time() API to get the tsf time of

specified interface.

Closes https://github.com/espressif/esp-idf/issues/5533
This commit is contained in:
Hrudaynath Dhabe 2020-07-10 19:39:23 +05:30 committed by ChenJianxing
parent 3af4b51a5c
commit 8bb287bae8
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