From 2ee98beba2740f94cdd1841f506c0b0b409027b5 Mon Sep 17 00:00:00 2001
From: Richard Barry <ribarry@amazon.com>
Date: Sun, 27 Jan 2008 19:27:51 +0000
Subject: [PATCH] Add recursive mutexes to PC demo.

---
 Demo/PC/FreeRTOSConfig.h |   1 +
 Demo/PC/main.c           |   8 ++
 Demo/PC/rtosdemo.tgt     | 218 +++++++++++++++++++++------------------
 Demo/PC/rtosdemo.wpj     |   6 +-
 4 files changed, 130 insertions(+), 103 deletions(-)

diff --git a/Demo/PC/FreeRTOSConfig.h b/Demo/PC/FreeRTOSConfig.h
index 894ca5e59c..4510590b37 100644
--- a/Demo/PC/FreeRTOSConfig.h
+++ b/Demo/PC/FreeRTOSConfig.h
@@ -64,6 +64,7 @@
 #define configUSE_MUTEXES				1
 #define configUSE_COUNTING_SEMAPHORES	1
 #define configUSE_ALTERNATIVE_API		1
+#define configUSE_RECURSIVE_MUTEXES		1
 
 #define configMAX_PRIORITIES		( ( unsigned portBASE_TYPE ) 10 )
 #define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
diff --git a/Demo/PC/main.c b/Demo/PC/main.c
index 56095bc573..c0998dd0c8 100644
--- a/Demo/PC/main.c
+++ b/Demo/PC/main.c
@@ -95,6 +95,7 @@
 #include "AltQTest.h"
 #include "AltPollQ.h"
 #include "AltBlckQ.h"
+#include "RecMutex.h"
 
 /* Priority definitions for the tasks in the demo application. */
 #define mainLED_TASK_PRIORITY		( tskIDLE_PRIORITY + 1 )
@@ -163,6 +164,7 @@ portSHORT main( void )
 	vCreateAltBlockTimeTasks();
 	vStartAltBlockingQueueTasks( mainQUEUE_BLOCK_PRIORITY );	
 	vStartAltPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
+	vStartRecursiveMutexTasks();
 		
 	/* Create the "Print" task as described at the top of the file. */
 	xTaskCreate( vErrorChecks, "Print", mainPRINT_STACK_SIZE, NULL, mainPRINT_TASK_PRIORITY, NULL );
@@ -416,6 +418,12 @@ static portSHORT sErrorHasOccurred = pdFALSE;
 		sErrorHasOccurred = pdTRUE;
 	}
 
+	if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
+	{
+		vDisplayMessage( "Error in recursive mutex tasks!\r\n" );
+		sErrorHasOccurred = pdTRUE;
+	}
+
 	if( sErrorHasOccurred == pdFALSE )
 	{
 		vDisplayMessage( "OK " );
diff --git a/Demo/PC/rtosdemo.tgt b/Demo/PC/rtosdemo.tgt
index 90a5900ac8..e6a005d938 100644
--- a/Demo/PC/rtosdemo.tgt
+++ b/Demo/PC/rtosdemo.tgt
@@ -75,7 +75,7 @@ WVList
 0
 19
 WPickList
-63
+64
 20
 MItem
 3
@@ -886,8 +886,8 @@ WVList
 0
 208
 MItem
-15
-fileio\fileio.c
+28
+..\COMMON\MINIMAL\recmutex.c
 209
 WString
 4
@@ -904,8 +904,8 @@ WVList
 0
 212
 MItem
-6
-main.c
+15
+fileio\fileio.c
 213
 WString
 4
@@ -922,8 +922,8 @@ WVList
 0
 216
 MItem
-17
-partest\partest.c
+6
+main.c
 217
 WString
 4
@@ -940,8 +940,8 @@ WVList
 0
 220
 MItem
-15
-serial\serial.c
+17
+partest\partest.c
 221
 WString
 4
@@ -958,26 +958,26 @@ WVList
 0
 224
 MItem
-3
-*.h
+15
+serial\serial.c
 225
 WString
-3
-NIL
+4
+COBJ
 226
 WVList
 0
 227
 WVList
 0
--1
+20
+1
 1
-0
 0
 228
 MItem
-31
-..\..\SOURCE\INCLUDE\croutine.h
+3
+*.h
 229
 WString
 3
@@ -988,14 +988,14 @@ WVList
 231
 WVList
 0
-224
+-1
 1
 1
 0
 232
 MItem
-27
-..\..\source\include\list.h
+31
+..\..\SOURCE\INCLUDE\croutine.h
 233
 WString
 3
@@ -1006,14 +1006,14 @@ WVList
 235
 WVList
 0
-224
+228
 1
 1
 0
 236
 MItem
-31
-..\..\source\include\portable.h
+27
+..\..\source\include\list.h
 237
 WString
 3
@@ -1024,14 +1024,14 @@ WVList
 239
 WVList
 0
-224
+228
 1
 1
 0
 240
 MItem
 31
-..\..\source\include\projdefs.h
+..\..\source\include\portable.h
 241
 WString
 3
@@ -1042,14 +1042,14 @@ WVList
 243
 WVList
 0
-224
+228
 1
 1
 0
 244
 MItem
-28
-..\..\source\include\queue.h
+31
+..\..\source\include\projdefs.h
 245
 WString
 3
@@ -1060,14 +1060,14 @@ WVList
 247
 WVList
 0
-224
+228
 1
 1
 0
 248
 MItem
-29
-..\..\source\include\semphr.h
+28
+..\..\source\include\queue.h
 249
 WString
 3
@@ -1078,14 +1078,14 @@ WVList
 251
 WVList
 0
-224
+228
 1
 1
 0
 252
 MItem
-27
-..\..\source\include\task.h
+29
+..\..\source\include\semphr.h
 253
 WString
 3
@@ -1096,14 +1096,14 @@ WVList
 255
 WVList
 0
-224
+228
 1
 1
 0
 256
 MItem
-55
-..\..\source\portable\owatcom\16bitdos\common\portasm.h
+27
+..\..\source\include\task.h
 257
 WString
 3
@@ -1114,14 +1114,14 @@ WVList
 259
 WVList
 0
-224
+228
 1
 1
 0
 260
 MItem
-53
-..\..\source\portable\owatcom\16bitdos\pc\portmacro.h
+55
+..\..\source\portable\owatcom\16bitdos\common\portasm.h
 261
 WString
 3
@@ -1132,14 +1132,14 @@ WVList
 263
 WVList
 0
-224
+228
 1
 1
 0
 264
 MItem
-28
-..\COMMON\INCLUDE\AltBlckQ.h
+53
+..\..\source\portable\owatcom\16bitdos\pc\portmacro.h
 265
 WString
 3
@@ -1150,14 +1150,14 @@ WVList
 267
 WVList
 0
-224
+228
 1
 1
 0
 268
 MItem
 28
-..\COMMON\INCLUDE\AltBlock.h
+..\COMMON\INCLUDE\AltBlckQ.h
 269
 WString
 3
@@ -1168,14 +1168,14 @@ WVList
 271
 WVList
 0
-224
+228
 1
 1
 0
 272
 MItem
 28
-..\COMMON\INCLUDE\AltPollQ.h
+..\COMMON\INCLUDE\AltBlock.h
 273
 WString
 3
@@ -1186,14 +1186,14 @@ WVList
 275
 WVList
 0
-224
+228
 1
 1
 0
 276
 MItem
 28
-..\COMMON\INCLUDE\AltQTest.h
+..\COMMON\INCLUDE\AltPollQ.h
 277
 WString
 3
@@ -1204,14 +1204,14 @@ WVList
 279
 WVList
 0
-224
+228
 1
 1
 0
 280
 MItem
-26
-..\common\include\blockq.h
+28
+..\COMMON\INCLUDE\AltQTest.h
 281
 WString
 3
@@ -1222,14 +1222,14 @@ WVList
 283
 WVList
 0
-224
+228
 1
 1
 0
 284
 MItem
-28
-..\COMMON\INCLUDE\blocktim.h
+26
+..\common\include\blockq.h
 285
 WString
 3
@@ -1240,14 +1240,14 @@ WVList
 287
 WVList
 0
-224
+228
 1
 1
 0
 288
 MItem
-27
-..\common\include\comtest.h
+28
+..\COMMON\INCLUDE\blocktim.h
 289
 WString
 3
@@ -1258,14 +1258,14 @@ WVList
 291
 WVList
 0
-224
+228
 1
 1
 0
 292
 MItem
-28
-..\COMMON\INCLUDE\countsem.h
+27
+..\common\include\comtest.h
 293
 WString
 3
@@ -1276,14 +1276,14 @@ WVList
 295
 WVList
 0
-224
+228
 1
 1
 0
 296
 MItem
-26
-..\COMMON\INCLUDE\crhook.h
+28
+..\COMMON\INCLUDE\countsem.h
 297
 WString
 3
@@ -1294,14 +1294,14 @@ WVList
 299
 WVList
 0
-224
+228
 1
 1
 0
 300
 MItem
-25
-..\common\include\death.h
+26
+..\COMMON\INCLUDE\crhook.h
 301
 WString
 3
@@ -1312,14 +1312,14 @@ WVList
 303
 WVList
 0
-224
+228
 1
 1
 0
 304
 MItem
-27
-..\COMMON\INCLUDE\dynamic.h
+25
+..\common\include\death.h
 305
 WString
 3
@@ -1330,14 +1330,14 @@ WVList
 307
 WVList
 0
-224
+228
 1
 1
 0
 308
 MItem
-26
-..\common\include\fileio.h
+27
+..\COMMON\INCLUDE\dynamic.h
 309
 WString
 3
@@ -1348,14 +1348,14 @@ WVList
 311
 WVList
 0
-224
+228
 1
 1
 0
 312
 MItem
-25
-..\common\include\flash.h
+26
+..\common\include\fileio.h
 313
 WString
 3
@@ -1366,14 +1366,14 @@ WVList
 315
 WVList
 0
-224
+228
 1
 1
 0
 316
 MItem
-24
-..\common\include\flop.h
+25
+..\common\include\flash.h
 317
 WString
 3
@@ -1384,14 +1384,14 @@ WVList
 319
 WVList
 0
-224
+228
 1
 1
 0
 320
 MItem
-28
-..\COMMON\INCLUDE\GenQTest.h
+24
+..\common\include\flop.h
 321
 WString
 3
@@ -1402,14 +1402,14 @@ WVList
 323
 WVList
 0
-224
+228
 1
 1
 0
 324
 MItem
-27
-..\common\include\partest.h
+28
+..\COMMON\INCLUDE\GenQTest.h
 325
 WString
 3
@@ -1420,14 +1420,14 @@ WVList
 327
 WVList
 0
-224
+228
 1
 1
 0
 328
 MItem
-25
-..\common\include\pollq.h
+27
+..\common\include\partest.h
 329
 WString
 3
@@ -1438,14 +1438,14 @@ WVList
 331
 WVList
 0
-224
+228
 1
 1
 0
 332
 MItem
 25
-..\common\include\print.h
+..\common\include\pollq.h
 333
 WString
 3
@@ -1456,14 +1456,14 @@ WVList
 335
 WVList
 0
-224
+228
 1
 1
 0
 336
 MItem
-27
-..\common\include\semtest.h
+25
+..\common\include\print.h
 337
 WString
 3
@@ -1474,14 +1474,14 @@ WVList
 339
 WVList
 0
-224
+228
 1
 1
 0
 340
 MItem
-26
-..\common\include\serial.h
+27
+..\common\include\semtest.h
 341
 WString
 3
@@ -1492,14 +1492,14 @@ WVList
 343
 WVList
 0
-224
+228
 1
 1
 0
 344
 MItem
-16
-FreeRTOSConfig.h
+26
+..\common\include\serial.h
 345
 WString
 3
@@ -1510,7 +1510,25 @@ WVList
 347
 WVList
 0
-224
+228
+1
+1
+0
+348
+MItem
+16
+FreeRTOSConfig.h
+349
+WString
+3
+NIL
+350
+WVList
+0
+351
+WVList
+0
+228
 1
 1
 0
diff --git a/Demo/PC/rtosdemo.wpj b/Demo/PC/rtosdemo.wpj
index f02b7811a1..34b7521489 100644
--- a/Demo/PC/rtosdemo.wpj
+++ b/Demo/PC/rtosdemo.wpj
@@ -6,7 +6,7 @@ VpeMain
 WRect
 0
 0
-6209
+6202
 7168
 2
 MProject
@@ -38,6 +38,6 @@ WRect
 WFileName
 12
 rtosdemo.tgt
-0
-0
+6
+63
 7