esp_adapter.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. // Copyright 2015-2018 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #include <stddef.h>
  14. #include <stdlib.h>
  15. #include <stdio.h>
  16. #include <string.h>
  17. #include <assert.h>
  18. #include "freertos/FreeRTOS.h"
  19. #include "freertos/task.h"
  20. #include "freertos/queue.h"
  21. #include "freertos/semphr.h"
  22. #include "freertos/event_groups.h"
  23. #include "freertos/xtensa_api.h"
  24. #include "freertos/portmacro.h"
  25. #include "freertos/xtensa_api.h"
  26. #include "esp_types.h"
  27. #include "esp_system.h"
  28. #include "esp_task.h"
  29. #include "esp_intr.h"
  30. #include "esp_attr.h"
  31. #include "esp_log.h"
  32. #include "esp_heap_caps.h"
  33. #include "esp_wifi_os_adapter.h"
  34. #include "esp_wifi_internal.h"
  35. #include "esp_phy_init.h"
  36. #include "crypto/md5.h"
  37. #include "crypto/sha1.h"
  38. #include "crypto/crypto.h"
  39. #include "crypto/aes.h"
  40. #include "crypto/dh_group5.h"
  41. #include "driver/periph_ctrl.h"
  42. #include "nvs.h"
  43. #include "os.h"
  44. #include "esp_smartconfig.h"
  45. #include "smartconfig_ack.h"
  46. #include "esp_coexist_internal.h"
  47. #include "esp_coexist_adapter.h"
  48. extern void esp_dport_access_stall_other_cpu_start_wrap(void);
  49. extern void esp_dport_access_stall_other_cpu_end_wrap(void);
  50. /*
  51. If CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly.
  52. If failed, try to allocate it in internal memory then.
  53. */
  54. IRAM_ATTR void *wifi_malloc( size_t size )
  55. {
  56. #if CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST
  57. return heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
  58. #else
  59. return malloc(size);
  60. #endif
  61. }
  62. /*
  63. If CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly.
  64. If failed, try to allocate it in internal memory then.
  65. */
  66. IRAM_ATTR void *wifi_realloc( void *ptr, size_t size )
  67. {
  68. #if CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST
  69. return heap_caps_realloc_prefer(ptr, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
  70. #else
  71. return realloc(ptr, size);
  72. #endif
  73. }
  74. /*
  75. If CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly.
  76. If failed, try to allocate it in internal memory then.
  77. */
  78. IRAM_ATTR void *wifi_calloc( size_t n, size_t size )
  79. {
  80. #if CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST
  81. return heap_caps_calloc_prefer(n, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
  82. #else
  83. return calloc(n, size);
  84. #endif
  85. }
  86. static void * IRAM_ATTR wifi_zalloc_wrapper(size_t size)
  87. {
  88. void *ptr = wifi_calloc(1, size);
  89. if (ptr) {
  90. memset(ptr, 0, size);
  91. }
  92. return ptr;
  93. }
  94. wifi_static_queue_t* wifi_create_queue( int queue_len, int item_size)
  95. {
  96. wifi_static_queue_t *queue = NULL;
  97. queue = (wifi_static_queue_t*)heap_caps_malloc(sizeof(wifi_static_queue_t), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
  98. if (!queue) {
  99. return NULL;
  100. }
  101. #if CONFIG_SPIRAM_USE_MALLOC
  102. queue->storage = heap_caps_calloc(1, sizeof(StaticQueue_t) + (queue_len*item_size), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
  103. if (!queue->storage) {
  104. goto _error;
  105. }
  106. queue->handle = xQueueCreateStatic( queue_len, item_size, ((uint8_t*)(queue->storage)) + sizeof(StaticQueue_t), (StaticQueue_t*)(queue->storage));
  107. if (!queue->handle) {
  108. goto _error;
  109. }
  110. return queue;
  111. _error:
  112. if (queue) {
  113. if (queue->storage) {
  114. free(queue->storage);
  115. }
  116. free(queue);
  117. }
  118. return NULL;
  119. #else
  120. queue->handle = xQueueCreate( queue_len, item_size);
  121. return queue;
  122. #endif
  123. }
  124. void wifi_delete_queue(wifi_static_queue_t *queue)
  125. {
  126. if (queue) {
  127. vQueueDelete(queue->handle);
  128. #if CONFIG_SPIRAM_USE_MALLOC
  129. if (queue->storage) {
  130. free(queue->storage);
  131. }
  132. #endif
  133. free(queue);
  134. }
  135. }
  136. static void * wifi_create_queue_wrapper(int queue_len, int item_size)
  137. {
  138. return wifi_create_queue(queue_len, item_size);
  139. }
  140. static void wifi_delete_queue_wrapper(void *queue)
  141. {
  142. wifi_delete_queue(queue);
  143. }
  144. static void set_isr_wrapper(int32_t n, void *f, void *arg)
  145. {
  146. xt_set_interrupt_handler(n, (xt_handler)f, arg);
  147. }
  148. static void * spin_lock_create_wrapper(void)
  149. {
  150. portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED;
  151. void *mux = malloc(sizeof(portMUX_TYPE));
  152. if (mux) {
  153. memcpy(mux,&tmp,sizeof(portMUX_TYPE));
  154. return mux;
  155. }
  156. return NULL;
  157. }
  158. static uint32_t IRAM_ATTR wifi_int_disable_wrapper(void *wifi_int_mux)
  159. {
  160. if (xPortInIsrContext()) {
  161. portENTER_CRITICAL_ISR(wifi_int_mux);
  162. } else {
  163. portENTER_CRITICAL(wifi_int_mux);
  164. }
  165. return 0;
  166. }
  167. static void IRAM_ATTR wifi_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp)
  168. {
  169. if (xPortInIsrContext()) {
  170. portEXIT_CRITICAL_ISR(wifi_int_mux);
  171. } else {
  172. portEXIT_CRITICAL(wifi_int_mux);
  173. }
  174. }
  175. static void IRAM_ATTR task_yield_from_isr_wrapper(void)
  176. {
  177. portYIELD_FROM_ISR();
  178. }
  179. static void * semphr_create_wrapper(uint32_t max, uint32_t init)
  180. {
  181. return (void *)xSemaphoreCreateCounting(max, init);
  182. }
  183. static void semphr_delete_wrapper(void *semphr)
  184. {
  185. vSemaphoreDelete(semphr);
  186. }
  187. static int32_t IRAM_ATTR semphr_take_from_isr_wrapper(void *semphr, void *hptw)
  188. {
  189. return (int32_t)xSemaphoreTakeFromISR(semphr, hptw);
  190. }
  191. static int32_t IRAM_ATTR semphr_give_from_isr_wrapper(void *semphr, void *hptw)
  192. {
  193. return (int32_t)xSemaphoreGiveFromISR(semphr, hptw);
  194. }
  195. static int32_t semphr_take_wrapper(void *semphr, uint32_t block_time_tick)
  196. {
  197. if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) {
  198. return (int32_t)xSemaphoreTake(semphr, portMAX_DELAY);
  199. } else {
  200. return (int32_t)xSemaphoreTake(semphr, block_time_tick);
  201. }
  202. }
  203. static int32_t semphr_give_wrapper(void *semphr)
  204. {
  205. return (int32_t)xSemaphoreGive(semphr);
  206. }
  207. static void * recursive_mutex_create_wrapper(void)
  208. {
  209. return (void *)xSemaphoreCreateRecursiveMutex();
  210. }
  211. static void * mutex_create_wrapper(void)
  212. {
  213. return (void *)xSemaphoreCreateMutex();
  214. }
  215. static void mutex_delete_wrapper(void *mutex)
  216. {
  217. vSemaphoreDelete(mutex);
  218. }
  219. static int32_t IRAM_ATTR mutex_lock_wrapper(void *mutex)
  220. {
  221. return (int32_t)xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
  222. }
  223. static int32_t IRAM_ATTR mutex_unlock_wrapper(void *mutex)
  224. {
  225. return (int32_t)xSemaphoreGiveRecursive(mutex);
  226. }
  227. static void * queue_create_wrapper(uint32_t queue_len, uint32_t item_size)
  228. {
  229. return (void *)xQueueCreate(queue_len, item_size);
  230. }
  231. static int32_t queue_send_wrapper(void *queue, void *item, uint32_t block_time_tick)
  232. {
  233. if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) {
  234. return (int32_t)xQueueSend(queue, item, portMAX_DELAY);
  235. } else {
  236. return (int32_t)xQueueSend(queue, item, block_time_tick);
  237. }
  238. }
  239. static int32_t IRAM_ATTR queue_send_from_isr_wrapper(void *queue, void *item, void *hptw)
  240. {
  241. return (int32_t)xQueueSendFromISR(queue, item, hptw);
  242. }
  243. static int32_t queue_send_to_back_wrapper(void *queue, void *item, uint32_t block_time_tick)
  244. {
  245. return (int32_t)xQueueGenericSend(queue, item, block_time_tick, queueSEND_TO_BACK);
  246. }
  247. static int32_t queue_send_to_front_wrapper(void *queue, void *item, uint32_t block_time_tick)
  248. {
  249. return (int32_t)xQueueGenericSend(queue, item, block_time_tick, queueSEND_TO_FRONT);
  250. }
  251. static int32_t queue_recv_wrapper(void *queue, void *item, uint32_t block_time_tick)
  252. {
  253. if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) {
  254. return (int32_t)xQueueReceive(queue, item, portMAX_DELAY);
  255. } else {
  256. return (int32_t)xQueueReceive(queue, item, block_time_tick);
  257. }
  258. }
  259. 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)
  260. {
  261. if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) {
  262. return (uint32_t)xEventGroupWaitBits(event, bits_to_wait_for, clear_on_exit, wait_for_all_bits, portMAX_DELAY);
  263. } else {
  264. return (uint32_t)xEventGroupWaitBits(event, bits_to_wait_for, clear_on_exit, wait_for_all_bits, block_time_tick);
  265. }
  266. }
  267. 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)
  268. {
  269. return (uint32_t)xTaskCreatePinnedToCore(task_func, name, stack_depth, param, prio, task_handle, (core_id < portNUM_PROCESSORS ? core_id : tskNO_AFFINITY));
  270. }
  271. static int32_t task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle)
  272. {
  273. return (uint32_t)xTaskCreate(task_func, name, stack_depth, param, prio, task_handle);
  274. }
  275. static int32_t IRAM_ATTR task_ms_to_tick_wrapper(uint32_t ms)
  276. {
  277. return (int32_t)(ms / portTICK_PERIOD_MS);
  278. }
  279. static int32_t task_get_max_priority_wrapper(void)
  280. {
  281. return (int32_t)(configMAX_PRIORITIES);
  282. }
  283. static void IRAM_ATTR timer_arm_wrapper(void *timer, uint32_t tmout, bool repeat)
  284. {
  285. ets_timer_arm(timer, tmout, repeat);
  286. }
  287. static void IRAM_ATTR timer_disarm_wrapper(void *timer)
  288. {
  289. ets_timer_disarm(timer);
  290. }
  291. static void timer_done_wrapper(void *ptimer)
  292. {
  293. ets_timer_done(ptimer);
  294. }
  295. static void timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg)
  296. {
  297. ets_timer_setfn(ptimer, pfunction, parg);
  298. }
  299. static void IRAM_ATTR timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat)
  300. {
  301. ets_timer_arm_us(ptimer, us, repeat);
  302. }
  303. static int get_time_wrapper(void *t)
  304. {
  305. return os_get_time(t);
  306. }
  307. static void * IRAM_ATTR malloc_internal_wrapper(size_t size)
  308. {
  309. return heap_caps_malloc(size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
  310. }
  311. static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size)
  312. {
  313. return heap_caps_realloc(ptr, size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
  314. }
  315. static void * IRAM_ATTR calloc_internal_wrapper(size_t n, size_t size)
  316. {
  317. return heap_caps_calloc(n, size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
  318. }
  319. static void * IRAM_ATTR zalloc_internal_wrapper(size_t size)
  320. {
  321. void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
  322. if (ptr) {
  323. memset(ptr, 0, size);
  324. }
  325. return ptr;
  326. }
  327. static void sc_ack_send_wrapper(void *param)
  328. {
  329. return sc_ack_send((sc_ack_t *)param);
  330. }
  331. static uint32_t coex_status_get_wrapper(void)
  332. {
  333. #if CONFIG_SW_COEXIST_ENABLE
  334. return coex_status_get();
  335. #else
  336. return 0;
  337. #endif
  338. }
  339. static int coex_wifi_request_wrapper(uint32_t event, uint32_t latency, uint32_t duration)
  340. {
  341. #if CONFIG_SW_COEXIST_ENABLE
  342. return coex_wifi_request(event, latency, duration);
  343. #else
  344. return 0;
  345. #endif
  346. }
  347. static int coex_wifi_release_wrapper(uint32_t event)
  348. {
  349. #if CONFIG_SW_COEXIST_ENABLE
  350. return coex_wifi_release(event);
  351. #else
  352. return 0;
  353. #endif
  354. }
  355. int IRAM_ATTR coex_bt_request_wrapper(uint32_t event, uint32_t latency, uint32_t duration)
  356. {
  357. #if CONFIG_SW_COEXIST_ENABLE
  358. return coex_bt_request(event, latency, duration);
  359. #else
  360. return 0;
  361. #endif
  362. }
  363. int IRAM_ATTR coex_bt_release_wrapper(uint32_t event)
  364. {
  365. #if CONFIG_SW_COEXIST_ENABLE
  366. return coex_bt_release(event);
  367. #else
  368. return 0;
  369. #endif
  370. }
  371. int coex_register_bt_cb_wrapper(coex_func_cb_t cb)
  372. {
  373. #if CONFIG_SW_COEXIST_ENABLE
  374. return coex_register_bt_cb(cb);
  375. #else
  376. return 0;
  377. #endif
  378. }
  379. uint32_t IRAM_ATTR coex_bb_reset_lock_wrapper(void)
  380. {
  381. #if CONFIG_SW_COEXIST_ENABLE
  382. return coex_bb_reset_lock();
  383. #else
  384. return 0;
  385. #endif
  386. }
  387. void IRAM_ATTR coex_bb_reset_unlock_wrapper(uint32_t restore)
  388. {
  389. #if CONFIG_SW_COEXIST_ENABLE
  390. coex_bb_reset_unlock(restore);
  391. #endif
  392. }
  393. wifi_osi_funcs_t g_wifi_osi_funcs = {
  394. ._version = ESP_WIFI_OS_ADAPTER_VERSION,
  395. ._set_isr = set_isr_wrapper,
  396. ._ints_on = xt_ints_on,
  397. ._ints_off = xt_ints_off,
  398. ._spin_lock_create = spin_lock_create_wrapper,
  399. ._spin_lock_delete = free,
  400. ._wifi_int_disable = wifi_int_disable_wrapper,
  401. ._wifi_int_restore = wifi_int_restore_wrapper,
  402. ._task_yield_from_isr = task_yield_from_isr_wrapper,
  403. ._semphr_create = semphr_create_wrapper,
  404. ._semphr_delete = semphr_delete_wrapper,
  405. ._semphr_take = semphr_take_wrapper,
  406. ._semphr_give = semphr_give_wrapper,
  407. ._mutex_create = mutex_create_wrapper,
  408. ._recursive_mutex_create = recursive_mutex_create_wrapper,
  409. ._mutex_delete = mutex_delete_wrapper,
  410. ._mutex_lock = mutex_lock_wrapper,
  411. ._mutex_unlock = mutex_unlock_wrapper,
  412. ._queue_create = queue_create_wrapper,
  413. ._queue_delete = vQueueDelete,
  414. ._queue_send = queue_send_wrapper,
  415. ._queue_send_from_isr = queue_send_from_isr_wrapper,
  416. ._queue_send_to_back = queue_send_to_back_wrapper,
  417. ._queue_send_to_front = queue_send_to_front_wrapper,
  418. ._queue_recv = queue_recv_wrapper,
  419. ._queue_msg_waiting = uxQueueMessagesWaiting,
  420. ._event_group_create = xEventGroupCreate,
  421. ._event_group_delete = vEventGroupDelete,
  422. ._event_group_set_bits = xEventGroupSetBits,
  423. ._event_group_clear_bits = xEventGroupClearBits,
  424. ._event_group_wait_bits = event_group_wait_bits_wrapper,
  425. ._task_create_pinned_to_core = task_create_pinned_to_core_wrapper,
  426. ._task_create = task_create_wrapper,
  427. ._task_delete = vTaskDelete,
  428. ._task_delay = vTaskDelay,
  429. ._task_ms_to_tick = task_ms_to_tick_wrapper,
  430. ._task_get_current_task = xTaskGetCurrentTaskHandle,
  431. ._task_get_max_priority = task_get_max_priority_wrapper,
  432. ._malloc = malloc,
  433. ._free = free,
  434. ._get_free_heap_size = esp_get_free_heap_size,
  435. ._rand = esp_random,
  436. ._dport_access_stall_other_cpu_start_wrap = esp_dport_access_stall_other_cpu_start_wrap,
  437. ._dport_access_stall_other_cpu_end_wrap = esp_dport_access_stall_other_cpu_end_wrap,
  438. ._phy_rf_deinit = esp_phy_rf_deinit,
  439. ._phy_load_cal_and_init = esp_phy_load_cal_and_init,
  440. ._read_mac = esp_read_mac,
  441. ._timer_arm = timer_arm_wrapper,
  442. ._timer_disarm = timer_disarm_wrapper,
  443. ._timer_done = timer_done_wrapper,
  444. ._timer_setfn = timer_setfn_wrapper,
  445. ._timer_arm_us = timer_arm_us_wrapper,
  446. ._periph_module_enable = periph_module_enable,
  447. ._periph_module_disable = periph_module_disable,
  448. ._esp_timer_get_time = esp_timer_get_time,
  449. ._nvs_set_i8 = nvs_set_i8,
  450. ._nvs_get_i8 = nvs_get_i8,
  451. ._nvs_set_u8 = nvs_set_u8,
  452. ._nvs_get_u8 = nvs_get_u8,
  453. ._nvs_set_u16 = nvs_set_u16,
  454. ._nvs_get_u16 = nvs_get_u16,
  455. ._nvs_open = nvs_open,
  456. ._nvs_close = nvs_close,
  457. ._nvs_commit = nvs_commit,
  458. ._nvs_set_blob = nvs_set_blob,
  459. ._nvs_get_blob = nvs_get_blob,
  460. ._nvs_erase_key = nvs_erase_key,
  461. ._get_random = os_get_random,
  462. ._get_time = get_time_wrapper,
  463. ._random = os_random,
  464. ._log_write = esp_log_write,
  465. ._log_timestamp = esp_log_timestamp,
  466. ._malloc_internal = malloc_internal_wrapper,
  467. ._realloc_internal = realloc_internal_wrapper,
  468. ._calloc_internal = calloc_internal_wrapper,
  469. ._zalloc_internal = zalloc_internal_wrapper,
  470. ._wifi_malloc = wifi_malloc,
  471. ._wifi_realloc = wifi_realloc,
  472. ._wifi_calloc = wifi_calloc,
  473. ._wifi_zalloc = wifi_zalloc_wrapper,
  474. ._wifi_create_queue = wifi_create_queue_wrapper,
  475. ._wifi_delete_queue = wifi_delete_queue_wrapper,
  476. ._modem_sleep_enter = esp_modem_sleep_enter,
  477. ._modem_sleep_exit = esp_modem_sleep_exit,
  478. ._modem_sleep_register = esp_modem_sleep_register,
  479. ._modem_sleep_deregister = esp_modem_sleep_deregister,
  480. ._sc_ack_send = sc_ack_send_wrapper,
  481. ._sc_ack_send_stop = sc_ack_send_stop,
  482. ._coex_status_get = coex_status_get_wrapper,
  483. ._coex_wifi_request = coex_wifi_request_wrapper,
  484. ._coex_wifi_release = coex_wifi_release_wrapper,
  485. ._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
  486. };
  487. coex_adapter_funcs_t g_coex_adapter_funcs = {
  488. ._version = COEX_ADAPTER_VERSION,
  489. ._spin_lock_create = spin_lock_create_wrapper,
  490. ._spin_lock_delete = free,
  491. ._int_disable = wifi_int_disable_wrapper,
  492. ._int_enable = wifi_int_restore_wrapper,
  493. ._task_yield_from_isr = task_yield_from_isr_wrapper,
  494. ._semphr_create = semphr_create_wrapper,
  495. ._semphr_delete = semphr_delete_wrapper,
  496. ._semphr_take_from_isr = semphr_take_from_isr_wrapper,
  497. ._semphr_give_from_isr = semphr_give_from_isr_wrapper,
  498. ._semphr_take = semphr_take_wrapper,
  499. ._semphr_give = semphr_give_wrapper,
  500. ._is_in_isr = xPortInIsrContext,
  501. ._malloc_internal = malloc_internal_wrapper,
  502. ._free = free,
  503. ._timer_disarm = timer_disarm_wrapper,
  504. ._timer_done = timer_done_wrapper,
  505. ._timer_setfn = timer_setfn_wrapper,
  506. ._timer_arm_us = timer_arm_us_wrapper,
  507. ._esp_timer_get_time = esp_timer_get_time,
  508. ._magic = COEX_ADAPTER_MAGIC,
  509. };