mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Kernel changes:
+ Do not attempt to free the stack of a deleted task if the stack was statically allocated. + Introduce configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES - which optionally writes known values into the list and list item data structures in order to assist with the detection of memory corruptions. Microblase port: +Change occurrences of #if XPAR_MICROBLAZE_0_USE_FPU == 1 to #if XPAR_MICROBLAZE_0_USE_FPU != 0 as the value can also be 2 or 3. Demo app modifications: + Update Zynq project to use the 2014.4 tools and add in tests for the new task notification feature. + Update SAM4S project to include tests for the new task notification feature.
This commit is contained in:
parent
f407b70dcc
commit
2de32c0141
|
@ -106,7 +106,6 @@
|
||||||
*/
|
*/
|
||||||
#define configMAX_API_CALL_INTERRUPT_PRIORITY 18
|
#define configMAX_API_CALL_INTERRUPT_PRIORITY 18
|
||||||
|
|
||||||
|
|
||||||
#define configCPU_CLOCK_HZ 100000000UL
|
#define configCPU_CLOCK_HZ 100000000UL
|
||||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
||||||
#define configUSE_TICKLESS_IDLE 0
|
#define configUSE_TICKLESS_IDLE 0
|
||||||
|
|
|
@ -144,6 +144,8 @@
|
||||||
#include "QueueOverwrite.h"
|
#include "QueueOverwrite.h"
|
||||||
#include "IntQueue.h"
|
#include "IntQueue.h"
|
||||||
#include "EventGroupsDemo.h"
|
#include "EventGroupsDemo.h"
|
||||||
|
#include "TaskNotify.h"
|
||||||
|
#include "IntSemTest.h"
|
||||||
|
|
||||||
/* Priorities for the demo application tasks. */
|
/* Priorities for the demo application tasks. */
|
||||||
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL )
|
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL )
|
||||||
|
@ -250,6 +252,9 @@ void main_full( void )
|
||||||
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
|
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
|
||||||
vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );
|
vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );
|
||||||
vStartEventGroupTasks();
|
vStartEventGroupTasks();
|
||||||
|
vStartTaskNotifyTask();
|
||||||
|
vStartInterruptSemaphoreTasks();
|
||||||
|
|
||||||
|
|
||||||
/* Start the tasks that implements the command console on the UART, as
|
/* Start the tasks that implements the command console on the UART, as
|
||||||
described above. */
|
described above. */
|
||||||
|
@ -318,80 +323,90 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
that they are all still running, and that none have detected an error. */
|
that they are all still running, and that none have detected an error. */
|
||||||
if( xAreIntQueueTasksStillRunning() != pdTRUE )
|
if( xAreIntQueueTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 0UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreMathsTaskStillRunning() != pdTRUE )
|
if( xAreMathsTaskStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 1UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 2UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreBlockingQueuesStillRunning() != pdTRUE )
|
if( xAreBlockingQueuesStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 3UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
|
if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 4UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( xAreGenericQueueTasksStillRunning() != pdTRUE )
|
if ( xAreGenericQueueTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 5UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
|
if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 6UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xIsCreateTaskStillRunning() != pdTRUE )
|
if( xIsCreateTaskStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 7UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
|
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 8UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreTimerDemoTasksStillRunning( ( TickType_t ) mainNO_ERROR_CHECK_TASK_PERIOD ) != pdPASS )
|
if( xAreTimerDemoTasksStillRunning( ( TickType_t ) mainNO_ERROR_CHECK_TASK_PERIOD ) != pdPASS )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 9UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
|
if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 10UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xIsQueueOverwriteTaskStillRunning() != pdPASS )
|
if( xIsQueueOverwriteTaskStillRunning() != pdPASS )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 11UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreEventGroupTasksStillRunning() != pdPASS )
|
if( xAreEventGroupTasksStillRunning() != pdPASS )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 12UL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xAreTaskNotificationTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulErrorFound |= 1UL << 13UL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulErrorFound |= 1UL << 14UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check that the register test 1 task is still running. */
|
/* Check that the register test 1 task is still running. */
|
||||||
if( ulLastRegTest1Value == ulRegTest1LoopCounter )
|
if( ulLastRegTest1Value == ulRegTest1LoopCounter )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 15UL;
|
||||||
}
|
}
|
||||||
ulLastRegTest1Value = ulRegTest1LoopCounter;
|
ulLastRegTest1Value = ulRegTest1LoopCounter;
|
||||||
|
|
||||||
/* Check that the register test 2 task is still running. */
|
/* Check that the register test 2 task is still running. */
|
||||||
if( ulLastRegTest2Value == ulRegTest2LoopCounter )
|
if( ulLastRegTest2Value == ulRegTest2LoopCounter )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 16UL;
|
||||||
}
|
}
|
||||||
ulLastRegTest2Value = ulRegTest2LoopCounter;
|
ulLastRegTest2Value = ulRegTest2LoopCounter;
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,8 @@
|
||||||
#include "TimerDemo.h"
|
#include "TimerDemo.h"
|
||||||
#include "QueueOverwrite.h"
|
#include "QueueOverwrite.h"
|
||||||
#include "EventGroupsDemo.h"
|
#include "EventGroupsDemo.h"
|
||||||
|
#include "TaskNotify.h"
|
||||||
|
#include "IntSemTest.h"
|
||||||
|
|
||||||
/* Xilinx includes. */
|
/* Xilinx includes. */
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
@ -311,6 +313,12 @@ void vApplicationTickHook( void )
|
||||||
|
|
||||||
/* Call the periodic event group from ISR demo. */
|
/* Call the periodic event group from ISR demo. */
|
||||||
vPeriodicEventGroupsProcessing();
|
vPeriodicEventGroupsProcessing();
|
||||||
|
|
||||||
|
/* Use task notifications from an interrupt. */
|
||||||
|
xNotifyTaskFromISR();
|
||||||
|
|
||||||
|
/* Use mutexes from interrupts. */
|
||||||
|
vInterruptSemaphorePeriodicTest();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ IF EXIST src\asf\thirdparty\FreeRTOS Goto END
|
||||||
copy %FREERTOS_SOURCE%\queue.c src\asf\thirdparty\FreeRTOS
|
copy %FREERTOS_SOURCE%\queue.c src\asf\thirdparty\FreeRTOS
|
||||||
copy %FREERTOS_SOURCE%\list.c src\asf\thirdparty\FreeRTOS
|
copy %FREERTOS_SOURCE%\list.c src\asf\thirdparty\FreeRTOS
|
||||||
copy %FREERTOS_SOURCE%\timers.c src\asf\thirdparty\FreeRTOS
|
copy %FREERTOS_SOURCE%\timers.c src\asf\thirdparty\FreeRTOS
|
||||||
|
copy %FREERTOS_SOURCE%\event_groups.c src\asf\thirdparty\FreeRTOS
|
||||||
|
|
||||||
REM Copy the common header files into the project directory
|
REM Copy the common header files into the project directory
|
||||||
copy %FREERTOS_SOURCE%\include\*.* src\asf\thirdparty\FreeRTOS\include
|
copy %FREERTOS_SOURCE%\include\*.* src\asf\thirdparty\FreeRTOS\include
|
||||||
|
@ -48,6 +49,10 @@ IF EXIST src\asf\thirdparty\FreeRTOS Goto END
|
||||||
copy %COMMON_SOURCE%\integer.c src\Common-Demo-Source
|
copy %COMMON_SOURCE%\integer.c src\Common-Demo-Source
|
||||||
copy %COMMON_SOURCE%\QueueSet.c src\Common-Demo-Source
|
copy %COMMON_SOURCE%\QueueSet.c src\Common-Demo-Source
|
||||||
COPY %COMMON_SOURCE%\IntQueue.c src\Common-Demo-Source
|
COPY %COMMON_SOURCE%\IntQueue.c src\Common-Demo-Source
|
||||||
|
COPY %COMMON_SOURCE%\TaskNotify.c src\Common-Demo-Source
|
||||||
|
COPY %COMMON_SOURCE%\TimerDemo.c src\Common-Demo-Source
|
||||||
|
COPY %COMMON_SOURCE%\EventGroupsDemo.c src\Common-Demo-Source
|
||||||
|
COPY %COMMON_SOURCE%\IntSemTest.c src\Common-Demo-Source
|
||||||
|
|
||||||
REM Copy the common demo file headers.
|
REM Copy the common demo file headers.
|
||||||
copy %COMMON_INCLUDE%\*.h src\Common-Demo-Source\include
|
copy %COMMON_INCLUDE%\*.h src\Common-Demo-Source\include
|
||||||
|
|
Binary file not shown.
|
@ -142,7 +142,7 @@
|
||||||
<documentation help="" />
|
<documentation help="" />
|
||||||
<offline-documentation help="" />
|
<offline-documentation help="" />
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.6.0" />
|
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.10.1" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</framework-data>
|
</framework-data>
|
||||||
</AsfFrameworkConfig>
|
</AsfFrameworkConfig>
|
||||||
|
@ -267,11 +267,6 @@
|
||||||
</armgcc.linker.libraries.LibrarySearchPaths>
|
</armgcc.linker.libraries.LibrarySearchPaths>
|
||||||
<armgcc.linker.optimization.GarbageCollectUnusedSections>True</armgcc.linker.optimization.GarbageCollectUnusedSections>
|
<armgcc.linker.optimization.GarbageCollectUnusedSections>True</armgcc.linker.optimization.GarbageCollectUnusedSections>
|
||||||
<armgcc.linker.miscellaneous.LinkerFlags>-T../src/asf/sam/utils/linker_scripts/sam4s/sam4s16/gcc/flash.ld -Wl,--cref -Wl,--entry=Reset_Handler -mthumb</armgcc.linker.miscellaneous.LinkerFlags>
|
<armgcc.linker.miscellaneous.LinkerFlags>-T../src/asf/sam/utils/linker_scripts/sam4s/sam4s16/gcc/flash.ld -Wl,--cref -Wl,--entry=Reset_Handler -mthumb</armgcc.linker.miscellaneous.LinkerFlags>
|
||||||
<armgcc.assembler.general.IncludePaths>
|
|
||||||
<ListValues>
|
|
||||||
<Value>../src/ASF/sam/drivers/tc</Value>
|
|
||||||
</ListValues>
|
|
||||||
</armgcc.assembler.general.IncludePaths>
|
|
||||||
<armgcc.preprocessingassembler.general.AssemblerFlags>-DARM_MATH_CM4=true -DBOARD=SAM4S_EK -D__SAM4S16C__</armgcc.preprocessingassembler.general.AssemblerFlags>
|
<armgcc.preprocessingassembler.general.AssemblerFlags>-DARM_MATH_CM4=true -DBOARD=SAM4S_EK -D__SAM4S16C__</armgcc.preprocessingassembler.general.AssemblerFlags>
|
||||||
<armgcc.preprocessingassembler.general.IncludePaths>
|
<armgcc.preprocessingassembler.general.IncludePaths>
|
||||||
<ListValues>
|
<ListValues>
|
||||||
|
@ -372,12 +367,8 @@
|
||||||
</ListValues>
|
</ListValues>
|
||||||
</armgcc.linker.libraries.LibrarySearchPaths>
|
</armgcc.linker.libraries.LibrarySearchPaths>
|
||||||
<armgcc.linker.optimization.GarbageCollectUnusedSections>True</armgcc.linker.optimization.GarbageCollectUnusedSections>
|
<armgcc.linker.optimization.GarbageCollectUnusedSections>True</armgcc.linker.optimization.GarbageCollectUnusedSections>
|
||||||
|
<armgcc.linker.memorysettings.ExternalRAM />
|
||||||
<armgcc.linker.miscellaneous.LinkerFlags>-T../src/asf/sam/utils/linker_scripts/sam4s/sam4s16/gcc/flash.ld -Wl,--cref -Wl,--entry=Reset_Handler -mthumb</armgcc.linker.miscellaneous.LinkerFlags>
|
<armgcc.linker.miscellaneous.LinkerFlags>-T../src/asf/sam/utils/linker_scripts/sam4s/sam4s16/gcc/flash.ld -Wl,--cref -Wl,--entry=Reset_Handler -mthumb</armgcc.linker.miscellaneous.LinkerFlags>
|
||||||
<armgcc.assembler.general.IncludePaths>
|
|
||||||
<ListValues>
|
|
||||||
<Value>../src/ASF/sam/drivers/tc</Value>
|
|
||||||
</ListValues>
|
|
||||||
</armgcc.assembler.general.IncludePaths>
|
|
||||||
<armgcc.preprocessingassembler.general.AssemblerFlags>-DARM_MATH_CM4=true -DBOARD=SAM4S_EK -D__SAM4S16C__</armgcc.preprocessingassembler.general.AssemblerFlags>
|
<armgcc.preprocessingassembler.general.AssemblerFlags>-DARM_MATH_CM4=true -DBOARD=SAM4S_EK -D__SAM4S16C__</armgcc.preprocessingassembler.general.AssemblerFlags>
|
||||||
<armgcc.preprocessingassembler.general.IncludePaths>
|
<armgcc.preprocessingassembler.general.IncludePaths>
|
||||||
<ListValues>
|
<ListValues>
|
||||||
|
@ -423,18 +414,36 @@
|
||||||
<None Include="src\asf\sam\drivers\usart\usart.h">
|
<None Include="src\asf\sam\drivers\usart\usart.h">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</None>
|
</None>
|
||||||
|
<Compile Include="src\asf\thirdparty\FreeRTOS\event_groups.c">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="src\asf\thirdparty\FreeRTOS\portable\MemMang\heap_4.c">
|
<Compile Include="src\asf\thirdparty\FreeRTOS\portable\MemMang\heap_4.c">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="src\Common-Demo-Source\EventGroupsDemo.c">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="src\Common-Demo-Source\include\demo_serial.h">
|
<Compile Include="src\Common-Demo-Source\include\demo_serial.h">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="src\Common-Demo-Source\include\TaskNotify.h">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="src\Common-Demo-Source\IntQueue.c">
|
<Compile Include="src\Common-Demo-Source\IntQueue.c">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="src\Common-Demo-Source\IntSemTest.c">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="src\Common-Demo-Source\QueueSet.c">
|
<Compile Include="src\Common-Demo-Source\QueueSet.c">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="src\Common-Demo-Source\TaskNotify.c">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="src\Common-Demo-Source\TimerDemo.c">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="src\IntQueueTimer.c">
|
<Compile Include="src\IntQueueTimer.c">
|
||||||
<SubType>compile</SubType>
|
<SubType>compile</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
|
@ -91,7 +91,7 @@ extern uint32_t SystemCoreClock;
|
||||||
|
|
||||||
#define configUSE_PREEMPTION 1
|
#define configUSE_PREEMPTION 1
|
||||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
||||||
#define configUSE_IDLE_HOOK 0
|
#define configUSE_IDLE_HOOK 1
|
||||||
#define configUSE_TICK_HOOK 1
|
#define configUSE_TICK_HOOK 1
|
||||||
#define configCPU_CLOCK_HZ ( SystemCoreClock )
|
#define configCPU_CLOCK_HZ ( SystemCoreClock )
|
||||||
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
||||||
|
@ -132,6 +132,7 @@ to exclude the API function. */
|
||||||
#define INCLUDE_vTaskDelayUntil 1
|
#define INCLUDE_vTaskDelayUntil 1
|
||||||
#define INCLUDE_vTaskDelay 1
|
#define INCLUDE_vTaskDelay 1
|
||||||
#define INCLUDE_eTaskGetState 1
|
#define INCLUDE_eTaskGetState 1
|
||||||
|
#define INCLUDE_xTimerPendFunctionCall 1
|
||||||
|
|
||||||
/* Cortex-M specific definitions. */
|
/* Cortex-M specific definitions. */
|
||||||
#ifdef __NVIC_PRIO_BITS
|
#ifdef __NVIC_PRIO_BITS
|
||||||
|
|
|
@ -85,7 +85,6 @@
|
||||||
|
|
||||||
/* Standard demo includes. */
|
/* Standard demo includes. */
|
||||||
#include "partest.h"
|
#include "partest.h"
|
||||||
#include "QueueSet.h"
|
|
||||||
|
|
||||||
/* Atmel library includes. */
|
/* Atmel library includes. */
|
||||||
#include <asf.h>
|
#include <asf.h>
|
||||||
|
@ -181,6 +180,14 @@ void vApplicationIdleHook( void )
|
||||||
important that vApplicationIdleHook() is permitted to return to its calling
|
important that vApplicationIdleHook() is permitted to return to its calling
|
||||||
function, because it is the responsibility of the idle task to clean up
|
function, because it is the responsibility of the idle task to clean up
|
||||||
memory allocated by the kernel to any task that has since been deleted. */
|
memory allocated by the kernel to any task that has since been deleted. */
|
||||||
|
|
||||||
|
#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )
|
||||||
|
{
|
||||||
|
extern void vFullDemoIdleHook( void );
|
||||||
|
|
||||||
|
vFullDemoIdleHook();
|
||||||
|
}
|
||||||
|
#endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -207,8 +214,9 @@ void vApplicationTickHook( void )
|
||||||
|
|
||||||
#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )
|
#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )
|
||||||
{
|
{
|
||||||
/* In this case the tick hook is used as part of the queue set test. */
|
extern void vFullDemoTickHook( void );
|
||||||
vQueueSetAccessQueueSetFromISR();
|
|
||||||
|
vFullDemoTickHook();
|
||||||
}
|
}
|
||||||
#endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */
|
#endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,10 @@
|
||||||
#include "comtest2.h"
|
#include "comtest2.h"
|
||||||
#include "QueueSet.h"
|
#include "QueueSet.h"
|
||||||
#include "IntQueue.h"
|
#include "IntQueue.h"
|
||||||
|
#include "TaskNotify.h"
|
||||||
|
#include "TimerDemo.h"
|
||||||
|
#include "EventGroupsDemo.h"
|
||||||
|
#include "IntSemTest.h"
|
||||||
|
|
||||||
/* Atmel library includes. */
|
/* Atmel library includes. */
|
||||||
#include "asf.h"
|
#include "asf.h"
|
||||||
|
@ -142,12 +146,12 @@
|
||||||
/* The period after which the check timer will expire, in ms, provided no errors
|
/* The period after which the check timer will expire, in ms, provided no errors
|
||||||
have been reported by any of the standard demo tasks. ms are converted to the
|
have been reported by any of the standard demo tasks. ms are converted to the
|
||||||
equivalent in ticks using the portTICK_PERIOD_MS constant. */
|
equivalent in ticks using the portTICK_PERIOD_MS constant. */
|
||||||
#define mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS )
|
#define mainCHECK_TIMER_PERIOD_MS ( pdMS_TO_TICKS( 3000UL ) )
|
||||||
|
|
||||||
/* The period at which the check timer will expire, in ms, if an error has been
|
/* The period at which the check timer will expire, in ms, if an error has been
|
||||||
reported in one of the standard demo tasks. ms are converted to the equivalent
|
reported in one of the standard demo tasks. ms are converted to the equivalent
|
||||||
in ticks using the portTICK_PERIOD_MS constant. */
|
in ticks using the portTICK_PERIOD_MS constant. */
|
||||||
#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS )
|
#define mainERROR_CHECK_TIMER_PERIOD_MS ( pdMS_TO_TICKS( 200UL ) )
|
||||||
|
|
||||||
/* The standard demo flash timers can be used to flash any number of LEDs. In
|
/* The standard demo flash timers can be used to flash any number of LEDs. In
|
||||||
this case, because only three LEDs are available, and one is in use by the
|
this case, because only three LEDs are available, and one is in use by the
|
||||||
|
@ -165,8 +169,23 @@ standard demo flash timers. */
|
||||||
for the comtest, so the LED number is deliberately out of range. */
|
for the comtest, so the LED number is deliberately out of range. */
|
||||||
#define mainCOM_TEST_LED ( 3 )
|
#define mainCOM_TEST_LED ( 3 )
|
||||||
|
|
||||||
|
/* Used by the standard demo timer tasks. */
|
||||||
|
#define mainTIMER_TEST_PERIOD ( 50 )
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called by the idle hook function when the project is configured to run the
|
||||||
|
* full (as opposed to the blinky) demo.
|
||||||
|
*/
|
||||||
|
void vFullDemoIdleHook( void );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called by the tick hook function when the project is configured to run the
|
||||||
|
* full (as opposed to the blinky) demo.
|
||||||
|
*/
|
||||||
|
void vFullDemoTickHook( void );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The check timer callback function, as described at the top of this file.
|
* The check timer callback function, as described at the top of this file.
|
||||||
*/
|
*/
|
||||||
|
@ -176,8 +195,6 @@ static void prvCheckTimerCallback( TimerHandle_t xTimer );
|
||||||
|
|
||||||
void main_full( void )
|
void main_full( void )
|
||||||
{
|
{
|
||||||
TimerHandle_t xCheckTimer = NULL;
|
|
||||||
|
|
||||||
/* Start all the other standard demo/test tasks. The have not particular
|
/* Start all the other standard demo/test tasks. The have not particular
|
||||||
functionality, but do demonstrate how to use the FreeRTOS API and test the
|
functionality, but do demonstrate how to use the FreeRTOS API and test the
|
||||||
kernel port. */
|
kernel port. */
|
||||||
|
@ -191,23 +208,12 @@ TimerHandle_t xCheckTimer = NULL;
|
||||||
vStartRecursiveMutexTasks();
|
vStartRecursiveMutexTasks();
|
||||||
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
|
||||||
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
||||||
vStartLEDFlashTimers( mainNUMBER_OF_FLASH_TIMERS_LEDS );
|
|
||||||
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
||||||
vStartQueueSetTasks();
|
vStartQueueSetTasks();
|
||||||
|
vStartTaskNotifyTask();
|
||||||
/* Create the software timer that performs the 'check' functionality,
|
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
|
||||||
as described at the top of this file. */
|
vStartEventGroupTasks();
|
||||||
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
vStartInterruptSemaphoreTasks();
|
||||||
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
|
||||||
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
|
||||||
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
|
||||||
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
|
||||||
);
|
|
||||||
|
|
||||||
if( xCheckTimer != NULL )
|
|
||||||
{
|
|
||||||
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The set of tasks created by the following function call have to be
|
/* The set of tasks created by the following function call have to be
|
||||||
created last as they keep account of the number of tasks they expect to see
|
created last as they keep account of the number of tasks they expect to see
|
||||||
|
@ -236,64 +242,85 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
|
|
||||||
if( xAreIntQueueTasksStillRunning() != pdTRUE )
|
if( xAreIntQueueTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 0UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
|
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 1UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 2UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreBlockingQueuesStillRunning() != pdTRUE )
|
if( xAreBlockingQueuesStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 3UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
|
if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 4UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( xAreGenericQueueTasksStillRunning() != pdTRUE )
|
if ( xAreGenericQueueTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 5UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
|
if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 6UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xIsCreateTaskStillRunning() != pdTRUE )
|
if( xIsCreateTaskStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 7UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xArePollingQueuesStillRunning() != pdTRUE )
|
if( xArePollingQueuesStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 8UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
|
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 9UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreComTestTasksStillRunning() != pdTRUE )
|
if( xAreComTestTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 10UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreQueueSetTasksStillRunning() != pdPASS )
|
if( xAreQueueSetTasksStillRunning() != pdTRUE )
|
||||||
{
|
{
|
||||||
ulErrorFound = pdTRUE;
|
ulErrorFound |= 1UL << 11UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( xAreTaskNotificationTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulErrorFound |= 1UL << 12UL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xAreTimerDemoTasksStillRunning( mainCHECK_TIMER_PERIOD_MS ) != pdTRUE )
|
||||||
|
{
|
||||||
|
ulErrorFound |= 1UL << 13UL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xAreEventGroupTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulErrorFound |= 1UL << 14UL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulErrorFound |= 1UL << 15UL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Toggle the check LED to give an indication of the system status. If
|
/* Toggle the check LED to give an indication of the system status. If
|
||||||
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
|
||||||
everything is ok. A faster toggle indicates an error. */
|
everything is ok. A faster toggle indicates an error. */
|
||||||
|
@ -318,3 +345,49 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vFullDemoIdleHook( void )
|
||||||
|
{
|
||||||
|
static TimerHandle_t xCheckTimer = NULL;
|
||||||
|
|
||||||
|
if( xCheckTimer == NULL )
|
||||||
|
{
|
||||||
|
/* Create the software timer that performs the 'check'
|
||||||
|
functionality, in the full demo. This is not done before the
|
||||||
|
scheduler is started as to do so would prevent the standard demo
|
||||||
|
timer tasks from passing their tests (they expect the timer
|
||||||
|
command queue to be empty. */
|
||||||
|
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
|
||||||
|
mainCHECK_TIMER_PERIOD_MS, /* The timer period, in this case 3000ms (3s). */
|
||||||
|
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
||||||
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
|
);
|
||||||
|
|
||||||
|
if( xCheckTimer != NULL )
|
||||||
|
{
|
||||||
|
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Also start some timers that just flash LEDs. */
|
||||||
|
vStartLEDFlashTimers( mainNUMBER_OF_FLASH_TIMERS_LEDS );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vFullDemoTickHook( void )
|
||||||
|
{
|
||||||
|
/* In this case the tick hook is used as part of the queue set test. */
|
||||||
|
vQueueSetAccessQueueSetFromISR();
|
||||||
|
|
||||||
|
/* Use task notifications from an interrupt. */
|
||||||
|
xNotifyTaskFromISR();
|
||||||
|
|
||||||
|
/* Use timers from an interrupt. */
|
||||||
|
vTimerPeriodicISRTests();
|
||||||
|
|
||||||
|
/* Use event groups from an interrupt. */
|
||||||
|
vPeriodicEventGroupsProcessing();
|
||||||
|
|
||||||
|
/* Use mutexes from interrupts. */
|
||||||
|
vInterruptSemaphorePeriodicTest();
|
||||||
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
#define configUSE_TICK_HOOK 1
|
#define configUSE_TICK_HOOK 1
|
||||||
#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
|
#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
|
||||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 50 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 50 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */
|
||||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 23 * 1024 ) )
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 24 * 1024 ) )
|
||||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||||
#define configUSE_TRACE_FACILITY 1
|
#define configUSE_TRACE_FACILITY 1
|
||||||
#define configUSE_16_BIT_TICKS 0
|
#define configUSE_16_BIT_TICKS 0
|
||||||
|
|
|
@ -112,9 +112,9 @@ that make up the total heap. This is only done to provide an example of heap_5
|
||||||
being used as this demo could easily create one large heap region instead of
|
being used as this demo could easily create one large heap region instead of
|
||||||
multiple smaller heap regions - in which case heap_4.c would be the more
|
multiple smaller heap regions - in which case heap_4.c would be the more
|
||||||
appropriate choice. */
|
appropriate choice. */
|
||||||
#define mainREGION_1_SIZE 3001
|
#define mainREGION_1_SIZE 4001
|
||||||
#define mainREGION_2_SIZE 18105
|
#define mainREGION_2_SIZE 18105
|
||||||
#define mainREGION_3_SIZE 1407
|
#define mainREGION_3_SIZE 1807
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.
|
* main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.
|
||||||
|
@ -367,6 +367,9 @@ const HeapRegion_t xHeapRegions[] =
|
||||||
array. */
|
array. */
|
||||||
configASSERT( ( ulAdditionalOffset + mainREGION_1_SIZE + mainREGION_2_SIZE + mainREGION_3_SIZE ) < configTOTAL_HEAP_SIZE );
|
configASSERT( ( ulAdditionalOffset + mainREGION_1_SIZE + mainREGION_2_SIZE + mainREGION_3_SIZE ) < configTOTAL_HEAP_SIZE );
|
||||||
|
|
||||||
|
/* Prevent compiler warnings when configASSERT() is not defined. */
|
||||||
|
( void ) ulAdditionalOffset;
|
||||||
|
|
||||||
vPortDefineHeapRegions( xHeapRegions );
|
vPortDefineHeapRegions( xHeapRegions );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -91,6 +91,9 @@
|
||||||
* \ingroup FreeRTOSIntro
|
* \ingroup FreeRTOSIntro
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef INC_FREERTOS_H
|
||||||
|
#error FreeRTOS.h must be included before list.h
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef LIST_H
|
#ifndef LIST_H
|
||||||
#define LIST_H
|
#define LIST_H
|
||||||
|
@ -130,21 +133,62 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Macros that can be used to place known values within the list structures,
|
||||||
|
then check that the known values do not get corrupted during the execution of
|
||||||
|
the application. These may catch the list data structures being overwritten in
|
||||||
|
memory. They will not catch data errors caused by incorrect configuration or
|
||||||
|
use of FreeRTOS.*/
|
||||||
|
#if( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 0 )
|
||||||
|
/* Define the macros to do nothing. */
|
||||||
|
#define listLIST_ITEM_INTEGRITY_CHECK_VALUE_1
|
||||||
|
#define listLIST_ITEM_INTEGRITY_CHECK_VALUE_2
|
||||||
|
#define listLIST_INTEGRITY_CHECK_VALUE_1
|
||||||
|
#define listLIST_INTEGRITY_CHECK_VALUE_2
|
||||||
|
#define listSET_LIST_ITEM_INTEGRITY_CHECK_1_VALUE( pxItem )
|
||||||
|
#define listSET_LIST_ITEM_INTEGRITY_CHECK_2_VALUE( pxItem )
|
||||||
|
#define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList )
|
||||||
|
#define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList )
|
||||||
|
#define listTEST_LIST_ITEM_INTEGRITY( pxItem )
|
||||||
|
#define listTEST_LIST_INTEGRITY( pxList )
|
||||||
|
#else
|
||||||
|
/* Define macros that add new members into the list structures. */
|
||||||
|
#define listLIST_ITEM_INTEGRITY_CHECK_VALUE_1 TickType_t xListItemIntegrityValue1;
|
||||||
|
#define listLIST_ITEM_INTEGRITY_CHECK_VALUE_2 TickType_t xListItemIntegrityValue2;
|
||||||
|
#define listLIST_INTEGRITY_CHECK_VALUE_1 TickType_t xListIntegrityValue1;
|
||||||
|
#define listLIST_INTEGRITY_CHECK_VALUE_2 TickType_t xListIntegrityValue2;
|
||||||
|
|
||||||
|
/* Define macros that set the new structure members to known values. */
|
||||||
|
#define listSET_LIST_ITEM_INTEGRITY_CHECK_1_VALUE( pxItem ) ( pxItem )->xListItemIntegrityValue1 = pdINTEGRITY_CHECK_VALUE
|
||||||
|
#define listSET_LIST_ITEM_INTEGRITY_CHECK_2_VALUE( pxItem ) ( pxItem )->xListItemIntegrityValue2 = pdINTEGRITY_CHECK_VALUE
|
||||||
|
#define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList ) ( pxList )->xListIntegrityValue1 = pdINTEGRITY_CHECK_VALUE
|
||||||
|
#define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList ) ( pxList )->xListIntegrityValue2 = pdINTEGRITY_CHECK_VALUE
|
||||||
|
|
||||||
|
/* Define macros that will assert if one of the structure members does not
|
||||||
|
contain its expected value. */
|
||||||
|
#define listTEST_LIST_ITEM_INTEGRITY( pxItem ) configASSERT( ( ( pxItem )->xListItemIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxItem )->xListItemIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )
|
||||||
|
#define listTEST_LIST_INTEGRITY( pxList ) configASSERT( ( ( pxList )->xListIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxList )->xListIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )
|
||||||
|
#endif /* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Definition of the only type of object that a list can contain.
|
* Definition of the only type of object that a list can contain.
|
||||||
*/
|
*/
|
||||||
struct xLIST_ITEM
|
struct xLIST_ITEM
|
||||||
{
|
{
|
||||||
|
listLIST_ITEM_INTEGRITY_CHECK_VALUE_1 /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
configLIST_VOLATILE TickType_t xItemValue; /*< The value being listed. In most cases this is used to sort the list in descending order. */
|
configLIST_VOLATILE TickType_t xItemValue; /*< The value being listed. In most cases this is used to sort the list in descending order. */
|
||||||
struct xLIST_ITEM * configLIST_VOLATILE pxNext; /*< Pointer to the next ListItem_t in the list. */
|
struct xLIST_ITEM * configLIST_VOLATILE pxNext; /*< Pointer to the next ListItem_t in the list. */
|
||||||
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; /*< Pointer to the previous ListItem_t in the list. */
|
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; /*< Pointer to the previous ListItem_t in the list. */
|
||||||
void * pvOwner; /*< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */
|
void * pvOwner; /*< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */
|
||||||
void * configLIST_VOLATILE pvContainer; /*< Pointer to the list in which this list item is placed (if any). */
|
void * configLIST_VOLATILE pvContainer; /*< Pointer to the list in which this list item is placed (if any). */
|
||||||
|
listLIST_ITEM_INTEGRITY_CHECK_VALUE_2 /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
};
|
};
|
||||||
typedef struct xLIST_ITEM ListItem_t; /* For some reason lint wants this as two separate definitions. */
|
typedef struct xLIST_ITEM ListItem_t; /* For some reason lint wants this as two separate definitions. */
|
||||||
|
|
||||||
struct xMINI_LIST_ITEM
|
struct xMINI_LIST_ITEM
|
||||||
{
|
{
|
||||||
|
listLIST_ITEM_INTEGRITY_CHECK_VALUE_1 /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
configLIST_VOLATILE TickType_t xItemValue;
|
configLIST_VOLATILE TickType_t xItemValue;
|
||||||
struct xLIST_ITEM * configLIST_VOLATILE pxNext;
|
struct xLIST_ITEM * configLIST_VOLATILE pxNext;
|
||||||
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;
|
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;
|
||||||
|
@ -156,9 +200,11 @@ typedef struct xMINI_LIST_ITEM MiniListItem_t;
|
||||||
*/
|
*/
|
||||||
typedef struct xLIST
|
typedef struct xLIST
|
||||||
{
|
{
|
||||||
|
listLIST_INTEGRITY_CHECK_VALUE_1 /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
configLIST_VOLATILE UBaseType_t uxNumberOfItems;
|
configLIST_VOLATILE UBaseType_t uxNumberOfItems;
|
||||||
ListItem_t * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */
|
ListItem_t * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */
|
||||||
MiniListItem_t xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */
|
MiniListItem_t xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */
|
||||||
|
listLIST_INTEGRITY_CHECK_VALUE_2 /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
} List_t;
|
} List_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -88,6 +88,17 @@ typedef void (*TaskFunction_t)( void * );
|
||||||
#define errQUEUE_BLOCKED ( -4 )
|
#define errQUEUE_BLOCKED ( -4 )
|
||||||
#define errQUEUE_YIELD ( -5 )
|
#define errQUEUE_YIELD ( -5 )
|
||||||
|
|
||||||
|
/* Macros used for basic data corruption checks. */
|
||||||
|
#ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES
|
||||||
|
#define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if( configUSE_16_BIT_TICKS == 1 )
|
||||||
|
#define pdINTEGRITY_CHECK_VALUE 0x5a5a
|
||||||
|
#else
|
||||||
|
#define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* PROJDEFS_H */
|
#endif /* PROJDEFS_H */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,11 @@ void vListInitialise( List_t * const pxList )
|
||||||
pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd );/*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd );/*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
||||||
|
|
||||||
pxList->uxNumberOfItems = ( UBaseType_t ) 0U;
|
pxList->uxNumberOfItems = ( UBaseType_t ) 0U;
|
||||||
|
|
||||||
|
/* Write known values into the list if
|
||||||
|
configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
|
listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList );
|
||||||
|
listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -96,6 +101,11 @@ void vListInitialiseItem( ListItem_t * const pxItem )
|
||||||
{
|
{
|
||||||
/* Make sure the list item is not recorded as being on a list. */
|
/* Make sure the list item is not recorded as being on a list. */
|
||||||
pxItem->pvContainer = NULL;
|
pxItem->pvContainer = NULL;
|
||||||
|
|
||||||
|
/* Write known values into the list item if
|
||||||
|
configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
|
listSET_LIST_ITEM_INTEGRITY_CHECK_1_VALUE( pxItem );
|
||||||
|
listSET_LIST_ITEM_INTEGRITY_CHECK_2_VALUE( pxItem );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -103,6 +113,12 @@ void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem )
|
||||||
{
|
{
|
||||||
ListItem_t * const pxIndex = pxList->pxIndex;
|
ListItem_t * const pxIndex = pxList->pxIndex;
|
||||||
|
|
||||||
|
/* Only effective when configASSERT() is also defined, these tests may catch
|
||||||
|
the list data structures being overwritten in memory. They will not catch
|
||||||
|
data errors caused by incorrect configuration or use of FreeRTOS. */
|
||||||
|
listTEST_LIST_INTEGRITY( pxList );
|
||||||
|
listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );
|
||||||
|
|
||||||
/* Insert a new list item into pxList, but rather than sort the list,
|
/* Insert a new list item into pxList, but rather than sort the list,
|
||||||
makes the new list item the last item to be removed by a call to
|
makes the new list item the last item to be removed by a call to
|
||||||
listGET_OWNER_OF_NEXT_ENTRY(). */
|
listGET_OWNER_OF_NEXT_ENTRY(). */
|
||||||
|
@ -123,6 +139,12 @@ void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem )
|
||||||
ListItem_t *pxIterator;
|
ListItem_t *pxIterator;
|
||||||
const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;
|
const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;
|
||||||
|
|
||||||
|
/* Only effective when configASSERT() is also defined, these tests may catch
|
||||||
|
the list data structures being overwritten in memory. They will not catch
|
||||||
|
data errors caused by incorrect configuration or use of FreeRTOS. */
|
||||||
|
listTEST_LIST_INTEGRITY( pxList );
|
||||||
|
listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );
|
||||||
|
|
||||||
/* Insert the new list item into the list, sorted in xItemValue order.
|
/* Insert the new list item into the list, sorted in xItemValue order.
|
||||||
|
|
||||||
If the list already contains a list item with the same item value then the
|
If the list already contains a list item with the same item value then the
|
||||||
|
|
|
@ -155,7 +155,7 @@ const uint32_t ulR13 = ( uint32_t ) &_SDA_BASE_;
|
||||||
*pxTopOfStack = ( StackType_t ) 0x00000000;
|
*pxTopOfStack = ( StackType_t ) 0x00000000;
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
|
|
||||||
#if XPAR_MICROBLAZE_0_USE_FPU == 1
|
#if XPAR_MICROBLAZE_0_USE_FPU != 0
|
||||||
/* The FSR value placed in the initial task context is just 0. */
|
/* The FSR value placed in the initial task context is just 0. */
|
||||||
*pxTopOfStack = portINITIAL_FSR;
|
*pxTopOfStack = portINITIAL_FSR;
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
|
|
|
@ -196,7 +196,7 @@ extern void *pxCurrentTCB;
|
||||||
exception. */
|
exception. */
|
||||||
xRegisterDump.ulPC = xRegisterDump.ulR17_return_address_from_exceptions - portexINSTRUCTION_SIZE;
|
xRegisterDump.ulPC = xRegisterDump.ulR17_return_address_from_exceptions - portexINSTRUCTION_SIZE;
|
||||||
|
|
||||||
#if XPAR_MICROBLAZE_0_USE_FPU == 1
|
#if XPAR_MICROBLAZE_0_USE_FPU != 0
|
||||||
{
|
{
|
||||||
xRegisterDump.ulFSR = mffsr();
|
xRegisterDump.ulFSR = mffsr();
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ extern void *pxCurrentTCB;
|
||||||
xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_STACK_VIOLATION or XEXC_ID_MMU";
|
xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_STACK_VIOLATION or XEXC_ID_MMU";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if XPAR_MICROBLAZE_0_USE_FPU == 1
|
#if XPAR_MICROBLAZE_0_USE_FPU != 0
|
||||||
|
|
||||||
case XEXC_ID_FPU :
|
case XEXC_ID_FPU :
|
||||||
xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_FPU see ulFSR value";
|
xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_FPU see ulFSR value";
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
|
|
||||||
/* The context is oversized to allow functions called from the ISR to write
|
/* The context is oversized to allow functions called from the ISR to write
|
||||||
back into the caller stack. */
|
back into the caller stack. */
|
||||||
#if XPAR_MICROBLAZE_0_USE_FPU == 1
|
#if XPAR_MICROBLAZE_0_USE_FPU != 0
|
||||||
#define portCONTEXT_SIZE 136
|
#define portCONTEXT_SIZE 136
|
||||||
#define portMINUS_CONTEXT_SIZE -136
|
#define portMINUS_CONTEXT_SIZE -136
|
||||||
#else
|
#else
|
||||||
|
@ -175,7 +175,7 @@ back into the caller stack. */
|
||||||
mfs r18, rmsr
|
mfs r18, rmsr
|
||||||
swi r18, r1, portMSR_OFFSET
|
swi r18, r1, portMSR_OFFSET
|
||||||
|
|
||||||
#if XPAR_MICROBLAZE_0_USE_FPU == 1
|
#if XPAR_MICROBLAZE_0_USE_FPU != 0
|
||||||
/* Stack FSR. */
|
/* Stack FSR. */
|
||||||
mfs r18, rfsr
|
mfs r18, rfsr
|
||||||
swi r18, r1, portFSR_OFFSET
|
swi r18, r1, portFSR_OFFSET
|
||||||
|
@ -228,7 +228,7 @@ back into the caller stack. */
|
||||||
lwi r18, r1, portMSR_OFFSET
|
lwi r18, r1, portMSR_OFFSET
|
||||||
mts rmsr, r18
|
mts rmsr, r18
|
||||||
|
|
||||||
#if XPAR_MICROBLAZE_0_USE_FPU == 1
|
#if XPAR_MICROBLAZE_0_USE_FPU != 0
|
||||||
/* Reload the FSR from the stack. */
|
/* Reload the FSR from the stack. */
|
||||||
lwi r18, r1, portFSR_OFFSET
|
lwi r18, r1, portFSR_OFFSET
|
||||||
mts rfsr, r18
|
mts rfsr, r18
|
||||||
|
|
|
@ -133,6 +133,7 @@ typedef struct tskTaskControlBlock
|
||||||
|
|
||||||
#if ( portUSING_MPU_WRAPPERS == 1 )
|
#if ( portUSING_MPU_WRAPPERS == 1 )
|
||||||
xMPU_SETTINGS xMPUSettings; /*< The MPU settings are defined as part of the port layer. THIS MUST BE THE SECOND MEMBER OF THE TCB STRUCT. */
|
xMPU_SETTINGS xMPUSettings; /*< The MPU settings are defined as part of the port layer. THIS MUST BE THE SECOND MEMBER OF THE TCB STRUCT. */
|
||||||
|
BaseType_t xUsingStaticallyAllocatedStack; /* Set to pdTRUE if the stack is a statically allocated array, and pdFALSE if the stack is dynamically allocated. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ListItem_t xGenericListItem; /*< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */
|
ListItem_t xGenericListItem; /*< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */
|
||||||
|
@ -543,6 +544,7 @@ BaseType_t xTaskGenericCreate( TaskFunction_t pxTaskCode, const char * const pcN
|
||||||
{
|
{
|
||||||
BaseType_t xReturn;
|
BaseType_t xReturn;
|
||||||
TCB_t * pxNewTCB;
|
TCB_t * pxNewTCB;
|
||||||
|
StackType_t *pxTopOfStack;
|
||||||
|
|
||||||
configASSERT( pxTaskCode );
|
configASSERT( pxTaskCode );
|
||||||
configASSERT( ( ( uxPriority & ( ~portPRIVILEGE_BIT ) ) < configMAX_PRIORITIES ) );
|
configASSERT( ( ( uxPriority & ( ~portPRIVILEGE_BIT ) ) < configMAX_PRIORITIES ) );
|
||||||
|
@ -553,8 +555,6 @@ TCB_t * pxNewTCB;
|
||||||
|
|
||||||
if( pxNewTCB != NULL )
|
if( pxNewTCB != NULL )
|
||||||
{
|
{
|
||||||
StackType_t *pxTopOfStack;
|
|
||||||
|
|
||||||
#if( portUSING_MPU_WRAPPERS == 1 )
|
#if( portUSING_MPU_WRAPPERS == 1 )
|
||||||
/* Should the task be created in privileged mode? */
|
/* Should the task be created in privileged mode? */
|
||||||
BaseType_t xRunPrivileged;
|
BaseType_t xRunPrivileged;
|
||||||
|
@ -567,6 +567,20 @@ TCB_t * pxNewTCB;
|
||||||
xRunPrivileged = pdFALSE;
|
xRunPrivileged = pdFALSE;
|
||||||
}
|
}
|
||||||
uxPriority &= ~portPRIVILEGE_BIT;
|
uxPriority &= ~portPRIVILEGE_BIT;
|
||||||
|
|
||||||
|
if( puxStackBuffer != NULL )
|
||||||
|
{
|
||||||
|
/* The application provided its own stack. Note this so no
|
||||||
|
attempt is made to delete the stack should that task be
|
||||||
|
deleted. */
|
||||||
|
pxNewTCB->xUsingStaticallyAllocatedStack = pdTRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* The stack was allocated dynamically. Note this so it can be
|
||||||
|
deleted again if the task is deleted. */
|
||||||
|
pxNewTCB->xUsingStaticallyAllocatedStack = pdFALSE;
|
||||||
|
}
|
||||||
#endif /* portUSING_MPU_WRAPPERS == 1 */
|
#endif /* portUSING_MPU_WRAPPERS == 1 */
|
||||||
|
|
||||||
/* Calculate the top of stack address. This depends on whether the
|
/* Calculate the top of stack address. This depends on whether the
|
||||||
|
@ -3222,7 +3236,22 @@ TCB_t *pxNewTCB;
|
||||||
_reclaim_reent( &( pxTCB->xNewLib_reent ) );
|
_reclaim_reent( &( pxTCB->xNewLib_reent ) );
|
||||||
}
|
}
|
||||||
#endif /* configUSE_NEWLIB_REENTRANT */
|
#endif /* configUSE_NEWLIB_REENTRANT */
|
||||||
|
|
||||||
|
#if( portUSING_MPU_WRAPPERS == 1 )
|
||||||
|
{
|
||||||
|
/* Only free the stack if it was allocated dynamically in the first
|
||||||
|
place. */
|
||||||
|
if( pxTCB->xUsingStaticallyAllocatedStack == pdFALSE )
|
||||||
|
{
|
||||||
vPortFreeAligned( pxTCB->pxStack );
|
vPortFreeAligned( pxTCB->pxStack );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
vPortFreeAligned( pxTCB->pxStack );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
vPortFree( pxTCB );
|
vPortFree( pxTCB );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3601,7 +3630,7 @@ TCB_t *pxTCB;
|
||||||
pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName );
|
pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName );
|
||||||
|
|
||||||
/* Write the rest of the string. */
|
/* Write the rest of the string. */
|
||||||
sprintf( pcWriteBuffer, "\t\t%c\t%u\t%u\t%u\r\n", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );
|
sprintf( pcWriteBuffer, "\t%c\t%u\t%u\t%u\r\n", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );
|
||||||
pcWriteBuffer += strlen( pcWriteBuffer );
|
pcWriteBuffer += strlen( pcWriteBuffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3694,13 +3723,13 @@ TCB_t *pxTCB;
|
||||||
{
|
{
|
||||||
#ifdef portLU_PRINTF_SPECIFIER_REQUIRED
|
#ifdef portLU_PRINTF_SPECIFIER_REQUIRED
|
||||||
{
|
{
|
||||||
sprintf( pcWriteBuffer, "\t\t%lu\t\t%lu%%\r\n", pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );
|
sprintf( pcWriteBuffer, "\t%lu\t\t%lu%%\r\n", pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
/* sizeof( int ) == sizeof( long ) so a smaller
|
/* sizeof( int ) == sizeof( long ) so a smaller
|
||||||
printf() library can be used. */
|
printf() library can be used. */
|
||||||
sprintf( pcWriteBuffer, "\t\t%u\t\t%u%%\r\n", ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage );
|
sprintf( pcWriteBuffer, "\t%u\t\t%u%%\r\n", ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -3710,13 +3739,13 @@ TCB_t *pxTCB;
|
||||||
consumed less than 1% of the total run time. */
|
consumed less than 1% of the total run time. */
|
||||||
#ifdef portLU_PRINTF_SPECIFIER_REQUIRED
|
#ifdef portLU_PRINTF_SPECIFIER_REQUIRED
|
||||||
{
|
{
|
||||||
sprintf( pcWriteBuffer, "\t\t%lu\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter );
|
sprintf( pcWriteBuffer, "\t%lu\t\t<1%%\r\n", pxTaskStatusArray[ x ].ulRunTimeCounter );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
/* sizeof( int ) == sizeof( long ) so a smaller
|
/* sizeof( int ) == sizeof( long ) so a smaller
|
||||||
printf() library can be used. */
|
printf() library can be used. */
|
||||||
sprintf( pcWriteBuffer, "\t\t%u\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter );
|
sprintf( pcWriteBuffer, "\t%u\t\t<1%%\r\n", ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue