idle.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef CX_ZIVUOS_IDLE_H_INCLUDED
  2. #define CX_ZIVUOS_IDLE_H_INCLUDED
  3. #include "zv_types.h"
  4. /**
  5. * That is type of IDLE worker function. It is called when all other
  6. * tasks are in waiting (not ready) state.
  7. * That function must analyze tasks stack, and check that any task
  8. * exists. If all task slots are empty, then IDLE worker would
  9. * return false. When tasks exists, but are not in ready state it
  10. * must return true.
  11. *
  12. * @param self Kernel to work on.
  13. * @return True when any task exists, false if not.
  14. */
  15. typedef bool (*zv_idle_worker_t) (struct zv_kernel_s *);
  16. /**
  17. * That is default IDLE worker function. That check if any task exists on
  18. * task stack. It must be called from custom IDLE worker, if any custom
  19. * IDLE worker had been selected.
  20. *
  21. * @param self Kernel to work on.
  22. * @return True when any task exists, false when not.
  23. */
  24. bool zv_idle_worker_check_tasks(struct zv_kernel_s *self);
  25. /**
  26. * Select zv_idle_worker_check_tasks as default IDLE worker.
  27. */
  28. #define zv_idle_worker_default zv_idle_worker_check_tasks
  29. #endif