copy %COMMON_SOURCE%\flash.c Common_Demo_Source\r
copy %COMMON_SOURCE%\comtest.c Common_Demo_Source\r
copy %COMMON_SOURCE%\TimerDemo.c Common_Demo_Source\r
- copy %COMMON_SOURCE%\countsem.c Common_Demo_Source\r
- copy %COMMON_SOURCE%\integer.c Common_Demo_Source\r
+ copy %COMMON_SOURCE%\countsem.c Common_Demo_Source\r
+ copy %COMMON_SOURCE%\integer.c Common_Demo_Source\r
\r
REM Copy the common demo file headers.\r
copy %COMMON_INCLUDE%\*.h Common_Demo_Source\include\r
/*----------------------------------------------------------*/\r
\r
#define configUSE_PREEMPTION 1\r
-#define configUSE_IDLE_HOOK 0\r
+#define configUSE_IDLE_HOOK 1\r
/* CPU is actually 150MHz but FPIDIV is 1 meaning divide by 2 for the\r
peripheral clock. */\r
#define configCPU_CLOCK_HZ ( ( unsigned long ) 150000000UL )\r
#define configTICK_RATE_HZ ( ( portTickType ) 1000UL )\r
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 6 )\r
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 )\r
-#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 32 * 1024 ) )\r
+#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 35U * 1024U ) )\r
#define configMAX_TASK_NAME_LEN ( 16 )\r
#define configUSE_TRACE_FACILITY 0\r
#define configUSE_16_BIT_TICKS 0\r
#define configIDLE_SHOULD_YIELD 0\r
#define configUSE_MALLOC_FAILED_HOOK 1\r
#define configCHECK_FOR_STACK_OVERFLOW 0\r
-\r
+#define configUSE_TICK_HOOK 1\r
#define configUSE_COUNTING_SEMAPHORES 1\r
#define configUSE_RECURSIVE_MUTEXES 1\r
#define configUSE_MUTEXES 1\r
#define configUSE_CO_ROUTINES 0\r
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )\r
\r
-/* Timer functionality. For space constraint reasons, the standard demo timer\r
-tests are only included in the build configuration that generates code that\r
-runs from Flash, and not in the build configuration that generates code that\r
-runs from RAM. */\r
-#ifdef BUILD_FOR_RAM_EXECUTION\r
- #define configUSE_TIMERS 0\r
- #define configUSE_TICK_HOOK 0\r
-#else\r
- #define configUSE_TIMER 1\r
- #define configUSE_TICK_HOOK 1\r
-#endif\r
-\r
-#define configTIMER_TASK_PRIORITY ( 4 )\r
-#define configTIMER_QUEUE_LENGTH ( 5 )\r
-#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE\r
+/* Software timer configuration. */\r
+#define configUSE_TIMERS 1\r
+#define configTIMER_TASK_PRIORITY ( 4 )\r
+#define configTIMER_QUEUE_LENGTH ( 5 )\r
+#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE\r
\r
/* Set the following definitions to 1 to include the API function, or zero\r
to exclude the API function. */\r
#define INCLUDE_vTaskDelayUntil 1\r
#define INCLUDE_vTaskDelay 1\r
\r
-#define configMAX_SYSCALL_INTERRUPT_PRIORITY 64\r
-#define configKERNEL_INTERRUPT_PRIORITY 1\r
+#define configMAX_SYSCALL_INTERRUPT_PRIORITY 64 /* Interrupt above priority 64 are not effected by critical sections, but cannot call interrupt safe FreeRTOS functions. */\r
+#define configKERNEL_INTERRUPT_PRIORITY 2 /* This is defined here for clarity, but the value must not be changed from 2. */\r
+#define configKERNEL_YIELD_PRIORITY 1 /* This is defined here for clarity, but must not be changed from its default value of 1. */\r
+\r
+/* Interrupt priorities. */\r
+#define configINTERRUPT_PRIORITY_TX 16\r
+#define configINTERRUPT_PRIORITY_RX 18\r
+#define configHIGH_FREQUENCY_TIMER_PRIORITY ( configMAX_SYSCALL_INTERRUPT_PRIORITY - 1UL )\r
\r
/* Default definition of configASSERT(). */\r
#define configASSERT( x ) if( ( x ) == 0 ) { portDISABLE_INTERRUPTS(); for( ;; ); }\r
\r
+extern volatile unsigned long ulNest, ulMaxNest;\r
+#define COUNT_NEST() \\r
+{ \\r
+ ulNest++; \\r
+ if( ulNest > ulMaxNest ) \\r
+ { \\r
+ ulMaxNest = ulNest; \\r
+ } \\r
+}\r
+\r
#endif /* FREERTOS_CONFIG_H */\r
\r
#include <machine/cint.h>\r
#include <machine/wdtcon.h>\r
\r
+#warning DOCUMENT THIS\r
/* This constant is specific to this test application. It allows the high\r
frequency (interrupt nesting test) timer to know how often to trigger, and the\r
check task to know how many iterations to expect at any given time. */\r
-#define tmrtestHIGH_FREQUENCY_TIMER_TEST_HZ ( 1931UL )\r
+#define tmrtestHIGH_FREQUENCY_TIMER_TEST_HZ ( 8931UL )\r
\r
static void prvPortHighFrequencyTimerHandler( int iArg ) __attribute__((longcall));\r
static void prvHighFrequencyTimerTask( void *pvParameters );\r
\r
/* Setup the interrupt itself. The STM module clock divider is setup when \r
the tick interrupt is configured - which is when the scheduler is started - \r
- so there is no need to do it here. */\r
+ so there is no need to do it here.\r
\r
- unlock_wdtcon();\r
- {\r
- /* Wait until access to Endint protected register is enabled. */\r
- while( 0 != ( WDT_CON0.reg & 0x1UL ) );\r
-\r
- /* RMC == 1 so STM Clock == FPI */\r
- STM_CLC.reg = ( 1UL << 8 );\r
- }\r
- lock_wdtcon();\r
-\r
- /* The tick interrupt uses compare match 0, so this test uses compare match\r
+ The tick interrupt uses compare match 0, so this test uses compare match\r
1, which means shifting up the values by 16 before writing them to the\r
register. */\r
ulCompareMatchBits = ( 0x1fUL - __CLZ( ulCompareMatchValue ) );\r
STM_CMCON.reg |= ulCompareMatchBits;\r
STM_CMP1.reg = ulCompareMatchValue;\r
\r
- if( 0 != _install_int_handler( configMAX_SYSCALL_INTERRUPT_PRIORITY - 5, prvPortHighFrequencyTimerHandler, 0 ) )\r
+ if( 0 != _install_int_handler( configHIGH_FREQUENCY_TIMER_PRIORITY, prvPortHighFrequencyTimerHandler, 0 ) )\r
{\r
/* Set-up the interrupt. */\r
- STM_SRC1.reg = ( ( configMAX_SYSCALL_INTERRUPT_PRIORITY - 5 ) | 0x00005000UL );\r
+ STM_SRC1.reg = ( configHIGH_FREQUENCY_TIMER_PRIORITY | 0x00005000UL );\r
\r
/* Enable the Interrupt. */\r
STM_ISRR.reg &= ~( 0x03UL << 2UL );\r
static volatile unsigned long ulExecutionCounter = 0UL;\r
unsigned long ulHigherPriorityTaskWoken = pdFALSE;\r
\r
+COUNT_NEST();\r
/* Just to avoid compiler warnings about unused parameters. */\r
( void ) iArg;\r
\r
}\r
\r
portYIELD_FROM_ISR( ulHigherPriorityTaskWoken );\r
+ulNest--;\r
}\r
+volatile unsigned long ulNest = 0UL, ulMaxNest = 0UL;\r
/*\r
FreeRTOS V7.0.2 - Copyright (C) 2011 Real Time Engineers Ltd.\r
\r
lReturn = pdFAIL;\r
}\r
\r
- if( xArePollingQueuesStillRunning() != pdTRUE )\r
+ if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
{\r
lReturn = pdFAIL;\r
}\r
\r
- if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
+ if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
{\r
lReturn = pdFAIL;\r
}\r
\r
- if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
+ if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
{\r
lReturn = pdFAIL;\r
}\r
\r
- if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
+ if ( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
{\r
lReturn = pdFAIL;\r
}\r
\r
- if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
+ if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
{\r
lReturn = pdFAIL;\r
}\r
\r
- if ( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
+ if( prvAreRegTestTasksStillRunning() != pdTRUE )\r
{\r
lReturn = pdFAIL;\r
}\r
\r
- if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
+ if( xIsCreateTaskStillRunning() != pdTRUE )\r
{\r
lReturn = pdFAIL;\r
}\r
\r
- if( prvAreRegTestTasksStillRunning() != pdTRUE )\r
+ if( xAreTimerDemoTasksStillRunning( mainNO_ERROR_FLASH_PERIOD_MS ) != pdTRUE )\r
{\r
lReturn = pdFAIL;\r
}\r
\r
- if( xIsCreateTaskStillRunning() != pdTRUE )\r
+ if( xArePollingQueuesStillRunning() != pdTRUE )\r
+ {\r
+ lReturn = pdFAIL;\r
+ }\r
+\r
+ if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
{\r
lReturn = pdFAIL;\r
}\r
lReturn = pdFAIL;\r
}\r
\r
-\r
- #if configUSE_TIMERS == 1\r
- {\r
- /* For space constraint reasons, do not include the timer demo in\r
- builds that execute from RAM. */\r
- if( xAreTimerDemoTasksStillRunning( mainNO_ERROR_FLASH_PERIOD_MS ) != pdTRUE )\r
- {\r
- lReturn = pdFAIL;\r
- }\r
- }\r
- #endif\r
-\r
return lReturn;\r
}\r
/*-----------------------------------------------------------*/\r
FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used\r
to query the size of free heap space that remains (although it does not\r
provide information on how the remaining heap might be fragmented). */\r
- _debug();\r
taskDISABLE_INTERRUPTS();\r
for( ;; );\r
}\r
}\r
/*-----------------------------------------------------------*/\r
\r
+static void prvOptionallyCreateComprehensveTestApplication( void )\r
+{\r
+ #if mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY == 0\r
+ {\r
+ vStartIntegerMathTasks( tskIDLE_PRIORITY );\r
+ vStartDynamicPriorityTasks();\r
+ vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
+ vCreateBlockTimeTasks();\r
+ vStartCountingSemaphoreTasks();\r
+ vStartGenericQueueTasks( tskIDLE_PRIORITY );\r
+ vStartRecursiveMutexTasks();\r
+ vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );\r
+ vSetupInterruptNestingTest();\r
+ vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
+ vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
+ vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
+\r
+ /* Create the register test tasks, as described at the top of this file. */\r
+ xTaskCreate( prvRegisterCheckTask1, ( signed char * ) "Reg 1", configMINIMAL_STACK_SIZE, &ulRegisterTest1Count, tskIDLE_PRIORITY, NULL );\r
+ xTaskCreate( prvRegisterCheckTask2, ( signed char * ) "Reg 2", configMINIMAL_STACK_SIZE, &ulRegisterTest2Count, tskIDLE_PRIORITY, NULL );\r
+\r
+ /* Start the check task - which is defined in this file. */\r
+ xTaskCreate( prvCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
+\r
+ /* This task has to be created last as it keeps account of the number of tasks\r
+ it expects to see running. */\r
+ vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
+ }\r
+ #else /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */\r
+ {\r
+ /* Just to prevent compiler warnings when the configuration options are\r
+ set such that these static functions are not used. */\r
+ ( void ) prvCheckTask;\r
+ ( void ) prvRegisterCheckTask1;\r
+ ( void ) prvRegisterCheckTask2;\r
+ }\r
+ #endif /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
static void prvRegisterCheckTask1( void *pvParameters )\r
{\r
/* Make space on the stack for the parameter and a counter. */\r
/* The parameter is used but in the assembly. */\r
(void)pvParameters;\r
}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvOptionallyCreateComprehensveTestApplication( void )\r
-{\r
- #if mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY == 0\r
- {\r
- vStartIntegerMathTasks( tskIDLE_PRIORITY );\r
- vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
- vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
- vStartDynamicPriorityTasks();\r
- vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
- vCreateBlockTimeTasks();\r
- vStartCountingSemaphoreTasks();\r
- vStartGenericQueueTasks( tskIDLE_PRIORITY );\r
- vStartRecursiveMutexTasks();\r
- vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );\r
- vSetupInterruptNestingTest();\r
-\r
- #if configUSE_TIMERS == 1\r
- {\r
- /* For space constraint reasons, do not include the timer demo in\r
- builds that execute from RAM. */\r
- vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
- }\r
- #endif /* configUSE_TIMERS */\r
-\r
- /* Create the register test tasks, as described at the top of this file. */\r
- xTaskCreate( prvRegisterCheckTask1, ( signed char * ) "Reg 1", configMINIMAL_STACK_SIZE, &ulRegisterTest1Count, tskIDLE_PRIORITY, NULL );\r
- xTaskCreate( prvRegisterCheckTask2, ( signed char * ) "Reg 2", configMINIMAL_STACK_SIZE, &ulRegisterTest2Count, tskIDLE_PRIORITY, NULL );\r
-\r
- /* Start the check task - which is defined in this file. */\r
- xTaskCreate( prvCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
-\r
- /* This task has to be created last as it keeps account of the number of tasks\r
- it expects to see running. */\r
- vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
- }\r
- #else /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */\r
- {\r
- /* Just to prevent compiler warnings when the configuration options are\r
- set such that these static functions are not used. */\r
- ( void ) prvCheckTask;\r
- ( void ) prvRegisterCheckTask1;\r
- ( void ) prvRegisterCheckTask2;\r
- }\r
- #endif /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */\r
-}\r
\r
/*-----------------------------------------------------------*/\r
\r
\r
/*---------------------------------------------------------------------------*/\r
\r
-/* Interrupt priorities. */\r
-#define serialINTERRUPT_PRIORITY_TX 16\r
-#define serialINTERRUPT_PRIORITY_RX 18\r
-\r
-/*---------------------------------------------------------------------------*/\r
-\r
/*\r
* See if the Serial Transmit Interrupt is currently activated, meaning that\r
* the interrupt is working through the back log of bytes that it needs to\r
ASC0_CON.reg = 0x00008011; /* 1 Start, 1 Stop, 8 Data, No Parity, No Error Checking, Receive On, Module On. */\r
\r
/* Install the Tx interrupt. */\r
- if( 0 != _install_int_handler( serialINTERRUPT_PRIORITY_TX, prvTxBufferInterruptHandler, 0 ) )\r
+ if( 0 != _install_int_handler( configINTERRUPT_PRIORITY_TX, prvTxBufferInterruptHandler, 0 ) )\r
{\r
- ASC0_TBSRC.reg = serialINTERRUPT_PRIORITY_TX | 0x5000UL;\r
+ ASC0_TBSRC.reg = configINTERRUPT_PRIORITY_TX | 0x5000UL;\r
xTransmitStatus = 0UL;\r
}\r
\r
/* Install the Rx interrupt. */\r
- if( 0 != _install_int_handler( serialINTERRUPT_PRIORITY_RX, prvRxInterruptHandler, 0 ) )\r
+ if( 0 != _install_int_handler( configINTERRUPT_PRIORITY_RX, prvRxInterruptHandler, 0 ) )\r
{\r
- ASC0_RSRC.reg = serialINTERRUPT_PRIORITY_RX | 0x5000UL;\r
+ ASC0_RSRC.reg = configINTERRUPT_PRIORITY_RX | 0x5000UL;\r
}\r
\r
/* COM Handle is never used by demo code. */\r
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
unsigned char ucTx;\r
\r
+COUNT_NEST();\r
+\r
/* Just to remove compiler warnings about unused parameters. */\r
( void ) iArg;\r
\r
\r
/* Finally end ISR and switch Task. */\r
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );\r
+ulNest--;\r
}\r
/*---------------------------------------------------------------------------*/\r
\r
{\r
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
unsigned char ucRx;\r
-\r
+COUNT_NEST();\r
/* Just to remove compiler warnings about unused parameters. */\r
( void ) iArg;\r
\r
\r
/* Finally end ISR and switch Task. */\r
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );\r
+ulNest--;\r
}\r
/*---------------------------------------------------------------------------*/\r
\r