训练营PLSR题目
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

253 行
8.3 KiB

  1. /*
  2. ************************************************************************************************************************
  3. * uC/OS-III
  4. * The Real-Time Kernel
  5. *
  6. * (c) Copyright 2009-2014; Micrium, Inc.; Weston, FL
  7. * All rights reserved. Protected by international copyright laws.
  8. *
  9. * APPLICATION HOOKS
  10. *
  11. * File : OS_APP_HOOKS.C
  12. * By : JJL
  13. * Version : V3.04.04
  14. *
  15. * LICENSING TERMS:
  16. * ---------------
  17. * uC/OS-III is provided in source form for FREE short-term evaluation, for educational use or
  18. * for peaceful research. If you plan or intend to use uC/OS-III in a commercial application/
  19. * product then, you need to contact Micrium to properly license uC/OS-III for its use in your
  20. * application/product. We provide ALL the source code for your convenience and to help you
  21. * experience uC/OS-III. The fact that the source is provided does NOT mean that you can use
  22. * it commercially without paying a licensing fee.
  23. *
  24. * Knowledge of the source code may NOT be used to develop a similar product.
  25. *
  26. * Please help us continue to provide the embedded community with the finest software available.
  27. * Your honesty is greatly appreciated.
  28. *
  29. * You can find our product's user manual, API reference, release notes and
  30. * more information at https://doc.micrium.com.
  31. * You can contact us at www.micrium.com.
  32. ************************************************************************************************************************
  33. */
  34. #define MICRIUM_SOURCE
  35. #include "os.h"
  36. #include <os_app_hooks.h>
  37. /*
  38. ************************************************************************************************************************
  39. * SET ALL APPLICATION HOOKS
  40. *
  41. * Description: Set ALL application hooks.
  42. *
  43. * Arguments : none.
  44. *
  45. * Note(s) : none
  46. ************************************************************************************************************************
  47. */
  48. void App_OS_SetAllHooks (void)
  49. {
  50. #if OS_CFG_APP_HOOKS_EN > 0u
  51. CPU_SR_ALLOC();
  52. CPU_CRITICAL_ENTER();
  53. OS_AppTaskCreateHookPtr = App_OS_TaskCreateHook;
  54. OS_AppTaskDelHookPtr = App_OS_TaskDelHook;
  55. OS_AppTaskReturnHookPtr = App_OS_TaskReturnHook;
  56. OS_AppIdleTaskHookPtr = App_OS_IdleTaskHook;
  57. OS_AppStatTaskHookPtr = App_OS_StatTaskHook;
  58. OS_AppTaskSwHookPtr = App_OS_TaskSwHook;
  59. OS_AppTimeTickHookPtr = App_OS_TimeTickHook;
  60. CPU_CRITICAL_EXIT();
  61. #endif
  62. }
  63. /*
  64. ************************************************************************************************************************
  65. * CLEAR ALL APPLICATION HOOKS
  66. *
  67. * Description: Clear ALL application hooks.
  68. *
  69. * Arguments : none.
  70. *
  71. * Note(s) : none
  72. ************************************************************************************************************************
  73. */
  74. void App_OS_ClrAllHooks (void)
  75. {
  76. #if OS_CFG_APP_HOOKS_EN > 0u
  77. CPU_SR_ALLOC();
  78. CPU_CRITICAL_ENTER();
  79. OS_AppTaskCreateHookPtr = (OS_APP_HOOK_TCB)0;
  80. OS_AppTaskDelHookPtr = (OS_APP_HOOK_TCB)0;
  81. OS_AppTaskReturnHookPtr = (OS_APP_HOOK_TCB)0;
  82. OS_AppIdleTaskHookPtr = (OS_APP_HOOK_VOID)0;
  83. OS_AppStatTaskHookPtr = (OS_APP_HOOK_VOID)0;
  84. OS_AppTaskSwHookPtr = (OS_APP_HOOK_VOID)0;
  85. OS_AppTimeTickHookPtr = (OS_APP_HOOK_VOID)0;
  86. CPU_CRITICAL_EXIT();
  87. #endif
  88. }
  89. /*
  90. ************************************************************************************************************************
  91. * APPLICATION TASK CREATION HOOK
  92. *
  93. * Description: This function is called when a task is created.
  94. *
  95. * Arguments : p_tcb is a pointer to the task control block of the task being created.
  96. *
  97. * Note(s) : none
  98. ************************************************************************************************************************
  99. */
  100. void App_OS_TaskCreateHook (OS_TCB *p_tcb)
  101. {
  102. (void)&p_tcb;
  103. }
  104. /*
  105. ************************************************************************************************************************
  106. * APPLICATION TASK DELETION HOOK
  107. *
  108. * Description: This function is called when a task is deleted.
  109. *
  110. * Arguments : p_tcb is a pointer to the task control block of the task being deleted.
  111. *
  112. * Note(s) : none
  113. ************************************************************************************************************************
  114. */
  115. void App_OS_TaskDelHook (OS_TCB *p_tcb)
  116. {
  117. (void)&p_tcb;
  118. }
  119. /*
  120. ************************************************************************************************************************
  121. * APPLICATION TASK RETURN HOOK
  122. *
  123. * Description: This function is called if a task accidentally returns. In other words, a task should either be an
  124. * infinite loop or delete itself when done.
  125. *
  126. * Arguments : p_tcb is a pointer to the OS_TCB of the task that is returning.
  127. *
  128. * Note(s) : none
  129. ************************************************************************************************************************
  130. */
  131. void App_OS_TaskReturnHook (OS_TCB *p_tcb)
  132. {
  133. (void)&p_tcb;
  134. }
  135. /*
  136. ************************************************************************************************************************
  137. * APPLICATION IDLE TASK HOOK
  138. *
  139. * Description: This function is called by the idle task. This hook has been added to allow you to do such things as
  140. * STOP the CPU to conserve power.
  141. *
  142. * Arguments : none
  143. *
  144. * Note(s) : none
  145. ************************************************************************************************************************
  146. */
  147. void App_OS_IdleTaskHook (void)
  148. {
  149. }
  150. /*
  151. ************************************************************************************************************************
  152. * APPLICATION OS INITIALIZATION HOOK
  153. *
  154. * Description: This function is called by OSInit() at the beginning of OSInit().
  155. *
  156. * Arguments : none
  157. *
  158. * Note(s) : none
  159. ************************************************************************************************************************
  160. */
  161. void App_OS_InitHook (void)
  162. {
  163. }
  164. /*
  165. ************************************************************************************************************************
  166. * APPLICATION STATISTIC TASK HOOK
  167. *
  168. * Description: This function is called every second by uC/OS-III's statistics task. This allows your application to add
  169. * functionality to the statistics task.
  170. *
  171. * Arguments : none
  172. *
  173. * Note(s) : none
  174. ************************************************************************************************************************
  175. */
  176. void App_OS_StatTaskHook (void)
  177. {
  178. }
  179. /*
  180. ************************************************************************************************************************
  181. * APPLICATION TASK SWITCH HOOK
  182. *
  183. * Description: This function is called when a task switch is performed. This allows you to perform other operations
  184. * during a context switch.
  185. *
  186. * Arguments : none
  187. *
  188. * Note(s) : 1) Interrupts are disabled during this call.
  189. * 2) It is assumed that the global pointer 'OSTCBHighRdyPtr' points to the TCB of the task that will be
  190. * 'switched in' (i.e. the highest priority task) and, 'OSTCBCurPtr' points to the task being switched out
  191. * (i.e. the preempted task).
  192. ************************************************************************************************************************
  193. */
  194. void App_OS_TaskSwHook (void)
  195. {
  196. }
  197. /*
  198. ************************************************************************************************************************
  199. * APPLICATION TICK HOOK
  200. *
  201. * Description: This function is called every tick.
  202. *
  203. * Arguments : none
  204. *
  205. * Note(s) : 1) This function is assumed to be called from the Tick ISR.
  206. ************************************************************************************************************************
  207. */
  208. void App_OS_TimeTickHook (void)
  209. {
  210. }