X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=FreeRTOS%2FDemo%2FPIC32MZ_MPLAB%2Fmain_full.c;h=1e9c67f2d8418e7160faf76daf59ef71f395df39;hb=61a5601b461eea61201ee14fc20615ddecf8c259;hp=9820fe807a22c5a09e825ed4501edd3d2cc761cd;hpb=758848cd92bc5b99ef94165052f0f537833ce1d7;p=freertos diff --git a/FreeRTOS/Demo/PIC32MZ_MPLAB/main_full.c b/FreeRTOS/Demo/PIC32MZ_MPLAB/main_full.c index 9820fe807..1e9c67f2d 100644 --- a/FreeRTOS/Demo/PIC32MZ_MPLAB/main_full.c +++ b/FreeRTOS/Demo/PIC32MZ_MPLAB/main_full.c @@ -1,67 +1,29 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. - All rights reserved - - VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. - - *************************************************************************** - * * - * FreeRTOS provides completely free yet professionally developed, * - * robust, strictly quality controlled, supported, and cross * - * platform software that has become a de facto standard. * - * * - * Help yourself get started quickly and support the FreeRTOS * - * project by purchasing a FreeRTOS tutorial book, reference * - * manual, or both from: http://www.FreeRTOS.org/Documentation * - * * - * Thank you! * - * * - *************************************************************************** - - 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 from the following - link: http://www.freertos.org/a00114.html - - 1 tab == 4 spaces! - - *************************************************************************** - * * - * Having a problem? Start by reading the FAQ "My application does * - * not run, what could be wrong?" * - * * - * http://www.FreeRTOS.org/FAQHelp.html * - * * - *************************************************************************** - - http://www.FreeRTOS.org - Documentation, books, training, latest versions, - license and Real Time Engineers Ltd. contact details. - - 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.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High - Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS - licenses offer ticketed support, indemnification and 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! -*/ + * FreeRTOS Kernel V10.2.1 + * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * 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 + * the Software without restriction, including without limitation the rights to + * 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, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * 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 + * 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. + * + * http://www.FreeRTOS.org + * http://aws.amazon.com/freertos + * + * 1 tab == 4 spaces! + */ /****************************************************************************** * NOTE 1: This project provides two demo applications. A simple blinky style @@ -138,26 +100,29 @@ #include "QueueOverwrite.h" #include "QueueSet.h" #include "recmutex.h" +#include "EventGroupsDemo.h" +#include "flop_mz.h" /*-----------------------------------------------------------*/ /* 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_RATE_MS constant. */ -#define mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_RATE_MS ) +equivalent in ticks using the portTICK_PERIOD_MS constant. */ +#define mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS ) /* 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_RATE_MS constant. */ -#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_RATE_MS ) +in ticks using the portTICK_PERIOD_MS constant. */ +#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) /* The priorities of the various demo application tasks. */ #define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) #define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) #define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) #define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) #define mainQUEUE_OVERWRITE_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY ) /* The LED controlled by the 'check' software timer. */ #define mainCHECK_LED ( 2 ) @@ -180,7 +145,7 @@ occur. */ /* * The check timer callback function, as described at the top of this file. */ -static void prvCheckTimerCallback( xTimerHandle xTimer ); +static void prvCheckTimerCallback( TimerHandle_t xTimer ); /* * It is important to ensure the high frequency timer test does not start before @@ -189,7 +154,7 @@ static void prvCheckTimerCallback( xTimerHandle xTimer ); * executing. A one-shot timer is used, so the callback function will only * execute once (unless it is manually reset/restarted). */ -static void prvSetupHighFrequencyTimerTest( xTimerHandle xTimer ); +static void prvSetupHighFrequencyTimerTest( TimerHandle_t xTimer ); /* * Tasks that test the context switch mechanism by filling the processor @@ -221,7 +186,7 @@ volatile unsigned long ulRegTest1Cycles = 0, ulRegTest2Cycles = 0; */ int main_full( void ) { -xTimerHandle xTimer = NULL; +TimerHandle_t xTimer = NULL; /* Create all the other standard demo tasks. */ vStartLEDFlashTimers( mainNUM_FLASH_TIMER_LEDS ); @@ -236,6 +201,8 @@ xTimerHandle xTimer = NULL; vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_TASK_PRIORITY ); vStartQueueSetTasks(); vStartRecursiveMutexTasks(); + vStartEventGroupTasks(); + vStartMathTasks( mainFLOP_TASK_PRIORITY ); /* Create the tasks defined within this file. */ xTaskCreate( prvRegTestTask1, /* The function that implements the task. */ @@ -262,7 +229,7 @@ xTimerHandle xTimer = NULL; /* A software timer is also used to start the high frequency timer test. This is to ensure the test does not start before the kernel. This time a - one shot software timer is used. */ + one-shot software timer is used. */ xTimer = xTimerCreate( "HighHzTimerSetup", 1, pdFALSE, ( void * ) 0, prvSetupHighFrequencyTimerTest ); if( xTimer != NULL ) { @@ -288,6 +255,11 @@ extern void vRegTest1( volatile unsigned long * ); /* Avoid compiler warnings. */ ( void ) pvParameters; + /* Must be called before any hardware floating point operations are + performed to let the RTOS portable layer know that this task requires + a floating point context. */ + portTASK_USES_FLOATING_POINT(); + /* Pass the address of the RegTest1 loop counter into the test function, which is necessarily implemented in assembler. */ vRegTest1( &ulRegTest1Cycles ); @@ -304,6 +276,11 @@ extern void vRegTest2( volatile unsigned long * ); /* Avoid compiler warnings. */ ( void ) pvParameters; + /* Must be called before any hardware floating point operations are + performed to let the RTOS portable layer know that this task requires + a floating point context. */ + portTASK_USES_FLOATING_POINT(); + /* Pass the address of the RegTest2 loop counter into the test function, which is necessarily implemented in assembler. */ vRegTest2( &ulRegTest2Cycles ); @@ -313,7 +290,7 @@ extern void vRegTest2( volatile unsigned long * ); } /*-----------------------------------------------------------*/ -static void prvCheckTimerCallback( xTimerHandle xTimer ) +static void prvCheckTimerCallback( TimerHandle_t xTimer ) { static long lChangedTimerPeriodAlready = pdFALSE; static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0, ulLastHighFrequencyTimerInterrupts = 0; @@ -383,13 +360,21 @@ extern unsigned long ulHighFrequencyTimerInterrupts; { ulErrorOccurred |= ( 0x01UL << 12UL ); } + else if( xAreEventGroupTasksStillRunning() != pdTRUE ) + { + ulErrorOccurred |= ( 0x01UL << 13UL ); + } + else if( xAreMathsTaskStillRunning() != pdTRUE ) + { + ulErrorOccurred |= ( 0x01UL << 15UL ); + } /* Ensure the expected number of high frequency interrupts have occurred. */ if( ulLastHighFrequencyTimerInterrupts != 0 ) { if( ( ulHighFrequencyTimerInterrupts - ulLastHighFrequencyTimerInterrupts ) < ulExpectedHighFrequencyInterrupts ) { - ulErrorOccurred |= ( 0x01UL << 13UL ); + ulErrorOccurred |= ( 0x01UL << 14UL ); } } ulLastHighFrequencyTimerInterrupts = ulHighFrequencyTimerInterrupts; @@ -415,7 +400,7 @@ extern unsigned long ulHighFrequencyTimerInterrupts; } /*-----------------------------------------------------------*/ -static void prvSetupHighFrequencyTimerTest( xTimerHandle xTimer ) +static void prvSetupHighFrequencyTimerTest( TimerHandle_t xTimer ) { void vSetupTimerTest( unsigned short usFrequencyHz ); @@ -424,7 +409,7 @@ void vSetupTimerTest( unsigned short usFrequencyHz ); /* Setup the high frequency, high priority, timer test. It is setup in this software timer callback to ensure it does not start before the kernel does. - This is a one shot timer - so the setup routine will only be executed once. */ + This is a one-shot timer - so the setup routine will only be executed once. */ vSetupTimerTest( mainTEST_INTERRUPT_FREQUENCY ); } /*-----------------------------------------------------------*/