OS_AppHooks.c 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. /*
  2. *********************************************************************************************************
  3. * uC/OS-II APP HOOKS
  4. *
  5. * (c) Copyright 2005-2009, Micrium, Weston, FL
  6. * All Rights Reserved
  7. *
  8. *
  9. * File : OS_AppHooks.c
  10. * By :
  11. * Version : V2.91
  12. *
  13. * LICENSING TERMS:
  14. * ---------------
  15. * uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.
  16. * If you plan on using uC/OS-II in a commercial product you need to contact Micriµm to properly license
  17. * its use in your product. We provide ALL the source code for your convenience and to help you experience
  18. * uC/OS-II. The fact that the source is provided does NOT mean that you can use it without paying a
  19. * licensing fee.
  20. *********************************************************************************************************
  21. */
  22. /*
  23. *********************************************************************************************************
  24. *********************************************************************************************************
  25. *
  26. *********************************************************************************************************
  27. *********************************************************************************************************
  28. */
  29. /*
  30. *********************************************************************************************************
  31. * INCLUDE FILES
  32. *********************************************************************************************************
  33. */
  34. #include <includes.h>
  35. /*
  36. *********************************************************************************************************
  37. * TASK RETURN HOOK (APPLICATION)
  38. *
  39. * Description :
  40. *
  41. * Argument : ptcb is a pointer to the task control block of the task being created.
  42. *
  43. * Note :
  44. *********************************************************************************************************
  45. */
  46. void OSTaskReturnHook(OS_TCB *ptcb)
  47. {
  48. }
  49. #if OS_APP_HOOKS_EN > 0u
  50. /*
  51. *********************************************************************************************************
  52. * TASK CREATION HOOK (APPLICATION)
  53. *
  54. * Description : This function is called when a task is created.
  55. *
  56. * Argument : ptcb is a pointer to the task control block of the task being created.
  57. *
  58. * Note : (1) Interrupts are disabled during this call.
  59. *********************************************************************************************************
  60. */
  61. void App_TaskCreateHook (OS_TCB *ptcb)
  62. {
  63. #if (OS_VIEW_MODULE == DEF_ENABLED)
  64. OSView_TaskCreateHook(ptcb);
  65. #endif
  66. }
  67. /*
  68. *********************************************************************************************************
  69. * TASK DELETION HOOK (APPLICATION)
  70. *
  71. * Description : This function is called when a task is deleted.
  72. *
  73. * Argument : ptcb is a pointer to the task control block of the task being deleted.
  74. *
  75. * Note : (1) Interrupts are disabled during this call.
  76. *********************************************************************************************************
  77. */
  78. void App_TaskDelHook (OS_TCB *ptcb)
  79. {
  80. (void)ptcb;
  81. }
  82. /*
  83. *********************************************************************************************************
  84. * IDLE TASK HOOK (APPLICATION)
  85. *
  86. * Description : This function is called by OSTaskIdleHook(), which is called by the idle task. This hook
  87. * has been added to allow you to do such things as STOP the CPU to conserve power.
  88. *
  89. * Argument : none.
  90. *
  91. * Note : (1) Interrupts are enabled during this call.
  92. *********************************************************************************************************
  93. */
  94. #if OS_VERSION >= 251
  95. void App_TaskIdleHook (void)
  96. {
  97. // static unsigned int sct=0;
  98. // if(++sct>10000){
  99. // sct=0;
  100. // printf("I\r\n");
  101. // }
  102. }
  103. #endif
  104. /*
  105. *********************************************************************************************************
  106. * TASK RETURN HOOK (APPLICATION)
  107. *
  108. * Description :
  109. *
  110. * Argument : none.
  111. *
  112. * Note :
  113. *********************************************************************************************************
  114. */
  115. void App_TaskReturnHook (OS_TCB *ptcb)
  116. {
  117. }
  118. /*
  119. *********************************************************************************************************
  120. * STATISTIC TASK HOOK (APPLICATION)
  121. *
  122. * Description : This function is called by OSTaskStatHook(), which is called every second by uC/OS-II's
  123. * statistics task. This allows your application to add functionality to the statistics task.
  124. *
  125. * Argument : none.
  126. *********************************************************************************************************
  127. */
  128. void App_TaskStatHook (void)
  129. {
  130. }
  131. /*
  132. *********************************************************************************************************
  133. * TASK SWITCH HOOK (APPLICATION)
  134. *
  135. * Description : This function is called when a task switch is performed. This allows you to perform other
  136. * operations during a context switch.
  137. *
  138. * Argument : none.
  139. *
  140. * Note : 1 Interrupts are disabled during this call.
  141. *
  142. * 2 It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
  143. * will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the
  144. * task being switched out (i.e. the preempted task).
  145. *********************************************************************************************************
  146. */
  147. #if OS_TASK_SW_HOOK_EN > 0u
  148. void App_TaskSwHook (void)
  149. {
  150. #if (OS_VIEW_MODULE == DEF_ENABLED)
  151. OSView_TaskSwHook();
  152. #endif
  153. }
  154. #endif
  155. /*
  156. *********************************************************************************************************
  157. * OS_TCBInit() HOOK (APPLICATION)
  158. *
  159. * Description : This function is called by OSTCBInitHook(), which is called by OS_TCBInit() after setting
  160. * up most of the TCB.
  161. *
  162. * Argument : ptcb is a pointer to the TCB of the task being created.
  163. *
  164. * Note : (1) Interrupts may or may not be ENABLED during this call.
  165. *********************************************************************************************************
  166. */
  167. #if OS_VERSION >= 204
  168. void App_TCBInitHook (OS_TCB *ptcb)
  169. {
  170. (void)ptcb;
  171. }
  172. #endif
  173. /*
  174. *********************************************************************************************************
  175. * App_TimeTickHook() HOOK (APPLICATION)
  176. *
  177. * Description :
  178. *
  179. * Argument :
  180. *
  181. * Note :
  182. *********************************************************************************************************
  183. */
  184. #if OS_TIME_TICK_HOOK_EN > 0u
  185. void App_TimeTickHook (void)
  186. {
  187. #if (OS_VIEW_MODULE == DEF_ENABLED)
  188. OSView_TickHook();
  189. #endif
  190. }
  191. #endif
  192. #endif
  193. /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/