You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.1 KiB

  1. #include "ztask.h"
  2. #define TAG "ztask"
  3. /*
  4. * @brief: uartص״̬תʱ֪ͨ
  5. *
  6. */
  7. void Task_init(Task_t* task){
  8. if(task->TaskNotify){
  9. task->TaskNotify--;
  10. if(task->m_tasktransition){
  11. task->m_status = working;
  12. //ZLOGI(TAG, "task_init");
  13. if(task->m_taskfunc) task->m_taskfunc();
  14. task->m_status = end;
  15. }
  16. else{
  17. task->m_status = idle;
  18. }
  19. }
  20. }
  21. /*
  22. * @brief صע
  23. *
  24. *
  25. *
  26. *ж״̬
  27. *:״̬ת
  28. * ״̬ת1.صǼע
  29. * 2.֪ͨ
  30. *
  31. *ǿУ״̬ת
  32. * ״̬תأ1.ע
  33. * 2.֪ͨȴ״̬
  34. */
  35. void Task_start(taskfuction cb, Task_t* task){
  36. if(task->m_status != idle){
  37. task->m_tasktransition = false;//״̬: �ǿ��У�״̬ת����
  38. task->TaskNotify++; //֪ͨ����
  39. }
  40. else{
  41. task->m_taskfunc = cb;
  42. task->m_tasktransition = true;//״̬: ���У�״̬ת����
  43. task->TaskNotify++; //֪ͨ����
  44. }
  45. //ZLOGI(TAG, "TaskNotify: %d", task->TaskNotify);
  46. }