esp_coexist_adapter.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright 2019 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. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #ifndef __ESP_COEXIST_ADAPTER_H__
  15. #define __ESP_COEXIST_ADAPTER_H__
  16. #include <stdarg.h>
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. #define COEX_ADAPTER_VERSION 0x00000002
  21. #define COEX_ADAPTER_MAGIC 0xDEADBEAF
  22. #define COEX_ADAPTER_FUNCS_TIME_BLOCKING 0xffffffff
  23. typedef struct {
  24. int32_t _version;
  25. #if CONFIG_IDF_TARGET_ESP32
  26. void *(* _spin_lock_create)(void);
  27. void (* _spin_lock_delete)(void *lock);
  28. uint32_t (*_int_disable)(void *mux);
  29. void (*_int_enable)(void *mux, uint32_t tmp);
  30. #endif
  31. void (*_task_yield_from_isr)(void);
  32. void *(*_semphr_create)(uint32_t max, uint32_t init);
  33. void (*_semphr_delete)(void *semphr);
  34. int32_t (*_semphr_take_from_isr)(void *semphr, void *hptw);
  35. int32_t (*_semphr_give_from_isr)(void *semphr, void *hptw);
  36. int32_t (*_semphr_take)(void *semphr, uint32_t block_time_tick);
  37. int32_t (*_semphr_give)(void *semphr);
  38. int (* _is_in_isr)(void);
  39. void * (* _malloc_internal)(size_t size);
  40. void (* _free)(void *p);
  41. #if CONFIG_IDF_TARGET_ESP32
  42. void (* _timer_disarm)(void *timer);
  43. void (* _timer_done)(void *ptimer);
  44. void (* _timer_setfn)(void *ptimer, void *pfunction, void *parg);
  45. void (* _timer_arm_us)(void *ptimer, uint32_t us, bool repeat);
  46. #endif
  47. int64_t (* _esp_timer_get_time)(void);
  48. int32_t _magic;
  49. } coex_adapter_funcs_t;
  50. extern coex_adapter_funcs_t g_coex_adapter_funcs;
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif /* __ESP_COEXIST_ADAPTER_H__ */