mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-03 06:27:47 +00:00
added all function for g_wifi_osi_funcs
This commit is contained in:
+390
-6
@@ -69,19 +69,24 @@ static void *_mutex_create(void) {
|
||||
printf("called: _mutex_create\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int mutx = 0;
|
||||
|
||||
static void *_recursive_mutex_create(void) {
|
||||
printf("called: _recursive_mutex_create\n");
|
||||
return NULL;
|
||||
printf("called: _recursive_mutex_create. ret=%p\n", &mutx);
|
||||
return &mutx;
|
||||
}
|
||||
static void _mutex_delete(void *mutex) {
|
||||
printf("called: _mutex_delete\n");
|
||||
printf("called: _mutex_delete: %p\n", mutex);
|
||||
}
|
||||
static int32_t _mutex_lock(void *mutex) {
|
||||
printf("called: _mutex_lock\n");
|
||||
printf("called: _mutex_lock: %p\n", mutex);
|
||||
*(unsigned int*)mutex = 1;
|
||||
return 0;
|
||||
}
|
||||
static int32_t _mutex_unlock(void *mutex) {
|
||||
printf("called: _mutex_unlock\n");
|
||||
printf("called: _mutex_unlock: %p\n", mutex);
|
||||
*(unsigned int*)mutex = 0;
|
||||
return 0;
|
||||
}
|
||||
static void * _queue_create(uint32_t queue_len, uint32_t item_size) {
|
||||
@@ -135,6 +140,300 @@ static uint32_t _event_group_wait_bits(void *event, uint32_t bits_to_wait_for, i
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define P(x) printf("called: "#x"\n");
|
||||
|
||||
static 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) {
|
||||
P(_task_create_pinned_to_core)
|
||||
return 0;
|
||||
}
|
||||
static int32_t _task_create(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle) {
|
||||
P(_task_create)
|
||||
return 0;
|
||||
}
|
||||
static void _task_delete(void *task_handle) {
|
||||
P(_task_delete)
|
||||
}
|
||||
static void _task_delay(uint32_t tick) {
|
||||
P(_task_delay)
|
||||
}
|
||||
static int32_t _task_ms_to_tick(uint32_t ms) {
|
||||
P(_task_ms_to_tick)
|
||||
return 0;
|
||||
}
|
||||
static void* _task_get_current_task(void) {
|
||||
P(_task_get_current_task)
|
||||
return NULL;
|
||||
}
|
||||
static int32_t _task_get_max_priority() {
|
||||
P(_task_get_max_priority)
|
||||
return 0;
|
||||
}
|
||||
static void* _malloc(unsigned int size) {
|
||||
P(_malloc)
|
||||
return NULL;
|
||||
}
|
||||
static void _free(void *p) {
|
||||
P(_free)
|
||||
}
|
||||
static 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) {
|
||||
P(_event_post)
|
||||
return 0;
|
||||
}
|
||||
static uint32_t _get_free_heap_size(void) {
|
||||
P(_get_free_heap_size)
|
||||
return 0;
|
||||
}
|
||||
static uint32_t _rand(void) {
|
||||
P(_rand)
|
||||
return 0;
|
||||
}
|
||||
static void _dport_access_stall_other_cpu_start_wrap(void) {
|
||||
P(_dport_access_stall_other_cpu_start_wrap)
|
||||
}
|
||||
static void _dport_access_stall_other_cpu_end_wrap(void) {
|
||||
P(_dport_access_stall_other_cpu_end_wrap)
|
||||
}
|
||||
static void _wifi_apb80m_request(void) {
|
||||
P(_wifi_apb80m_request)
|
||||
}
|
||||
static void _wifi_apb80m_release(void) {
|
||||
P(_wifi_apb80m_release)
|
||||
}
|
||||
static void _phy_disable(void) {
|
||||
P(_phy_disable)
|
||||
}
|
||||
static void _phy_enable(void) {
|
||||
P(_phy_enable)
|
||||
}
|
||||
// #if CONFIG_IDF_TARGET_ESP32
|
||||
// void (* _phy_common_clock_enable(void)
|
||||
// void (* _phy_common_clock_disable(void)
|
||||
// #endif
|
||||
static int _phy_update_country_info(const char* country) {
|
||||
P(_phy_update_country_info)
|
||||
return 0;
|
||||
}
|
||||
static int _read_mac(uint8_t* mac, uint32_t type) {
|
||||
P(_read_mac)
|
||||
return 0;
|
||||
}
|
||||
static void _timer_arm(void *timer, uint32_t tmout, bool repeat) {
|
||||
P(_timer_arm)
|
||||
}
|
||||
static void _timer_disarm(void *timer) {
|
||||
P(_timer_disarm)
|
||||
}
|
||||
static void _timer_done(void *ptimer) {
|
||||
P(_timer_done)
|
||||
}
|
||||
static void _timer_setfn(void *ptimer, void *pfunction, void *parg) {
|
||||
P(_timer_setfn)
|
||||
}
|
||||
static void _timer_arm_us(void *ptimer, uint32_t us, bool repeat) {
|
||||
P(_timer_arm_us)
|
||||
}
|
||||
static void _wifi_reset_mac(void) {
|
||||
P(_wifi_reset_mac)
|
||||
}
|
||||
static void _wifi_clock_enable(void) {
|
||||
P(_wifi_clock_enable)
|
||||
}
|
||||
static void _wifi_clock_disable(void) {
|
||||
P(_wifi_clock_disable)
|
||||
}
|
||||
static void _wifi_rtc_enable_iso(void) {
|
||||
P(_wifi_rtc_enable_iso)
|
||||
}
|
||||
static void _wifi_rtc_disable_iso(void) {
|
||||
P(_wifi_rtc_disable_iso)
|
||||
}
|
||||
static int64_t _esp_timer_get_time(void) {
|
||||
P(_esp_timer_get_time)
|
||||
return 0;
|
||||
}
|
||||
static int _nvs_set_i8(uint32_t handle, const char* key, int8_t value) {
|
||||
P(_nvs_set_i8)
|
||||
return 0;
|
||||
}
|
||||
static int _nvs_get_i8(uint32_t handle, const char* key, int8_t* out_value) {
|
||||
P(_nvs_get_i8)
|
||||
return 0;
|
||||
}
|
||||
static int _nvs_set_u8(uint32_t handle, const char* key, uint8_t value) {
|
||||
P(_nvs_set_u8)
|
||||
return 0;
|
||||
}
|
||||
static int _nvs_get_u8(uint32_t handle, const char* key, uint8_t* out_value) {
|
||||
P(_nvs_get_u8)
|
||||
return 0;
|
||||
}
|
||||
static int _nvs_set_u16(uint32_t handle, const char* key, uint16_t value) {
|
||||
P(_nvs_set_u16)
|
||||
return 0;
|
||||
}
|
||||
static int _nvs_get_u16(uint32_t handle, const char* key, uint16_t* out_value) {
|
||||
P(_nvs_get_u16)
|
||||
return 0;
|
||||
}
|
||||
static int _nvs_open(const char* name, uint32_t open_mode, uint32_t *out_handle) {
|
||||
P(_nvs_open)
|
||||
return 0;
|
||||
}
|
||||
static void _nvs_close(uint32_t handle) {
|
||||
P(_nvs_close)
|
||||
}
|
||||
static int _nvs_commit(uint32_t handle) {
|
||||
P(_nvs_commit)
|
||||
return 0;
|
||||
}
|
||||
static int _nvs_set_blob(uint32_t handle, const char* key, const void* value, size_t length) {
|
||||
P(_nvs_set_blob)
|
||||
return 0;
|
||||
}
|
||||
static int _nvs_get_blob(uint32_t handle, const char* key, void* out_value, size_t* length) {
|
||||
P(_nvs_get_blob)
|
||||
return 0;
|
||||
}
|
||||
static int _nvs_erase_key(uint32_t handle, const char* key) {
|
||||
P(_nvs_erase_key)
|
||||
return 0;
|
||||
}
|
||||
static int _get_random(uint8_t *buf, size_t len) {
|
||||
P(_get_random)
|
||||
return 0;
|
||||
}
|
||||
static int _get_time(void *t) {
|
||||
P(_get_time)
|
||||
return 0;
|
||||
}
|
||||
static unsigned long _random(void) {
|
||||
P(_random)
|
||||
return 0;
|
||||
}
|
||||
// #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3
|
||||
// uint32_t (* _slowclk_cal_get(void)
|
||||
// #endif
|
||||
static void _log_write(uint32_t level, const char* tag, const char* format, ...) {
|
||||
P(_log_write)
|
||||
}
|
||||
static void _log_writev(uint32_t level, const char* tag, const char* format, va_list args) {
|
||||
P(_log_writev)
|
||||
}
|
||||
static uint32_t _log_timestamp(void) {
|
||||
P(_log_timestamp)
|
||||
return 0;
|
||||
}
|
||||
static void* _malloc_internal(size_t size) {
|
||||
P(_malloc_internal)
|
||||
return NULL;
|
||||
}
|
||||
static void* _realloc_internal(void *ptr, size_t size) {
|
||||
P(_realloc_internal)
|
||||
return NULL;
|
||||
}
|
||||
static void* _calloc_internal(size_t n, size_t size) {
|
||||
P(_calloc_internal)
|
||||
return NULL;
|
||||
}
|
||||
static void* _zalloc_internal(size_t size) {
|
||||
P(_zalloc_internal)
|
||||
return NULL;
|
||||
}
|
||||
static void* _wifi_malloc(size_t size) {
|
||||
P(_wifi_malloc)
|
||||
return NULL;
|
||||
}
|
||||
static void* _wifi_realloc(void *ptr, size_t size) {
|
||||
P(_wifi_realloc)
|
||||
return NULL;
|
||||
}
|
||||
static void* _wifi_calloc(size_t n, size_t size) {
|
||||
P(_wifi_calloc)
|
||||
return NULL;
|
||||
}
|
||||
static void* _wifi_zalloc(size_t size) {
|
||||
P(_wifi_zalloc)
|
||||
return NULL;
|
||||
}
|
||||
static void* _wifi_create_queue(int queue_len, int item_size) {
|
||||
P(_wifi_create_queue)
|
||||
return NULL;
|
||||
}
|
||||
static void _wifi_delete_queue(void * queue) {
|
||||
P(_wifi_delete_queue)
|
||||
}
|
||||
static int _coex_init(void) {
|
||||
P(_coex_init)
|
||||
return 0;
|
||||
}
|
||||
static void _coex_deinit(void) {
|
||||
P(_coex_deinit)
|
||||
}
|
||||
static int _coex_enable(void) {
|
||||
P(_coex_enable)
|
||||
return 0;
|
||||
}
|
||||
static void _coex_disable(void) {
|
||||
P(_coex_disable)
|
||||
}
|
||||
static uint32_t _coex_status_get(void) {
|
||||
P(_coex_status_get)
|
||||
return 0;
|
||||
}
|
||||
static void _coex_condition_set(uint32_t type, bool dissatisfy) {
|
||||
P(_coex_condition_set)
|
||||
}
|
||||
static int _coex_wifi_request(uint32_t event, uint32_t latency, uint32_t duration) {
|
||||
P(_coex_wifi_request)
|
||||
return 0;
|
||||
}
|
||||
static int _coex_wifi_release(uint32_t event) {
|
||||
P(_coex_wifi_release)
|
||||
return 0;
|
||||
}
|
||||
static int _coex_wifi_channel_set(uint8_t primary, uint8_t secondary) {
|
||||
P(_coex_wifi_channel_set)
|
||||
return 0;
|
||||
}
|
||||
static int _coex_event_duration_get(uint32_t event, uint32_t *duration) {
|
||||
P(_coex_event_duration_get)
|
||||
return 0;
|
||||
}
|
||||
static int _coex_pti_get(uint32_t event, uint8_t *pti) {
|
||||
P(_coex_pti_get)
|
||||
return 0;
|
||||
}
|
||||
static void _coex_schm_status_bit_clear(uint32_t type, uint32_t status) {
|
||||
P(_coex_schm_status_bit_clear)
|
||||
}
|
||||
static void _coex_schm_status_bit_set(uint32_t type, uint32_t status) {
|
||||
P(_coex_schm_status_bit_set)
|
||||
}
|
||||
static int _coex_schm_interval_set(uint32_t interval) {
|
||||
P(_coex_schm_interval_set)
|
||||
return 0;
|
||||
}
|
||||
static uint32_t _coex_schm_interval_get(void) {
|
||||
P(_coex_schm_interval_get)
|
||||
return 0;
|
||||
}
|
||||
static uint8_t _coex_schm_curr_period_get(void) {
|
||||
P(_coex_schm_curr_period_get)
|
||||
return 0;
|
||||
}
|
||||
static void* _coex_schm_curr_phase_get(void) {
|
||||
P(_coex_schm_curr_phase_get)
|
||||
return NULL;
|
||||
}
|
||||
static int _coex_schm_curr_phase_idx_set(int idx) {
|
||||
P(_coex_schm_curr_phase_idx_set)
|
||||
return 0;
|
||||
}
|
||||
static int _coex_schm_curr_phase_idx_get(void) {
|
||||
P(_coex_schm_curr_phase_idx_get)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// OS adapter functions.
|
||||
// See: esp-idf/components/esp_wifi/include/esp_private/wifi_os_adapter.h
|
||||
wifi_osi_funcs_t g_wifi_osi_funcs = {
|
||||
@@ -174,7 +473,92 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
|
||||
._event_group_set_bits = _event_group_set_bits,
|
||||
._event_group_clear_bits = _event_group_clear_bits,
|
||||
._event_group_wait_bits = _event_group_wait_bits,
|
||||
// TODO: define more of these functions
|
||||
._task_create_pinned_to_core = _task_create_pinned_to_core,
|
||||
._task_create = _task_create,
|
||||
._task_delete = _task_delete,
|
||||
._task_delay = _task_delay,
|
||||
._task_ms_to_tick = _task_ms_to_tick,
|
||||
._task_get_current_task = _task_get_current_task,
|
||||
._task_get_max_priority = _task_get_max_priority,
|
||||
._malloc = _malloc,
|
||||
._free = _free,
|
||||
._event_post = _event_post,
|
||||
._get_free_heap_size = _get_free_heap_size,
|
||||
._rand = _rand,
|
||||
._dport_access_stall_other_cpu_start_wrap = _dport_access_stall_other_cpu_start_wrap,
|
||||
._dport_access_stall_other_cpu_end_wrap = _dport_access_stall_other_cpu_end_wrap,
|
||||
._wifi_apb80m_request = _wifi_apb80m_request,
|
||||
._wifi_apb80m_release = _wifi_apb80m_release,
|
||||
._phy_disable = _phy_disable,
|
||||
._phy_enable = _phy_enable,
|
||||
// #if CONFIG_IDF_TARGET_ESP32
|
||||
// void (* _phy_common_clock_enable
|
||||
// void (* _phy_common_clock_disable
|
||||
// #endif
|
||||
._phy_update_country_info = _phy_update_country_info,
|
||||
._read_mac = _read_mac,
|
||||
._timer_arm = _timer_arm,
|
||||
._timer_disarm = _timer_disarm,
|
||||
._timer_done = _timer_done,
|
||||
._timer_setfn = _timer_setfn,
|
||||
._timer_arm_us = _timer_arm_us,
|
||||
._wifi_reset_mac = _wifi_reset_mac,
|
||||
._wifi_clock_enable = _wifi_clock_enable,
|
||||
._wifi_clock_disable = _wifi_clock_disable,
|
||||
._wifi_rtc_enable_iso = _wifi_rtc_enable_iso,
|
||||
._wifi_rtc_disable_iso = _wifi_rtc_disable_iso,
|
||||
._esp_timer_get_time = _esp_timer_get_time,
|
||||
._nvs_set_i8 = _nvs_set_i8,
|
||||
._nvs_get_i8 = _nvs_get_i8,
|
||||
._nvs_set_u8 = _nvs_set_u8,
|
||||
._nvs_get_u8 = _nvs_get_u8,
|
||||
._nvs_set_u16 = _nvs_set_u16,
|
||||
._nvs_get_u16 = _nvs_get_u16,
|
||||
._nvs_open = _nvs_open,
|
||||
._nvs_close = _nvs_close,
|
||||
._nvs_commit = _nvs_commit,
|
||||
._nvs_set_blob = _nvs_set_blob,
|
||||
._nvs_get_blob = _nvs_get_blob,
|
||||
._nvs_erase_key = _nvs_erase_key,
|
||||
._get_random = _get_random,
|
||||
._get_time = _get_time,
|
||||
._random = _random,
|
||||
// #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3
|
||||
// uint32_t (* _slowclk_cal_get
|
||||
// #endif
|
||||
._log_write = _log_write,
|
||||
._log_writev = _log_writev,
|
||||
._log_timestamp = _log_timestamp,
|
||||
._malloc_internal = _malloc_internal,
|
||||
._realloc_internal = _realloc_internal,
|
||||
._calloc_internal = _calloc_internal,
|
||||
._zalloc_internal = _zalloc_internal,
|
||||
._wifi_malloc = _wifi_malloc,
|
||||
._wifi_realloc = _wifi_realloc,
|
||||
._wifi_calloc = _wifi_calloc,
|
||||
._wifi_zalloc = _wifi_zalloc,
|
||||
._wifi_create_queue = _wifi_create_queue,
|
||||
._wifi_delete_queue = _wifi_delete_queue,
|
||||
._coex_init = _coex_init,
|
||||
._coex_deinit = _coex_deinit,
|
||||
._coex_enable = _coex_enable,
|
||||
._coex_disable = _coex_disable,
|
||||
._coex_status_get = _coex_status_get,
|
||||
._coex_condition_set = _coex_condition_set,
|
||||
._coex_wifi_request = _coex_wifi_request,
|
||||
._coex_wifi_release = _coex_wifi_release,
|
||||
._coex_wifi_channel_set = _coex_wifi_channel_set,
|
||||
._coex_event_duration_get = _coex_event_duration_get,
|
||||
._coex_pti_get = _coex_pti_get,
|
||||
._coex_schm_status_bit_clear = _coex_schm_status_bit_clear,
|
||||
._coex_schm_status_bit_set = _coex_schm_status_bit_set,
|
||||
._coex_schm_interval_set = _coex_schm_interval_set,
|
||||
._coex_schm_interval_get = _coex_schm_interval_get,
|
||||
._coex_schm_curr_period_get = _coex_schm_curr_period_get,
|
||||
._coex_schm_curr_phase_get = _coex_schm_curr_phase_get,
|
||||
._coex_schm_curr_phase_idx_set = _coex_schm_curr_phase_idx_set,
|
||||
._coex_schm_curr_phase_idx_get = _coex_schm_curr_phase_idx_get,
|
||||
|
||||
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user