mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Continue work on SmartFusion demo.
This commit is contained in:
parent
ed24f0fdc1
commit
9481ea480b
|
@ -66,7 +66,7 @@
|
|||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="Common_Demo_Tasks|Debug/FreeRTOS_Source/portable/GCC/ARM_CM3|FreeRTOS_Source|MicroSemi_Code/drivers/mss_ethernet_mac|main-full.c|MicroSemi_Code/drivers/mss_pdma|FreeTCPIP|MicroSemi_Code/drivers/mss_spi|Debug/FreeRTOS_Source/portable/MemMang|MicroSemi_Code/drivers/mss_ace|MicroSemi_Code/drivers/mss_uart|WebServer|MicroSemi_Code/drivers/mac" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="Common_Demo_Tasks|Debug/FreeRTOS_Source/portable/GCC/ARM_CM3|MicroSemi_Code/drivers/mss_ethernet_mac|main-full.c|MicroSemi_Code/drivers/mss_pdma|FreeTCPIP|MicroSemi_Code/drivers/mss_spi|Debug/FreeRTOS_Source/portable/MemMang|MicroSemi_Code/drivers/mss_ace|MicroSemi_Code/drivers/mss_uart|WebServer|MicroSemi_Code/drivers/mac" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
|
@ -454,12 +454,12 @@
|
|||
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.cross.cortexm3.exe.debug.option.optimization.level.577221940" name="Optimization Level" superClass="gnu.c.compiler.cross.cortexm3.exe.debug.option.optimization.level" valueType="enumerated"/>
|
||||
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.cross.cortexm3.exe.debug.option.debugging.level.455246761" name="Debug Level" superClass="gnu.c.compiler.cross.cortexm3.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.include.paths.1331265337" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/RTOSDemo}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/RTOSDemo/Common_Demo_Tasks/include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/RTOSDemo/FreeRTOS_Source/include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/RTOSDemo/FreeRTOS_Source/portable/GCC/ARM_CM3}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/RTOSDemo}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/RTOSDemo/MicroSemi_Code/drivers/mss_gpio}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/RTOSDemo/MicroSemi_Code/drivers/mss_watchdog}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/RTOSDemo/Common_Demo_Tasks/include}""/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.12052800" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
|
@ -485,7 +485,7 @@
|
|||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="main-blinky.c|FreeTCPIP|WebServer|MicroSemi_Code/drivers/mss_uart|MicroSemi_Code/drivers/mss_spi|MicroSemi_Code/drivers/mss_pdma|MicroSemi_Code/drivers/mss_ethernet_mac|MicroSemi_Code/drivers/mss_ace|MicroSemi_Code/drivers/mac|Debug/FreeRTOS_Source/portable/GCC/ARM_CM3|Debug/FreeRTOS_Source/portable/MemMang|FreeRTOS_Source" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="main-blinky.c|FreeTCPIP|WebServer|MicroSemi_Code/drivers/mss_uart|MicroSemi_Code/drivers/mss_spi|MicroSemi_Code/drivers/mss_pdma|MicroSemi_Code/drivers/mss_ethernet_mac|MicroSemi_Code/drivers/mss_ace|MicroSemi_Code/drivers/mac|Debug/FreeRTOS_Source/portable/GCC/ARM_CM3|Debug/FreeRTOS_Source/portable/MemMang" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
|
|
|
@ -38,7 +38,7 @@ IF EXIST FreeRTOS_Source Goto END
|
|||
copy ..\..\Source\portable\GCC\ARM_CM3\*.* FreeRTOS_Source\portable\GCC\ARM_CM3
|
||||
|
||||
REM Copy the basic memory allocation files
|
||||
copy ..\..\Source\portable\MemMang\heap_1.c FreeRTOS_Source\portable\MemMang
|
||||
copy ..\..\Source\portable\MemMang\heap_2.c FreeRTOS_Source\portable\MemMang
|
||||
|
||||
REM Copy the core FreeTCPIP (based on uIP) files
|
||||
copy ..\Common\ethernet\FreeTCPIP\psock.c FreeTCPIP
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 7 * 1024 ) )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 45 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 10 )
|
||||
#define configUSE_TRACE_FACILITY 0
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
|
@ -91,7 +91,7 @@
|
|||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configUSE_RECURSIVE_MUTEXES 0
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_MALLOC_FAILED_HOOK 1
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 0
|
||||
|
@ -103,7 +103,7 @@
|
|||
/* Software timer definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( 3 )
|
||||
#define configTIMER_QUEUE_LENGTH 5
|
||||
#define configTIMER_QUEUE_LENGTH 10
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
|
@ -116,6 +116,11 @@ to exclude the API function. */
|
|||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
|
||||
/* Override some of the priorities set in the common demo tasks. This is
|
||||
required to ensure false positive timing errors are not reported. */
|
||||
#define bktPRIMARY_PRIORITY ( configMAX_PRIORITIES - 3 )
|
||||
#define bktSECONDARY_PRIORITY ( configMAX_PRIORITIES - 4 )
|
||||
|
||||
/* Use the system definition, if there is one */
|
||||
#ifdef __NVIC_PRIO_BITS
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
|
|
|
@ -111,6 +111,24 @@ void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vParTestSetLEDFromISR( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
|
||||
{
|
||||
if( uxLED < partstMAX_LEDS )
|
||||
{
|
||||
if( xValue == pdTRUE )
|
||||
{
|
||||
ulGPIOState &= ~( 1UL << uxLED );
|
||||
}
|
||||
else
|
||||
{
|
||||
ulGPIOState |= ( 1UL << uxLED );
|
||||
}
|
||||
|
||||
MSS_GPIO_set_outputs( ulGPIOState );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
||||
{
|
||||
if( uxLED < partstMAX_LEDS )
|
||||
|
@ -119,7 +137,7 @@ void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
|
|||
interrupt. */
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
if( ( ulGPIOState & ( 1UL << uxLED ) != 0UL )
|
||||
if( ( ulGPIOState & ( 1UL << uxLED ) ) != 0UL )
|
||||
{
|
||||
ulGPIOState &= ~( 1UL << uxLED );
|
||||
}
|
||||
|
|
|
@ -114,7 +114,15 @@ remain on until a full five seconds pass without the button being pressed.
|
|||
|
||||
/* Common demo includes. */
|
||||
#include "partest.h"
|
||||
|
||||
#include "flash.h"
|
||||
#include "BlockQ.h"
|
||||
#include "death.h"
|
||||
#include "blocktim.h"
|
||||
#include "semtest.h"
|
||||
#include "GenQTest.h"
|
||||
#include "QPeek.h"
|
||||
#include "recmutex.h"
|
||||
#include "TimerDemo.h"
|
||||
|
||||
/* Priorities at which the tasks are created. */
|
||||
#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
|
@ -127,10 +135,24 @@ converted to ticks using the portTICK_RATE_MS constant. */
|
|||
/* The number of items the queue can hold. This is 1 as the receive task
|
||||
will remove items as they are added, meaning the send task should always find
|
||||
the queue empty. */
|
||||
#define mainQUEUE_LENGTH ( 1 )
|
||||
#define mainQUEUE_LENGTH ( 1 )
|
||||
|
||||
#define mainCHECK_LED 0x07UL
|
||||
#define mainTIMER_CONTROLLED_LED 0x06UL
|
||||
#define mainTASK_CONTROLLED_LED 0x05UL
|
||||
|
||||
#define mainTIMER_TEST_PERIOD ( 50 )
|
||||
|
||||
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
|
||||
#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainuIP_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
|
||||
#define mainTASK_CONTROLLED_LED 0x01UL
|
||||
#define mainTIMER_CONTROLLED_LED 0x02UL
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
|
@ -150,6 +172,14 @@ static void prvQueueSendTask( void *pvParameters );
|
|||
*/
|
||||
static void vLEDTimerCallback( xTimerHandle xTimer );
|
||||
|
||||
static void vCheckTimerCallback( xTimerHandle xTimer );
|
||||
|
||||
/*
|
||||
* This is not a 'standard' partest function, so the prototype is not in
|
||||
* partest.h.
|
||||
*/
|
||||
void vParTestSetLEDFromISR( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The queue used by both tasks. */
|
||||
|
@ -159,6 +189,12 @@ static xQueueHandle xQueue = NULL;
|
|||
function. */
|
||||
static xTimerHandle xLEDTimer = NULL;
|
||||
|
||||
static xTimerHandle xCheckTimer = NULL;
|
||||
|
||||
/* The status message that is displayed at the bottom of the "task stats" web
|
||||
page, which is served by the uIP task. This will report any errors picked up
|
||||
by the reg test task. */
|
||||
static const char *pcStatusMessage = NULL;
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -188,6 +224,22 @@ int main(void)
|
|||
vLEDTimerCallback /* The callback function that switches the LED off. */
|
||||
);
|
||||
|
||||
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer", /* A text name, purely to help debugging. */
|
||||
( 3000 / portTICK_RATE_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. */
|
||||
vCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||
);
|
||||
|
||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||
vCreateBlockTimeTasks();
|
||||
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
||||
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
|
||||
vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );
|
||||
vStartQueuePeekTasks();
|
||||
vStartRecursiveMutexTasks();
|
||||
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
|
||||
|
||||
/* Start the tasks and timer running. */
|
||||
vTaskStartScheduler();
|
||||
}
|
||||
|
@ -201,6 +253,73 @@ int main(void)
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void vCheckTimerCallback( xTimerHandle xTimer )
|
||||
{
|
||||
/* Check the standard demo tasks are running without error. */
|
||||
if( xAreGenericQueueTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
/* Increase the rate at which this task cycles, which will increase the
|
||||
rate at which mainCHECK_LED flashes to give visual feedback that an error
|
||||
has occurred. */
|
||||
pcStatusMessage = "Error: GenQueue";
|
||||
// xPrintf( pcStatusMessage );
|
||||
}
|
||||
|
||||
if( xAreQueuePeekTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: QueuePeek\r\n";
|
||||
// xPrintf( pcStatusMessage );
|
||||
}
|
||||
|
||||
if( xAreBlockingQueuesStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: BlockQueue\r\n";
|
||||
// xPrintf( pcStatusMessage );
|
||||
}
|
||||
|
||||
if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: BlockTime\r\n";
|
||||
// xPrintf( pcStatusMessage );
|
||||
}
|
||||
|
||||
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: SemTest\r\n";
|
||||
// xPrintf( pcStatusMessage );
|
||||
}
|
||||
|
||||
if( xIsCreateTaskStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: Death\r\n";
|
||||
// xPrintf( pcStatusMessage );
|
||||
}
|
||||
|
||||
if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: RecMutex\r\n";
|
||||
// xPrintf( pcStatusMessage );
|
||||
}
|
||||
|
||||
if( xAreTimerDemoTasksStillRunning( ( 3000 / portTICK_RATE_MS ) ) != pdTRUE )
|
||||
{
|
||||
pcStatusMessage = "Error: TimerDemo";
|
||||
}
|
||||
|
||||
/* Toggle the check LED to give an indication of the system status. If
|
||||
the LED toggles every 5 seconds then everything is ok. A faster toggle
|
||||
indicates an error. */
|
||||
vParTestToggleLED( mainCHECK_LED );
|
||||
|
||||
if( pcStatusMessage != NULL )
|
||||
{
|
||||
/* The block time is set to zero as a timer callback must *never*
|
||||
attempt to block. */
|
||||
xTimerChangePeriod( xCheckTimer, ( 500 / portTICK_RATE_MS ), 0 );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void vLEDTimerCallback( xTimerHandle xTimer )
|
||||
{
|
||||
/* The timer has expired - so no button pushes have occurred in the last
|
||||
|
@ -208,8 +327,7 @@ static void vLEDTimerCallback( xTimerHandle xTimer )
|
|||
a critical section because it is accessed from multiple tasks, and the
|
||||
button interrupt - in this trivial case, for simplicity, the critical
|
||||
section is omitted. */
|
||||
ulGPIOState |= mainTIMER_CONTROLLED_LED;
|
||||
MSS_GPIO_set_outputs( ulGPIOState );
|
||||
vParTestSetLED( mainTIMER_CONTROLLED_LED, pdFALSE );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -221,8 +339,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
|||
/* The button was pushed, so ensure the LED is on before resetting the
|
||||
LED timer. The LED timer will turn the LED off if the button is not
|
||||
pushed within 5000ms. */
|
||||
ulGPIOState &= ~mainTIMER_CONTROLLED_LED;
|
||||
MSS_GPIO_set_outputs( ulGPIOState );
|
||||
vParTestSetLEDFromISR( mainTIMER_CONTROLLED_LED, pdTRUE );
|
||||
|
||||
/* This interrupt safe FreeRTOS function can be called from this interrupt
|
||||
because the interrupt priority is below the
|
||||
|
@ -246,6 +363,13 @@ static void prvQueueSendTask( void *pvParameters )
|
|||
portTickType xNextWakeTime;
|
||||
const unsigned long ulValueToSend = 100UL;
|
||||
|
||||
/* The suicide tasks must be created last as they need to know how many
|
||||
tasks were running prior to their creation in order to ascertain whether
|
||||
or not the correct/expected number of tasks are running at any given time. */
|
||||
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
|
||||
|
||||
xTimerStart( xCheckTimer, portMAX_DELAY );
|
||||
|
||||
/* Initialise xNextWakeTime - this only needs to be done once. */
|
||||
xNextWakeTime = xTaskGetTickCount();
|
||||
|
||||
|
@ -285,15 +409,7 @@ unsigned long ulReceivedValue;
|
|||
because it is accessed from multiple tasks, and the button interrupt
|
||||
- in this trivial case, for simplicity, the critical section is
|
||||
omitted. */
|
||||
if( ( ulGPIOState & mainTASK_CONTROLLED_LED ) != 0 )
|
||||
{
|
||||
ulGPIOState &= ~mainTASK_CONTROLLED_LED;
|
||||
}
|
||||
else
|
||||
{
|
||||
ulGPIOState |= mainTASK_CONTROLLED_LED;
|
||||
}
|
||||
MSS_GPIO_set_outputs( ulGPIOState );
|
||||
vParTestToggleLED( mainTASK_CONTROLLED_LED );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue