-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathos_app_hooks.c
226 lines (192 loc) · 7.33 KB
/
os_app_hooks.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/*
************************************************************************************************************************
* uC/OS-III
* The Real-Time Kernel
*
* (c) Copyright 2009, Micrium, Weston, FL
* All Rights Reserved
* www.Micrium.com
*
* APPLICATION HOOKS
*
* File : OS_APP_HOOKS.C
* By : JJL
* Version : V3.00.6
*
* LICENSING TERMS:
* ---------------
* uC/OS-III is provided in source form to registered licensees. It is illegal to distribute this source
* code to any third party unless you receive written permission by an authorized Micrium officer.
*
* Knowledge of the source code may NOT be used to develop a similar product.
*
* Please help us continue to provide the Embedded community with the finest software available. Your
* honesty is greatly appreciated.
*
* You can contact us at www.micrium.com.
************************************************************************************************************************
*/
#include <os.h>
#include <os_app_hooks.h>
/*$PAGE*/
/*
************************************************************************************************************************
* SET ALL APPLICATION HOOKS
*
* Description: Set ALL application hooks.
*
* Arguments : none.
*
* Note(s) : none
************************************************************************************************************************
*/
void App_OS_SetAllHooks (void)
{
CPU_SR_ALLOC();
CPU_CRITICAL_ENTER();
OS_AppTaskCreateHookPtr = App_OS_TaskCreateHook;
OS_AppTaskDelHookPtr = App_OS_TaskDelHook;
OS_AppTaskReturnHookPtr = App_OS_TaskReturnHook;
OS_AppIdleTaskHookPtr = App_OS_IdleTaskHook;
OS_AppStatTaskHookPtr = App_OS_StatTaskHook;
OS_AppTaskSwHookPtr = App_OS_TaskSwHook;
OS_AppTimeTickHookPtr = App_OS_TimeTickHook;
CPU_CRITICAL_EXIT();
}
/*$PAGE*/
/*
************************************************************************************************************************
* CLEAR ALL APPLICATION HOOKS
*
* Description: Clear ALL application hooks.
*
* Arguments : none.
*
* Note(s) : none
************************************************************************************************************************
*/
void App_OS_ClrAllHooks (void)
{
CPU_SR_ALLOC();
CPU_CRITICAL_ENTER();
OS_AppTaskCreateHookPtr = (OS_APP_HOOK_TCB)0;
OS_AppTaskDelHookPtr = (OS_APP_HOOK_TCB)0;
OS_AppTaskReturnHookPtr = (OS_APP_HOOK_TCB)0;
OS_AppIdleTaskHookPtr = (OS_APP_HOOK_VOID)0;
OS_AppStatTaskHookPtr = (OS_APP_HOOK_VOID)0;
OS_AppTaskSwHookPtr = (OS_APP_HOOK_VOID)0;
OS_AppTimeTickHookPtr = (OS_APP_HOOK_VOID)0;
CPU_CRITICAL_EXIT();
}
/*$PAGE*/
/*
************************************************************************************************************************
* APPLICATION TASK CREATION HOOK
*
* Description: This function is called when a task is created.
*
* Arguments : p_tcb is a pointer to the task control block of the task being created.
*
* Note(s) : none
************************************************************************************************************************
*/
void App_OS_TaskCreateHook (OS_TCB *p_tcb)
{
}
/*$PAGE*/
/*
************************************************************************************************************************
* APPLICATION TASK DELETION HOOK
*
* Description: This function is called when a task is deleted.
*
* Arguments : p_tcb is a pointer to the task control block of the task being deleted.
*
* Note(s) : none
************************************************************************************************************************
*/
void App_OS_TaskDelHook (OS_TCB *p_tcb)
{
}
/*$PAGE*/
/*
************************************************************************************************************************
* APPLICATION TASK RETURN HOOK
*
* Description: This function is called if a task accidentally returns. In other words, a task should either be an
* infinite loop or delete itself when done.
*
* Arguments : p_tcb is a pointer to the OS_TCB of the task that is returning.
*
* Note(s) : none
************************************************************************************************************************
*/
void App_OS_TaskReturnHook (OS_TCB *p_tcb)
{
}
/*$PAGE*/
/*
************************************************************************************************************************
* APPLICATION IDLE TASK HOOK
*
* Description: This function is called by the idle task. This hook has been added to allow you to do such things as
* STOP the CPU to conserve power.
*
* Arguments : none
*
* Note(s) : none
************************************************************************************************************************
*/
void App_OS_IdleTaskHook (void)
{
}
/*$PAGE*/
/*
************************************************************************************************************************
* APPLICATION STATISTIC TASK HOOK
*
* Description: This function is called every second by uC/OS-III's statistics task. This allows your application to add
* functionality to the statistics task.
*
* Arguments : none
*
* Note(s) : none
************************************************************************************************************************
*/
void App_OS_StatTaskHook (void)
{
}
/*$PAGE*/
/*
************************************************************************************************************************
* APPLICATION TASK SWITCH HOOK
*
* Description: This function is called when a task switch is performed. This allows you to perform other operations
* during a context switch.
*
* Arguments : none
*
* Note(s) : 1) Interrupts are disabled during this call.
* 2) It is assumed that the global pointer 'OSTCBHighRdyPtr' points to the TCB of the task that will be
* 'switched in' (i.e. the highest priority task) and, 'OSTCBCurPtr' points to the task being switched out
* (i.e. the preempted task).
************************************************************************************************************************
*/
void App_OS_TaskSwHook (void)
{
}
/*$PAGE*/
/*
************************************************************************************************************************
* APPLICATION TICK HOOK
*
* Description: This function is called every tick.
*
* Arguments : none
*
* Note(s) : 1) This function is assumed to be called from the Tick ISR.
************************************************************************************************************************
*/
void App_OS_TimeTickHook (void)
{
}