mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-19 09:38:32 -04:00
Counting semaphore demo added.
This commit is contained in:
parent
a8eabeabbb
commit
d69d2df8d6
11 changed files with 581 additions and 202 deletions
|
@ -50,18 +50,19 @@
|
|||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 1
|
||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 256 ) /* This can be made smaller if required. */
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 32 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 1
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_CO_ROUTINES 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 1
|
||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 256 ) /* This can be made smaller if required. */
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 32 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_16_BIT_TICKS 1
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_CO_ROUTINES 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
|
||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 10 )
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
|
|
@ -65,38 +65,6 @@
|
|||
* <HR>
|
||||
*/
|
||||
|
||||
/*
|
||||
Changes from V1.00:
|
||||
|
||||
+ Prevent the call to kbhit() for debug builds as the debugger seems to
|
||||
have problems stepping over the call.
|
||||
|
||||
Changes from V1.2.3
|
||||
|
||||
+ The integer and comtest tasks are now used when the cooperative scheduler
|
||||
is being used. Previously they were only used with the preemptive
|
||||
scheduler.
|
||||
|
||||
Changes from V1.2.6
|
||||
|
||||
+ Create new tasks as defined by the new demo application file dynamic.c.
|
||||
|
||||
Changes from V2.0.0
|
||||
|
||||
+ Delay periods are now specified using variables and constants of
|
||||
portTickType rather than unsigned portLONG.
|
||||
|
||||
Changes from V3.1.1
|
||||
|
||||
+ The tasks defined in the new file "events.c" are now created and
|
||||
monitored for errors.
|
||||
|
||||
Changes from V3.2.4
|
||||
|
||||
+ Now includes the flash co-routine demo rather than the flash task demo.
|
||||
This is to demonstrate the co-routine functionality.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <conio.h>
|
||||
#include "FreeRTOS.h"
|
||||
|
@ -122,6 +90,7 @@ Changes from V3.2.4
|
|||
#include "blocktim.h"
|
||||
#include "GenQTest.h"
|
||||
#include "QPeek.h"
|
||||
#include "countsem.h"
|
||||
|
||||
/* Priority definitions for the tasks in the demo application. */
|
||||
#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
|
@ -185,6 +154,7 @@ portSHORT main( void )
|
|||
vStartDynamicPriorityTasks();
|
||||
vStartMultiEventTasks();
|
||||
vStartQueuePeekTasks();
|
||||
vStartCountingSemaphoreTasks();
|
||||
|
||||
/* Create the "Print" task as described at the top of the file. */
|
||||
xTaskCreate( vErrorChecks, "Print", mainPRINT_STACK_SIZE, NULL, mainPRINT_TASK_PRIORITY, NULL );
|
||||
|
@ -408,6 +378,12 @@ static portSHORT sErrorHasOccurred = pdFALSE;
|
|||
sErrorHasOccurred = pdTRUE;
|
||||
}
|
||||
|
||||
if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
vDisplayMessage( "Error in counting semaphore demo task!\r\n" );
|
||||
sErrorHasOccurred = pdTRUE;
|
||||
}
|
||||
|
||||
if( sErrorHasOccurred == pdFALSE )
|
||||
{
|
||||
vDisplayMessage( "OK " );
|
||||
|
|
|
@ -75,7 +75,7 @@ WVList
|
|||
0
|
||||
19
|
||||
WPickList
|
||||
53
|
||||
55
|
||||
20
|
||||
MItem
|
||||
3
|
||||
|
@ -724,8 +724,8 @@ WVList
|
|||
0
|
||||
172
|
||||
MItem
|
||||
27
|
||||
..\COMMON\MINIMAL\crflash.c
|
||||
28
|
||||
..\COMMON\MINIMAL\countsem.c
|
||||
173
|
||||
WString
|
||||
4
|
||||
|
@ -742,8 +742,8 @@ WVList
|
|||
0
|
||||
176
|
||||
MItem
|
||||
26
|
||||
..\COMMON\MINIMAL\crhook.c
|
||||
27
|
||||
..\COMMON\MINIMAL\crflash.c
|
||||
177
|
||||
WString
|
||||
4
|
||||
|
@ -760,8 +760,8 @@ WVList
|
|||
0
|
||||
180
|
||||
MItem
|
||||
28
|
||||
..\COMMON\MINIMAL\GenQTest.c
|
||||
26
|
||||
..\COMMON\MINIMAL\crhook.c
|
||||
181
|
||||
WString
|
||||
4
|
||||
|
@ -778,8 +778,8 @@ WVList
|
|||
0
|
||||
184
|
||||
MItem
|
||||
25
|
||||
..\COMMON\MINIMAL\QPeek.c
|
||||
28
|
||||
..\COMMON\MINIMAL\GenQTest.c
|
||||
185
|
||||
WString
|
||||
4
|
||||
|
@ -796,8 +796,8 @@ WVList
|
|||
0
|
||||
188
|
||||
MItem
|
||||
15
|
||||
fileio\fileio.c
|
||||
25
|
||||
..\COMMON\MINIMAL\QPeek.c
|
||||
189
|
||||
WString
|
||||
4
|
||||
|
@ -814,8 +814,8 @@ WVList
|
|||
0
|
||||
192
|
||||
MItem
|
||||
6
|
||||
main.c
|
||||
15
|
||||
fileio\fileio.c
|
||||
193
|
||||
WString
|
||||
4
|
||||
|
@ -832,8 +832,8 @@ WVList
|
|||
0
|
||||
196
|
||||
MItem
|
||||
17
|
||||
partest\partest.c
|
||||
6
|
||||
main.c
|
||||
197
|
||||
WString
|
||||
4
|
||||
|
@ -850,8 +850,8 @@ WVList
|
|||
0
|
||||
200
|
||||
MItem
|
||||
15
|
||||
serial\serial.c
|
||||
17
|
||||
partest\partest.c
|
||||
201
|
||||
WString
|
||||
4
|
||||
|
@ -868,26 +868,26 @@ WVList
|
|||
0
|
||||
204
|
||||
MItem
|
||||
3
|
||||
*.h
|
||||
15
|
||||
serial\serial.c
|
||||
205
|
||||
WString
|
||||
3
|
||||
NIL
|
||||
4
|
||||
COBJ
|
||||
206
|
||||
WVList
|
||||
0
|
||||
207
|
||||
WVList
|
||||
0
|
||||
-1
|
||||
20
|
||||
1
|
||||
1
|
||||
0
|
||||
0
|
||||
208
|
||||
MItem
|
||||
31
|
||||
..\..\SOURCE\INCLUDE\croutine.h
|
||||
3
|
||||
*.h
|
||||
209
|
||||
WString
|
||||
3
|
||||
|
@ -898,14 +898,14 @@ WVList
|
|||
211
|
||||
WVList
|
||||
0
|
||||
204
|
||||
1
|
||||
-1
|
||||
1
|
||||
0
|
||||
0
|
||||
212
|
||||
MItem
|
||||
27
|
||||
..\..\source\include\list.h
|
||||
31
|
||||
..\..\SOURCE\INCLUDE\croutine.h
|
||||
213
|
||||
WString
|
||||
3
|
||||
|
@ -916,14 +916,14 @@ WVList
|
|||
215
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
216
|
||||
MItem
|
||||
31
|
||||
..\..\source\include\portable.h
|
||||
27
|
||||
..\..\source\include\list.h
|
||||
217
|
||||
WString
|
||||
3
|
||||
|
@ -934,14 +934,14 @@ WVList
|
|||
219
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
220
|
||||
MItem
|
||||
31
|
||||
..\..\source\include\projdefs.h
|
||||
..\..\source\include\portable.h
|
||||
221
|
||||
WString
|
||||
3
|
||||
|
@ -952,14 +952,14 @@ WVList
|
|||
223
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
224
|
||||
MItem
|
||||
28
|
||||
..\..\source\include\queue.h
|
||||
31
|
||||
..\..\source\include\projdefs.h
|
||||
225
|
||||
WString
|
||||
3
|
||||
|
@ -970,14 +970,14 @@ WVList
|
|||
227
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
228
|
||||
MItem
|
||||
29
|
||||
..\..\source\include\semphr.h
|
||||
28
|
||||
..\..\source\include\queue.h
|
||||
229
|
||||
WString
|
||||
3
|
||||
|
@ -988,14 +988,14 @@ WVList
|
|||
231
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
232
|
||||
MItem
|
||||
27
|
||||
..\..\source\include\task.h
|
||||
29
|
||||
..\..\source\include\semphr.h
|
||||
233
|
||||
WString
|
||||
3
|
||||
|
@ -1006,14 +1006,14 @@ WVList
|
|||
235
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
236
|
||||
MItem
|
||||
55
|
||||
..\..\source\portable\owatcom\16bitdos\common\portasm.h
|
||||
27
|
||||
..\..\source\include\task.h
|
||||
237
|
||||
WString
|
||||
3
|
||||
|
@ -1024,14 +1024,14 @@ WVList
|
|||
239
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
240
|
||||
MItem
|
||||
53
|
||||
..\..\source\portable\owatcom\16bitdos\pc\portmacro.h
|
||||
55
|
||||
..\..\source\portable\owatcom\16bitdos\common\portasm.h
|
||||
241
|
||||
WString
|
||||
3
|
||||
|
@ -1042,14 +1042,14 @@ WVList
|
|||
243
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
244
|
||||
MItem
|
||||
26
|
||||
..\common\include\blockq.h
|
||||
53
|
||||
..\..\source\portable\owatcom\16bitdos\pc\portmacro.h
|
||||
245
|
||||
WString
|
||||
3
|
||||
|
@ -1060,14 +1060,14 @@ WVList
|
|||
247
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
248
|
||||
MItem
|
||||
28
|
||||
..\COMMON\INCLUDE\blocktim.h
|
||||
26
|
||||
..\common\include\blockq.h
|
||||
249
|
||||
WString
|
||||
3
|
||||
|
@ -1078,14 +1078,14 @@ WVList
|
|||
251
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
252
|
||||
MItem
|
||||
27
|
||||
..\common\include\comtest.h
|
||||
28
|
||||
..\COMMON\INCLUDE\blocktim.h
|
||||
253
|
||||
WString
|
||||
3
|
||||
|
@ -1096,14 +1096,14 @@ WVList
|
|||
255
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
256
|
||||
MItem
|
||||
26
|
||||
..\COMMON\INCLUDE\crhook.h
|
||||
27
|
||||
..\common\include\comtest.h
|
||||
257
|
||||
WString
|
||||
3
|
||||
|
@ -1114,14 +1114,14 @@ WVList
|
|||
259
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
260
|
||||
MItem
|
||||
25
|
||||
..\common\include\death.h
|
||||
28
|
||||
..\COMMON\INCLUDE\countsem.h
|
||||
261
|
||||
WString
|
||||
3
|
||||
|
@ -1132,14 +1132,14 @@ WVList
|
|||
263
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
264
|
||||
MItem
|
||||
27
|
||||
..\COMMON\INCLUDE\dynamic.h
|
||||
26
|
||||
..\COMMON\INCLUDE\crhook.h
|
||||
265
|
||||
WString
|
||||
3
|
||||
|
@ -1150,14 +1150,14 @@ WVList
|
|||
267
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
268
|
||||
MItem
|
||||
26
|
||||
..\common\include\fileio.h
|
||||
25
|
||||
..\common\include\death.h
|
||||
269
|
||||
WString
|
||||
3
|
||||
|
@ -1168,14 +1168,14 @@ WVList
|
|||
271
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
272
|
||||
MItem
|
||||
25
|
||||
..\common\include\flash.h
|
||||
27
|
||||
..\COMMON\INCLUDE\dynamic.h
|
||||
273
|
||||
WString
|
||||
3
|
||||
|
@ -1186,14 +1186,14 @@ WVList
|
|||
275
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
276
|
||||
MItem
|
||||
24
|
||||
..\common\include\flop.h
|
||||
26
|
||||
..\common\include\fileio.h
|
||||
277
|
||||
WString
|
||||
3
|
||||
|
@ -1204,14 +1204,14 @@ WVList
|
|||
279
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
280
|
||||
MItem
|
||||
28
|
||||
..\COMMON\INCLUDE\GenQTest.h
|
||||
25
|
||||
..\common\include\flash.h
|
||||
281
|
||||
WString
|
||||
3
|
||||
|
@ -1222,14 +1222,14 @@ WVList
|
|||
283
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
284
|
||||
MItem
|
||||
27
|
||||
..\common\include\partest.h
|
||||
24
|
||||
..\common\include\flop.h
|
||||
285
|
||||
WString
|
||||
3
|
||||
|
@ -1240,14 +1240,14 @@ WVList
|
|||
287
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
288
|
||||
MItem
|
||||
25
|
||||
..\common\include\pollq.h
|
||||
28
|
||||
..\COMMON\INCLUDE\GenQTest.h
|
||||
289
|
||||
WString
|
||||
3
|
||||
|
@ -1258,14 +1258,14 @@ WVList
|
|||
291
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
292
|
||||
MItem
|
||||
25
|
||||
..\common\include\print.h
|
||||
27
|
||||
..\common\include\partest.h
|
||||
293
|
||||
WString
|
||||
3
|
||||
|
@ -1276,14 +1276,14 @@ WVList
|
|||
295
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
296
|
||||
MItem
|
||||
27
|
||||
..\common\include\semtest.h
|
||||
25
|
||||
..\common\include\pollq.h
|
||||
297
|
||||
WString
|
||||
3
|
||||
|
@ -1294,14 +1294,14 @@ WVList
|
|||
299
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
300
|
||||
MItem
|
||||
26
|
||||
..\common\include\serial.h
|
||||
25
|
||||
..\common\include\print.h
|
||||
301
|
||||
WString
|
||||
3
|
||||
|
@ -1312,14 +1312,14 @@ WVList
|
|||
303
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
304
|
||||
MItem
|
||||
16
|
||||
FreeRTOSConfig.h
|
||||
27
|
||||
..\common\include\semtest.h
|
||||
305
|
||||
WString
|
||||
3
|
||||
|
@ -1330,7 +1330,43 @@ WVList
|
|||
307
|
||||
WVList
|
||||
0
|
||||
204
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
308
|
||||
MItem
|
||||
26
|
||||
..\common\include\serial.h
|
||||
309
|
||||
WString
|
||||
3
|
||||
NIL
|
||||
310
|
||||
WVList
|
||||
0
|
||||
311
|
||||
WVList
|
||||
0
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
312
|
||||
MItem
|
||||
16
|
||||
FreeRTOSConfig.h
|
||||
313
|
||||
WString
|
||||
3
|
||||
NIL
|
||||
314
|
||||
WVList
|
||||
0
|
||||
315
|
||||
WVList
|
||||
0
|
||||
208
|
||||
1
|
||||
1
|
||||
0
|
||||
|
|
|
@ -4,10 +4,10 @@ projectIdent
|
|||
VpeMain
|
||||
1
|
||||
WRect
|
||||
0
|
||||
0
|
||||
7680
|
||||
9216
|
||||
6
|
||||
9
|
||||
6229
|
||||
7197
|
||||
2
|
||||
MProject
|
||||
3
|
||||
|
@ -31,7 +31,7 @@ WRect
|
|||
0
|
||||
0
|
||||
7168
|
||||
8474
|
||||
8270
|
||||
0
|
||||
0
|
||||
9
|
||||
|
@ -39,5 +39,5 @@ WFileName
|
|||
12
|
||||
rtosdemo.tgt
|
||||
0
|
||||
24
|
||||
25
|
||||
7
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue