task.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef _TASK_H_
  2. #define _TASK_H_
  3. #include "ets_sys.h"
  4. #include "osapi.h"
  5. #include "os_type.h"
  6. /* use LOW / MEDIUM / HIGH since it isn't clear from the docs which is higher */
  7. #define TASK_PRIORITY_LOW 0
  8. #define TASK_PRIORITY_MEDIUM 1
  9. #define TASK_PRIORITY_HIGH 2
  10. #define TASK_PRIORITY_COUNT 3
  11. /*
  12. * Signals are a 32-bit number of the form header:14; count:16, priority:2. The header
  13. * is just a fixed fingerprint and the count is allocated serially by the task get_id()
  14. * function.
  15. */
  16. #define task_post(priority,handle,param) system_os_post(priority, ((handle) | priority), param)
  17. #define task_post_low(handle,param) task_post(TASK_PRIORITY_LOW, handle, param)
  18. #define task_post_medium(handle,param) task_post(TASK_PRIORITY_MEDIUM, handle, param)
  19. #define task_post_high(handle,param) task_post(TASK_PRIORITY_HIGH, handle, param)
  20. #define task_handle_t os_signal_t
  21. #define task_param_t os_param_t
  22. typedef void (*task_callback_t)(task_param_t param, uint8 prio);
  23. bool task_init_handler(uint8 priority, uint8 qlen);
  24. task_handle_t task_get_id(task_callback_t t);
  25. #endif