Add prints for CI (#670)

* Add prints for CI markers

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
This commit is contained in:
Gaurav-Aggarwal-AWS 2021-07-28 10:44:52 -07:00 committed by GitHub
parent 5c9ab8dcce
commit 5f21507703
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 1008 additions and 1015 deletions

View file

@ -1,152 +1,155 @@
/* /*
FreeRTOS V202107.00 FreeRTOS V202107.00
All rights reserved All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
This file is part of the FreeRTOS distribution. This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception. Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
*************************************************************************** ***************************************************************************
>>! NOTE: The modification to the GPL is included to allow you to !<< >>! NOTE: The modification to the GPL is included to allow you to !<<
>>! distribute a combined work that includes FreeRTOS without being !<< >>! distribute a combined work that includes FreeRTOS without being !<<
>>! obliged to provide the source code for proprietary components !<< >>! obliged to provide the source code for proprietary components !<<
>>! outside of the FreeRTOS kernel. !<< >>! outside of the FreeRTOS kernel. !<<
*************************************************************************** ***************************************************************************
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. Full license text is available on the following FOR A PARTICULAR PURPOSE. Full license text is available on the following
link: http://www.freertos.org/a00114.html link: http://www.freertos.org/a00114.html
*************************************************************************** ***************************************************************************
* * * *
* FreeRTOS provides completely free yet professionally developed, * * FreeRTOS provides completely free yet professionally developed, *
* robust, strictly quality controlled, supported, and cross * * robust, strictly quality controlled, supported, and cross *
* platform software that is more than just the market leader, it * * platform software that is more than just the market leader, it *
* is the industry's de facto standard. * * is the industry's de facto standard. *
* * * *
* Help yourself get started quickly while simultaneously helping * * Help yourself get started quickly while simultaneously helping *
* to support the FreeRTOS project by purchasing a FreeRTOS * * to support the FreeRTOS project by purchasing a FreeRTOS *
* tutorial book, reference manual, or both: * * tutorial book, reference manual, or both: *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *
* * * *
*************************************************************************** ***************************************************************************
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading 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 the FAQ page "My application does not run, what could be wrong?". Have you
defined configASSERT()? defined configASSERT()?
http://www.FreeRTOS.org/support - In return for receiving this top quality http://www.FreeRTOS.org/support - In return for receiving this top quality
embedded software for free we request you assist our global community by embedded software for free we request you assist our global community by
participating in the support forum. participating in the support forum.
http://www.FreeRTOS.org/training - Investing in training allows your team to 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 be as productive as possible as early as possible. Now you can receive
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
Ltd, and the world's leading authority on the world's leading RTOS. Ltd, and the world's leading authority on the world's leading RTOS.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, a DOS including FreeRTOS+Trace - an indispensable productivity tool, a DOS
compatible FAT file system, and our tiny thread aware UDP/IP stack. compatible FAT file system, and our tiny thread aware UDP/IP stack.
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate. 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. 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 http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
licenses offer ticketed support, indemnification and commercial middleware. licenses offer ticketed support, indemnification and commercial middleware.
http://www.SafeRTOS.com - High Integrity Systems also provide a safety http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability. mission critical applications that require provable dependability.
1 tab == 4 spaces! 1 tab == 4 spaces!
*/ */
#ifndef FREERTOS_CONFIG_H #ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H #define FREERTOS_CONFIG_H
#include "clock_config.h" #include "clock_config.h"
#include "fsl_debug_console.h"
/*-----------------------------------------------------------
* Application specific definitions. /*-----------------------------------------------------------
* * Application specific definitions.
* These definitions should be adjusted for your particular hardware and *
* application requirements. * These definitions should be adjusted for your particular hardware and
* * application requirements.
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE *
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
* See http://www.freertos.org/a00110.html. *
*----------------------------------------------------------*/ * See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/
/* See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html */
#define configMTIME_BASE_ADDRESS ( 0 ) /* See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html */
#define configMTIMECMP_BASE_ADDRESS ( 0 ) #define configMTIME_BASE_ADDRESS ( 0 )
#define configMTIMECMP_BASE_ADDRESS ( 0 )
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 1 #define configUSE_PREEMPTION 1
#define configUSE_TICK_HOOK 1 #define configUSE_IDLE_HOOK 1
#define configCPU_CLOCK_HZ BOARD_BOOTCLOCKRUN_CORE_CLOCK #define configUSE_TICK_HOOK 1
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 ) #define configCPU_CLOCK_HZ BOARD_BOOTCLOCKRUN_CORE_CLOCK
#define configMAX_PRIORITIES ( 5 ) #define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 200 ) /* Can be as low as 60 but some of the demo tasks that use this constant require it to be higher. */ #define configMAX_PRIORITIES ( 5 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 100 * 1024 ) ) #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 200 ) /* Can be as low as 60 but some of the demo tasks that use this constant require it to be higher. */
#define configMAX_TASK_NAME_LEN ( 16 ) #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 100 * 1024 ) )
#define configUSE_TRACE_FACILITY 0 #define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_16_BIT_TICKS 0 #define configUSE_TRACE_FACILITY 0
#define configIDLE_SHOULD_YIELD 0 #define configUSE_16_BIT_TICKS 0
#define configUSE_MUTEXES 1 #define configIDLE_SHOULD_YIELD 0
#define configQUEUE_REGISTRY_SIZE 8 #define configUSE_MUTEXES 1
#define configCHECK_FOR_STACK_OVERFLOW 2 #define configQUEUE_REGISTRY_SIZE 8
#define configUSE_RECURSIVE_MUTEXES 1 #define configCHECK_FOR_STACK_OVERFLOW 2
#define configUSE_MALLOC_FAILED_HOOK 1 #define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_APPLICATION_TASK_TAG 0 #define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_COUNTING_SEMAPHORES 1 #define configUSE_APPLICATION_TASK_TAG 0
#define configGENERATE_RUN_TIME_STATS 0 #define configUSE_COUNTING_SEMAPHORES 1
#define configGENERATE_RUN_TIME_STATS 0
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0 /* Co-routine definitions. */
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) #define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Software timer definitions. */
#define configUSE_TIMERS 1 /* Software timer definitions. */
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) #define configUSE_TIMERS 1
#define configTIMER_QUEUE_LENGTH 4 #define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE ) #define configTIMER_QUEUE_LENGTH 4
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
/* Task priorities. Allow these to be overridden. */
#ifndef uartPRIMARY_PRIORITY /* Task priorities. Allow these to be overridden. */
#define uartPRIMARY_PRIORITY ( configMAX_PRIORITIES - 3 ) #ifndef uartPRIMARY_PRIORITY
#endif #define uartPRIMARY_PRIORITY ( configMAX_PRIORITIES - 3 )
#endif
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */ /* Set the following definitions to 1 to include the API function, or zero
#define INCLUDE_vTaskPrioritySet 1 to exclude the API function. */
#define INCLUDE_uxTaskPriorityGet 1 #define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_vTaskDelete 1 #define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskCleanUpResources 1 #define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskSuspend 1 #define INCLUDE_vTaskCleanUpResources 1
#define INCLUDE_vTaskDelayUntil 1 #define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelay 1 #define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_eTaskGetState 1 #define INCLUDE_vTaskDelay 1
#define INCLUDE_xTimerPendFunctionCall 1 #define INCLUDE_eTaskGetState 1
#define INCLUDE_xTaskAbortDelay 1 #define INCLUDE_xTimerPendFunctionCall 1
#define INCLUDE_xTaskGetHandle 1 #define INCLUDE_xTaskAbortDelay 1
#define INCLUDE_xSemaphoreGetMutexHolder 1 #define INCLUDE_xTaskGetHandle 1
#define INCLUDE_xSemaphoreGetMutexHolder 1
/* Normal assert() semantics without relying on the provision of an assert.h
header file. */ /* Normal assert() semantics without relying on the provision of an assert.h
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); __asm volatile( "ebreak" ); for( ;; ); } header file. */
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); __asm volatile( "ebreak" ); for( ;; ); }
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
#define configKERNEL_INTERRUPT_PRIORITY 7 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
#define configKERNEL_INTERRUPT_PRIORITY 7
#endif /* FREERTOS_CONFIG_H */ /* Map to the platform printf function. */
#define configPRINT_STRING( pcString ) PRINTF( pcString )
#endif /* FREERTOS_CONFIG_H */

View file

@ -1,206 +1,205 @@
/* /*
* FreeRTOS V202107.00 * FreeRTOS V202107.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to * the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so, * the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions: * subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in all * The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. * copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* *
* http://www.FreeRTOS.org * http://www.FreeRTOS.org
* http://aws.amazon.com/freertos * http://aws.amazon.com/freertos
* *
* 1 tab == 4 spaces! * 1 tab == 4 spaces!
*/ */
/****************************************************************************** /******************************************************************************
* NOTE 1: This project provides two demo applications. A simple blinky * NOTE 1: This project provides two demo applications. A simple blinky
* style project, and a more comprehensive test and demo application. The * style project, and a more comprehensive test and demo application. The
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select
* between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY * between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
* in main.c. This file implements the simply blinky style version. * in main.c. This file implements the simply blinky style version.
* *
* NOTE 2: This file only contains the source code that is specific to the * NOTE 2: This file only contains the source code that is specific to the
* basic demo. Generic functions, such FreeRTOS hook functions, and functions * basic demo. Generic functions, such FreeRTOS hook functions, and functions
* required to configure the hardware are defined in main.c. * required to configure the hardware are defined in main.c.
****************************************************************************** ******************************************************************************
* *
* main_blinky() creates one queue, and two tasks. It then starts the * main_blinky() creates one queue, and two tasks. It then starts the
* scheduler. * scheduler.
* *
* The Queue Send Task: * The Queue Send Task:
* The queue send task is implemented by the prvQueueSendTask() function in * The queue send task is implemented by the prvQueueSendTask() function in
* this file. prvQueueSendTask() sits in a loop that causes it to repeatedly * this file. prvQueueSendTask() sits in a loop that causes it to repeatedly
* block for 1000 milliseconds, before sending the value 100 to the queue that * block for 1000 milliseconds, before sending the value 100 to the queue that
* was created within main_blinky(). Once the value is sent, the task loops * was created within main_blinky(). Once the value is sent, the task loops
* back around to block for another 1000 milliseconds...and so on. * back around to block for another 1000 milliseconds...and so on.
* *
* The Queue Receive Task: * The Queue Receive Task:
* The queue receive task is implemented by the prvQueueReceiveTask() function * The queue receive task is implemented by the prvQueueReceiveTask() function
* in this file. prvQueueReceiveTask() sits in a loop where it repeatedly * in this file. prvQueueReceiveTask() sits in a loop where it repeatedly
* blocks on attempts to read data from the queue that was created within * blocks on attempts to read data from the queue that was created within
* main_blinky(). When data is received, the task checks the value of the * main_blinky(). When data is received, the task checks the value of the
* data, and if the value equals the expected 100, writes 'Blink' to the UART * data, and if the value equals the expected 100, writes 'Blink' to the UART
* (the UART is used in place of the LED to allow easy execution in QEMU). The * (the UART is used in place of the LED to allow easy execution in QEMU). The
* 'block time' parameter passed to the queue receive function specifies that * 'block time' parameter passed to the queue receive function specifies that
* the task should be held in the Blocked state indefinitely to wait for data to * the task should be held in the Blocked state indefinitely to wait for data to
* be available on the queue. The queue receive task will only leave the * be available on the queue. The queue receive task will only leave the
* Blocked state when the queue send task writes to the queue. As the queue * Blocked state when the queue send task writes to the queue. As the queue
* send task writes to the queue every 1000 milliseconds, the queue receive * send task writes to the queue every 1000 milliseconds, the queue receive
* task leaves the Blocked state every 1000 milliseconds, and therefore toggles * task leaves the Blocked state every 1000 milliseconds, and therefore toggles
* the LED every 200 milliseconds. * the LED every 200 milliseconds.
*/ */
/* Standard includes. */ /* Standard includes. */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
/* Kernel includes. */ /* Kernel includes. */
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "task.h" #include "task.h"
#include "queue.h" #include "queue.h"
/* Priorities used by the tasks. */ /* Priorities used by the tasks. */
#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) #define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) #define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
/* The rate at which data is sent to the queue. The 200ms value is converted /* The rate at which data is sent to the queue. The 200ms value is converted
to ticks using the pdMS_TO_TICKS() macro. */ to ticks using the pdMS_TO_TICKS() macro. */
#define mainQUEUE_SEND_FREQUENCY_MS pdMS_TO_TICKS( 1000 ) #define mainQUEUE_SEND_FREQUENCY_MS pdMS_TO_TICKS( 1000 )
/* The maximum number items the queue can hold. The priority of the receiving /* The maximum number items the queue can hold. The priority of the receiving
task is above the priority of the sending task, so the receiving task will task is above the priority of the sending task, so the receiving task will
preempt the sending task and remove the queue items each time the sending task preempt the sending task and remove the queue items each time the sending task
writes to the queue. Therefore the queue will never have more than one item in writes to the queue. Therefore the queue will never have more than one item in
it at any time, and even with a queue length of 1, the sending task will never it at any time, and even with a queue length of 1, the sending task will never
find the queue full. */ find the queue full. */
#define mainQUEUE_LENGTH ( 1 ) #define mainQUEUE_LENGTH ( 1 )
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* /*
* Called by main when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1 in * Called by main when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1 in
* main.c. * main.c.
*/ */
void main_blinky( void ); void main_blinky( void );
/* /*
* The tasks as described in the comments at the top of this file. * The tasks as described in the comments at the top of this file.
*/ */
static void prvQueueReceiveTask( void *pvParameters ); static void prvQueueReceiveTask( void *pvParameters );
static void prvQueueSendTask( void *pvParameters ); static void prvQueueSendTask( void *pvParameters );
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* The queue used by both tasks. */ /* The queue used by both tasks. */
static QueueHandle_t xQueue = NULL; static QueueHandle_t xQueue = NULL;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void main_blinky( void ) void main_blinky( void )
{ {
/* Create the queue. */ /* Create the queue. */
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );
if( xQueue != NULL ) if( xQueue != NULL )
{ {
/* Start the two tasks as described in the comments at the top of this /* Start the two tasks as described in the comments at the top of this
file. */ file. */
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */ xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */ "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
configMINIMAL_STACK_SIZE * 2U, /* The size of the stack to allocate to the task. */ configMINIMAL_STACK_SIZE * 2U, /* The size of the stack to allocate to the task. */
NULL, /* The parameter passed to the task - not used in this case. */ NULL, /* The parameter passed to the task - not used in this case. */
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
NULL ); /* The task handle is not required, so NULL is passed. */ NULL ); /* The task handle is not required, so NULL is passed. */
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE * 2U, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE * 2U, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
/* Start the tasks and timer running. */ /* Start the tasks and timer running. */
vTaskStartScheduler(); vTaskStartScheduler();
} }
/* If all is well, the scheduler will now be running, and the following /* 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 line will never be reached. If the following line does execute, then
there was insufficient FreeRTOS heap memory available for the Idle and/or there was insufficient FreeRTOS heap memory available for the Idle and/or
timer tasks to be created. See the memory management section on the timer tasks to be created. See the memory management section on the
FreeRTOS web site for more details on the FreeRTOS heap FreeRTOS web site for more details on the FreeRTOS heap
http://www.freertos.org/a00111.html. */ http://www.freertos.org/a00111.html. */
for( ;; ); for( ;; );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvQueueSendTask( void *pvParameters ) static void prvQueueSendTask( void *pvParameters )
{ {
TickType_t xNextWakeTime; TickType_t xNextWakeTime;
const unsigned long ulValueToSend = 100UL; const unsigned long ulValueToSend = 100UL;
BaseType_t xReturned; BaseType_t xReturned;
/* Remove compiler warning about unused parameter. */ /* Remove compiler warning about unused parameter. */
( void ) pvParameters; ( void ) pvParameters;
/* Initialise xNextWakeTime - this only needs to be done once. */ /* Initialise xNextWakeTime - this only needs to be done once. */
xNextWakeTime = xTaskGetTickCount(); xNextWakeTime = xTaskGetTickCount();
for( ;; ) for( ;; )
{ {
/* Place this task in the blocked state until it is time to run again. */ /* Place this task in the blocked state until it is time to run again. */
vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );
/* Send to the queue - causing the queue receive task to unblock and /* Send to the queue - causing the queue receive task to unblock and
toggle the LED. 0 is used as the block time so the sending operation toggle the LED. 0 is used as the block time so the sending operation
will not block - it shouldn't need to block as the queue should always will not block - it shouldn't need to block as the queue should always
be empty at this point in the code. */ be empty at this point in the code. */
xReturned = xQueueSend( xQueue, &ulValueToSend, 0U ); xReturned = xQueueSend( xQueue, &ulValueToSend, 0U );
configASSERT( xReturned == pdPASS ); configASSERT( xReturned == pdPASS );
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvQueueReceiveTask( void *pvParameters ) static void prvQueueReceiveTask( void *pvParameters )
{ {
unsigned long ulReceivedValue; unsigned long ulReceivedValue;
const unsigned long ulExpectedValue = 100UL; const unsigned long ulExpectedValue = 100UL;
const char * const pcPassMessage = "Blink\r\n"; const char * const pcPassMessage = "Blink\r\n";
const char * const pcFailMessage = "Unexpected value received\r\n"; const char * const pcFailMessage = "Unexpected value received\r\n";
extern void vSendString( const char * const pcString ); extern void vToggleLED( void );
extern void vToggleLED( void );
/* Remove compiler warning about unused parameter. */
/* Remove compiler warning about unused parameter. */ ( void ) pvParameters;
( void ) pvParameters;
for( ;; )
for( ;; ) {
{ /* Wait until something arrives in the queue - this task will block
/* Wait until something arrives in the queue - this task will block indefinitely provided INCLUDE_vTaskSuspend is set to 1 in
indefinitely provided INCLUDE_vTaskSuspend is set to 1 in FreeRTOSConfig.h. */
FreeRTOSConfig.h. */ xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
/* To get here something must have been received from the queue, but
/* To get here something must have been received from the queue, but is it the expected value? If it is, toggle the LED. */
is it the expected value? If it is, toggle the LED. */ if( ulReceivedValue == ulExpectedValue )
if( ulReceivedValue == ulExpectedValue ) {
{ configPRINT_STRING( pcPassMessage );
vSendString( pcPassMessage ); vToggleLED();
vToggleLED(); ulReceivedValue = 0U;
ulReceivedValue = 0U; }
} else
else {
{ configPRINT_STRING( pcFailMessage );
vSendString( pcFailMessage ); }
} }
} }
} /*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/

View file

@ -1,407 +1,407 @@
/* /*
* FreeRTOS V202107.00 * FreeRTOS V202107.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to * the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so, * the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions: * subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in all * The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. * copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* *
* http://www.FreeRTOS.org * http://www.FreeRTOS.org
* http://aws.amazon.com/freertos * http://aws.amazon.com/freertos
* *
* 1 tab == 4 spaces! * 1 tab == 4 spaces!
*/ */
/****************************************************************************** /******************************************************************************
* NOTE 1: This project provides two demo applications. A simple blinky style * NOTE 1: This project provides two demo applications. A simple blinky style
* project, and a more comprehensive test and demo application. The * project, and a more comprehensive test and demo application. The
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select
* between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY * between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
* in main.c. This file implements the comprehensive test and demo version. * in main.c. This file implements the comprehensive test and demo version.
* *
* NOTE 2: This file only contains the source code that is specific to the * NOTE 2: This file only contains the source code that is specific to the
* full demo. Generic functions, such FreeRTOS hook functions, and functions * full demo. Generic functions, such FreeRTOS hook functions, and functions
* required to configure the hardware, are defined in main.c. * required to configure the hardware, are defined in main.c.
* *
****************************************************************************** ******************************************************************************
* *
* main_full() creates all the demo application tasks and software timers, then * main_full() creates all the demo application tasks and software timers, then
* starts the scheduler. The web documentation provides more details of the * starts the scheduler. The web documentation provides more details of the
* standard demo application tasks, which provide no particular functionality, * standard demo application tasks, which provide no particular functionality,
* but do provide a good example of how to use the FreeRTOS API. * 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 * In addition to the standard demo tasks, the following tasks and tests are
* defined and/or created within this file: * defined and/or created within this file:
* *
* "Reg test" tasks - These fill both the core registers with known values, then * "Reg test" tasks - These fill both the core registers with known values, then
* check that each register maintains its expected value for the lifetime of the * 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 * 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 * with a very low priority, so get preempted very frequently. A register
* containing an unexpected value is indicative of an error in the context * containing an unexpected value is indicative of an error in the context
* switching mechanism. * switching mechanism.
* *
* "Check" task - The check executes every three seconds. It checks that all * "Check" task - The check executes every three seconds. It checks that all
* the standard demo tasks, and the register check tasks, are not only still * 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 * 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 * discovers that a task has either stalled, or reported an error, then it
* prints an error message to the UART, otherwise it prints "Pass.". * prints an error message to the UART, otherwise it prints "Pass.".
*/ */
/* Standard includes. */ /* Standard includes. */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
/* Kernel includes. */ /* Kernel includes. */
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "task.h" #include "task.h"
#include "timers.h" #include "timers.h"
#include "semphr.h" #include "semphr.h"
/* Standard demo application includes. */ /* Standard demo application includes. */
#include "dynamic.h" #include "dynamic.h"
#include "blocktim.h" #include "blocktim.h"
#include "GenQTest.h" #include "GenQTest.h"
#include "recmutex.h" #include "recmutex.h"
#include "TimerDemo.h" #include "TimerDemo.h"
#include "EventGroupsDemo.h" #include "EventGroupsDemo.h"
#include "TaskNotify.h" #include "TaskNotify.h"
#include "AbortDelay.h" #include "AbortDelay.h"
#include "countsem.h" #include "countsem.h"
#include "death.h" #include "death.h"
#include "MessageBufferDemo.h" #include "MessageBufferDemo.h"
#include "StreamBufferDemo.h" #include "StreamBufferDemo.h"
#include "StreamBufferInterrupt.h" #include "StreamBufferInterrupt.h"
/* Priorities for the demo application tasks. */ /* Priorities for the demo application tasks. */
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) #define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3UL ) #define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3UL )
/* The period of the check task, in ms, converted to ticks using the /* The period of the check task, in ms, converted to ticks using the
pdMS_TO_TICKS() macro. mainNO_ERROR_CHECK_TASK_PERIOD is used if no errors have pdMS_TO_TICKS() macro. mainNO_ERROR_CHECK_TASK_PERIOD is used if no errors have
been found, mainERROR_CHECK_TASK_PERIOD is used if an error has been found. */ been found, mainERROR_CHECK_TASK_PERIOD is used if an error has been found. */
#define mainNO_ERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 3000UL ) #define mainNO_ERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 3000UL )
#define mainERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 500UL ) #define mainERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 500UL )
/* Parameters that are passed into the register check tasks solely for the /* Parameters that are passed into the register check tasks solely for the
purpose of ensuring parameters are passed into tasks correctly. */ purpose of ensuring parameters are passed into tasks correctly. */
#define mainREG_TEST_TASK_1_PARAMETER ( ( void * ) 0x12345678 ) #define mainREG_TEST_TASK_1_PARAMETER ( ( void * ) 0x12345678 )
#define mainREG_TEST_TASK_2_PARAMETER ( ( void * ) 0x87654321 ) #define mainREG_TEST_TASK_2_PARAMETER ( ( void * ) 0x87654321 )
/* The base period used by the timer test tasks. */ /* The base period used by the timer test tasks. */
#define mainTIMER_TEST_PERIOD ( 50 ) #define mainTIMER_TEST_PERIOD ( 50 )
/* The size of the stack allocated to the check task (as described in the /* The size of the stack allocated to the check task (as described in the
comments at the top of this file. This is surprisingly large as it calls comments at the top of this file. This is surprisingly large as it calls
the logging library's print function, which allocates a 128 byte buffer on its the logging library's print function, which allocates a 128 byte buffer on its
stack. */ stack. */
#define mainCHECK_TASK_STACK_SIZE_WORDS 200 #define mainCHECK_TASK_STACK_SIZE_WORDS 200
/* Size of the stacks to allocated for the register check tasks. */ /* Size of the stacks to allocated for the register check tasks. */
#define mainREG_TEST_STACK_SIZE_WORDS 150 #define mainREG_TEST_STACK_SIZE_WORDS 150
/*-----------------------------------------------------------*/ /* Success output messages. This is used by the CI - do not change. */
#define mainDEMO_SUCCESS_MESSAGE "FreeRTOS Demo SUCCESS\r\n"
/* /*-----------------------------------------------------------*/
* Called by main() to run the full demo (as opposed to the blinky demo) when
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0. /*
*/ * Called by main() to run the full demo (as opposed to the blinky demo) when
void main_full( void ); * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.
*/
/* void main_full( void );
* The check task, as described at the top of this file.
*/ /*
static void prvCheckTask( void *pvParameters ); * The check task, as described at the top of this file.
*/
/* static void prvCheckTask( void *pvParameters );
* Initialise and start the peripheral timers that are used to exercise external
* interrupt processing. /*
*/ * Initialise and start the peripheral timers that are used to exercise external
static void prvSetupPeripheralTimers( void ); * interrupt processing.
*/
/* static void prvSetupPeripheralTimers( void );
* Register check tasks 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 * Register check tasks as described at the top of this file. The nature of
* parameter. * 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
static void prvRegTestTaskEntry1( void *pvParameters ); * parameter.
extern void vRegTest1Implementation( void ); */
static void prvRegTestTaskEntry2( void *pvParameters ); static void prvRegTestTaskEntry1( void *pvParameters );
extern void vRegTest2Implementation( void ); extern void vRegTest1Implementation( void );
static void prvRegTestTaskEntry2( void *pvParameters );
/* extern void vRegTest2Implementation( void );
* Tick hook used by the full demo, which includes code that interacts with
* some of the tests. /*
*/ * Tick hook used by the full demo, which includes code that interacts with
void vFullDemoTickHook( void ); * some of the tests.
*/
/*-----------------------------------------------------------*/ void vFullDemoTickHook( 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 have not discovered any errors. If a variable /* The following two variables are used to communicate the status of the
stops incrementing, then an error has been found. */ register check tasks to the check task. If the variables keep incrementing,
volatile uint32_t ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL; then the register check tasks have not discovered any errors. If a variable
stops incrementing, then an error has been found. */
/*-----------------------------------------------------------*/ volatile uint32_t ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL;
void main_full( void ) /*-----------------------------------------------------------*/
{
/* Start all the other standard demo/test tasks. They have no particular void main_full( void )
functionality, but do demonstrate how to use the FreeRTOS API and test the {
kernel port. */ /* Start all the other standard demo/test tasks. They have no particular
vStartDynamicPriorityTasks(); functionality, but do demonstrate how to use the FreeRTOS API and test the
vCreateBlockTimeTasks(); kernel port. */
vStartGenericQueueTasks( tskIDLE_PRIORITY ); vStartDynamicPriorityTasks();
vStartRecursiveMutexTasks(); vCreateBlockTimeTasks();
vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); vStartGenericQueueTasks( tskIDLE_PRIORITY );
vStartEventGroupTasks(); vStartRecursiveMutexTasks();
vStartTaskNotifyTask(); vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
vCreateAbortDelayTasks(); vStartEventGroupTasks();
vStartCountingSemaphoreTasks(); vStartTaskNotifyTask();
vStartMessageBufferTasks( configMINIMAL_STACK_SIZE ); vCreateAbortDelayTasks();
vStartStreamBufferTasks(); vStartCountingSemaphoreTasks();
vStartStreamBufferInterruptDemo(); vStartMessageBufferTasks( configMINIMAL_STACK_SIZE );
vStartStreamBufferTasks();
/* Create the register check tasks, as described at the top of this file. vStartStreamBufferInterruptDemo();
Use xTaskCreateStatic() to create a task using only statically allocated
memory. */ /* Create the register check tasks, as described at the top of this file.
xTaskCreate( prvRegTestTaskEntry1, /* The function that implements the task. */ Use xTaskCreateStatic() to create a task using only statically allocated
"Reg1", /* The name of the task. */ memory. */
mainREG_TEST_STACK_SIZE_WORDS, /* Size of stack to allocate for the task - in words not bytes!. */ xTaskCreate( prvRegTestTaskEntry1, /* The function that implements the task. */
mainREG_TEST_TASK_1_PARAMETER, /* Parameter passed into the task. */ "Reg1", /* The name of the task. */
tskIDLE_PRIORITY, /* Priority of the task. */ mainREG_TEST_STACK_SIZE_WORDS, /* Size of stack to allocate for the task - in words not bytes!. */
NULL ); /* Can be used to pass out a handle to the created task. */ mainREG_TEST_TASK_1_PARAMETER, /* Parameter passed into the task. */
xTaskCreate( prvRegTestTaskEntry2, "Reg2", mainREG_TEST_STACK_SIZE_WORDS, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL ); tskIDLE_PRIORITY, /* Priority of the task. */
NULL ); /* Can be used to pass out a handle to the created task. */
/* Create the task that performs the 'check' functionality, as described at xTaskCreate( prvRegTestTaskEntry2, "Reg2", mainREG_TEST_STACK_SIZE_WORDS, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL );
the top of this file. */
xTaskCreate( prvCheckTask, "Check", mainCHECK_TASK_STACK_SIZE_WORDS, NULL, mainCHECK_TASK_PRIORITY, NULL ); /* Create the task that performs the 'check' functionality, as described at
the top of this file. */
/* The set of tasks created by the following function call have to be xTaskCreate( prvCheckTask, "Check", mainCHECK_TASK_STACK_SIZE_WORDS, NULL, mainCHECK_TASK_PRIORITY, NULL );
created last as they keep account of the number of tasks they expect to see
running. */ /* The set of tasks created by the following function call have to be
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); created last as they keep account of the number of tasks they expect to see
running. */
/* Start the timers that are used to exercise external interrupt handling. */ vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
prvSetupPeripheralTimers();
/* Start the timers that are used to exercise external interrupt handling. */
/* Start the scheduler. */ prvSetupPeripheralTimers();
vTaskStartScheduler();
/* Start the scheduler. */
/* If all is well, the scheduler will now be running, and the following vTaskStartScheduler();
line will never be reached. If the following line does execute, then
there was insufficient FreeRTOS heap memory available for the Idle and/or /* If all is well, the scheduler will now be running, and the following
timer tasks to be created. See the memory management section on the line will never be reached. If the following line does execute, then
FreeRTOS web site for more details on the FreeRTOS heap there was insufficient FreeRTOS heap memory available for the Idle and/or
http://www.freertos.org/a00111.html. */ timer tasks to be created. See the memory management section on the
for( ;; ); FreeRTOS web site for more details on the FreeRTOS heap
} http://www.freertos.org/a00111.html. */
/*-----------------------------------------------------------*/ for( ;; );
}
static void prvCheckTask( void *pvParameters ) /*-----------------------------------------------------------*/
{
TickType_t xDelayPeriod = mainNO_ERROR_CHECK_TASK_PERIOD; static void prvCheckTask( void *pvParameters )
TickType_t xLastExecutionTime; {
uint32_t ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; TickType_t xDelayPeriod = mainNO_ERROR_CHECK_TASK_PERIOD;
char * const pcPassMessage = "."; TickType_t xLastExecutionTime;
char * pcStatusMessage = pcPassMessage; uint32_t ulLastRegTest1Value = 0, ulLastRegTest2Value = 0;
extern void vSendString( const char * const pcString ); char * const pcPassMessage = mainDEMO_SUCCESS_MESSAGE;
extern void vToggleLED( void ); char * pcStatusMessage = pcPassMessage;
extern void vToggleLED( void );
/* Just to stop compiler warnings. */
( void ) pvParameters; /* Just to stop compiler warnings. */
( void ) pvParameters;
/* Output "pass", then an additional '.' character for each successful
loop. */ /* Demo start marker. */
vSendString( "Pass" ); configPRINT_STRING( "FreeRTOS Demo Start\r\n" );
/* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
works correctly. */ works correctly. */
xLastExecutionTime = xTaskGetTickCount(); xLastExecutionTime = xTaskGetTickCount();
/* Cycle for ever, delaying then checking all the other tasks are still /* Cycle for ever, delaying then checking all the other tasks are still
operating without error. The onboard LED is toggled on each iteration. operating without error. The onboard LED is toggled on each iteration.
If an error is detected then the delay period is decreased from 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 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 effect of increasing the rate at which the onboard LED toggles, and in so
doing gives visual feedback of the system status. */ doing gives visual feedback of the system status. */
for( ;; ) for( ;; )
{ {
/* Delay until it is time to execute again. */ /* Delay until it is time to execute again. */
vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod ); vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );
/* Check all the demo tasks (other than the flash tasks) to ensure /* 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. */ that they are all still running, and that none have detected an error. */
if( xAreDynamicPriorityTasksStillRunning() == pdFALSE ) if( xAreDynamicPriorityTasksStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Dynamic priority demo/tests.\r\n"; pcStatusMessage = "FreeRTOS Demo ERROR: Dynamic priority demo/tests.\r\n";
} }
if( xAreBlockTimeTestTasksStillRunning() == pdFALSE ) if( xAreBlockTimeTestTasksStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Block time demo/tests.\r\n"; pcStatusMessage = "FreeRTOS Demo ERROR: Block time demo/tests.\r\n";
} }
if( xAreGenericQueueTasksStillRunning() == pdFALSE ) if( xAreGenericQueueTasksStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Generic queue demo/tests.\r\n"; pcStatusMessage = "FreeRTOS Demo ERROR: Generic queue demo/tests.\r\n";
} }
if( xAreRecursiveMutexTasksStillRunning() == pdFALSE ) if( xAreRecursiveMutexTasksStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Recursive mutex demo/tests.\r\n"; pcStatusMessage = "FreeRTOS Demo ERROR: Recursive mutex demo/tests.\r\n";
} }
if( xAreTimerDemoTasksStillRunning( ( TickType_t ) xDelayPeriod ) == pdFALSE ) if( xAreTimerDemoTasksStillRunning( ( TickType_t ) xDelayPeriod ) == pdFALSE )
{ {
pcStatusMessage = "ERROR: Timer demo/tests.\r\n"; pcStatusMessage = "FreeRTOS Demo ERROR: Timer demo/tests.\r\n";
} }
if( xAreEventGroupTasksStillRunning() == pdFALSE ) if( xAreEventGroupTasksStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Event group demo/tests.\r\n"; pcStatusMessage = "FreeRTOS Demo ERROR: Event group demo/tests.\r\n";
} }
if( xAreTaskNotificationTasksStillRunning() == pdFALSE ) if( xAreTaskNotificationTasksStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Task notification demo/tests.\r\n"; pcStatusMessage = "FreeRTOS Demo ERROR: Task notification demo/tests.\r\n";
} }
if( xAreAbortDelayTestTasksStillRunning() == pdFALSE ) if( xAreAbortDelayTestTasksStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Abort delay.\r\n"; pcStatusMessage = "FreeRTOS Demo ERROR: Abort delay.\r\n";
} }
if( xAreCountingSemaphoreTasksStillRunning() == pdFALSE ) if( xAreCountingSemaphoreTasksStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Counting semaphores.\r\n"; pcStatusMessage = "FreeRTOS Demo ERROR: Counting semaphores.\r\n";
} }
if( xIsCreateTaskStillRunning() == pdFALSE ) if( xIsCreateTaskStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Suicide tasks.\r\n"; pcStatusMessage = "FreeRTOS Demo ERROR: Suicide tasks.\r\n";
} }
if( xAreMessageBufferTasksStillRunning() == pdFALSE ) if( xAreMessageBufferTasksStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Message buffer.\r\n"; pcStatusMessage = "FreeRTOS Demo ERROR: Message buffer.\r\n";
} }
if( xAreStreamBufferTasksStillRunning() == pdFALSE ) if( xAreStreamBufferTasksStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Stream buffer.\r\n"; pcStatusMessage = "FreeRTOS Demo ERROR: Stream buffer.\r\n";
} }
if( xIsInterruptStreamBufferDemoStillRunning() == pdFALSE ) if( xIsInterruptStreamBufferDemoStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Stream buffer interrupt.\r\n"; pcStatusMessage = "FreeRTOS Demo ERROR: Stream buffer interrupt.\r\n";
} }
/* 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 )
{ {
pcStatusMessage = "ERROR: Register test 1.\r\n"; pcStatusMessage = "FreeRTOS Demo ERROR: Register test 1.\r\n";
} }
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 )
{ {
pcStatusMessage = "ERROR: Register test 2.\r\n"; pcStatusMessage = "FreeRTOS Demo ERROR: Register test 2.\r\n";
} }
ulLastRegTest2Value = ulRegTest2LoopCounter; ulLastRegTest2Value = ulRegTest2LoopCounter;
/* Write the status message to the UART. */ /* Write the status message to the UART. */
vToggleLED(); vToggleLED();
vSendString( pcStatusMessage ); configPRINT_STRING( pcStatusMessage );
/* If an error has been found then increase the LED toggle rate by /* If an error has been found then increase the LED toggle rate by
increasing the cycle frequency. */ increasing the cycle frequency. */
if( pcStatusMessage != pcPassMessage ) if( pcStatusMessage != pcPassMessage )
{ {
xDelayPeriod = mainERROR_CHECK_TASK_PERIOD; xDelayPeriod = mainERROR_CHECK_TASK_PERIOD;
} }
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvRegTestTaskEntry1( void *pvParameters ) static void prvRegTestTaskEntry1( void *pvParameters )
{ {
/* Although the regtest task is written in assembler, its entry point is /* 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 written in C for convenience of checking the task parameter is being passed
in correctly. */ in correctly. */
if( pvParameters == mainREG_TEST_TASK_1_PARAMETER ) if( pvParameters == mainREG_TEST_TASK_1_PARAMETER )
{ {
/* Start the part of the test that is written in assembler. */ /* Start the part of the test that is written in assembler. */
vRegTest1Implementation(); vRegTest1Implementation();
} }
/* The following line will only execute if the task parameter is found to /* The following line will only execute if the task parameter is found to
be incorrect. The check task will detect that the regtest loop counter is be incorrect. The check task will detect that the regtest loop counter is
not being incremented and flag an error. */ not being incremented and flag an error. */
vTaskDelete( NULL ); vTaskDelete( NULL );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvRegTestTaskEntry2( void *pvParameters ) static void prvRegTestTaskEntry2( void *pvParameters )
{ {
/* Although the regtest task is written in assembler, its entry point is /* 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 written in C for convenience of checking the task parameter is being passed
in correctly. */ in correctly. */
if( pvParameters == mainREG_TEST_TASK_2_PARAMETER ) if( pvParameters == mainREG_TEST_TASK_2_PARAMETER )
{ {
/* Start the part of the test that is written in assembler. */ /* Start the part of the test that is written in assembler. */
vRegTest2Implementation(); vRegTest2Implementation();
} }
/* The following line will only execute if the task parameter is found to /* The following line will only execute if the task parameter is found to
be incorrect. The check task will detect that the regtest loop counter is be incorrect. The check task will detect that the regtest loop counter is
not being incremented and flag an error. */ not being incremented and flag an error. */
vTaskDelete( NULL ); vTaskDelete( NULL );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void vFullDemoTickHook( void ) void vFullDemoTickHook( void )
{ {
/* The full demo includes a software timer demo/test that requires /* The full demo includes a software timer demo/test that requires
prodding periodically from the tick interrupt. */ prodding periodically from the tick interrupt. */
vTimerPeriodicISRTests(); vTimerPeriodicISRTests();
/* Call the periodic event group from ISR demo. */ /* Call the periodic event group from ISR demo. */
vPeriodicEventGroupsProcessing(); vPeriodicEventGroupsProcessing();
/* Use task notifications from an interrupt. */ /* Use task notifications from an interrupt. */
xNotifyTaskFromISR(); xNotifyTaskFromISR();
/* Writes to stream buffer byte by byte to test the stream buffer trigger /* Writes to stream buffer byte by byte to test the stream buffer trigger
level functionality. */ level functionality. */
vPeriodicStreamBufferProcessing(); vPeriodicStreamBufferProcessing();
/* Writes a string to a string buffer four bytes at a time to demonstrate /* Writes a string to a string buffer four bytes at a time to demonstrate
a stream being sent from an interrupt to a task. */ a stream being sent from an interrupt to a task. */
vBasicStreamBufferSendFromISR(); vBasicStreamBufferSendFromISR();
/* Called from vApplicationTickHook() when the project is configured to /* Called from vApplicationTickHook() when the project is configured to
build the full test/demo applications. */ build the full test/demo applications. */
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvSetupPeripheralTimers( void ) static void prvSetupPeripheralTimers( void )
{ {
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -1,251 +1,242 @@
/* /*
* FreeRTOS V202107.00 * FreeRTOS V202107.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to * the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so, * the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions: * subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in all * The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. * copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* *
* https://www.FreeRTOS.org * https://www.FreeRTOS.org
* https://github.com/FreeRTOS * https://github.com/FreeRTOS
* *
*/ */
/* /*
* Create implementation of vPortSetupTimerInterrupt() if the CLINT is not * Create implementation of vPortSetupTimerInterrupt() if the CLINT is not
* available, but make sure the configCLINT_BASE_ADDRESS constant is still * available, but make sure the configCLINT_BASE_ADDRESS constant is still
* defined. * defined.
* *
* Define vPortHandleInterrupt to whatever the interrupt handler is called. In * Define vPortHandleInterrupt to whatever the interrupt handler is called. In
* this case done by defining vPortHandleInterrupt=SystemIrqHandler on the * this case done by defining vPortHandleInterrupt=SystemIrqHandler on the
* assembler command line as SystemIrqHandler is referenced from both FreeRTOS * assembler command line as SystemIrqHandler is referenced from both FreeRTOS
* code and the libraries that come with the Vega board. * code and the libraries that come with the Vega board.
*/ */
/* FreeRTOS kernel includes. */ /* FreeRTOS kernel includes. */
#include <FreeRTOS.h> #include <FreeRTOS.h>
#include <task.h> #include <task.h>
/* Vega includes. */ /* Vega includes. */
#include "fsl_device_registers.h" #include "fsl_device_registers.h"
#include "fsl_debug_console.h" #include "fsl_debug_console.h"
#include "board.h" #include "board.h"
#include "pin_mux.h" #include "pin_mux.h"
#include "clock_config.h" #include "clock_config.h"
/****************************************************************************** /******************************************************************************
* This project provides two demo applications. A simple blinky style project, * This project provides two demo applications. A simple blinky style project,
* and a more comprehensive test and demo application. The * and a more comprehensive test and demo application. The
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting (defined in this file) is used to * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting (defined in this file) is used to
* select between the two. The simply blinky demo is implemented and described * select between the two. The simply blinky demo is implemented and described
* in main_blinky.c. The more comprehensive test and demo application is * in main_blinky.c. The more comprehensive test and demo application is
* implemented and described in main_full.c. * implemented and described in main_full.c.
* *
* This file implements the code that is not demo specific, including the * This file implements the code that is not demo specific, including the
* hardware setup and standard FreeRTOS hook functions. * hardware setup and standard FreeRTOS hook functions.
* *
* ENSURE TO READ THE DOCUMENTATION PAGE FOR THIS PORT AND DEMO APPLICATION ON * ENSURE TO READ THE DOCUMENTATION PAGE FOR THIS PORT AND DEMO APPLICATION ON
* THE http://www.FreeRTOS.org WEB SITE FOR FULL INFORMATION ON USING THIS DEMO * THE http://www.FreeRTOS.org WEB SITE FOR FULL INFORMATION ON USING THIS DEMO
* APPLICATION, AND ITS ASSOCIATE FreeRTOS ARCHITECTURE PORT! * APPLICATION, AND ITS ASSOCIATE FreeRTOS ARCHITECTURE PORT!
* *
*/ */
/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo, /* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,
or 0 to run the more comprehensive test and demo application. */ or 0 to run the more comprehensive test and demo application. */
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 #define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0
/* /*
* 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.
* main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0. * main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.
*/ */
#if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1
extern void main_blinky( void ); extern void main_blinky( void );
#else #else
extern void main_full( void ); extern void main_full( void );
#endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */ #endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */
/* Prototypes for the standard FreeRTOS callback/hook functions implemented /* Prototypes for the standard FreeRTOS callback/hook functions implemented
within this file. See https://www.freertos.org/a00016.html */ within this file. See https://www.freertos.org/a00016.html */
void vApplicationMallocFailedHook( void ); void vApplicationMallocFailedHook( void );
void vApplicationIdleHook( void ); void vApplicationIdleHook( void );
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );
void vApplicationTickHook( void ); void vApplicationTickHook( void );
/* Prepare hardware to run the demo. */ /* Prepare hardware to run the demo. */
static void prvSetupHardware( void ); static void prvSetupHardware( void );
/* Send a message to the UART initialised in prvSetupHardware. */ /*-----------------------------------------------------------*/
void vSendString( const char * const pcString );
void main( void )
/*-----------------------------------------------------------*/ {
prvSetupHardware();
void main( void )
{ /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top
prvSetupHardware(); of this file. */
#if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )
/* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top {
of this file. */ main_blinky();
#if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) }
{ #else
main_blinky(); {
} main_full();
#else }
{ #endif
main_full(); }
} /*-----------------------------------------------------------*/
#endif
} static void prvSetupHardware( void )
/*-----------------------------------------------------------*/ {
gpio_pin_config_t mGpioPinConfigStruct;
static void prvSetupHardware( void )
{ /* Init board hardware. */
gpio_pin_config_t mGpioPinConfigStruct; BOARD_InitPins();
BOARD_BootClockRUN();
/* Init board hardware. */ BOARD_InitDebugConsole();
BOARD_InitPins();
BOARD_BootClockRUN(); /* For LED. */
BOARD_InitDebugConsole(); mGpioPinConfigStruct.outputLogic = 1U; /* High. */
mGpioPinConfigStruct.pinDirection = kGPIO_DigitalOutput;
/* For LED. */ GPIO_PinInit( BOARD_LED1_GPIO, BOARD_LED1_GPIO_PIN, &mGpioPinConfigStruct );
mGpioPinConfigStruct.outputLogic = 1U; /* High. */ }
mGpioPinConfigStruct.pinDirection = kGPIO_DigitalOutput; /*-----------------------------------------------------------*/
GPIO_PinInit( BOARD_LED1_GPIO, BOARD_LED1_GPIO_PIN, &mGpioPinConfigStruct );
} void vToggleLED( void )
/*-----------------------------------------------------------*/ {
GPIO_TogglePinsOutput( BOARD_LED1_GPIO, 1U << BOARD_LED1_GPIO_PIN );
void vToggleLED( void ) }
{ /*-----------------------------------------------------------*/
GPIO_TogglePinsOutput( BOARD_LED1_GPIO, 1U << BOARD_LED1_GPIO_PIN );
} void vApplicationMallocFailedHook( void )
/*-----------------------------------------------------------*/ {
/* vApplicationMallocFailedHook() will only be called if
void vSendString( const char * const pcString ) configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
{ function that will get called if a call to pvPortMalloc() fails.
PRINTF( pcString ); pvPortMalloc() is called internally by the kernel whenever a task, queue,
} timer or semaphore is created. It is also called by various parts of the
/*-----------------------------------------------------------*/ demo application. If heap_1.c or heap_2.c are used, then the size of the
heap available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in
void vApplicationMallocFailedHook( void ) FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used
{ to query the size of free heap space that remains (although it does not
/* vApplicationMallocFailedHook() will only be called if provide information on how the remaining heap might be fragmented). */
configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook taskDISABLE_INTERRUPTS();
function that will get called if a call to pvPortMalloc() fails. __asm volatile( "ebreak" );
pvPortMalloc() is called internally by the kernel whenever a task, queue, for( ;; );
timer or semaphore is created. It is also called by various parts of the }
demo application. If heap_1.c or heap_2.c are used, then the size of the /*-----------------------------------------------------------*/
heap available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in
FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used void vApplicationIdleHook( void )
to query the size of free heap space that remains (although it does not {
provide information on how the remaining heap might be fragmented). */ /* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
taskDISABLE_INTERRUPTS(); to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
__asm volatile( "ebreak" ); task. It is essential that code added to this hook function never attempts
for( ;; ); to block in any way (for example, call xQueueReceive() with a block time
} specified, or call vTaskDelay()). If the application makes use of the
/*-----------------------------------------------------------*/ vTaskDelete() API function (as this demo application does) then it is also
important that vApplicationIdleHook() is permitted to return to its calling
void vApplicationIdleHook( void ) 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. */
/* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set }
to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle /*-----------------------------------------------------------*/
task. It is essential that code added to this hook function never attempts
to block in any way (for example, call xQueueReceive() with a block time void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
specified, or call vTaskDelay()). If the application makes use of the {
vTaskDelete() API function (as this demo application does) then it is also ( void ) pcTaskName;
important that vApplicationIdleHook() is permitted to return to its calling ( void ) pxTask;
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. */ /* Run time stack overflow checking is performed if
} configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
/*-----------------------------------------------------------*/ function is called if a stack overflow is detected. */
taskDISABLE_INTERRUPTS();
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) __asm volatile( "ebreak" );
{ for( ;; );
( void ) pcTaskName; }
( void ) pxTask; /*-----------------------------------------------------------*/
/* Run time stack overflow checking is performed if void vApplicationTickHook( void )
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook {
function is called if a stack overflow is detected. */ /* The tests in the full demo expect some interaction with interrupts. */
taskDISABLE_INTERRUPTS(); #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 )
__asm volatile( "ebreak" ); {
for( ;; ); extern void vFullDemoTickHook( void );
} vFullDemoTickHook();
/*-----------------------------------------------------------*/ }
#endif
void vApplicationTickHook( void ) }
{ /*-----------------------------------------------------------*/
/* The tests in the full demo expect some interaction with interrupts. */
#if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) void vPortSetupTimerInterrupt( void )
{ {
extern void vFullDemoTickHook( void ); extern void SystemSetupSystick(uint32_t tickRateHz, uint32_t intPriority );
vFullDemoTickHook();
} /* No CLINT so use the LPIT (Low Power Interrupt Timer) to generate the tick
#endif interrupt. */
} CLOCK_SetIpSrc( kCLOCK_Lpit0, kCLOCK_IpSrcFircAsync );
/*-----------------------------------------------------------*/ SystemSetupSystick( configTICK_RATE_HZ, configKERNEL_INTERRUPT_PRIORITY - 1 );
}
void vPortSetupTimerInterrupt( void ) /*-----------------------------------------------------------*/
{
extern void SystemSetupSystick(uint32_t tickRateHz, uint32_t intPriority ); void LPIT0_IRQHandler( void )
{
/* No CLINT so use the LPIT (Low Power Interrupt Timer) to generate the tick BaseType_t xTaskIncrementTick( void );
interrupt. */ void vTaskSwitchContext( void );
CLOCK_SetIpSrc( kCLOCK_Lpit0, kCLOCK_IpSrcFircAsync );
SystemSetupSystick( configTICK_RATE_HZ, configKERNEL_INTERRUPT_PRIORITY - 1 ); #warning requires critical section if interrupt nesting is used.
}
/*-----------------------------------------------------------*/ /* vPortSetupTimerInterrupt() uses LPIT0 to generate the tick interrupt. */
if( xTaskIncrementTick() != 0 )
void LPIT0_IRQHandler( void ) {
{ vTaskSwitchContext();
BaseType_t xTaskIncrementTick( void ); }
void vTaskSwitchContext( void );
/* Clear LPIT0 interrupt. */
#warning requires critical section if interrupt nesting is used. LPIT0->MSR = 1U;
}
/* vPortSetupTimerInterrupt() uses LPIT0 to generate the tick interrupt. */ /*-----------------------------------------------------------*/
if( xTaskIncrementTick() != 0 )
{ /* At the time of writing, interrupt nesting is not supported, so do not use
vTaskSwitchContext(); the default SystemIrqHandler() implementation as that enables interrupts. A
} version that does not enable interrupts is provided below. THIS INTERRUPT
HANDLER IS SPECIFIC TO THE VEGA BOARD WHICH DOES NOT INCLUDE A CLINT! */
/* Clear LPIT0 interrupt. */ void SystemIrqHandler( uint32_t mcause )
LPIT0->MSR = 1U; {
} uint32_t ulInterruptNumber;
/*-----------------------------------------------------------*/ typedef void ( * irq_handler_t )( void );
extern const irq_handler_t isrTable[];
/* At the time of writing, interrupt nesting is not supported, so do not use
the default SystemIrqHandler() implementation as that enables interrupts. A ulInterruptNumber = mcause & 0x1FUL;
version that does not enable interrupts is provided below. THIS INTERRUPT
HANDLER IS SPECIFIC TO THE VEGA BOARD WHICH DOES NOT INCLUDE A CLINT! */ /* Clear pending flag in EVENT unit .*/
void SystemIrqHandler( uint32_t mcause ) EVENT_UNIT->INTPTPENDCLEAR = ( 1U << ulInterruptNumber );
{
uint32_t ulInterruptNumber; /* Read back to make sure write finished. */
typedef void ( * irq_handler_t )( void ); (void)(EVENT_UNIT->INTPTPENDCLEAR);
extern const irq_handler_t isrTable[];
/* Now call the real irq handler for ulInterruptNumber */
ulInterruptNumber = mcause & 0x1FUL; isrTable[ ulInterruptNumber ]();
}
/* Clear pending flag in EVENT unit .*/
EVENT_UNIT->INTPTPENDCLEAR = ( 1U << ulInterruptNumber );
/* Read back to make sure write finished. */
(void)(EVENT_UNIT->INTPTPENDCLEAR);
/* Now call the real irq handler for ulInterruptNumber */
isrTable[ ulInterruptNumber ]();
}