LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
os_app_hooks.c
Go to the documentation of this file.
1 /*
2 ************************************************************************************************************************
3 * uC/OS-III
4 * The Real-Time Kernel
5 *
6 * (c) Copyright 2009-2012; 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.03.00
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 contact us at www.micrium.com, or by phone at +1 (954) 217-2036.
30 ************************************************************************************************************************
31 */
32 
33 #define MICRIUM_SOURCE
34 #include <os.h>
35 #include <os_app_hooks.h>
36 
37 /*$PAGE*/
38 /*
39 ************************************************************************************************************************
40 * SET ALL APPLICATION HOOKS
41 *
42 * Description: Set ALL application hooks.
43 *
44 * Arguments : none.
45 *
46 * Note(s) : none
47 ************************************************************************************************************************
48 */
49 
50 void App_OS_SetAllHooks (void)
51 {
52 #if OS_CFG_APP_HOOKS_EN > 0u
53  CPU_SR_ALLOC();
54 
55 
57  OS_AppTaskCreateHookPtr = App_OS_TaskCreateHook;
58  OS_AppTaskDelHookPtr = App_OS_TaskDelHook;
59  OS_AppTaskReturnHookPtr = App_OS_TaskReturnHook;
60 
61  OS_AppIdleTaskHookPtr = App_OS_IdleTaskHook;
62  OS_AppStatTaskHookPtr = App_OS_StatTaskHook;
63  OS_AppTaskSwHookPtr = App_OS_TaskSwHook;
64  OS_AppTimeTickHookPtr = App_OS_TimeTickHook;
66 #endif
67 }
68 
69 /*$PAGE*/
70 /*
71 ************************************************************************************************************************
72 * CLEAR ALL APPLICATION HOOKS
73 *
74 * Description: Clear ALL application hooks.
75 *
76 * Arguments : none.
77 *
78 * Note(s) : none
79 ************************************************************************************************************************
80 */
81 
82 void App_OS_ClrAllHooks (void)
83 {
84 #if OS_CFG_APP_HOOKS_EN > 0u
85  CPU_SR_ALLOC();
86 
87 
89  OS_AppTaskCreateHookPtr = (OS_APP_HOOK_TCB)0;
90  OS_AppTaskDelHookPtr = (OS_APP_HOOK_TCB)0;
91  OS_AppTaskReturnHookPtr = (OS_APP_HOOK_TCB)0;
92 
93  OS_AppIdleTaskHookPtr = (OS_APP_HOOK_VOID)0;
94  OS_AppStatTaskHookPtr = (OS_APP_HOOK_VOID)0;
95  OS_AppTaskSwHookPtr = (OS_APP_HOOK_VOID)0;
96  OS_AppTimeTickHookPtr = (OS_APP_HOOK_VOID)0;
98 #endif
99 }
100 
101 /*$PAGE*/
102 /*
103 ************************************************************************************************************************
104 * APPLICATION TASK CREATION HOOK
105 *
106 * Description: This function is called when a task is created.
107 *
108 * Arguments : p_tcb is a pointer to the task control block of the task being created.
109 *
110 * Note(s) : none
111 ************************************************************************************************************************
112 */
113 
114 void App_OS_TaskCreateHook (OS_TCB *p_tcb)
115 {
116  (void)&p_tcb;
117 }
118 
119 /*$PAGE*/
120 /*
121 ************************************************************************************************************************
122 * APPLICATION TASK DELETION HOOK
123 *
124 * Description: This function is called when a task is deleted.
125 *
126 * Arguments : p_tcb is a pointer to the task control block of the task being deleted.
127 *
128 * Note(s) : none
129 ************************************************************************************************************************
130 */
131 
132 void App_OS_TaskDelHook (OS_TCB *p_tcb)
133 {
134  (void)&p_tcb;
135 }
136 
137 /*$PAGE*/
138 /*
139 ************************************************************************************************************************
140 * APPLICATION TASK RETURN HOOK
141 *
142 * Description: This function is called if a task accidentally returns. In other words, a task should either be an
143 * infinite loop or delete itself when done.
144 *
145 * Arguments : p_tcb is a pointer to the OS_TCB of the task that is returning.
146 *
147 * Note(s) : none
148 ************************************************************************************************************************
149 */
150 
151 void App_OS_TaskReturnHook (OS_TCB *p_tcb)
152 {
153  (void)&p_tcb;
154 }
155 
156 /*$PAGE*/
157 /*
158 ************************************************************************************************************************
159 * APPLICATION IDLE TASK HOOK
160 *
161 * Description: This function is called by the idle task. This hook has been added to allow you to do such things as
162 * STOP the CPU to conserve power.
163 *
164 * Arguments : none
165 *
166 * Note(s) : none
167 ************************************************************************************************************************
168 */
169 
171 {
172 
173 }
174 
175 /*$PAGE*/
176 /*
177 ************************************************************************************************************************
178 * APPLICATION OS INITIALIZATION HOOK
179 *
180 * Description: This function is called by OSInit() at the beginning of OSInit().
181 *
182 * Arguments : none
183 *
184 * Note(s) : none
185 ************************************************************************************************************************
186 */
187 
188 void App_OS_InitHook (void)
189 {
190 
191 }
192 
193 /*$PAGE*/
194 /*
195 ************************************************************************************************************************
196 * APPLICATION STATISTIC TASK HOOK
197 *
198 * Description: This function is called every second by uC/OS-III's statistics task. This allows your application to add
199 * functionality to the statistics task.
200 *
201 * Arguments : none
202 *
203 * Note(s) : none
204 ************************************************************************************************************************
205 */
206 
208 {
209 
210 }
211 
212 /*$PAGE*/
213 /*
214 ************************************************************************************************************************
215 * APPLICATION TASK SWITCH HOOK
216 *
217 * Description: This function is called when a task switch is performed. This allows you to perform other operations
218 * during a context switch.
219 *
220 * Arguments : none
221 *
222 * Note(s) : 1) Interrupts are disabled during this call.
223 * 2) It is assumed that the global pointer 'OSTCBHighRdyPtr' points to the TCB of the task that will be
224 * 'switched in' (i.e. the highest priority task) and, 'OSTCBCurPtr' points to the task being switched out
225 * (i.e. the preempted task).
226 ************************************************************************************************************************
227 */
228 
229 void App_OS_TaskSwHook (void)
230 {
231 
232 }
233 
234 /*$PAGE*/
235 /*
236 ************************************************************************************************************************
237 * APPLICATION TICK HOOK
238 *
239 * Description: This function is called every tick.
240 *
241 * Arguments : none
242 *
243 * Note(s) : 1) This function is assumed to be called from the Tick ISR.
244 ************************************************************************************************************************
245 */
246 
248 {
249 
250 }