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.
 
 
 
 
 

254 rivejä
9.0 KiB

  1. /*
  2. *********************************************************************************************************
  3. * EXAMPLE CODE
  4. *
  5. * This file is provided as an example on how to use Micrium products.
  6. *
  7. * Please feel free to use any application code labeled as 'EXAMPLE CODE' in
  8. * your application products. Example code may be used as is, in whole or in
  9. * part, or may be used as a reference only. This file can be modified as
  10. * required to meet the end-product requirements.
  11. *
  12. *********************************************************************************************************
  13. */
  14. /*
  15. *********************************************************************************************************
  16. *
  17. * uC/OS-II
  18. * Application Hooks
  19. *
  20. * Filename : app_hooks.c
  21. * Version : V2.93.01
  22. *********************************************************************************************************
  23. */
  24. /*
  25. *********************************************************************************************************
  26. * INCLUDE FILES
  27. *********************************************************************************************************
  28. */
  29. #include <os.h>
  30. /*
  31. *********************************************************************************************************
  32. * EXTERN GLOBAL VARIABLES
  33. *********************************************************************************************************
  34. */
  35. /*
  36. *********************************************************************************************************
  37. * LOCAL CONSTANTS
  38. *********************************************************************************************************
  39. */
  40. /*
  41. *********************************************************************************************************
  42. * LOCAL DATA TYPES
  43. *********************************************************************************************************
  44. */
  45. /*
  46. *********************************************************************************************************
  47. * LOCAL TABLES
  48. *********************************************************************************************************
  49. */
  50. /*
  51. *********************************************************************************************************
  52. * LOCAL GLOBAL VARIABLES
  53. *********************************************************************************************************
  54. */
  55. /*
  56. *********************************************************************************************************
  57. * LOCAL FUNCTION PROTOTYPES
  58. *********************************************************************************************************
  59. */
  60. /*
  61. *********************************************************************************************************
  62. *********************************************************************************************************
  63. ** GLOBAL FUNCTIONS
  64. *********************************************************************************************************
  65. *********************************************************************************************************
  66. */
  67. /*
  68. *********************************************************************************************************
  69. *********************************************************************************************************
  70. ** uC/OS-II APP HOOKS
  71. *********************************************************************************************************
  72. *********************************************************************************************************
  73. */
  74. #if (OS_APP_HOOKS_EN > 0)
  75. /*
  76. *********************************************************************************************************
  77. * TASK CREATION HOOK (APPLICATION)
  78. *
  79. * Description : This function is called when a task is created.
  80. *
  81. * Argument(s) : ptcb is a pointer to the task control block of the task being created.
  82. *
  83. * Note(s) : (1) Interrupts are disabled during this call.
  84. *********************************************************************************************************
  85. */
  86. void App_TaskCreateHook (OS_TCB *ptcb)
  87. {
  88. (void)ptcb;
  89. }
  90. /*
  91. *********************************************************************************************************
  92. * TASK DELETION HOOK (APPLICATION)
  93. *
  94. * Description : This function is called when a task is deleted.
  95. *
  96. * Argument(s) : ptcb is a pointer to the task control block of the task being deleted.
  97. *
  98. * Note(s) : (1) Interrupts are disabled during this call.
  99. *********************************************************************************************************
  100. */
  101. void App_TaskDelHook (OS_TCB *ptcb)
  102. {
  103. (void)ptcb;
  104. }
  105. /*
  106. *********************************************************************************************************
  107. * IDLE TASK HOOK (APPLICATION)
  108. *
  109. * Description : This function is called by OSTaskIdleHook(), which is called by the idle task. This hook
  110. * has been added to allow you to do such things as STOP the CPU to conserve power.
  111. *
  112. * Argument(s) : none.
  113. *
  114. * Note(s) : (1) Interrupts are enabled during this call.
  115. *********************************************************************************************************
  116. */
  117. #if OS_VERSION >= 251
  118. void App_TaskIdleHook (void)
  119. {
  120. }
  121. #endif
  122. /*
  123. *********************************************************************************************************
  124. * STATISTIC TASK HOOK (APPLICATION)
  125. *
  126. * Description : This function is called by OSTaskStatHook(), which is called every second by uC/OS-II's
  127. * statistics task. This allows your application to add functionality to the statistics task.
  128. *
  129. * Argument(s) : none.
  130. *********************************************************************************************************
  131. */
  132. void App_TaskStatHook (void)
  133. {
  134. }
  135. /*
  136. *********************************************************************************************************
  137. * TASK RETURN HOOK (APPLICATION)
  138. *
  139. * Description: This function is called if a task accidentally returns. In other words, a task should
  140. * either be an infinite loop or delete itself when done.
  141. *
  142. * Arguments : ptcb is a pointer to the task control block of the task that is returning.
  143. *
  144. * Note(s) : none
  145. *********************************************************************************************************
  146. */
  147. #if OS_VERSION >= 289
  148. void App_TaskReturnHook (OS_TCB *ptcb)
  149. {
  150. (void)ptcb;
  151. }
  152. #endif
  153. /*
  154. *********************************************************************************************************
  155. * TASK SWITCH HOOK (APPLICATION)
  156. *
  157. * Description : This function is called when a task switch is performed. This allows you to perform other
  158. * operations during a context switch.
  159. *
  160. * Argument(s) : none.
  161. *
  162. * Note(s) : (1) Interrupts are disabled during this call.
  163. *
  164. * (2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
  165. * will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the
  166. * task being switched out (i.e. the preempted task).
  167. *********************************************************************************************************
  168. */
  169. #if OS_TASK_SW_HOOK_EN > 0
  170. void App_TaskSwHook (void)
  171. {
  172. }
  173. #endif
  174. /*
  175. *********************************************************************************************************
  176. * OS_TCBInit() HOOK (APPLICATION)
  177. *
  178. * Description : This function is called by OSTCBInitHook(), which is called by OS_TCBInit() after setting
  179. * up most of the TCB.
  180. *
  181. * Argument(s) : ptcb is a pointer to the TCB of the task being created.
  182. *
  183. * Note(s) : (1) Interrupts may or may not be ENABLED during this call.
  184. *********************************************************************************************************
  185. */
  186. #if OS_VERSION >= 204
  187. void App_TCBInitHook (OS_TCB *ptcb)
  188. {
  189. (void)ptcb;
  190. }
  191. #endif
  192. /*
  193. *********************************************************************************************************
  194. * TICK HOOK (APPLICATION)
  195. *
  196. * Description : This function is called every tick.
  197. *
  198. * Argument(s) : none.
  199. *
  200. * Note(s) : (1) Interrupts may or may not be ENABLED during this call.
  201. *********************************************************************************************************
  202. */
  203. #if OS_TIME_TICK_HOOK_EN > 0
  204. void App_TimeTickHook (void)
  205. {
  206. }
  207. #endif
  208. #endif