/*\r
- FreeRTOS.org V4.3.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.7.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
and contact details. Please ensure to read the configuration and relevant \r
port sections of the online documentation.\r
\r
- Also see http://www.SafeRTOS.com for an IEC 61508 compliant version along\r
- with commercial development and support options.\r
+ Also see http://www.SafeRTOS.com a version that has been certified for use\r
+ in safety critical systems, plus commercial licensing, development and\r
+ support options.\r
***************************************************************************\r
*/\r
\r
#include "integer.h"\r
#include "PollQ.h"\r
#include "blocktim.h"\r
+#include "recmutex.h"\r
\r
/* Hardware configuration definitions. */\r
#define mainBUS_CLK_FULL ( ( unsigned portCHAR ) 0x01 )\r
#define mainLED_DELAY ( ( portTickType ) 500 / portTICK_RATE_MS )\r
#define mainCHECK_DELAY ( ( portTickType ) 5000 / portTICK_RATE_MS )\r
#define mainLIST_BUFFER_SIZE 2048\r
+#define mainNO_DELAY ( 0 )\r
+#define mainSHORT_DELAY ( 150 / portTICK_RATE_MS )\r
\r
/* Task priorities. */\r
#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
vStartDynamicPriorityTasks();\r
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
vCreateBlockTimeTasks();\r
+ vStartRecursiveMutexTasks();\r
\r
/* Start the tasks defined within this file. */\r
xTaskCreate( vLEDTask, "LED", configMINIMAL_STACK_SIZE, NULL, mainLED_TASK_PRIORITY, NULL );\r
/* Start the scheduler. */\r
vTaskStartScheduler();\r
\r
- /* The scheduler should now running, so we will only ever reach here if we\r
+ /* The scheduler should now be running, so we will only ever reach here if we\r
ran out of heap space. */\r
\r
return 0;\r
xErrorOccurred = pdTRUE;\r
}\r
\r
+ if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+\r
/* Send either a pass or fail message. If an error is found it is\r
never cleared again. */\r
if( xErrorOccurred == pdTRUE )\r
static portCHAR cListBuffer[ mainLIST_BUFFER_SIZE ];\r
const portCHAR *pcList = &( cListBuffer[ 0 ] );\r
const portCHAR * const pcHeader = "\nTask State Priority Stack #\n************************************************";\r
-extern void (vButtonISR) ( void );\r
+extern void (vButtonISRWrapper) ( void );\r
\r
/* Configure the interrupt. */\r
portENTER_CRITICAL(); \r
/* Setup the VIC for EINT 1. */\r
VICIntSelect &= ~mainEINT_1_VIC_CHANNEL_BIT;\r
VICIntEnable |= mainEINT_1_VIC_CHANNEL_BIT;\r
- VICVectAddr1 = ( portLONG ) vButtonISR;\r
+ VICVectAddr1 = ( portLONG ) vButtonISRWrapper;\r
VICVectCntl1 = mainEINT_1_ENABLE_BIT | mainEINT_1_CHANNEL;\r
}\r
portEXIT_CRITICAL();\r
\r
for( ;; )\r
{\r
+ /* For debouncing, wait a while then clear the semaphore. */\r
+ vTaskDelay( mainSHORT_DELAY );\r
+ xSemaphoreTake( xButtonSemaphore, mainNO_DELAY );\r
+\r
/* Wait for an interrupt. */\r
- while( xSemaphoreTake( xButtonSemaphore, portMAX_DELAY ) != pdPASS );\r
+ xSemaphoreTake( xButtonSemaphore, portMAX_DELAY );\r
\r
/* Send the column headers to the print task for display. */\r
xQueueSend( xPrintQueue, &pcHeader, portMAX_DELAY );\r