Skip to content

Commit e160a67

Browse files
committed
Initial commit
0 parents  commit e160a67

File tree

557 files changed

+170883
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

557 files changed

+170883
-0
lines changed

Cfg/Template/app_cfg.h

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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+
*
18+
* APPLICATION CONFIGURATION
19+
*
20+
* EXAMPLE CODE
21+
*
22+
* Filename : app_cfg.h
23+
*********************************************************************************************************
24+
*/
25+
26+
#ifndef _APP_CFG_H_
27+
#define _APP_CFG_H_
28+
29+
30+
/*
31+
*********************************************************************************************************
32+
* INCLUDE FILES
33+
*********************************************************************************************************
34+
*/
35+
36+
#include <stdarg.h>
37+
#include <stdio.h>
38+
39+
40+
/*
41+
*********************************************************************************************************
42+
* MODULE ENABLE / DISABLE
43+
*********************************************************************************************************
44+
*/
45+
46+
47+
/*
48+
*********************************************************************************************************
49+
* TASK PRIORITIES
50+
*********************************************************************************************************
51+
*/
52+
53+
#define APP_CFG_STARTUP_TASK_PRIO 3u
54+
55+
#define OS_TASK_TMR_PRIO (OS_LOWEST_PRIO - 2u)
56+
57+
58+
/*
59+
*********************************************************************************************************
60+
* TASK STACK SIZES
61+
* Size of the task stacks (# of OS_STK entries)
62+
*********************************************************************************************************
63+
*/
64+
65+
#define APP_CFG_STARTUP_TASK_STK_SIZE 128u
66+
67+
68+
/*
69+
*********************************************************************************************************
70+
* TRACE / DEBUG CONFIGURATION
71+
*********************************************************************************************************
72+
*/
73+
74+
#ifndef TRACE_LEVEL_OFF
75+
#define TRACE_LEVEL_OFF 0u
76+
#endif
77+
78+
#ifndef TRACE_LEVEL_INFO
79+
#define TRACE_LEVEL_INFO 1u
80+
#endif
81+
82+
#ifndef TRACE_LEVEL_DBG
83+
#define TRACE_LEVEL_DBG 2u
84+
#endif
85+
86+
#define APP_TRACE_LEVEL TRACE_LEVEL_OFF
87+
#define APP_TRACE printf
88+
89+
#define APP_TRACE_INFO(x) ((APP_TRACE_LEVEL >= TRACE_LEVEL_INFO) ? (void)(APP_TRACE x) : (void)0)
90+
#define APP_TRACE_DBG(x) ((APP_TRACE_LEVEL >= TRACE_LEVEL_DBG) ? (void)(APP_TRACE x) : (void)0)
91+
92+
93+
/*
94+
*********************************************************************************************************
95+
* MODULE END
96+
*********************************************************************************************************
97+
*/
98+
99+
#endif /* End of module include. */

Cfg/Template/app_hooks.c

Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
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+
*
18+
* uC/OS-II
19+
* Application Hooks
20+
*
21+
* Filename : app_hooks.c
22+
* Version : V2.93.00
23+
*********************************************************************************************************
24+
*/
25+
26+
/*
27+
*********************************************************************************************************
28+
* INCLUDE FILES
29+
*********************************************************************************************************
30+
*/
31+
32+
#include <os.h>
33+
34+
35+
/*
36+
*********************************************************************************************************
37+
* EXTERN GLOBAL VARIABLES
38+
*********************************************************************************************************
39+
*/
40+
41+
42+
/*
43+
*********************************************************************************************************
44+
* LOCAL CONSTANTS
45+
*********************************************************************************************************
46+
*/
47+
48+
49+
/*
50+
*********************************************************************************************************
51+
* LOCAL DATA TYPES
52+
*********************************************************************************************************
53+
*/
54+
55+
/*
56+
*********************************************************************************************************
57+
* LOCAL TABLES
58+
*********************************************************************************************************
59+
*/
60+
61+
62+
/*
63+
*********************************************************************************************************
64+
* LOCAL GLOBAL VARIABLES
65+
*********************************************************************************************************
66+
*/
67+
68+
69+
/*
70+
*********************************************************************************************************
71+
* LOCAL FUNCTION PROTOTYPES
72+
*********************************************************************************************************
73+
*/
74+
75+
76+
77+
/*
78+
*********************************************************************************************************
79+
*********************************************************************************************************
80+
** GLOBAL FUNCTIONS
81+
*********************************************************************************************************
82+
*********************************************************************************************************
83+
*/
84+
85+
/*
86+
*********************************************************************************************************
87+
*********************************************************************************************************
88+
** uC/OS-II APP HOOKS
89+
*********************************************************************************************************
90+
*********************************************************************************************************
91+
*/
92+
93+
#if (OS_APP_HOOKS_EN > 0)
94+
95+
/*
96+
*********************************************************************************************************
97+
* TASK CREATION HOOK (APPLICATION)
98+
*
99+
* Description : This function is called when a task is created.
100+
*
101+
* Argument(s) : ptcb is a pointer to the task control block of the task being created.
102+
*
103+
* Note(s) : (1) Interrupts are disabled during this call.
104+
*********************************************************************************************************
105+
*/
106+
107+
void App_TaskCreateHook (OS_TCB *ptcb)
108+
{
109+
(void)ptcb;
110+
}
111+
112+
113+
/*
114+
*********************************************************************************************************
115+
* TASK DELETION HOOK (APPLICATION)
116+
*
117+
* Description : This function is called when a task is deleted.
118+
*
119+
* Argument(s) : ptcb is a pointer to the task control block of the task being deleted.
120+
*
121+
* Note(s) : (1) Interrupts are disabled during this call.
122+
*********************************************************************************************************
123+
*/
124+
125+
void App_TaskDelHook (OS_TCB *ptcb)
126+
{
127+
(void)ptcb;
128+
}
129+
130+
131+
/*
132+
*********************************************************************************************************
133+
* IDLE TASK HOOK (APPLICATION)
134+
*
135+
* Description : This function is called by OSTaskIdleHook(), which is called by the idle task. This hook
136+
* has been added to allow you to do such things as STOP the CPU to conserve power.
137+
*
138+
* Argument(s) : none.
139+
*
140+
* Note(s) : (1) Interrupts are enabled during this call.
141+
*********************************************************************************************************
142+
*/
143+
144+
#if OS_VERSION >= 251
145+
void App_TaskIdleHook (void)
146+
{
147+
}
148+
#endif
149+
150+
151+
/*
152+
*********************************************************************************************************
153+
* STATISTIC TASK HOOK (APPLICATION)
154+
*
155+
* Description : This function is called by OSTaskStatHook(), which is called every second by uC/OS-II's
156+
* statistics task. This allows your application to add functionality to the statistics task.
157+
*
158+
* Argument(s) : none.
159+
*********************************************************************************************************
160+
*/
161+
162+
void App_TaskStatHook (void)
163+
{
164+
}
165+
166+
167+
/*
168+
*********************************************************************************************************
169+
* TASK RETURN HOOK (APPLICATION)
170+
*
171+
* Description: This function is called if a task accidentally returns. In other words, a task should
172+
* either be an infinite loop or delete itself when done.
173+
*
174+
* Arguments : ptcb is a pointer to the task control block of the task that is returning.
175+
*
176+
* Note(s) : none
177+
*********************************************************************************************************
178+
*/
179+
180+
181+
#if OS_VERSION >= 289
182+
void App_TaskReturnHook (OS_TCB *ptcb)
183+
{
184+
(void)ptcb;
185+
}
186+
#endif
187+
188+
189+
/*
190+
*********************************************************************************************************
191+
* TASK SWITCH HOOK (APPLICATION)
192+
*
193+
* Description : This function is called when a task switch is performed. This allows you to perform other
194+
* operations during a context switch.
195+
*
196+
* Argument(s) : none.
197+
*
198+
* Note(s) : (1) Interrupts are disabled during this call.
199+
*
200+
* (2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
201+
* will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the
202+
* task being switched out (i.e. the preempted task).
203+
*********************************************************************************************************
204+
*/
205+
206+
#if OS_TASK_SW_HOOK_EN > 0
207+
void App_TaskSwHook (void)
208+
{
209+
210+
}
211+
#endif
212+
213+
214+
/*
215+
*********************************************************************************************************
216+
* OS_TCBInit() HOOK (APPLICATION)
217+
*
218+
* Description : This function is called by OSTCBInitHook(), which is called by OS_TCBInit() after setting
219+
* up most of the TCB.
220+
*
221+
* Argument(s) : ptcb is a pointer to the TCB of the task being created.
222+
*
223+
* Note(s) : (1) Interrupts may or may not be ENABLED during this call.
224+
*********************************************************************************************************
225+
*/
226+
227+
#if OS_VERSION >= 204
228+
void App_TCBInitHook (OS_TCB *ptcb)
229+
{
230+
(void)ptcb;
231+
}
232+
#endif
233+
234+
235+
/*
236+
*********************************************************************************************************
237+
* TICK HOOK (APPLICATION)
238+
*
239+
* Description : This function is called every tick.
240+
*
241+
* Argument(s) : none.
242+
*
243+
* Note(s) : (1) Interrupts may or may not be ENABLED during this call.
244+
*********************************************************************************************************
245+
*/
246+
247+
#if OS_TIME_TICK_HOOK_EN > 0
248+
void App_TimeTickHook (void)
249+
{
250+
251+
}
252+
#endif
253+
#endif

0 commit comments

Comments
 (0)