mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Basic demo up and running.
This commit is contained in:
parent
4953c7d030
commit
5ff84b9869
|
@ -67,7 +67,7 @@
|
||||||
#define configUSE_TICK_HOOK 0
|
#define configUSE_TICK_HOOK 0
|
||||||
#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 25000000 )
|
#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 25000000 )
|
||||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||||
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 60 )
|
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 90 )
|
||||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 24000 ) )
|
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 24000 ) )
|
||||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||||
#define configUSE_TRACE_FACILITY 1
|
#define configUSE_TRACE_FACILITY 1
|
||||||
|
@ -94,6 +94,7 @@ to exclude the API function. */
|
||||||
#define INCLUDE_vTaskDelay 1
|
#define INCLUDE_vTaskDelay 1
|
||||||
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||||
|
|
||||||
|
#define configYIELD_INTERRUPT_VECTOR 63UL
|
||||||
#define configKERNEL_INTERRUPT_PRIORITY 1
|
#define configKERNEL_INTERRUPT_PRIORITY 1
|
||||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 4
|
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 4
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
#define portPRESCALE_VALUE 64
|
#define portPRESCALE_VALUE 64
|
||||||
#define portPRESCALE_REG_SETTING ( 5 << 8 )
|
#define portPRESCALE_REG_SETTING ( 5 << 8 )
|
||||||
|
@ -69,14 +70,16 @@ const unsigned portSHORT usCompareMatchValue = ( ( configCPU_CLOCK_HZ / portPRES
|
||||||
MCF_PIT0_PCSR = ( portPRESCALE_REG_SETTING | MCF_PIT_PCSR_PIE | MCF_PIT_PCSR_RLD | MCF_PIT_PCSR_EN );
|
MCF_PIT0_PCSR = ( portPRESCALE_REG_SETTING | MCF_PIT_PCSR_PIE | MCF_PIT_PCSR_RLD | MCF_PIT_PCSR_EN );
|
||||||
MCF_PIT0_PMR = usCompareMatchValue;
|
MCF_PIT0_PMR = usCompareMatchValue;
|
||||||
}
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
void __attribute__ ((interrupt)) __cs3_isr_interrupt_127(void)
|
|
||||||
{
|
|
||||||
MCF_INTC0_INTFRCH &= ~( 1UL << 31UL );
|
|
||||||
}
|
|
||||||
|
|
||||||
void __attribute__ ((interrupt)) __cs3_isr_interrupt_119( void )
|
void __attribute__ ((interrupt)) __cs3_isr_interrupt_119( void )
|
||||||
{
|
{
|
||||||
MCF_PIT0_PCSR |= MCF_PIT_PCSR_PIF;
|
MCF_PIT0_PCSR |= MCF_PIT_PCSR_PIF;
|
||||||
MCF_INTC0_INTFRCH |= ( 1UL << 31UL );
|
vTaskIncrementTick();
|
||||||
|
|
||||||
|
#if configUSE_PREEMPTION == 1
|
||||||
|
{
|
||||||
|
taskYIELD();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ VPATH=$(FREERTOS_SOURCE_DIR) : $(PORT_SOURCE_DIR) : $(COMMON_DEMO_CODE_DIR) : $(
|
||||||
|
|
||||||
OBJS = $(OUTPUT_DIR)/portasm.o \
|
OBJS = $(OUTPUT_DIR)/portasm.o \
|
||||||
$(OUTPUT_DIR)/main.o \
|
$(OUTPUT_DIR)/main.o \
|
||||||
|
$(OUTPUT_DIR)/flash.o \
|
||||||
$(OUTPUT_DIR)/ParTest.o \
|
$(OUTPUT_DIR)/ParTest.o \
|
||||||
$(OUTPUT_DIR)/BlockQ.o \
|
$(OUTPUT_DIR)/BlockQ.o \
|
||||||
$(OUTPUT_DIR)/blocktim.o \
|
$(OUTPUT_DIR)/blocktim.o \
|
||||||
|
|
|
@ -90,7 +90,14 @@
|
||||||
|
|
||||||
/* The time between cycles of the 'check' functionality (defined within the
|
/* The time between cycles of the 'check' functionality (defined within the
|
||||||
tick hook. */
|
tick hook. */
|
||||||
#define mainCHECK_DELAY ( ( portTickType ) 5000 / portTICK_RATE_MS )
|
#define mainNO_ERROR_PERIOD ( ( portTickType ) 5000 / portTICK_RATE_MS )
|
||||||
|
|
||||||
|
/* The rate at which the LED controlled by the 'check' task will flash when an
|
||||||
|
error has been detected. */
|
||||||
|
#define mainERROR_PERIOD ( 500 )
|
||||||
|
|
||||||
|
/* The LED controlled by the 'check' task. */
|
||||||
|
#define mainCHECK_LED ( 3 )
|
||||||
|
|
||||||
/* Task priorities. */
|
/* Task priorities. */
|
||||||
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||||
|
@ -107,6 +114,13 @@ tick hook. */
|
||||||
*/
|
*/
|
||||||
static void prvSetupHardware( void );
|
static void prvSetupHardware( void );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implements the 'check' task functionality as described at the top of this
|
||||||
|
* file.
|
||||||
|
*/
|
||||||
|
static void prvCheckTask( void *pvParameters );
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
int main( void )
|
int main( void )
|
||||||
|
@ -114,6 +128,7 @@ int main( void )
|
||||||
prvSetupHardware();
|
prvSetupHardware();
|
||||||
|
|
||||||
/* Start the standard demo tasks. */
|
/* Start the standard demo tasks. */
|
||||||
|
vStartLEDFlashTasks( tskIDLE_PRIORITY );
|
||||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||||
vCreateBlockTimeTasks();
|
vCreateBlockTimeTasks();
|
||||||
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
||||||
|
@ -123,6 +138,9 @@ int main( void )
|
||||||
vStartQueuePeekTasks();
|
vStartQueuePeekTasks();
|
||||||
vStartRecursiveMutexTasks();
|
vStartRecursiveMutexTasks();
|
||||||
|
|
||||||
|
/* Create the check task. */
|
||||||
|
xTaskCreate( prvCheckTask, ( signed portCHAR * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
/* The suicide tasks must be created last as they need to know how many
|
/* 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
|
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. */
|
or not the correct/expected number of tasks are running at any given time. */
|
||||||
|
@ -133,7 +151,66 @@ int main( void )
|
||||||
|
|
||||||
/* Will only get here if there was insufficient memory to create the idle
|
/* Will only get here if there was insufficient memory to create the idle
|
||||||
task. */
|
task. */
|
||||||
return 0;
|
for( ;; );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvCheckTask( void *pvParameters )
|
||||||
|
{
|
||||||
|
unsigned ulTicksToWait = mainNO_ERROR_PERIOD;
|
||||||
|
portTickType xLastExecutionTime;
|
||||||
|
|
||||||
|
( void ) pvParameters;
|
||||||
|
|
||||||
|
/* Initialise the variable used to control our iteration rate prior to
|
||||||
|
its first use. */
|
||||||
|
xLastExecutionTime = xTaskGetTickCount();
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
/* Wait until it is time to run the tests again. */
|
||||||
|
vTaskDelayUntil( &xLastExecutionTime, ulTicksToWait );
|
||||||
|
|
||||||
|
/* Has an error been found in any task? */
|
||||||
|
if( xAreGenericQueueTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulTicksToWait = mainERROR_PERIOD;
|
||||||
|
}
|
||||||
|
else if( xAreQueuePeekTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulTicksToWait = mainERROR_PERIOD;
|
||||||
|
}
|
||||||
|
else if( xAreBlockingQueuesStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulTicksToWait = mainERROR_PERIOD;
|
||||||
|
}
|
||||||
|
else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulTicksToWait = mainERROR_PERIOD;
|
||||||
|
}
|
||||||
|
else if( xAreSemaphoreTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulTicksToWait = mainERROR_PERIOD;
|
||||||
|
}
|
||||||
|
else if( xArePollingQueuesStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulTicksToWait = mainERROR_PERIOD;
|
||||||
|
}
|
||||||
|
else if( xIsCreateTaskStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulTicksToWait = mainERROR_PERIOD;
|
||||||
|
}
|
||||||
|
else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulTicksToWait = mainERROR_PERIOD;
|
||||||
|
}
|
||||||
|
else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulTicksToWait = mainERROR_PERIOD;
|
||||||
|
}
|
||||||
|
|
||||||
|
vParTestToggleLED( mainCHECK_LED );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue