thread.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * This file is only used for doxygen document generation.
  3. */
  4. /**
  5. * @addtogroup Thread
  6. * @{
  7. */
  8. /**
  9. * @brief This function will handle IPI interrupt and do a scheduling in system.
  10. *
  11. * @param vector is the number of IPI interrupt for system scheduling.
  12. *
  13. * @param param is not used, and can be set to RT_NULL.
  14. *
  15. * @note this function should be invoke or register as ISR in BSP.
  16. *
  17. * @note this function is only implemented in scheduler_mp.c.
  18. */
  19. void rt_scheduler_ipi_handler(int vector, void *param);
  20. /**
  21. * @brief This function will perform one scheduling. It will select one thread
  22. * with the highest priority level in global ready queue or local ready queue,
  23. * then switch to it.
  24. *
  25. * @note this function is implemented in both scheduler_up.c and scheduler_mp.c.
  26. */
  27. void rt_schedule(void);
  28. /**
  29. * @brief This function checks whether a scheduling is needed after an IRQ context switching. If yes,
  30. * it will select one thread with the highest priority level, and then switch
  31. * to it.
  32. *
  33. * @param context is the context to be switched to.
  34. *
  35. * @note this function is only implemented in scheduler_mp.c.
  36. */
  37. void rt_scheduler_do_irq_switch(void *context);
  38. /**
  39. * @brief This function will insert a thread to the system ready queue. The state of
  40. * thread will be set as READY and the thread will be removed from suspend queue.
  41. *
  42. * @param thread is the thread to be inserted.
  43. *
  44. * @note Please do not invoke this function in user application.
  45. *
  46. * @note this function is implemented in both scheduler_up.c and scheduler_mp.c.
  47. */
  48. void rt_schedule_insert_thread(struct rt_thread *thread);
  49. /**
  50. * @brief This function will remove a thread from system ready queue.
  51. *
  52. * @param thread is the thread to be removed.
  53. *
  54. * @note Please do not invoke this function in user application.
  55. *
  56. * @note this function is implemented in both scheduler_up.c and scheduler_mp.c.
  57. */
  58. void rt_schedule_remove_thread(struct rt_thread *thread);
  59. /**
  60. * @brief This function will lock the thread scheduler.
  61. *
  62. * @note this function is implemented in both scheduler_up.c and scheduler_mp.c.
  63. */
  64. void rt_enter_critical(void);
  65. /**
  66. * @brief This function will unlock the thread scheduler.
  67. *
  68. * @note this function is implemented in both scheduler_up.c and scheduler_mp.c.
  69. */
  70. void rt_exit_critical(void);
  71. /**
  72. * @brief Get the scheduler lock level.
  73. *
  74. * @return the level of the scheduler lock. 0 means unlocked.
  75. *
  76. * @note this function is implemented in both scheduler_up.c and scheduler_mp.c.
  77. */
  78. rt_uint16_t rt_critical_level(void);
  79. /**@}*/