mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-20 01:58:32 -04:00
Add the beginnings of a Microblaze project for the KC705.
This commit is contained in:
parent
501a531d46
commit
acfbb7dd14
11 changed files with 2688 additions and 2 deletions
|
@ -0,0 +1,303 @@
|
|||
/*
|
||||
FreeRTOS V8.2.0 - Copyright (C) 2015 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* The register test task as described in the comments at the top of main-full.c.
|
||||
*/
|
||||
.global vRegTest1Implementation
|
||||
.global vRegTest2Implementation
|
||||
|
||||
/* Variables that are incremented on each iteration of the reg test tasks -
|
||||
provided the tasks have not reported any errors. The check timer inspects these
|
||||
variables to ensure they are still incrementing as expected. If a variable
|
||||
stops incrementing then it is likely that its associate task has stalled or
|
||||
detected an error. */
|
||||
.extern ulRegTest1LoopCounter
|
||||
.extern ulRegTest2LoopCounter
|
||||
|
||||
#warning Does not seem to test the floating point context register.
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
.section .text
|
||||
.align 2
|
||||
vRegTest1Implementation:
|
||||
/* First fill the relevant registers with known values. r0 is always 0, r1
|
||||
is the stack pointer, and r3 is a read only small data area pointer. */
|
||||
addi r3, r0, 3
|
||||
addi r4, r0, 4
|
||||
addi r5, r0, 5
|
||||
addi r6, r0, 6
|
||||
addi r7, r0, 7
|
||||
addi r8, r0, 8
|
||||
addi r9, r0, 9
|
||||
addi r10, r0, 10
|
||||
addi r11, r0, 11
|
||||
addi r12, r0, 12
|
||||
/* R13 = read write small data area anchour. */
|
||||
/* R14 = return address for interrupt. */
|
||||
/* R15 = return address for sub-routine. */
|
||||
/* R16 = return address for trap. */
|
||||
/* R17 = return address for exceptions. */
|
||||
/* R18 = reserved for assembler and compiler temporaries. */
|
||||
addi r19, r0, 19
|
||||
addi r20, r0, 20
|
||||
addi r21, r0, 21
|
||||
addi r22, r0, 22
|
||||
addi r23, r0, 23
|
||||
addi r24, r0, 24
|
||||
addi r25, r0, 25
|
||||
addi r26, r0, 26
|
||||
addi r27, r0, 27
|
||||
addi r28, r0, 28
|
||||
addi r29, r0, 29
|
||||
addi r30, r0, 30
|
||||
addi r31, r0, 31
|
||||
|
||||
/* Now test the register values to ensure they contain the same value that
|
||||
was written to them above. This task will get preempted frequently so
|
||||
other tasks are likely to have executed since the register values were
|
||||
written. If any register contains an unexpected value then the task will
|
||||
branch to Error_Loop_1, which in turn prevents it from incrementing its
|
||||
loop counter, enabling the check timer to determine that all is not as it
|
||||
should be. */
|
||||
|
||||
Loop_Start_1:
|
||||
xori r18, r3, 3
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r4, 4
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r6, 6
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r7, 7
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r8, 8
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r9, 9
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r10, 10
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r11, 11
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r12, 12
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r19, 19
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r20, 20
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r21, 21
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r22, 22
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r23, 23
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r24, 24
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r25, 25
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r26, 26
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r27, 27
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r28, 28
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r29, 29
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r30, 30
|
||||
bnei r18, Error_Loop_1
|
||||
xori r18, r31, 31
|
||||
bnei r18, Error_Loop_1
|
||||
|
||||
/* If this task has not branched to the error loop, then everything is ok,
|
||||
and the check variable can be incremented to indicate that this task
|
||||
is still running. Then, brach back to the top to check the register
|
||||
contents again. */
|
||||
lwi r18, r0, ulRegTest1LoopCounter
|
||||
addik r18, r18, 1
|
||||
swi r18, r0, ulRegTest1LoopCounter
|
||||
|
||||
bri Loop_Start_1
|
||||
|
||||
/* The test function will branch here if it discovers an error. This part
|
||||
of the code just sits in a NULL loop, which prevents the check variable
|
||||
incrementing any further to allow the check timer to recognize that this
|
||||
test has failed. */
|
||||
Error_Loop_1:
|
||||
bri 0
|
||||
nop
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
.section .text
|
||||
.align 2
|
||||
vRegTest2Implementation:
|
||||
/* First fill the relevant registers with known values. r0 is always 0, r1
|
||||
is the stack pointer, and r3 is a read only small data area pointer. */
|
||||
addi r3, r0, 30000
|
||||
addi r4, r0, 40000
|
||||
addi r5, r0, 50000
|
||||
addi r6, r0, 60000
|
||||
addi r7, r0, 70000
|
||||
addi r8, r0, 80000
|
||||
addi r9, r0, 90000
|
||||
addi r10, r0, 100000
|
||||
addi r11, r0, 110000
|
||||
addi r12, r0, 120000
|
||||
/* R13 = read write small data area anchour. */
|
||||
/* R14 = return address for interrupt. */
|
||||
/* R15 = return address for sub-routine. */
|
||||
/* R16 = return address for trap. */
|
||||
/* R17 = return address for exceptions. */
|
||||
/* R18 = reserved for assembler and compiler temporaries. */
|
||||
addi r19, r0, 190000
|
||||
addi r20, r0, 200000
|
||||
addi r21, r0, 210000
|
||||
addi r22, r0, 220000
|
||||
addi r23, r0, 230000
|
||||
addi r24, r0, 240000
|
||||
addi r25, r0, 250000
|
||||
addi r26, r0, 260000
|
||||
addi r27, r0, 270000
|
||||
addi r28, r0, 280000
|
||||
addi r29, r0, 290000
|
||||
addi r30, r0, 300000
|
||||
addi r31, r0, 310000
|
||||
|
||||
/* Now test the register values to ensure they contain the same value that
|
||||
was written to them above. This task will get preempted frequently so
|
||||
other tasks are likely to have executed since the register values were
|
||||
written. If any register contains an unexpected value then the task will
|
||||
branch to Error_Loop_2, which in turn prevents it from incrementing its
|
||||
loop counter, enabling the check timer to determine that all is not as it
|
||||
should be. */
|
||||
|
||||
Loop_Start_2:
|
||||
xori r18, r3, 30000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r4, 40000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r6, 60000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r7, 70000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r8, 80000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r9, 90000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r10, 100000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r11, 110000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r12, 120000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r19, 190000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r20, 200000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r21, 210000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r22, 220000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r23, 230000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r24, 240000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r25, 250000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r26, 260000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r27, 270000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r28, 280000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r29, 290000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r30, 300000
|
||||
bnei r18, Error_Loop_2
|
||||
xori r18, r31, 310000
|
||||
bnei r18, Error_Loop_2
|
||||
|
||||
/* If this task has not branched to the error loop, then everything is ok,
|
||||
and the check variable can be incremented to indicate that this task
|
||||
is still running. Then, brach back to the top to check the register
|
||||
contents again. */
|
||||
lwi r18, r0, ulRegTest2LoopCounter
|
||||
addik r18, r18, 1
|
||||
swi r18, r0, ulRegTest2LoopCounter
|
||||
|
||||
bri Loop_Start_2
|
||||
|
||||
/* The test function will branch here if it discovers an error. This part
|
||||
of the code just sits in a NULL loop, which prevents the check variable
|
||||
incrementing any further to allow the check timer to recognize that this
|
||||
test has failed. */
|
||||
Error_Loop_2:
|
||||
bri 0
|
||||
nop
|
||||
|
|
@ -0,0 +1,483 @@
|
|||
/*
|
||||
FreeRTOS V8.2.0 - Copyright (C) 2015 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* NOTE 1: This project provides two demo applications. A simple blinky
|
||||
* style project, and a more comprehensive test and demo application. The
|
||||
* mainCREATE_SIMPLY_BLINKY_DEMO_ONLY setting in main.c is used to select
|
||||
* between the two. See the notes on using mainCREATE_SIMPLY_BLINKY_DEMO_ONLY
|
||||
* in main.c. This file implements the comprehensive version.
|
||||
*
|
||||
* NOTE 2: This file only contains the source code that is specific to the
|
||||
* full demo. Generic functions, such FreeRTOS hook functions, and functions
|
||||
* required to configure the hardware, are defined in main.c.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* main_full() creates all the demo application tasks and software timers, then
|
||||
* starts the scheduler. The web documentation provides more details of the
|
||||
* standard demo application tasks, which provide no particular functionality,
|
||||
* but do provide a good example of how to use the FreeRTOS API.
|
||||
*
|
||||
* In addition to the standard demo tasks, the following tasks and tests are
|
||||
* defined and/or created within this file:
|
||||
*
|
||||
* FreeRTOS+CLI command console. The command console is access through the
|
||||
* UART to USB connector on the ZC702 Zynq development board (marked J2). For
|
||||
* reasons of robustness testing the UART driver is deliberately written to be
|
||||
* inefficient and should not be used as a template for a production driver.
|
||||
* Type "help" to see a list of registered commands. The FreeRTOS+CLI license
|
||||
* is different to the FreeRTOS license, see http://www.FreeRTOS.org/cli for
|
||||
* license and usage details. The default baud rate is 115200.
|
||||
*
|
||||
* "Reg test" tasks - These fill both the core and floating point registers with
|
||||
* known values, then check 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 with a very low priority, so get preempted very
|
||||
* frequently. A register containing an unexpected value is indicative of an
|
||||
* error in the context switching mechanism.
|
||||
*
|
||||
* "Check" task - The check task period is initially set to three seconds. The
|
||||
* task checks that all the standard demo tasks, and the register check tasks,
|
||||
* are not only still executing, but are executing without reporting any errors.
|
||||
* If the check task discovers that a task has either stalled, or reported an
|
||||
* error, then it changes its own execution period from the initial three
|
||||
* seconds, to just 200ms. The check task also toggles an LED each time it is
|
||||
* called. This provides a visual indication of the system status: If the LED
|
||||
* toggles every three seconds, then no issues have been discovered. If the LED
|
||||
* toggles every 200ms, then an issue has been discovered with at least one
|
||||
* task.
|
||||
*/
|
||||
|
||||
/* Standard includes. */
|
||||
#include <stdio.h>
|
||||
|
||||
/* Kernel includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "timers.h"
|
||||
#include "semphr.h"
|
||||
|
||||
/* Standard demo application includes. */
|
||||
#include "flash_timer.h"
|
||||
#include "flop.h"
|
||||
#include "semtest.h"
|
||||
#include "dynamic.h"
|
||||
#include "blocktim.h"
|
||||
#include "countsem.h"
|
||||
#include "GenQTest.h"
|
||||
#include "recmutex.h"
|
||||
#include "partest.h"
|
||||
#include "serial.h"
|
||||
#include "TimerDemo.h"
|
||||
#include "IntQueue.h"
|
||||
#include "EventGroupsDemo.h"
|
||||
#include "TaskNotify.h"
|
||||
#include "IntSemTest.h"
|
||||
|
||||
/* Priorities for the demo application tasks. */
|
||||
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL )
|
||||
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2UL )
|
||||
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3UL )
|
||||
#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||
#define mainUART_COMMAND_CONSOLE_STACK_SIZE ( configMINIMAL_STACK_SIZE * 3UL )
|
||||
#define mainCOM_TEST_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||
#define mainQUEUE_OVERWRITE_PRIORITY ( tskIDLE_PRIORITY )
|
||||
#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY )
|
||||
|
||||
/* The priority used by the UART command console task. */
|
||||
#define mainUART_COMMAND_CONSOLE_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
|
||||
|
||||
/* The LED used by the check timer. */
|
||||
#define mainCHECK_LED ( 7 )
|
||||
|
||||
|
||||
/* A block time of zero simply means "don't block". */
|
||||
#define mainDONT_BLOCK ( 0UL )
|
||||
|
||||
/* 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
|
||||
equivalent in ticks using the portTICK_PERIOD_MS constant. */
|
||||
#define mainNO_ERROR_CHECK_TASK_PERIOD ( pdMS_TO_TICKS( 3000UL ) )
|
||||
|
||||
/* 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
|
||||
in ticks using the portTICK_PERIOD_MS constant. */
|
||||
#define mainERROR_CHECK_TASK_PERIOD ( pdMS_TO_TICKS( 200UL ) )
|
||||
|
||||
/* Parameters that are passed into the register check tasks solely for the
|
||||
purpose of ensuring parameters are passed into tasks correctly. */
|
||||
#define mainREG_TEST_TASK_1_PARAMETER ( ( void * ) 0x12345678 )
|
||||
#define mainREG_TEST_TASK_2_PARAMETER ( ( void * ) 0x87654321 )
|
||||
|
||||
/* The base period used by the timer test tasks. */
|
||||
#define mainTIMER_TEST_PERIOD ( 50 )
|
||||
|
||||
/* The number of timers to create that just flash LEDs. */
|
||||
#define mainNUM_FLASH_TIMERS ( 3 )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
||||
/*
|
||||
* The check task, as described at the top of this file.
|
||||
*/
|
||||
static void prvCheckTask( void *pvParameters );
|
||||
|
||||
/*
|
||||
* Register check tasks, and the tasks used to write over and check the contents
|
||||
* of the FPU registers, as described at the top of this file. The nature of
|
||||
* these files necessitates that they are written in an assembly file, but the
|
||||
* entry points are kept in the C file for the convenience of checking the task
|
||||
* parameter.
|
||||
*/
|
||||
static void prvRegTestTaskEntry1( void *pvParameters );
|
||||
extern void vRegTest1Implementation( void );
|
||||
static void prvRegTestTaskEntry2( void *pvParameters );
|
||||
extern void vRegTest2Implementation( void );
|
||||
|
||||
/*
|
||||
* Register commands that can be used with FreeRTOS+CLI. The commands are
|
||||
* defined in CLI-Commands.c and File-Related-CLI-Command.c respectively.
|
||||
*/
|
||||
extern void vRegisterSampleCLICommands( void );
|
||||
|
||||
/*
|
||||
* The task that manages the FreeRTOS+CLI input and output.
|
||||
*/
|
||||
extern void vUARTCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority );
|
||||
|
||||
/*
|
||||
* When the full demo is build the tick hook it used to demonstrate API
|
||||
* functions being called from an interrupt and to perform some tests.
|
||||
*/
|
||||
void vFullDemoTickHook( void );
|
||||
|
||||
/*
|
||||
* When the full demo is build the idle hook is used to create some timers that
|
||||
* cannot be created in main() because the timer demo tasks need the entire
|
||||
* command queue.
|
||||
*/
|
||||
void vFullDemoIdleHook( void );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The following two variables are used to communicate the status of the
|
||||
register check tasks to the check task. If the variables keep incrementing,
|
||||
then the register check tasks has not discovered any errors. If a variable
|
||||
stops incrementing, then an error has been found. */
|
||||
volatile unsigned long ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void main_full( void )
|
||||
{
|
||||
/* Start all the other standard demo/test tasks. They have not particular
|
||||
functionality, but do demonstrate how to use the FreeRTOS API and test the
|
||||
kernel port. */
|
||||
// vStartInterruptQueueTasks();
|
||||
|
||||
vStartDynamicPriorityTasks();
|
||||
vCreateBlockTimeTasks();
|
||||
vStartCountingSemaphoreTasks();
|
||||
vStartGenericQueueTasks( tskIDLE_PRIORITY );
|
||||
vStartRecursiveMutexTasks();
|
||||
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
||||
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
|
||||
vStartEventGroupTasks();
|
||||
vStartTaskNotifyTask();
|
||||
vStartInterruptSemaphoreTasks();
|
||||
|
||||
/* Note - the set of standard demo tasks contains two versions of
|
||||
vStartMathTasks.c. One is defined in flop.c, and uses double precision
|
||||
floating point numbers and variables. The other is defined in sp_flop.c,
|
||||
and uses single precision floating point numbers and variables. The
|
||||
MicroBlaze floating point unit only handles single precision floating.
|
||||
Therefore, to test the floating point hardware, sp_flop.c should be included
|
||||
in this project. */
|
||||
vStartMathTasks( mainFLOP_TASK_PRIORITY );
|
||||
|
||||
/* Start the tasks that implements the command console on the UART, as
|
||||
described above. */
|
||||
vUARTCommandConsoleStart( mainUART_COMMAND_CONSOLE_STACK_SIZE, mainUART_COMMAND_CONSOLE_TASK_PRIORITY );
|
||||
|
||||
/* Register the standard CLI commands. */
|
||||
vRegisterSampleCLICommands();
|
||||
|
||||
/* Create the register check tasks, as described at the top of this file */
|
||||
xTaskCreate( prvRegTestTaskEntry1, "Reg1", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_1_PARAMETER, tskIDLE_PRIORITY, NULL );
|
||||
xTaskCreate( prvRegTestTaskEntry2, "Reg2", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL );
|
||||
|
||||
/* Create the task that performs the 'check' functionality, as described at
|
||||
the top of this file. */
|
||||
xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||
|
||||
/* Start the scheduler. */
|
||||
vTaskStartScheduler();
|
||||
|
||||
/* If all is well, the scheduler will now be running, and the following
|
||||
line will never be reached. If the following line does execute, then
|
||||
there was either insufficient FreeRTOS heap memory available for the idle
|
||||
and/or timer tasks to be created, or vTaskStartScheduler() was called from
|
||||
User mode. See the memory management section on the FreeRTOS web site for
|
||||
more details on the FreeRTOS heap http://www.freertos.org/a00111.html. The
|
||||
mode from which main() is called is set in the C start up code and must be
|
||||
a privileged mode (not user mode). */
|
||||
for( ;; );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvCheckTask( void *pvParameters )
|
||||
{
|
||||
TickType_t xDelayPeriod = mainNO_ERROR_CHECK_TASK_PERIOD;
|
||||
TickType_t xLastExecutionTime;
|
||||
static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0;
|
||||
unsigned long ulErrorFound = pdFALSE;
|
||||
|
||||
/* Just to stop compiler warnings. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
|
||||
works correctly. */
|
||||
xLastExecutionTime = xTaskGetTickCount();
|
||||
|
||||
/* Cycle for ever, delaying then checking all the other tasks are still
|
||||
operating without error. The onboard LED is toggled on each iteration.
|
||||
If an error is detected then the delay period is decreased from
|
||||
mainNO_ERROR_CHECK_TASK_PERIOD to mainERROR_CHECK_TASK_PERIOD. This has the
|
||||
effect of increasing the rate at which the onboard LED toggles, and in so
|
||||
doing gives visual feedback of the system status. */
|
||||
for( ;; )
|
||||
{
|
||||
/* Delay until it is time to execute again. */
|
||||
vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );
|
||||
|
||||
/* Check all the demo tasks (other than the flash tasks) to ensure
|
||||
that they are all still running, and that none have detected an error. */
|
||||
if( 0 )// if( xAreIntQueueTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorFound |= 1UL << 0UL;
|
||||
}
|
||||
|
||||
if( xAreMathsTaskStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorFound |= 1UL << 1UL;
|
||||
}
|
||||
|
||||
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorFound |= 1UL << 2UL;
|
||||
}
|
||||
|
||||
if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorFound |= 1UL << 4UL;
|
||||
}
|
||||
|
||||
if ( xAreGenericQueueTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorFound |= 1UL << 5UL;
|
||||
}
|
||||
|
||||
if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorFound |= 1UL << 6UL;
|
||||
}
|
||||
|
||||
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorFound |= 1UL << 8UL;
|
||||
}
|
||||
|
||||
if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorFound |= 1UL << 10UL;
|
||||
}
|
||||
|
||||
if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorFound |= 1UL << 14UL;
|
||||
}
|
||||
|
||||
if( xAreTimerDemoTasksStillRunning( ( TickType_t ) mainNO_ERROR_CHECK_TASK_PERIOD ) != pdPASS )
|
||||
{
|
||||
ulErrorFound |= 1UL << 9UL;
|
||||
}
|
||||
|
||||
if( xAreEventGroupTasksStillRunning() != pdPASS )
|
||||
{
|
||||
ulErrorFound |= 1UL << 12UL;
|
||||
}
|
||||
|
||||
if( xAreTaskNotificationTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorFound |= 1UL << 13UL;
|
||||
}
|
||||
|
||||
/* Check that the register test 1 task is still running. */
|
||||
if( ulLastRegTest1Value == ulRegTest1LoopCounter )
|
||||
{
|
||||
ulErrorFound |= 1UL << 15UL;
|
||||
}
|
||||
ulLastRegTest1Value = ulRegTest1LoopCounter;
|
||||
|
||||
/* Check that the register test 2 task is still running. */
|
||||
if( ulLastRegTest2Value == ulRegTest2LoopCounter )
|
||||
{
|
||||
ulErrorFound |= 1UL << 16UL;
|
||||
}
|
||||
ulLastRegTest2Value = ulRegTest2LoopCounter;
|
||||
|
||||
/* Toggle the check LED to give an indication of the system status. If
|
||||
the LED toggles every mainNO_ERROR_CHECK_TASK_PERIOD milliseconds then
|
||||
everything is ok. A faster toggle indicates an error. */
|
||||
vParTestToggleLED( mainCHECK_LED );
|
||||
|
||||
if( ulErrorFound != pdFALSE )
|
||||
{
|
||||
/* An error has been detected in one of the tasks - flash the LED
|
||||
at a higher frequency to give visible feedback that something has
|
||||
gone wrong (it might just be that the loop back connector required
|
||||
by the comtest tasks has not been fitted). */
|
||||
xDelayPeriod = mainERROR_CHECK_TASK_PERIOD;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvRegTestTaskEntry1( void *pvParameters )
|
||||
{
|
||||
/* Although the regtest task is written in assembler, its entry point is
|
||||
written in C for convenience of checking the task parameter is being passed
|
||||
in correctly. */
|
||||
if( pvParameters == mainREG_TEST_TASK_1_PARAMETER )
|
||||
{
|
||||
/* Start the part of the test that is written in assembler. */
|
||||
vRegTest1Implementation();
|
||||
}
|
||||
|
||||
/* The following line will only execute if the task parameter is found to
|
||||
be incorrect. The check timer will detect that the regtest loop counter is
|
||||
not being incremented and flag an error. */
|
||||
vTaskDelete( NULL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvRegTestTaskEntry2( void *pvParameters )
|
||||
{
|
||||
/* Although the regtest task is written in assembler, its entry point is
|
||||
written in C for convenience of checking the task parameter is being passed
|
||||
in correctly. */
|
||||
if( pvParameters == mainREG_TEST_TASK_2_PARAMETER )
|
||||
{
|
||||
/* Start the part of the test that is written in assembler. */
|
||||
vRegTest2Implementation();
|
||||
}
|
||||
|
||||
/* The following line will only execute if the task parameter is found to
|
||||
be incorrect. The check timer will detect that the regtest loop counter is
|
||||
not being incremented and flag an error. */
|
||||
vTaskDelete( NULL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vFullDemoTickHook( void )
|
||||
{
|
||||
/* The full demo includes a software timer demo/test that requires
|
||||
prodding periodically from the tick interrupt. */
|
||||
vTimerPeriodicISRTests();
|
||||
|
||||
/* Call the periodic event group from ISR demo. */
|
||||
vPeriodicEventGroupsProcessing();
|
||||
|
||||
/* Use task notifications from an interrupt. */
|
||||
xNotifyTaskFromISR();
|
||||
|
||||
/* Use mutexes from interrupts. */
|
||||
vInterruptSemaphorePeriodicTest();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vFullDemoIdleHook( void )
|
||||
{
|
||||
static uint32_t ulStartedTimers = pdFALSE;
|
||||
|
||||
if( ulStartedTimers == pdFALSE )
|
||||
{
|
||||
/* The flash timers are not created from main() as the timer demo needs
|
||||
the entire timer command queue in order to perform some tests. */
|
||||
vStartLEDFlashTimers( mainNUM_FLASH_TIMERS );
|
||||
ulStartedTimers = pdTRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue