esp_adapter.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. /*
  2. * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #include <stddef.h>
  7. #include <stdlib.h>
  8. #include <stdio.h>
  9. #include <string.h>
  10. #include <assert.h>
  11. #include <pthread.h>
  12. #include "freertos/FreeRTOS.h"
  13. #include "freertos/task.h"
  14. #include "freertos/queue.h"
  15. #include "freertos/semphr.h"
  16. #include "freertos/event_groups.h"
  17. #include "freertos/portmacro.h"
  18. #include "freertos/xtensa_api.h"
  19. #include "esp_types.h"
  20. #include "esp_random.h"
  21. #include "esp_mac.h"
  22. #include "esp_task.h"
  23. #include "esp_intr_alloc.h"
  24. #include "esp_attr.h"
  25. #include "esp_log.h"
  26. #include "esp_event.h"
  27. #include "esp_heap_caps.h"
  28. #include "esp_timer.h"
  29. #include "esp_cpu.h"
  30. #include "esp_private/wifi_os_adapter.h"
  31. #include "esp_private/wifi.h"
  32. #include "esp_phy_init.h"
  33. #include "soc/dport_reg.h"
  34. #include "soc/syscon_reg.h"
  35. #include "phy_init_data.h"
  36. #include "esp_private/periph_ctrl.h"
  37. #include "nvs.h"
  38. #include "os.h"
  39. #include "esp_smartconfig.h"
  40. #include "private/esp_coexist_internal.h"
  41. #include "dport_access.h"
  42. #include "esp_rom_sys.h"
  43. #include "esp32/rom/ets_sys.h"
  44. #include "private/esp_modem_wrapper.h"
  45. #define TAG "esp_adapter"
  46. #ifdef CONFIG_PM_ENABLE
  47. extern void wifi_apb80m_request(void);
  48. extern void wifi_apb80m_release(void);
  49. #endif
  50. static void IRAM_ATTR s_esp_dport_access_stall_other_cpu_start(void)
  51. {
  52. DPORT_STALL_OTHER_CPU_START();
  53. }
  54. static void IRAM_ATTR s_esp_dport_access_stall_other_cpu_end(void)
  55. {
  56. DPORT_STALL_OTHER_CPU_END();
  57. }
  58. /*
  59. If CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly.
  60. If failed, try to allocate it in internal memory then.
  61. */
  62. IRAM_ATTR void *wifi_malloc( size_t size )
  63. {
  64. #if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP
  65. return heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
  66. #else
  67. return malloc(size);
  68. #endif
  69. }
  70. /*
  71. If CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly.
  72. If failed, try to allocate it in internal memory then.
  73. */
  74. IRAM_ATTR void *wifi_realloc( void *ptr, size_t size )
  75. {
  76. #if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP
  77. return heap_caps_realloc_prefer(ptr, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
  78. #else
  79. return realloc(ptr, size);
  80. #endif
  81. }
  82. /*
  83. If CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly.
  84. If failed, try to allocate it in internal memory then.
  85. */
  86. IRAM_ATTR void *wifi_calloc( size_t n, size_t size )
  87. {
  88. #if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP
  89. return heap_caps_calloc_prefer(n, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
  90. #else
  91. return calloc(n, size);
  92. #endif
  93. }
  94. static void * IRAM_ATTR wifi_zalloc_wrapper(size_t size)
  95. {
  96. void *ptr = wifi_calloc(1, size);
  97. return ptr;
  98. }
  99. wifi_static_queue_t* wifi_create_queue( int queue_len, int item_size)
  100. {
  101. wifi_static_queue_t *queue = NULL;
  102. queue = (wifi_static_queue_t*)heap_caps_malloc(sizeof(wifi_static_queue_t), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
  103. if (!queue) {
  104. return NULL;
  105. }
  106. #if CONFIG_SPIRAM_USE_MALLOC
  107. queue->storage = heap_caps_calloc(1, sizeof(StaticQueue_t) + (queue_len*item_size), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
  108. if (!queue->storage) {
  109. goto _error;
  110. }
  111. queue->handle = xQueueCreateStatic( queue_len, item_size, ((uint8_t*)(queue->storage)) + sizeof(StaticQueue_t), (StaticQueue_t*)(queue->storage));
  112. if (!queue->handle) {
  113. goto _error;
  114. }
  115. return queue;
  116. _error:
  117. if (queue) {
  118. if (queue->storage) {
  119. free(queue->storage);
  120. }
  121. free(queue);
  122. }
  123. return NULL;
  124. #else
  125. queue->handle = xQueueCreate( queue_len, item_size);
  126. return queue;
  127. #endif
  128. }
  129. void wifi_delete_queue(wifi_static_queue_t *queue)
  130. {
  131. if (queue) {
  132. vQueueDelete(queue->handle);
  133. #if CONFIG_SPIRAM_USE_MALLOC
  134. if (queue->storage) {
  135. free(queue->storage);
  136. }
  137. #endif
  138. free(queue);
  139. }
  140. }
  141. static void * wifi_create_queue_wrapper(int queue_len, int item_size)
  142. {
  143. return wifi_create_queue(queue_len, item_size);
  144. }
  145. static void wifi_delete_queue_wrapper(void *queue)
  146. {
  147. wifi_delete_queue(queue);
  148. }
  149. static void set_intr_wrapper(int32_t cpu_no, uint32_t intr_source, uint32_t intr_num, int32_t intr_prio)
  150. {
  151. esp_rom_route_intr_matrix(cpu_no, intr_source, intr_num);
  152. }
  153. static void clear_intr_wrapper(uint32_t intr_source, uint32_t intr_num)
  154. {
  155. }
  156. static void set_isr_wrapper(int32_t n, void *f, void *arg)
  157. {
  158. xt_set_interrupt_handler(n, (xt_handler)f, arg);
  159. }
  160. static bool IRAM_ATTR is_from_isr_wrapper(void)
  161. {
  162. return !xPortCanYield();
  163. }
  164. static void wifi_thread_semphr_free(void* data)
  165. {
  166. SemaphoreHandle_t *sem = (SemaphoreHandle_t*)(data);
  167. if (sem) {
  168. vSemaphoreDelete(sem);
  169. }
  170. }
  171. static void * wifi_thread_semphr_get_wrapper(void)
  172. {
  173. static bool s_wifi_thread_sem_key_init = false;
  174. static pthread_key_t s_wifi_thread_sem_key;
  175. SemaphoreHandle_t sem = NULL;
  176. if (s_wifi_thread_sem_key_init == false) {
  177. if (0 != pthread_key_create(&s_wifi_thread_sem_key, wifi_thread_semphr_free)) {
  178. return NULL;
  179. }
  180. s_wifi_thread_sem_key_init = true;
  181. }
  182. sem = pthread_getspecific(s_wifi_thread_sem_key);
  183. if (!sem) {
  184. sem = xSemaphoreCreateCounting(1, 0);
  185. if (sem) {
  186. pthread_setspecific(s_wifi_thread_sem_key, sem);
  187. ESP_LOGV(TAG, "thread sem create: sem=%p", sem);
  188. }
  189. }
  190. ESP_LOGV(TAG, "thread sem get: sem=%p", sem);
  191. return (void*)sem;
  192. }
  193. static void * recursive_mutex_create_wrapper(void)
  194. {
  195. return (void *)xSemaphoreCreateRecursiveMutex();
  196. }
  197. static void * mutex_create_wrapper(void)
  198. {
  199. return (void *)xSemaphoreCreateMutex();
  200. }
  201. static void mutex_delete_wrapper(void *mutex)
  202. {
  203. vSemaphoreDelete(mutex);
  204. }
  205. static int32_t IRAM_ATTR mutex_lock_wrapper(void *mutex)
  206. {
  207. return (int32_t)xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
  208. }
  209. static int32_t IRAM_ATTR mutex_unlock_wrapper(void *mutex)
  210. {
  211. return (int32_t)xSemaphoreGiveRecursive(mutex);
  212. }
  213. static void * queue_create_wrapper(uint32_t queue_len, uint32_t item_size)
  214. {
  215. return (void *)xQueueCreate(queue_len, item_size);
  216. }
  217. static int32_t queue_send_wrapper(void *queue, void *item, uint32_t block_time_tick)
  218. {
  219. if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) {
  220. return (int32_t)xQueueSend(queue, item, portMAX_DELAY);
  221. } else {
  222. return (int32_t)xQueueSend(queue, item, block_time_tick);
  223. }
  224. }
  225. static int32_t IRAM_ATTR queue_send_from_isr_wrapper(void *queue, void *item, void *hptw)
  226. {
  227. return (int32_t)xQueueSendFromISR(queue, item, hptw);
  228. }
  229. static int32_t queue_send_to_back_wrapper(void *queue, void *item, uint32_t block_time_tick)
  230. {
  231. return (int32_t)xQueueGenericSend(queue, item, block_time_tick, queueSEND_TO_BACK);
  232. }
  233. static int32_t queue_send_to_front_wrapper(void *queue, void *item, uint32_t block_time_tick)
  234. {
  235. return (int32_t)xQueueGenericSend(queue, item, block_time_tick, queueSEND_TO_FRONT);
  236. }
  237. static int32_t queue_recv_wrapper(void *queue, void *item, uint32_t block_time_tick)
  238. {
  239. if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) {
  240. return (int32_t)xQueueReceive(queue, item, portMAX_DELAY);
  241. } else {
  242. return (int32_t)xQueueReceive(queue, item, block_time_tick);
  243. }
  244. }
  245. static uint32_t event_group_wait_bits_wrapper(void *event, uint32_t bits_to_wait_for, int clear_on_exit, int wait_for_all_bits, uint32_t block_time_tick)
  246. {
  247. if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) {
  248. return (uint32_t)xEventGroupWaitBits(event, bits_to_wait_for, clear_on_exit, wait_for_all_bits, portMAX_DELAY);
  249. } else {
  250. return (uint32_t)xEventGroupWaitBits(event, bits_to_wait_for, clear_on_exit, wait_for_all_bits, block_time_tick);
  251. }
  252. }
  253. static int32_t task_create_pinned_to_core_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle, uint32_t core_id)
  254. {
  255. return (uint32_t)xTaskCreatePinnedToCore(task_func, name, stack_depth, param, prio, task_handle, (core_id < portNUM_PROCESSORS ? core_id : tskNO_AFFINITY));
  256. }
  257. static int32_t task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle)
  258. {
  259. return (uint32_t)xTaskCreate(task_func, name, stack_depth, param, prio, task_handle);
  260. }
  261. static int32_t IRAM_ATTR task_ms_to_tick_wrapper(uint32_t ms)
  262. {
  263. return (int32_t)(ms / portTICK_PERIOD_MS);
  264. }
  265. static int32_t task_get_max_priority_wrapper(void)
  266. {
  267. return (int32_t)(configMAX_PRIORITIES);
  268. }
  269. static int32_t esp_event_post_wrapper(const char* event_base, int32_t event_id, void* event_data, size_t event_data_size, uint32_t ticks_to_wait)
  270. {
  271. if (ticks_to_wait == OSI_FUNCS_TIME_BLOCKING) {
  272. return (int32_t)esp_event_post(event_base, event_id, event_data, event_data_size, portMAX_DELAY);
  273. } else {
  274. return (int32_t)esp_event_post(event_base, event_id, event_data, event_data_size, ticks_to_wait);
  275. }
  276. }
  277. static void IRAM_ATTR wifi_apb80m_request_wrapper(void)
  278. {
  279. #ifdef CONFIG_PM_ENABLE
  280. wifi_apb80m_request();
  281. #endif
  282. }
  283. static void IRAM_ATTR wifi_apb80m_release_wrapper(void)
  284. {
  285. #ifdef CONFIG_PM_ENABLE
  286. wifi_apb80m_release();
  287. #endif
  288. }
  289. static void IRAM_ATTR timer_arm_wrapper(void *timer, uint32_t tmout, bool repeat)
  290. {
  291. ets_timer_arm(timer, tmout, repeat);
  292. }
  293. static void wifi_reset_mac_wrapper(void)
  294. {
  295. periph_module_reset(PERIPH_WIFI_MODULE);
  296. }
  297. static void wifi_clock_enable_wrapper(void)
  298. {
  299. wifi_module_enable();
  300. }
  301. static void wifi_clock_disable_wrapper(void)
  302. {
  303. wifi_module_disable();
  304. }
  305. static int get_time_wrapper(void *t)
  306. {
  307. return os_get_time(t);
  308. }
  309. static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size)
  310. {
  311. return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
  312. }
  313. static void * IRAM_ATTR calloc_internal_wrapper(size_t n, size_t size)
  314. {
  315. return heap_caps_calloc(n, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
  316. }
  317. static void * IRAM_ATTR zalloc_internal_wrapper(size_t size)
  318. {
  319. void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
  320. return ptr;
  321. }
  322. static int coex_init_wrapper(void)
  323. {
  324. #if CONFIG_SW_COEXIST_ENABLE
  325. return coex_init();
  326. #else
  327. return 0;
  328. #endif
  329. }
  330. static void coex_deinit_wrapper(void)
  331. {
  332. #if CONFIG_SW_COEXIST_ENABLE
  333. coex_deinit();
  334. #endif
  335. }
  336. static int coex_enable_wrapper(void)
  337. {
  338. #if CONFIG_SW_COEXIST_ENABLE
  339. return coex_enable();
  340. #else
  341. return 0;
  342. #endif
  343. }
  344. static void coex_disable_wrapper(void)
  345. {
  346. #if CONFIG_SW_COEXIST_ENABLE
  347. coex_disable();
  348. #endif
  349. }
  350. static IRAM_ATTR uint32_t coex_status_get_wrapper(void)
  351. {
  352. #if CONFIG_SW_COEXIST_ENABLE
  353. return coex_status_get();
  354. #else
  355. return 0;
  356. #endif
  357. }
  358. static int coex_wifi_request_wrapper(uint32_t event, uint32_t latency, uint32_t duration)
  359. {
  360. #if CONFIG_SW_COEXIST_ENABLE
  361. return coex_wifi_request(event, latency, duration);
  362. #else
  363. return 0;
  364. #endif
  365. }
  366. static IRAM_ATTR int coex_wifi_release_wrapper(uint32_t event)
  367. {
  368. #if CONFIG_SW_COEXIST_ENABLE
  369. return coex_wifi_release(event);
  370. #else
  371. return 0;
  372. #endif
  373. }
  374. static int coex_wifi_channel_set_wrapper(uint8_t primary, uint8_t secondary)
  375. {
  376. #if CONFIG_SW_COEXIST_ENABLE
  377. return coex_wifi_channel_set(primary, secondary);
  378. #else
  379. return 0;
  380. #endif
  381. }
  382. static IRAM_ATTR int coex_event_duration_get_wrapper(uint32_t event, uint32_t *duration)
  383. {
  384. #if CONFIG_SW_COEXIST_ENABLE
  385. return coex_event_duration_get(event, duration);
  386. #else
  387. return 0;
  388. #endif
  389. }
  390. static int coex_pti_get_wrapper(uint32_t event, uint8_t *pti)
  391. {
  392. return 0;
  393. }
  394. static void coex_schm_status_bit_clear_wrapper(uint32_t type, uint32_t status)
  395. {
  396. #if CONFIG_SW_COEXIST_ENABLE
  397. coex_schm_status_bit_clear(type, status);
  398. #endif
  399. }
  400. static void coex_schm_status_bit_set_wrapper(uint32_t type, uint32_t status)
  401. {
  402. #if CONFIG_SW_COEXIST_ENABLE
  403. coex_schm_status_bit_set(type, status);
  404. #endif
  405. }
  406. static IRAM_ATTR int coex_schm_interval_set_wrapper(uint32_t interval)
  407. {
  408. #if CONFIG_SW_COEXIST_ENABLE
  409. return coex_schm_interval_set(interval);
  410. #else
  411. return 0;
  412. #endif
  413. }
  414. static uint32_t coex_schm_interval_get_wrapper(void)
  415. {
  416. #if CONFIG_SW_COEXIST_ENABLE
  417. return coex_schm_interval_get();
  418. #else
  419. return 0;
  420. #endif
  421. }
  422. static uint8_t coex_schm_curr_period_get_wrapper(void)
  423. {
  424. #if CONFIG_SW_COEXIST_ENABLE
  425. return coex_schm_curr_period_get();
  426. #else
  427. return 0;
  428. #endif
  429. }
  430. static void * coex_schm_curr_phase_get_wrapper(void)
  431. {
  432. #if CONFIG_SW_COEXIST_ENABLE
  433. return coex_schm_curr_phase_get();
  434. #else
  435. return NULL;
  436. #endif
  437. }
  438. static int coex_register_start_cb_wrapper(int (* cb)(void))
  439. {
  440. #if CONFIG_SW_COEXIST_ENABLE
  441. return coex_register_start_cb(cb);
  442. #else
  443. return 0;
  444. #endif
  445. }
  446. static int coex_schm_process_restart_wrapper(void)
  447. {
  448. #if CONFIG_SW_COEXIST_ENABLE
  449. return coex_schm_process_restart();
  450. #else
  451. return 0;
  452. #endif
  453. }
  454. static int coex_schm_register_cb_wrapper(int type, int(*cb)(int))
  455. {
  456. #if CONFIG_SW_COEXIST_ENABLE
  457. return coex_schm_register_callback(type, cb);
  458. #else
  459. return 0;
  460. #endif
  461. }
  462. static void IRAM_ATTR esp_empty_wrapper(void)
  463. {
  464. }
  465. static void esp_phy_enable_wrapper(void)
  466. {
  467. esp_phy_enable(PHY_MODEM_WIFI);
  468. phy_wifi_enable_set(1);
  469. }
  470. static void esp_phy_disable_wrapper(void)
  471. {
  472. phy_wifi_enable_set(0);
  473. esp_phy_disable(PHY_MODEM_WIFI);
  474. }
  475. wifi_osi_funcs_t g_wifi_osi_funcs = {
  476. ._version = ESP_WIFI_OS_ADAPTER_VERSION,
  477. ._env_is_chip = esp_coex_common_env_is_chip_wrapper,
  478. ._set_intr = set_intr_wrapper,
  479. ._clear_intr = clear_intr_wrapper,
  480. ._set_isr = set_isr_wrapper,
  481. ._ints_on = esp_cpu_intr_enable,
  482. ._ints_off = esp_cpu_intr_disable,
  483. ._is_from_isr = is_from_isr_wrapper,
  484. ._spin_lock_create = esp_coex_common_spin_lock_create_wrapper,
  485. ._spin_lock_delete = free,
  486. ._wifi_int_disable = esp_coex_common_int_disable_wrapper,
  487. ._wifi_int_restore = esp_coex_common_int_restore_wrapper,
  488. ._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper,
  489. ._semphr_create = esp_coex_common_semphr_create_wrapper,
  490. ._semphr_delete = esp_coex_common_semphr_delete_wrapper,
  491. ._semphr_take = esp_coex_common_semphr_take_wrapper,
  492. ._semphr_give = esp_coex_common_semphr_give_wrapper,
  493. ._wifi_thread_semphr_get = wifi_thread_semphr_get_wrapper,
  494. ._mutex_create = mutex_create_wrapper,
  495. ._recursive_mutex_create = recursive_mutex_create_wrapper,
  496. ._mutex_delete = mutex_delete_wrapper,
  497. ._mutex_lock = mutex_lock_wrapper,
  498. ._mutex_unlock = mutex_unlock_wrapper,
  499. ._queue_create = queue_create_wrapper,
  500. ._queue_delete = (void(*)(void *))vQueueDelete,
  501. ._queue_send = queue_send_wrapper,
  502. ._queue_send_from_isr = queue_send_from_isr_wrapper,
  503. ._queue_send_to_back = queue_send_to_back_wrapper,
  504. ._queue_send_to_front = queue_send_to_front_wrapper,
  505. ._queue_recv = queue_recv_wrapper,
  506. ._queue_msg_waiting = (uint32_t(*)(void *))uxQueueMessagesWaiting,
  507. ._event_group_create = (void *(*)(void))xEventGroupCreate,
  508. ._event_group_delete = (void(*)(void *))vEventGroupDelete,
  509. ._event_group_set_bits = (uint32_t(*)(void *,uint32_t))xEventGroupSetBits,
  510. ._event_group_clear_bits = (uint32_t(*)(void *,uint32_t))xEventGroupClearBits,
  511. ._event_group_wait_bits = event_group_wait_bits_wrapper,
  512. ._task_create_pinned_to_core = task_create_pinned_to_core_wrapper,
  513. ._task_create = task_create_wrapper,
  514. ._task_delete = (void(*)(void *))vTaskDelete,
  515. ._task_delay = vTaskDelay,
  516. ._task_ms_to_tick = task_ms_to_tick_wrapper,
  517. ._task_get_current_task = (void *(*)(void))xTaskGetCurrentTaskHandle,
  518. ._task_get_max_priority = task_get_max_priority_wrapper,
  519. ._malloc = malloc,
  520. ._free = free,
  521. ._event_post = esp_event_post_wrapper,
  522. ._get_free_heap_size = esp_get_free_internal_heap_size,
  523. ._rand = esp_random,
  524. ._dport_access_stall_other_cpu_start_wrap = s_esp_dport_access_stall_other_cpu_start,
  525. ._dport_access_stall_other_cpu_end_wrap = s_esp_dport_access_stall_other_cpu_end,
  526. ._wifi_apb80m_request = wifi_apb80m_request_wrapper,
  527. ._wifi_apb80m_release = wifi_apb80m_release_wrapper,
  528. ._phy_disable = esp_phy_disable_wrapper,
  529. ._phy_enable = esp_phy_enable_wrapper,
  530. ._phy_common_clock_enable = esp_phy_common_clock_enable,
  531. ._phy_common_clock_disable = esp_phy_common_clock_disable,
  532. ._phy_update_country_info = esp_phy_update_country_info,
  533. ._read_mac = esp_read_mac,
  534. ._timer_arm = timer_arm_wrapper,
  535. ._timer_disarm = esp_coex_common_timer_disarm_wrapper,
  536. ._timer_done = esp_coex_common_timer_done_wrapper,
  537. ._timer_setfn = esp_coex_common_timer_setfn_wrapper,
  538. ._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
  539. ._wifi_reset_mac = wifi_reset_mac_wrapper,
  540. ._wifi_clock_enable = wifi_clock_enable_wrapper,
  541. ._wifi_clock_disable = wifi_clock_disable_wrapper,
  542. ._wifi_rtc_enable_iso = esp_empty_wrapper,
  543. ._wifi_rtc_disable_iso = esp_empty_wrapper,
  544. ._esp_timer_get_time = esp_timer_get_time,
  545. ._nvs_set_i8 = nvs_set_i8,
  546. ._nvs_get_i8 = nvs_get_i8,
  547. ._nvs_set_u8 = nvs_set_u8,
  548. ._nvs_get_u8 = nvs_get_u8,
  549. ._nvs_set_u16 = nvs_set_u16,
  550. ._nvs_get_u16 = nvs_get_u16,
  551. ._nvs_open = nvs_open,
  552. ._nvs_close = nvs_close,
  553. ._nvs_commit = nvs_commit,
  554. ._nvs_set_blob = nvs_set_blob,
  555. ._nvs_get_blob = nvs_get_blob,
  556. ._nvs_erase_key = nvs_erase_key,
  557. ._get_random = os_get_random,
  558. ._get_time = get_time_wrapper,
  559. ._random = os_random,
  560. ._log_write = esp_log_write,
  561. ._log_writev = esp_log_writev,
  562. ._log_timestamp = esp_log_timestamp,
  563. ._malloc_internal = esp_coex_common_malloc_internal_wrapper,
  564. ._realloc_internal = realloc_internal_wrapper,
  565. ._calloc_internal = calloc_internal_wrapper,
  566. ._zalloc_internal = zalloc_internal_wrapper,
  567. ._wifi_malloc = wifi_malloc,
  568. ._wifi_realloc = wifi_realloc,
  569. ._wifi_calloc = wifi_calloc,
  570. ._wifi_zalloc = wifi_zalloc_wrapper,
  571. ._wifi_create_queue = wifi_create_queue_wrapper,
  572. ._wifi_delete_queue = wifi_delete_queue_wrapper,
  573. ._coex_init = coex_init_wrapper,
  574. ._coex_deinit = coex_deinit_wrapper,
  575. ._coex_enable = coex_enable_wrapper,
  576. ._coex_disable = coex_disable_wrapper,
  577. ._coex_status_get = coex_status_get_wrapper,
  578. ._coex_wifi_request = coex_wifi_request_wrapper,
  579. ._coex_wifi_release = coex_wifi_release_wrapper,
  580. ._coex_wifi_channel_set = coex_wifi_channel_set_wrapper,
  581. ._coex_event_duration_get = coex_event_duration_get_wrapper,
  582. ._coex_pti_get = coex_pti_get_wrapper,
  583. ._coex_schm_status_bit_clear = coex_schm_status_bit_clear_wrapper,
  584. ._coex_schm_status_bit_set = coex_schm_status_bit_set_wrapper,
  585. ._coex_schm_interval_set = coex_schm_interval_set_wrapper,
  586. ._coex_schm_interval_get = coex_schm_interval_get_wrapper,
  587. ._coex_schm_curr_period_get = coex_schm_curr_period_get_wrapper,
  588. ._coex_schm_curr_phase_get = coex_schm_curr_phase_get_wrapper,
  589. ._coex_register_start_cb = coex_register_start_cb_wrapper,
  590. ._coex_schm_process_restart = coex_schm_process_restart_wrapper,
  591. ._coex_schm_register_cb = coex_schm_register_cb_wrapper,
  592. ._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
  593. };