esp-idf/components/esp_wifi/include/esp_private/wifi_os_adapter.h

164 lines
7.6 KiB
C
Raw Normal View History

/*
* SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ESP_WIFI_OS_ADAPTER_H_
#define ESP_WIFI_OS_ADAPTER_H_
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
#define ESP_WIFI_OS_ADAPTER_VERSION 0x00000008
#define ESP_WIFI_OS_ADAPTER_MAGIC 0xDEADBEAF
#define OSI_FUNCS_TIME_BLOCKING 0xffffffff
#define OSI_QUEUE_SEND_FRONT 0
#define OSI_QUEUE_SEND_BACK 1
#define OSI_QUEUE_SEND_OVERWRITE 2
typedef struct {
int32_t _version;
bool (* _env_is_chip)(void);
void (*_set_intr)(int32_t cpu_no, uint32_t intr_source, uint32_t intr_num, int32_t intr_prio);
void (*_clear_intr)(uint32_t intr_source, uint32_t intr_num);
void (*_set_isr)(int32_t n, void *f, void *arg);
void (*_ints_on)(uint32_t mask);
void (*_ints_off)(uint32_t mask);
bool (* _is_from_isr)(void);
void *(* _spin_lock_create)(void);
void (* _spin_lock_delete)(void *lock);
uint32_t (*_wifi_int_disable)(void *wifi_int_mux);
void (*_wifi_int_restore)(void *wifi_int_mux, uint32_t tmp);
void (*_task_yield_from_isr)(void);
void *(*_semphr_create)(uint32_t max, uint32_t init);
void (*_semphr_delete)(void *semphr);
int32_t (*_semphr_take)(void *semphr, uint32_t block_time_tick);
int32_t (*_semphr_give)(void *semphr);
void *(*_wifi_thread_semphr_get)(void);
void *(*_mutex_create)(void);
void *(*_recursive_mutex_create)(void);
void (*_mutex_delete)(void *mutex);
int32_t (*_mutex_lock)(void *mutex);
int32_t (*_mutex_unlock)(void *mutex);
void *(* _queue_create)(uint32_t queue_len, uint32_t item_size);
void (* _queue_delete)(void *queue);
int32_t (* _queue_send)(void *queue, void *item, uint32_t block_time_tick);
int32_t (* _queue_send_from_isr)(void *queue, void *item, void *hptw);
int32_t (* _queue_send_to_back)(void *queue, void *item, uint32_t block_time_tick);
int32_t (* _queue_send_to_front)(void *queue, void *item, uint32_t block_time_tick);
int32_t (* _queue_recv)(void *queue, void *item, uint32_t block_time_tick);
uint32_t (* _queue_msg_waiting)(void *queue);
void *(* _event_group_create)(void);
void (* _event_group_delete)(void *event);
uint32_t (* _event_group_set_bits)(void *event, uint32_t bits);
uint32_t (* _event_group_clear_bits)(void *event, uint32_t bits);
2020-12-14 21:55:04 -05:00
uint32_t (* _event_group_wait_bits)(void *event, uint32_t bits_to_wait_for, int clear_on_exit, int wait_for_all_bits, uint32_t block_time_tick);
int32_t (* _task_create_pinned_to_core)(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle, uint32_t core_id);
int32_t (* _task_create)(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle);
void (* _task_delete)(void *task_handle);
void (* _task_delay)(uint32_t tick);
int32_t (* _task_ms_to_tick)(uint32_t ms);
void *(* _task_get_current_task)(void);
int32_t (* _task_get_max_priority)(void);
2022-05-12 06:52:18 -04:00
void *(* _malloc)(size_t size);
void (* _free)(void *p);
int32_t (* _event_post)(const char* event_base, int32_t event_id, void* event_data, size_t event_data_size, uint32_t ticks_to_wait);
uint32_t (* _get_free_heap_size)(void);
uint32_t (* _rand)(void);
void (* _dport_access_stall_other_cpu_start_wrap)(void);
void (* _dport_access_stall_other_cpu_end_wrap)(void);
void (* _wifi_apb80m_request)(void);
void (* _wifi_apb80m_release)(void);
void (* _phy_disable)(void);
void (* _phy_enable)(void);
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
void (* _phy_common_clock_enable)(void);
void (* _phy_common_clock_disable)(void);
#endif
2020-12-14 21:55:04 -05:00
int (* _phy_update_country_info)(const char* country);
2022-05-12 06:52:18 -04:00
int (* _read_mac)(uint8_t* mac, unsigned int type);
void (* _timer_arm)(void *timer, uint32_t tmout, bool repeat);
void (* _timer_disarm)(void *timer);
void (* _timer_done)(void *ptimer);
void (* _timer_setfn)(void *ptimer, void *pfunction, void *parg);
void (* _timer_arm_us)(void *ptimer, uint32_t us, bool repeat);
2020-02-19 06:16:42 -05:00
void (* _wifi_reset_mac)(void);
void (* _wifi_clock_enable)(void);
void (* _wifi_clock_disable)(void);
void (* _wifi_rtc_enable_iso)(void);
void (* _wifi_rtc_disable_iso)(void);
int64_t (* _esp_timer_get_time)(void);
2020-12-14 21:55:04 -05:00
int (* _nvs_set_i8)(uint32_t handle, const char* key, int8_t value);
int (* _nvs_get_i8)(uint32_t handle, const char* key, int8_t* out_value);
int (* _nvs_set_u8)(uint32_t handle, const char* key, uint8_t value);
int (* _nvs_get_u8)(uint32_t handle, const char* key, uint8_t* out_value);
int (* _nvs_set_u16)(uint32_t handle, const char* key, uint16_t value);
int (* _nvs_get_u16)(uint32_t handle, const char* key, uint16_t* out_value);
2022-05-12 06:52:18 -04:00
int (* _nvs_open)(const char* name, unsigned int open_mode, uint32_t *out_handle);
2020-12-14 21:55:04 -05:00
void (* _nvs_close)(uint32_t handle);
int (* _nvs_commit)(uint32_t handle);
int (* _nvs_set_blob)(uint32_t handle, const char* key, const void* value, size_t length);
int (* _nvs_get_blob)(uint32_t handle, const char* key, void* out_value, size_t* length);
int (* _nvs_erase_key)(uint32_t handle, const char* key);
int (* _get_random)(uint8_t *buf, size_t len);
int (* _get_time)(void *t);
unsigned long (* _random)(void);
2022-12-20 09:07:09 -05:00
#if !CONFIG_IDF_TARGET_ESP32
2019-06-16 23:50:37 -04:00
uint32_t (* _slowclk_cal_get)(void);
#endif
2022-05-12 06:52:18 -04:00
void (* _log_write)(unsigned int level, const char* tag, const char* format, ...);
void (* _log_writev)(unsigned int level, const char* tag, const char* format, va_list args);
uint32_t (* _log_timestamp)(void);
void * (* _malloc_internal)(size_t size);
void * (* _realloc_internal)(void *ptr, size_t size);
void * (* _calloc_internal)(size_t n, size_t size);
void * (* _zalloc_internal)(size_t size);
void * (* _wifi_malloc)(size_t size);
void * (* _wifi_realloc)(void *ptr, size_t size);
void * (* _wifi_calloc)(size_t n, size_t size);
void * (* _wifi_zalloc)(size_t size);
2020-12-14 21:55:04 -05:00
void * (* _wifi_create_queue)(int queue_len, int item_size);
void (* _wifi_delete_queue)(void * queue);
int (* _coex_init)(void);
void (* _coex_deinit)(void);
int (* _coex_enable)(void);
void (* _coex_disable)(void);
uint32_t (* _coex_status_get)(void);
void (* _coex_condition_set)(uint32_t type, bool dissatisfy);
2020-12-14 21:55:04 -05:00
int (* _coex_wifi_request)(uint32_t event, uint32_t latency, uint32_t duration);
int (* _coex_wifi_release)(uint32_t event);
int (* _coex_wifi_channel_set)(uint8_t primary, uint8_t secondary);
int (* _coex_event_duration_get)(uint32_t event, uint32_t *duration);
int (* _coex_pti_get)(uint32_t event, uint8_t *pti);
void (* _coex_schm_status_bit_clear)(uint32_t type, uint32_t status);
void (* _coex_schm_status_bit_set)(uint32_t type, uint32_t status);
int (* _coex_schm_interval_set)(uint32_t interval);
uint32_t (* _coex_schm_interval_get)(void);
uint8_t (* _coex_schm_curr_period_get)(void);
void * (* _coex_schm_curr_phase_get)(void);
int (* _coex_register_start_cb)(int (* cb)(void));
auto beacon: support esp32c6 autobeacon (advanced DTIM sleep feature) modem retention: Support esp32c6 wifi MAC and baseband sleep retention sleep_modem: wifi MAC modem wakeup protect in modem state before PMU trigger sleep enable request sleep modem: provide a interface to get whether the Modem power domain is allowed to power off during sleep add i2c_ana master header file to project auto beacon: release PMU's lock on root clock source (it is locked in the PLL) wifi receiving beacon frame in PMU modem state strongly depends on the BBPLL clock, PMU will forcibly lock the root clock source as PLL, when the root clock source of the software system is selected as PLL, we need to release the root clock source locking. When it is judged that the PLL is locked by PMU after wakeing up from the PMU modem state, switch the root clock source to the PLL in the sleep process (a critical section). auto beacon: fix the failure to receive broadcast/multicast frames in modem state When the multicast field in the beacon frame received in the PMU modem state is True, the PMU switches to the PMU active state (the PMU waits for the HP LDO to stabilize and then restores the MAC context) and starts to receive broadcast/multicast frames (Broadcast/Multicast frames will be sent after a minimum delay of 48 us after the beacon frame), because the PMU waits for the HP LDO to stabilize too long (~154 us), which will cause broadcast/multicast frame reception to be missed. auto beacon: select the PLL clock source as the REGDMA backup clock source when the PMU switches to ACTIVE from MODEM state update Digital Peripheral (M2A switch) REGDMA restore time parameter auto beacon: fix the issue that only channel 1 can connect to AP in modem state
2022-03-13 23:33:01 -04:00
#if SOC_PM_MODEM_RETENTION_BY_REGDMA
2022-12-20 09:07:09 -05:00
void (* _regdma_link_set_write_wait_content)(void *, uint32_t, uint32_t);
void * (* _sleep_retention_find_link_by_id)(int);
int (* _sleep_retention_entries_create)(const void *, int, int, int);
void (* _sleep_retention_entries_destroy)(int);
#endif
int (* _coex_schm_process_restart)(void);
2023-02-17 03:20:46 -05:00
int (* _coex_schm_register_cb)(int, int (* cb)(int));
int32_t _magic;
} wifi_osi_funcs_t;
extern wifi_osi_funcs_t g_wifi_osi_funcs;
#ifdef __cplusplus
}
#endif
#endif /* ESP_WIFI_OS_ADAPTER_H_ */