task.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef TASK_H_
  2. #define TASK_H_
  3. #include "sys.h"
  4. //define the task scheduler base type
  5. typedef struct {
  6. s8 (*handler)(void *pdata);
  7. void *pdata;
  8. }task;
  9. /******************************************************************************
  10. * FunctionName : new_task
  11. * Description : new a empty task
  12. * Parameters : none
  13. * Returns : the created task
  14. *******************************************************************************/
  15. task* new_task(void);
  16. /******************************************************************************
  17. * FunctionName : add_task
  18. * Description : add a new task to the system
  19. * Parameters : the task to be added
  20. * Returns : the add operation result
  21. *******************************************************************************/
  22. s8 add_task(task *ptask);
  23. /******************************************************************************
  24. * FunctionName : pop_task
  25. * Description : pop a task from the system
  26. * Parameters : none
  27. * Returns : the task
  28. *******************************************************************************/
  29. task* pop_task(void);
  30. /******************************************************************************
  31. * FunctionName : delete_task
  32. * Description : delete a task
  33. * Parameters : the task to be deleted
  34. * Returns : none
  35. *******************************************************************************/
  36. void delete_task(task *ptask);
  37. #endif