2021-04-07 03:04:51 -04:00
|
|
|
/*
|
2024-02-05 21:45:35 -05:00
|
|
|
* SPDX-FileCopyrightText: 2018-2023 Espressif Systems (Shanghai) CO LTD
|
2021-04-07 03:04:51 -04:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2017-10-19 05:42:55 -04:00
|
|
|
|
|
|
|
#ifndef ESP_WIFI_OS_ADAPTER_H_
|
|
|
|
#define ESP_WIFI_OS_ADAPTER_H_
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2023-08-31 02:58:58 -04:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include "sdkconfig.h"
|
2017-10-19 05:42:55 -04:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-05-22 05:15:28 -04:00
|
|
|
#define ESP_WIFI_OS_ADAPTER_VERSION 0x00000008
|
2017-10-19 05:42:55 -04:00
|
|
|
#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;
|
2020-08-26 05:51:13 -04:00
|
|
|
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);
|
2017-10-19 05:42:55 -04:00
|
|
|
void (*_set_isr)(int32_t n, void *f, void *arg);
|
|
|
|
void (*_ints_on)(uint32_t mask);
|
|
|
|
void (*_ints_off)(uint32_t mask);
|
2020-08-26 05:51:13 -04:00
|
|
|
bool (* _is_from_isr)(void);
|
2017-10-19 05:42:55 -04:00
|
|
|
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);
|
2019-04-26 01:50:06 -04:00
|
|
|
void *(*_wifi_thread_semphr_get)(void);
|
2017-10-19 05:42:55 -04:00
|
|
|
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);
|
2017-10-19 05:42:55 -04:00
|
|
|
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);
|
2017-10-19 05:42:55 -04:00
|
|
|
void (* _free)(void *p);
|
2019-04-16 23:44:51 -04:00
|
|
|
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);
|
2017-10-19 05:42:55 -04:00
|
|
|
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);
|
2020-08-26 05:51:13 -04:00
|
|
|
void (* _wifi_apb80m_request)(void);
|
|
|
|
void (* _wifi_apb80m_release)(void);
|
2020-05-22 05:15:28 -04:00
|
|
|
void (* _phy_disable)(void);
|
|
|
|
void (* _phy_enable)(void);
|
2022-08-01 05:58:53 -04:00
|
|
|
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
|
2019-08-20 03:47:42 -04:00
|
|
|
void (* _phy_common_clock_enable)(void);
|
|
|
|
void (* _phy_common_clock_disable)(void);
|
2019-12-30 03:51:12 -05:00
|
|
|
#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);
|
2017-10-19 05:42:55 -04:00
|
|
|
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);
|
2020-08-26 05:51:13 -04:00
|
|
|
void (* _wifi_rtc_enable_iso)(void);
|
|
|
|
void (* _wifi_rtc_disable_iso)(void);
|
2017-10-19 05:42:55 -04:00
|
|
|
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);
|
2017-10-19 05:42:55 -04:00
|
|
|
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);
|
2017-10-19 05:42:55 -04:00
|
|
|
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);
|
2017-10-19 05:42:55 -04:00
|
|
|
void (* _wifi_delete_queue)(void * queue);
|
2020-05-22 05:15:28 -04:00
|
|
|
int (* _coex_init)(void);
|
|
|
|
void (* _coex_deinit)(void);
|
2020-08-26 05:51:13 -04:00
|
|
|
int (* _coex_enable)(void);
|
|
|
|
void (* _coex_disable)(void);
|
2019-02-20 08:01:27 -05:00
|
|
|
uint32_t (* _coex_status_get)(void);
|
2019-09-12 02:12:13 -04:00
|
|
|
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);
|
2020-08-26 05:51:13 -04:00
|
|
|
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);
|
2023-02-22 07:55:30 -05:00
|
|
|
int (* _coex_schm_process_restart)(void);
|
|
|
|
int (* _coex_schm_register_cb)(int, int (* cb)(int));
|
2022-03-15 05:08:12 -04:00
|
|
|
int (* _coex_register_start_cb)(int (* cb)(void));
|
2022-12-11 22:56:11 -05:00
|
|
|
#if CONFIG_IDF_TARGET_ESP32C6
|
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);
|
|
|
|
#endif
|
2024-04-17 05:40:46 -04:00
|
|
|
int (*_coex_schm_flexible_period_set)(uint8_t);
|
|
|
|
uint8_t (*_coex_schm_flexible_period_get)(void);
|
2017-10-19 05:42:55 -04:00
|
|
|
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_ */
|