mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Complete tidy up of SAMD20 demo.
This commit is contained in:
parent
41a1dc62b7
commit
dcea05a81c
|
@ -6,13 +6,10 @@ EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|ARM = Debug|ARM
|
Debug|ARM = Debug|ARM
|
||||||
Release|ARM = Release|ARM
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{2A475B6A-78B0-4237-8947-341BD379AB5C}.Debug|ARM.ActiveCfg = Debug|ARM
|
{2A475B6A-78B0-4237-8947-341BD379AB5C}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||||
{2A475B6A-78B0-4237-8947-341BD379AB5C}.Debug|ARM.Build.0 = Debug|ARM
|
{2A475B6A-78B0-4237-8947-341BD379AB5C}.Debug|ARM.Build.0 = Debug|ARM
|
||||||
{2A475B6A-78B0-4237-8947-341BD379AB5C}.Release|ARM.ActiveCfg = Release|ARM
|
|
||||||
{2A475B6A-78B0-4237-8947-341BD379AB5C}.Release|ARM.Build.0 = Release|ARM
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
Binary file not shown.
|
@ -83,6 +83,18 @@
|
||||||
* In addition to the standard demo tasks, the following tasks and timer are
|
* In addition to the standard demo tasks, the following tasks and timer are
|
||||||
* defined and/or created within this file:
|
* defined and/or created within this file:
|
||||||
*
|
*
|
||||||
|
* "Command console task" - This uses the Atmel USART driver to provide the
|
||||||
|
* input and output to FreeRTOS+CLI - the FreeRTOS Command Line Interface. To
|
||||||
|
* use the CLI:
|
||||||
|
* - Power the SAMD20 XPlained board through the USB debugger connector. This
|
||||||
|
* will create a virtual COM port through the USB.
|
||||||
|
* - Build and run the demo application.
|
||||||
|
* - Start a dumb terminal program such as TerraTerm or Hyper Terminal.
|
||||||
|
* - In the dumb terminal select the UART port associated with the XPlained
|
||||||
|
* debugger connection, using 19200 baud.
|
||||||
|
* - Type 'help' in the terminal window to see a lit of command registered by
|
||||||
|
* the demo.
|
||||||
|
*
|
||||||
* "Reg test" tasks - These fill the registers with known values, then check
|
* "Reg test" tasks - These fill the registers with known values, then check
|
||||||
* that each register maintains its expected value for the lifetime of the
|
* that each register maintains its expected value for the lifetime of the
|
||||||
* task. Each task uses a different set of values. The reg test tasks execute
|
* task. Each task uses a different set of values. The reg test tasks execute
|
||||||
|
@ -144,7 +156,7 @@ extern void vRegTest1Task( void *pvParameters );
|
||||||
extern void vRegTest2Task( void *pvParameters );
|
extern void vRegTest2Task( void *pvParameters );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function that starts the command console.
|
* Function that starts the command console task.
|
||||||
*/
|
*/
|
||||||
extern void vUARTCommandConsoleStart( uint16_t usStackSize, unsigned portBASE_TYPE uxPriority );
|
extern void vUARTCommandConsoleStart( uint16_t usStackSize, unsigned portBASE_TYPE uxPriority );
|
||||||
|
|
||||||
|
@ -222,6 +234,7 @@ const size_t xRegTestStackSize = 25U;
|
||||||
actually start running until the scheduler starts. A block time of
|
actually start running until the scheduler starts. A block time of
|
||||||
zero is used in this call, although any value could be used as the block
|
zero is used in this call, although any value could be used as the block
|
||||||
time will be ignored because the scheduler has not started yet. */
|
time will be ignored because the scheduler has not started yet. */
|
||||||
|
configASSERT( xTimer );
|
||||||
if( xTimer != NULL )
|
if( xTimer != NULL )
|
||||||
{
|
{
|
||||||
xTimerStart( xTimer, mainDONT_BLOCK );
|
xTimerStart( xTimer, mainDONT_BLOCK );
|
||||||
|
@ -250,58 +263,59 @@ unsigned long ulErrorFound = pdFALSE;
|
||||||
running, and that none have detected an error. */
|
running, and that none have detected an error. */
|
||||||
if( xAreDynamicPriorityTasksStillRunning() != pdPASS )
|
if( xAreDynamicPriorityTasksStillRunning() != pdPASS )
|
||||||
{
|
{
|
||||||
ulErrorFound |= ( 0x01UL << 0UL );
|
ulErrorFound = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreBlockTimeTestTasksStillRunning() != pdPASS )
|
if( xAreBlockTimeTestTasksStillRunning() != pdPASS )
|
||||||
{
|
{
|
||||||
ulErrorFound |= ( 0x01UL << 1UL );
|
ulErrorFound = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreCountingSemaphoreTasksStillRunning() != pdPASS )
|
if( xAreCountingSemaphoreTasksStillRunning() != pdPASS )
|
||||||
{
|
{
|
||||||
ulErrorFound |= ( 0x01UL << 2UL );
|
ulErrorFound = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreRecursiveMutexTasksStillRunning() != pdPASS )
|
if( xAreRecursiveMutexTasksStillRunning() != pdPASS )
|
||||||
{
|
{
|
||||||
ulErrorFound |= ( 0x01UL << 3UL );
|
ulErrorFound = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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 |= ( 0x01UL << 4UL );
|
ulErrorFound = pdTRUE;
|
||||||
}
|
}
|
||||||
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 |= ( 0x01UL << 5UL );
|
ulErrorFound = pdTRUE;
|
||||||
}
|
}
|
||||||
ulLastRegTest2Value = ulRegTest2LoopCounter;
|
ulLastRegTest2Value = ulRegTest2LoopCounter;
|
||||||
|
|
||||||
|
|
||||||
if( xAreQueueSetTasksStillRunning() != pdPASS )
|
if( xAreQueueSetTasksStillRunning() != pdPASS )
|
||||||
{
|
{
|
||||||
ulErrorFound |= ( 0x01UL << 6UL );
|
ulErrorFound = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xIsQueueOverwriteTaskStillRunning() != pdPASS )
|
if( xIsQueueOverwriteTaskStillRunning() != pdPASS )
|
||||||
{
|
{
|
||||||
ulErrorFound |= ( 0x01UL << 7UL );
|
ulErrorFound = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreGenericQueueTasksStillRunning() != pdPASS )
|
if( xAreGenericQueueTasksStillRunning() != pdPASS )
|
||||||
{
|
{
|
||||||
ulErrorFound |= ( 0x01UL << 8UL );
|
ulErrorFound = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xAreQueuePeekTasksStillRunning() != pdPASS )
|
if( xAreQueuePeekTasksStillRunning() != pdPASS )
|
||||||
{
|
{
|
||||||
ulErrorFound |= ( 0x01UL << 9UL );
|
ulErrorFound = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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. */
|
||||||
|
|
|
@ -98,8 +98,7 @@ or 0 to run the more comprehensive test and demo application. */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Perform any application specific hardware configuration. The clocks,
|
* Perform any application specific hardware configuration.
|
||||||
* memory, etc. are configured before main() is called.
|
|
||||||
*/
|
*/
|
||||||
static void prvSetupHardware( void );
|
static void prvSetupHardware( void );
|
||||||
|
|
||||||
|
@ -202,12 +201,7 @@ void vApplicationTickHook( void )
|
||||||
configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be
|
configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be
|
||||||
added here, but the tick hook is called from an interrupt context, so
|
added here, but the tick hook is called from an interrupt context, so
|
||||||
code must not attempt to block, and only the interrupt safe FreeRTOS API
|
code must not attempt to block, and only the interrupt safe FreeRTOS API
|
||||||
functions can be used (those that end in FromISR()). The code in this
|
functions can be used (those that end in FromISR()). */
|
||||||
tick hook implementation is for demonstration only - it has no real
|
|
||||||
purpose. It just gives a semaphore every 50ms. The semaphore unblocks a
|
|
||||||
task that then toggles an LED. Additionally, the call to
|
|
||||||
vQueueSetAccessQueueSetFromISR() is part of the "standard demo tasks"
|
|
||||||
functionality. */
|
|
||||||
|
|
||||||
/* The semaphore and associated task are not created when the simple blinky
|
/* The semaphore and associated task are not created when the simple blinky
|
||||||
demo is used. */
|
demo is used. */
|
||||||
|
@ -223,6 +217,8 @@ void vApplicationTickHook( void )
|
||||||
|
|
||||||
void vMainConfigureTimerForRunTimeStats( void )
|
void vMainConfigureTimerForRunTimeStats( void )
|
||||||
{
|
{
|
||||||
|
/* Used by the optional run-time stats gathering functionality. */
|
||||||
|
|
||||||
/* How many clocks are there per tenth of a millisecond? */
|
/* How many clocks are there per tenth of a millisecond? */
|
||||||
ulClocksPer10thOfAMilliSecond = configCPU_CLOCK_HZ / 10000UL;
|
ulClocksPer10thOfAMilliSecond = configCPU_CLOCK_HZ / 10000UL;
|
||||||
}
|
}
|
||||||
|
@ -236,6 +232,9 @@ volatile unsigned long * const pulCurrentSysTickCount = ( ( volatile unsigned lo
|
||||||
volatile unsigned long * const pulInterruptCTRLState = ( ( volatile unsigned long *) 0xe000ed04 );
|
volatile unsigned long * const pulInterruptCTRLState = ( ( volatile unsigned long *) 0xe000ed04 );
|
||||||
const unsigned long ulSysTickPendingBit = 0x04000000UL;
|
const unsigned long ulSysTickPendingBit = 0x04000000UL;
|
||||||
|
|
||||||
|
/* Used by the optional run-time stats gathering functionality. */
|
||||||
|
|
||||||
|
|
||||||
/* NOTE: There are potentially race conditions here. However, it is used
|
/* NOTE: There are potentially race conditions here. However, it is used
|
||||||
anyway to keep the examples simple, and to avoid reliance on a separate
|
anyway to keep the examples simple, and to avoid reliance on a separate
|
||||||
timer peripheral. */
|
timer peripheral. */
|
||||||
|
@ -276,4 +275,33 @@ const unsigned long ulSysTickPendingBit = 0x04000000UL;
|
||||||
|
|
||||||
return ulReturn;
|
return ulReturn;
|
||||||
}
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef JUST_AN_EXAMPLE_ISR
|
||||||
|
|
||||||
|
void Dummy_IRQHandler(void)
|
||||||
|
{
|
||||||
|
long lHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
|
/* Clear the interrupt if necessary. */
|
||||||
|
Dummy_ClearITPendingBit();
|
||||||
|
|
||||||
|
/* This interrupt does nothing more than demonstrate how to synchronise a
|
||||||
|
task with an interrupt. A semaphore is used for this purpose. Note
|
||||||
|
lHigherPriorityTaskWoken is initialised to zero. Only FreeRTOS API functions
|
||||||
|
that end in "FromISR" can be called from an ISR. */
|
||||||
|
xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken );
|
||||||
|
|
||||||
|
/* If there was a task that was blocked on the semaphore, and giving the
|
||||||
|
semaphore caused the task to unblock, and the unblocked task has a priority
|
||||||
|
higher than the current Running state task (the task that this interrupt
|
||||||
|
interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE
|
||||||
|
internally within xSemaphoreGiveFromISR(). Passing pdTRUE into the
|
||||||
|
portEND_SWITCHING_ISR() macro will result in a context switch being pended to
|
||||||
|
ensure this interrupt returns directly to the unblocked, higher priority,
|
||||||
|
task. Passing pdFALSE into portEND_SWITCHING_ISR() has no effect. */
|
||||||
|
portEND_SWITCHING_ISR( lHigherPriorityTaskWoken );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* JUST_AN_EXAMPLE_ISR */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue