api_os.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef _API_OS_H_
  2. #define _API_OS_H_
  3. typedef struct _thread_cfg_t{
  4. uint8_t enable;
  5. uint8_t priority;
  6. uint16_t stack_heap_size;
  7. }thread_cfg_t;
  8. struct thread_cfg_cb{
  9. thread_cfg_t bt_hw;
  10. thread_cfg_t bt_stack;
  11. thread_cfg_t aupcm;
  12. thread_cfg_t dirver;
  13. thread_cfg_t timer;
  14. thread_cfg_t main;
  15. };
  16. typedef void (*thd_drv_callback_t)(uint8_t msg);
  17. typedef void (*thd_aupcm_callback_t)(uint8_t msg);
  18. /**
  19. * @brief Post a msg to driver thread.
  20. * @note it should be called after 'thread_driver_user_callback_register', or failed.
  21. * @param msg: the msg need to post to driver thread.
  22. * @retval true if msg post successfully, or false.
  23. */
  24. bool thread_driver_msg_post(uint8_t msg);
  25. /**
  26. * @brief Register a callback func for driver vendor msg.
  27. * @note the driver thread should be exists, or will failed.
  28. * @param callback: the callback func.
  29. * @retval true if func register successfully, or false.
  30. */
  31. bool thread_driver_user_callback_register(thd_drv_callback_t callback);
  32. /**
  33. * @brief Post a msg to aupcm thread.
  34. * @note it should be called after 'thread_aupcm_callback_register', or failed.
  35. * @param msg: the msg need to post to aupcm thread.
  36. * @retval true if msg post successfully, or false.
  37. */
  38. bool thread_aupcm_msg_post(uint8_t msg);
  39. /**
  40. * @brief Register a callback func for aupcm thread msg.
  41. * @note the aupcm thread should be exists, or will failed.
  42. * @param callback: the callback func.
  43. * @retval true if func register successfully, or false.
  44. */
  45. bool thread_aupcm_callback_register(thd_aupcm_callback_t callback);
  46. void thread_driver_create(void);
  47. void thread_aupcm_create(void);
  48. void thread_btstack_create(void);
  49. #endif