diff --git a/.github/.cSpellWords.txt b/.github/.cSpellWords.txt index 5a860c80edf..d42a790b3ef 100644 --- a/.github/.cSpellWords.txt +++ b/.github/.cSpellWords.txt @@ -101,6 +101,7 @@ AERR AESCCM AESCE AESCMAC +AESGCM AESNI AESR AFECR @@ -307,6 +308,7 @@ BCTRL BCUT BDCR BDEV +BDEVOPENMODE BDEVTEST BDEVTESTPARAM BDFA @@ -323,6 +325,7 @@ BERR BESR BFAR BFARV +BFARVALID BFHFNMIGN BFRX BFSR @@ -430,6 +433,7 @@ BUFNA BUFWREN BUMEN BUSA +BUSFAULTENA BUSFAULTSR BUSP BUSTKE @@ -646,6 +650,7 @@ CLKPR CLKPS CLKRQ CLKS +CLKSOURCE CLKSR CLKSTA CLKVCLR @@ -761,6 +766,7 @@ CPCSTOP CPCTRG CPDI CPHA +CPIEVTENA CPIN CPINREADY CPIV @@ -862,6 +868,11 @@ CWTA CWTAVAL CWTIF CWUF +CYCCNT +CYCCNTENA +CYCEVTENA +CYCMATCH +CYCTAP CYGNAL Cbmc Centralised @@ -1491,7 +1502,9 @@ EWRL EWRX EWUP EXCC +EXCEVTENA EXCOL +EXCTRCENA EXDEF EXEDG EXID @@ -1600,6 +1613,7 @@ FMULTCLK FMXR FNTR FNUM +FOLDEVTENA FOLVA FOLVB FOOB @@ -2496,6 +2510,7 @@ MASKH MASKL MAXBLKL MAXFS +MAXFSIZE MAXFSSIZE MAXMB MAXRTX @@ -2570,6 +2585,7 @@ MDTX MEDEMSR MEM MEMA +MEMFAULTENA MEMFAULTSR MEMP MERASE @@ -2601,6 +2617,7 @@ MISRA MLAN MMAR MMARV +MMARVALID MMCCR MMCIT MMCR @@ -2862,6 +2879,7 @@ Nfontname Ngan Nios Nmap +Nondet Npcap Nullpuc Nullpx @@ -3253,6 +3271,7 @@ PRFTBS PRIA PRIS PRIVDEFEN +PRIVDEFENA PRKLAST PRLH PRLL @@ -3611,6 +3630,7 @@ RMEN RMII RMIIEN RMIIMII +RMTAUTH RMTE RMTEN RMUTE @@ -3989,6 +4009,8 @@ SECEV SECP SECU SEGGER +SELEXTCLK +SELEXTEN SENDA SEQR SESREQ @@ -4044,6 +4066,8 @@ SLBDIS SLCKSEL SLCR SLCT +SLEEPEVTENA +SLEEPONEXIT SLEWCTL SLICEBY SLIPIF @@ -4287,6 +4311,7 @@ SYBYPSR SYMM SYNCA SYNCB +SYNCENA SYNCR SYNMAXRTX SYNSR @@ -4524,6 +4549,7 @@ TRAPA TRARECLENGTH TRAS TRCD +TRCENA TRCMD TRCMPAD TRCMPAU @@ -4902,6 +4928,7 @@ USEND USEPWMDIV USEQ USGA +USGFAULTENA USGFAULTSR USGTRGAF USGTRGAR @@ -4965,6 +4992,8 @@ VDTO VECT VECTACTIVE VECTCLRACTIVE +VECTKEY +VECTKEYSTAT VECTPENDING VECTRESET VECTTBL @@ -5141,6 +5170,7 @@ XADD XAPM XAXIPMON XBLANK +XCALLBACK XCANPS XCOL XCOREAI @@ -5340,6 +5370,7 @@ coalescences codecov comms converttounixtime +coreid coremqtt cortexa coverity @@ -5410,6 +5441,7 @@ eqcfg equalto equidistribution eret +estack ethernetif etrgs evba @@ -5596,6 +5628,7 @@ lxip macaddrhr macaddrlr maes +maxfsize maxiosz maxnpacks mbar @@ -5655,10 +5688,10 @@ mret mrru mrseq mrsne -msse mspgcc msplim msreq +msse mstatus mstroff mtdr @@ -5689,6 +5722,7 @@ noassert nocrypt noheap noint +nondet nopts nostdint notifyzz @@ -5868,6 +5902,7 @@ reti revsh rgmii riscv +rmtauth rovr rsar rslcx @@ -6018,6 +6053,7 @@ txrx u uadd uasx +ubasetype ublock ublox uchars @@ -6037,6 +6073,7 @@ unhashed unifdef uninitialised uninitializing +unprecise unsubscriptions unsuspended unsuspends diff --git a/.github/scripts/common/requirements.txt b/.github/scripts/common/requirements.txt index b5722b8466d..130809087e0 100644 --- a/.github/scripts/common/requirements.txt +++ b/.github/scripts/common/requirements.txt @@ -1,5 +1,5 @@ Deprecated -GitPython +GitPython>=3.1.41 PyGithub PyJWT PyYAML diff --git a/.github/scripts/core_checker.py b/.github/scripts/core_checker.py index c8067ae8f31..1fa5c963a28 100755 --- a/.github/scripts/core_checker.py +++ b/.github/scripts/core_checker.py @@ -305,11 +305,16 @@ r'FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/.*', r'FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/.*', r'FreeRTOS/Demo/AVR32_UC3/.*', + r'FreeRTOS/Demo/AVR_ATMega4809_IAR/.*', + r'FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/.*', + r'FreeRTOS/Demo/AVR_Dx_IAR/.*', + r'FreeRTOS/Demo/AVR_Dx_MPLAB.X/.*', r'FreeRTOS/Demo/ARM7_STR75x_GCC/STLibrary/inc/.*', r'FreeRTOS/Demo/ARM7_STR75x_IAR/STLibrary/inc/.*', r'FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/System/GCC/inc/.*', r'FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/AtmelFiles/drivers/misc/.*', r'FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/.*', + r'FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/.*', r'FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/Trace_Recorder_Configuration/.*', r'FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/Trace_Recorder_Configuration/.*', r'FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/common/WinPCap/.*', diff --git a/.github/scripts/release-requirements.txt b/.github/scripts/release-requirements.txt index b5722b8466d..130809087e0 100644 --- a/.github/scripts/release-requirements.txt +++ b/.github/scripts/release-requirements.txt @@ -1,5 +1,5 @@ Deprecated -GitPython +GitPython>=3.1.41 PyGithub PyJWT PyYAML diff --git a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/UARTCommandConsole.c b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/UARTCommandConsole.c index 5249a0cad12..4b5c0c54d29 100644 --- a/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/UARTCommandConsole.c +++ b/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/UARTCommandConsole.c @@ -69,6 +69,7 @@ static void prvUARTCommandConsoleTask( void * pvParameters ); void vUARTCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority ); +void vOutputString( const char * const pcMessage ); /*-----------------------------------------------------------*/ @@ -110,7 +111,6 @@ static void prvUARTCommandConsoleTask( void * pvParameters ) char * pcOutputString; static char cInputString[ cmdMAX_INPUT_SIZE ], cLastInputString[ cmdMAX_INPUT_SIZE ]; BaseType_t xReturned; - xComPortHandle xPort; ( void ) pvParameters; diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/TCPEchoClient_SingleTasks.c b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/TCPEchoClient_SingleTasks.c index 7b0569cea14..0f9dcc90828 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/TCPEchoClient_SingleTasks.c +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/TCPEchoClient_SingleTasks.c @@ -70,6 +70,9 @@ /* The number of instances of the echo client task to create. */ #define echoNUM_ECHO_CLIENTS ( 1 ) +/* To enable the use of zero copy interface of the TCP sockets */ + #define USE_TCP_ZERO_COPY ( 0 ) + /*-----------------------------------------------------------*/ /* @@ -151,6 +154,68 @@ return xReturn; } +/*-----------------------------------------------------------*/ + + static BaseType_t vTCPCreateAndSendData( Socket_t xSocket, + char * pcTransmitBuffer, + volatile uint32_t * pulTxCount, + uint32_t ulBufferLength ) + { + BaseType_t lStringLength; + BaseType_t lTransmitted; + char * pcDstBuffer; + + #if USE_TCP_ZERO_COPY + BaseType_t xStreamBufferLength; + char * pcBuffer; + #endif /* USE_TCP_ZERO_COPY */ + + pcDstBuffer = pcTransmitBuffer; + + #if USE_TCP_ZERO_COPY + /* Get a direct pointer to the TX head of the circular transmit buffer */ + pcBuffer = ( char * ) FreeRTOS_get_tx_head( xSocket, &xStreamBufferLength ); + + /* Check if sufficient space is there in the stream buffer. If there + * isn't enough size use application provided buffer */ + if( xStreamBufferLength >= ulBufferLength ) + { + /* Use the TCP stream buffer to directly create the TX data */ + pcDstBuffer = pcBuffer; + } + #endif /* USE_TCP_ZERO_COPY */ + + lStringLength = prvCreateTxData( pcDstBuffer, ulBufferLength ); + + /* Add in some unique text at the front of the string. */ + sprintf( pcDstBuffer, "TxRx message number %u", ( unsigned ) *pulTxCount ); + ( *pulTxCount )++; + + #if USE_TCP_ZERO_COPY + /* Check to see if zero copy is used */ + if( pcDstBuffer != pcTransmitBuffer ) + { + /* Save a copy of the data in pcTransmitBuffer + * which can be used to verify the echoed back data */ + memcpy( pcTransmitBuffer, pcDstBuffer, lStringLength ); + + /* Set the buffer pointer as NULL to let the stack know + * that its a zero copy */ + pcDstBuffer = NULL; + } + #endif /* USE_TCP_ZERO_COPY */ + + /* Send the string to the socket. */ + lTransmitted = FreeRTOS_send( xSocket, /* The socket being sent to. */ + ( void * ) pcDstBuffer, /* The data being sent. */ + lStringLength, /* The length of the data being sent. */ + 0 ); /* No flags. */ + + configPRINTF( ( "FreeRTOS_send: %u/%u\n", ( unsigned ) lTransmitted, ( unsigned ) lStringLength ) ); + + return lTransmitted; + } + /*-----------------------------------------------------------*/ static void prvEchoClientTask( void * pvParameters ) @@ -161,7 +226,7 @@ const int32_t lMaxLoopCount = 1; volatile uint32_t ulTxCount = 0UL; BaseType_t xReceivedBytes, xReturned = 0, xInstance; - BaseType_t lTransmitted, lStringLength; + BaseType_t lTransmitted; char * pcTransmittedString, * pcReceivedString; WinProperties_t xWinProps; TickType_t xTimeOnEntering; @@ -252,19 +317,7 @@ /* Send a number of echo requests. */ for( lLoopCount = 0; lLoopCount < lMaxLoopCount; lLoopCount++ ) { - /* Create the string that is sent to the echo server. */ - lStringLength = prvCreateTxData( pcTransmittedString, echoBUFFER_SIZES ); - - /* Add in some unique text at the front of the string. */ - sprintf( pcTransmittedString, "TxRx message number %u", ( unsigned ) ulTxCount ); - ulTxCount++; - - /* Send the string to the socket. */ - lTransmitted = FreeRTOS_send( xSocket, /* The socket being sent to. */ - ( void * ) pcTransmittedString, /* The data being sent. */ - lStringLength, /* The length of the data being sent. */ - 0 ); /* No flags. */ - configPRINTF( ( "FreeRTOS_send: %u/%u\n", ( unsigned ) lTransmitted, ( unsigned ) lStringLength ) ); + lTransmitted = vTCPCreateAndSendData( xSocket, pcTransmittedString, &ulTxCount, echoBUFFER_SIZES ); if( xIsFatalError( lTransmitted ) ) { @@ -282,10 +335,27 @@ /* Receive data echoed back to the socket. */ while( xReceivedBytes < lTransmitted ) { - xReturned = FreeRTOS_recv( xSocket, /* The socket being received from. */ - &( pcReceivedString[ xReceivedBytes ] ), /* The buffer into which the received data will be written. */ - lStringLength - xReceivedBytes, /* The size of the buffer provided to receive the data. */ - 0 ); /* No flags. */ + #if USE_TCP_ZERO_COPY + uint8_t * pucZeroCopyRxBuffPtr = NULL; + xReturned = FreeRTOS_recv( xSocket, /* The socket being received from. */ + &pucZeroCopyRxBuffPtr, /* While using FREERTOS_ZERO_COPY flag, pvBuffer is taken as a double pointer which will be updated with pointer to TCP RX stream buffer. */ + ipconfigTCP_MSS, /* The size of the buffer provided to receive the data. */ + FREERTOS_ZERO_COPY ); /* Use FREERTOS_ZERO_COPY flag to enable zero copy. */ + + if( pucZeroCopyRxBuffPtr != NULL ) + { + memcpy( &( pcReceivedString[ xReceivedBytes ] ), pucZeroCopyRxBuffPtr, xReturned ); + + /* Release the memory that was previously obtained by calling FreeRTOS_recv() + * with the flag 'FREERTOS_ZERO_COPY' */ + FreeRTOS_ReleaseTCPPayloadBuffer( xSocket, pucZeroCopyRxBuffPtr, xReturned ); + } + #else /* if USE_TCP_ZERO_COPY */ + xReturned = FreeRTOS_recv( xSocket, /* The socket being received from. */ + &( pcReceivedString[ xReceivedBytes ] ), /* The buffer into which the received data will be written. */ + lTransmitted - xReceivedBytes, /* The size of the buffer provided to receive the data. */ + 0 ); /* No flags. */ + #endif /* USE_TCP_ZERO_COPY */ if( xIsFatalError( xReturned ) ) { diff --git a/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/FreeRTOSConfig.h index 1f9cca0f2ab..e979be9430d 100644 --- a/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/ParTest/ParTest.c b/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/ParTest/ParTest.c index c6701927082..710fe151b72 100644 --- a/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/ParTest/ParTest.c +++ b/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/main.c b/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/main.c index 062680c3e93..646fbe323c3 100644 --- a/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/main.c +++ b/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -25,12 +25,12 @@ */ /* - NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. - The processor MUST be in supervisor mode when vTaskStartScheduler is - called. The demo applications included in the FreeRTOS.org download switch - to supervisor mode prior to main being called. If you are not using one of - these demo application projects then ensure Supervisor mode is used. -*/ + * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + * The processor MUST be in supervisor mode when vTaskStartScheduler is + * called. The demo applications included in the FreeRTOS.org download switch + * to supervisor mode prior to main being called. If you are not using one of + * these demo application projects then ensure Supervisor mode is used. + */ /* @@ -84,44 +84,44 @@ /*-----------------------------------------------------------*/ /* Constants for the ComTest tasks. */ -#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 ) -#define mainCOM_TEST_LED ( 5 ) +#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 ) +#define mainCOM_TEST_LED ( 5 ) /* Priorities for the demo application tasks. */ -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* The rate at which the on board LED will toggle when there is/is not an -error. */ -#define mainNO_ERROR_FLASH_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) -#define mainERROR_FLASH_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) -#define mainON_BOARD_LED_BIT ( ( unsigned long ) 7 ) + * error. */ +#define mainNO_ERROR_FLASH_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainERROR_FLASH_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) +#define mainON_BOARD_LED_BIT ( ( unsigned long ) 7 ) /* Constants used by the vMemCheckTask() task. */ -#define mainCOUNT_INITIAL_VALUE ( ( unsigned long ) 0 ) -#define mainNO_TASK ( 0 ) +#define mainCOUNT_INITIAL_VALUE ( ( unsigned long ) 0 ) +#define mainNO_TASK ( 0 ) /* The size of the memory blocks allocated by the vMemCheckTask() task. */ -#define mainMEM_CHECK_SIZE_1 ( ( size_t ) 51 ) -#define mainMEM_CHECK_SIZE_2 ( ( size_t ) 52 ) -#define mainMEM_CHECK_SIZE_3 ( ( size_t ) 151 ) +#define mainMEM_CHECK_SIZE_1 ( ( size_t ) 51 ) +#define mainMEM_CHECK_SIZE_2 ( ( size_t ) 52 ) +#define mainMEM_CHECK_SIZE_3 ( ( size_t ) 151 ) -#define MAX_WAIT_STATES 8 +#define MAX_WAIT_STATES 8 static const unsigned long ululCSRWaitValues[ MAX_WAIT_STATES + 1 ] = { - WaitState1,/* There is no "zero wait state" value, so use one wait state */ - WaitState1, - WaitState2, - WaitState3, - WaitState4, - WaitState5, - WaitState6, - WaitState7, - WaitState8 + WaitState1, /* There is no "zero wait state" value, so use one wait state */ + WaitState1, + WaitState2, + WaitState3, + WaitState4, + WaitState5, + WaitState6, + WaitState7, + WaitState8 }; /*-----------------------------------------------------------*/ @@ -136,14 +136,14 @@ static long prvCheckOtherTasksAreStillRunning( unsigned long ulMemCheckTaskCount * prvCheckOtherTasksAreStillRunning(). See the description at the top * of the file. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * Dynamically created and deleted during each cycle of the vErrorChecks() * task. This is done to check the operation of the memory allocator. * See the top of vErrorChecks for more details. */ -static void vMemCheckTask( void *pvParameters ); +static void vMemCheckTask( void * pvParameters ); /* * Configure the processor for use with the Olimex demo board. This includes @@ -158,309 +158,312 @@ static void prvSetupHardware( void ); */ int main( void ) { - /* Setup the hardware for use with the Olimex demo board. */ - prvSetupHardware(); - - /* Start the demo/test application tasks. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartMathTasks( tskIDLE_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartDynamicPriorityTasks(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - - /* Start the check task - which is defined in this file. */ - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - - /* Now all the tasks have been started - start the scheduler. - - NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. - The processor MUST be in supervisor mode when vTaskStartScheduler is - called. The demo applications included in the FreeRTOS.org download switch - to supervisor mode prior to main being called. If you are not using one of - these demo application projects then ensure Supervisor mode is used here. */ - vTaskStartScheduler(); - - /* Should never reach here! */ - return 0; + /* Setup the hardware for use with the Olimex demo board. */ + prvSetupHardware(); + + /* Start the demo/test application tasks. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartMathTasks( tskIDLE_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartDynamicPriorityTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + + /* Start the check task - which is defined in this file. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + + /* Now all the tasks have been started - start the scheduler. + * + * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + * The processor MUST be in supervisor mode when vTaskStartScheduler is + * called. The demo applications included in the FreeRTOS.org download switch + * to supervisor mode prior to main being called. If you are not using one of + * these demo application projects then ensure Supervisor mode is used here. */ + vTaskStartScheduler(); + + /* Should never reach here! */ + return 0; } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD; -unsigned long ulMemCheckTaskRunningCount; -TaskHandle_t xCreatedTask; - - /* Just to stop compiler warnings. */ - ( void ) pvParameters; - - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. If an error is detected then the delay period - is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so - the on board LED flash rate will increase. - - In addition to the standard tests the memory allocator is tested through - the dynamic creation and deletion of a task each cycle. Each time the - task is created memory must be allocated for its stack. When the task is - deleted this memory is returned to the heap. If the task cannot be created - then it is likely that the memory allocation failed. */ - - for( ;; ) - { - /* Reset xCreatedTask. This is modified by the task about to be - created so we can tell if it is executing correctly or not. */ - xCreatedTask = mainNO_TASK; - - /* Dynamically create a task - passing ulMemCheckTaskRunningCount as a - parameter. */ - ulMemCheckTaskRunningCount = mainCOUNT_INITIAL_VALUE; - if( xTaskCreate( vMemCheckTask, "MEM_CHECK", configMINIMAL_STACK_SIZE, ( void * ) &ulMemCheckTaskRunningCount, tskIDLE_PRIORITY, &xCreatedTask ) != pdPASS ) - { - /* Could not create the task - we have probably run out of heap. */ - xDelayPeriod = mainERROR_FLASH_PERIOD; - } - - /* Delay until it is time to execute again. */ - vTaskDelay( xDelayPeriod ); - - /* Delete the dynamically created task. */ - if( xCreatedTask != mainNO_TASK ) - { - vTaskDelete( xCreatedTask ); - } - - /* Check all the standard demo application tasks are executing without - error. ulMemCheckTaskRunningCount is checked to ensure it was - modified by the task just deleted. */ - if( prvCheckOtherTasksAreStillRunning( ulMemCheckTaskRunningCount ) != pdPASS ) - { - /* An error has been detected in one of the tasks - flash faster. */ - xDelayPeriod = mainERROR_FLASH_PERIOD; - } - - /* The toggle rate of the LED depends on how long this task delays for. - An error reduces the delay period and so increases the toggle rate. */ - vParTestToggleLED( mainON_BOARD_LED_BIT ); - } + TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD; + unsigned long ulMemCheckTaskRunningCount; + TaskHandle_t xCreatedTask; + + /* Just to stop compiler warnings. */ + ( void ) pvParameters; + + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. If an error is detected then the delay period + * is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so + * the on board LED flash rate will increase. + * + * In addition to the standard tests the memory allocator is tested through + * the dynamic creation and deletion of a task each cycle. Each time the + * task is created memory must be allocated for its stack. When the task is + * deleted this memory is returned to the heap. If the task cannot be created + * then it is likely that the memory allocation failed. */ + + for( ; ; ) + { + /* Reset xCreatedTask. This is modified by the task about to be + * created so we can tell if it is executing correctly or not. */ + xCreatedTask = mainNO_TASK; + + /* Dynamically create a task - passing ulMemCheckTaskRunningCount as a + * parameter. */ + ulMemCheckTaskRunningCount = mainCOUNT_INITIAL_VALUE; + + if( xTaskCreate( vMemCheckTask, "MEM_CHECK", configMINIMAL_STACK_SIZE, ( void * ) &ulMemCheckTaskRunningCount, tskIDLE_PRIORITY, &xCreatedTask ) != pdPASS ) + { + /* Could not create the task - we have probably run out of heap. */ + xDelayPeriod = mainERROR_FLASH_PERIOD; + } + + /* Delay until it is time to execute again. */ + vTaskDelay( xDelayPeriod ); + + /* Delete the dynamically created task. */ + if( xCreatedTask != mainNO_TASK ) + { + vTaskDelete( xCreatedTask ); + } + + /* Check all the standard demo application tasks are executing without + * error. ulMemCheckTaskRunningCount is checked to ensure it was + * modified by the task just deleted. */ + if( prvCheckOtherTasksAreStillRunning( ulMemCheckTaskRunningCount ) != pdPASS ) + { + /* An error has been detected in one of the tasks - flash faster. */ + xDelayPeriod = mainERROR_FLASH_PERIOD; + } + + /* The toggle rate of the LED depends on how long this task delays for. + * An error reduces the delay period and so increases the toggle rate. */ + vParTestToggleLED( mainON_BOARD_LED_BIT ); + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { -long lCount; - - #ifdef RUN_FROM_ROM - { - portFLOAT nsecsPerClockTick; - long lNumWaitStates; - unsigned long ulCSRWaitValue; - - /* We are compiling to run from ROM (either on-chip or off-chip flash). - Leave the RAM/flash mapped the way they are on reset - (flash @ 0x00000000, RAM @ 0x00300000), and set up the - proper flash wait states (starts out at the maximum number - of wait states on reset, so we should be able to reduce it). - Most of this code will probably get removed by the compiler - if optimization is enabled, since these calculations are - based on constants. But the compiler should still produce - a correct wait state register value. */ - nsecsPerClockTick = ( portFLOAT ) 1000000000 / configCPU_CLOCK_HZ; - lNumWaitStates = ( long )( ( configFLASH_SPEED_NSEC / nsecsPerClockTick ) + 0.5 ) - 1; - - if( lNumWaitStates < 0 ) - { - lNumWaitStates = 0; - } - - if( lNumWaitStates > MAX_WAIT_STATES ) - { - lNumWaitStates = MAX_WAIT_STATES; - } - - ulCSRWaitValue = ululCSRWaitValues[ lNumWaitStates ]; - ulCSRWaitValue = WaitState5; - - AT91C_BASE_EBI->EBI_CSR[ 0 ] = ulCSRWaitValue | DataBus16 | WaitStateEnable - | PageSize1M | tDF_0cycle - | ByteWriteAccessType | CSEnable - | 0x00000000 /* Base Address */; - } - #else /* else we are compiling to run from on-chip RAM */ - { - /* If compiling to run from RAM, we expect the on-chip RAM to already - be mapped at 0x00000000. This is typically done with an initialization - script for the JTAG emulator you are using to download and run the - demo application. So there is nothing to do here in this case. */ - } - #endif - - /* Disable all interrupts at the AIC level initially... */ - AT91C_BASE_AIC->AIC_IDCR = 0xFFFFFFFF; - - /* Set all SVR and SMR entries to default values (start with a clean slate)... */ - for( lCount = 0; lCount < 32; lCount++ ) - { - AT91C_BASE_AIC->AIC_SVR[ lCount ] = (unsigned long) 0; - AT91C_BASE_AIC->AIC_SMR[ lCount ] = AIC_SRCTYPE_INT_EDGE_TRIGGERED; - } - - /* Disable clocks to all peripherals initially... */ - AT91C_BASE_PS->PS_PCDR = 0xFFFFFFFF; - - /* Clear all interrupts at the AIC level initially... */ - AT91C_BASE_AIC->AIC_ICCR = 0xFFFFFFFF; - - /* Perform 8 "End Of Interrupt" cmds to make sure AIC will not Lock out - nIRQ */ - for( lCount = 0; lCount < 8; lCount++ ) - { - AT91C_BASE_AIC->AIC_EOICR = 0; - } - - /* Initialise LED outputs. */ - vParTestInitialise(); + long lCount; + + #ifdef RUN_FROM_ROM + { + portFLOAT nsecsPerClockTick; + long lNumWaitStates; + unsigned long ulCSRWaitValue; + + /* We are compiling to run from ROM (either on-chip or off-chip flash). + * Leave the RAM/flash mapped the way they are on reset + * (flash @ 0x00000000, RAM @ 0x00300000), and set up the + * proper flash wait states (starts out at the maximum number + * of wait states on reset, so we should be able to reduce it). + * Most of this code will probably get removed by the compiler + * if optimization is enabled, since these calculations are + * based on constants. But the compiler should still produce + * a correct wait state register value. */ + nsecsPerClockTick = ( portFLOAT ) 1000000000 / configCPU_CLOCK_HZ; + lNumWaitStates = ( long ) ( ( configFLASH_SPEED_NSEC / nsecsPerClockTick ) + 0.5 ) - 1; + + if( lNumWaitStates < 0 ) + { + lNumWaitStates = 0; + } + + if( lNumWaitStates > MAX_WAIT_STATES ) + { + lNumWaitStates = MAX_WAIT_STATES; + } + + ulCSRWaitValue = ululCSRWaitValues[ lNumWaitStates ]; + ulCSRWaitValue = WaitState5; + + AT91C_BASE_EBI->EBI_CSR[ 0 ] = ulCSRWaitValue | DataBus16 | WaitStateEnable + | PageSize1M | tDF_0cycle + | ByteWriteAccessType | CSEnable + | 0x00000000 /* Base Address */; + } + #else /* else we are compiling to run from on-chip RAM */ + { + /* If compiling to run from RAM, we expect the on-chip RAM to already + * be mapped at 0x00000000. This is typically done with an initialization + * script for the JTAG emulator you are using to download and run the + * demo application. So there is nothing to do here in this case. */ + } + #endif /* ifdef RUN_FROM_ROM */ + + /* Disable all interrupts at the AIC level initially... */ + AT91C_BASE_AIC->AIC_IDCR = 0xFFFFFFFF; + + /* Set all SVR and SMR entries to default values (start with a clean slate)... */ + for( lCount = 0; lCount < 32; lCount++ ) + { + AT91C_BASE_AIC->AIC_SVR[ lCount ] = ( unsigned long ) 0; + AT91C_BASE_AIC->AIC_SMR[ lCount ] = AIC_SRCTYPE_INT_EDGE_TRIGGERED; + } + + /* Disable clocks to all peripherals initially... */ + AT91C_BASE_PS->PS_PCDR = 0xFFFFFFFF; + + /* Clear all interrupts at the AIC level initially... */ + AT91C_BASE_AIC->AIC_ICCR = 0xFFFFFFFF; + + /* Perform 8 "End Of Interrupt" cmds to make sure AIC will not Lock out + * nIRQ */ + for( lCount = 0; lCount < 8; lCount++ ) + { + AT91C_BASE_AIC->AIC_EOICR = 0; + } + + /* Initialise LED outputs. */ + vParTestInitialise(); } /*-----------------------------------------------------------*/ static long prvCheckOtherTasksAreStillRunning( unsigned long ulMemCheckTaskCount ) { -long lReturn = ( long ) pdPASS; - - /* Check all the demo tasks (other than the flash tasks) to ensure - that they are all still running, and that none of them have detected - an error. */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreMathsTaskStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( ulMemCheckTaskCount == mainCOUNT_INITIAL_VALUE ) - { - /* The vMemCheckTask did not increment the counter - it must - have failed. */ - lReturn = ( long ) pdFAIL; - } - - return lReturn; + long lReturn = ( long ) pdPASS; + + /* Check all the demo tasks (other than the flash tasks) to ensure + * that they are all still running, and that none of them have detected + * an error. */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreMathsTaskStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( ulMemCheckTaskCount == mainCOUNT_INITIAL_VALUE ) + { + /* The vMemCheckTask did not increment the counter - it must + * have failed. */ + lReturn = ( long ) pdFAIL; + } + + return lReturn; } /*-----------------------------------------------------------*/ -static void vMemCheckTask( void *pvParameters ) +static void vMemCheckTask( void * pvParameters ) { -unsigned long *pulMemCheckTaskRunningCounter; -void *pvMem1, *pvMem2, *pvMem3; -static long lErrorOccurred = pdFALSE; - - /* This task is dynamically created then deleted during each cycle of the - vErrorChecks task to check the operation of the memory allocator. Each time - the task is created memory is allocated for the stack and TCB. Each time - the task is deleted this memory is returned to the heap. This task itself - exercises the allocator by allocating and freeing blocks. - - The task executes at the idle priority so does not require a delay. - - pulMemCheckTaskRunningCounter is incremented each cycle to indicate to the - vErrorChecks() task that this task is still executing without error. */ - - pulMemCheckTaskRunningCounter = ( unsigned long * ) pvParameters; - - for( ;; ) - { - if( lErrorOccurred == pdFALSE ) - { - /* We have never seen an error so increment the counter. */ - ( *pulMemCheckTaskRunningCounter )++; - } - else - { - /* There has been an error so reset the counter so the check task - can tell that an error occurred. */ - *pulMemCheckTaskRunningCounter = mainCOUNT_INITIAL_VALUE; - } - - /* Allocate some memory - just to give the allocator some extra - exercise. This has to be in a critical section to ensure the - task does not get deleted while it has memory allocated. */ - vTaskSuspendAll(); - { - pvMem1 = pvPortMalloc( mainMEM_CHECK_SIZE_1 ); - if( pvMem1 == NULL ) - { - lErrorOccurred = pdTRUE; - } - else - { - memset( pvMem1, 0xaa, mainMEM_CHECK_SIZE_1 ); - vPortFree( pvMem1 ); - } - } - xTaskResumeAll(); - - /* Again - with a different size block. */ - vTaskSuspendAll(); - { - pvMem2 = pvPortMalloc( mainMEM_CHECK_SIZE_2 ); - if( pvMem2 == NULL ) - { - lErrorOccurred = pdTRUE; - } - else - { - memset( pvMem2, 0xaa, mainMEM_CHECK_SIZE_2 ); - vPortFree( pvMem2 ); - } - } - xTaskResumeAll(); - - /* Again - with a different size block. */ - vTaskSuspendAll(); - { - pvMem3 = pvPortMalloc( mainMEM_CHECK_SIZE_3 ); - if( pvMem3 == NULL ) - { - lErrorOccurred = pdTRUE; - } - else - { - memset( pvMem3, 0xaa, mainMEM_CHECK_SIZE_3 ); - vPortFree( pvMem3 ); - } - } - xTaskResumeAll(); - } + unsigned long * pulMemCheckTaskRunningCounter; + void * pvMem1, * pvMem2, * pvMem3; + static long lErrorOccurred = pdFALSE; + + /* This task is dynamically created then deleted during each cycle of the + * vErrorChecks task to check the operation of the memory allocator. Each time + * the task is created memory is allocated for the stack and TCB. Each time + * the task is deleted this memory is returned to the heap. This task itself + * exercises the allocator by allocating and freeing blocks. + * + * The task executes at the idle priority so does not require a delay. + * + * pulMemCheckTaskRunningCounter is incremented each cycle to indicate to the + * vErrorChecks() task that this task is still executing without error. */ + + pulMemCheckTaskRunningCounter = ( unsigned long * ) pvParameters; + + for( ; ; ) + { + if( lErrorOccurred == pdFALSE ) + { + /* We have never seen an error so increment the counter. */ + ( *pulMemCheckTaskRunningCounter )++; + } + else + { + /* There has been an error so reset the counter so the check task + * can tell that an error occurred. */ + *pulMemCheckTaskRunningCounter = mainCOUNT_INITIAL_VALUE; + } + + /* Allocate some memory - just to give the allocator some extra + * exercise. This has to be in a critical section to ensure the + * task does not get deleted while it has memory allocated. */ + vTaskSuspendAll(); + { + pvMem1 = pvPortMalloc( mainMEM_CHECK_SIZE_1 ); + + if( pvMem1 == NULL ) + { + lErrorOccurred = pdTRUE; + } + else + { + memset( pvMem1, 0xaa, mainMEM_CHECK_SIZE_1 ); + vPortFree( pvMem1 ); + } + } + xTaskResumeAll(); + + /* Again - with a different size block. */ + vTaskSuspendAll(); + { + pvMem2 = pvPortMalloc( mainMEM_CHECK_SIZE_2 ); + + if( pvMem2 == NULL ) + { + lErrorOccurred = pdTRUE; + } + else + { + memset( pvMem2, 0xaa, mainMEM_CHECK_SIZE_2 ); + vPortFree( pvMem2 ); + } + } + xTaskResumeAll(); + + /* Again - with a different size block. */ + vTaskSuspendAll(); + { + pvMem3 = pvPortMalloc( mainMEM_CHECK_SIZE_3 ); + + if( pvMem3 == NULL ) + { + lErrorOccurred = pdTRUE; + } + else + { + memset( pvMem3, 0xaa, mainMEM_CHECK_SIZE_3 ); + vPortFree( pvMem3 ); + } + } + xTaskResumeAll(); + } } - diff --git a/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/serial/serial.c b/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/serial/serial.c index 38472470f73..deec31e5480 100644 --- a/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/serial/serial.c +++ b/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/serial/serialISR.c b/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/serial/serialISR.c index 0c1b521ed23..07bb9308f18 100644 --- a/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/serial/serialISR.c +++ b/FreeRTOS/Demo/ARM7_AT91FR40008_GCC/serial/serialISR.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/FreeRTOSConfig.h index 3c89e24db8e..6d6c531c6dc 100644 --- a/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/ParTest/ParTest.c b/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/ParTest/ParTest.c index b116faff9de..3572266264f 100644 --- a/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/ParTest/ParTest.c +++ b/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/USB/USBSample.c b/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/USB/USBSample.c index 927f28e1044..52097be1ee9 100644 --- a/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/USB/USBSample.c +++ b/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/USB/USBSample.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/main.c b/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/main.c index 92bfa084d97..abcf19d3e0a 100644 --- a/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/main.c +++ b/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -24,29 +24,29 @@ * */ -/* - NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. - The processor MUST be in supervisor mode when vTaskStartScheduler is - called. The demo applications included in the FreeRTOS.org download switch - to supervisor mode prior to main being called. If you are not using one of - these demo application projects then ensure Supervisor mode is used. -*/ +/* + * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + * The processor MUST be in supervisor mode when vTaskStartScheduler is + * called. The demo applications included in the FreeRTOS.org download switch + * to supervisor mode prior to main being called. If you are not using one of + * these demo application projects then ensure Supervisor mode is used. + */ /* * Creates all the demo application tasks, then starts the scheduler. The WEB * documentation provides more details of the demo application tasks. The SAM7 * includes a sample USB that emulates a Joystick input to a USB host. - * - * Main.c also creates a task called "Check". This only executes every three - * seconds but has the highest priority so is guaranteed to get processor time. + * + * Main.c also creates a task called "Check". This only executes every three + * seconds but has the highest priority so is guaranteed to get processor time. * Its main function is to check that all the other tasks are still operational. - * Each task (other than the "flash" tasks) maintains a unique count that is - * incremented each time the task successfully completes its function. Should - * any error occur within such a task the count is permanently halted. The + * Each task (other than the "flash" tasks) maintains a unique count that is + * incremented each time the task successfully completes its function. Should + * any error occur within such a task the count is permanently halted. The * check task inspects the count of each task to ensure it has changed since - * the last time the check task executed. If all the count variables have + * the last time the check task executed. If all the count variables have * changed all the tasks are still executing error free, and the check task - * toggles the onboard LED. Should any task contain an error at any time + * toggles the onboard LED. Should any task contain an error at any time * the LED toggle rate will change from 3 seconds to 500ms. * */ @@ -70,29 +70,29 @@ #include "USB/USBSample.h" /* Priorities for the demo application tasks. */ -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainUSB_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainUSB_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* Constants required by the 'Check' task. */ -#define mainNO_ERROR_FLASH_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) -#define mainERROR_FLASH_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) -#define mainCHECK_TASK_LED ( 3 ) +#define mainNO_ERROR_FLASH_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainERROR_FLASH_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) +#define mainCHECK_TASK_LED ( 3 ) /* Constants for the ComTest tasks. */ -#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 ) -#define mainCOM_TEST_LED ( 4 ) /* Off the board. */ +#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 ) +#define mainCOM_TEST_LED ( 4 ) /* Off the board. */ /* - * The task that executes at the highest priority and calls + * The task that executes at the highest priority and calls * prvCheckOtherTasksAreStillRunning(). See the description at the top * of the file. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * Configure the processor for use with the Atmel demo board. Setup is minimal @@ -111,136 +111,133 @@ static long prvCheckOtherTasksAreStillRunning( void ); /*-----------------------------------------------------------*/ /* - * Starts all the other tasks, then starts the scheduler. + * Starts all the other tasks, then starts the scheduler. */ void main( void ) { - /* Setup any hardware that has not already been configured by the low - level init routines. */ - prvSetupHardware(); - - /* Initialise the LED outputs for use by the demo application tasks. */ - vParTestInitialise(); - - /* Start all the standard demo application tasks. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vStartDynamicPriorityTasks(); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - - /* Also start the USB demo which is just for the SAM7. */ - xTaskCreate( vUSBDemoTask, "USB", configMINIMAL_STACK_SIZE, NULL, mainUSB_PRIORITY, NULL ); - - /* Start the check task - which is defined in this file. */ - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - - /* Start the scheduler. - - NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. - The processor MUST be in supervisor mode when vTaskStartScheduler is - called. The demo applications included in the FreeRTOS.org download switch - to supervisor mode prior to main being called. If you are not using one of - these demo application projects then ensure Supervisor mode is used here. */ - - vTaskStartScheduler(); - - /* We should never get here as control is now taken by the scheduler. */ - return; + /* Setup any hardware that has not already been configured by the low + * level init routines. */ + prvSetupHardware(); + + /* Initialise the LED outputs for use by the demo application tasks. */ + vParTestInitialise(); + + /* Start all the standard demo application tasks. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vStartDynamicPriorityTasks(); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + + /* Also start the USB demo which is just for the SAM7. */ + xTaskCreate( vUSBDemoTask, "USB", configMINIMAL_STACK_SIZE, NULL, mainUSB_PRIORITY, NULL ); + + /* Start the check task - which is defined in this file. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + + /* Start the scheduler. + * + * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + * The processor MUST be in supervisor mode when vTaskStartScheduler is + * called. The demo applications included in the FreeRTOS.org download switch + * to supervisor mode prior to main being called. If you are not using one of + * these demo application projects then ensure Supervisor mode is used here. */ + + vTaskStartScheduler(); + + /* We should never get here as control is now taken by the scheduler. */ } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* When using the JTAG debugger the hardware is not always initialised to - the correct default state. This line just ensures that this does not - cause all interrupts to be masked at the start. */ - AT91C_BASE_AIC->AIC_EOICR = 0; - - /* Most setup is performed by the low level init function called from the - startup asm file. */ - - /* Configure the PIO Lines corresponding to LED1 to LED4 to be outputs as - well as the UART Tx line. */ - AT91F_PIO_CfgOutput( AT91C_BASE_PIOA, LED_MASK ); - - /* Enable the peripheral clock. */ - AT91F_PMC_EnablePeriphClock( AT91C_BASE_PMC, 1 << AT91C_ID_PIOA ); + /* When using the JTAG debugger the hardware is not always initialised to + * the correct default state. This line just ensures that this does not + * cause all interrupts to be masked at the start. */ + AT91C_BASE_AIC->AIC_EOICR = 0; + + /* Most setup is performed by the low level init function called from the + * startup asm file. */ + + /* Configure the PIO Lines corresponding to LED1 to LED4 to be outputs as + * well as the UART Tx line. */ + AT91F_PIO_CfgOutput( AT91C_BASE_PIOA, LED_MASK ); + + /* Enable the peripheral clock. */ + AT91F_PMC_EnablePeriphClock( AT91C_BASE_PMC, 1 << AT91C_ID_PIOA ); } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD; - - /* The parameters are not used in this task. */ - ( void ) pvParameters; - - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. If an error is detected then the delay period - is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so - the on board LED flash rate will increase. */ - - for( ;; ) - { - /* Delay until it is time to execute again. */ - vTaskDelay( xDelayPeriod ); - - /* Check all the standard demo application tasks are executing without - error. */ - if( prvCheckOtherTasksAreStillRunning() != pdPASS ) - { - /* An error has been detected in one of the tasks - flash faster. */ - xDelayPeriod = mainERROR_FLASH_PERIOD; - } - - vParTestToggleLED( mainCHECK_TASK_LED ); - } + TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD; + + /* The parameters are not used in this task. */ + ( void ) pvParameters; + + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. If an error is detected then the delay period + * is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so + * the on board LED flash rate will increase. */ + + for( ; ; ) + { + /* Delay until it is time to execute again. */ + vTaskDelay( xDelayPeriod ); + + /* Check all the standard demo application tasks are executing without + * error. */ + if( prvCheckOtherTasksAreStillRunning() != pdPASS ) + { + /* An error has been detected in one of the tasks - flash faster. */ + xDelayPeriod = mainERROR_FLASH_PERIOD; + } + + vParTestToggleLED( mainCHECK_TASK_LED ); + } } /*-----------------------------------------------------------*/ static long prvCheckOtherTasksAreStillRunning( void ) { -long lReturn = ( long ) pdPASS; - - /* Check all the demo tasks (other than the flash tasks) to ensure - that they are all still running, and that none of them have detected - an error. */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - return lReturn; + long lReturn = ( long ) pdPASS; + + /* Check all the demo tasks (other than the flash tasks) to ensure + * that they are all still running, and that none of them have detected + * an error. */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + return lReturn; } /*-----------------------------------------------------------*/ - - diff --git a/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/serial/serial.c b/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/serial/serial.c index d777cf6b750..2aa6ed50d35 100644 --- a/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/serial/serial.c +++ b/FreeRTOS/Demo/ARM7_AT91SAM7S64_IAR/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_LPC2106_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/ARM7_LPC2106_GCC/FreeRTOSConfig.h index 27e1e9c55be..e384a613b05 100644 --- a/FreeRTOS/Demo/ARM7_LPC2106_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/ARM7_LPC2106_GCC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_LPC2106_GCC/ParTest/ParTest.c b/FreeRTOS/Demo/ARM7_LPC2106_GCC/ParTest/ParTest.c index 0a91c7e9e4d..0cc79a5dd91 100644 --- a/FreeRTOS/Demo/ARM7_LPC2106_GCC/ParTest/ParTest.c +++ b/FreeRTOS/Demo/ARM7_LPC2106_GCC/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_LPC2106_GCC/main.c b/FreeRTOS/Demo/ARM7_LPC2106_GCC/main.c index 01b78ec963a..14b71173ae8 100644 --- a/FreeRTOS/Demo/ARM7_LPC2106_GCC/main.c +++ b/FreeRTOS/Demo/ARM7_LPC2106_GCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -25,12 +25,12 @@ */ /* - NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. - The processor MUST be in supervisor mode when vTaskStartScheduler is - called. The demo applications included in the FreeRTOS.org download switch - to supervisor mode prior to main being called. If you are not using one of - these demo application projects then ensure Supervisor mode is used. -*/ + * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + * The processor MUST be in supervisor mode when vTaskStartScheduler is + * called. The demo applications included in the FreeRTOS.org download switch + * to supervisor mode prior to main being called. If you are not using one of + * these demo application projects then ensure Supervisor mode is used. + */ /* @@ -58,16 +58,16 @@ */ /* - Changes from V2.4.2 - - + The vErrorChecks() task now dynamically creates then deletes a task each - cycle. This tests the operation of the memory allocator. - - Changes from V2.5.2 - - + vParTestInitialise() is called during initialisation to ensure all the - LED's start off. -*/ + * Changes from V2.4.2 + * + + The vErrorChecks() task now dynamically creates then deletes a task each + + cycle. This tests the operation of the memory allocator. + + + + Changes from V2.5.2 + + + + vParTestInitialise() is called during initialisation to ensure all the + + LED's start off. + */ /* Standard includes. */ @@ -93,53 +93,53 @@ /*-----------------------------------------------------------*/ /* Constants to setup I/O. */ -#define mainTX_ENABLE ( ( unsigned long ) 0x0001 ) -#define mainRX_ENABLE ( ( unsigned long ) 0x0004 ) -#define mainP0_14 ( ( unsigned long ) 0x4000 ) -#define mainJTAG_PORT ( ( unsigned long ) 0x3E0000UL ) +#define mainTX_ENABLE ( ( unsigned long ) 0x0001 ) +#define mainRX_ENABLE ( ( unsigned long ) 0x0004 ) +#define mainP0_14 ( ( unsigned long ) 0x4000 ) +#define mainJTAG_PORT ( ( unsigned long ) 0x3E0000UL ) /* Constants to setup the PLL. */ -#define mainPLL_MUL_4 ( ( unsigned char ) 0x0003 ) -#define mainPLL_DIV_1 ( ( unsigned char ) 0x0000 ) -#define mainPLL_ENABLE ( ( unsigned char ) 0x0001 ) -#define mainPLL_CONNECT ( ( unsigned char ) 0x0003 ) -#define mainPLL_FEED_BYTE1 ( ( unsigned char ) 0xaa ) -#define mainPLL_FEED_BYTE2 ( ( unsigned char ) 0x55 ) -#define mainPLL_LOCK ( ( unsigned long ) 0x0400 ) +#define mainPLL_MUL_4 ( ( unsigned char ) 0x0003 ) +#define mainPLL_DIV_1 ( ( unsigned char ) 0x0000 ) +#define mainPLL_ENABLE ( ( unsigned char ) 0x0001 ) +#define mainPLL_CONNECT ( ( unsigned char ) 0x0003 ) +#define mainPLL_FEED_BYTE1 ( ( unsigned char ) 0xaa ) +#define mainPLL_FEED_BYTE2 ( ( unsigned char ) 0x55 ) +#define mainPLL_LOCK ( ( unsigned long ) 0x0400 ) /* Constants to setup the MAM. */ -#define mainMAM_TIM_3 ( ( unsigned char ) 0x03 ) -#define mainMAM_MODE_FULL ( ( unsigned char ) 0x02 ) +#define mainMAM_TIM_3 ( ( unsigned char ) 0x03 ) +#define mainMAM_MODE_FULL ( ( unsigned char ) 0x02 ) /* Constants to setup the peripheral bus. */ -#define mainBUS_CLK_FULL ( ( unsigned char ) 0x01 ) +#define mainBUS_CLK_FULL ( ( unsigned char ) 0x01 ) /* Constants for the ComTest tasks. */ -#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 ) -#define mainCOM_TEST_LED ( 3 ) +#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 ) +#define mainCOM_TEST_LED ( 3 ) /* Priorities for the demo application tasks. */ -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 0 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 0 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 0 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 0 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* The rate at which the on board LED will toggle when there is/is not an -error. */ -#define mainNO_ERROR_FLASH_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) -#define mainERROR_FLASH_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) -#define mainON_BOARD_LED_BIT ( ( unsigned long ) 0x80 ) + * error. */ +#define mainNO_ERROR_FLASH_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainERROR_FLASH_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) +#define mainON_BOARD_LED_BIT ( ( unsigned long ) 0x80 ) /* Constants used by the vMemCheckTask() task. */ -#define mainCOUNT_INITIAL_VALUE ( ( unsigned long ) 0 ) -#define mainNO_TASK ( 0 ) +#define mainCOUNT_INITIAL_VALUE ( ( unsigned long ) 0 ) +#define mainNO_TASK ( 0 ) /* The size of the memory blocks allocated by the vMemCheckTask() task. */ -#define mainMEM_CHECK_SIZE_1 ( ( size_t ) 51 ) -#define mainMEM_CHECK_SIZE_2 ( ( size_t ) 52 ) -#define mainMEM_CHECK_SIZE_3 ( ( size_t ) 151 ) +#define mainMEM_CHECK_SIZE_1 ( ( size_t ) 51 ) +#define mainMEM_CHECK_SIZE_2 ( ( size_t ) 52 ) +#define mainMEM_CHECK_SIZE_3 ( ( size_t ) 151 ) /*-----------------------------------------------------------*/ @@ -160,14 +160,14 @@ static long prvCheckOtherTasksAreStillRunning( unsigned long ulMemCheckTaskCount * prvCheckOtherTasksAreStillRunning(). See the description at the top * of the file. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * Dynamically created and deleted during each cycle of the vErrorChecks() * task. This is done to check the operation of the memory allocator. * See the top of vErrorChecks for more details. */ -static void vMemCheckTask( void *pvParameters ); +static void vMemCheckTask( void * pvParameters ); /* * Configure the processor for use with the Olimex demo board. This includes @@ -182,288 +182,291 @@ static void prvSetupHardware( void ); */ int main( void ) { - /* Setup the hardware for use with the Olimex demo board. */ - prvSetupHardware(); - - /* Start the demo/test application tasks. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartMathTasks( tskIDLE_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartDynamicPriorityTasks(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - - /* Start the check task - which is defined in this file. */ - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - - /* Now all the tasks have been started - start the scheduler. - - NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. - The processor MUST be in supervisor mode when vTaskStartScheduler is - called. The demo applications included in the FreeRTOS.org download switch - to supervisor mode prior to main being called. If you are not using one of - these demo application projects then ensure Supervisor mode is used here. */ - vTaskStartScheduler(); - - /* Should never reach here! */ - return 0; + /* Setup the hardware for use with the Olimex demo board. */ + prvSetupHardware(); + + /* Start the demo/test application tasks. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartMathTasks( tskIDLE_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartDynamicPriorityTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + + /* Start the check task - which is defined in this file. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + + /* Now all the tasks have been started - start the scheduler. + * + * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + * The processor MUST be in supervisor mode when vTaskStartScheduler is + * called. The demo applications included in the FreeRTOS.org download switch + * to supervisor mode prior to main being called. If you are not using one of + * these demo application projects then ensure Supervisor mode is used here. */ + vTaskStartScheduler(); + + /* Should never reach here! */ + return 0; } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD; -unsigned long ulMemCheckTaskRunningCount; -TaskHandle_t xCreatedTask; - - /* The parameters are not used in this function. */ - ( void ) pvParameters; - - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. If an error is detected then the delay period - is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so - the on board LED flash rate will increase. - - In addition to the standard tests the memory allocator is tested through - the dynamic creation and deletion of a task each cycle. Each time the - task is created memory must be allocated for its stack. When the task is - deleted this memory is returned to the heap. If the task cannot be created - then it is likely that the memory allocation failed. */ - - for( ;; ) - { - /* Dynamically create a task - passing ulMemCheckTaskRunningCount as a - parameter. */ - ulMemCheckTaskRunningCount = mainCOUNT_INITIAL_VALUE; - xCreatedTask = mainNO_TASK; - - if( xTaskCreate( vMemCheckTask, "MEM_CHECK", configMINIMAL_STACK_SIZE, ( void * ) &ulMemCheckTaskRunningCount, tskIDLE_PRIORITY, &xCreatedTask ) != pdPASS ) - { - /* Could not create the task - we have probably run out of heap. */ - xDelayPeriod = mainERROR_FLASH_PERIOD; - } - - /* Delay until it is time to execute again. */ - vTaskDelay( xDelayPeriod ); - - /* Delete the dynamically created task. */ - if( xCreatedTask != mainNO_TASK ) - { - vTaskDelete( xCreatedTask ); - } - - /* Check all the standard demo application tasks are executing without - error. ulMemCheckTaskRunningCount is checked to ensure it was - modified by the task just deleted. */ - if( prvCheckOtherTasksAreStillRunning( ulMemCheckTaskRunningCount ) != pdPASS ) - { - /* An error has been detected in one of the tasks - flash faster. */ - xDelayPeriod = mainERROR_FLASH_PERIOD; - } - - prvToggleOnBoardLED(); - } + TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD; + unsigned long ulMemCheckTaskRunningCount; + TaskHandle_t xCreatedTask; + + /* The parameters are not used in this function. */ + ( void ) pvParameters; + + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. If an error is detected then the delay period + * is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so + * the on board LED flash rate will increase. + * + * In addition to the standard tests the memory allocator is tested through + * the dynamic creation and deletion of a task each cycle. Each time the + * task is created memory must be allocated for its stack. When the task is + * deleted this memory is returned to the heap. If the task cannot be created + * then it is likely that the memory allocation failed. */ + + for( ; ; ) + { + /* Dynamically create a task - passing ulMemCheckTaskRunningCount as a + * parameter. */ + ulMemCheckTaskRunningCount = mainCOUNT_INITIAL_VALUE; + xCreatedTask = mainNO_TASK; + + if( xTaskCreate( vMemCheckTask, "MEM_CHECK", configMINIMAL_STACK_SIZE, ( void * ) &ulMemCheckTaskRunningCount, tskIDLE_PRIORITY, &xCreatedTask ) != pdPASS ) + { + /* Could not create the task - we have probably run out of heap. */ + xDelayPeriod = mainERROR_FLASH_PERIOD; + } + + /* Delay until it is time to execute again. */ + vTaskDelay( xDelayPeriod ); + + /* Delete the dynamically created task. */ + if( xCreatedTask != mainNO_TASK ) + { + vTaskDelete( xCreatedTask ); + } + + /* Check all the standard demo application tasks are executing without + * error. ulMemCheckTaskRunningCount is checked to ensure it was + * modified by the task just deleted. */ + if( prvCheckOtherTasksAreStillRunning( ulMemCheckTaskRunningCount ) != pdPASS ) + { + /* An error has been detected in one of the tasks - flash faster. */ + xDelayPeriod = mainERROR_FLASH_PERIOD; + } + + prvToggleOnBoardLED(); + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - #ifdef RUN_FROM_RAM - /* Remap the interrupt vectors to RAM if we are are running from RAM. */ - SCB_MEMMAP = 2; - #endif - - /* Configure the RS2332 pins. All other pins remain at their default of 0. */ - PCB_PINSEL0 |= mainTX_ENABLE; - PCB_PINSEL0 |= mainRX_ENABLE; - - /* Set all GPIO to output other than the P0.14 (BSL), and the JTAG pins. - The JTAG pins are left as input as I'm not sure what will happen if the - Wiggler is connected after powerup - not that it would be a good idea to - do that anyway. */ - GPIO_IODIR = ~( mainP0_14 + mainJTAG_PORT ); - - /* Setup the PLL to multiply the XTAL input by 4. */ - SCB_PLLCFG = ( mainPLL_MUL_4 | mainPLL_DIV_1 ); - - /* Activate the PLL by turning it on then feeding the correct sequence of - bytes. */ - SCB_PLLCON = mainPLL_ENABLE; - SCB_PLLFEED = mainPLL_FEED_BYTE1; - SCB_PLLFEED = mainPLL_FEED_BYTE2; - - /* Wait for the PLL to lock... */ - while( !( SCB_PLLSTAT & mainPLL_LOCK ) ); - - /* ...before connecting it using the feed sequence again. */ - SCB_PLLCON = mainPLL_CONNECT; - SCB_PLLFEED = mainPLL_FEED_BYTE1; - SCB_PLLFEED = mainPLL_FEED_BYTE2; - - /* Setup and turn on the MAM. Three cycle access is used due to the fast - PLL used. It is possible faster overall performance could be obtained by - tuning the MAM and PLL settings. */ - MAM_TIM = mainMAM_TIM_3; - MAM_CR = mainMAM_MODE_FULL; - - /* Setup the peripheral bus to be the same as the PLL output. */ - SCB_VPBDIV = mainBUS_CLK_FULL; - - /* Initialise LED outputs. */ - vParTestInitialise(); + #ifdef RUN_FROM_RAM + /* Remap the interrupt vectors to RAM if we are are running from RAM. */ + SCB_MEMMAP = 2; + #endif + + /* Configure the RS2332 pins. All other pins remain at their default of 0. */ + PCB_PINSEL0 |= mainTX_ENABLE; + PCB_PINSEL0 |= mainRX_ENABLE; + + /* Set all GPIO to output other than the P0.14 (BSL), and the JTAG pins. + * The JTAG pins are left as input as I'm not sure what will happen if the + * Wiggler is connected after powerup - not that it would be a good idea to + * do that anyway. */ + GPIO_IODIR = ~( mainP0_14 + mainJTAG_PORT ); + + /* Setup the PLL to multiply the XTAL input by 4. */ + SCB_PLLCFG = ( mainPLL_MUL_4 | mainPLL_DIV_1 ); + + /* Activate the PLL by turning it on then feeding the correct sequence of + * bytes. */ + SCB_PLLCON = mainPLL_ENABLE; + SCB_PLLFEED = mainPLL_FEED_BYTE1; + SCB_PLLFEED = mainPLL_FEED_BYTE2; + + /* Wait for the PLL to lock... */ + while( !( SCB_PLLSTAT & mainPLL_LOCK ) ) + { + } + + /* ...before connecting it using the feed sequence again. */ + SCB_PLLCON = mainPLL_CONNECT; + SCB_PLLFEED = mainPLL_FEED_BYTE1; + SCB_PLLFEED = mainPLL_FEED_BYTE2; + + /* Setup and turn on the MAM. Three cycle access is used due to the fast + * PLL used. It is possible faster overall performance could be obtained by + * tuning the MAM and PLL settings. */ + MAM_TIM = mainMAM_TIM_3; + MAM_CR = mainMAM_MODE_FULL; + + /* Setup the peripheral bus to be the same as the PLL output. */ + SCB_VPBDIV = mainBUS_CLK_FULL; + + /* Initialise LED outputs. */ + vParTestInitialise(); } /*-----------------------------------------------------------*/ void prvToggleOnBoardLED( void ) { -unsigned long ulState; - - ulState = GPIO0_IOPIN; - if( ulState & mainON_BOARD_LED_BIT ) - { - GPIO_IOCLR = mainON_BOARD_LED_BIT; - } - else - { - GPIO_IOSET = mainON_BOARD_LED_BIT; - } + unsigned long ulState; + + ulState = GPIO0_IOPIN; + + if( ulState & mainON_BOARD_LED_BIT ) + { + GPIO_IOCLR = mainON_BOARD_LED_BIT; + } + else + { + GPIO_IOSET = mainON_BOARD_LED_BIT; + } } /*-----------------------------------------------------------*/ static long prvCheckOtherTasksAreStillRunning( unsigned long ulMemCheckTaskCount ) { -long lReturn = ( long ) pdPASS; - - /* Check all the demo tasks (other than the flash tasks) to ensure - that they are all still running, and that none of them have detected - an error. */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreMathsTaskStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( ulMemCheckTaskCount == mainCOUNT_INITIAL_VALUE ) - { - /* The vMemCheckTask did not increment the counter - it must - have failed. */ - lReturn = ( long ) pdFAIL; - } - - return lReturn; + long lReturn = ( long ) pdPASS; + + /* Check all the demo tasks (other than the flash tasks) to ensure + * that they are all still running, and that none of them have detected + * an error. */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreMathsTaskStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( ulMemCheckTaskCount == mainCOUNT_INITIAL_VALUE ) + { + /* The vMemCheckTask did not increment the counter - it must + * have failed. */ + lReturn = ( long ) pdFAIL; + } + + return lReturn; } /*-----------------------------------------------------------*/ -static void vMemCheckTask( void *pvParameters ) +static void vMemCheckTask( void * pvParameters ) { -unsigned long *pulMemCheckTaskRunningCounter; -void *pvMem1, *pvMem2, *pvMem3; -static long lErrorOccurred = pdFALSE; - - /* This task is dynamically created then deleted during each cycle of the - vErrorChecks task to check the operation of the memory allocator. Each time - the task is created memory is allocated for the stack and TCB. Each time - the task is deleted this memory is returned to the heap. This task itself - exercises the allocator by allocating and freeing blocks. - - The task executes at the idle priority so does not require a delay. - - pulMemCheckTaskRunningCounter is incremented each cycle to indicate to the - vErrorChecks() task that this task is still executing without error. */ - - pulMemCheckTaskRunningCounter = ( unsigned long * ) pvParameters; - - for( ;; ) - { - if( lErrorOccurred == pdFALSE ) - { - /* We have never seen an error so increment the counter. */ - ( *pulMemCheckTaskRunningCounter )++; - } - - /* Allocate some memory - just to give the allocator some extra - exercise. This has to be in a critical section to ensure the - task does not get deleted while it has memory allocated. */ - vTaskSuspendAll(); - { - pvMem1 = pvPortMalloc( mainMEM_CHECK_SIZE_1 ); - if( pvMem1 == NULL ) - { - lErrorOccurred = pdTRUE; - } - else - { - memset( pvMem1, 0xaa, mainMEM_CHECK_SIZE_1 ); - vPortFree( pvMem1 ); - } - } - xTaskResumeAll(); - - /* Again - with a different size block. */ - vTaskSuspendAll(); - { - pvMem2 = pvPortMalloc( mainMEM_CHECK_SIZE_2 ); - if( pvMem2 == NULL ) - { - lErrorOccurred = pdTRUE; - } - else - { - memset( pvMem2, 0xaa, mainMEM_CHECK_SIZE_2 ); - vPortFree( pvMem2 ); - } - } - xTaskResumeAll(); - - /* Again - with a different size block. */ - vTaskSuspendAll(); - { - pvMem3 = pvPortMalloc( mainMEM_CHECK_SIZE_3 ); - if( pvMem3 == NULL ) - { - lErrorOccurred = pdTRUE; - } - else - { - memset( pvMem3, 0xaa, mainMEM_CHECK_SIZE_3 ); - vPortFree( pvMem3 ); - } - } - xTaskResumeAll(); - } + unsigned long * pulMemCheckTaskRunningCounter; + void * pvMem1, * pvMem2, * pvMem3; + static long lErrorOccurred = pdFALSE; + + /* This task is dynamically created then deleted during each cycle of the + * vErrorChecks task to check the operation of the memory allocator. Each time + * the task is created memory is allocated for the stack and TCB. Each time + * the task is deleted this memory is returned to the heap. This task itself + * exercises the allocator by allocating and freeing blocks. + * + * The task executes at the idle priority so does not require a delay. + * + * pulMemCheckTaskRunningCounter is incremented each cycle to indicate to the + * vErrorChecks() task that this task is still executing without error. */ + + pulMemCheckTaskRunningCounter = ( unsigned long * ) pvParameters; + + for( ; ; ) + { + if( lErrorOccurred == pdFALSE ) + { + /* We have never seen an error so increment the counter. */ + ( *pulMemCheckTaskRunningCounter )++; + } + + /* Allocate some memory - just to give the allocator some extra + * exercise. This has to be in a critical section to ensure the + * task does not get deleted while it has memory allocated. */ + vTaskSuspendAll(); + { + pvMem1 = pvPortMalloc( mainMEM_CHECK_SIZE_1 ); + + if( pvMem1 == NULL ) + { + lErrorOccurred = pdTRUE; + } + else + { + memset( pvMem1, 0xaa, mainMEM_CHECK_SIZE_1 ); + vPortFree( pvMem1 ); + } + } + xTaskResumeAll(); + + /* Again - with a different size block. */ + vTaskSuspendAll(); + { + pvMem2 = pvPortMalloc( mainMEM_CHECK_SIZE_2 ); + + if( pvMem2 == NULL ) + { + lErrorOccurred = pdTRUE; + } + else + { + memset( pvMem2, 0xaa, mainMEM_CHECK_SIZE_2 ); + vPortFree( pvMem2 ); + } + } + xTaskResumeAll(); + + /* Again - with a different size block. */ + vTaskSuspendAll(); + { + pvMem3 = pvPortMalloc( mainMEM_CHECK_SIZE_3 ); + + if( pvMem3 == NULL ) + { + lErrorOccurred = pdTRUE; + } + else + { + memset( pvMem3, 0xaa, mainMEM_CHECK_SIZE_3 ); + vPortFree( pvMem3 ); + } + } + xTaskResumeAll(); + } } - - - diff --git a/FreeRTOS/Demo/ARM7_LPC2106_GCC/serial/serial.c b/FreeRTOS/Demo/ARM7_LPC2106_GCC/serial/serial.c index c5a7eaca8d0..2fad57072aa 100644 --- a/FreeRTOS/Demo/ARM7_LPC2106_GCC/serial/serial.c +++ b/FreeRTOS/Demo/ARM7_LPC2106_GCC/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_LPC2106_GCC/serial/serialISR.c b/FreeRTOS/Demo/ARM7_LPC2106_GCC/serial/serialISR.c index 1a4762fbe93..baa625ea136 100644 --- a/FreeRTOS/Demo/ARM7_LPC2106_GCC/serial/serialISR.c +++ b/FreeRTOS/Demo/ARM7_LPC2106_GCC/serial/serialISR.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_LPC2129_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/ARM7_LPC2129_IAR/FreeRTOSConfig.h index 2402ab62750..1afd1f50ace 100644 --- a/FreeRTOS/Demo/ARM7_LPC2129_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/ARM7_LPC2129_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_LPC2129_IAR/ParTest/ParTest.c b/FreeRTOS/Demo/ARM7_LPC2129_IAR/ParTest/ParTest.c index 2097204e99d..ea1bc0892d7 100644 --- a/FreeRTOS/Demo/ARM7_LPC2129_IAR/ParTest/ParTest.c +++ b/FreeRTOS/Demo/ARM7_LPC2129_IAR/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_LPC2129_IAR/main.c b/FreeRTOS/Demo/ARM7_LPC2129_IAR/main.c index 7bb5f826cd4..a0954a8c672 100644 --- a/FreeRTOS/Demo/ARM7_LPC2129_IAR/main.c +++ b/FreeRTOS/Demo/ARM7_LPC2129_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -26,12 +26,12 @@ /* - NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. - The processor MUST be in supervisor mode when vTaskStartScheduler is - called. The demo applications included in the FreeRTOS.org download switch - to supervisor mode prior to main being called. If you are not using one of - these demo application projects then ensure Supervisor mode is used. -*/ + * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + * The processor MUST be in supervisor mode when vTaskStartScheduler is + * called. The demo applications included in the FreeRTOS.org download switch + * to supervisor mode prior to main being called. If you are not using one of + * these demo application projects then ensure Supervisor mode is used. + */ /* @@ -70,49 +70,49 @@ #include "comtest2.h" /* Priorities for the demo application tasks. */ -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* Constants required by the 'Check' task. */ -#define mainNO_ERROR_FLASH_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) -#define mainERROR_FLASH_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) -#define mainCHECK_TASK_LED ( 7 ) +#define mainNO_ERROR_FLASH_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainERROR_FLASH_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) +#define mainCHECK_TASK_LED ( 7 ) /* Constants for the ComTest tasks. */ -#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 ) -#define mainCOM_TEST_LED ( 4 ) -#define mainTX_ENABLE ( ( unsigned long ) 0x0001 ) -#define mainRX_ENABLE ( ( unsigned long ) 0x0004 ) +#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 ) +#define mainCOM_TEST_LED ( 4 ) +#define mainTX_ENABLE ( ( unsigned long ) 0x0001 ) +#define mainRX_ENABLE ( ( unsigned long ) 0x0004 ) /* Constants to setup the PLL. */ -#define mainPLL_MUL_5 ( ( unsigned char ) 0x0004 ) -#define mainPLL_DIV_1 ( ( unsigned char ) 0x0000 ) -#define mainPLL_ENABLE ( ( unsigned char ) 0x0001 ) -#define mainPLL_CONNECT ( ( unsigned char ) 0x0003 ) -#define mainPLL_FEED_BYTE1 ( ( unsigned char ) 0xaa ) -#define mainPLL_FEED_BYTE2 ( ( unsigned char ) 0x55 ) -#define mainPLL_LOCK ( ( unsigned long ) 0x0400 ) +#define mainPLL_MUL_5 ( ( unsigned char ) 0x0004 ) +#define mainPLL_DIV_1 ( ( unsigned char ) 0x0000 ) +#define mainPLL_ENABLE ( ( unsigned char ) 0x0001 ) +#define mainPLL_CONNECT ( ( unsigned char ) 0x0003 ) +#define mainPLL_FEED_BYTE1 ( ( unsigned char ) 0xaa ) +#define mainPLL_FEED_BYTE2 ( ( unsigned char ) 0x55 ) +#define mainPLL_LOCK ( ( unsigned long ) 0x0400 ) /* Constants to setup the MAM. */ -#define mainMAM_TIM_3 ( ( unsigned char ) 0x03 ) -#define mainMAM_MODE_FULL ( ( unsigned char ) 0x02 ) +#define mainMAM_TIM_3 ( ( unsigned char ) 0x03 ) +#define mainMAM_MODE_FULL ( ( unsigned char ) 0x02 ) /* Constants to setup the peripheral bus. */ -#define mainBUS_CLK_FULL ( ( unsigned char ) 0x01 ) +#define mainBUS_CLK_FULL ( ( unsigned char ) 0x01 ) /* And finally, constant to setup the port for the LED's. */ -#define mainLED_TO_OUTPUT ( ( unsigned long ) 0xff0000 ) +#define mainLED_TO_OUTPUT ( ( unsigned long ) 0xff0000 ) /* * The task that executes at the highest priority and calls * prvCheckOtherTasksAreStillRunning(). See the description at the top * of the file. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * Configures the processor for use with this demo. @@ -133,146 +133,145 @@ static long prvCheckOtherTasksAreStillRunning( void ); */ void main( void ) { - /* Setup the processor. */ - prvSetupHardware(); - - /* Start all the standard demo application tasks. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vStartDynamicPriorityTasks(); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - - /* Start the check task - which is defined in this file. */ - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - - /* Start the scheduler. - - NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. - The processor MUST be in supervisor mode when vTaskStartScheduler is - called. The demo applications included in the FreeRTOS.org download switch - to supervisor mode prior to main being called. If you are not using one of - these demo application projects then ensure Supervisor mode is used here. - */ - vTaskStartScheduler(); - - /* We should never get here as control is now taken by the scheduler. */ - return; + /* Setup the processor. */ + prvSetupHardware(); + + /* Start all the standard demo application tasks. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vStartDynamicPriorityTasks(); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + + /* Start the check task - which is defined in this file. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + + /* Start the scheduler. + * + * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + * The processor MUST be in supervisor mode when vTaskStartScheduler is + * called. The demo applications included in the FreeRTOS.org download switch + * to supervisor mode prior to main being called. If you are not using one of + * these demo application projects then ensure Supervisor mode is used here. + */ + vTaskStartScheduler(); + + /* We should never get here as control is now taken by the scheduler. */ } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Setup the PLL to multiply the XTAL input by 5. */ - PLLCFG = ( mainPLL_MUL_5 | mainPLL_DIV_1 ); - - /* Activate the PLL by turning it on then feeding the correct sequence of - bytes. */ - PLLCON = mainPLL_ENABLE; - PLLFEED = mainPLL_FEED_BYTE1; - PLLFEED = mainPLL_FEED_BYTE2; - - /* Wait for the PLL to lock... */ - while( !( PLLSTAT & mainPLL_LOCK ) ); - - /* ...before connecting it using the feed sequence again. */ - PLLCON = mainPLL_CONNECT; - PLLFEED = mainPLL_FEED_BYTE1; - PLLFEED = mainPLL_FEED_BYTE2; - - /* Setup and turn on the MAM. Three cycle access is used due to the fast - PLL used. It is possible faster overall performance could be obtained by - tuning the MAM and PLL settings. */ - MAMTIM = mainMAM_TIM_3; - MAMCR = mainMAM_MODE_FULL; - - /* Setup the peripheral bus to be the same as the PLL output. */ - APBDIV = mainBUS_CLK_FULL; - - /* Configure the RS2332 pins. All other pins remain at their default of 0. */ - PINSEL0 |= mainTX_ENABLE; - PINSEL0 |= mainRX_ENABLE; - - /* LED pins need to be output. */ - IO1DIR = mainLED_TO_OUTPUT; - - /* Setup the peripheral bus to be the same as the PLL output. */ - APBDIV = mainBUS_CLK_FULL; + /* Setup the PLL to multiply the XTAL input by 5. */ + PLLCFG = ( mainPLL_MUL_5 | mainPLL_DIV_1 ); + + /* Activate the PLL by turning it on then feeding the correct sequence of + * bytes. */ + PLLCON = mainPLL_ENABLE; + PLLFEED = mainPLL_FEED_BYTE1; + PLLFEED = mainPLL_FEED_BYTE2; + + /* Wait for the PLL to lock... */ + while( !( PLLSTAT & mainPLL_LOCK ) ) + { + } + + /* ...before connecting it using the feed sequence again. */ + PLLCON = mainPLL_CONNECT; + PLLFEED = mainPLL_FEED_BYTE1; + PLLFEED = mainPLL_FEED_BYTE2; + + /* Setup and turn on the MAM. Three cycle access is used due to the fast + * PLL used. It is possible faster overall performance could be obtained by + * tuning the MAM and PLL settings. */ + MAMTIM = mainMAM_TIM_3; + MAMCR = mainMAM_MODE_FULL; + + /* Setup the peripheral bus to be the same as the PLL output. */ + APBDIV = mainBUS_CLK_FULL; + + /* Configure the RS2332 pins. All other pins remain at their default of 0. */ + PINSEL0 |= mainTX_ENABLE; + PINSEL0 |= mainRX_ENABLE; + + /* LED pins need to be output. */ + IO1DIR = mainLED_TO_OUTPUT; + + /* Setup the peripheral bus to be the same as the PLL output. */ + APBDIV = mainBUS_CLK_FULL; } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD; - - /* The parameters are not used in this task. */ - ( void ) pvParameters; - - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. If an error is detected then the delay period - is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so - the on board LED flash rate will increase. */ - - for( ;; ) - { - /* Delay until it is time to execute again. */ - vTaskDelay( xDelayPeriod ); - - /* Check all the standard demo application tasks are executing without - error. */ - if( prvCheckOtherTasksAreStillRunning() != pdPASS ) - { - /* An error has been detected in one of the tasks - flash faster. */ - xDelayPeriod = mainERROR_FLASH_PERIOD; - } - - vParTestToggleLED( mainCHECK_TASK_LED ); - } + TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD; + + /* The parameters are not used in this task. */ + ( void ) pvParameters; + + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. If an error is detected then the delay period + * is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so + * the on board LED flash rate will increase. */ + + for( ; ; ) + { + /* Delay until it is time to execute again. */ + vTaskDelay( xDelayPeriod ); + + /* Check all the standard demo application tasks are executing without + * error. */ + if( prvCheckOtherTasksAreStillRunning() != pdPASS ) + { + /* An error has been detected in one of the tasks - flash faster. */ + xDelayPeriod = mainERROR_FLASH_PERIOD; + } + + vParTestToggleLED( mainCHECK_TASK_LED ); + } } /*-----------------------------------------------------------*/ static long prvCheckOtherTasksAreStillRunning( void ) { -long lReturn = ( long ) pdPASS; - - /* Check all the demo tasks (other than the flash tasks) to ensure - that they are all still running, and that none of them have detected - an error. */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - return lReturn; + long lReturn = ( long ) pdPASS; + + /* Check all the demo tasks (other than the flash tasks) to ensure + * that they are all still running, and that none of them have detected + * an error. */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + return lReturn; } /*-----------------------------------------------------------*/ - - diff --git a/FreeRTOS/Demo/ARM7_LPC2129_IAR/serial/serial.c b/FreeRTOS/Demo/ARM7_LPC2129_IAR/serial/serial.c index 8485c962c1c..3820f6e1364 100644 --- a/FreeRTOS/Demo/ARM7_LPC2129_IAR/serial/serial.c +++ b/FreeRTOS/Demo/ARM7_LPC2129_IAR/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_LPC2129_Keil_RVDS/FreeRTOSConfig.h b/FreeRTOS/Demo/ARM7_LPC2129_Keil_RVDS/FreeRTOSConfig.h index 4c1cd9d0819..a1c46f1ff5c 100644 --- a/FreeRTOS/Demo/ARM7_LPC2129_Keil_RVDS/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/ARM7_LPC2129_Keil_RVDS/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_LPC2129_Keil_RVDS/ParTest/ParTest.c b/FreeRTOS/Demo/ARM7_LPC2129_Keil_RVDS/ParTest/ParTest.c index 7c9b057abbd..056418c3151 100644 --- a/FreeRTOS/Demo/ARM7_LPC2129_Keil_RVDS/ParTest/ParTest.c +++ b/FreeRTOS/Demo/ARM7_LPC2129_Keil_RVDS/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_LPC2129_Keil_RVDS/main.c b/FreeRTOS/Demo/ARM7_LPC2129_Keil_RVDS/main.c index 386a6fcfab6..30632d37e72 100644 --- a/FreeRTOS/Demo/ARM7_LPC2129_Keil_RVDS/main.c +++ b/FreeRTOS/Demo/ARM7_LPC2129_Keil_RVDS/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -24,29 +24,29 @@ * */ -/* - NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. - The processor MUST be in supervisor mode when vTaskStartScheduler is - called. The demo applications included in the FreeRTOS.org download switch - to supervisor mode prior to main being called. If you are not using one of - these demo application projects then ensure Supervisor mode is used. -*/ +/* + * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + * The processor MUST be in supervisor mode when vTaskStartScheduler is + * called. The demo applications included in the FreeRTOS.org download switch + * to supervisor mode prior to main being called. If you are not using one of + * these demo application projects then ensure Supervisor mode is used. + */ /* * Creates all the demo application tasks, then starts the scheduler. The WEB * documentation provides more details of the demo application tasks. - * - * Main.c also creates a task called "Check". This only executes every three - * seconds but has the highest priority so is guaranteed to get processor time. + * + * Main.c also creates a task called "Check". This only executes every three + * seconds but has the highest priority so is guaranteed to get processor time. * Its main function is to check that all the other tasks are still operational. - * Each task (other than the "flash" tasks) maintains a unique count that is - * incremented each time the task successfully completes its function. Should - * any error occur within such a task the count is permanently halted. The + * Each task (other than the "flash" tasks) maintains a unique count that is + * incremented each time the task successfully completes its function. Should + * any error occur within such a task the count is permanently halted. The * check task inspects the count of each task to ensure it has changed since - * the last time the check task executed. If all the count variables have + * the last time the check task executed. If all the count variables have * changed all the tasks are still executing error free, and the check task - * toggles the onboard LED. Should any task contain an error at any time + * toggles the onboard LED. Should any task contain an error at any time * the LED toggle rate will change from 3 seconds to 500ms. * */ @@ -71,31 +71,31 @@ /*-----------------------------------------------------------*/ /* Constants to setup I/O and processor. */ -#define mainTX_ENABLE ( ( unsigned long ) 0x00010000 ) /* UART1. */ -#define mainRX_ENABLE ( ( unsigned long ) 0x00040000 ) /* UART1. */ -#define mainBUS_CLK_FULL ( ( unsigned char ) 0x01 ) -#define mainLED_TO_OUTPUT ( ( unsigned long ) 0xff0000 ) +#define mainTX_ENABLE ( ( unsigned long ) 0x00010000 ) /* UART1. */ +#define mainRX_ENABLE ( ( unsigned long ) 0x00040000 ) /* UART1. */ +#define mainBUS_CLK_FULL ( ( unsigned char ) 0x01 ) +#define mainLED_TO_OUTPUT ( ( unsigned long ) 0xff0000 ) /* Constants for the ComTest demo application tasks. */ -#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 ) -#define mainCOM_TEST_LED ( 3 ) +#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 ) +#define mainCOM_TEST_LED ( 3 ) /* Priorities for the demo application tasks. */ -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) /* Constants used by the "check" task. As described at the head of this file -the check task toggles an LED. The rate at which the LED flashes is used to -indicate whether an error has been detected or not. If the LED toggles every -3 seconds then no errors have been detected. If the rate increases to 500ms -then an error has been detected in at least one of the demo application tasks. */ -#define mainCHECK_LED ( 7 ) -#define mainNO_ERROR_FLASH_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) -#define mainERROR_FLASH_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) + * the check task toggles an LED. The rate at which the LED flashes is used to + * indicate whether an error has been detected or not. If the LED toggles every + * 3 seconds then no errors have been detected. If the rate increases to 500ms + * then an error has been detected in at least one of the demo application tasks. */ +#define mainCHECK_LED ( 7 ) +#define mainNO_ERROR_FLASH_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainERROR_FLASH_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) /*-----------------------------------------------------------*/ @@ -106,11 +106,11 @@ then an error has been detected in at least one of the demo application tasks. * static long prvCheckOtherTasksAreStillRunning( void ); /* - * The task that executes at the highest priority and calls + * The task that executes at the highest priority and calls * prvCheckOtherTasksAreStillRunning(). See the description at the top * of the file. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * Configure the processor for use with the Keil demo board. This is very @@ -125,125 +125,125 @@ static void prvSetupHardware( void ); /* * Application entry point: - * Starts all the other tasks, then starts the scheduler. + * Starts all the other tasks, then starts the scheduler. */ int main( void ) { - /* Setup the hardware for use with the Keil demo board. */ - prvSetupHardware(); - - /* Start the demo/test application tasks. */ - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartDynamicPriorityTasks(); - - /* Start the check task - which is defined in this file. This is the task - that periodically checks to see that all the other tasks are executing - without error. */ - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - - /* Now all the tasks have been started - start the scheduler. - - NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. - The processor MUST be in supervisor mode when vTaskStartScheduler is - called. The demo applications included in the FreeRTOS.org download switch - to supervisor mode prior to main being called. If you are not using one of - these demo application projects then ensure Supervisor mode is used here. */ - vTaskStartScheduler(); - - /* Should never reach here! If you do then there was not enough heap - available for the idle task to be created. */ - for( ;; ); + /* Setup the hardware for use with the Keil demo board. */ + prvSetupHardware(); + + /* Start the demo/test application tasks. */ + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartDynamicPriorityTasks(); + + /* Start the check task - which is defined in this file. This is the task + * that periodically checks to see that all the other tasks are executing + * without error. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + + /* Now all the tasks have been started - start the scheduler. + * + * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + * The processor MUST be in supervisor mode when vTaskStartScheduler is + * called. The demo applications included in the FreeRTOS.org download switch + * to supervisor mode prior to main being called. If you are not using one of + * these demo application projects then ensure Supervisor mode is used here. */ + vTaskStartScheduler(); + + /* Should never reach here! If you do then there was not enough heap + * available for the idle task to be created. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD; - - /* Parameters are not used. */ - ( void ) pvParameters; - - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. If an error is detected then the delay period - is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so - the on board LED flash rate will increase. - - This task runs at the highest priority. */ - - for( ;; ) - { - /* The period of the delay depends on whether an error has been - detected or not. If an error has been detected then the period - is reduced to increase the LED flash rate. */ - vTaskDelay( xDelayPeriod ); - - if( prvCheckOtherTasksAreStillRunning() != pdPASS ) - { - /* An error has been detected in one of the tasks - flash faster. */ - xDelayPeriod = mainERROR_FLASH_PERIOD; - } - - /* Toggle the LED before going back to wait for the next cycle. */ - vParTestToggleLED( mainCHECK_LED ); - } + TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD; + + /* Parameters are not used. */ + ( void ) pvParameters; + + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. If an error is detected then the delay period + * is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so + * the on board LED flash rate will increase. + * + * This task runs at the highest priority. */ + + for( ; ; ) + { + /* The period of the delay depends on whether an error has been + * detected or not. If an error has been detected then the period + * is reduced to increase the LED flash rate. */ + vTaskDelay( xDelayPeriod ); + + if( prvCheckOtherTasksAreStillRunning() != pdPASS ) + { + /* An error has been detected in one of the tasks - flash faster. */ + xDelayPeriod = mainERROR_FLASH_PERIOD; + } + + /* Toggle the LED before going back to wait for the next cycle. */ + vParTestToggleLED( mainCHECK_LED ); + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Perform the hardware setup required. This is minimal as most of the - setup is managed by the settings in the project file. */ + /* Perform the hardware setup required. This is minimal as most of the + * setup is managed by the settings in the project file. */ - /* Configure the UART1 pins. All other pins remain at their default of 0. */ - PINSEL0 |= mainTX_ENABLE; - PINSEL0 |= mainRX_ENABLE; + /* Configure the UART1 pins. All other pins remain at their default of 0. */ + PINSEL0 |= mainTX_ENABLE; + PINSEL0 |= mainRX_ENABLE; - /* LED pins need to be output. */ - IODIR1 = mainLED_TO_OUTPUT; + /* LED pins need to be output. */ + IODIR1 = mainLED_TO_OUTPUT; - /* Setup the peripheral bus to be the same as the PLL output. */ - VPBDIV = mainBUS_CLK_FULL; + /* Setup the peripheral bus to be the same as the PLL output. */ + VPBDIV = mainBUS_CLK_FULL; } /*-----------------------------------------------------------*/ static long prvCheckOtherTasksAreStillRunning( void ) { -long lReturn = pdPASS; - - /* Check all the demo tasks (other than the flash tasks) to ensure - that they are all still running, and that none of them have detected - an error. */ - if( xAreComTestTasksStillRunning() != pdPASS ) - { - lReturn = pdFAIL; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - lReturn = pdFAIL; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - lReturn = pdFAIL; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - lReturn = pdFAIL; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - lReturn = pdFAIL; - } - - return lReturn; + long lReturn = pdPASS; + + /* Check all the demo tasks (other than the flash tasks) to ensure + * that they are all still running, and that none of them have detected + * an error. */ + if( xAreComTestTasksStillRunning() != pdPASS ) + { + lReturn = pdFAIL; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + lReturn = pdFAIL; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + lReturn = pdFAIL; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + lReturn = pdFAIL; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + lReturn = pdFAIL; + } + + return lReturn; } /*-----------------------------------------------------------*/ - - diff --git a/FreeRTOS/Demo/ARM7_LPC2129_Keil_RVDS/serial/serial.c b/FreeRTOS/Demo/ARM7_LPC2129_Keil_RVDS/serial/serial.c index 74a7bd75291..a155913f0da 100644 --- a/FreeRTOS/Demo/ARM7_LPC2129_Keil_RVDS/serial/serial.c +++ b/FreeRTOS/Demo/ARM7_LPC2129_Keil_RVDS/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_LPC2138_Rowley/FreeRTOSConfig.h b/FreeRTOS/Demo/ARM7_LPC2138_Rowley/FreeRTOSConfig.h index 3c5e696f2f0..d712fbd6c0a 100644 --- a/FreeRTOS/Demo/ARM7_LPC2138_Rowley/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/ARM7_LPC2138_Rowley/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_LPC2138_Rowley/main.c b/FreeRTOS/Demo/ARM7_LPC2138_Rowley/main.c index 6c8b9d4456e..6970901982a 100644 --- a/FreeRTOS/Demo/ARM7_LPC2138_Rowley/main.c +++ b/FreeRTOS/Demo/ARM7_LPC2138_Rowley/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -75,51 +75,51 @@ #include "semtest.h" /* Hardware configuration definitions. */ -#define mainBUS_CLK_FULL ( ( unsigned char ) 0x01 ) -#define mainLED_BIT 0x80000000 -#define mainP0_14__EINT_1 ( 2 << 28 ) -#define mainEINT_1_EDGE_SENSITIVE 2 -#define mainEINT_1_FALLING_EDGE_SENSITIVE 0 -#define mainEINT_1_CHANNEL 15 -#define mainEINT_1_VIC_CHANNEL_BIT ( 1 << mainEINT_1_CHANNEL ) -#define mainEINT_1_ENABLE_BIT ( 1 << 5 ) +#define mainBUS_CLK_FULL ( ( unsigned char ) 0x01 ) +#define mainLED_BIT 0x80000000 +#define mainP0_14__EINT_1 ( 2 << 28 ) +#define mainEINT_1_EDGE_SENSITIVE 2 +#define mainEINT_1_FALLING_EDGE_SENSITIVE 0 +#define mainEINT_1_CHANNEL 15 +#define mainEINT_1_VIC_CHANNEL_BIT ( 1 << mainEINT_1_CHANNEL ) +#define mainEINT_1_ENABLE_BIT ( 1 << 5 ) /* Demo application definitions. */ -#define mainQUEUE_SIZE ( 3 ) -#define mainLED_DELAY ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) -#define mainERROR_LED_DELAY ( ( TickType_t ) 50 / portTICK_PERIOD_MS ) -#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) -#define mainLIST_BUFFER_SIZE 2048 -#define mainNO_DELAY ( 0 ) -#define mainSHORT_DELAY ( 150 / portTICK_PERIOD_MS ) +#define mainQUEUE_SIZE ( 3 ) +#define mainLED_DELAY ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) +#define mainERROR_LED_DELAY ( ( TickType_t ) 50 / portTICK_PERIOD_MS ) +#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) +#define mainLIST_BUFFER_SIZE 2048 +#define mainNO_DELAY ( 0 ) +#define mainSHORT_DELAY ( 150 / portTICK_PERIOD_MS ) /* Task priorities. */ -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainPRINT_TASK_PRIORITY ( tskIDLE_PRIORITY + 0 ) +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainPRINT_TASK_PRIORITY ( tskIDLE_PRIORITY + 0 ) /*-----------------------------------------------------------*/ /* The semaphore used to wake the button task from within the external interrupt -handler. */ + * handler. */ SemaphoreHandle_t xButtonSemaphore; /* The queue that is used to send message to vPrintTask for display in the -terminal output window. */ + * terminal output window. */ QueueHandle_t xPrintQueue; /* The rate at which the LED will toggle. The toggle rate increases if an -error is detected in any task. */ + * error is detected in any task. */ static TickType_t xLED_Delay = mainLED_DELAY; /*-----------------------------------------------------------*/ /* * Simply flashes the on board LED every mainLED_DELAY milliseconds. */ -static void vLEDTask( void *pvParameters ); +static void vLEDTask( void * pvParameters ); /* * Checks the status of all the demo tasks then prints a message to the @@ -130,250 +130,251 @@ static void vLEDTask( void *pvParameters ); * Messages are not written directly to the terminal, but passed to vPrintTask * via a queue. */ -static void vCheckTask( void *pvParameters ); +static void vCheckTask( void * pvParameters ); /* * Controls all terminal output. If a task wants to send a message to the * terminal IO it posts a pointer to the text to vPrintTask via a queue. This * ensures serial access to the terminal IO. */ -static void vPrintTask( void *pvParameter ); +static void vPrintTask( void * pvParameter ); /* * Simply waits for an interrupt to be generated from the built in button, then * generates a table of tasks states that is then written by vPrintTask to the * terminal output window within CrossStudio. */ -static void vButtonHandlerTask( void *pvParameters ); +static void vButtonHandlerTask( void * pvParameters ); /*-----------------------------------------------------------*/ int main( void ) { - /* Setup the peripheral bus to be the same as the PLL output. */ - VPBDIV = mainBUS_CLK_FULL; - - /* Create the queue used to pass message to vPrintTask. */ - xPrintQueue = xQueueCreate( mainQUEUE_SIZE, sizeof( char * ) ); - - /* Create the semaphore used to wake vButtonHandlerTask(). */ - vSemaphoreCreateBinary( xButtonSemaphore ); - xSemaphoreTake( xButtonSemaphore, 0 ); - - /* Start the standard demo tasks. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartDynamicPriorityTasks(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - - #if configUSE_PREEMPTION == 1 - { - /* The timing of console output when not using the preemptive - scheduler causes the block time tests to detect a timing problem. */ - vCreateBlockTimeTasks(); - } - #endif + /* Setup the peripheral bus to be the same as the PLL output. */ + VPBDIV = mainBUS_CLK_FULL; + + /* Create the queue used to pass message to vPrintTask. */ + xPrintQueue = xQueueCreate( mainQUEUE_SIZE, sizeof( char * ) ); + + /* Create the semaphore used to wake vButtonHandlerTask(). */ + vSemaphoreCreateBinary( xButtonSemaphore ); + xSemaphoreTake( xButtonSemaphore, 0 ); + + /* Start the standard demo tasks. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartDynamicPriorityTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + + #if configUSE_PREEMPTION == 1 + { + /* The timing of console output when not using the preemptive + * scheduler causes the block time tests to detect a timing problem. */ + vCreateBlockTimeTasks(); + } + #endif vStartRecursiveMutexTasks(); - /* Start the tasks defined within this file. */ - xTaskCreate( vLEDTask, "LED", configMINIMAL_STACK_SIZE, NULL, mainLED_TASK_PRIORITY, NULL ); + /* Start the tasks defined within this file. */ + xTaskCreate( vLEDTask, "LED", configMINIMAL_STACK_SIZE, NULL, mainLED_TASK_PRIORITY, NULL ); xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); xTaskCreate( vPrintTask, "Print", configMINIMAL_STACK_SIZE, NULL, mainPRINT_TASK_PRIORITY, NULL ); xTaskCreate( vButtonHandlerTask, "Button", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - /* Start the scheduler. */ - vTaskStartScheduler(); + /* Start the scheduler. */ + vTaskStartScheduler(); - /* The scheduler should now be running, so we will only ever reach here if we - ran out of heap space. */ + /* The scheduler should now be running, so we will only ever reach here if we + * ran out of heap space. */ - return 0; + return 0; } /*-----------------------------------------------------------*/ -static void vLEDTask( void *pvParameters ) +static void vLEDTask( void * pvParameters ) { - /* Just to remove compiler warnings. */ - ( void ) pvParameters; + /* Just to remove compiler warnings. */ + ( void ) pvParameters; - /* Configure IO. */ - IO0DIR |= mainLED_BIT; - IO0SET = mainLED_BIT; + /* Configure IO. */ + IO0DIR |= mainLED_BIT; + IO0SET = mainLED_BIT; - for( ;; ) - { - /* Not very exiting - just delay... */ - vTaskDelay( xLED_Delay ); + for( ; ; ) + { + /* Not very exiting - just delay... */ + vTaskDelay( xLED_Delay ); - /* ...set the IO ... */ + /* ...set the IO ... */ IO0CLR = mainLED_BIT; - /* ...delay again... */ - vTaskDelay( xLED_Delay ); + /* ...delay again... */ + vTaskDelay( xLED_Delay ); - /* ...then clear the IO. */ - IO0SET = mainLED_BIT; - } + /* ...then clear the IO. */ + IO0SET = mainLED_BIT; + } } /*-----------------------------------------------------------*/ -static void vCheckTask( void *pvParameters ) +static void vCheckTask( void * pvParameters ) { -portBASE_TYPE xErrorOccurred = pdFALSE; -TickType_t xLastExecutionTime; -const char * const pcPassMessage = "PASS\n"; -const char * const pcFailMessage = "FAIL\n"; - - /* Just to remove compiler warnings. */ - ( void ) pvParameters; - - /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() - works correctly. */ - xLastExecutionTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Perform this check every mainCHECK_DELAY milliseconds. */ - vTaskDelayUntil( &xLastExecutionTime, mainCHECK_DELAY ); - - /* Has an error been found in any task? */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - #if configUSE_PREEMPTION == 1 - { - /* The timing of console output when not using the preemptive - scheduler causes the block time tests to detect a timing problem. */ - if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - } - #endif - - if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - /* Send either a pass or fail message. If an error is found it is - never cleared again. */ - if( xErrorOccurred == pdTRUE ) - { - xLED_Delay = mainERROR_LED_DELAY; - xQueueSend( xPrintQueue, &pcFailMessage, portMAX_DELAY ); - } - else - { - xQueueSend( xPrintQueue, &pcPassMessage, portMAX_DELAY ); - } - } + portBASE_TYPE xErrorOccurred = pdFALSE; + TickType_t xLastExecutionTime; + const char * const pcPassMessage = "PASS\n"; + const char * const pcFailMessage = "FAIL\n"; + + /* Just to remove compiler warnings. */ + ( void ) pvParameters; + + /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() + * works correctly. */ + xLastExecutionTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Perform this check every mainCHECK_DELAY milliseconds. */ + vTaskDelayUntil( &xLastExecutionTime, mainCHECK_DELAY ); + + /* Has an error been found in any task? */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + #if configUSE_PREEMPTION == 1 + { + /* The timing of console output when not using the preemptive + * scheduler causes the block time tests to detect a timing problem. */ + if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + } + #endif + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + /* Send either a pass or fail message. If an error is found it is + * never cleared again. */ + if( xErrorOccurred == pdTRUE ) + { + xLED_Delay = mainERROR_LED_DELAY; + xQueueSend( xPrintQueue, &pcFailMessage, portMAX_DELAY ); + } + else + { + xQueueSend( xPrintQueue, &pcPassMessage, portMAX_DELAY ); + } + } } /*-----------------------------------------------------------*/ -static void vPrintTask( void *pvParameters ) +static void vPrintTask( void * pvParameters ) { -char *pcMessage; - - /* Just to stop compiler warnings. */ - ( void ) pvParameters; - - for( ;; ) - { - /* Wait for a message to arrive. */ - while( xQueueReceive( xPrintQueue, &pcMessage, portMAX_DELAY ) != pdPASS ); - - /* Write the message to the terminal IO. */ - #ifndef NDEBUG - debug_printf( "%s", pcMessage ); - #endif - } + char * pcMessage; + + /* Just to stop compiler warnings. */ + ( void ) pvParameters; + + for( ; ; ) + { + /* Wait for a message to arrive. */ + while( xQueueReceive( xPrintQueue, &pcMessage, portMAX_DELAY ) != pdPASS ) + { + } + + /* Write the message to the terminal IO. */ + #ifndef NDEBUG + debug_printf( "%s", pcMessage ); + #endif + } } /*-----------------------------------------------------------*/ -static void vButtonHandlerTask( void *pvParameters ) +static void vButtonHandlerTask( void * pvParameters ) { -static char cListBuffer[ mainLIST_BUFFER_SIZE ]; -const char *pcList = &( cListBuffer[ 0 ] ); -const char * const pcHeader = "\nTask State Priority Stack #\n************************************************"; -extern void (vButtonISRWrapper) ( void ); - - /* Just to stop compiler warnings. */ - ( void ) pvParameters; - - /* Configure the interrupt. */ - portENTER_CRITICAL(); - { - /* Configure P0.14 to generate interrupts. */ - PINSEL0 |= mainP0_14__EINT_1; - EXTMODE = mainEINT_1_EDGE_SENSITIVE; - EXTPOLAR = mainEINT_1_FALLING_EDGE_SENSITIVE; - - /* Setup the VIC for EINT 1. */ - VICIntSelect &= ~mainEINT_1_VIC_CHANNEL_BIT; - VICIntEnable |= mainEINT_1_VIC_CHANNEL_BIT; - VICVectAddr1 = ( long ) vButtonISRWrapper; - VICVectCntl1 = mainEINT_1_ENABLE_BIT | mainEINT_1_CHANNEL; - } - portEXIT_CRITICAL(); - - for( ;; ) - { - /* For debouncing, wait a while then clear the semaphore. */ - vTaskDelay( mainSHORT_DELAY ); - xSemaphoreTake( xButtonSemaphore, mainNO_DELAY ); - - /* Wait for an interrupt. */ - xSemaphoreTake( xButtonSemaphore, portMAX_DELAY ); - - /* Send the column headers to the print task for display. */ - xQueueSend( xPrintQueue, &pcHeader, portMAX_DELAY ); - - /* Create the list of task states. */ - vTaskList( cListBuffer ); - - /* Send the task status information to the print task for display. */ - xQueueSend( xPrintQueue, &pcList, portMAX_DELAY ); - } + static char cListBuffer[ mainLIST_BUFFER_SIZE ]; + const char * pcList = &( cListBuffer[ 0 ] ); + const char * const pcHeader = "\nTask State Priority Stack #\n************************************************"; + + extern void( vButtonISRWrapper ) ( void ); + + /* Just to stop compiler warnings. */ + ( void ) pvParameters; + + /* Configure the interrupt. */ + portENTER_CRITICAL(); + { + /* Configure P0.14 to generate interrupts. */ + PINSEL0 |= mainP0_14__EINT_1; + EXTMODE = mainEINT_1_EDGE_SENSITIVE; + EXTPOLAR = mainEINT_1_FALLING_EDGE_SENSITIVE; + + /* Setup the VIC for EINT 1. */ + VICIntSelect &= ~mainEINT_1_VIC_CHANNEL_BIT; + VICIntEnable |= mainEINT_1_VIC_CHANNEL_BIT; + VICVectAddr1 = ( long ) vButtonISRWrapper; + VICVectCntl1 = mainEINT_1_ENABLE_BIT | mainEINT_1_CHANNEL; + } + portEXIT_CRITICAL(); + + for( ; ; ) + { + /* For debouncing, wait a while then clear the semaphore. */ + vTaskDelay( mainSHORT_DELAY ); + xSemaphoreTake( xButtonSemaphore, mainNO_DELAY ); + + /* Wait for an interrupt. */ + xSemaphoreTake( xButtonSemaphore, portMAX_DELAY ); + + /* Send the column headers to the print task for display. */ + xQueueSend( xPrintQueue, &pcHeader, portMAX_DELAY ); + + /* Create the list of task states. */ + vTaskList( cListBuffer ); + + /* Send the task status information to the print task for display. */ + xQueueSend( xPrintQueue, &pcList, portMAX_DELAY ); + } } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - /* Check pcTaskName for the name of the offending task, or pxCurrentTCB - if pcTaskName has itself been corrupted. */ - ( void ) pxTask; - ( void ) pcTaskName; - for( ;; ); + /* Check pcTaskName for the name of the offending task, or pxCurrentTCB + * if pcTaskName has itself been corrupted. */ + ( void ) pxTask; + ( void ) pcTaskName; + + for( ; ; ) + { + } } - - - - - - diff --git a/FreeRTOS/Demo/ARM7_LPC2138_Rowley/mainISR.c b/FreeRTOS/Demo/ARM7_LPC2138_Rowley/mainISR.c index a914b50dbf1..020ac8e9b71 100644 --- a/FreeRTOS/Demo/ARM7_LPC2138_Rowley/mainISR.c +++ b/FreeRTOS/Demo/ARM7_LPC2138_Rowley/mainISR.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -26,32 +26,32 @@ #include "FreeRTOS.h" #include "semphr.h" -#define isrCLEAR_EINT_1 2 +#define isrCLEAR_EINT_1 2 /* - * Interrupt routine that simply wakes vButtonHandlerTask on each interrupt + * Interrupt routine that simply wakes vButtonHandlerTask on each interrupt * generated by a push of the built in button. The wrapper takes care of * the ISR entry. This then calls the actual handler function to perform * the work. This work should not be done in the wrapper itself unless * you are absolutely sure that no stack space is used. */ -void vButtonISRWrapper( void ) __attribute__ ((naked)); -void vButtonHandler( void ) __attribute__ ((noinline)); +void vButtonISRWrapper( void ) __attribute__( ( naked ) ); +void vButtonHandler( void ) __attribute__( ( noinline ) ); void vButtonHandler( void ) { -extern SemaphoreHandle_t xButtonSemaphore; -portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + extern SemaphoreHandle_t xButtonSemaphore; + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; - xSemaphoreGiveFromISR( xButtonSemaphore, &xHigherPriorityTaskWoken ); + xSemaphoreGiveFromISR( xButtonSemaphore, &xHigherPriorityTaskWoken ); - if( xHigherPriorityTaskWoken ) - { - /* We have woken a task. Calling "yield from ISR" here will ensure - the interrupt returns to the woken task if it has a priority higher - than the interrupted task. */ - portYIELD_FROM_ISR(); - } + if( xHigherPriorityTaskWoken ) + { + /* We have woken a task. Calling "yield from ISR" here will ensure + * the interrupt returns to the woken task if it has a priority higher + * than the interrupted task. */ + portYIELD_FROM_ISR(); + } EXTINT = isrCLEAR_EINT_1; VICVectAddr = 0; @@ -60,17 +60,14 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; void vButtonISRWrapper( void ) { - /* Save the context of the interrupted task. */ - portSAVE_CONTEXT(); + /* Save the context of the interrupted task. */ + portSAVE_CONTEXT(); - /* Call the handler to do the work. This must be a separate function to - the wrapper to ensure the correct stack frame is set up. */ - __asm volatile( "bl vButtonHandler" ); + /* Call the handler to do the work. This must be a separate function to + * the wrapper to ensure the correct stack frame is set up. */ + __asm volatile ( "bl vButtonHandler" ); - /* Restore the context of whichever task is going to run once the interrupt - completes. */ - portRESTORE_CONTEXT(); + /* Restore the context of whichever task is going to run once the interrupt + * completes. */ + portRESTORE_CONTEXT(); } - - - diff --git a/FreeRTOS/Demo/ARM7_STR71x_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/ARM7_STR71x_IAR/FreeRTOSConfig.h index a9a8d463f0b..8a16eaa1a81 100644 --- a/FreeRTOS/Demo/ARM7_STR71x_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/ARM7_STR71x_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_STR71x_IAR/ParTest/ParTest.c b/FreeRTOS/Demo/ARM7_STR71x_IAR/ParTest/ParTest.c index a093ec87b35..ae7b9e2da93 100644 --- a/FreeRTOS/Demo/ARM7_STR71x_IAR/ParTest/ParTest.c +++ b/FreeRTOS/Demo/ARM7_STR71x_IAR/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_STR71x_IAR/main.c b/FreeRTOS/Demo/ARM7_STR71x_IAR/main.c index 633ba37d971..8f3db9cac4a 100644 --- a/FreeRTOS/Demo/ARM7_STR71x_IAR/main.c +++ b/FreeRTOS/Demo/ARM7_STR71x_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -25,12 +25,12 @@ */ /* - NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. - The processor MUST be in supervisor mode when vTaskStartScheduler is - called. The demo applications included in the FreeRTOS.org download switch - to supervisor mode prior to main being called. If you are not using one of - these demo application projects then ensure Supervisor mode is used. -*/ + * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + * The processor MUST be in supervisor mode when vTaskStartScheduler is + * called. The demo applications included in the FreeRTOS.org download switch + * to supervisor mode prior to main being called. If you are not using one of + * these demo application projects then ensure Supervisor mode is used. + */ /* * Creates all the demo application tasks, then starts the scheduler. The WEB @@ -69,28 +69,28 @@ #include "comtest2.h" /* Priorities for the demo application tasks. */ -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* Constants required by the 'Check' task. */ -#define mainNO_ERROR_FLASH_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) -#define mainERROR_FLASH_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) -#define mainCHECK_TASK_LED ( 4 ) +#define mainNO_ERROR_FLASH_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainERROR_FLASH_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) +#define mainCHECK_TASK_LED ( 4 ) /* Constants for the ComTest tasks. */ -#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 ) -#define mainCOM_TEST_LED ( 6 ) /* The LED built onto the kickstart board. */ +#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 ) +#define mainCOM_TEST_LED ( 6 ) /* The LED built onto the kickstart board. */ /* * The task that executes at the highest priority and calls * prvCheckOtherTasksAreStillRunning(). See the description at the top * of the file. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * Configure the processor for use with the IAR STR71x demo board. This @@ -112,37 +112,36 @@ static long prvCheckOtherTasksAreStillRunning( void ); */ void main( void ) { - /* Setup any hardware that has not already been configured by the low - level init routines. */ - prvSetupHardware(); - - /* Initialise the LED outputs for use by the demo application tasks. */ - vParTestInitialise(); - - /* Start all the standard demo application tasks. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vStartDynamicPriorityTasks(); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - - /* Start the check task - which is defined in this file. */ - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - - /* Start the scheduler. - - NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. - The processor MUST be in supervisor mode when vTaskStartScheduler is - called. The demo applications included in the FreeRTOS.org download switch - to supervisor mode prior to main being called. If you are not using one of - these demo application projects then ensure Supervisor mode is used here. */ - - vTaskStartScheduler(); - - /* We should never get here as control is now taken by the scheduler. */ - return; + /* Setup any hardware that has not already been configured by the low + * level init routines. */ + prvSetupHardware(); + + /* Initialise the LED outputs for use by the demo application tasks. */ + vParTestInitialise(); + + /* Start all the standard demo application tasks. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vStartDynamicPriorityTasks(); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + + /* Start the check task - which is defined in this file. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + + /* Start the scheduler. + * + * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + * The processor MUST be in supervisor mode when vTaskStartScheduler is + * called. The demo applications included in the FreeRTOS.org download switch + * to supervisor mode prior to main being called. If you are not using one of + * these demo application projects then ensure Supervisor mode is used here. */ + + vTaskStartScheduler(); + + /* We should never get here as control is now taken by the scheduler. */ } /*-----------------------------------------------------------*/ @@ -151,90 +150,88 @@ static void prvSetupHardware( void ) /* Setup the PLL to generate a 48MHz clock from the 4MHz CLK. */ /* Turn of the div by two. */ - RCCU_Div2Config( DISABLE ); + RCCU_Div2Config( DISABLE ); /* 48MHz = ( 4MHz * 12 ) / 1 */ - RCCU_PLL1Config( RCCU_PLL1_Mul_12, RCCU_Div_1 ); + RCCU_PLL1Config( RCCU_PLL1_Mul_12, RCCU_Div_1 ); RCCU_RCLKSourceConfig( RCCU_PLL1_Output ); } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD; -TickType_t xLastWakeTime; - - /* The parameters are not used in this task. */ - ( void ) pvParameters; - - /* Initialise xLastWakeTime to ensure the first call to vTaskDelayUntil() - functions correctly. */ - xLastWakeTime = xTaskGetTickCount(); - - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. If an error is detected then the delay period - is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so - the on board LED flash rate will increase. */ - - for( ;; ) - { - /* Delay until it is time to execute again. The delay period is - shorter following an error so the LED flashes faster. */ - vTaskDelayUntil( &xLastWakeTime, xDelayPeriod ); - - /* Check all the standard demo application tasks are executing without - error. */ - if( prvCheckOtherTasksAreStillRunning() != pdPASS ) - { - /* An error has been detected in one of the tasks - flash faster. */ - xDelayPeriod = mainERROR_FLASH_PERIOD; - } - - vParTestToggleLED( mainCHECK_TASK_LED ); - } + TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD; + TickType_t xLastWakeTime; + + /* The parameters are not used in this task. */ + ( void ) pvParameters; + + /* Initialise xLastWakeTime to ensure the first call to vTaskDelayUntil() + * functions correctly. */ + xLastWakeTime = xTaskGetTickCount(); + + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. If an error is detected then the delay period + * is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so + * the on board LED flash rate will increase. */ + + for( ; ; ) + { + /* Delay until it is time to execute again. The delay period is + * shorter following an error so the LED flashes faster. */ + vTaskDelayUntil( &xLastWakeTime, xDelayPeriod ); + + /* Check all the standard demo application tasks are executing without + * error. */ + if( prvCheckOtherTasksAreStillRunning() != pdPASS ) + { + /* An error has been detected in one of the tasks - flash faster. */ + xDelayPeriod = mainERROR_FLASH_PERIOD; + } + + vParTestToggleLED( mainCHECK_TASK_LED ); + } } /*-----------------------------------------------------------*/ static long prvCheckOtherTasksAreStillRunning( void ) { -long lReturn = ( long ) pdPASS; - - /* Check all the demo tasks (other than the flash tasks) to ensure - that they are all still running, and that none of them have detected - an error. */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } - - return lReturn; + long lReturn = ( long ) pdPASS; + + /* Check all the demo tasks (other than the flash tasks) to ensure + * that they are all still running, and that none of them have detected + * an error. */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } + + return lReturn; } /*-----------------------------------------------------------*/ - - diff --git a/FreeRTOS/Demo/ARM7_STR71x_IAR/serial/serial.c b/FreeRTOS/Demo/ARM7_STR71x_IAR/serial/serial.c index 9f83338d651..60a1e336823 100644 --- a/FreeRTOS/Demo/ARM7_STR71x_IAR/serial/serial.c +++ b/FreeRTOS/Demo/ARM7_STR71x_IAR/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_STR75x_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/ARM7_STR75x_GCC/FreeRTOSConfig.h index 8f985233586..0bc2e7ec268 100644 --- a/FreeRTOS/Demo/ARM7_STR75x_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/ARM7_STR75x_GCC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_STR75x_GCC/ParTest/ParTest.c b/FreeRTOS/Demo/ARM7_STR75x_GCC/ParTest/ParTest.c index f6ccae65974..8f21857f92d 100644 --- a/FreeRTOS/Demo/ARM7_STR75x_GCC/ParTest/ParTest.c +++ b/FreeRTOS/Demo/ARM7_STR75x_GCC/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_STR75x_GCC/main.c b/FreeRTOS/Demo/ARM7_STR75x_GCC/main.c index ba65d49cd9f..6e5323719f8 100644 --- a/FreeRTOS/Demo/ARM7_STR75x_GCC/main.c +++ b/FreeRTOS/Demo/ARM7_STR75x_GCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -66,41 +66,41 @@ #include "dynamic.h" /* Demo application task priorities. */ -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* How often should we check the other tasks? */ -#define mainCHECK_TASK_CYCLE_TIME ( 3000 ) +#define mainCHECK_TASK_CYCLE_TIME ( 3000 ) /* The maximum offset into the pass and fail strings sent to the LCD. An -offset is used a simple method of using a different column each time a message -is written to the LCD. */ -#define mainMAX_WRITE_COLUMN ( 14 ) + * offset is used a simple method of using a different column each time a message + * is written to the LCD. */ +#define mainMAX_WRITE_COLUMN ( 14 ) /* Baud rate used by the comtest tasks. */ -#define mainCOM_TEST_BAUD_RATE ( 19200 ) +#define mainCOM_TEST_BAUD_RATE ( 19200 ) /* The LED used by the comtest tasks. See the comtest.c file for more -information. */ -#define mainCOM_TEST_LED ( 3 ) + * information. */ +#define mainCOM_TEST_LED ( 3 ) /* The number of messages that can be queued for display on the LCD at any one -time. */ -#define mainLCD_QUEUE_LENGTH ( 2 ) + * time. */ +#define mainLCD_QUEUE_LENGTH ( 2 ) /* The time to wait when sending to mainLCD_QUEUE_LENGTH. */ -#define mainNO_DELAY ( 0 ) +#define mainNO_DELAY ( 0 ) /*-----------------------------------------------------------*/ /* The type that is posted to the LCD queue. */ typedef struct LCD_MESSAGE { - unsigned char *pucString; /* Points to the string to be displayed. */ - unsigned char ucLine; /* The line of the LCD that should be used. */ + unsigned char * pucString; /* Points to the string to be displayed. */ + unsigned char ucLine; /* The line of the LCD that should be used. */ } LCDMessage; /*-----------------------------------------------------------*/ @@ -110,12 +110,12 @@ typedef struct LCD_MESSAGE * all the other tasks in the system. See the description at the top of the * file. */ -static void vCheckTask( void *pvParameters ); +static void vCheckTask( void * pvParameters ); /* * ST provided routine to configure the processor. */ -static void prvSetupHardware(void); +static void prvSetupHardware( void ); /* * The only task that should access the LCD. Other tasks wanting to write @@ -124,7 +124,7 @@ static void prvSetupHardware(void); * waiting for the arrival of such messages, displays the message, then blocks * again. */ -static void vPrintTask( void *pvParameters ); +static void vPrintTask( void * pvParameters ); /*-----------------------------------------------------------*/ @@ -136,177 +136,179 @@ static QueueHandle_t xLCDQueue; /* Create all the demo application tasks, then start the scheduler. */ int main( void ) { - /* Perform any hardware setup necessary. */ - prvSetupHardware(); - vParTestInitialise(); - - /* Create the queue used to communicate with the LCD print task. */ - xLCDQueue = xQueueCreate( mainLCD_QUEUE_LENGTH, sizeof( LCDMessage ) ); - - /* Create the standard demo application tasks. See the WEB documentation - for more information on these tasks. */ - vCreateBlockTimeTasks(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vStartDynamicPriorityTasks(); - vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - - /* Create the tasks defined within this file. */ - xTaskCreate( vPrintTask, "LCD", configMINIMAL_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL ); - xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - - vTaskStartScheduler(); - - /* Execution will only reach here if there was insufficient heap to - start the scheduler. */ - return 0; + /* Perform any hardware setup necessary. */ + prvSetupHardware(); + vParTestInitialise(); + + /* Create the queue used to communicate with the LCD print task. */ + xLCDQueue = xQueueCreate( mainLCD_QUEUE_LENGTH, sizeof( LCDMessage ) ); + + /* Create the standard demo application tasks. See the WEB documentation + * for more information on these tasks. */ + vCreateBlockTimeTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartDynamicPriorityTasks(); + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + + /* Create the tasks defined within this file. */ + xTaskCreate( vPrintTask, "LCD", configMINIMAL_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL ); + xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + + vTaskStartScheduler(); + + /* Execution will only reach here if there was insufficient heap to + * start the scheduler. */ + return 0; } /*-----------------------------------------------------------*/ -static void vCheckTask( void *pvParameters ) +static void vCheckTask( void * pvParameters ) { -static unsigned long ulErrorDetected = pdFALSE; -TickType_t xLastExecutionTime; -unsigned char *ucErrorMessage = ( unsigned char * )" FAIL"; -unsigned char *ucSuccessMessage = ( unsigned char * )" PASS"; -unsigned portBASE_TYPE uxColumn = mainMAX_WRITE_COLUMN; -LCDMessage xMessage; - - /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() - works correctly. */ - xLastExecutionTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Wait until it is time for the next cycle. */ - vTaskDelayUntil( &xLastExecutionTime, mainCHECK_TASK_CYCLE_TIME ); - - /* Has an error been found in any of the standard demo tasks? */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - ulErrorDetected = pdTRUE; - } - - if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - ulErrorDetected = pdTRUE; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - ulErrorDetected = pdTRUE; - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - ulErrorDetected = pdTRUE; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - ulErrorDetected = pdTRUE; - } - - /* Calculate the LCD line on which we would like the message to - be displayed. The column variable is used for convenience as - it is incremented each cycle anyway. */ - xMessage.ucLine = ( unsigned char ) ( uxColumn & 0x01 ); - - /* The message displayed depends on whether an error was found or - not. Any discovered error is latched. Here the column variable - is used as an index into the text string as a simple way of moving - the text from column to column. */ - if( ulErrorDetected == pdFALSE ) - { - xMessage.pucString = ucSuccessMessage + uxColumn; - } - else - { - xMessage.pucString = ucErrorMessage + uxColumn; - } - - /* Send the message to the print task for display. */ - xQueueSend( xLCDQueue, ( void * ) &xMessage, mainNO_DELAY ); - - /* Make sure the message is printed in a different column the next - time around. */ - uxColumn--; - if( uxColumn == 0 ) - { - uxColumn = mainMAX_WRITE_COLUMN; - } - } + static unsigned long ulErrorDetected = pdFALSE; + TickType_t xLastExecutionTime; + unsigned char * ucErrorMessage = ( unsigned char * ) " FAIL"; + unsigned char * ucSuccessMessage = ( unsigned char * ) " PASS"; + unsigned portBASE_TYPE uxColumn = mainMAX_WRITE_COLUMN; + LCDMessage xMessage; + + /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() + * works correctly. */ + xLastExecutionTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Wait until it is time for the next cycle. */ + vTaskDelayUntil( &xLastExecutionTime, mainCHECK_TASK_CYCLE_TIME ); + + /* Has an error been found in any of the standard demo tasks? */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + ulErrorDetected = pdTRUE; + } + + if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + ulErrorDetected = pdTRUE; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + ulErrorDetected = pdTRUE; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + ulErrorDetected = pdTRUE; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + ulErrorDetected = pdTRUE; + } + + /* Calculate the LCD line on which we would like the message to + * be displayed. The column variable is used for convenience as + * it is incremented each cycle anyway. */ + xMessage.ucLine = ( unsigned char ) ( uxColumn & 0x01 ); + + /* The message displayed depends on whether an error was found or + * not. Any discovered error is latched. Here the column variable + * is used as an index into the text string as a simple way of moving + * the text from column to column. */ + if( ulErrorDetected == pdFALSE ) + { + xMessage.pucString = ucSuccessMessage + uxColumn; + } + else + { + xMessage.pucString = ucErrorMessage + uxColumn; + } + + /* Send the message to the print task for display. */ + xQueueSend( xLCDQueue, ( void * ) &xMessage, mainNO_DELAY ); + + /* Make sure the message is printed in a different column the next + * time around. */ + uxColumn--; + + if( uxColumn == 0 ) + { + uxColumn = mainMAX_WRITE_COLUMN; + } + } } /*-----------------------------------------------------------*/ -static void vPrintTask( void *pvParameters ) +static void vPrintTask( void * pvParameters ) { -LCDMessage xMessage; - - for( ;; ) - { - /* Wait until a message arrives. */ - while( xQueueReceive( xLCDQueue, ( void * ) &xMessage, portMAX_DELAY ) != pdPASS ); - - /* The message contains the text to display, and the line on which the - text should be displayed. */ - LCD_Clear(); - LCD_DisplayString( xMessage.ucLine, xMessage.pucString, BlackText ); - } + LCDMessage xMessage; + + for( ; ; ) + { + /* Wait until a message arrives. */ + while( xQueueReceive( xLCDQueue, ( void * ) &xMessage, portMAX_DELAY ) != pdPASS ) + { + } + + /* The message contains the text to display, and the line on which the + * text should be displayed. */ + LCD_Clear(); + LCD_DisplayString( xMessage.ucLine, xMessage.pucString, BlackText ); + } } /*-----------------------------------------------------------*/ -static void prvSetupHardware(void) +static void prvSetupHardware( void ) { -ErrorStatus OSC4MStartUpStatus01; + ErrorStatus OSC4MStartUpStatus01; - /* ST provided routine. */ + /* ST provided routine. */ - /* MRCC system reset */ - MRCC_DeInit(); + /* MRCC system reset */ + MRCC_DeInit(); - /* Wait for OSC4M start-up */ - OSC4MStartUpStatus01 = MRCC_WaitForOSC4MStartUp(); + /* Wait for OSC4M start-up */ + OSC4MStartUpStatus01 = MRCC_WaitForOSC4MStartUp(); - if(OSC4MStartUpStatus01 == SUCCESS) - { - /* Set HCLK to 60MHz */ - MRCC_HCLKConfig(MRCC_CKSYS_Div1); + if( OSC4MStartUpStatus01 == SUCCESS ) + { + /* Set HCLK to 60MHz */ + MRCC_HCLKConfig( MRCC_CKSYS_Div1 ); - /* Set CKTIM to 60MHz */ - MRCC_CKTIMConfig(MRCC_HCLK_Div1); + /* Set CKTIM to 60MHz */ + MRCC_CKTIMConfig( MRCC_HCLK_Div1 ); - /* Set PCLK to 30MHz */ - MRCC_PCLKConfig(MRCC_CKTIM_Div2); + /* Set PCLK to 30MHz */ + MRCC_PCLKConfig( MRCC_CKTIM_Div2 ); - /* Enable Flash Burst mode */ - CFG_FLASHBurstConfig(CFG_FLASHBurst_Enable); + /* Enable Flash Burst mode */ + CFG_FLASHBurstConfig( CFG_FLASHBurst_Enable ); - /* Set CK_SYS to 60 MHz */ - MRCC_CKSYSConfig(MRCC_CKSYS_OSC4MPLL, MRCC_PLL_Mul_15); - } + /* Set CK_SYS to 60 MHz */ + MRCC_CKSYSConfig( MRCC_CKSYS_OSC4MPLL, MRCC_PLL_Mul_15 ); + } - /* GPIO pins optimized for 3V3 operation */ - MRCC_IOVoltageRangeConfig(MRCC_IOVoltageRange_3V3); + /* GPIO pins optimized for 3V3 operation */ + MRCC_IOVoltageRangeConfig( MRCC_IOVoltageRange_3V3 ); - /* GPIO clock source enable */ - MRCC_PeripheralClockConfig(MRCC_Peripheral_GPIO, ENABLE); + /* GPIO clock source enable */ + MRCC_PeripheralClockConfig( MRCC_Peripheral_GPIO, ENABLE ); - /* EXTIT clock source enable */ - MRCC_PeripheralClockConfig(MRCC_Peripheral_EXTIT, ENABLE); - /* TB clock source enable */ - MRCC_PeripheralClockConfig(MRCC_Peripheral_TB, ENABLE); + /* EXTIT clock source enable */ + MRCC_PeripheralClockConfig( MRCC_Peripheral_EXTIT, ENABLE ); + /* TB clock source enable */ + MRCC_PeripheralClockConfig( MRCC_Peripheral_TB, ENABLE ); - /* Initialize the demonstration menu */ - LCD_Init(); + /* Initialize the demonstration menu */ + LCD_Init(); - LCD_DisplayString(Line1, ( unsigned char * ) "www.FreeRTOS.org", BlackText); - LCD_DisplayString(Line2, ( unsigned char * ) " STR750 Demo ", BlackText); + LCD_DisplayString( Line1, ( unsigned char * ) "www.FreeRTOS.org", BlackText ); + LCD_DisplayString( Line2, ( unsigned char * ) " STR750 Demo ", BlackText ); - EIC_IRQCmd(ENABLE); + EIC_IRQCmd( ENABLE ); } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/ARM7_STR75x_GCC/serial/serial.c b/FreeRTOS/Demo/ARM7_STR75x_GCC/serial/serial.c index 55b9d45afa6..92aca62c1fd 100644 --- a/FreeRTOS/Demo/ARM7_STR75x_GCC/serial/serial.c +++ b/FreeRTOS/Demo/ARM7_STR75x_GCC/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_STR75x_GCC/serial/serialISR.c b/FreeRTOS/Demo/ARM7_STR75x_GCC/serial/serialISR.c index b3d58168fd4..ab00a72ea34 100644 --- a/FreeRTOS/Demo/ARM7_STR75x_GCC/serial/serialISR.c +++ b/FreeRTOS/Demo/ARM7_STR75x_GCC/serial/serialISR.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_STR75x_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/ARM7_STR75x_IAR/FreeRTOSConfig.h index 8fbdf7ace32..7ad6a92e008 100644 --- a/FreeRTOS/Demo/ARM7_STR75x_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/ARM7_STR75x_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_STR75x_IAR/ParTest/ParTest.c b/FreeRTOS/Demo/ARM7_STR75x_IAR/ParTest/ParTest.c index f6ccae65974..8f21857f92d 100644 --- a/FreeRTOS/Demo/ARM7_STR75x_IAR/ParTest/ParTest.c +++ b/FreeRTOS/Demo/ARM7_STR75x_IAR/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM7_STR75x_IAR/main.c b/FreeRTOS/Demo/ARM7_STR75x_IAR/main.c index ebab686636d..b769de5b69d 100644 --- a/FreeRTOS/Demo/ARM7_STR75x_IAR/main.c +++ b/FreeRTOS/Demo/ARM7_STR75x_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -66,41 +66,41 @@ #include "dynamic.h" /* Demo application task priorities. */ -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* How often should we check the other tasks? */ -#define mainCHECK_TASK_CYCLE_TIME ( 3000 ) +#define mainCHECK_TASK_CYCLE_TIME ( 3000 ) /* The maximum offset into the pass and fail strings sent to the LCD. An -offset is used a simple method of using a different column each time a message -is written to the LCD. */ -#define mainMAX_WRITE_COLUMN ( 14 ) + * offset is used a simple method of using a different column each time a message + * is written to the LCD. */ +#define mainMAX_WRITE_COLUMN ( 14 ) /* Baud rate used by the comtest tasks. */ -#define mainCOM_TEST_BAUD_RATE ( 19200 ) +#define mainCOM_TEST_BAUD_RATE ( 19200 ) /* The LED used by the comtest tasks. See the comtest.c file for more -information. */ -#define mainCOM_TEST_LED ( 3 ) + * information. */ +#define mainCOM_TEST_LED ( 3 ) /* The number of messages that can be queued for display on the LCD at any one -time. */ -#define mainLCD_QUEUE_LENGTH ( 2 ) + * time. */ +#define mainLCD_QUEUE_LENGTH ( 2 ) /* The time to wait when sending to mainLCD_QUEUE_LENGTH. */ -#define mainNO_DELAY ( 0 ) +#define mainNO_DELAY ( 0 ) /*-----------------------------------------------------------*/ /* The type that is posted to the LCD queue. */ typedef struct LCD_MESSAGE { - unsigned char *pucString; /* Points to the string to be displayed. */ - unsigned char ucLine; /* The line of the LCD that should be used. */ + unsigned char * pucString; /* Points to the string to be displayed. */ + unsigned char ucLine; /* The line of the LCD that should be used. */ } LCDMessage; /*-----------------------------------------------------------*/ @@ -110,12 +110,12 @@ typedef struct LCD_MESSAGE * all the other tasks in the system. See the description at the top of the * file. */ -static void vCheckTask( void *pvParameters ); +static void vCheckTask( void * pvParameters ); /* * ST provided routine to configure the processor. */ -static void prvSetupHardware(void); +static void prvSetupHardware( void ); /* * The only task that should access the LCD. Other tasks wanting to write @@ -124,7 +124,7 @@ static void prvSetupHardware(void); * waiting for the arrival of such messages, displays the message, then blocks * again. */ -static void vPrintTask( void *pvParameters ); +static void vPrintTask( void * pvParameters ); /*-----------------------------------------------------------*/ @@ -136,174 +136,177 @@ static QueueHandle_t xLCDQueue; /* Create all the demo application tasks, then start the scheduler. */ void main( void ) { - /* Perform any hardware setup necessary. */ - prvSetupHardware(); - vParTestInitialise(); - - /* Create the queue used to communicate with the LCD print task. */ - xLCDQueue = xQueueCreate( mainLCD_QUEUE_LENGTH, sizeof( LCDMessage ) ); - - /* Create the standard demo application tasks. See the WEB documentation - for more information on these tasks. */ - vCreateBlockTimeTasks(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vStartDynamicPriorityTasks(); - vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - - /* Create the tasks defined within this file. */ - xTaskCreate( vPrintTask, "LCD", configMINIMAL_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL ); - xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - - vTaskStartScheduler(); - - /* Execution will only reach here if there was insufficient heap to - start the scheduler. */ + /* Perform any hardware setup necessary. */ + prvSetupHardware(); + vParTestInitialise(); + + /* Create the queue used to communicate with the LCD print task. */ + xLCDQueue = xQueueCreate( mainLCD_QUEUE_LENGTH, sizeof( LCDMessage ) ); + + /* Create the standard demo application tasks. See the WEB documentation + * for more information on these tasks. */ + vCreateBlockTimeTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartDynamicPriorityTasks(); + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + + /* Create the tasks defined within this file. */ + xTaskCreate( vPrintTask, "LCD", configMINIMAL_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL ); + xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + + vTaskStartScheduler(); + + /* Execution will only reach here if there was insufficient heap to + * start the scheduler. */ } /*-----------------------------------------------------------*/ -static void vCheckTask( void *pvParameters ) +static void vCheckTask( void * pvParameters ) { -static unsigned long ulErrorDetected = pdFALSE; -TickType_t xLastExecutionTime; -unsigned char *cErrorMessage = " FAIL"; -unsigned char *cSuccessMessage = " PASS"; -unsigned portBASE_TYPE uxColumn = mainMAX_WRITE_COLUMN; -LCDMessage xMessage; - - /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() - works correctly. */ - xLastExecutionTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Wait until it is time for the next cycle. */ - vTaskDelayUntil( &xLastExecutionTime, mainCHECK_TASK_CYCLE_TIME ); - - /* Has an error been found in any of the standard demo tasks? */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - ulErrorDetected = pdTRUE; - } - - if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - ulErrorDetected = pdTRUE; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - ulErrorDetected = pdTRUE; - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - ulErrorDetected = pdTRUE; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - ulErrorDetected = pdTRUE; - } - - /* Calculate the LCD line on which we would like the message to - be displayed. The column variable is used for convenience as - it is incremented each cycle anyway. */ - xMessage.ucLine = ( unsigned char ) ( uxColumn & 0x01 ); - - /* The message displayed depends on whether an error was found or - not. Any discovered error is latched. Here the column variable - is used as an index into the text string as a simple way of moving - the text from column to column. */ - if( ulErrorDetected == pdFALSE ) - { - xMessage.pucString = cSuccessMessage + uxColumn; - } - else - { - xMessage.pucString = cErrorMessage + uxColumn; - } - - /* Send the message to the print task for display. */ - xQueueSend( xLCDQueue, ( void * ) &xMessage, mainNO_DELAY ); - - /* Make sure the message is printed in a different column the next - time around. */ - uxColumn--; - if( uxColumn == 0 ) - { - uxColumn = mainMAX_WRITE_COLUMN; - } - } + static unsigned long ulErrorDetected = pdFALSE; + TickType_t xLastExecutionTime; + unsigned char * cErrorMessage = " FAIL"; + unsigned char * cSuccessMessage = " PASS"; + unsigned portBASE_TYPE uxColumn = mainMAX_WRITE_COLUMN; + LCDMessage xMessage; + + /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() + * works correctly. */ + xLastExecutionTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Wait until it is time for the next cycle. */ + vTaskDelayUntil( &xLastExecutionTime, mainCHECK_TASK_CYCLE_TIME ); + + /* Has an error been found in any of the standard demo tasks? */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + ulErrorDetected = pdTRUE; + } + + if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + ulErrorDetected = pdTRUE; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + ulErrorDetected = pdTRUE; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + ulErrorDetected = pdTRUE; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + ulErrorDetected = pdTRUE; + } + + /* Calculate the LCD line on which we would like the message to + * be displayed. The column variable is used for convenience as + * it is incremented each cycle anyway. */ + xMessage.ucLine = ( unsigned char ) ( uxColumn & 0x01 ); + + /* The message displayed depends on whether an error was found or + * not. Any discovered error is latched. Here the column variable + * is used as an index into the text string as a simple way of moving + * the text from column to column. */ + if( ulErrorDetected == pdFALSE ) + { + xMessage.pucString = cSuccessMessage + uxColumn; + } + else + { + xMessage.pucString = cErrorMessage + uxColumn; + } + + /* Send the message to the print task for display. */ + xQueueSend( xLCDQueue, ( void * ) &xMessage, mainNO_DELAY ); + + /* Make sure the message is printed in a different column the next + * time around. */ + uxColumn--; + + if( uxColumn == 0 ) + { + uxColumn = mainMAX_WRITE_COLUMN; + } + } } /*-----------------------------------------------------------*/ -static void vPrintTask( void *pvParameters ) +static void vPrintTask( void * pvParameters ) { -LCDMessage xMessage; - - for( ;; ) - { - /* Wait until a message arrives. */ - while( xQueueReceive( xLCDQueue, ( void * ) &xMessage, portMAX_DELAY ) != pdPASS ); - - /* The message contains the text to display, and the line on which the - text should be displayed. */ - LCD_Clear(); - LCD_DisplayString( xMessage.ucLine, xMessage.pucString, BlackText ); - } + LCDMessage xMessage; + + for( ; ; ) + { + /* Wait until a message arrives. */ + while( xQueueReceive( xLCDQueue, ( void * ) &xMessage, portMAX_DELAY ) != pdPASS ) + { + } + + /* The message contains the text to display, and the line on which the + * text should be displayed. */ + LCD_Clear(); + LCD_DisplayString( xMessage.ucLine, xMessage.pucString, BlackText ); + } } /*-----------------------------------------------------------*/ -static void prvSetupHardware(void) +static void prvSetupHardware( void ) { -ErrorStatus OSC4MStartUpStatus01; + ErrorStatus OSC4MStartUpStatus01; - /* ST provided routine. */ + /* ST provided routine. */ - /* MRCC system reset */ - MRCC_DeInit(); + /* MRCC system reset */ + MRCC_DeInit(); - /* Wait for OSC4M start-up */ - OSC4MStartUpStatus01 = MRCC_WaitForOSC4MStartUp(); + /* Wait for OSC4M start-up */ + OSC4MStartUpStatus01 = MRCC_WaitForOSC4MStartUp(); - if(OSC4MStartUpStatus01 == SUCCESS) - { - /* Set HCLK to 60MHz */ - MRCC_HCLKConfig(MRCC_CKSYS_Div1); + if( OSC4MStartUpStatus01 == SUCCESS ) + { + /* Set HCLK to 60MHz */ + MRCC_HCLKConfig( MRCC_CKSYS_Div1 ); - /* Set CKTIM to 60MHz */ - MRCC_CKTIMConfig(MRCC_HCLK_Div1); + /* Set CKTIM to 60MHz */ + MRCC_CKTIMConfig( MRCC_HCLK_Div1 ); - /* Set PCLK to 30MHz */ - MRCC_PCLKConfig(MRCC_CKTIM_Div2); + /* Set PCLK to 30MHz */ + MRCC_PCLKConfig( MRCC_CKTIM_Div2 ); - /* Enable Flash Burst mode */ - CFG_FLASHBurstConfig(CFG_FLASHBurst_Enable); + /* Enable Flash Burst mode */ + CFG_FLASHBurstConfig( CFG_FLASHBurst_Enable ); - /* Set CK_SYS to 60 MHz */ - MRCC_CKSYSConfig(MRCC_CKSYS_OSC4MPLL, MRCC_PLL_Mul_15); - } + /* Set CK_SYS to 60 MHz */ + MRCC_CKSYSConfig( MRCC_CKSYS_OSC4MPLL, MRCC_PLL_Mul_15 ); + } - /* GPIO pins optimized for 3V3 operation */ - MRCC_IOVoltageRangeConfig(MRCC_IOVoltageRange_3V3); + /* GPIO pins optimized for 3V3 operation */ + MRCC_IOVoltageRangeConfig( MRCC_IOVoltageRange_3V3 ); - /* GPIO clock source enable */ - MRCC_PeripheralClockConfig(MRCC_Peripheral_GPIO, ENABLE); + /* GPIO clock source enable */ + MRCC_PeripheralClockConfig( MRCC_Peripheral_GPIO, ENABLE ); - /* EXTIT clock source enable */ - MRCC_PeripheralClockConfig(MRCC_Peripheral_EXTIT, ENABLE); - /* TB clock source enable */ - MRCC_PeripheralClockConfig(MRCC_Peripheral_TB, ENABLE); + /* EXTIT clock source enable */ + MRCC_PeripheralClockConfig( MRCC_Peripheral_EXTIT, ENABLE ); + /* TB clock source enable */ + MRCC_PeripheralClockConfig( MRCC_Peripheral_TB, ENABLE ); - /* Initialize the demonstration menu */ - LCD_Init(); + /* Initialize the demonstration menu */ + LCD_Init(); - LCD_DisplayString(Line1, "www.FreeRTOS.org", BlackText); - LCD_DisplayString(Line2, " STR750 Demo ", BlackText); + LCD_DisplayString( Line1, "www.FreeRTOS.org", BlackText ); + LCD_DisplayString( Line2, " STR750 Demo ", BlackText ); - EIC_IRQCmd(ENABLE); + EIC_IRQCmd( ENABLE ); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/ARM7_STR75x_IAR/serial/serial.c b/FreeRTOS/Demo/ARM7_STR75x_IAR/serial/serial.c index 457bb5a6bc4..532eaea92ed 100644 --- a/FreeRTOS/Demo/ARM7_STR75x_IAR/serial/serial.c +++ b/FreeRTOS/Demo/ARM7_STR75x_IAR/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM9_AT91SAM9XE_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/ARM9_AT91SAM9XE_IAR/FreeRTOSConfig.h index cb5fe4de83d..b78ddf31479 100644 --- a/FreeRTOS/Demo/ARM9_AT91SAM9XE_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/ARM9_AT91SAM9XE_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM9_AT91SAM9XE_IAR/ParTest/ParTest.c b/FreeRTOS/Demo/ARM9_AT91SAM9XE_IAR/ParTest/ParTest.c index b986496b812..f1aa95e9bb2 100644 --- a/FreeRTOS/Demo/ARM9_AT91SAM9XE_IAR/ParTest/ParTest.c +++ b/FreeRTOS/Demo/ARM9_AT91SAM9XE_IAR/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ARM9_AT91SAM9XE_IAR/main.c b/FreeRTOS/Demo/ARM9_AT91SAM9XE_IAR/main.c index fa299644d1b..56d4225ae11 100644 --- a/FreeRTOS/Demo/ARM9_AT91SAM9XE_IAR/main.c +++ b/FreeRTOS/Demo/ARM9_AT91SAM9XE_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -63,21 +63,21 @@ #include /* Priorities for the demo application tasks. */ -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 0 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 0 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainGENERIC_QUEUE_PRIORITY ( tskIDLE_PRIORITY ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 0 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 0 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainGENERIC_QUEUE_PRIORITY ( tskIDLE_PRIORITY ) /* The period of the check task both in and out of the presense of an error. */ -#define mainNO_ERROR_PERIOD ( 5000 / portTICK_PERIOD_MS ) -#define mainERROR_PERIOD ( 500 / portTICK_PERIOD_MS ); +#define mainNO_ERROR_PERIOD ( 5000 / portTICK_PERIOD_MS ) +#define mainERROR_PERIOD ( 500 / portTICK_PERIOD_MS ); /* Constants used by the ComTest task. */ -#define mainCOM_TEST_BAUD_RATE ( 38400 ) -#define mainCOM_TEST_LED ( LED_DS1 ) +#define mainCOM_TEST_BAUD_RATE ( 38400 ) +#define mainCOM_TEST_LED ( LED_DS1 ) /*-----------------------------------------------------------*/ @@ -85,148 +85,150 @@ static void prvSetupHardware( void ); /* The check task as described at the top of this file. */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); /*-----------------------------------------------------------*/ int main() { - /* Perform any hardware setup necessary to run the demo. */ - prvSetupHardware(); - - /* First create the 'standard demo' tasks. These exist just to to - demonstrate API functions being used and test the kernel port. More - information is provided on the FreeRTOS.org WEB site. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartDynamicPriorityTasks(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vCreateBlockTimeTasks(); - vStartCountingSemaphoreTasks(); - vStartGenericQueueTasks( tskIDLE_PRIORITY ); - vStartQueuePeekTasks(); - vStartRecursiveMutexTasks(); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - - /* Create the check task - this is the task that checks all the other tasks - are executing as expected and without reporting any errors. */ - xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL ); - - /* The death demo tasks must be started last as the sanity checks performed - require knowledge of the number of other tasks in the system. */ - vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - - /* Start the scheduler. From this point on the execution will be under - the control of the kernel. */ - vTaskStartScheduler(); - - /* Will only get here if there was insufficient heap available for the - idle task to be created. */ - for( ;; ); + /* Perform any hardware setup necessary to run the demo. */ + prvSetupHardware(); + + /* First create the 'standard demo' tasks. These exist just to to + * demonstrate API functions being used and test the kernel port. More + * information is provided on the FreeRTOS.org WEB site. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartDynamicPriorityTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vCreateBlockTimeTasks(); + vStartCountingSemaphoreTasks(); + vStartGenericQueueTasks( tskIDLE_PRIORITY ); + vStartQueuePeekTasks(); + vStartRecursiveMutexTasks(); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + + /* Create the check task - this is the task that checks all the other tasks + * are executing as expected and without reporting any errors. */ + xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL ); + + /* The death demo tasks must be started last as the sanity checks performed + * require knowledge of the number of other tasks in the system. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + + /* Start the scheduler. From this point on the execution will be under + * the control of the kernel. */ + vTaskStartScheduler(); + + /* Will only get here if there was insufficient heap available for the + * idle task to be created. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ static void prvCheckTask( void * pvParameters ) { -TickType_t xNextWakeTime, xPeriod = mainNO_ERROR_PERIOD; -static volatile unsigned long ulErrorCode = 0UL; - - /* Just to remove the compiler warning. */ - ( void ) pvParameters; - - /* Initialise xNextWakeTime prior to its first use. From this point on - the value of the variable is handled automatically by the kernel. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Delay until it is time for this task to execute again. */ - vTaskDelayUntil( &xNextWakeTime, xPeriod ); - - /* Check all the other tasks in the system - latch any reported errors - into the ulErrorCode variable. */ - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - ulErrorCode |= 0x01UL; - } - - if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - ulErrorCode |= 0x02UL; - } - - if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) - { - ulErrorCode |= 0x04UL; - } - - if( xIsCreateTaskStillRunning() != pdTRUE ) - { - ulErrorCode |= 0x08UL; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - ulErrorCode |= 0x10UL; - } - - if( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - ulErrorCode |= 0x20UL; - } - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - ulErrorCode |= 0x40UL; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - ulErrorCode |= 0x80UL; - } - - if( xAreQueuePeekTasksStillRunning() != pdTRUE ) - { - ulErrorCode |= 0x100UL; - } - - if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - ulErrorCode |= 0x200UL; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - ulErrorCode |= 0x400UL; - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - ulErrorCode |= 0x800UL; - } - - /* Reduce the block period and in so doing increase the frequency at - which this task executes if any errors have been latched. The increased - frequency causes the LED toggle rate to increase and so gives some - visual feedback that an error has occurred. */ - if( ulErrorCode != 0x00 ) - { - xPeriod = mainERROR_PERIOD; - } - - /* Finally toggle the LED. */ - vParTestToggleLED( LED_POWER ); - } + TickType_t xNextWakeTime, xPeriod = mainNO_ERROR_PERIOD; + static volatile unsigned long ulErrorCode = 0UL; + + /* Just to remove the compiler warning. */ + ( void ) pvParameters; + + /* Initialise xNextWakeTime prior to its first use. From this point on + * the value of the variable is handled automatically by the kernel. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Delay until it is time for this task to execute again. */ + vTaskDelayUntil( &xNextWakeTime, xPeriod ); + + /* Check all the other tasks in the system - latch any reported errors + * into the ulErrorCode variable. */ + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + ulErrorCode |= 0x01UL; + } + + if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + ulErrorCode |= 0x02UL; + } + + if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) + { + ulErrorCode |= 0x04UL; + } + + if( xIsCreateTaskStillRunning() != pdTRUE ) + { + ulErrorCode |= 0x08UL; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + ulErrorCode |= 0x10UL; + } + + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + ulErrorCode |= 0x20UL; + } + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + ulErrorCode |= 0x40UL; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + ulErrorCode |= 0x80UL; + } + + if( xAreQueuePeekTasksStillRunning() != pdTRUE ) + { + ulErrorCode |= 0x100UL; + } + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + ulErrorCode |= 0x200UL; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + ulErrorCode |= 0x400UL; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + ulErrorCode |= 0x800UL; + } + + /* Reduce the block period and in so doing increase the frequency at + * which this task executes if any errors have been latched. The increased + * frequency causes the LED toggle rate to increase and so gives some + * visual feedback that an error has occurred. */ + if( ulErrorCode != 0x00 ) + { + xPeriod = mainERROR_PERIOD; + } + + /* Finally toggle the LED. */ + vParTestToggleLED( LED_POWER ); + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { -const Pin xPins[] = { PIN_USART0_RXD, PIN_USART0_TXD }; + const Pin xPins[] = { PIN_USART0_RXD, PIN_USART0_TXD }; - /* Setup the LED outputs. */ - vParTestInitialise(); - - /* Setup the pins for the UART. */ - PIO_Configure( xPins, PIO_LISTSIZE( xPins ) ); + /* Setup the LED outputs. */ + vParTestInitialise(); + + /* Setup the pins for the UART. */ + PIO_Configure( xPins, PIO_LISTSIZE( xPins ) ); } diff --git a/FreeRTOS/Demo/ARM9_AT91SAM9XE_IAR/serial/serial.c b/FreeRTOS/Demo/ARM9_AT91SAM9XE_IAR/serial/serial.c index 7c85386e872..67fa79c9dd2 100644 --- a/FreeRTOS/Demo/ARM9_AT91SAM9XE_IAR/serial/serial.c +++ b/FreeRTOS/Demo/ARM9_AT91SAM9XE_IAR/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR32_UC3/main.c b/FreeRTOS/Demo/AVR32_UC3/main.c index 97a4d36099a..2524785fd31 100644 --- a/FreeRTOS/Demo/AVR32_UC3/main.c +++ b/FreeRTOS/Demo/AVR32_UC3/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -25,7 +25,8 @@ */ /*This file has been prepared for Doxygen automatic documentation generation.*/ -/*! \file ********************************************************************* + +/* \file ********************************************************************* * * \brief FreeRTOS Real Time Kernel example. * @@ -79,56 +80,48 @@ #include "death.h" #include "flop.h" -/*! \name Priority definitions for most of the tasks in the demo application. +/* Priority definitions for most of the tasks in the demo application. * Some tasks just use the idle priority. */ -//! @{ -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) -#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -//! @} - -//! Baud rate used by the serial port tasks. -#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 57600 ) - -//! LED used by the serial port tasks. This is toggled on each character Tx, -//! and mainCOM_TEST_LED + 1 is toggled on each character Rx. -#define mainCOM_TEST_LED ( 3 ) - -//! LED that is toggled by the check task. The check task periodically checks -//! that all the other tasks are operating without error. If no errors are found -//! the LED is toggled. If an error is found at any time the LED toggles faster. -#define mainCHECK_TASK_LED ( 6 ) - -//! LED that is set upon error. -#define mainERROR_LED ( 7 ) - -//! The period between executions of the check task. -#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) - -//! If an error is detected in a task, the vErrorChecks task will enter in an -//! infinite loop flashing the LED at this rate. -#define mainERROR_FLASH_RATE ( (TickType_t) 500 / portTICK_PERIOD_MS ) - -/*! \name Constants used by the vMemCheckTask() task. +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) +#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) + +/* Baud rate used by the serial port tasks. */ +#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 57600 ) + +/* LED used by the serial port tasks. This is toggled on each character Tx, + * and mainCOM_TEST_LED + 1 is toggled on each character Rx. */ +#define mainCOM_TEST_LED ( 3 ) + +/* LED that is toggled by the check task. The check task periodically checks + * that all the other tasks are operating without error. If no errors are found + * the LED is toggled. If an error is found at any time the LED toggles faster. */ -//! @{ -#define mainCOUNT_INITIAL_VALUE ( ( unsigned long ) 0 ) -#define mainNO_TASK ( 0 ) -//! @} +#define mainCHECK_TASK_LED ( 6 ) -/*! \name The size of the memory blocks allocated by the vMemCheckTask() task. - */ -//! @{ -#define mainMEM_CHECK_SIZE_1 ( ( size_t ) 51 ) -#define mainMEM_CHECK_SIZE_2 ( ( size_t ) 52 ) -#define mainMEM_CHECK_SIZE_3 ( ( size_t ) 15 ) -//! @} +/* LED that is set upon error. */ +#define mainERROR_LED ( 7 ) + +/* The period between executions of the check task. */ +#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) + +/* If an error is detected in a task, the vErrorChecks task will enter in an + * infinite loop flashing the LED at this rate. */ +#define mainERROR_FLASH_RATE ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) + +/* Constants used by the vMemCheckTask() task. */ +#define mainCOUNT_INITIAL_VALUE ( ( unsigned long ) 0 ) +#define mainNO_TASK ( 0 ) +/* The size of the memory blocks allocated by the vMemCheckTask() task. */ +#define mainMEM_CHECK_SIZE_1 ( ( size_t ) 51 ) +#define mainMEM_CHECK_SIZE_2 ( ( size_t ) 52 ) +#define mainMEM_CHECK_SIZE_3 ( ( size_t ) 15 ) /*-----------------------------------------------------------*/ @@ -137,7 +130,7 @@ * prvCheckOtherTasksAreStillRunning(). See the description at the top * of the file. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * Checks that all the demo application tasks are still executing without error @@ -148,7 +141,7 @@ static portBASE_TYPE prvCheckOtherTasksAreStillRunning( void ); /* * A task that exercises the memory allocator. */ -static void vMemCheckTask( void *pvParameters ); +static void vMemCheckTask( void * pvParameters ); /* * Called by the check task following the detection of an error to set the @@ -160,305 +153,305 @@ static void prvIndicateError( void ); int main( void ) { - /* Start the crystal oscillator 0 and switch the main clock to it. */ - pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP); - - portDBG_TRACE("Starting the FreeRTOS AVR32 UC3 Demo..."); - - /* Setup the LED's for output. */ - vParTestInitialise(); - - /* Start the standard demo tasks. See the WEB documentation for more - information. */ - vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartDynamicPriorityTasks(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vStartMathTasks( tskIDLE_PRIORITY ); - - /* Start the demo tasks defined within this file, specifically the check - task as described at the top of this file. */ - xTaskCreate( - vErrorChecks - , "ErrCheck" - , configMINIMAL_STACK_SIZE - , NULL - , mainCHECK_TASK_PRIORITY - , NULL ); - - /* Start the scheduler. */ - vTaskStartScheduler(); - - /* Will only get here if there was insufficient memory to create the idle - task. */ - - return 0; + /* Start the crystal oscillator 0 and switch the main clock to it. */ + pm_switch_to_osc0( &AVR32_PM, FOSC0, OSC0_STARTUP ); + + portDBG_TRACE( "Starting the FreeRTOS AVR32 UC3 Demo..." ); + + /* Setup the LED's for output. */ + vParTestInitialise(); + + /* Start the standard demo tasks. See the WEB documentation for more + * information. */ + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartDynamicPriorityTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vStartMathTasks( tskIDLE_PRIORITY ); + + /* Start the demo tasks defined within this file, specifically the check + * task as described at the top of this file. */ + xTaskCreate( + vErrorChecks + , "ErrCheck" + , configMINIMAL_STACK_SIZE + , NULL + , mainCHECK_TASK_PRIORITY + , NULL ); + + /* Start the scheduler. */ + vTaskStartScheduler(); + + /* Will only get here if there was insufficient memory to create the idle + * task. */ + + return 0; } /*-----------------------------------------------------------*/ -/*! - * \brief The task function for the "Check" task. +/* + * @brief The task function for the "Check" task. */ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -static volatile unsigned long ulDummyVariable = 3UL; -unsigned long ulMemCheckTaskRunningCount; -TaskHandle_t xCreatedTask; -portBASE_TYPE bSuicidalTask = 0; - - /* The parameters are not used. Prevent compiler warnings. */ - ( void ) pvParameters; - - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. - - In addition to the standard tests the memory allocator is tested through - the dynamic creation and deletion of a task each cycle. Each time the - task is created memory must be allocated for its stack. When the task is - deleted this memory is returned to the heap. If the task cannot be created - then it is likely that the memory allocation failed. */ - - for( ;; ) - { - /* Do this only once. */ - if( bSuicidalTask == 0 ) - { - bSuicidalTask++; - - /* This task has to be created last as it keeps account of the number of - tasks it expects to see running. However its implementation expects - to be called before vTaskStartScheduler(). We're in the case here where - vTaskStartScheduler() has already been called (thus the hidden IDLE task - has already been spawned). Since vCreateSuicidalTask() supposes that the - IDLE task isn't included in the response from uxTaskGetNumberOfTasks(), - let the MEM_CHECK task play that role. => this is why vCreateSuicidalTasks() - is not called as the last task. */ - vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - } - - /* Reset xCreatedTask. This is modified by the task about to be - created so we can tell if it is executing correctly or not. */ - xCreatedTask = mainNO_TASK; - - /* Dynamically create a task - passing ulMemCheckTaskRunningCount as a - parameter. */ - ulMemCheckTaskRunningCount = mainCOUNT_INITIAL_VALUE; - - if( xTaskCreate( vMemCheckTask, - "MEM_CHECK", - configMINIMAL_STACK_SIZE, - ( void * ) &ulMemCheckTaskRunningCount, - tskIDLE_PRIORITY, &xCreatedTask ) != pdPASS ) - { - /* Could not create the task - we have probably run out of heap. - Don't go any further and flash the LED faster to provide visual - feedback of the error. */ - prvIndicateError(); - } - - /* Delay until it is time to execute again. */ - vTaskDelay( mainCHECK_PERIOD ); - - /* Delete the dynamically created task. */ - if( xCreatedTask != mainNO_TASK ) - { - vTaskDelete( xCreatedTask ); - } - - /* Perform a bit of 32bit maths to ensure the registers used by the - integer tasks get some exercise. The result here is not important - - see the demo application documentation for more info. */ - ulDummyVariable *= 3; - - /* Check all other tasks are still operating without error. - Check that vMemCheckTask did increment the counter. */ - if( ( prvCheckOtherTasksAreStillRunning() != pdFALSE ) - || ( ulMemCheckTaskRunningCount == mainCOUNT_INITIAL_VALUE ) ) - { - /* An error has occurred in one of the tasks. - Don't go any further and flash the LED faster to give visual - feedback of the error. */ - prvIndicateError(); - } - else - { - /* Toggle the LED if everything is okay. */ - vParTestToggleLED( mainCHECK_TASK_LED ); - } - } + static volatile unsigned long ulDummyVariable = 3UL; + unsigned long ulMemCheckTaskRunningCount; + TaskHandle_t xCreatedTask; + portBASE_TYPE bSuicidalTask = 0; + + /* The parameters are not used. Prevent compiler warnings. */ + ( void ) pvParameters; + + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. + * + * In addition to the standard tests the memory allocator is tested through + * the dynamic creation and deletion of a task each cycle. Each time the + * task is created memory must be allocated for its stack. When the task is + * deleted this memory is returned to the heap. If the task cannot be created + * then it is likely that the memory allocation failed. */ + + for( ; ; ) + { + /* Do this only once. */ + if( bSuicidalTask == 0 ) + { + bSuicidalTask++; + + /* This task has to be created last as it keeps account of the number of + * tasks it expects to see running. However its implementation expects + * to be called before vTaskStartScheduler(). We're in the case here where + * vTaskStartScheduler() has already been called (thus the hidden IDLE task + * has already been spawned). Since vCreateSuicidalTask() supposes that the + * IDLE task isn't included in the response from uxTaskGetNumberOfTasks(), + * let the MEM_CHECK task play that role. => this is why vCreateSuicidalTasks() + * is not called as the last task. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + } + + /* Reset xCreatedTask. This is modified by the task about to be + * created so we can tell if it is executing correctly or not. */ + xCreatedTask = mainNO_TASK; + + /* Dynamically create a task - passing ulMemCheckTaskRunningCount as a + * parameter. */ + ulMemCheckTaskRunningCount = mainCOUNT_INITIAL_VALUE; + + if( xTaskCreate( vMemCheckTask, + "MEM_CHECK", + configMINIMAL_STACK_SIZE, + ( void * ) &ulMemCheckTaskRunningCount, + tskIDLE_PRIORITY, &xCreatedTask ) != pdPASS ) + { + /* Could not create the task - we have probably run out of heap. + * Don't go any further and flash the LED faster to provide visual + * feedback of the error. */ + prvIndicateError(); + } + + /* Delay until it is time to execute again. */ + vTaskDelay( mainCHECK_PERIOD ); + + /* Delete the dynamically created task. */ + if( xCreatedTask != mainNO_TASK ) + { + vTaskDelete( xCreatedTask ); + } + + /* Perform a bit of 32bit maths to ensure the registers used by the + * integer tasks get some exercise. The result here is not important - + * see the demo application documentation for more info. */ + ulDummyVariable *= 3; + + /* Check all other tasks are still operating without error. + * Check that vMemCheckTask did increment the counter. */ + if( ( prvCheckOtherTasksAreStillRunning() != pdFALSE ) || + ( ulMemCheckTaskRunningCount == mainCOUNT_INITIAL_VALUE ) ) + { + /* An error has occurred in one of the tasks. + * Don't go any further and flash the LED faster to give visual + * feedback of the error. */ + prvIndicateError(); + } + else + { + /* Toggle the LED if everything is okay. */ + vParTestToggleLED( mainCHECK_TASK_LED ); + } + } } /*-----------------------------------------------------------*/ -/*! - * \brief Checks that all the demo application tasks are still executing without error. +/* + * @brief Checks that all the demo application tasks are still executing without error. */ static portBASE_TYPE prvCheckOtherTasksAreStillRunning( void ) { -static portBASE_TYPE xErrorHasOccurred = pdFALSE; - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xAreMathsTaskStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xIsCreateTaskStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - return ( xErrorHasOccurred ); + static portBASE_TYPE xErrorHasOccurred = pdFALSE; + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xAreMathsTaskStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xIsCreateTaskStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + return( xErrorHasOccurred ); } /*-----------------------------------------------------------*/ -/*! - * \brief Dynamically created and deleted during each cycle of the vErrorChecks() - * task. This is done to check the operation of the memory allocator. +/* + * @brief Dynamically created and deleted during each cycle of the vErrorChecks() + * task. This is done to check the operation of the memory allocator. * See the top of vErrorChecks for more details. * - * \param *pvParameters Parameters for the task (can be of any kind) + * @param pvParameters Parameters for the task (can be of any kind) */ -static void vMemCheckTask( void *pvParameters ) +static void vMemCheckTask( void * pvParameters ) { -unsigned long *pulMemCheckTaskRunningCounter; -void *pvMem1, *pvMem2, *pvMem3; -static long lErrorOccurred = pdFALSE; - - /* This task is dynamically created then deleted during each cycle of the - vErrorChecks task to check the operation of the memory allocator. Each time - the task is created memory is allocated for the stack and TCB. Each time - the task is deleted this memory is returned to the heap. This task itself - exercises the allocator by allocating and freeing blocks. - - The task executes at the idle priority so does not require a delay. - - pulMemCheckTaskRunningCounter is incremented each cycle to indicate to the - vErrorChecks() task that this task is still executing without error. */ - - pulMemCheckTaskRunningCounter = ( unsigned long * ) pvParameters; - - for( ;; ) - { - if( lErrorOccurred == pdFALSE ) - { - /* We have never seen an error so increment the counter. */ - ( *pulMemCheckTaskRunningCounter )++; - } - else - { - /* There has been an error so reset the counter so the check task - can tell that an error occurred. */ - *pulMemCheckTaskRunningCounter = mainCOUNT_INITIAL_VALUE; - } - - /* Allocate some memory - just to give the allocator some extra - exercise. This has to be in a critical section to ensure the - task does not get deleted while it has memory allocated. */ - - vTaskSuspendAll(); - { - pvMem1 = pvPortMalloc( mainMEM_CHECK_SIZE_1 ); - - if( pvMem1 == NULL ) - { - lErrorOccurred = pdTRUE; - } - else - { - memset( pvMem1, 0xaa, mainMEM_CHECK_SIZE_1 ); - vPortFree( pvMem1 ); - } - } - xTaskResumeAll(); - - /* Again - with a different size block. */ - vTaskSuspendAll(); - { - pvMem2 = pvPortMalloc( mainMEM_CHECK_SIZE_2 ); - - if( pvMem2 == NULL ) - { - lErrorOccurred = pdTRUE; - } - else - { - memset( pvMem2, 0xaa, mainMEM_CHECK_SIZE_2 ); - vPortFree( pvMem2 ); - } - } - xTaskResumeAll(); - - /* Again - with a different size block. */ - vTaskSuspendAll(); - { - pvMem3 = pvPortMalloc( mainMEM_CHECK_SIZE_3 ); - if( pvMem3 == NULL ) - { - lErrorOccurred = pdTRUE; - } - else - { - memset( pvMem3, 0xaa, mainMEM_CHECK_SIZE_3 ); - vPortFree( pvMem3 ); - } - } - xTaskResumeAll(); - } + unsigned long * pulMemCheckTaskRunningCounter; + void * pvMem1, * pvMem2, * pvMem3; + static long lErrorOccurred = pdFALSE; + + /* This task is dynamically created then deleted during each cycle of the + * vErrorChecks task to check the operation of the memory allocator. Each time + * the task is created memory is allocated for the stack and TCB. Each time + * the task is deleted this memory is returned to the heap. This task itself + * exercises the allocator by allocating and freeing blocks. + * + * The task executes at the idle priority so does not require a delay. + * + * pulMemCheckTaskRunningCounter is incremented each cycle to indicate to the + * vErrorChecks() task that this task is still executing without error. */ + + pulMemCheckTaskRunningCounter = ( unsigned long * ) pvParameters; + + for( ; ; ) + { + if( lErrorOccurred == pdFALSE ) + { + /* We have never seen an error so increment the counter. */ + ( *pulMemCheckTaskRunningCounter )++; + } + else + { + /* There has been an error so reset the counter so the check task + * can tell that an error occurred. */ + *pulMemCheckTaskRunningCounter = mainCOUNT_INITIAL_VALUE; + } + + /* Allocate some memory - just to give the allocator some extra + * exercise. This has to be in a critical section to ensure the + * task does not get deleted while it has memory allocated. */ + + vTaskSuspendAll(); + { + pvMem1 = pvPortMalloc( mainMEM_CHECK_SIZE_1 ); + + if( pvMem1 == NULL ) + { + lErrorOccurred = pdTRUE; + } + else + { + memset( pvMem1, 0xaa, mainMEM_CHECK_SIZE_1 ); + vPortFree( pvMem1 ); + } + } + xTaskResumeAll(); + + /* Again - with a different size block. */ + vTaskSuspendAll(); + { + pvMem2 = pvPortMalloc( mainMEM_CHECK_SIZE_2 ); + + if( pvMem2 == NULL ) + { + lErrorOccurred = pdTRUE; + } + else + { + memset( pvMem2, 0xaa, mainMEM_CHECK_SIZE_2 ); + vPortFree( pvMem2 ); + } + } + xTaskResumeAll(); + + /* Again - with a different size block. */ + vTaskSuspendAll(); + { + pvMem3 = pvPortMalloc( mainMEM_CHECK_SIZE_3 ); + + if( pvMem3 == NULL ) + { + lErrorOccurred = pdTRUE; + } + else + { + memset( pvMem3, 0xaa, mainMEM_CHECK_SIZE_3 ); + vPortFree( pvMem3 ); + } + } + xTaskResumeAll(); + } } /*-----------------------------------------------------------*/ static void prvIndicateError( void ) { - /* The check task has found an error in one of the other tasks. - Set the LEDs to a state that indicates this. */ - vParTestSetLED(mainERROR_LED,pdTRUE); - - for(;;) - { - #if( BOARD==EVK1100 ) - vParTestToggleLED( mainCHECK_TASK_LED ); - vTaskDelay( mainERROR_FLASH_RATE ); - #endif - #if ( BOARD==EVK1101 ) - vParTestSetLED( 0, pdTRUE ); - vParTestSetLED( 1, pdTRUE ); - vParTestSetLED( 2, pdTRUE ); - vParTestSetLED( 3, pdTRUE ); - #endif - } -} - + /* The check task has found an error in one of the other tasks. + * Set the LEDs to a state that indicates this. */ + vParTestSetLED( mainERROR_LED, pdTRUE ); + + for( ; ; ) + { + #if ( BOARD == EVK1100 ) + vParTestToggleLED( mainCHECK_TASK_LED ); + vTaskDelay( mainERROR_FLASH_RATE ); + #endif + #if ( BOARD == EVK1101 ) + vParTestSetLED( 0, pdTRUE ); + vParTestSetLED( 1, pdTRUE ); + vParTestSetLED( 2, pdTRUE ); + vParTestSetLED( 3, pdTRUE ); + #endif + } +} \ No newline at end of file diff --git a/FreeRTOS/Demo/AVR_ATMega323_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/AVR_ATMega323_IAR/FreeRTOSConfig.h index 9f14b996fe5..7786d90e392 100644 --- a/FreeRTOS/Demo/AVR_ATMega323_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/AVR_ATMega323_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega323_IAR/ParTest/ParTest.c b/FreeRTOS/Demo/AVR_ATMega323_IAR/ParTest/ParTest.c index 3ba67e40ae6..dae0bbeb8ab 100644 --- a/FreeRTOS/Demo/AVR_ATMega323_IAR/ParTest/ParTest.c +++ b/FreeRTOS/Demo/AVR_ATMega323_IAR/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega323_IAR/main.c b/FreeRTOS/Demo/AVR_ATMega323_IAR/main.c index 4e4e75d0154..8739651b78d 100644 --- a/FreeRTOS/Demo/AVR_ATMega323_IAR/main.c +++ b/FreeRTOS/Demo/AVR_ATMega323_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -44,45 +44,45 @@ */ /* -Changes from V1.2.0 - - + Changed the baud rate for the serial test from 19200 to 57600. - -Changes from V1.2.3 - - + The integer and comtest tasks are now used when the cooperative scheduler - is being used. Previously they were only used with the preemptive - scheduler. - -Changes from V1.2.5 - - + Set the baud rate to 38400. This has a smaller error percentage with an - 8MHz clock (according to the manual). - -Changes from V2.0.0 - - + Delay periods are now specified using variables and constants of - TickType_t rather than unsigned long. - -Changes from V2.2.0 - - + File can now be built using either the IAR or WinAVR compiler. - -Changes from V2.6.1 - - + The IAR and WinAVR AVR ports are now maintained separately. - -Changes from V4.0.5 - - + Modified to demonstrate the use of co-routines. -*/ + * Changes from V1.2.0 + * + + Changed the baud rate for the serial test from 19200 to 57600. + + + + Changes from V1.2.3 + + + + The integer and comtest tasks are now used when the cooperative scheduler + + is being used. Previously they were only used with the preemptive + + scheduler. + + + + Changes from V1.2.5 + + + + Set the baud rate to 38400. This has a smaller error percentage with an + + 8MHz clock (according to the manual). + + + + Changes from V2.0.0 + + + + Delay periods are now specified using variables and constants of + + TickType_t rather than unsigned long. + + + + Changes from V2.2.0 + + + + File can now be built using either the IAR or WinAVR compiler. + + + + Changes from V2.6.1 + + + + The IAR and WinAVR AVR ports are now maintained separately. + + + + Changes from V4.0.5 + + + + Modified to demonstrate the use of co-routines. + */ #include #include #ifdef GCC_MEGA_AVR - /* EEPROM routines used only with the WinAVR compiler. */ - #include + /* EEPROM routines used only with the WinAVR compiler. */ + #include #endif /* Scheduler include files. */ @@ -101,39 +101,39 @@ Changes from V4.0.5 #include "regtest.h" /* Priority definitions for most of the tasks in the demo application. Some -tasks just use the idle priority. */ -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) + * tasks just use the idle priority. */ +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) /* Baud rate used by the serial port tasks. */ -#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 38400 ) +#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 38400 ) /* LED used by the serial port tasks. This is toggled on each character Tx, -and mainCOM_TEST_LED + 1 is toggles on each character Rx. */ -#define mainCOM_TEST_LED ( 4 ) + * and mainCOM_TEST_LED + 1 is toggles on each character Rx. */ +#define mainCOM_TEST_LED ( 4 ) /* LED that is toggled by the check task. The check task periodically checks -that all the other tasks are operating without error. If no errors are found -the LED is toggled. If an error is found at any time the LED is never toggles -again. */ -#define mainCHECK_TASK_LED ( 7 ) + * that all the other tasks are operating without error. If no errors are found + * the LED is toggled. If an error is found at any time the LED is never toggles + * again. */ +#define mainCHECK_TASK_LED ( 7 ) /* The period between executions of the check task. */ -#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) /* An address in the EEPROM used to count resets. This is used to check that -the demo application is not unexpectedly resetting. */ -#define mainRESET_COUNT_ADDRESS ( ( void * ) 0x50 ) + * the demo application is not unexpectedly resetting. */ +#define mainRESET_COUNT_ADDRESS ( ( void * ) 0x50 ) /* The number of coroutines to create. */ -#define mainNUM_FLASH_COROUTINES ( 3 ) +#define mainNUM_FLASH_COROUTINES ( 3 ) /* * The task function for the "Check" task. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * Checks the unique counts of other tasks to ensure they are still operational. @@ -150,124 +150,125 @@ static void prvIncrementResetCount( void ); /* * Idle hook is used to scheduler co-routines. */ -void vApplicationIdleHook( void ); +void vApplicationIdleHook( void ); short main( void ) { - prvIncrementResetCount(); - - /* Setup the LED's for output. */ - vParTestInitialise(); - - /* Create the standard demo tasks. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartRegTestTasks(); - - /* Create the tasks defined within this file. */ - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - - /* Create the co-routines that flash the LED's. */ - vStartFlashCoRoutines( mainNUM_FLASH_COROUTINES ); - - /* In this port, to use preemptive scheduler define configUSE_PREEMPTION - as 1 in portmacro.h. To use the cooperative scheduler define - configUSE_PREEMPTION as 0. */ - vTaskStartScheduler(); - - return 0; + prvIncrementResetCount(); + + /* Setup the LED's for output. */ + vParTestInitialise(); + + /* Create the standard demo tasks. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartRegTestTasks(); + + /* Create the tasks defined within this file. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + + /* Create the co-routines that flash the LED's. */ + vStartFlashCoRoutines( mainNUM_FLASH_COROUTINES ); + + /* In this port, to use preemptive scheduler define configUSE_PREEMPTION + * as 1 in portmacro.h. To use the cooperative scheduler define + * configUSE_PREEMPTION as 0. */ + vTaskStartScheduler(); + + return 0; } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -static volatile unsigned long ulDummyVariable = 3UL; - - /* The parameters are not used. */ - ( void ) pvParameters; - - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. */ - for( ;; ) - { - vTaskDelay( mainCHECK_PERIOD ); - - /* Perform a bit of 32bit maths to ensure the registers used by the - integer tasks get some exercise. The result here is not important - - see the demo application documentation for more info. */ - ulDummyVariable *= 3; - - prvCheckOtherTasksAreStillRunning(); - } + static volatile unsigned long ulDummyVariable = 3UL; + + /* The parameters are not used. */ + ( void ) pvParameters; + + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. */ + for( ; ; ) + { + vTaskDelay( mainCHECK_PERIOD ); + + /* Perform a bit of 32bit maths to ensure the registers used by the + * integer tasks get some exercise. The result here is not important - + * see the demo application documentation for more info. */ + ulDummyVariable *= 3; + + prvCheckOtherTasksAreStillRunning(); + } } /*-----------------------------------------------------------*/ static void prvCheckOtherTasksAreStillRunning( void ) { -static portBASE_TYPE xErrorHasOccurred = pdFALSE; - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xAreRegTestTasksStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xErrorHasOccurred == pdFALSE ) - { - /* Toggle the LED if everything is okay so we know if an error occurs even if not - using console IO. */ - vParTestToggleLED( mainCHECK_TASK_LED ); - } + static portBASE_TYPE xErrorHasOccurred = pdFALSE; + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xAreRegTestTasksStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xErrorHasOccurred == pdFALSE ) + { + /* Toggle the LED if everything is okay so we know if an error occurs even if not + * using console IO. */ + vParTestToggleLED( mainCHECK_TASK_LED ); + } } /*-----------------------------------------------------------*/ static void prvIncrementResetCount( void ) { -unsigned char ucCount; -const unsigned char ucReadBit = ( unsigned char ) 0x01; -const unsigned char ucWrite1 = ( unsigned char ) 0x04; -const unsigned char ucWrite2 = ( unsigned char ) 0x02; - - /* Increment the EEPROM value at 0x00. - - Setup the EEPROM address. */ - EEARH = 0x00; - EEARL = 0x00; - - /* Set the read enable bit. */ - EECR |= ucReadBit; - - /* Wait for the read. */ - while( EECR & ucReadBit ); - - /* The byte is ready. */ - ucCount = EEDR; - - /* Increment the reset count, then write the byte back. */ - ucCount++; - EEDR = ucCount; - EECR = ucWrite1; - EECR = ( ucWrite1 | ucWrite2 ); + unsigned char ucCount; + const unsigned char ucReadBit = ( unsigned char ) 0x01; + const unsigned char ucWrite1 = ( unsigned char ) 0x04; + const unsigned char ucWrite2 = ( unsigned char ) 0x02; + + /* Increment the EEPROM value at 0x00. + * + * Setup the EEPROM address. */ + EEARH = 0x00; + EEARL = 0x00; + + /* Set the read enable bit. */ + EECR |= ucReadBit; + + /* Wait for the read. */ + while( EECR & ucReadBit ) + { + } + + /* The byte is ready. */ + ucCount = EEDR; + + /* Increment the reset count, then write the byte back. */ + ucCount++; + EEDR = ucCount; + EECR = ucWrite1; + EECR = ( ucWrite1 | ucWrite2 ); } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - vCoRoutineSchedule(); + vCoRoutineSchedule(); } - diff --git a/FreeRTOS/Demo/AVR_ATMega323_IAR/regtest.c b/FreeRTOS/Demo/AVR_ATMega323_IAR/regtest.c index a0f43976d44..14f050f6752 100644 --- a/FreeRTOS/Demo/AVR_ATMega323_IAR/regtest.c +++ b/FreeRTOS/Demo/AVR_ATMega323_IAR/regtest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega323_IAR/regtest.h b/FreeRTOS/Demo/AVR_ATMega323_IAR/regtest.h index b9a15760ff1..ee2817bc752 100644 --- a/FreeRTOS/Demo/AVR_ATMega323_IAR/regtest.h +++ b/FreeRTOS/Demo/AVR_ATMega323_IAR/regtest.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega323_IAR/serial/serial.c b/FreeRTOS/Demo/AVR_ATMega323_IAR/serial/serial.c index 2a5a448c308..a12dca9189a 100644 --- a/FreeRTOS/Demo/AVR_ATMega323_IAR/serial/serial.c +++ b/FreeRTOS/Demo/AVR_ATMega323_IAR/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega323_WinAVR/FreeRTOSConfig.h b/FreeRTOS/Demo/AVR_ATMega323_WinAVR/FreeRTOSConfig.h index 55538b9a8cc..cf851169806 100644 --- a/FreeRTOS/Demo/AVR_ATMega323_WinAVR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/AVR_ATMega323_WinAVR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega323_WinAVR/ParTest/ParTest.c b/FreeRTOS/Demo/AVR_ATMega323_WinAVR/ParTest/ParTest.c index 34a57d42889..a6bf87e5971 100644 --- a/FreeRTOS/Demo/AVR_ATMega323_WinAVR/ParTest/ParTest.c +++ b/FreeRTOS/Demo/AVR_ATMega323_WinAVR/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega323_WinAVR/main.c b/FreeRTOS/Demo/AVR_ATMega323_WinAVR/main.c index 4221e680b85..a57ff0374cf 100644 --- a/FreeRTOS/Demo/AVR_ATMega323_WinAVR/main.c +++ b/FreeRTOS/Demo/AVR_ATMega323_WinAVR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -44,42 +44,42 @@ */ /* -Changes from V1.2.0 - - + Changed the baud rate for the serial test from 19200 to 57600. - -Changes from V1.2.3 - - + The integer and comtest tasks are now used when the cooperative scheduler - is being used. Previously they were only used with the preemptive - scheduler. - -Changes from V1.2.5 - - + Set the baud rate to 38400. This has a smaller error percentage with an - 8MHz clock (according to the manual). - -Changes from V2.0.0 - - + Delay periods are now specified using variables and constants of - TickType_t rather than unsigned long. - -Changes from V2.6.1 - - + The IAR and WinAVR AVR ports are now maintained separately. - -Changes from V4.0.5 - - + Modified to demonstrate the use of co-routines. - -*/ + * Changes from V1.2.0 + * + + Changed the baud rate for the serial test from 19200 to 57600. + + + + Changes from V1.2.3 + + + + The integer and comtest tasks are now used when the cooperative scheduler + + is being used. Previously they were only used with the preemptive + + scheduler. + + + + Changes from V1.2.5 + + + + Set the baud rate to 38400. This has a smaller error percentage with an + + 8MHz clock (according to the manual). + + + + Changes from V2.0.0 + + + + Delay periods are now specified using variables and constants of + + TickType_t rather than unsigned long. + + + + Changes from V2.6.1 + + + + The IAR and WinAVR AVR ports are now maintained separately. + + + + Changes from V4.0.5 + + + + Modified to demonstrate the use of co-routines. + + + */ #include #include #ifdef GCC_MEGA_AVR - /* EEPROM routines used only with the WinAVR compiler. */ - #include + /* EEPROM routines used only with the WinAVR compiler. */ + #include #endif /* Scheduler include files. */ @@ -98,39 +98,39 @@ Changes from V4.0.5 #include "regtest.h" /* Priority definitions for most of the tasks in the demo application. Some -tasks just use the idle priority. */ -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) + * tasks just use the idle priority. */ +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) /* Baud rate used by the serial port tasks. */ -#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 38400 ) +#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 38400 ) /* LED used by the serial port tasks. This is toggled on each character Tx, -and mainCOM_TEST_LED + 1 is toggles on each character Rx. */ -#define mainCOM_TEST_LED ( 4 ) + * and mainCOM_TEST_LED + 1 is toggles on each character Rx. */ +#define mainCOM_TEST_LED ( 4 ) /* LED that is toggled by the check task. The check task periodically checks -that all the other tasks are operating without error. If no errors are found -the LED is toggled. If an error is found at any time the LED is never toggles -again. */ -#define mainCHECK_TASK_LED ( 7 ) + * that all the other tasks are operating without error. If no errors are found + * the LED is toggled. If an error is found at any time the LED is never toggles + * again. */ +#define mainCHECK_TASK_LED ( 7 ) /* The period between executions of the check task. */ -#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) /* An address in the EEPROM used to count resets. This is used to check that -the demo application is not unexpectedly resetting. */ -#define mainRESET_COUNT_ADDRESS ( ( void * ) 0x50 ) + * the demo application is not unexpectedly resetting. */ +#define mainRESET_COUNT_ADDRESS ( ( void * ) 0x50 ) /* The number of coroutines to create. */ -#define mainNUM_FLASH_COROUTINES ( 3 ) +#define mainNUM_FLASH_COROUTINES ( 3 ) /* * The task function for the "Check" task. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * Checks the unique counts of other tasks to ensure they are still operational. @@ -153,100 +153,99 @@ void vApplicationIdleHook( void ); short main( void ) { - prvIncrementResetCount(); + prvIncrementResetCount(); - /* Setup the LED's for output. */ - vParTestInitialise(); + /* Setup the LED's for output. */ + vParTestInitialise(); - /* Create the standard demo tasks. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartRegTestTasks(); + /* Create the standard demo tasks. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartRegTestTasks(); - /* Create the tasks defined within this file. */ - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + /* Create the tasks defined within this file. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - /* Create the co-routines that flash the LED's. */ - vStartFlashCoRoutines( mainNUM_FLASH_COROUTINES ); + /* Create the co-routines that flash the LED's. */ + vStartFlashCoRoutines( mainNUM_FLASH_COROUTINES ); - /* In this port, to use preemptive scheduler define configUSE_PREEMPTION - as 1 in portmacro.h. To use the cooperative scheduler define - configUSE_PREEMPTION as 0. */ - vTaskStartScheduler(); + /* In this port, to use preemptive scheduler define configUSE_PREEMPTION + * as 1 in portmacro.h. To use the cooperative scheduler define + * configUSE_PREEMPTION as 0. */ + vTaskStartScheduler(); - return 0; + return 0; } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -static volatile unsigned long ulDummyVariable = 3UL; + static volatile unsigned long ulDummyVariable = 3UL; - /* The parameters are not used. */ - ( void ) pvParameters; + /* The parameters are not used. */ + ( void ) pvParameters; - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. */ - for( ;; ) - { - vTaskDelay( mainCHECK_PERIOD ); + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. */ + for( ; ; ) + { + vTaskDelay( mainCHECK_PERIOD ); - /* Perform a bit of 32bit maths to ensure the registers used by the - integer tasks get some exercise. The result here is not important - - see the demo application documentation for more info. */ - ulDummyVariable *= 3; + /* Perform a bit of 32bit maths to ensure the registers used by the + * integer tasks get some exercise. The result here is not important - + * see the demo application documentation for more info. */ + ulDummyVariable *= 3; - prvCheckOtherTasksAreStillRunning(); - } + prvCheckOtherTasksAreStillRunning(); + } } /*-----------------------------------------------------------*/ static void prvCheckOtherTasksAreStillRunning( void ) { -static portBASE_TYPE xErrorHasOccurred = pdFALSE; - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xAreRegTestTasksStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xErrorHasOccurred == pdFALSE ) - { - /* Toggle the LED if everything is okay so we know if an error occurs even if not - using console IO. */ - vParTestToggleLED( mainCHECK_TASK_LED ); - } + static portBASE_TYPE xErrorHasOccurred = pdFALSE; + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xAreRegTestTasksStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xErrorHasOccurred == pdFALSE ) + { + /* Toggle the LED if everything is okay so we know if an error occurs even if not + * using console IO. */ + vParTestToggleLED( mainCHECK_TASK_LED ); + } } /*-----------------------------------------------------------*/ static void prvIncrementResetCount( void ) { -unsigned char ucCount; + unsigned char ucCount; - eeprom_read_block( &ucCount, mainRESET_COUNT_ADDRESS, sizeof( ucCount ) ); - ucCount++; - eeprom_write_byte( mainRESET_COUNT_ADDRESS, ucCount ); + eeprom_read_block( &ucCount, mainRESET_COUNT_ADDRESS, sizeof( ucCount ) ); + ucCount++; + eeprom_write_byte( mainRESET_COUNT_ADDRESS, ucCount ); } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - vCoRoutineSchedule(); + vCoRoutineSchedule(); } - diff --git a/FreeRTOS/Demo/AVR_ATMega323_WinAVR/regtest.c b/FreeRTOS/Demo/AVR_ATMega323_WinAVR/regtest.c index 0834b1a6714..c64decc318e 100644 --- a/FreeRTOS/Demo/AVR_ATMega323_WinAVR/regtest.c +++ b/FreeRTOS/Demo/AVR_ATMega323_WinAVR/regtest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega323_WinAVR/regtest.h b/FreeRTOS/Demo/AVR_ATMega323_WinAVR/regtest.h index b9a15760ff1..ee2817bc752 100644 --- a/FreeRTOS/Demo/AVR_ATMega323_WinAVR/regtest.h +++ b/FreeRTOS/Demo/AVR_ATMega323_WinAVR/regtest.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega323_WinAVR/serial/serial.c b/FreeRTOS/Demo/AVR_ATMega323_WinAVR/serial/serial.c index 788cd51c0c6..9941e76d1e9 100644 --- a/FreeRTOS/Demo/AVR_ATMega323_WinAVR/serial/serial.c +++ b/FreeRTOS/Demo/AVR_ATMega323_WinAVR/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/FreeRTOSConfig.h b/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/FreeRTOSConfig.h index 5a52f70e584..88ed213382d 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/ParTest/ParTest.c b/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/ParTest/ParTest.c index 49b8bf36216..e1f465090ea 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/ParTest/ParTest.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/main_blinky.c b/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/main_blinky.c index bc457b262a4..d078e23bc68 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/main_blinky.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/main_minimal.c b/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/main_minimal.c index 9593b042501..95a202e87c7 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/main_minimal.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/main_minimal.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/regtest.c b/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/regtest.c index 83acef7057a..a6e5aa56b8b 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/regtest.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/regtest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/regtest.h b/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/regtest.h index e883ac7287c..fc3e57c1dc9 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/regtest.h +++ b/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/regtest.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/serial/serial.c b/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/serial/serial.c index 16ba888cf87..da33f2846d4 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/serial/serial.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega4809_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/AVR_ATMega4809_IAR/FreeRTOSConfig.h index e0519588ac7..39a5ada1738 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/AVR_ATMega4809_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega4809_IAR/ParTest/ParTest.c b/FreeRTOS/Demo/AVR_ATMega4809_IAR/ParTest/ParTest.c index 49b8bf36216..e1f465090ea 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_IAR/ParTest/ParTest.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_IAR/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega4809_IAR/main.c b/FreeRTOS/Demo/AVR_ATMega4809_IAR/main.c index a19870dc52c..450efe8785c 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_IAR/main.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_IAR/main.c @@ -1,22 +1,22 @@ /* -(C) 2020 Microchip Technology Inc. and its subsidiaries. - -Subject to your compliance with these terms, you may use Microchip software and -any derivatives exclusively with Microchip products. It is your responsibility -to comply with third party license terms applicable to your use of third party -software (including open source software) that may accompany Microchip software. - -THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER EXPRESS, -IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES -OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, -INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER -RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF -THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWED -BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THIS -SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY -TO MICROCHIP FOR THIS SOFTWARE. -*/ + * (C) 2020 Microchip Technology Inc. and its subsidiaries. + * + * Subject to your compliance with these terms, you may use Microchip software and + * any derivatives exclusively with Microchip products. It is your responsibility + * to comply with third party license terms applicable to your use of third party + * software (including open source software) that may accompany Microchip software. + * + * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES + * OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. + * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, + * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER + * RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF + * THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWED + * BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THIS + * SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY + * TO MICROCHIP FOR THIS SOFTWARE. + */ #include #include "FreeRTOS.h" @@ -28,29 +28,29 @@ TO MICROCHIP FOR THIS SOFTWARE. static void prvSetupHardware( void ); #if ( mainSELECTED_APPLICATION == 0 ) -extern void main_blinky( void ); -extern void init_blinky( void ); + extern void main_blinky( void ); + extern void init_blinky( void ); #elif ( mainSELECTED_APPLICATION == 1 ) -extern void main_minimal( void ); -extern void init_minimal( void ); + extern void main_minimal( void ); + extern void init_minimal( void ); #elif ( mainSELECTED_APPLICATION == 2 ) -extern void main_full( void ); -extern void init_full( void ); + extern void main_full( void ); + extern void init_full( void ); #else -#error Invalid mainSELECTED_APPLICATION setting. See the comments at the top of this file and above the mainSELECTED_APPLICATION definition. + #error Invalid mainSELECTED_APPLICATION setting. See the comments at the top of this file and above the mainSELECTED_APPLICATION definition. #endif int main( void ) { prvSetupHardware(); -#if ( mainSELECTED_APPLICATION == 0 ) - main_blinky(); -#elif ( mainSELECTED_APPLICATION == 1 ) - main_minimal(); -#elif ( mainSELECTED_APPLICATION == 2 ) - main_full(); -#endif + #if ( mainSELECTED_APPLICATION == 0 ) + main_blinky(); + #elif ( mainSELECTED_APPLICATION == 1 ) + main_minimal(); + #elif ( mainSELECTED_APPLICATION == 2 ) + main_full(); + #endif return 0; } @@ -58,37 +58,37 @@ int main( void ) static void prvSetupHardware( void ) { /* Ensure no interrupts execute while the scheduler is in an inconsistent - state. Interrupts are automatically enabled when the scheduler is - started. */ + * state. Interrupts are automatically enabled when the scheduler is + * started. */ portDISABLE_INTERRUPTS(); CLK_init(); -#if ( mainSELECTED_APPLICATION == 0 ) - init_blinky(); -#elif ( mainSELECTED_APPLICATION == 1 ) - init_minimal(); -#elif ( mainSELECTED_APPLICATION == 2 ) - init_full(); -#endif + #if ( mainSELECTED_APPLICATION == 0 ) + init_blinky(); + #elif ( mainSELECTED_APPLICATION == 1 ) + init_minimal(); + #elif ( mainSELECTED_APPLICATION == 2 ) + init_full(); + #endif } /* vApplicationStackOverflowHook is called when a stack overflow occurs. -This is usefull in application development, for debugging. To use this -hook, uncomment it, and set configCHECK_FOR_STACK_OVERFLOW to 1 in -"FreeRTOSConfig.h" header file. */ + * This is usefull in application development, for debugging. To use this + * hook, uncomment it, and set configCHECK_FOR_STACK_OVERFLOW to 1 in + * "FreeRTOSConfig.h" header file. */ -// void vApplicationStackOverflowHook(TaskHandle_t *pxTask, char *pcTaskName ) -// { -// for( ;; ); -// } +/* void vApplicationStackOverflowHook(TaskHandle_t *pxTask, char *pcTaskName ) */ +/* { */ +/* for( ;; ); */ +/* } */ /* vApplicationMallocFailedHook is called when memorry allocation fails. -This is usefull in application development, for debugging. To use this -hook, uncomment it, and set configUSE_MALLOC_FAILED_HOOK to 1 in -"FreeRTOSConfig.h" header file. */ - -// void vApplicationMallocFailedHook( void ) -// { -// for( ;; ); -// } + * This is usefull in application development, for debugging. To use this + * hook, uncomment it, and set configUSE_MALLOC_FAILED_HOOK to 1 in + * "FreeRTOSConfig.h" header file. */ + +/* void vApplicationMallocFailedHook( void ) */ +/* { */ +/* for( ;; ); */ +/* } */ diff --git a/FreeRTOS/Demo/AVR_ATMega4809_IAR/main_blinky.c b/FreeRTOS/Demo/AVR_ATMega4809_IAR/main_blinky.c index 9c10ef24250..7b9f14c716c 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_IAR/main_blinky.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_IAR/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -59,25 +59,25 @@ #include "semphr.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /*-----------------------------------------------------------*/ @@ -87,18 +87,18 @@ static QueueHandle_t xQueue = NULL; void main_blinky( void ) { /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); - + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); + if( xQueue != NULL ) { /* Start the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - NULL, /* The parameter passed to the task - not used in this case. */ - mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + NULL, /* The parameter passed to the task - not used in this case. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); @@ -107,14 +107,16 @@ void main_blinky( void ) } /* 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( ;; ); + * 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( ; ; ) + { + } } void init_blinky( void ) @@ -123,10 +125,10 @@ void init_blinky( void ) PORTF.DIRSET = PIN5_bm; } -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; /* Remove compiler warning about unused parameter. */ ( void ) pvParameters; @@ -134,37 +136,37 @@ const unsigned long ulValueToSend = 100UL; /* Initialise xNextWakeTime - this only needs to be done once. */ xNextWakeTime = xTaskGetTickCount(); - for( ;; ) + for( ; ; ) { /* Place this task in the blocked state until it is time to run again. */ vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); /* 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 - will not block - it shouldn't need to block as the queue should always - be empty at this point in the code. */ + * 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 + * be empty at this point in the code. */ xQueueSend( xQueue, &ulValueToSend, 0U ); } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; -const unsigned long ulExpectedValue = 100UL; + unsigned long ulReceivedValue; + const unsigned long ulExpectedValue = 100UL; /* Remove compiler warning about unused parameter. */ ( void ) pvParameters; - for( ;; ) + for( ; ; ) { /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); /* 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 ) { /* Toggle LED on pin PF5. */ @@ -173,4 +175,3 @@ const unsigned long ulExpectedValue = 100UL; } } } - diff --git a/FreeRTOS/Demo/AVR_ATMega4809_IAR/main_full.c b/FreeRTOS/Demo/AVR_ATMega4809_IAR/main_full.c index 97de9502f96..d1606a8cd35 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_IAR/main_full.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_IAR/main_full.c @@ -7,46 +7,47 @@ #include "regtest.h" #include "recmutex.h" -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL ) -#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL ) +#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) /* The period between executions of the check task. */ -#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) /* LED that is toggled by the check task. The check task periodically checks -that all the other tasks are operating without error. If no errors are found -the LED is toggled. If an error is found at any time the LED is never toggles -again. */ -#define mainCHECK_TASK_LED ( 5 ) + * that all the other tasks are operating without error. If no errors are found + * the LED is toggled. If an error is found at any time the LED is never toggles + * again. */ +#define mainCHECK_TASK_LED ( 5 ) /* * The check task, as described at the top of this file. */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); void main_full( void ) { - - vStartSemaphoreTasks(mainSEM_TEST_PRIORITY); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); vStartTaskNotifyTask(); vStartRegTestTasks(); vStartRecursiveMutexTasks(); - + /* Create the task that performs the 'check' functionality, as described at - the top of this file. */ + * the top of this file. */ xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); 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( ;; ); + * 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( ; ; ) + { + } } void init_full( void ) @@ -54,52 +55,52 @@ void init_full( void ) vParTestInitialise(); } -static void prvCheckTask( void *pvParameters ) +static void prvCheckTask( void * pvParameters ) { -TickType_t xLastExecutionTime; -unsigned long ulErrorFound = pdFALSE; + TickType_t xLastExecutionTime; + unsigned long ulErrorFound = pdFALSE; /* Just to stop compiler warnings. */ ( void ) pvParameters; /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() - works correctly. */ + * 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 - unless an error occurred. */ - for( ;; ) + * operating without error. The onboard LED is toggled on each iteration + * unless an error occurred. */ + for( ; ; ) { /* Delay until it is time to execute again. */ vTaskDelayUntil( &xLastExecutionTime, mainCHECK_PERIOD ); /* 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( xAreSemaphoreTasksStillRunning() != pdTRUE ) { ulErrorFound |= 1UL << 0UL; } - + if( xAreTaskNotificationTasksStillRunning() != pdTRUE ) { ulErrorFound |= 1UL << 1UL; } - + if( xAreRegTestTasksStillRunning() != pdTRUE ) { ulErrorFound |= 1UL << 2UL; } - - if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) { ulErrorFound |= 1UL << 3UL; } - + if( ulErrorFound == pdFALSE ) { /* Toggle the LED if everything is okay so we know if an error occurs even if not - using console IO. */ + * using console IO. */ vParTestToggleLED( mainCHECK_TASK_LED ); } } diff --git a/FreeRTOS/Demo/AVR_ATMega4809_IAR/main_minimal.c b/FreeRTOS/Demo/AVR_ATMega4809_IAR/main_minimal.c index 21860a96ec5..27f6b00d7aa 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_IAR/main_minimal.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_IAR/main_minimal.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -37,7 +37,7 @@ #include "regtest.h" /* Priority definitions for most of the tasks in the demo application. Some -tasks just use the idle priority. */ + * tasks just use the idle priority. */ #define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) #define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) #define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) @@ -46,20 +46,20 @@ tasks just use the idle priority. */ #define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 9600 ) /* LED used by the serial port tasks. This is toggled on each character Tx, -and mainCOM_TEST_LED + 1 is toggles on each character Rx. */ + * and mainCOM_TEST_LED + 1 is toggles on each character Rx. */ #define mainCOM_TEST_LED ( 6 ) /* LED that is toggled by the check task. The check task periodically checks -that all the other tasks are operating without error. If no errors are found -the LED is toggled. If an error is found at any time the LED is never toggles -again. */ + * that all the other tasks are operating without error. If no errors are found + * the LED is toggled. If an error is found at any time the LED is never toggles + * again. */ #define mainCHECK_TASK_LED ( 5 ) /* The period between executions of the check task. */ #define mainCHECK_PERIOD ( ( TickType_t ) 1000 / portTICK_PERIOD_MS ) /* An address in the EEPROM used to count resets. This is used to check that -the demo application is not unexpectedly resetting. */ + * the demo application is not unexpectedly resetting. */ #define mainRESET_COUNT_ADDRESS ( 0x1400 ) /* The number of coroutines to create. */ @@ -68,7 +68,7 @@ the demo application is not unexpectedly resetting. */ /* * The task function for the "Check" task. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * Checks the unique counts of other tasks to ensure they are still operational. @@ -91,16 +91,16 @@ void main_minimal( void ) vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); vStartRegTestTasks(); - + /* Create the tasks defined within this file. */ xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); /* Create the co-routines that flash the LED's. */ vStartFlashCoRoutines( mainNUM_FLASH_COROUTINES ); - + /* In this port, to use preemptive scheduler define configUSE_PREEMPTION - as 1 in portmacro.h. To use the cooperative scheduler define - configUSE_PREEMPTION as 0. */ + * as 1 in portmacro.h. To use the cooperative scheduler define + * configUSE_PREEMPTION as 0. */ vTaskStartScheduler(); } @@ -109,28 +109,28 @@ void init_minimal( void ) /* Configure UART pins: PB0 Rx, PB1 Tx */ PORTB.DIR &= ~PIN1_bm; PORTB.DIR |= PIN0_bm; - + vParTestInitialise(); } -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -static volatile unsigned long ulDummyVariable = 3UL; + static volatile unsigned long ulDummyVariable = 3UL; /* The parameters are not used. */ ( void ) pvParameters; /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. */ - for( ;; ) + * operating without error. */ + for( ; ; ) { vTaskDelay( mainCHECK_PERIOD ); /* Perform a bit of 32bit maths to ensure the registers used by the - integer tasks get some exercise. The result here is not important - - see the demo application documentation for more info. */ + * integer tasks get some exercise. The result here is not important - + * see the demo application documentation for more info. */ ulDummyVariable *= 3; - + prvCheckOtherTasksAreStillRunning(); } } @@ -138,7 +138,7 @@ static volatile unsigned long ulDummyVariable = 3UL; static void prvCheckOtherTasksAreStillRunning( void ) { -static portBASE_TYPE xErrorHasOccurred = pdFALSE; + static portBASE_TYPE xErrorHasOccurred = pdFALSE; if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { @@ -159,11 +159,11 @@ static portBASE_TYPE xErrorHasOccurred = pdFALSE; { xErrorHasOccurred = pdTRUE; } - + if( xErrorHasOccurred == pdFALSE ) { /* Toggle the LED if everything is okay so we know if an error occurs even if not - using console IO. */ + * using console IO. */ vParTestToggleLED( mainCHECK_TASK_LED ); } } @@ -171,7 +171,7 @@ static portBASE_TYPE xErrorHasOccurred = pdFALSE; static void prvIncrementResetCount( void ) { -static unsigned char __eeprom ucResetCount @ mainRESET_COUNT_ADDRESS; + static unsigned char __eeprom ucResetCount @ mainRESET_COUNT_ADDRESS; ucResetCount++; } diff --git a/FreeRTOS/Demo/AVR_ATMega4809_IAR/regtest.c b/FreeRTOS/Demo/AVR_ATMega4809_IAR/regtest.c index c159de453e3..220298db620 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_IAR/regtest.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_IAR/regtest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega4809_IAR/regtest.h b/FreeRTOS/Demo/AVR_ATMega4809_IAR/regtest.h index e883ac7287c..fc3e57c1dc9 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_IAR/regtest.h +++ b/FreeRTOS/Demo/AVR_ATMega4809_IAR/regtest.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega4809_IAR/serial/serial.c b/FreeRTOS/Demo/AVR_ATMega4809_IAR/serial/serial.c index 69eb3138daa..683266ef297 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_IAR/serial/serial.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_IAR/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/FreeRTOSConfig.h b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/FreeRTOSConfig.h index 09084506b79..61704f8d69c 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/ParTest/ParTest.c b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/ParTest/ParTest.c index 49b8bf36216..e1f465090ea 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/ParTest/ParTest.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/main.c b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/main.c index e7e32f0943d..1088b1f7835 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/main.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/main.c @@ -1,22 +1,22 @@ /* -(C) 2020 Microchip Technology Inc. and its subsidiaries. - -Subject to your compliance with these terms, you may use Microchip software and -any derivatives exclusively with Microchip products. It is your responsibility -to comply with third party license terms applicable to your use of third party -software (including open source software) that may accompany Microchip software. - -THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER EXPRESS, -IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES -OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, -INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER -RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF -THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWED -BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THIS -SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY -TO MICROCHIP FOR THIS SOFTWARE. -*/ + * (C) 2020 Microchip Technology Inc. and its subsidiaries. + * + * Subject to your compliance with these terms, you may use Microchip software and + * any derivatives exclusively with Microchip products. It is your responsibility + * to comply with third party license terms applicable to your use of third party + * software (including open source software) that may accompany Microchip software. + * + * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES + * OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. + * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, + * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER + * RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF + * THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWED + * BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THIS + * SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY + * TO MICROCHIP FOR THIS SOFTWARE. + */ #include #include "FreeRTOS.h" @@ -28,29 +28,29 @@ TO MICROCHIP FOR THIS SOFTWARE. static void prvSetupHardware( void ); #if ( mainSELECTED_APPLICATION == 0 ) -extern void main_blinky( void ); -extern void init_blinky( void ); + extern void main_blinky( void ); + extern void init_blinky( void ); #elif ( mainSELECTED_APPLICATION == 1 ) -extern void main_minimal( void ); -extern void init_minimal( void ); + extern void main_minimal( void ); + extern void init_minimal( void ); #elif ( mainSELECTED_APPLICATION == 2 ) -extern void main_full( void ); -extern void init_full( void ); + extern void main_full( void ); + extern void init_full( void ); #else -#error Invalid mainSELECTED_APPLICATION setting. See the comments at the top of this file and above the mainSELECTED_APPLICATION definition. + #error Invalid mainSELECTED_APPLICATION setting. See the comments at the top of this file and above the mainSELECTED_APPLICATION definition. #endif int main( void ) { prvSetupHardware(); -#if ( mainSELECTED_APPLICATION == 0 ) - main_blinky(); -#elif ( mainSELECTED_APPLICATION == 1 ) - main_minimal(); -#elif ( mainSELECTED_APPLICATION == 2 ) - main_full(); -#endif + #if ( mainSELECTED_APPLICATION == 0 ) + main_blinky(); + #elif ( mainSELECTED_APPLICATION == 1 ) + main_minimal(); + #elif ( mainSELECTED_APPLICATION == 2 ) + main_full(); + #endif return 0; } @@ -58,37 +58,58 @@ int main( void ) static void prvSetupHardware( void ) { /* Ensure no interrupts execute while the scheduler is in an inconsistent - state. Interrupts are automatically enabled when the scheduler is - started. */ + * state. Interrupts are automatically enabled when the scheduler is + * started. */ portDISABLE_INTERRUPTS(); CLK_init(); -#if ( mainSELECTED_APPLICATION == 0 ) - init_blinky(); -#elif ( mainSELECTED_APPLICATION == 1 ) - init_minimal(); -#elif ( mainSELECTED_APPLICATION == 2 ) - init_full(); -#endif + #if ( mainSELECTED_APPLICATION == 0 ) + init_blinky(); + #elif ( mainSELECTED_APPLICATION == 1 ) + init_minimal(); + #elif ( mainSELECTED_APPLICATION == 2 ) + init_full(); + #endif } /* vApplicationStackOverflowHook is called when a stack overflow occurs. -This is usefull in application development, for debugging. To use this -hook, uncomment it, and set configCHECK_FOR_STACK_OVERFLOW to 1 in -"FreeRTOSConfig.h" header file. */ - -// void vApplicationStackOverflowHook(TaskHandle_t *pxTask, char *pcTaskName ) -// { -// for( ;; ); -// } + * This is usefull in application development, for debugging. To use this + * hook, uncomment it, and set configCHECK_FOR_STACK_OVERFLOW to 1 in + * "FreeRTOSConfig.h" header file. */ + +#if ( portHAS_STACK_OVERFLOW_CHECKING != 0 ) && ( configCHECK_FOR_STACK_OVERFLOW != 0 ) + void vApplicationStackOverflowHook( void ) + { + volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0; + taskENTER_CRITICAL(); + /* To debug this failure set ulSetToNonZeroInDebuggerToContinue + * to a non-zero value using a debugger. */ + while( ulSetToNonZeroInDebuggerToContinue == 0 ) + { + portNOP(); + } + taskEXIT_CRITICAL(); + } +#endif /* ( portHAS_STACK_OVERFLOW_CHECKING != 0 ) && ( configCHECK_FOR_STACK_OVERFLOW != 0 ) */ /* vApplicationMallocFailedHook is called when memorry allocation fails. -This is usefull in application development, for debugging. To use this -hook, uncomment it, and set configUSE_MALLOC_FAILED_HOOK to 1 in -"FreeRTOSConfig.h" header file. */ - -// void vApplicationMallocFailedHook( void ) -// { -// for( ;; ); -// } + * This is usefull in application development, for debugging. To use this + * hook, uncomment it, and set configUSE_MALLOC_FAILED_HOOK to 1 in + * "FreeRTOSConfig.h" header file. */ + +#if ( configUSE_MALLOC_FAILED_HOOK != 0 ) + void vApplicationMallocFailedHook( void ) + { + volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0; + taskENTER_CRITICAL(); + /* To debug this failure set ulSetToNonZeroInDebuggerToContinue + * to a non-zero value using a debugger. */ + while( ulSetToNonZeroInDebuggerToContinue == 0 ) + { + /* No-Op */ + portNOP(); + } + taskEXIT_CRITICAL(); + } +#endif /* configUSE_MALLOC_FAILED_HOOK */ diff --git a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/main_blinky.c b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/main_blinky.c index bc457b262a4..8c2567f6175 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/main_blinky.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -59,25 +59,25 @@ #include "semphr.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /*-----------------------------------------------------------*/ @@ -87,18 +87,18 @@ static QueueHandle_t xQueue = NULL; void main_blinky( void ) { /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); - + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); + if( xQueue != NULL ) { /* Start the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - NULL, /* The parameter passed to the task - not used in this case. */ - mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + NULL, /* The parameter passed to the task - not used in this case. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); @@ -107,14 +107,16 @@ void main_blinky( void ) } /* 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( ;; ); + * 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( ; ; ) + { + } } void init_blinky( void ) @@ -123,10 +125,10 @@ void init_blinky( void ) PORTF.DIRSET = PIN5_bm; } -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; /* Remove compiler warning about unused parameter. */ ( void ) pvParameters; @@ -134,37 +136,37 @@ const unsigned long ulValueToSend = 100UL; /* Initialise xNextWakeTime - this only needs to be done once. */ xNextWakeTime = xTaskGetTickCount(); - for( ;; ) + for( ; ; ) { /* Place this task in the blocked state until it is time to run again. */ vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); /* 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 - will not block - it shouldn't need to block as the queue should always - be empty at this point in the code. */ + * 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 + * be empty at this point in the code. */ xQueueSend( xQueue, &ulValueToSend, 0U ); } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; -const unsigned long ulExpectedValue = 100UL; + unsigned long ulReceivedValue; + const unsigned long ulExpectedValue = 100UL; /* Remove compiler warning about unused parameter. */ ( void ) pvParameters; - for( ;; ) + for( ; ; ) { /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); /* 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 ) { /* Toggle LED on pin PF5. */ diff --git a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/main_full.c b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/main_full.c index 5bd35b256eb..8cf20a53c10 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/main_full.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/main_full.c @@ -6,43 +6,45 @@ #include "regtest.h" #include "recmutex.h" -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL ) -#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL ) +#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) /* The period between executions of the check task. */ -#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) /* LED that is toggled by the check task. The check task periodically checks -that all the other tasks are operating without error. If no errors are found -the LED is toggled. If an error is found at any time the LED is never toggles -again. */ -#define mainCHECK_TASK_LED ( 5 ) + * that all the other tasks are operating without error. If no errors are found + * the LED is toggled. If an error is found at any time the LED is never toggles + * again. */ +#define mainCHECK_TASK_LED ( 5 ) /* The check task, as described at the top of this file. */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); void main_full( void ) { - vStartSemaphoreTasks(mainSEM_TEST_PRIORITY); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); vStartTaskNotifyTask(); vStartRegTestTasks(); vStartRecursiveMutexTasks(); /* Create the task that performs the 'check' functionality, as described at - the top of this file. */ + * the top of this file. */ xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); 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( ;; ); + * 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( ; ; ) + { + } } void init_full( void ) @@ -50,52 +52,52 @@ void init_full( void ) vParTestInitialise(); } -static void prvCheckTask( void *pvParameters ) +static void prvCheckTask( void * pvParameters ) { -TickType_t xLastExecutionTime; -unsigned long ulErrorFound = pdFALSE; + TickType_t xLastExecutionTime; + unsigned long ulErrorFound = pdFALSE; /* Just to stop compiler warnings. */ ( void ) pvParameters; /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() - works correctly. */ + * 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 - unless an error occurred. */ - for( ;; ) + * operating without error. The onboard LED is toggled on each iteration + * unless an error occurred. */ + for( ; ; ) { /* Delay until it is time to execute again. */ vTaskDelayUntil( &xLastExecutionTime, mainCHECK_PERIOD ); /* 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( xAreSemaphoreTasksStillRunning() != pdTRUE ) { ulErrorFound |= 1UL << 0UL; } - + if( xAreTaskNotificationTasksStillRunning() != pdTRUE ) { ulErrorFound |= 1UL << 1UL; } - + if( xAreRegTestTasksStillRunning() != pdTRUE ) { ulErrorFound |= 1UL << 2UL; } - - if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) { ulErrorFound |= 1UL << 3UL; } - + if( ulErrorFound == pdFALSE ) { /* Toggle the LED if everything is okay so we know if an error occurs even if not - using console IO. */ + * using console IO. */ vParTestToggleLED( mainCHECK_TASK_LED ); } } diff --git a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/main_minimal.c b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/main_minimal.c index 9593b042501..5b9bb8123ca 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/main_minimal.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/main_minimal.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -38,7 +38,7 @@ #include "regtest.h" /* Priority definitions for most of the tasks in the demo application. Some -tasks just use the idle priority. */ + * tasks just use the idle priority. */ #define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) #define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) #define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) @@ -47,20 +47,20 @@ tasks just use the idle priority. */ #define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 9600 ) /* LED used by the serial port tasks. This is toggled on each character Tx, -and mainCOM_TEST_LED + 1 is toggles on each character Rx. */ + * and mainCOM_TEST_LED + 1 is toggles on each character Rx. */ #define mainCOM_TEST_LED ( 6 ) /* LED that is toggled by the check task. The check task periodically checks -that all the other tasks are operating without error. If no errors are found -the LED is toggled. If an error is found at any time the LED is never toggles -again. */ + * that all the other tasks are operating without error. If no errors are found + * the LED is toggled. If an error is found at any time the LED is never toggles + * again. */ #define mainCHECK_TASK_LED ( 5 ) /* The period between executions of the check task. */ #define mainCHECK_PERIOD ( ( TickType_t ) 1000 / portTICK_PERIOD_MS ) /* An address in the EEPROM used to count resets. This is used to check that -the demo application is not unexpectedly resetting. */ + * the demo application is not unexpectedly resetting. */ #define mainRESET_COUNT_ADDRESS ( 0x1400 ) /* The number of coroutines to create. */ @@ -69,7 +69,7 @@ the demo application is not unexpectedly resetting. */ /* * The task function for the "Check" task. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * Checks the unique counts of other tasks to ensure they are still operational. @@ -92,16 +92,16 @@ void main_minimal( void ) vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); vStartRegTestTasks(); - + /* Create the tasks defined within this file. */ xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); /* Create the co-routines that flash the LED's. */ vStartFlashCoRoutines( mainNUM_FLASH_COROUTINES ); - + /* In this port, to use preemptive scheduler define configUSE_PREEMPTION - as 1 in portmacro.h. To use the cooperative scheduler define - configUSE_PREEMPTION as 0. */ + * as 1 in portmacro.h. To use the cooperative scheduler define + * configUSE_PREEMPTION as 0. */ vTaskStartScheduler(); } @@ -110,28 +110,28 @@ void init_minimal( void ) /* Configure UART pins: PB0 Rx, PB1 Tx */ PORTB.DIR &= ~PIN1_bm; PORTB.DIR |= PIN0_bm; - + vParTestInitialise(); } -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -static volatile unsigned long ulDummyVariable = 3UL; + static volatile unsigned long ulDummyVariable = 3UL; /* The parameters are not used. */ ( void ) pvParameters; /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. */ - for( ;; ) + * operating without error. */ + for( ; ; ) { vTaskDelay( mainCHECK_PERIOD ); /* Perform a bit of 32bit maths to ensure the registers used by the - integer tasks get some exercise. The result here is not important - - see the demo application documentation for more info. */ + * integer tasks get some exercise. The result here is not important - + * see the demo application documentation for more info. */ ulDummyVariable *= 3; - + prvCheckOtherTasksAreStillRunning(); } } @@ -139,7 +139,7 @@ static volatile unsigned long ulDummyVariable = 3UL; static void prvCheckOtherTasksAreStillRunning( void ) { -static portBASE_TYPE xErrorHasOccurred = pdFALSE; + static portBASE_TYPE xErrorHasOccurred = pdFALSE; if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { @@ -160,11 +160,11 @@ static portBASE_TYPE xErrorHasOccurred = pdFALSE; { xErrorHasOccurred = pdTRUE; } - + if( xErrorHasOccurred == pdFALSE ) { /* Toggle the LED if everything is okay so we know if an error occurs even if not - using console IO. */ + * using console IO. */ vParTestToggleLED( mainCHECK_TASK_LED ); } } @@ -172,7 +172,7 @@ static portBASE_TYPE xErrorHasOccurred = pdFALSE; static void prvIncrementResetCount( void ) { -unsigned char ucResetCount; + unsigned char ucResetCount; eeprom_read_block( &ucResetCount, ( void * ) mainRESET_COUNT_ADDRESS, sizeof( ucResetCount ) ); ucResetCount++; diff --git a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/regtest.c b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/regtest.c index 7e01a663d46..7d0251059ec 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/regtest.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/regtest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/regtest.h b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/regtest.h index e883ac7287c..fc3e57c1dc9 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/regtest.h +++ b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/regtest.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/serial/serial.c b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/serial/serial.c index 16ba888cf87..da33f2846d4 100644 --- a/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/serial/serial.c +++ b/FreeRTOS/Demo/AVR_ATMega4809_MPLAB.X/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/FreeRTOSConfig.h b/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/FreeRTOSConfig.h index f69f5a1ab7c..bace37cc4a4 100644 --- a/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/ParTest.c b/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/ParTest.c index 240a339b3fc..e67841722e9 100644 --- a/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/ParTest.c +++ b/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/main.c b/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/main.c index 53497f92303..90103f2802f 100644 --- a/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/main.c +++ b/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/regtest.c b/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/regtest.c index a57fe8b368e..55ae7e9b1d8 100644 --- a/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/regtest.c +++ b/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/regtest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/regtest.h b/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/regtest.h index 146591586b7..076808cca69 100644 --- a/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/regtest.h +++ b/FreeRTOS/Demo/AVR_ATmega328PB_Xplained_mini_GCC/RTOSDemo/regtest.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/FreeRTOSConfig.h b/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/FreeRTOSConfig.h index 544b54eaeb4..e0f4321e5d4 100644 --- a/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/ParTest/partest.c b/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/ParTest/partest.c index 27a269c0368..e5a1b69ee99 100644 --- a/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/ParTest/partest.c +++ b/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/ParTest/partest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/main_blinky.c b/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/main_blinky.c index b941f928a17..db9fb594460 100644 --- a/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/main_blinky.c +++ b/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/main_minimal.c b/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/main_minimal.c index bf54d4b5c0d..8cbf2b0b02b 100644 --- a/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/main_minimal.c +++ b/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/main_minimal.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/regtest.c b/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/regtest.c index 83acef7057a..a6e5aa56b8b 100644 --- a/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/regtest.c +++ b/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/regtest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/regtest.h b/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/regtest.h index fbaa9534de8..8d28ee9ad25 100644 --- a/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/regtest.h +++ b/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/regtest.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/serial/serial.c b/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/serial/serial.c index efda48f84e2..5b10c28e2f5 100644 --- a/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/serial/serial.c +++ b/FreeRTOS/Demo/AVR_Dx_Atmel_Studio/RTOSDemo/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_Dx_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/AVR_Dx_IAR/FreeRTOSConfig.h index b38ad18cdd2..d61870e8835 100644 --- a/FreeRTOS/Demo/AVR_Dx_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/AVR_Dx_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_Dx_IAR/ParTest/partest.c b/FreeRTOS/Demo/AVR_Dx_IAR/ParTest/partest.c index 27a269c0368..e5a1b69ee99 100644 --- a/FreeRTOS/Demo/AVR_Dx_IAR/ParTest/partest.c +++ b/FreeRTOS/Demo/AVR_Dx_IAR/ParTest/partest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_Dx_IAR/RegTest.c b/FreeRTOS/Demo/AVR_Dx_IAR/RegTest.c index c159de453e3..220298db620 100644 --- a/FreeRTOS/Demo/AVR_Dx_IAR/RegTest.c +++ b/FreeRTOS/Demo/AVR_Dx_IAR/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_Dx_IAR/RegTest.h b/FreeRTOS/Demo/AVR_Dx_IAR/RegTest.h index e883ac7287c..fc3e57c1dc9 100644 --- a/FreeRTOS/Demo/AVR_Dx_IAR/RegTest.h +++ b/FreeRTOS/Demo/AVR_Dx_IAR/RegTest.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_Dx_IAR/main.c b/FreeRTOS/Demo/AVR_Dx_IAR/main.c index a19870dc52c..b2fc4894249 100644 --- a/FreeRTOS/Demo/AVR_Dx_IAR/main.c +++ b/FreeRTOS/Demo/AVR_Dx_IAR/main.c @@ -1,22 +1,22 @@ /* -(C) 2020 Microchip Technology Inc. and its subsidiaries. - -Subject to your compliance with these terms, you may use Microchip software and -any derivatives exclusively with Microchip products. It is your responsibility -to comply with third party license terms applicable to your use of third party -software (including open source software) that may accompany Microchip software. - -THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER EXPRESS, -IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES -OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, -INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER -RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF -THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWED -BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THIS -SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY -TO MICROCHIP FOR THIS SOFTWARE. -*/ + * (C) 2020 Microchip Technology Inc. and its subsidiaries. + * + * Subject to your compliance with these terms, you may use Microchip software and + * any derivatives exclusively with Microchip products. It is your responsibility + * to comply with third party license terms applicable to your use of third party + * software (including open source software) that may accompany Microchip software. + * + * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES + * OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. + * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, + * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER + * RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF + * THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWED + * BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THIS + * SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY + * TO MICROCHIP FOR THIS SOFTWARE. + */ #include #include "FreeRTOS.h" @@ -28,29 +28,29 @@ TO MICROCHIP FOR THIS SOFTWARE. static void prvSetupHardware( void ); #if ( mainSELECTED_APPLICATION == 0 ) -extern void main_blinky( void ); -extern void init_blinky( void ); + extern void main_blinky( void ); + extern void init_blinky( void ); #elif ( mainSELECTED_APPLICATION == 1 ) -extern void main_minimal( void ); -extern void init_minimal( void ); + extern void main_minimal( void ); + extern void init_minimal( void ); #elif ( mainSELECTED_APPLICATION == 2 ) -extern void main_full( void ); -extern void init_full( void ); + extern void main_full( void ); + extern void init_full( void ); #else -#error Invalid mainSELECTED_APPLICATION setting. See the comments at the top of this file and above the mainSELECTED_APPLICATION definition. + #error Invalid mainSELECTED_APPLICATION setting. See the comments at the top of this file and above the mainSELECTED_APPLICATION definition. #endif int main( void ) { prvSetupHardware(); -#if ( mainSELECTED_APPLICATION == 0 ) - main_blinky(); -#elif ( mainSELECTED_APPLICATION == 1 ) - main_minimal(); -#elif ( mainSELECTED_APPLICATION == 2 ) - main_full(); -#endif + #if ( mainSELECTED_APPLICATION == 0 ) + main_blinky(); + #elif ( mainSELECTED_APPLICATION == 1 ) + main_minimal(); + #elif ( mainSELECTED_APPLICATION == 2 ) + main_full(); + #endif return 0; } @@ -58,37 +58,58 @@ int main( void ) static void prvSetupHardware( void ) { /* Ensure no interrupts execute while the scheduler is in an inconsistent - state. Interrupts are automatically enabled when the scheduler is - started. */ + * state. Interrupts are automatically enabled when the scheduler is + * started. */ portDISABLE_INTERRUPTS(); CLK_init(); -#if ( mainSELECTED_APPLICATION == 0 ) - init_blinky(); -#elif ( mainSELECTED_APPLICATION == 1 ) - init_minimal(); -#elif ( mainSELECTED_APPLICATION == 2 ) - init_full(); -#endif + #if ( mainSELECTED_APPLICATION == 0 ) + init_blinky(); + #elif ( mainSELECTED_APPLICATION == 1 ) + init_minimal(); + #elif ( mainSELECTED_APPLICATION == 2 ) + init_full(); + #endif } /* vApplicationStackOverflowHook is called when a stack overflow occurs. -This is usefull in application development, for debugging. To use this -hook, uncomment it, and set configCHECK_FOR_STACK_OVERFLOW to 1 in -"FreeRTOSConfig.h" header file. */ - -// void vApplicationStackOverflowHook(TaskHandle_t *pxTask, char *pcTaskName ) -// { -// for( ;; ); -// } + * This is usefull in application development, for debugging. To use this + * hook, uncomment it, and set configCHECK_FOR_STACK_OVERFLOW to 1 in + * "FreeRTOSConfig.h" header file. */ + +#if ( portHAS_STACK_OVERFLOW_CHECKING != 0 ) && ( configCHECK_FOR_STACK_OVERFLOW != 0 ) + void vApplicationStackOverflowHook( void ) + { + volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0; + taskENTER_CRITICAL(); + /* To debug this failure set ulSetToNonZeroInDebuggerToContinue + * to a non-zero value using a debugger. */ + while( ulSetToNonZeroInDebuggerToContinue == 0 ) + { + portNOP(); + } + taskEXIT_CRITICAL(); + } +#endif /* ( portHAS_STACK_OVERFLOW_CHECKING != 0 ) && ( configCHECK_FOR_STACK_OVERFLOW != 0 ) */ /* vApplicationMallocFailedHook is called when memorry allocation fails. -This is usefull in application development, for debugging. To use this -hook, uncomment it, and set configUSE_MALLOC_FAILED_HOOK to 1 in -"FreeRTOSConfig.h" header file. */ - -// void vApplicationMallocFailedHook( void ) -// { -// for( ;; ); -// } + * This is usefull in application development, for debugging. To use this + * hook, uncomment it, and set configUSE_MALLOC_FAILED_HOOK to 1 in + * "FreeRTOSConfig.h" header file. */ + +#if ( configUSE_MALLOC_FAILED_HOOK != 0 ) + void vApplicationMallocFailedHook( void ) + { + volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0; + taskENTER_CRITICAL(); + /* To debug this failure set ulSetToNonZeroInDebuggerToContinue + * to a non-zero value using a debugger. */ + while( ulSetToNonZeroInDebuggerToContinue == 0 ) + { + /* No-Op */ + portNOP(); + } + taskEXIT_CRITICAL(); + } +#endif /* configUSE_MALLOC_FAILED_HOOK */ diff --git a/FreeRTOS/Demo/AVR_Dx_IAR/main_blinky.c b/FreeRTOS/Demo/AVR_Dx_IAR/main_blinky.c index 5a2fac95f58..76640b9a41d 100644 --- a/FreeRTOS/Demo/AVR_Dx_IAR/main_blinky.c +++ b/FreeRTOS/Demo/AVR_Dx_IAR/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -59,25 +59,25 @@ #include "semphr.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /*-----------------------------------------------------------*/ @@ -87,18 +87,18 @@ static QueueHandle_t xQueue = NULL; void main_blinky( void ) { /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); - + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); + if( xQueue != NULL ) { /* Start the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - NULL, /* The parameter passed to the task - not used in this case. */ - mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + NULL, /* The parameter passed to the task - not used in this case. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); @@ -107,14 +107,16 @@ void main_blinky( void ) } /* 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( ;; ); + * 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( ; ; ) + { + } } void init_blinky( void ) @@ -123,10 +125,10 @@ void init_blinky( void ) PORTC.DIRSET = PIN6_bm; } -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; /* Remove compiler warning about unused parameter. */ ( void ) pvParameters; @@ -134,37 +136,37 @@ const unsigned long ulValueToSend = 100UL; /* Initialise xNextWakeTime - this only needs to be done once. */ xNextWakeTime = xTaskGetTickCount(); - for( ;; ) + for( ; ; ) { /* Place this task in the blocked state until it is time to run again. */ vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); /* 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 - will not block - it shouldn't need to block as the queue should always - be empty at this point in the code. */ + * 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 + * be empty at this point in the code. */ xQueueSend( xQueue, &ulValueToSend, 0U ); } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; -const unsigned long ulExpectedValue = 100UL; + unsigned long ulReceivedValue; + const unsigned long ulExpectedValue = 100UL; /* Remove compiler warning about unused parameter. */ ( void ) pvParameters; - for( ;; ) + for( ; ; ) { /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); /* 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 ) { /* Toggle LED on pin PC6. */ @@ -173,4 +175,3 @@ const unsigned long ulExpectedValue = 100UL; } } } - diff --git a/FreeRTOS/Demo/AVR_Dx_IAR/main_full.c b/FreeRTOS/Demo/AVR_Dx_IAR/main_full.c index 7759a6fae63..d64cfa693bd 100644 --- a/FreeRTOS/Demo/AVR_Dx_IAR/main_full.c +++ b/FreeRTOS/Demo/AVR_Dx_IAR/main_full.c @@ -7,46 +7,47 @@ #include "regtest.h" #include "recmutex.h" -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL ) -#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL ) +#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) /* The period between executions of the check task. */ -#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) /* LED that is toggled by the check task. The check task periodically checks -that all the other tasks are operating without error. If no errors are found -the LED is toggled. If an error is found at any time the LED is never toggles -again. */ -#define mainCHECK_TASK_LED ( 6 ) + * that all the other tasks are operating without error. If no errors are found + * the LED is toggled. If an error is found at any time the LED is never toggles + * again. */ +#define mainCHECK_TASK_LED ( 6 ) /* * The check task, as described at the top of this file. */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); void main_full( void ) { - - vStartSemaphoreTasks(mainSEM_TEST_PRIORITY); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); vStartTaskNotifyTask(); vStartRegTestTasks(); vStartRecursiveMutexTasks(); - + /* Create the task that performs the 'check' functionality, as described at - the top of this file. */ + * the top of this file. */ xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); 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( ;; ); + * 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( ; ; ) + { + } } void init_full( void ) @@ -54,52 +55,52 @@ void init_full( void ) vParTestInitialise(); } -static void prvCheckTask( void *pvParameters ) +static void prvCheckTask( void * pvParameters ) { -TickType_t xLastExecutionTime; -unsigned long ulErrorFound = pdFALSE; + TickType_t xLastExecutionTime; + unsigned long ulErrorFound = pdFALSE; /* Just to stop compiler warnings. */ ( void ) pvParameters; /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() - works correctly. */ + * 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 - unless an error occurred. */ - for( ;; ) + * operating without error. The onboard LED is toggled on each iteration + * unless an error occurred. */ + for( ; ; ) { /* Delay until it is time to execute again. */ vTaskDelayUntil( &xLastExecutionTime, mainCHECK_PERIOD ); /* 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( xAreSemaphoreTasksStillRunning() != pdTRUE ) { ulErrorFound |= 1UL << 0UL; } - + if( xAreTaskNotificationTasksStillRunning() != pdTRUE ) { ulErrorFound |= 1UL << 1UL; } - + if( xAreRegTestTasksStillRunning() != pdTRUE ) { ulErrorFound |= 1UL << 2UL; } - - if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) { ulErrorFound |= 1UL << 3UL; } - + if( ulErrorFound == pdFALSE ) { /* Toggle the LED if everything is okay so we know if an error occurs even if not - using console IO. */ + * using console IO. */ vParTestToggleLED( mainCHECK_TASK_LED ); } } diff --git a/FreeRTOS/Demo/AVR_Dx_IAR/main_minimal.c b/FreeRTOS/Demo/AVR_Dx_IAR/main_minimal.c index 60999311ba8..9e489795125 100644 --- a/FreeRTOS/Demo/AVR_Dx_IAR/main_minimal.c +++ b/FreeRTOS/Demo/AVR_Dx_IAR/main_minimal.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -37,7 +37,7 @@ #include "regtest.h" /* Priority definitions for most of the tasks in the demo application. Some -tasks just use the idle priority. */ + * tasks just use the idle priority. */ #define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) #define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) #define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) @@ -46,20 +46,20 @@ tasks just use the idle priority. */ #define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 9600 ) /* LED used by the serial port tasks. This is toggled on each character Tx, -and mainCOM_TEST_LED + 1 is toggles on each character Rx. */ + * and mainCOM_TEST_LED + 1 is toggles on each character Rx. */ #define mainCOM_TEST_LED ( 7 ) /* LED that is toggled by the check task. The check task periodically checks -that all the other tasks are operating without error. If no errors are found -the LED is toggled. If an error is found at any time the LED is never toggles -again. */ + * that all the other tasks are operating without error. If no errors are found + * the LED is toggled. If an error is found at any time the LED is never toggles + * again. */ #define mainCHECK_TASK_LED ( 6 ) /* The period between executions of the check task. */ #define mainCHECK_PERIOD ( ( TickType_t ) 1000 / portTICK_PERIOD_MS ) /* An address in the EEPROM used to count resets. This is used to check that -the demo application is not unexpectedly resetting. */ + * the demo application is not unexpectedly resetting. */ #define mainRESET_COUNT_ADDRESS ( 0x1400 ) /* The number of coroutines to create. */ @@ -68,7 +68,7 @@ the demo application is not unexpectedly resetting. */ /* * The task function for the "Check" task. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * Checks the unique counts of other tasks to ensure they are still operational. @@ -91,16 +91,16 @@ void main_minimal( void ) vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); vStartRegTestTasks(); - + /* Create the tasks defined within this file. */ xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); /* Create the co-routines that flash the LED's. */ vStartFlashCoRoutines( mainNUM_FLASH_COROUTINES ); - + /* In this port, to use preemptive scheduler define configUSE_PREEMPTION - as 1 in portmacro.h. To use the cooperative scheduler define - configUSE_PREEMPTION as 0. */ + * as 1 in portmacro.h. To use the cooperative scheduler define + * configUSE_PREEMPTION as 0. */ vTaskStartScheduler(); } @@ -109,28 +109,28 @@ void init_minimal( void ) /* Configure UART pins: PC1 Rx, PC0 Tx */ PORTC.DIR &= ~PIN0_bm; PORTC.DIR |= PIN1_bm; - + vParTestInitialise(); } -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -static volatile unsigned long ulDummyVariable = 3UL; + static volatile unsigned long ulDummyVariable = 3UL; /* The parameters are not used. */ ( void ) pvParameters; /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. */ - for( ;; ) + * operating without error. */ + for( ; ; ) { vTaskDelay( mainCHECK_PERIOD ); /* Perform a bit of 32bit maths to ensure the registers used by the - integer tasks get some exercise. The result here is not important - - see the demo application documentation for more info. */ + * integer tasks get some exercise. The result here is not important - + * see the demo application documentation for more info. */ ulDummyVariable *= 3; - + prvCheckOtherTasksAreStillRunning(); } } @@ -138,7 +138,7 @@ static volatile unsigned long ulDummyVariable = 3UL; static void prvCheckOtherTasksAreStillRunning( void ) { -static portBASE_TYPE xErrorHasOccurred = pdFALSE; + static portBASE_TYPE xErrorHasOccurred = pdFALSE; if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { @@ -159,11 +159,11 @@ static portBASE_TYPE xErrorHasOccurred = pdFALSE; { xErrorHasOccurred = pdTRUE; } - + if( xErrorHasOccurred == pdFALSE ) { /* Toggle the LED if everything is okay so we know if an error occurs even if not - using console IO. */ + * using console IO. */ vParTestToggleLED( mainCHECK_TASK_LED ); } } @@ -171,7 +171,7 @@ static portBASE_TYPE xErrorHasOccurred = pdFALSE; static void prvIncrementResetCount( void ) { -static unsigned char __eeprom ucResetCount @ mainRESET_COUNT_ADDRESS; + static unsigned char __eeprom ucResetCount @ mainRESET_COUNT_ADDRESS; ucResetCount++; } diff --git a/FreeRTOS/Demo/AVR_Dx_IAR/serial/serial.c b/FreeRTOS/Demo/AVR_Dx_IAR/serial/serial.c index 996315edddb..8bba640d9dd 100644 --- a/FreeRTOS/Demo/AVR_Dx_IAR/serial/serial.c +++ b/FreeRTOS/Demo/AVR_Dx_IAR/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/FreeRTOSConfig.h b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/FreeRTOSConfig.h index 87f8ec46084..47487f492e6 100644 --- a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/ParTest/partest.c b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/ParTest/partest.c index 27a269c0368..e5a1b69ee99 100644 --- a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/ParTest/partest.c +++ b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/ParTest/partest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/RegTest.c b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/RegTest.c index 7e01a663d46..7d0251059ec 100644 --- a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/RegTest.c +++ b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/RegTest.h b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/RegTest.h index fbaa9534de8..8d28ee9ad25 100644 --- a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/RegTest.h +++ b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/RegTest.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/main.c b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/main.c index 8d7412fe11c..1088b1f7835 100644 --- a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/main.c +++ b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/main.c @@ -1,22 +1,22 @@ /* -(C) 2020 Microchip Technology Inc. and its subsidiaries. - -Subject to your compliance with these terms, you may use Microchip software and -any derivatives exclusively with Microchip products. It is your responsibility -to comply with third party license terms applicable to your use of third party -software (including open source software) that may accompany Microchip software. - -THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER EXPRESS, -IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES -OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, -INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER -RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF -THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWED -BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THIS -SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY -TO MICROCHIP FOR THIS SOFTWARE. -*/ + * (C) 2020 Microchip Technology Inc. and its subsidiaries. + * + * Subject to your compliance with these terms, you may use Microchip software and + * any derivatives exclusively with Microchip products. It is your responsibility + * to comply with third party license terms applicable to your use of third party + * software (including open source software) that may accompany Microchip software. + * + * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER EXPRESS, + * IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES + * OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. + * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, + * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER + * RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF + * THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWED + * BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THIS + * SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY + * TO MICROCHIP FOR THIS SOFTWARE. + */ #include #include "FreeRTOS.h" @@ -28,67 +28,88 @@ TO MICROCHIP FOR THIS SOFTWARE. static void prvSetupHardware( void ); #if ( mainSELECTED_APPLICATION == 0 ) -extern void main_blinky( void ); -extern void init_blinky( void ); + extern void main_blinky( void ); + extern void init_blinky( void ); #elif ( mainSELECTED_APPLICATION == 1 ) -extern void main_minimal( void ); -extern void init_minimal( void ); + extern void main_minimal( void ); + extern void init_minimal( void ); #elif ( mainSELECTED_APPLICATION == 2 ) -extern void main_full( void ); -extern void init_full( void ); + extern void main_full( void ); + extern void init_full( void ); #else -#error Invalid mainSELECTED_APPLICATION setting. See the comments at the top of this file and above the mainSELECTED_APPLICATION definition. + #error Invalid mainSELECTED_APPLICATION setting. See the comments at the top of this file and above the mainSELECTED_APPLICATION definition. #endif int main( void ) { prvSetupHardware(); -#if ( mainSELECTED_APPLICATION == 0 ) - main_blinky(); -#elif ( mainSELECTED_APPLICATION == 1 ) - main_minimal(); -#elif ( mainSELECTED_APPLICATION == 2 ) - main_full(); -#endif - + #if ( mainSELECTED_APPLICATION == 0 ) + main_blinky(); + #elif ( mainSELECTED_APPLICATION == 1 ) + main_minimal(); + #elif ( mainSELECTED_APPLICATION == 2 ) + main_full(); + #endif + return 0; } static void prvSetupHardware( void ) { /* Ensure no interrupts execute while the scheduler is in an inconsistent - state. Interrupts are automatically enabled when the scheduler is - started. */ + * state. Interrupts are automatically enabled when the scheduler is + * started. */ portDISABLE_INTERRUPTS(); CLK_init(); -#if ( mainSELECTED_APPLICATION == 0 ) - init_blinky(); -#elif ( mainSELECTED_APPLICATION == 1 ) - init_minimal(); -#elif ( mainSELECTED_APPLICATION == 2 ) - init_full(); -#endif + #if ( mainSELECTED_APPLICATION == 0 ) + init_blinky(); + #elif ( mainSELECTED_APPLICATION == 1 ) + init_minimal(); + #elif ( mainSELECTED_APPLICATION == 2 ) + init_full(); + #endif } /* vApplicationStackOverflowHook is called when a stack overflow occurs. -This is usefull in application development, for debugging. To use this -hook, uncomment it, and set configCHECK_FOR_STACK_OVERFLOW to 1 in -"FreeRTOSConfig.h" header file. */ + * This is usefull in application development, for debugging. To use this + * hook, uncomment it, and set configCHECK_FOR_STACK_OVERFLOW to 1 in + * "FreeRTOSConfig.h" header file. */ -// void vApplicationStackOverflowHook(TaskHandle_t *pxTask, char *pcTaskName ) -// { -// for( ;; ); -// } +#if ( portHAS_STACK_OVERFLOW_CHECKING != 0 ) && ( configCHECK_FOR_STACK_OVERFLOW != 0 ) + void vApplicationStackOverflowHook( void ) + { + volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0; + taskENTER_CRITICAL(); + /* To debug this failure set ulSetToNonZeroInDebuggerToContinue + * to a non-zero value using a debugger. */ + while( ulSetToNonZeroInDebuggerToContinue == 0 ) + { + portNOP(); + } + taskEXIT_CRITICAL(); + } +#endif /* ( portHAS_STACK_OVERFLOW_CHECKING != 0 ) && ( configCHECK_FOR_STACK_OVERFLOW != 0 ) */ /* vApplicationMallocFailedHook is called when memorry allocation fails. -This is usefull in application development, for debugging. To use this -hook, uncomment it, and set configUSE_MALLOC_FAILED_HOOK to 1 in -"FreeRTOSConfig.h" header file. */ + * This is usefull in application development, for debugging. To use this + * hook, uncomment it, and set configUSE_MALLOC_FAILED_HOOK to 1 in + * "FreeRTOSConfig.h" header file. */ -// void vApplicationMallocFailedHook( void ) -// { -// for( ;; ); -// } +#if ( configUSE_MALLOC_FAILED_HOOK != 0 ) + void vApplicationMallocFailedHook( void ) + { + volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0; + taskENTER_CRITICAL(); + /* To debug this failure set ulSetToNonZeroInDebuggerToContinue + * to a non-zero value using a debugger. */ + while( ulSetToNonZeroInDebuggerToContinue == 0 ) + { + /* No-Op */ + portNOP(); + } + taskEXIT_CRITICAL(); + } +#endif /* configUSE_MALLOC_FAILED_HOOK */ diff --git a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/main_blinky.c b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/main_blinky.c index 8e4c7f3a307..f436ca8bac7 100644 --- a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/main_blinky.c +++ b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -59,25 +59,25 @@ #include "semphr.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /*-----------------------------------------------------------*/ @@ -87,18 +87,18 @@ static QueueHandle_t xQueue = NULL; void main_blinky( void ) { /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); - + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); + if( xQueue != NULL ) { /* Start the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - NULL, /* The parameter passed to the task - not used in this case. */ - mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + NULL, /* The parameter passed to the task - not used in this case. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); @@ -107,14 +107,16 @@ void main_blinky( void ) } /* 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( ;; ); + * 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( ; ; ) + { + } } void init_blinky( void ) @@ -123,10 +125,10 @@ void init_blinky( void ) PORTC.DIRSET = PIN6_bm; } -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; /* Remove compiler warning about unused parameter. */ ( void ) pvParameters; @@ -134,37 +136,37 @@ const unsigned long ulValueToSend = 100UL; /* Initialise xNextWakeTime - this only needs to be done once. */ xNextWakeTime = xTaskGetTickCount(); - for( ;; ) + for( ; ; ) { /* Place this task in the blocked state until it is time to run again. */ vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); /* 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 - will not block - it shouldn't need to block as the queue should always - be empty at this point in the code. */ + * 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 + * be empty at this point in the code. */ xQueueSend( xQueue, &ulValueToSend, 0U ); } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; -const unsigned long ulExpectedValue = 100UL; + unsigned long ulReceivedValue; + const unsigned long ulExpectedValue = 100UL; /* Remove compiler warning about unused parameter. */ ( void ) pvParameters; - for( ;; ) + for( ; ; ) { /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); /* 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 ) { /* Toggle LED on pin PC6. */ diff --git a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/main_full.c b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/main_full.c index 8f18a0c335e..027293c2a5d 100644 --- a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/main_full.c +++ b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/main_full.c @@ -6,43 +6,45 @@ #include "regtest.h" #include "recmutex.h" -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL ) -#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL ) +#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) /* The period between executions of the check task. */ -#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) /* LED that is toggled by the check task. The check task periodically checks -that all the other tasks are operating without error. If no errors are found -the LED is toggled. If an error is found at any time the LED is never toggles -again. */ -#define mainCHECK_TASK_LED ( 6 ) + * that all the other tasks are operating without error. If no errors are found + * the LED is toggled. If an error is found at any time the LED is never toggles + * again. */ +#define mainCHECK_TASK_LED ( 6 ) /* The check task, as described at the top of this file. */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); void main_full( void ) { - vStartSemaphoreTasks(mainSEM_TEST_PRIORITY); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); vStartTaskNotifyTask(); vStartRegTestTasks(); vStartRecursiveMutexTasks(); /* Create the task that performs the 'check' functionality, as described at - the top of this file. */ + * the top of this file. */ xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); 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( ;; ); + * 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( ; ; ) + { + } } void init_full( void ) @@ -50,52 +52,52 @@ void init_full( void ) vParTestInitialise(); } -static void prvCheckTask( void *pvParameters ) +static void prvCheckTask( void * pvParameters ) { -TickType_t xLastExecutionTime; -unsigned long ulErrorFound = pdFALSE; + TickType_t xLastExecutionTime; + unsigned long ulErrorFound = pdFALSE; /* Just to stop compiler warnings. */ ( void ) pvParameters; /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() - works correctly. */ + * 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 - unless an error occurred. */ - for( ;; ) + * operating without error. The onboard LED is toggled on each iteration + * unless an error occurred. */ + for( ; ; ) { /* Delay until it is time to execute again. */ vTaskDelayUntil( &xLastExecutionTime, mainCHECK_PERIOD ); /* 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( xAreSemaphoreTasksStillRunning() != pdTRUE ) { ulErrorFound |= 1UL << 0UL; } - + if( xAreTaskNotificationTasksStillRunning() != pdTRUE ) { ulErrorFound |= 1UL << 1UL; } - + if( xAreRegTestTasksStillRunning() != pdTRUE ) { ulErrorFound |= 1UL << 2UL; } - - if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) { ulErrorFound |= 1UL << 3UL; } - + if( ulErrorFound == pdFALSE ) { /* Toggle the LED if everything is okay so we know if an error occurs even if not - using console IO. */ + * using console IO. */ vParTestToggleLED( mainCHECK_TASK_LED ); } } diff --git a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/main_minimal.c b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/main_minimal.c index bf54d4b5c0d..9969396b3ed 100644 --- a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/main_minimal.c +++ b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/main_minimal.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -37,7 +37,7 @@ #include "regtest.h" /* Priority definitions for most of the tasks in the demo application. Some -tasks just use the idle priority. */ + * tasks just use the idle priority. */ #define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) #define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) #define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) @@ -46,20 +46,20 @@ tasks just use the idle priority. */ #define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 9600 ) /* LED used by the serial port tasks. This is toggled on each character Tx, -and mainCOM_TEST_LED + 1 is toggles on each character Rx. */ + * and mainCOM_TEST_LED + 1 is toggles on each character Rx. */ #define mainCOM_TEST_LED ( 7 ) /* LED that is toggled by the check task. The check task periodically checks -that all the other tasks are operating without error. If no errors are found -the LED is toggled. If an error is found at any time the LED is never toggles -again. */ + * that all the other tasks are operating without error. If no errors are found + * the LED is toggled. If an error is found at any time the LED is never toggles + * again. */ #define mainCHECK_TASK_LED ( 6 ) /* The period between executions of the check task. */ #define mainCHECK_PERIOD ( ( TickType_t ) 1000 / portTICK_PERIOD_MS ) /* An address in the EEPROM used to count resets. This is used to check that -the demo application is not unexpectedly resetting. */ + * the demo application is not unexpectedly resetting. */ #define mainRESET_COUNT_ADDRESS ( 0x1400 ) /* The number of coroutines to create. */ @@ -68,7 +68,7 @@ the demo application is not unexpectedly resetting. */ /* * The task function for the "Check" task. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * Checks the unique counts of other tasks to ensure they are still operational. @@ -91,16 +91,16 @@ void main_minimal( void ) vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); vStartRegTestTasks(); - + /* Create the tasks defined within this file. */ xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); /* Create the co-routines that flash the LED's. */ vStartFlashCoRoutines( mainNUM_FLASH_COROUTINES ); - + /* In this port, to use preemptive scheduler define configUSE_PREEMPTION - as 1 in portmacro.h. To use the cooperative scheduler define - configUSE_PREEMPTION as 0. */ + * as 1 in portmacro.h. To use the cooperative scheduler define + * configUSE_PREEMPTION as 0. */ vTaskStartScheduler(); } @@ -109,28 +109,28 @@ void init_minimal( void ) /* Configure UART pins: PC1 Rx, PC0 Tx */ PORTC.DIR &= ~PIN0_bm; PORTC.DIR |= PIN1_bm; - + vParTestInitialise(); } -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -static volatile unsigned long ulDummyVariable = 3UL; + static volatile unsigned long ulDummyVariable = 3UL; /* The parameters are not used. */ ( void ) pvParameters; /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. */ - for( ;; ) + * operating without error. */ + for( ; ; ) { vTaskDelay( mainCHECK_PERIOD ); /* Perform a bit of 32bit maths to ensure the registers used by the - integer tasks get some exercise. The result here is not important - - see the demo application documentation for more info. */ + * integer tasks get some exercise. The result here is not important - + * see the demo application documentation for more info. */ ulDummyVariable *= 3; - + prvCheckOtherTasksAreStillRunning(); } } @@ -138,7 +138,7 @@ static volatile unsigned long ulDummyVariable = 3UL; static void prvCheckOtherTasksAreStillRunning( void ) { -static portBASE_TYPE xErrorHasOccurred = pdFALSE; + static portBASE_TYPE xErrorHasOccurred = pdFALSE; if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { @@ -159,11 +159,11 @@ static portBASE_TYPE xErrorHasOccurred = pdFALSE; { xErrorHasOccurred = pdTRUE; } - + if( xErrorHasOccurred == pdFALSE ) { /* Toggle the LED if everything is okay so we know if an error occurs even if not - using console IO. */ + * using console IO. */ vParTestToggleLED( mainCHECK_TASK_LED ); } } @@ -171,7 +171,7 @@ static portBASE_TYPE xErrorHasOccurred = pdFALSE; static void prvIncrementResetCount( void ) { -unsigned char ucResetCount; + unsigned char ucResetCount; eeprom_read_block( &ucResetCount, ( void * ) mainRESET_COUNT_ADDRESS, sizeof( ucResetCount ) ); ucResetCount++; diff --git a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/serial/serial.c b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/serial/serial.c index e981bb92d24..af7f428598a 100644 --- a/FreeRTOS/Demo/AVR_Dx_MPLAB.X/serial/serial.c +++ b/FreeRTOS/Demo/AVR_Dx_MPLAB.X/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Blinky_Demo/main_blinky.c index 5890eb98a19..ecb52e5193b 100644 --- a/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/FreeRTOSConfig.h index 48f59c00be2..b5ac001b2c6 100644 --- a/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/FreeRTOS_tick_config.c b/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/FreeRTOS_tick_config.c index de84f5623ac..7d3b23bd0d6 100644 --- a/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/FreeRTOS_tick_config.c +++ b/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/FreeRTOS_tick_config.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Full_Demo/IntQueueTimer.c index c4302b01a42..8e30980d2d5 100644 --- a/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Full_Demo/IntQueueTimer.h index 76d462f796c..8f1a766766e 100644 --- a/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Full_Demo/main_full.c b/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Full_Demo/main_full.c index 80ffe6bc09b..550bebbb1b6 100644 --- a/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/main.c b/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/main.c index 6304d1cab4c..193623920e7 100644 --- a/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/main.c +++ b/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/FreeRTOSConfig.h index 2b94c6aa689..db628e4ddbc 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/FreeRTOS_tick_config.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/FreeRTOS_tick_config.c index a3249b49d73..ccee8ccb48a 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/FreeRTOS_tick_config.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/FreeRTOS_tick_config.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/Full_Demo/IntQueueTimer.c index 19501f59f51..7f67e372b98 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/Full_Demo/IntQueueTimer.h index 76d462f796c..8f1a766766e 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/Full_Demo/main_full.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/Full_Demo/main_full.c index 9e3952e17b1..53c02bdc8cd 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/LEDs.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/LEDs.c index 6739572e86c..cc7d928629f 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/LEDs.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/LEDs.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/blinky_demo/main_blinky.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/blinky_demo/main_blinky.c index 2da0eee0b5e..597eebc6b6d 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/blinky_demo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/blinky_demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/main.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/main.c index d60af191c46..6ac05433e27 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/main.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -82,8 +82,8 @@ #include "chip.h" /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 /*-----------------------------------------------------------*/ @@ -97,182 +97,186 @@ static void prvSetupHardware( void ); * main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0. */ #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 - extern void main_blinky( void ); + extern void main_blinky( void ); #else - extern void main_full( void ); + extern void main_full( void ); #endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */ /* Prototypes for the standard FreeRTOS callback/hook functions implemented -within this file. */ + * within this file. */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /* Prototype for the IRQ handler called by the generic Cortex-A5 RTOS port -layer. */ + * layer. */ void vApplicationIRQHandler( void ); /*-----------------------------------------------------------*/ int main( void ) { - /* Configure the hardware ready to run the demo. */ - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* Configure the hardware ready to run the demo. */ + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Disable watchdog */ - wdt_disable( ); + /* Disable watchdog */ + wdt_disable(); - /* Set protect mode in the AIC for easier debugging. */ - AIC->AIC_DCR |= AIC_DCR_PROT; + /* Set protect mode in the AIC for easier debugging. */ + AIC->AIC_DCR |= AIC_DCR_PROT; - /* Configure ports used by LEDs. */ - vParTestInitialise(); + /* Configure ports used by LEDs. */ + vParTestInitialise(); - #if defined (ddram) - MMU_Initialize( ( uint32_t * ) 0x30C000 ); - CP15_EnableMMU(); - CP15_EnableDcache(); - CP15_EnableIcache(); - #endif + #if defined( ddram ) + MMU_Initialize( ( uint32_t * ) 0x30C000 ); + CP15_EnableMMU(); + CP15_EnableDcache(); + CP15_EnableIcache(); + #endif } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ - - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ + + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; + ( void ) pcTaskName; + ( void ) pxTask; - /* 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. */ + /* 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. */ - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile size_t xFreeHeapSpace; - - /* This is just a trivial example of an idle hook. It is called on each - cycle of the idle task. It must *NOT* attempt to block. In this case the - idle task just queries the amount of FreeRTOS heap that remains. See the - memory management section on the http://www.FreeRTOS.org web site for memory - management options. If there is a lot of heap memory free then the - configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up - RAM. */ - xFreeHeapSpace = xPortGetFreeHeapSize(); - - /* Remove compiler warning about xFreeHeapSpace being set but never used. */ - ( void ) xFreeHeapSpace; + volatile size_t xFreeHeapSpace; + + /* This is just a trivial example of an idle hook. It is called on each + * cycle of the idle task. It must *NOT* attempt to block. In this case the + * idle task just queries the amount of FreeRTOS heap that remains. See the + * memory management section on the http://www.FreeRTOS.org web site for memory + * management options. If there is a lot of heap memory free then the + * configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up + * RAM. */ + xFreeHeapSpace = xPortGetFreeHeapSize(); + + /* Remove compiler warning about xFreeHeapSpace being set but never used. */ + ( void ) xFreeHeapSpace; } /*-----------------------------------------------------------*/ -void vAssertCalled( const char * pcFile, unsigned long ulLine ) +void vAssertCalled( const char * pcFile, + unsigned long ulLine ) { -volatile unsigned long ul = 0; - - ( void ) pcFile; - ( void ) ulLine; - - taskENTER_CRITICAL(); - { - /* Set ul to a non-zero value using the debugger to step out of this - function. */ - while( ul == 0 ) - { - portNOP(); - } - } - taskEXIT_CRITICAL(); + volatile unsigned long ul = 0; + + ( void ) pcFile; + ( void ) ulLine; + + taskENTER_CRITICAL(); + { + /* Set ul to a non-zero value using the debugger to step out of this + * function. */ + while( ul == 0 ) + { + portNOP(); + } + } + taskEXIT_CRITICAL(); } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 - { - /* The full demo includes a software timer demo/test that requires - prodding periodically from the tick interrupt. */ - vTimerPeriodicISRTests(); - - /* Call the periodic queue overwrite from ISR demo. */ - vQueueOverwritePeriodicISRDemo(); - - /* Call the periodic event group from ISR demo. */ - vPeriodicEventGroupsProcessing(); - } - #endif + #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 + { + /* The full demo includes a software timer demo/test that requires + * prodding periodically from the tick interrupt. */ + vTimerPeriodicISRTests(); + + /* Call the periodic queue overwrite from ISR demo. */ + vQueueOverwritePeriodicISRDemo(); + + /* Call the periodic event group from ISR demo. */ + vPeriodicEventGroupsProcessing(); + } + #endif /* if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 */ } /*-----------------------------------------------------------*/ /* The function called by the RTOS port layer after it has managed interrupt -entry. */ + * entry. */ void vApplicationIRQHandler( void ) { -typedef void (*ISRFunction_t)( void ); -ISRFunction_t pxISRFunction; -volatile uint32_t * pulAIC_IVR = ( uint32_t * ) configINTERRUPT_VECTOR_ADDRESS; + typedef void (* ISRFunction_t)( void ); + ISRFunction_t pxISRFunction; + volatile uint32_t * pulAIC_IVR = ( uint32_t * ) configINTERRUPT_VECTOR_ADDRESS; - /* Obtain the address of the interrupt handler from the AIR. */ - pxISRFunction = ( ISRFunction_t ) *pulAIC_IVR; + /* Obtain the address of the interrupt handler from the AIR. */ + pxISRFunction = ( ISRFunction_t ) *pulAIC_IVR; - /* Write back to the SAMA5's interrupt controller's IVR register in case the - CPU is in protect mode. If the interrupt controller is not in protect mode - then this write is not necessary. */ - *pulAIC_IVR = ( uint32_t ) pxISRFunction; + /* Write back to the SAMA5's interrupt controller's IVR register in case the + * CPU is in protect mode. If the interrupt controller is not in protect mode + * then this write is not necessary. */ + *pulAIC_IVR = ( uint32_t ) pxISRFunction; - /* Ensure the write takes before re-enabling interrupts. */ - __DSB(); - __ISB(); - __enable_irq(); + /* Ensure the write takes before re-enabling interrupts. */ + __DSB(); + __ISB(); + __enable_irq(); - /* Call the installed ISR. */ - pxISRFunction(); + /* Call the installed ISR. */ + pxISRFunction(); } /* Keep the linker quiet. */ -size_t __write(int, const unsigned char *, size_t); -size_t __write(int f, const unsigned char *p, size_t s) +size_t __write( int, + const unsigned char *, + size_t ); +size_t __write( int f, + const unsigned char * p, + size_t s ) { - (void) f; - (void) p; - (void) s; - return 0; + ( void ) f; + ( void ) p; + ( void ) s; + return 0; } - - - diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/CDCCommandConsole.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/CDCCommandConsole.c index f083c3c7f2d..d35023d3a9a 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/CDCCommandConsole.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/CDCCommandConsole.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/FreeRTOSConfig.h index 6d5e0a0b2ad..c577dff1066 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/FreeRTOS_tick_config.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/FreeRTOS_tick_config.c index 1b6e366aa14..e33c581aea8 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/FreeRTOS_tick_config.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/FreeRTOS_tick_config.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/Full_Demo/IntQueueTimer.c index 5b28777546d..2090a977758 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/Full_Demo/IntQueueTimer.h index 76d462f796c..8f1a766766e 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/Full_Demo/main_full.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/Full_Demo/main_full.c index 78e9c37db8f..92a00a68dae 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/LEDs.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/LEDs.c index 7b54889ff20..77874fa1d83 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/LEDs.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/LEDs.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/blinky_demo/main_blinky.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/blinky_demo/main_blinky.c index d286160518b..3a8342d836c 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/blinky_demo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/blinky_demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/main.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/main.c index 60a7b55d011..fabec33cc5b 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/main.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -57,8 +57,8 @@ #include "chip.h" /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 /*-----------------------------------------------------------*/ @@ -72,42 +72,43 @@ static void prvSetupHardware( void ); * main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0. */ #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 - extern void main_blinky( void ); + extern void main_blinky( void ); #else - extern void main_full( void ); + extern void main_full( void ); #endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */ /* Prototypes for the standard FreeRTOS callback/hook functions implemented -within this file. */ + * within this file. */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /* Prototype for the IRQ handler called by the generic Cortex-A5 RTOS port -layer. */ + * layer. */ void vApplicationIRQHandler( void ); /*-----------------------------------------------------------*/ int main( void ) { - /* Configure the hardware ready to run the demo. */ - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* Configure the hardware ready to run the demo. */ + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ @@ -116,127 +117,127 @@ static void prvSetupHardware( void ) /* Disable watchdog */ WDT_Disable( WDT ); - /* Set protect mode in the AIC for easier debugging. */ - AIC->AIC_DCR |= AIC_DCR_PROT; + /* Set protect mode in the AIC for easier debugging. */ + AIC->AIC_DCR |= AIC_DCR_PROT; - /* Configure ports used by LEDs. */ - vParTestInitialise(); + /* Configure ports used by LEDs. */ + vParTestInitialise(); - #if defined (ddram) - MMU_Initialize( ( uint32_t * ) 0x30C000 ); - CP15_EnableMMU(); - CP15_EnableDcache(); - CP15_EnableIcache(); - #endif + #if defined( ddram ) + MMU_Initialize( ( uint32_t * ) 0x30C000 ); + CP15_EnableMMU(); + CP15_EnableDcache(); + CP15_EnableIcache(); + #endif } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ - - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ + + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; + ( void ) pcTaskName; + ( void ) pxTask; - /* 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. */ + /* 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. */ - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile size_t xFreeHeapSpace; - - /* This is just a trivial example of an idle hook. It is called on each - cycle of the idle task. It must *NOT* attempt to block. In this case the - idle task just queries the amount of FreeRTOS heap that remains. See the - memory management section on the http://www.FreeRTOS.org web site for memory - management options. If there is a lot of heap memory free then the - configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up - RAM. */ - xFreeHeapSpace = xPortGetFreeHeapSize(); - - /* Remove compiler warning about xFreeHeapSpace being set but never used. */ - ( void ) xFreeHeapSpace; + volatile size_t xFreeHeapSpace; + + /* This is just a trivial example of an idle hook. It is called on each + * cycle of the idle task. It must *NOT* attempt to block. In this case the + * idle task just queries the amount of FreeRTOS heap that remains. See the + * memory management section on the http://www.FreeRTOS.org web site for memory + * management options. If there is a lot of heap memory free then the + * configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up + * RAM. */ + xFreeHeapSpace = xPortGetFreeHeapSize(); + + /* Remove compiler warning about xFreeHeapSpace being set but never used. */ + ( void ) xFreeHeapSpace; } /*-----------------------------------------------------------*/ -void vAssertCalled( const char * pcFile, unsigned long ulLine ) +void vAssertCalled( const char * pcFile, + unsigned long ulLine ) { -volatile unsigned long ul = 0; - - ( void ) pcFile; - ( void ) ulLine; - - taskENTER_CRITICAL(); - { - /* Set ul to a non-zero value using the debugger to step out of this - function. */ - while( ul == 0 ) - { - portNOP(); - } - } - taskEXIT_CRITICAL(); + volatile unsigned long ul = 0; + + ( void ) pcFile; + ( void ) ulLine; + + taskENTER_CRITICAL(); + { + /* Set ul to a non-zero value using the debugger to step out of this + * function. */ + while( ul == 0 ) + { + portNOP(); + } + } + taskEXIT_CRITICAL(); } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 - { - /* The full demo includes a software timer demo/test that requires - prodding periodically from the tick interrupt. */ - vTimerPeriodicISRTests(); - - /* Call the periodic queue overwrite from ISR demo. */ - vQueueOverwritePeriodicISRDemo(); - - /* Call the periodic event group from ISR demo. */ - vPeriodicEventGroupsProcessing(); - } - #endif + #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 + { + /* The full demo includes a software timer demo/test that requires + * prodding periodically from the tick interrupt. */ + vTimerPeriodicISRTests(); + + /* Call the periodic queue overwrite from ISR demo. */ + vQueueOverwritePeriodicISRDemo(); + + /* Call the periodic event group from ISR demo. */ + vPeriodicEventGroupsProcessing(); + } + #endif /* if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 */ } /*-----------------------------------------------------------*/ /* The function called by the RTOS port layer after it has managed interrupt -entry. */ + * entry. */ void vApplicationIRQHandler( void ) { -typedef void (*ISRFunction_t)( void ); -ISRFunction_t pxISRFunction; -volatile uint32_t * pulAIC_IVR = ( uint32_t * ) configINTERRUPT_VECTOR_ADDRESS; + typedef void (* ISRFunction_t)( void ); + ISRFunction_t pxISRFunction; + volatile uint32_t * pulAIC_IVR = ( uint32_t * ) configINTERRUPT_VECTOR_ADDRESS; - /* Obtain the address of the interrupt handler from the AIR. */ - pxISRFunction = ( ISRFunction_t ) *pulAIC_IVR; + /* Obtain the address of the interrupt handler from the AIR. */ + pxISRFunction = ( ISRFunction_t ) *pulAIC_IVR; - /* Write back to the SAMA5's interrupt controller's IVR register in case the - CPU is in protect mode. If the interrupt controller is not in protect mode - then this write is not necessary. */ - *pulAIC_IVR = ( uint32_t ) pxISRFunction; + /* Write back to the SAMA5's interrupt controller's IVR register in case the + * CPU is in protect mode. If the interrupt controller is not in protect mode + * then this write is not necessary. */ + *pulAIC_IVR = ( uint32_t ) pxISRFunction; - /* Ensure the write takes before re-enabling interrupts. */ - __DSB(); - __ISB(); + /* Ensure the write takes before re-enabling interrupts. */ + __DSB(); + __ISB(); __enable_irq(); - /* Call the installed ISR. */ - pxISRFunction(); + /* Call the installed ISR. */ + pxISRFunction(); } - - diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Blinky_Demo/main_blinky.c index d286160518b..3a8342d836c 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/CDCCommandConsole.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/CDCCommandConsole.c index 9aec09aa131..6e6e46a5916 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/CDCCommandConsole.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/CDCCommandConsole.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/FreeRTOSConfig.h index c50a3c4645e..7d578e38ee8 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/FreeRTOS_tick_config.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/FreeRTOS_tick_config.c index 8dfa832ed06..f3807c8b5e7 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/FreeRTOS_tick_config.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/FreeRTOS_tick_config.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Full_Demo/IntQueueTimer.c index cea2ced4b60..ac708723204 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Full_Demo/IntQueueTimer.h index 76d462f796c..8f1a766766e 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Full_Demo/main_full.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Full_Demo/main_full.c index 78aa7ccb414..b27306143e5 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/LEDs.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/LEDs.c index 7b54889ff20..77874fa1d83 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/LEDs.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/LEDs.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/main.c b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/main.c index 97d3ed999fd..5dc48a24cb1 100644 --- a/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/main.c +++ b/FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -57,8 +57,8 @@ #include "chip.h" /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 /*-----------------------------------------------------------*/ @@ -71,43 +71,44 @@ static void prvSetupHardware( void ); * 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. */ -#if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - extern void main_blinky( void ); +#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + extern void main_blinky( void ); #else - extern void main_full( void ); + extern void main_full( void ); #endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */ /* Prototypes for the standard FreeRTOS callback/hook functions implemented -within this file. */ + * within this file. */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /* Prototype for the IRQ handler called by the generic Cortex-A5 RTOS port -layer. */ + * layer. */ void vApplicationIRQHandler( void ); /*-----------------------------------------------------------*/ int main( void ) { - /* Configure the hardware ready to run the demo. */ - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* Configure the hardware ready to run the demo. */ + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ @@ -116,129 +117,130 @@ static void prvSetupHardware( void ) /* Disable watchdog */ WDT_Disable( WDT ); - /* Set protect mode in the AIC for easier debugging. THIS IS COMMENTED OUT - AS IT RESULTS IN SPURIOUS INTERRUPTS. - AIC->AIC_DCR |= AIC_DCR_PROT; */ - - /* Configure ports used by LEDs. */ - vParTestInitialise(); - - #if defined (ddram) - { - MMU_Initialize( ( uint32_t * ) 0x20C000 ); - CP15_EnableMMU(); - CP15_EnableDcache(); - CP15_EnableIcache(); - } - #endif + /* Set protect mode in the AIC for easier debugging. THIS IS COMMENTED OUT + * AS IT RESULTS IN SPURIOUS INTERRUPTS. + * AIC->AIC_DCR |= AIC_DCR_PROT; */ + + /* Configure ports used by LEDs. */ + vParTestInitialise(); + + #if defined( ddram ) + { + MMU_Initialize( ( uint32_t * ) 0x20C000 ); + CP15_EnableMMU(); + CP15_EnableDcache(); + CP15_EnableIcache(); + } + #endif } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ - - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ + + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; + ( void ) pcTaskName; + ( void ) pxTask; - /* 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. */ + /* 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. */ - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile size_t xFreeHeapSpace; - - /* This is just a trivial example of an idle hook. It is called on each - cycle of the idle task. It must *NOT* attempt to block. In this case the - idle task just queries the amount of FreeRTOS heap that remains. See the - memory management section on the http://www.FreeRTOS.org web site for memory - management options. If there is a lot of heap memory free then the - configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up - RAM. */ - xFreeHeapSpace = xPortGetFreeHeapSize(); - - /* Remove compiler warning about xFreeHeapSpace being set but never used. */ - ( void ) xFreeHeapSpace; + volatile size_t xFreeHeapSpace; + + /* This is just a trivial example of an idle hook. It is called on each + * cycle of the idle task. It must *NOT* attempt to block. In this case the + * idle task just queries the amount of FreeRTOS heap that remains. See the + * memory management section on the http://www.FreeRTOS.org web site for memory + * management options. If there is a lot of heap memory free then the + * configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up + * RAM. */ + xFreeHeapSpace = xPortGetFreeHeapSize(); + + /* Remove compiler warning about xFreeHeapSpace being set but never used. */ + ( void ) xFreeHeapSpace; } /*-----------------------------------------------------------*/ -void vAssertCalled( const char * pcFile, unsigned long ulLine ) +void vAssertCalled( const char * pcFile, + unsigned long ulLine ) { -volatile unsigned long ul = 0; - - ( void ) pcFile; - ( void ) ulLine; - - taskENTER_CRITICAL(); - { - /* Set ul to a non-zero value using the debugger to step out of this - function. */ - while( ul == 0 ) - { - portNOP(); - } - } - taskEXIT_CRITICAL(); + volatile unsigned long ul = 0; + + ( void ) pcFile; + ( void ) ulLine; + + taskENTER_CRITICAL(); + { + /* Set ul to a non-zero value using the debugger to step out of this + * function. */ + while( ul == 0 ) + { + portNOP(); + } + } + taskEXIT_CRITICAL(); } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 - { - /* The full demo includes a software timer demo/test that requires - prodding periodically from the tick interrupt. */ - vTimerPeriodicISRTests(); - - /* Call the periodic queue overwrite from ISR demo. */ - vQueueOverwritePeriodicISRDemo(); - - /* Call the periodic event group from ISR demo. */ - vPeriodicEventGroupsProcessing(); - } - #endif + #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 + { + /* The full demo includes a software timer demo/test that requires + * prodding periodically from the tick interrupt. */ + vTimerPeriodicISRTests(); + + /* Call the periodic queue overwrite from ISR demo. */ + vQueueOverwritePeriodicISRDemo(); + + /* Call the periodic event group from ISR demo. */ + vPeriodicEventGroupsProcessing(); + } + #endif /* if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 */ } /*-----------------------------------------------------------*/ /* The function called by the RTOS port layer after it has managed interrupt -entry. */ + * entry. */ void vApplicationIRQHandler( void ) { -typedef void (*ISRFunction_t)( void ); -ISRFunction_t pxISRFunction; -volatile uint32_t * pulAIC_IVR = ( uint32_t * ) configINTERRUPT_VECTOR_ADDRESS; + typedef void (* ISRFunction_t)( void ); + ISRFunction_t pxISRFunction; + volatile uint32_t * pulAIC_IVR = ( uint32_t * ) configINTERRUPT_VECTOR_ADDRESS; - /* Obtain the address of the interrupt handler from the AIR. */ - pxISRFunction = ( ISRFunction_t ) *pulAIC_IVR; + /* Obtain the address of the interrupt handler from the AIR. */ + pxISRFunction = ( ISRFunction_t ) *pulAIC_IVR; - /* Write back to the SAMA5's interrupt controller's IVR register in case the - CPU is in protect mode. If the interrupt controller is not in protect mode - then this write is not necessary. */ - *pulAIC_IVR = ( uint32_t ) pxISRFunction; + /* Write back to the SAMA5's interrupt controller's IVR register in case the + * CPU is in protect mode. If the interrupt controller is not in protect mode + * then this write is not necessary. */ + *pulAIC_IVR = ( uint32_t ) pxISRFunction; - /* Ensure the write takes before re-enabling interrupts. */ - __DSB(); - __ISB(); + /* Ensure the write takes before re-enabling interrupts. */ + __DSB(); + __ISB(); __enable_irq(); - /* Call the installed ISR. */ - pxISRFunction(); + /* Call the installed ISR. */ + pxISRFunction(); } - diff --git a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/FreeRTOSConfig.h index b3565b1f38d..14a27e82c31 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/LEDs.c b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/LEDs.c index ff40ed78cce..ba0adf521a2 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/LEDs.c +++ b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/LEDs.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main.c b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main.c index 28bcbaec492..ee8892aa38f 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main.c +++ b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -75,7 +75,7 @@ * When mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0 the comprehensive test * and demo application will be run. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 /*-----------------------------------------------------------*/ @@ -89,240 +89,250 @@ static void prvSetupHardware( void ); * mainSELECTED_APPLICATION definition. */ #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - extern void main_blinky( void ); + extern void main_blinky( void ); #else - extern void main_full( void ); + extern void main_full( void ); #endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */ /* Prototypes for the standard FreeRTOS callback/hook functions implemented -within this file. */ + * within this file. */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /*-----------------------------------------------------------*/ /* configAPPLICATION_ALLOCATED_HEAP is set to 1 in FreeRTOSConfig.h so the -application can define the array used as the FreeRTOS heap. This is done so the -heap can be forced into fast internal RAM - useful because the stacks used by -the tasks come from this space. */ -uint8_t ucHeap[ configTOTAL_HEAP_SIZE ] __attribute__ ( ( section( ".oc_ram" ) ) ); + * application can define the array used as the FreeRTOS heap. This is done so the + * heap can be forced into fast internal RAM - useful because the stacks used by + * the tasks come from this space. */ +uint8_t ucHeap[ configTOTAL_HEAP_SIZE ] __attribute__( ( section( ".oc_ram" ) ) ); /* FreeRTOS uses its own interrupt handler code. This code cannot use the array -of handlers defined by the Altera drivers because the array is declared static, -and so not accessible outside of the dirver's source file. Instead declare an -array for use by the FreeRTOS handler. See: -http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html. */ + * of handlers defined by the Altera drivers because the array is declared static, + * and so not accessible outside of the dirver's source file. Instead declare an + * array for use by the FreeRTOS handler. See: + * http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html. */ static INT_DISPATCH_t xISRHandlers[ ALT_INT_PROVISION_INT_COUNT ]; /*-----------------------------------------------------------*/ int main( void ) { - /* Configure the hardware ready to run the demo. */ - prvSetupHardware(); - - /* The mainSELECTED_APPLICATION setting is described at the top - of this file. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - /* Don't expect to reach here. */ - return 0; + /* Configure the hardware ready to run the demo. */ + prvSetupHardware(); + + /* The mainSELECTED_APPLICATION setting is described at the top + * of this file. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + /* Don't expect to reach here. */ + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { -extern uint8_t __cs3_interrupt_vector; -uint32_t ulSCTLR, ulVectorTable = ( uint32_t ) &__cs3_interrupt_vector; -const uint32_t ulVBit = 13U; - - alt_int_global_init(); - alt_int_cpu_binary_point_set( 0 ); - - /* Clear SCTLR.V for low vectors and map the vector table to the beginning - of the code. */ - __asm( "MRC p15, 0, %0, c1, c0, 0" : "=r" ( ulSCTLR ) ); - ulSCTLR &= ~( 1 << ulVBit ); - __asm( "MCR p15, 0, %0, c1, c0, 0" : : "r" ( ulSCTLR ) ); - __asm( "MCR p15, 0, %0, c12, c0, 0" : : "r" ( ulVectorTable ) ); - - cache_init(); - mmu_init(); - - /* GPIO for LEDs. ParTest is a historic name which used to stand for - parallel port test. */ - vParTestInitialise(); + extern uint8_t __cs3_interrupt_vector; + uint32_t ulSCTLR, ulVectorTable = ( uint32_t ) &__cs3_interrupt_vector; + const uint32_t ulVBit = 13U; + + alt_int_global_init(); + alt_int_cpu_binary_point_set( 0 ); + + /* Clear SCTLR.V for low vectors and map the vector table to the beginning + * of the code. */ + __asm( "MRC p15, 0, %0, c1, c0, 0" : "=r" ( ulSCTLR ) ); + ulSCTLR &= ~( 1 << ulVBit ); + __asm( "MCR p15, 0, %0, c1, c0, 0" : : "r" ( ulSCTLR ) ); + __asm( "MCR p15, 0, %0, c12, c0, 0" : : "r" ( ulVectorTable ) ); + + cache_init(); + mmu_init(); + + /* GPIO for LEDs. ParTest is a historic name which used to stand for + * parallel port test. */ + vParTestInitialise(); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile size_t xFreeHeapSpace; - - /* This is just a trivial example of an idle hook. It is called on each - cycle of the idle task. It must *NOT* attempt to block. In this case the - idle task just queries the amount of FreeRTOS heap that remains. See the - memory management section on the http://www.FreeRTOS.org web site for memory - management options. If there is a lot of heap memory free then the - configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up - RAM. */ - xFreeHeapSpace = xPortGetFreeHeapSize(); - - /* Remove compiler warning about xFreeHeapSpace being set but never used. */ - ( void ) xFreeHeapSpace; + volatile size_t xFreeHeapSpace; + + /* This is just a trivial example of an idle hook. It is called on each + * cycle of the idle task. It must *NOT* attempt to block. In this case the + * idle task just queries the amount of FreeRTOS heap that remains. See the + * memory management section on the http://www.FreeRTOS.org web site for memory + * management options. If there is a lot of heap memory free then the + * configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up + * RAM. */ + xFreeHeapSpace = xPortGetFreeHeapSize(); + + /* Remove compiler warning about xFreeHeapSpace being set but never used. */ + ( void ) xFreeHeapSpace; } /*-----------------------------------------------------------*/ -void vAssertCalled( const char * pcFile, unsigned long ulLine ) +void vAssertCalled( const char * pcFile, + unsigned long ulLine ) { -volatile unsigned long ul = 0; - - ( void ) pcFile; - ( void ) ulLine; - - taskENTER_CRITICAL(); - { - /* Set ul to a non-zero value using the debugger to step out of this - function. */ - while( ul == 0 ) - { - portNOP(); - } - } - taskEXIT_CRITICAL(); + volatile unsigned long ul = 0; + + ( void ) pcFile; + ( void ) ulLine; + + taskENTER_CRITICAL(); + { + /* Set ul to a non-zero value using the debugger to step out of this + * function. */ + while( ul == 0 ) + { + portNOP(); + } + } + taskEXIT_CRITICAL(); } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 ) - { - /* The full demo includes a software timer demo/test that requires - prodding periodically from the tick interrupt. */ - vTimerPeriodicISRTests(); - - /* Call the periodic queue overwrite from ISR demo. */ - vQueueOverwritePeriodicISRDemo(); - - /* Call the periodic event group from ISR demo. */ - vPeriodicEventGroupsProcessing(); - - /* Call the periodic test that uses mutexes form an interrupt. */ - vInterruptSemaphorePeriodicTest(); - } - #endif + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 ) + { + /* The full demo includes a software timer demo/test that requires + * prodding periodically from the tick interrupt. */ + vTimerPeriodicISRTests(); + + /* Call the periodic queue overwrite from ISR demo. */ + vQueueOverwritePeriodicISRDemo(); + + /* Call the periodic event group from ISR demo. */ + vPeriodicEventGroupsProcessing(); + + /* Call the periodic test that uses mutexes form an interrupt. */ + vInterruptSemaphorePeriodicTest(); + } + #endif /* if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 ) */ } /*-----------------------------------------------------------*/ void vConfigureTickInterrupt( void ) { -alt_freq_t ulTempFrequency; -const alt_freq_t ulMicroSecondsPerSecond = 1000000UL; -void FreeRTOS_Tick_Handler( void ); + alt_freq_t ulTempFrequency; + const alt_freq_t ulMicroSecondsPerSecond = 1000000UL; + + void FreeRTOS_Tick_Handler( void ); - /* Interrupts are disabled when this function is called. */ + /* Interrupts are disabled when this function is called. */ - /* Initialise the general purpose timer modules. */ - alt_gpt_all_tmr_init(); + /* Initialise the general purpose timer modules. */ + alt_gpt_all_tmr_init(); - /* ALT_CLK_MPU_PERIPH = mpu_periph_clk */ - alt_clk_freq_get( ALT_CLK_MPU_PERIPH, &ulTempFrequency ); + /* ALT_CLK_MPU_PERIPH = mpu_periph_clk */ + alt_clk_freq_get( ALT_CLK_MPU_PERIPH, &ulTempFrequency ); - /* Use the local private timer. */ - alt_gpt_counter_set( ALT_GPT_CPU_PRIVATE_TMR, ulTempFrequency / configTICK_RATE_HZ ); + /* Use the local private timer. */ + alt_gpt_counter_set( ALT_GPT_CPU_PRIVATE_TMR, ulTempFrequency / configTICK_RATE_HZ ); - /* Sanity check. */ - configASSERT( alt_gpt_time_microsecs_get( ALT_GPT_CPU_PRIVATE_TMR ) == ( ulMicroSecondsPerSecond / configTICK_RATE_HZ ) ); + /* Sanity check. */ + configASSERT( alt_gpt_time_microsecs_get( ALT_GPT_CPU_PRIVATE_TMR ) == ( ulMicroSecondsPerSecond / configTICK_RATE_HZ ) ); - /* Set to periodic mode. */ - alt_gpt_mode_set( ALT_GPT_CPU_PRIVATE_TMR, ALT_GPT_RESTART_MODE_PERIODIC ); + /* Set to periodic mode. */ + alt_gpt_mode_set( ALT_GPT_CPU_PRIVATE_TMR, ALT_GPT_RESTART_MODE_PERIODIC ); - /* The timer can be started here as interrupts are disabled. */ - alt_gpt_tmr_start( ALT_GPT_CPU_PRIVATE_TMR ); + /* The timer can be started here as interrupts are disabled. */ + alt_gpt_tmr_start( ALT_GPT_CPU_PRIVATE_TMR ); - /* Register the standard FreeRTOS Cortex-A tick handler as the timer's - interrupt handler. The handler clears the interrupt using the - configCLEAR_TICK_INTERRUPT() macro, which is defined in FreeRTOSConfig.h. */ - vRegisterIRQHandler( ALT_INT_INTERRUPT_PPI_TIMER_PRIVATE, ( alt_int_callback_t ) FreeRTOS_Tick_Handler, NULL ); + /* Register the standard FreeRTOS Cortex-A tick handler as the timer's + * interrupt handler. The handler clears the interrupt using the + * configCLEAR_TICK_INTERRUPT() macro, which is defined in FreeRTOSConfig.h. */ + vRegisterIRQHandler( ALT_INT_INTERRUPT_PPI_TIMER_PRIVATE, ( alt_int_callback_t ) FreeRTOS_Tick_Handler, NULL ); - /* This tick interrupt must run at the lowest priority. */ - alt_int_dist_priority_set( ALT_INT_INTERRUPT_PPI_TIMER_PRIVATE, portLOWEST_USABLE_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ); + /* This tick interrupt must run at the lowest priority. */ + alt_int_dist_priority_set( ALT_INT_INTERRUPT_PPI_TIMER_PRIVATE, portLOWEST_USABLE_INTERRUPT_PRIORITY << portPRIORITY_SHIFT ); - /* Ensure the interrupt is forwarded to the CPU. */ + /* Ensure the interrupt is forwarded to the CPU. */ alt_int_dist_enable( ALT_INT_INTERRUPT_PPI_TIMER_PRIVATE ); /* Finally, enable the interrupt. */ - alt_gpt_int_clear_pending( ALT_GPT_CPU_PRIVATE_TMR ); - alt_gpt_int_enable( ALT_GPT_CPU_PRIVATE_TMR ); - + alt_gpt_int_clear_pending( ALT_GPT_CPU_PRIVATE_TMR ); + alt_gpt_int_enable( ALT_GPT_CPU_PRIVATE_TMR ); } /*-----------------------------------------------------------*/ -void vRegisterIRQHandler( uint32_t ulID, alt_int_callback_t pxHandlerFunction, void *pvContext ) +void vRegisterIRQHandler( uint32_t ulID, + alt_int_callback_t pxHandlerFunction, + void * pvContext ) { - if( ulID < ALT_INT_PROVISION_INT_COUNT ) - { - xISRHandlers[ ulID ].pxISR = pxHandlerFunction; - xISRHandlers[ ulID ].pvContext = pvContext; - } + if( ulID < ALT_INT_PROVISION_INT_COUNT ) + { + xISRHandlers[ ulID ].pxISR = pxHandlerFunction; + xISRHandlers[ ulID ].pvContext = pvContext; + } } /*-----------------------------------------------------------*/ void vApplicationIRQHandler( uint32_t ulICCIAR ) { -uint32_t ulInterruptID; -void *pvContext; -alt_int_callback_t pxISR; - - /* Re-enable interrupts. */ - __asm ( "cpsie i" ); - - /* The ID of the interrupt is obtained by bitwise anding the ICCIAR value - with 0x3FF. */ - ulInterruptID = ulICCIAR & 0x3FFUL; - - if( ulInterruptID < ALT_INT_PROVISION_INT_COUNT ) - { - /* Call the function installed in the array of installed handler - functions. */ - pxISR = xISRHandlers[ ulInterruptID ].pxISR; - pvContext = xISRHandlers[ ulInterruptID ].pvContext; - pxISR( ulICCIAR, pvContext ); - } + uint32_t ulInterruptID; + void * pvContext; + alt_int_callback_t pxISR; + + /* Re-enable interrupts. */ + __asm( "cpsie i" ); + + /* The ID of the interrupt is obtained by bitwise anding the ICCIAR value + * with 0x3FF. */ + ulInterruptID = ulICCIAR & 0x3FFUL; + + if( ulInterruptID < ALT_INT_PROVISION_INT_COUNT ) + { + /* Call the function installed in the array of installed handler + * functions. */ + pxISR = xISRHandlers[ ulInterruptID ].pxISR; + pvContext = xISRHandlers[ ulInterruptID ].pvContext; + pxISR( ulICCIAR, pvContext ); + } } - diff --git a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main_blinky.c b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main_blinky.c index 6296a61f02b..7519cbf3917 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -26,8 +26,8 @@ /****************************************************************************** * NOTE 1: This project provides two demo applications. A simple blinky - * style project, and a more comprehensive test and demo application. The - * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select + * style project, and a more comprehensive test and demo application. The + * 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 * in main.c. This file implements the simply blinky style version. * @@ -70,28 +70,28 @@ #include "partest.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /* The LED toggled by the Rx task. */ -#define mainTASK_LED ( 0 ) +#define mainTASK_LED ( 0 ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /*-----------------------------------------------------------*/ @@ -102,86 +102,87 @@ static QueueHandle_t xQueue = NULL; void main_blinky( void ) { - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); - - if( xQueue != NULL ) - { - /* Start the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - NULL, /* The parameter passed to the task - not used in this case. */ - mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ - - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Start the tasks and timer running. */ - 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( ;; ); + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); + + if( xQueue != NULL ) + { + /* Start the two tasks as described in the comments at the top of this + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + NULL, /* The parameter passed to the task - not used in this case. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ + + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Start the tasks and timer running. */ + 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 prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; - - /* Remove compiler warning about unused parameter. */ - ( void ) pvParameters; - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - - /* 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 - will not block - it shouldn't need to block as the queue should always - be empty at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; + + /* Remove compiler warning about unused parameter. */ + ( void ) pvParameters; + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + + /* 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 + * will not block - it shouldn't need to block as the queue should always + * be empty at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; -const unsigned long ulExpectedValue = 100UL; - - /* Remove compiler warning about unused parameter. */ - ( void ) pvParameters; - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it the expected value? If it is, toggle the LED. */ - if( ulReceivedValue == ulExpectedValue ) - { - vParTestToggleLED( mainTASK_LED ); - ulReceivedValue = 0U; - } - } + unsigned long ulReceivedValue; + const unsigned long ulExpectedValue = 100UL; + + /* Remove compiler warning about unused parameter. */ + ( void ) pvParameters; + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it the expected value? If it is, toggle the LED. */ + if( ulReceivedValue == ulExpectedValue ) + { + vParTestToggleLED( mainTASK_LED ); + ulReceivedValue = 0U; + } + } } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main_full.c b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main_full.c index 03c522d9e0d..d6eeaa01046 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main_full.c +++ b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -92,42 +92,42 @@ #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 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 ) /* The priority used by the UART command console task. This is very basic and -uses the Altera polling UART driver - so *must* run at the idle priority. */ -#define mainUART_COMMAND_CONSOLE_TASK_PRIORITY ( tskIDLE_PRIORITY ) +* uses the Altera polling UART driver - so *must* run at the idle priority. */ +#define mainUART_COMMAND_CONSOLE_TASK_PRIORITY ( tskIDLE_PRIORITY ) /* The LED used by the check task. */ -#define mainCHECK_LED ( 0 ) +#define mainCHECK_LED ( 0 ) /* A block time of zero simply means "don't block". */ -#define mainDONT_BLOCK ( 0UL ) +#define mainDONT_BLOCK ( 0UL ) /* The period of the check task, 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 pdMS_TO_TICKS() macro constant. */ -#define mainNO_ERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 3000UL ) + * any of the standard demo tasks. ms are converted to the equivalent in ticks + * using the pdMS_TO_TICKS() macro constant. */ +#define mainNO_ERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 3000UL ) /* The period of the check task, 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 -pdMS_TO_TICKS() macro. */ -#define mainERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 200UL ) + * the standard demo tasks. ms are converted to the equivalent in ticks using the + * pdMS_TO_TICKS() macro. */ +#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 ) + * 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 ) +#define mainTIMER_TEST_PERIOD ( 50 ) /*-----------------------------------------------------------*/ @@ -135,7 +135,7 @@ purpose of ensuring parameters are passed into tasks correctly. */ /* * The check task, as described at the top of this file. */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); /* * Register check tasks, and the tasks used to write over and check the contents @@ -144,9 +144,9 @@ static void prvCheckTask( void *pvParameters ); * entry points are kept in the C file for the convenience of checking the task * parameter. */ -static void prvRegTestTaskEntry1( void *pvParameters ); +static void prvRegTestTaskEntry1( void * pvParameters ); extern void vRegTest1Implementation( void ); -static void prvRegTestTaskEntry2( void *pvParameters ); +static void prvRegTestTaskEntry2( void * pvParameters ); extern void vRegTest2Implementation( void ); /* @@ -158,285 +158,284 @@ extern void vRegisterSampleCLICommands( void ); /* * The task that manages the FreeRTOS+CLI input and output. */ -extern void vUARTCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority ); +extern void vUARTCommandConsoleStart( uint16_t usStackSize, + UBaseType_t uxPriority ); /* * A high priority task that does nothing other than execute at a pseudo random * time to ensure the other test tasks don't just execute in a repeating * pattern. */ -static void prvPseudoRandomiser( void *pvParameters ); +static void prvPseudoRandomiser( void * pvParameters ); /*-----------------------------------------------------------*/ /* 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 -stops incrementing, then an error has been found. */ + * 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 + * 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 no particular - functionality, but do demonstrate how to use the FreeRTOS API and test the - kernel port. */ - vStartDynamicPriorityTasks(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vCreateBlockTimeTasks(); - vStartCountingSemaphoreTasks(); - vStartGenericQueueTasks( tskIDLE_PRIORITY ); - vStartRecursiveMutexTasks(); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartMathTasks( mainFLOP_TASK_PRIORITY ); - vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); - vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY ); - vStartEventGroupTasks(); - vStartInterruptSemaphoreTasks(); - - /* 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 just adds a little random behaviour. */ - xTaskCreate( prvPseudoRandomiser, "Rnd", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, 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 ); - - /* The set of tasks created by the following function call have to be - created last as they keep account of the number of tasks they expect to see - running. */ - vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - - /* 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( ;; ); + /* Start all the other standard demo/test tasks. They have no particular + * functionality, but do demonstrate how to use the FreeRTOS API and test the + * kernel port. */ + vStartDynamicPriorityTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vCreateBlockTimeTasks(); + vStartCountingSemaphoreTasks(); + vStartGenericQueueTasks( tskIDLE_PRIORITY ); + vStartRecursiveMutexTasks(); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartMathTasks( mainFLOP_TASK_PRIORITY ); + vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); + vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY ); + vStartEventGroupTasks(); + vStartInterruptSemaphoreTasks(); + + /* 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 just adds a little random behaviour. */ + xTaskCreate( prvPseudoRandomiser, "Rnd", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, 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 ); + + /* The set of tasks created by the following function call have to be + * created last as they keep account of the number of tasks they expect to see + * running. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + + /* 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 ) +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( xAreMathsTaskStillRunning() != pdTRUE ) - { - ulErrorFound = 1 << 1; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - ulErrorFound = 1 << 2; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - ulErrorFound = 1 << 3; - } - - if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - ulErrorFound = 1 << 4; - } - - if ( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - ulErrorFound = 1 << 5; - } - - if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - ulErrorFound = 1 << 6; - } - - if( xIsCreateTaskStillRunning() != pdTRUE ) - { - ulErrorFound = 1 << 7; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - ulErrorFound = 1 << 8; - } - - if( xAreTimerDemoTasksStillRunning( ( TickType_t ) mainNO_ERROR_CHECK_TASK_PERIOD ) != pdPASS ) - { - ulErrorFound = 1 << 9; - } - - if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) - { - ulErrorFound = 1 << 10; - } - - if( xIsQueueOverwriteTaskStillRunning() != pdPASS ) - { - ulErrorFound = 1 << 11; - } - - if( xAreEventGroupTasksStillRunning() != pdPASS ) - { - ulErrorFound = 1 << 12; - } - - if( xAreInterruptSemaphoreTasksStillRunning() != pdPASS ) - { - ulErrorFound = 1 << 13; - } - - /* Check that the register test 1 task is still running. */ - if( ulLastRegTest1Value == ulRegTest1LoopCounter ) - { - ulErrorFound = 1 << 14; - } - ulLastRegTest1Value = ulRegTest1LoopCounter; - - /* Check that the register test 2 task is still running. */ - if( ulLastRegTest2Value == ulRegTest2LoopCounter ) - { - ulErrorFound = 1 << 15; - } - 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; - } - } + 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( xAreMathsTaskStillRunning() != pdTRUE ) + { + ulErrorFound = 1 << 1; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + ulErrorFound = 1 << 2; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + ulErrorFound = 1 << 3; + } + + if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + ulErrorFound = 1 << 4; + } + + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + ulErrorFound = 1 << 5; + } + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + ulErrorFound = 1 << 6; + } + + if( xIsCreateTaskStillRunning() != pdTRUE ) + { + ulErrorFound = 1 << 7; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + ulErrorFound = 1 << 8; + } + + if( xAreTimerDemoTasksStillRunning( ( TickType_t ) mainNO_ERROR_CHECK_TASK_PERIOD ) != pdPASS ) + { + ulErrorFound = 1 << 9; + } + + if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) + { + ulErrorFound = 1 << 10; + } + + if( xIsQueueOverwriteTaskStillRunning() != pdPASS ) + { + ulErrorFound = 1 << 11; + } + + if( xAreEventGroupTasksStillRunning() != pdPASS ) + { + ulErrorFound = 1 << 12; + } + + if( xAreInterruptSemaphoreTasksStillRunning() != pdPASS ) + { + ulErrorFound = 1 << 13; + } + + /* Check that the register test 1 task is still running. */ + if( ulLastRegTest1Value == ulRegTest1LoopCounter ) + { + ulErrorFound = 1 << 14; + } + + ulLastRegTest1Value = ulRegTest1LoopCounter; + + /* Check that the register test 2 task is still running. */ + if( ulLastRegTest2Value == ulRegTest2LoopCounter ) + { + ulErrorFound = 1 << 15; + } + + 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 ) +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 ) - { - /* The reg test task also tests the floating point registers. Tasks - that use the floating point unit must call vPortTaskUsesFPU() before - any floating point instructions are executed. */ - vPortTaskUsesFPU(); - - /* 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 task will detect that the regtest loop counter is - not being incremented and flag an error. */ - vTaskDelete( NULL ); + /* 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 ) + { + /* The reg test task also tests the floating point registers. Tasks + * that use the floating point unit must call vPortTaskUsesFPU() before + * any floating point instructions are executed. */ + vPortTaskUsesFPU(); + + /* 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 task will detect that the regtest loop counter is + * not being incremented and flag an error. */ + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ -static void prvRegTestTaskEntry2( void *pvParameters ) +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 ) - { - /* The reg test task also tests the floating point registers. Tasks - that use the floating point unit must call vPortTaskUsesFPU() before - any floating point instructions are executed. */ - vPortTaskUsesFPU(); - - /* 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 task will detect that the regtest loop counter is - not being incremented and flag an error. */ - vTaskDelete( NULL ); + /* 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 ) + { + /* The reg test task also tests the floating point registers. Tasks + * that use the floating point unit must call vPortTaskUsesFPU() before + * any floating point instructions are executed. */ + vPortTaskUsesFPU(); + + /* 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 task will detect that the regtest loop counter is + * not being incremented and flag an error. */ + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ -static void prvPseudoRandomiser( void *pvParameters ) +static void prvPseudoRandomiser( void * pvParameters ) { -const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL, ulMinDelay = ( 35 / portTICK_PERIOD_MS ); -volatile uint32_t ulNextRand = ( uint32_t ) &pvParameters, ulValue; - - - /* This task does nothing other than ensure there is a little bit of - disruption in the scheduling pattern of the other tasks. Normally this is - done by generating interrupts at pseudo random times. */ - for( ;; ) - { - ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement; - ulValue = ( ulNextRand >> 16UL ) & 0xffUL; - - if( ulValue < ulMinDelay ) - { - ulValue = ulMinDelay; - } - - vTaskDelay( ulValue ); - - while( ulValue > 0 ) - { - __asm volatile( "NOP" ); - __asm volatile( "NOP" ); - __asm volatile( "NOP" ); - __asm volatile( "NOP" ); - - ulValue--; - } - } + const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL, ulMinDelay = ( 35 / portTICK_PERIOD_MS ); + volatile uint32_t ulNextRand = ( uint32_t ) &pvParameters, ulValue; + + + /* This task does nothing other than ensure there is a little bit of + * disruption in the scheduling pattern of the other tasks. Normally this is + * done by generating interrupts at pseudo random times. */ + for( ; ; ) + { + ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement; + ulValue = ( ulNextRand >> 16UL ) & 0xffUL; + + if( ulValue < ulMinDelay ) + { + ulValue = ulMinDelay; + } + + vTaskDelay( ulValue ); + + while( ulValue > 0 ) + { + __asm volatile ( "NOP" ); + __asm volatile ( "NOP" ); + __asm volatile ( "NOP" ); + __asm volatile ( "NOP" ); + + ulValue--; + } + } } - - - - - - diff --git a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/serial.c b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/serial.c index 143f15d1192..f26fc67060b 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/serial.c +++ b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Blinky_Demo/main_blinky.c index 6ac9446f534..3da0782cc79 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOSConfig.h index 053bf406bb8..ee95b54ae42 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOS_tick_config.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOS_tick_config.c index 2ca9e73edac..b4f6d764a7c 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOS_tick_config.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOS_tick_config.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/IntQueueTimer.c index e2d3350aa29..939af919c2e 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/IntQueueTimer.h index 4fb214c4093..dc540323649 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/main_full.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/main_full.c index a92578dd0a6..2a3bfbee7a7 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/serial.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/serial.c index 62792513dcd..4f631097f01 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/serial.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/ParTest.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/ParTest.c index a31aa57367b..770de736ac8 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/lwIP_Apps/apps/BasicSocketCommandServer/BasicSocketCommandServer.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/lwIP_Apps/apps/BasicSocketCommandServer/BasicSocketCommandServer.c index b7adfe51b42..7bb2ddf9b57 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/lwIP_Apps/apps/BasicSocketCommandServer/BasicSocketCommandServer.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/lwIP_Apps/apps/BasicSocketCommandServer/BasicSocketCommandServer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/lwIP_Apps/lwIP_Apps.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/lwIP_Apps/lwIP_Apps.c index 00effb7fab5..d201bcbf210 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/lwIP_Apps/lwIP_Apps.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/lwIP_Apps/lwIP_Apps.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/lwIP_Apps/lwIP_Apps.h b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/lwIP_Apps/lwIP_Apps.h index 0c7e833879d..678e49232ac 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/lwIP_Apps/lwIP_Apps.h +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/lwIP_Apps/lwIP_Apps.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/main_lwIP.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/main_lwIP.c index cdd4399f2f0..b72080b6f4f 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/main_lwIP.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/lwIP_Demo/main_lwIP.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c index 17bf5454e43..9e02c4637e2 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/FreeRTOSConfig.h index d10defcbf45..b07f4057e60 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/FreeRTOS_tick_config.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/FreeRTOS_tick_config.c index 2ca9e73edac..b4f6d764a7c 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/FreeRTOS_tick_config.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/FreeRTOS_tick_config.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/ParTest.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/ParTest.c index 047a698f0ec..df1cbc46d68 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/blinky_demo/main_blinky.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/blinky_demo/main_blinky.c index 1dabbe3ef73..e2150b37ef4 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/blinky_demo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/blinky_demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/full_demo/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/full_demo/IntQueueTimer.c index 2185476a454..d61a038b020 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/full_demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/full_demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/full_demo/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/full_demo/IntQueueTimer.h index 4fb214c4093..dc540323649 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/full_demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/full_demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/full_demo/main_full.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/full_demo/main_full.c index 4b8a0a8f17d..31a1c4c897a 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/full_demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/full_demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/full_demo/serial.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/full_demo/serial.c index 62792513dcd..4f631097f01 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/full_demo/serial.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/full_demo/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/main.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/main.c index 16d7036ccba..9de4c276d72 100644 --- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/main.c +++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702_Vitis_QEMU/RTOSDemo/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/FreeRTOSConfig.h index e2375916d90..13945fa4c24 100644 --- a/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/ParTest/ParTest.c b/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/ParTest/ParTest.c index b85c654aa3b..f9253e0dca0 100644 --- a/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/ParTest/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/lcd_message.h b/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/lcd_message.h index 4c17ce9baa7..2fbe9293ccd 100644 --- a/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/lcd_message.h +++ b/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/lcd_message.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/main.c b/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/main.c index 93799d9bc03..b3a2a4aa44e 100644 --- a/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/main.c +++ b/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -83,29 +83,29 @@ /*-----------------------------------------------------------*/ /* The time between cycles of the 'check' functionality (defined within the -tick hook). */ -#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) + * tick hook). */ +#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) /* The LCD task uses the sprintf function so requires a little more stack too. */ -#define mainLCD_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 ) +#define mainLCD_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 ) /* Task priorities. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) /* The maximum number of message that can be waiting for display at any one -time. */ -#define mainLCD_QUEUE_SIZE ( 3 ) + * time. */ +#define mainLCD_QUEUE_SIZE ( 3 ) /* Constants used by the comtest tasks. There isn't a spare LED so an invalid -LED is specified. */ -#define mainBAUD_RATE ( 115200 ) -#define mainCOM_TEST_LED ( 10 ) + * LED is specified. */ +#define mainBAUD_RATE ( 115200 ) +#define mainCOM_TEST_LED ( 10 ) /*-----------------------------------------------------------*/ @@ -118,13 +118,14 @@ static void prvSetupHardware( void ); * The LCD gatekeeper task. Tasks wishing to write to the LCD do not access * the LCD directly, but instead send the message to the LCD gatekeeper task. */ -static void prvLCDTask( void *pvParameters ); +static void prvLCDTask( void * pvParameters ); /* * Hook functions that can get called by the kernel. The 'check' functionality * is implemented within the tick hook. */ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); /* * The tick hook function as described in the comments at the top of this file. @@ -144,149 +145,154 @@ static QueueHandle_t xLCDQueue; int main( void ) { - /* Prepare the hardware. */ - prvSetupHardware(); + /* Prepare the hardware. */ + prvSetupHardware(); - /* Create the queue used by the LCD task. Messages for display on the LCD - are received via this queue. */ - xLCDQueue = xQueueCreate( mainLCD_QUEUE_SIZE, sizeof( xLCDMessage ) ); + /* Create the queue used by the LCD task. Messages for display on the LCD + * are received via this queue. */ + xLCDQueue = xQueueCreate( mainLCD_QUEUE_SIZE, sizeof( xLCDMessage ) ); - /* Start the standard demo tasks. These do nothing other than test the - port and provide some APU usage examples. */ + /* Start the standard demo tasks. These do nothing other than test the + * port and provide some APU usage examples. */ vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY ); vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); - vStartRecursiveMutexTasks(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vCreateBlockTimeTasks(); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartQueuePeekTasks(); - vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainBAUD_RATE, mainCOM_TEST_LED ); + vStartRecursiveMutexTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vCreateBlockTimeTasks(); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartQueuePeekTasks(); + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainBAUD_RATE, mainCOM_TEST_LED ); - /* Start the tasks defined within this file/specific to this demo. */ - xTaskCreate( prvLCDTask, "LCD", mainLCD_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + /* Start the tasks defined within this file/specific to this demo. */ + xTaskCreate( prvLCDTask, "LCD", mainLCD_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - /* Start the scheduler. */ - vTaskStartScheduler(); + /* Start the scheduler. */ + vTaskStartScheduler(); /* Will only get here if there was insufficient memory to create the idle - task. */ - return 0; + * task. */ + return 0; } /*-----------------------------------------------------------*/ void prvSetupHardware( void ) { - /* Initialise the port used for the LED outputs. */ - vParTestInitialise(); + /* Initialise the port used for the LED outputs. */ + vParTestInitialise(); } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { -static xLCDMessage xMessage = { "PASS" }; -static unsigned long ulTicksSinceLastDisplay = 0; -portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; - - /* Called from every tick interrupt. Have enough ticks passed to make it - time to perform our health status check again? */ - ulTicksSinceLastDisplay++; - if( ulTicksSinceLastDisplay >= mainCHECK_DELAY ) - { - ulTicksSinceLastDisplay = 0; - - /* Has an error been found in any task? */ - if( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN GEN Q"; - } - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN MATH"; - } - else if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN BLOCK Q"; - } - else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN BLOCK TIME"; - } - else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN SEMAPHORE"; - } - else if( xArePollingQueuesStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN POLL Q"; - } - else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN PEEK Q"; - } - else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN REC MUTEX"; - } - else if( xAreComTestTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN COMTEST"; - } - - /* Send the message to the LCD gatekeeper for display. */ - xHigherPriorityTaskWoken = pdFALSE; - xQueueSendFromISR( xLCDQueue, &xMessage, &xHigherPriorityTaskWoken ); - } + static xLCDMessage xMessage = { "PASS" }; + static unsigned long ulTicksSinceLastDisplay = 0; + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + + /* Called from every tick interrupt. Have enough ticks passed to make it + * time to perform our health status check again? */ + ulTicksSinceLastDisplay++; + + if( ulTicksSinceLastDisplay >= mainCHECK_DELAY ) + { + ulTicksSinceLastDisplay = 0; + + /* Has an error been found in any task? */ + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "ERROR IN GEN Q"; + } + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "ERROR IN MATH"; + } + else if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "ERROR IN BLOCK Q"; + } + else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "ERROR IN BLOCK TIME"; + } + else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "ERROR IN SEMAPHORE"; + } + else if( xArePollingQueuesStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "ERROR IN POLL Q"; + } + else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "ERROR IN PEEK Q"; + } + else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "ERROR IN REC MUTEX"; + } + else if( xAreComTestTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "ERROR IN COMTEST"; + } + + /* Send the message to the LCD gatekeeper for display. */ + xHigherPriorityTaskWoken = pdFALSE; + xQueueSendFromISR( xLCDQueue, &xMessage, &xHigherPriorityTaskWoken ); + } } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pxTask; - ( void ) pcTaskName; - - /* If the parameters have been corrupted then inspect pxCurrentTCB to - identify which task has overflowed its stack. */ - for( ;; ); + ( void ) pxTask; + ( void ) pcTaskName; + + /* If the parameters have been corrupted then inspect pxCurrentTCB to + * identify which task has overflowed its stack. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvLCDTask( void *pvParameters ) +static void prvLCDTask( void * pvParameters ) { -xLCDMessage xMessage; -unsigned long ulY = 0; -const unsigned long ulX = 5; -const unsigned long ulMaxY = 250, ulYIncrement = 22, ulWidth = 250, ulHeight = 20;; + xLCDMessage xMessage; + unsigned long ulY = 0; + const unsigned long ulX = 5; + const unsigned long ulMaxY = 250, ulYIncrement = 22, ulWidth = 250, ulHeight = 20; /* Initialize LCD. */ LCDD_Initialize(); LCDD_Start(); - LCDD_Fill( ( void * ) BOARD_LCD_BASE, COLOR_WHITE ); - LCDD_DrawString( ( void * ) BOARD_LCD_BASE, 1, ulY + 3, " www.FreeRTOS.org", COLOR_BLACK ); + LCDD_Fill( ( void * ) BOARD_LCD_BASE, COLOR_WHITE ); + LCDD_DrawString( ( void * ) BOARD_LCD_BASE, 1, ulY + 3, " www.FreeRTOS.org", COLOR_BLACK ); - for( ;; ) - { - /* Wait for a message from the check function (which is executed in - the tick hook). */ - xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ); + for( ; ; ) + { + /* Wait for a message from the check function (which is executed in + * the tick hook). */ + xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ); - /* Clear the space where the old message was. */ + /* Clear the space where the old message was. */ LCDD_DrawRectangle( ( void * ) BOARD_LCD_BASE, 0, ulY, ulWidth, ulHeight, COLOR_WHITE ); - /* Increment to the next drawing position. */ - ulY += ulYIncrement; + /* Increment to the next drawing position. */ + ulY += ulYIncrement; - /* Have the Y position moved past the end of the LCD? */ - if( ulY >= ulMaxY ) - { - ulY = 0; - } + /* Have the Y position moved past the end of the LCD? */ + if( ulY >= ulMaxY ) + { + ulY = 0; + } - /* Draw a new rectangle, in which the message will be written. */ + /* Draw a new rectangle, in which the message will be written. */ LCDD_DrawRectangle( ( void * ) BOARD_LCD_BASE, 0, ulY, ulWidth, ulHeight, COLOR_GREEN ); - /* Write the message. */ + /* Write the message. */ LCDD_DrawString( ( void * ) BOARD_LCD_BASE, ulX, ulY + 3, xMessage.pcMessage, COLOR_BLACK ); - } + } } diff --git a/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/serial/serial.c b/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/serial/serial.c index e07c45409a6..c976ac17505 100644 --- a/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/serial/serial.c +++ b/FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/Common-Demo-Source/comtest.c b/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/Common-Demo-Source/comtest.c index c8084146fef..b57e2d94fe3 100644 --- a/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/Common-Demo-Source/comtest.c +++ b/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/Common-Demo-Source/comtest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/Common-Demo-Source/include/demo_serial.h b/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/Common-Demo-Source/include/demo_serial.h index 2c7134c8d2d..4aa2e649ca7 100644 --- a/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/Common-Demo-Source/include/demo_serial.h +++ b/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/Common-Demo-Source/include/demo_serial.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/FreeRTOSConfig.h index 8de086ea862..3ea9591b625 100644 --- a/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/ParTest.c b/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/ParTest.c index 93f2f72e5f5..a8586f8113a 100644 --- a/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/main.c b/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/main.c index b0ef27147eb..7dffbb10eb9 100644 --- a/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/main.c +++ b/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/main_blinky.c b/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/main_blinky.c index a75c9f0ff99..0a1d346db0c 100644 --- a/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/main_full.c b/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/main_full.c index f07bb9e44eb..4403c98bed0 100644 --- a/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/main_full.c +++ b/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/serial.c b/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/serial.c index 4a56a7c174a..435f76a014f 100644 --- a/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/serial.c +++ b/FreeRTOS/Demo/CORTEX_ATSAM3S-EK2_Atmel_Studio/src/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/Common-Demo-Source/comtest.c b/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/Common-Demo-Source/comtest.c index c8084146fef..b57e2d94fe3 100644 --- a/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/Common-Demo-Source/comtest.c +++ b/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/Common-Demo-Source/comtest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/Common-Demo-Source/include/demo_serial.h b/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/Common-Demo-Source/include/demo_serial.h index 2c7134c8d2d..4aa2e649ca7 100644 --- a/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/Common-Demo-Source/include/demo_serial.h +++ b/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/Common-Demo-Source/include/demo_serial.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/FreeRTOSConfig.h index 8de086ea862..3ea9591b625 100644 --- a/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/ParTest.c b/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/ParTest.c index 93f2f72e5f5..a8586f8113a 100644 --- a/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/main.c b/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/main.c index b0ef27147eb..7dffbb10eb9 100644 --- a/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/main.c +++ b/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/main_blinky.c b/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/main_blinky.c index a75c9f0ff99..0a1d346db0c 100644 --- a/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/main_full.c b/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/main_full.c index f07bb9e44eb..4403c98bed0 100644 --- a/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/main_full.c +++ b/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/serial.c b/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/serial.c index b71b7a5f236..f5e0545e1cb 100644 --- a/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/serial.c +++ b/FreeRTOS/Demo/CORTEX_ATSAM3X_Atmel_Studio/src/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/FreeRTOSConfig.h index 3ebda65edc5..0f41ba971c8 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/IntQueueTimer.c index b5786d89339..2847ed69fb4 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/IntQueueTimer.h index 45f68d036ec..4d703b80f0a 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/ParTest.c b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/ParTest.c index 9bc3bbeddde..35a3ee88394 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/Serial.c b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/Serial.c index 1e48d161169..480d5179892 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/Serial.c +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/Serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/TimerTest.c b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/TimerTest.c index e9fa6dc20a9..854f076a9bf 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/TimerTest.c +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/TimerTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/main.c b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/main.c index 41246c17e95..fb9beb573af 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/main.c +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_GCC/FreeRTOS_Demo.cydsn/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/FreeRTOSConfig.h index 3ebda65edc5..0f41ba971c8 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/IntQueueTimer.c index b5786d89339..2847ed69fb4 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/IntQueueTimer.h index 45f68d036ec..4d703b80f0a 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/ParTest.c b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/ParTest.c index 9bc3bbeddde..35a3ee88394 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/Serial.c b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/Serial.c index 1e48d161169..480d5179892 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/Serial.c +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/Serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/TimerTest.c b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/TimerTest.c index e9fa6dc20a9..854f076a9bf 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/TimerTest.c +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/TimerTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/main.c b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/main.c index 41246c17e95..fb9beb573af 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/main.c +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_Keil/FreeRTOS_Demo.cydsn/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/FreeRTOSConfig.h index 3ebda65edc5..0f41ba971c8 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/IntQueueTimer.c index b5786d89339..2847ed69fb4 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/IntQueueTimer.h index 45f68d036ec..4d703b80f0a 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/ParTest.c b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/ParTest.c index 9bc3bbeddde..35a3ee88394 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/Serial.c b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/Serial.c index 1e48d161169..480d5179892 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/Serial.c +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/Serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/TimerTest.c b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/TimerTest.c index e9fa6dc20a9..854f076a9bf 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/TimerTest.c +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/TimerTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/main.c b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/main.c index 41246c17e95..fb9beb573af 100644 --- a/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/main.c +++ b/FreeRTOS/Demo/CORTEX_CY8C5588_PSoC_Creator_RVDS/FreeRTOS_Demo.cydsn/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/FreeRTOSConfig.h index d70bbff55e3..3cc1fcb59eb 100644 --- a/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Full_Demo/RegTest.c b/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Full_Demo/RegTest.c index e28d66f64b6..6ab001d2747 100644 --- a/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Full_Demo/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Full_Demo/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Full_Demo/main_full.c b/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Full_Demo/main_full.c index 1b0e0b92c88..2d2abd7cf86 100644 --- a/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Low_Power_Demo/low_power_tick_management_BURTC.c b/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Low_Power_Demo/low_power_tick_management_BURTC.c index f4410f9ebba..2275cb307a4 100644 --- a/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Low_Power_Demo/low_power_tick_management_BURTC.c +++ b/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Low_Power_Demo/low_power_tick_management_BURTC.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Low_Power_Demo/low_power_tick_management_RTC.c b/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Low_Power_Demo/low_power_tick_management_RTC.c index 7e68fa77c93..fbd277f1b32 100644 --- a/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Low_Power_Demo/low_power_tick_management_RTC.c +++ b/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Low_Power_Demo/low_power_tick_management_RTC.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Low_Power_Demo/main_low_power.c b/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Low_Power_Demo/main_low_power.c index 7cc9e8460af..d21fafe3d9b 100644 --- a/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Low_Power_Demo/main_low_power.c +++ b/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/Low_Power_Demo/main_low_power.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/main.c b/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/main.c index da2b41a0247..90d42496b2d 100644 --- a/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/main.c +++ b/FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -67,167 +67,172 @@ static void prvSetupHardware( void ); * main_low_power() is used when configCREATE_LOW_POWER_DEMO is set to 1. * main_full() is used when configCREATE_LOW_POWER_DEMO is set to 0. */ -#if( configCREATE_LOW_POWER_DEMO != 0 ) - extern void main_low_power( void ); +#if ( configCREATE_LOW_POWER_DEMO != 0 ) + extern void main_low_power( void ); #else - extern void main_full( void ); + extern void main_full( void ); #endif /* #if configCREATE_LOW_POWER_DEMO == 1 */ /* Prototypes for the standard FreeRTOS callback/hook functions implemented -within this file. */ + * within this file. */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /*-----------------------------------------------------------*/ int main( void ) { - /* - * See the following link for instructions: - * https://www.FreeRTOS.org/EFM32-Giant-Gecko-Pearl-Gecko-tickless-RTOS-demo.html - */ - - /* Configure the hardware ready to run the demo. */ - prvSetupHardware(); - - /* The mainCREATE_LOW_POWER_DEMO setting is described at the top - of this file. */ - #if( configCREATE_LOW_POWER_DEMO != 0 ) - { - main_low_power(); - } - #else - { - main_full(); - } - #endif - - /* Should not get here. */ - return 0; + /* + * See the following link for instructions: + * https://www.FreeRTOS.org/EFM32-Giant-Gecko-Pearl-Gecko-tickless-RTOS-demo.html + */ + + /* Configure the hardware ready to run the demo. */ + prvSetupHardware(); + + /* The mainCREATE_LOW_POWER_DEMO setting is described at the top + * of this file. */ + #if ( configCREATE_LOW_POWER_DEMO != 0 ) + { + main_low_power(); + } + #else + { + main_full(); + } + #endif + + /* Should not get here. */ + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Library initialisation routines. */ - CHIP_Init(); - BSP_TraceProfilerSetup(); - SLEEP_Init( NULL, NULL ); - BSP_LedsInit(); + /* Library initialisation routines. */ + CHIP_Init(); + BSP_TraceProfilerSetup(); + SLEEP_Init( NULL, NULL ); + BSP_LedsInit(); - SLEEP_SleepBlockBegin( configENERGY_MODE ); + SLEEP_SleepBlockBegin( configENERGY_MODE ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ - - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ + + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; + ( void ) pcTaskName; + ( void ) pxTask; - /* 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. */ + /* 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. */ - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile size_t xFreeHeapSpace; - - /* This is just a trivial example of an idle hook. It is called on each - cycle of the idle task. It must *NOT* attempt to block. In this case the - idle task just queries the amount of FreeRTOS heap that remains. See the - memory management section on the http://www.FreeRTOS.org web site for memory - management options. If there is a lot of heap memory free then the - configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up - RAM. */ - xFreeHeapSpace = xPortGetFreeHeapSize(); - - /* Remove compiler warning about xFreeHeapSpace being set but never used. */ - ( void ) xFreeHeapSpace; + volatile size_t xFreeHeapSpace; + + /* This is just a trivial example of an idle hook. It is called on each + * cycle of the idle task. It must *NOT* attempt to block. In this case the + * idle task just queries the amount of FreeRTOS heap that remains. See the + * memory management section on the http://www.FreeRTOS.org web site for memory + * management options. If there is a lot of heap memory free then the + * configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up + * RAM. */ + xFreeHeapSpace = xPortGetFreeHeapSize(); + + /* Remove compiler warning about xFreeHeapSpace being set but never used. */ + ( void ) xFreeHeapSpace; } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* The full demo includes tests that run from the tick hook. */ - #if( configCREATE_LOW_POWER_DEMO == 0 ) - { - extern void vFullDemoTickHook( void ); - - /* Some of the tests and demo tasks executed by the full demo include - interaction from an interrupt - for which the tick interrupt is used - via the tick hook function. */ - vFullDemoTickHook(); - } - #endif + /* The full demo includes tests that run from the tick hook. */ + #if ( configCREATE_LOW_POWER_DEMO == 0 ) + { + extern void vFullDemoTickHook( void ); + + /* Some of the tests and demo tasks executed by the full demo include + * interaction from an interrupt - for which the tick interrupt is used + * via the tick hook function. */ + vFullDemoTickHook(); + } + #endif } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an -implementation of vApplicationGetIdleTaskMemory() to provide the memory that is -used by the Idle task. */ -void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) + * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is + * used by the Idle task. */ +void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, + StackType_t ** ppxIdleTaskStackBuffer, + uint32_t * pulIdleTaskStackSize ) { /* If the buffers to be provided to the Idle task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xIdleTaskTCB; -static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Idle task's - state will be stored. */ - *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; - - /* Pass out the array that will be used as the Idle task's stack. */ - *ppxIdleTaskStackBuffer = uxIdleTaskStack; - - /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xIdleTaskTCB; + static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Idle task's + * state will be stored. */ + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + + /* Pass out the array that will be used as the Idle task's stack. */ + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + + /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the -application must provide an implementation of vApplicationGetTimerTaskMemory() -to provide the memory that is used by the Timer service task. */ -void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) + * application must provide an implementation of vApplicationGetTimerTaskMemory() + * to provide the memory that is used by the Timer service task. */ +void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, + StackType_t ** ppxTimerTaskStackBuffer, + uint32_t * pulTimerTaskStackSize ) { /* If the buffers to be provided to the Timer task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xTimerTaskTCB; -static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Timer - task's state will be stored. */ - *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; - - /* Pass out the array that will be used as the Timer task's stack. */ - *ppxTimerTaskStackBuffer = uxTimerTaskStack; - - /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xTimerTaskTCB; + static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Timer + * task's state will be stored. */ + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + + /* Pass out the array that will be used as the Timer task's stack. */ + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + + /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } - diff --git a/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/FreeRTOSConfig.h index 9b39c760d4a..6c1996eb87c 100644 --- a/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/Full_Demo/RegTest.c b/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/Full_Demo/RegTest.c index e4742d5c46e..9a4222de530 100644 --- a/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/Full_Demo/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/Full_Demo/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/Full_Demo/main_full.c b/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/Full_Demo/main_full.c index 1b0e0b92c88..2d2abd7cf86 100644 --- a/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/Low_Power_Demo/low_power_tick_management_RTCC.c b/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/Low_Power_Demo/low_power_tick_management_RTCC.c index 39f0eb0d4f2..fb2eeed24b2 100644 --- a/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/Low_Power_Demo/low_power_tick_management_RTCC.c +++ b/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/Low_Power_Demo/low_power_tick_management_RTCC.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/Low_Power_Demo/main_low_power.c b/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/Low_Power_Demo/main_low_power.c index 7cc9e8460af..d21fafe3d9b 100644 --- a/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/Low_Power_Demo/main_low_power.c +++ b/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/Low_Power_Demo/main_low_power.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/main.c b/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/main.c index d292fa97960..67bc62f00e7 100644 --- a/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/main.c +++ b/FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -67,177 +67,183 @@ static void prvSetupHardware( void ); * main_low_power() is used when configCREATE_LOW_POWER_DEMO is set to 1. * main_full() is used when configCREATE_LOW_POWER_DEMO is set to 0. */ -#if( configCREATE_LOW_POWER_DEMO != 0 ) - extern void main_low_power( void ); +#if ( configCREATE_LOW_POWER_DEMO != 0 ) + extern void main_low_power( void ); #else - extern void main_full( void ); + extern void main_full( void ); #endif /* #if configCREATE_LOW_POWER_DEMO == 1 */ /* Prototypes for the standard FreeRTOS callback/hook functions implemented -within this file. */ + * within this file. */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /*-----------------------------------------------------------*/ int main( void ) { - /* - * See the following link for instructions: - * https://www.FreeRTOS.org/EFM32-Giant-Gecko-Pearl-Gecko-tickless-RTOS-demo.html - */ - - /* Configure the hardware ready to run the demo. */ - prvSetupHardware(); - - /* The mainCREATE_LOW_POWER_DEMO setting is described at the top - of this file. */ - #if( configCREATE_LOW_POWER_DEMO != 0 ) - { - main_low_power(); - } - #else - { - main_full(); - } - #endif - - /* Should not get here. */ - return 0; + /* + * See the following link for instructions: + * https://www.FreeRTOS.org/EFM32-Giant-Gecko-Pearl-Gecko-tickless-RTOS-demo.html + */ + + /* Configure the hardware ready to run the demo. */ + prvSetupHardware(); + + /* The mainCREATE_LOW_POWER_DEMO setting is described at the top + * of this file. */ + #if ( configCREATE_LOW_POWER_DEMO != 0 ) + { + main_low_power(); + } + #else + { + main_full(); + } + #endif + + /* Should not get here. */ + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { -EMU_DCDCInit_TypeDef xDCDInit = EMU_DCDCINIT_STK_DEFAULT; -CMU_HFXOInit_TypeDef xHFXOInit = CMU_HFXOINIT_STK_DEFAULT; + EMU_DCDCInit_TypeDef xDCDInit = EMU_DCDCINIT_STK_DEFAULT; + CMU_HFXOInit_TypeDef xHFXOInit = CMU_HFXOINIT_STK_DEFAULT; - /* Chip errata */ - CHIP_Init(); + /* Chip errata */ + CHIP_Init(); - /* Init DCDC regulator and HFXO with kit specific parameters */ - EMU_DCDCInit( &xDCDInit ); - CMU_HFXOInit( &xHFXOInit ); + /* Init DCDC regulator and HFXO with kit specific parameters */ + EMU_DCDCInit( &xDCDInit ); + CMU_HFXOInit( &xHFXOInit ); - /* Switch HFCLK to HFXO and disable HFRCO */ - CMU_ClockSelectSet( cmuClock_HF, cmuSelect_HFXO ); - CMU_OscillatorEnable( cmuOsc_HFRCO, false, false ); + /* Switch HFCLK to HFXO and disable HFRCO */ + CMU_ClockSelectSet( cmuClock_HF, cmuSelect_HFXO ); + CMU_OscillatorEnable( cmuOsc_HFRCO, false, false ); - /* Initialize LED driver. */ - BSP_LedsInit(); - BSP_LedSet( 0 ); - BSP_LedClear( 1 ); + /* Initialize LED driver. */ + BSP_LedsInit(); + BSP_LedSet( 0 ); + BSP_LedClear( 1 ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ - - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ + + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; + ( void ) pcTaskName; + ( void ) pxTask; - /* 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. */ + /* 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. */ - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile size_t xFreeHeapSpace; - - /* This is just a trivial example of an idle hook. It is called on each - cycle of the idle task. It must *NOT* attempt to block. In this case the - idle task just queries the amount of FreeRTOS heap that remains. See the - memory management section on the http://www.FreeRTOS.org web site for memory - management options. If there is a lot of heap memory free then the - configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up - RAM. */ - xFreeHeapSpace = xPortGetFreeHeapSize(); - - /* Remove compiler warning about xFreeHeapSpace being set but never used. */ - ( void ) xFreeHeapSpace; + volatile size_t xFreeHeapSpace; + + /* This is just a trivial example of an idle hook. It is called on each + * cycle of the idle task. It must *NOT* attempt to block. In this case the + * idle task just queries the amount of FreeRTOS heap that remains. See the + * memory management section on the http://www.FreeRTOS.org web site for memory + * management options. If there is a lot of heap memory free then the + * configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up + * RAM. */ + xFreeHeapSpace = xPortGetFreeHeapSize(); + + /* Remove compiler warning about xFreeHeapSpace being set but never used. */ + ( void ) xFreeHeapSpace; } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* The full demo includes tests that run from the tick hook. */ - #if( configCREATE_LOW_POWER_DEMO == 0 ) - { - extern void vFullDemoTickHook( void ); - - /* Some of the tests and demo tasks executed by the full demo include - interaction from an interrupt - for which the tick interrupt is used - via the tick hook function. */ - vFullDemoTickHook(); - } - #endif + /* The full demo includes tests that run from the tick hook. */ + #if ( configCREATE_LOW_POWER_DEMO == 0 ) + { + extern void vFullDemoTickHook( void ); + + /* Some of the tests and demo tasks executed by the full demo include + * interaction from an interrupt - for which the tick interrupt is used + * via the tick hook function. */ + vFullDemoTickHook(); + } + #endif } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an -implementation of vApplicationGetIdleTaskMemory() to provide the memory that is -used by the Idle task. */ -void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) + * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is + * used by the Idle task. */ +void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, + StackType_t ** ppxIdleTaskStackBuffer, + uint32_t * pulIdleTaskStackSize ) { /* If the buffers to be provided to the Idle task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xIdleTaskTCB; -static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Idle task's - state will be stored. */ - *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; - - /* Pass out the array that will be used as the Idle task's stack. */ - *ppxIdleTaskStackBuffer = uxIdleTaskStack; - - /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xIdleTaskTCB; + static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Idle task's + * state will be stored. */ + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + + /* Pass out the array that will be used as the Idle task's stack. */ + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + + /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the -application must provide an implementation of vApplicationGetTimerTaskMemory() -to provide the memory that is used by the Timer service task. */ -void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) + * application must provide an implementation of vApplicationGetTimerTaskMemory() + * to provide the memory that is used by the Timer service task. */ +void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, + StackType_t ** ppxTimerTaskStackBuffer, + uint32_t * pulTimerTaskStackSize ) { /* If the buffers to be provided to the Timer task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xTimerTaskTCB; -static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Timer - task's state will be stored. */ - *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; - - /* Pass out the array that will be used as the Timer task's stack. */ - *ppxTimerTaskStackBuffer = uxTimerTaskStack; - - /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xTimerTaskTCB; + static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Timer + * task's state will be stored. */ + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + + /* Pass out the array that will be used as the Timer task's stack. */ + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + + /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } diff --git a/FreeRTOS/Demo/CORTEX_LM3S102_GCC/Demo1/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_LM3S102_GCC/Demo1/FreeRTOSConfig.h index af5a23973b8..53e2bdc88e9 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S102_GCC/Demo1/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_LM3S102_GCC/Demo1/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S102_GCC/Demo1/main.c b/FreeRTOS/Demo/CORTEX_LM3S102_GCC/Demo1/main.c index 6afe63bea2a..54815fdda22 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S102_GCC/Demo1/main.c +++ b/FreeRTOS/Demo/CORTEX_LM3S102_GCC/Demo1/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S102_GCC/Demo2/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_LM3S102_GCC/Demo2/FreeRTOSConfig.h index 61088db8a26..0383a2abc3f 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S102_GCC/Demo2/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_LM3S102_GCC/Demo2/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S102_GCC/Demo2/main.c b/FreeRTOS/Demo/CORTEX_LM3S102_GCC/Demo2/main.c index f51cc09f1d4..7cd8e26e799 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S102_GCC/Demo2/main.c +++ b/FreeRTOS/Demo/CORTEX_LM3S102_GCC/Demo2/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S102_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_LM3S102_GCC/FreeRTOSConfig.h index f40fc8b4c6a..b0fcdfa7082 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S102_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_LM3S102_GCC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S102_GCC/ParTest/ParTest.c b/FreeRTOS/Demo/CORTEX_LM3S102_GCC/ParTest/ParTest.c index d5da78b98ce..3e9d9f87067 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S102_GCC/ParTest/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_LM3S102_GCC/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S102_GCC/main.c b/FreeRTOS/Demo/CORTEX_LM3S102_GCC/main.c index 6afe63bea2a..79095decd6b 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S102_GCC/main.c +++ b/FreeRTOS/Demo/CORTEX_LM3S102_GCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -24,31 +24,31 @@ * */ -/* - * This demo application creates six co-routines and two tasks (three including +/* + * This demo application creates six co-routines and two tasks (three including * the idle task). The co-routines execute as part of the idle task hook. * - * Five of the created co-routines are the standard 'co-routine flash' - * co-routines contained within the Demo/Common/Minimal/crflash.c file and - * documented on the FreeRTOS.org WEB site. + * Five of the created co-routines are the standard 'co-routine flash' + * co-routines contained within the Demo/Common/Minimal/crflash.c file and + * documented on the FreeRTOS.org WEB site. * * The 'LCD Task' rotates a string on the LCD, delaying between each character * as necessitated by the slow interface, and delaying between each string just * long enough to enable the text to be read. * * The sixth co-routine and final task control the transmission and reception - * of a string to UART 0. The co-routine periodically sends the first + * of a string to UART 0. The co-routine periodically sends the first * character of the string to the UART, with the UART's TxEnd interrupt being - * used to transmit the remaining characters. The UART's RxEnd interrupt - * receives the characters and places them on a queue to be processed by the - * 'COMs Rx' task. An error is latched should an unexpected character be - * received, or any character be received out of sequence. + * used to transmit the remaining characters. The UART's RxEnd interrupt + * receives the characters and places them on a queue to be processed by the + * 'COMs Rx' task. An error is latched should an unexpected character be + * received, or any character be received out of sequence. * - * A loopback connector is required to ensure that each character transmitted + * A loopback connector is required to ensure that each character transmitted * on the UART is also received on the same UART. For test purposes the UART * FIFO's are not utalised in order to maximise the interrupt overhead. Also - * a pseudo random interval is used between the start of each transmission in - * order that the resultant interrupts are more randomly distributed and + * a pseudo random interval is used between the start of each transmission in + * order that the resultant interrupts are more randomly distributed and * therefore more likely to highlight any problems. * * The flash co-routines control LED's zero to four. LED five is toggled each @@ -56,12 +56,12 @@ * the string is CORRECTLY received on the UART. LED seven is latched on should * an error be detected in any task or co-routine. * - * In addition the idle task makes repetitive calls to - * prvSetAndCheckRegisters(). This simply loads the general purpose registers - * with a known value, then checks each register to ensure the held value is - * still correct. As a low priority task this checking routine is likely to - * get repeatedly swapped in and out. A register being found to contain an - * incorrect value is therefore indicative of an error in the task switching + * In addition the idle task makes repetitive calls to + * prvSetAndCheckRegisters(). This simply loads the general purpose registers + * with a known value, then checks each register to ensure the held value is + * still correct. As a low priority task this checking routine is likely to + * get repeatedly swapped in and out. A register being found to contain an + * incorrect value is therefore indicative of an error in the task switching * mechansim. * */ @@ -80,68 +80,68 @@ #include "DriverLib.h" /* The time to delay between writing each character to the LCD. */ -#define mainCHAR_WRITE_DELAY ( 2 / portTICK_PERIOD_MS ) +#define mainCHAR_WRITE_DELAY ( 2 / portTICK_PERIOD_MS ) /* The time to delay between writing each string to the LCD. */ -#define mainSTRING_WRITE_DELAY ( 400 / portTICK_PERIOD_MS ) +#define mainSTRING_WRITE_DELAY ( 400 / portTICK_PERIOD_MS ) /* The number of flash co-routines to create. */ -#define mainNUM_FLASH_CO_ROUTINES ( 5 ) +#define mainNUM_FLASH_CO_ROUTINES ( 5 ) /* The length of the queue used to pass received characters to the Comms Rx -task. */ -#define mainRX_QUEUE_LEN ( 5 ) + * task. */ +#define mainRX_QUEUE_LEN ( 5 ) -/* The priority of the co-routine used to initiate the transmission of the -string on UART 0. */ -#define mainTX_CO_ROUTINE_PRIORITY ( 1 ) +/* The priority of the co-routine used to initiate the transmission of the + * string on UART 0. */ +#define mainTX_CO_ROUTINE_PRIORITY ( 1 ) /* Only one co-routine is created so its index is not important. */ -#define mainTX_CO_ROUTINE_INDEX ( 0 ) +#define mainTX_CO_ROUTINE_INDEX ( 0 ) /* The time between transmissions of the string on UART 0. This is pseudo -random in order to generate a bit or randomness to when the interrupts occur.*/ -#define mainMIN_TX_DELAY ( 40 / portTICK_PERIOD_MS ) -#define mainMAX_TX_DELAY ( ( TickType_t ) 0x7f ) -#define mainOFFSET_TIME ( ( TickType_t ) 3 ) + * random in order to generate a bit or randomness to when the interrupts occur.*/ +#define mainMIN_TX_DELAY ( 40 / portTICK_PERIOD_MS ) +#define mainMAX_TX_DELAY ( ( TickType_t ) 0x7f ) +#define mainOFFSET_TIME ( ( TickType_t ) 3 ) /* The time the Comms Rx task should wait to receive a character. This should -be slightly longer than the time between transmissions. If we do not receive -a character after this time then there must be an error in the transmission or -the timing of the transmission. */ -#define mainCOMMS_RX_DELAY ( mainMAX_TX_DELAY + 20 ) + * be slightly longer than the time between transmissions. If we do not receive + * a character after this time then there must be an error in the transmission or + * the timing of the transmission. */ +#define mainCOMMS_RX_DELAY ( mainMAX_TX_DELAY + 20 ) /* The task priorities. */ -#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainCOMMS_RX_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainCOMMS_RX_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The LED's toggled by the various tasks. */ -#define mainCOMMS_FAIL_LED ( 7 ) -#define mainCOMMS_RX_LED ( 6 ) -#define mainCOMMS_TX_LED ( 5 ) +#define mainCOMMS_FAIL_LED ( 7 ) +#define mainCOMMS_RX_LED ( 6 ) +#define mainCOMMS_TX_LED ( 5 ) /* The baud rate used by the UART comms tasks/co-routine. */ -#define mainBAUD_RATE ( 57600 ) +#define mainBAUD_RATE ( 57600 ) /* FIFO setting for the UART. The FIFO is not used to create a better test. */ -#define mainFIFO_SET ( 0x10 ) +#define mainFIFO_SET ( 0x10 ) -/* The string that is transmitted on the UART contains sequentially the -characters from mainFIRST_TX_CHAR to mainLAST_TX_CHAR. */ -#define mainFIRST_TX_CHAR '0' -#define mainLAST_TX_CHAR 'z' +/* The string that is transmitted on the UART contains sequentially the + * characters from mainFIRST_TX_CHAR to mainLAST_TX_CHAR. */ +#define mainFIRST_TX_CHAR '0' +#define mainLAST_TX_CHAR 'z' /* Just used to walk through the program memory in order that some random data -can be generated. */ -#define mainTOTAL_PROGRAM_MEMORY ( ( unsigned long * ) ( 8 * 1024 ) ) -#define mainFIRST_PROGRAM_BYTES ( ( unsigned long * ) 4 ) + * can be generated. */ +#define mainTOTAL_PROGRAM_MEMORY ( ( unsigned long * ) ( 8 * 1024 ) ) +#define mainFIRST_PROGRAM_BYTES ( ( unsigned long * ) 4 ) /* The error routine that is called if the driver library encounters an error. */ #ifdef DEBUG -void -__error__(char *pcFilename, unsigned long ulLine) -{ -} + void __error__( char * pcFilename, + unsigned long ulLine ) + { + } #endif /*-----------------------------------------------------------*/ @@ -160,12 +160,13 @@ static void vCommsRxTask( void * pvParameters ); * The co-routine that periodically initiates the transmission of the string on * the UART. */ -static void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex ); +static void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, + unsigned portBASE_TYPE uxIndex ); -/* +/* * Writes a string the the LCD. */ -static void prvWriteString( const char *pcString ); +static void prvWriteString( const char * pcString ); /* * Initialisation routine for the UART. @@ -175,7 +176,8 @@ static void vSerialInit( void ); /* * Thread safe write to the PDC. */ -static void prvPDCWrite( char cAddress, char cData ); +static void prvPDCWrite( char cAddress, + char cData ); /* * Function to simply set a known value into the general purpose registers @@ -185,7 +187,7 @@ static void prvPDCWrite( char cAddress, char cData ); void prvSetAndCheckRegisters( void ); /* - * Latch the LED that indicates that an error has occurred. + * Latch the LED that indicates that an error has occurred. */ void vSetErrorLED( void ); @@ -197,399 +199,413 @@ static void prvSetupHardware( void ); /*-----------------------------------------------------------*/ /* Error flag set to pdFAIL if an error is encountered in the tasks/co-routines -defined within this file. */ + * defined within this file. */ unsigned portBASE_TYPE uxErrorStatus = pdPASS; /* The next character to transmit. */ static char cNextChar; /* The queue used to transmit characters from the interrupt to the Comms Rx -task. */ + * task. */ static QueueHandle_t xCommsQueue; /*-----------------------------------------------------------*/ void Main( void ) { - /* Create the queue used to communicate between the UART ISR and the Comms - Rx task. */ - xCommsQueue = xQueueCreate( mainRX_QUEUE_LEN, sizeof( char ) ); + /* Create the queue used to communicate between the UART ISR and the Comms + * Rx task. */ + xCommsQueue = xQueueCreate( mainRX_QUEUE_LEN, sizeof( char ) ); - /* Setup the ports used by the demo and the clock. */ - prvSetupHardware(); + /* Setup the ports used by the demo and the clock. */ + prvSetupHardware(); - /* Create the co-routines that flash the LED's. */ - vStartFlashCoRoutines( mainNUM_FLASH_CO_ROUTINES ); + /* Create the co-routines that flash the LED's. */ + vStartFlashCoRoutines( mainNUM_FLASH_CO_ROUTINES ); - /* Create the co-routine that initiates the transmission of characters - on the UART. */ - xCoRoutineCreate( vSerialTxCoRoutine, mainTX_CO_ROUTINE_PRIORITY, mainTX_CO_ROUTINE_INDEX ); + /* Create the co-routine that initiates the transmission of characters + * on the UART. */ + xCoRoutineCreate( vSerialTxCoRoutine, mainTX_CO_ROUTINE_PRIORITY, mainTX_CO_ROUTINE_INDEX ); - /* Create the LCD and Comms Rx tasks. */ - xTaskCreate( vLCDTask, "LCD", configMINIMAL_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL ); - xTaskCreate( vCommsRxTask, "CMS", configMINIMAL_STACK_SIZE, NULL, mainCOMMS_RX_TASK_PRIORITY, NULL ); + /* Create the LCD and Comms Rx tasks. */ + xTaskCreate( vLCDTask, "LCD", configMINIMAL_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL ); + xTaskCreate( vCommsRxTask, "CMS", configMINIMAL_STACK_SIZE, NULL, mainCOMMS_RX_TASK_PRIORITY, NULL ); - /* Start the scheduler running the tasks and co-routines just created. */ - vTaskStartScheduler(); + /* Start the scheduler running the tasks and co-routines just created. */ + vTaskStartScheduler(); - /* Should not get here unless we did not have enough memory to start the - scheduler. */ - for( ;; ); + /* Should not get here unless we did not have enough memory to start the + * scheduler. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Setup the PLL. */ - SysCtlClockSet( SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ ); + /* Setup the PLL. */ + SysCtlClockSet( SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ ); - /* Initialise the hardware used to talk to the LCD, LED's and UART. */ - PDCInit(); - vParTestInitialise(); - vSerialInit(); + /* Initialise the hardware used to talk to the LCD, LED's and UART. */ + PDCInit(); + vParTestInitialise(); + vSerialInit(); } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* The co-routines are executed in the idle task using the idle task - hook. */ - for( ;; ) - { - /* Schedule the co-routines. */ - vCoRoutineSchedule(); - - /* Run the register check function between each co-routine. */ - prvSetAndCheckRegisters(); - } + /* The co-routines are executed in the idle task using the idle task + * hook. */ + for( ; ; ) + { + /* Schedule the co-routines. */ + vCoRoutineSchedule(); + + /* Run the register check function between each co-routine. */ + prvSetAndCheckRegisters(); + } } /*-----------------------------------------------------------*/ -static void prvWriteString( const char *pcString ) +static void prvWriteString( const char * pcString ) { - /* Write pcString to the LED, pausing between each character. */ - prvPDCWrite(PDC_LCD_CSR, LCD_CLEAR); - while( *pcString ) - { - vTaskDelay( mainCHAR_WRITE_DELAY ); - prvPDCWrite( PDC_LCD_RAM, *pcString ); - pcString++; - } + /* Write pcString to the LED, pausing between each character. */ + prvPDCWrite( PDC_LCD_CSR, LCD_CLEAR ); + + while( *pcString ) + { + vTaskDelay( mainCHAR_WRITE_DELAY ); + prvPDCWrite( PDC_LCD_RAM, *pcString ); + pcString++; + } } /*-----------------------------------------------------------*/ void vLCDTask( void * pvParameters ) { -unsigned portBASE_TYPE uxIndex; -const unsigned char ucCFGData[] = { - 0x30, /* Set data bus to 8-bits. */ - 0x30, - 0x30, - 0x3C, /* Number of lines/font. */ - 0x08, /* Display off. */ - 0x01, /* Display clear. */ - 0x06, /* Entry mode [cursor dir][shift]. */ - 0x0C /* Display on [display on][curson on][blinking on]. */ - }; + unsigned portBASE_TYPE uxIndex; + const unsigned char ucCFGData[] = + { + 0x30, /* Set data bus to 8-bits. */ + 0x30, + 0x30, + 0x3C, /* Number of lines/font. */ + 0x08, /* Display off. */ + 0x01, /* Display clear. */ + 0x06, /* Entry mode [cursor dir][shift]. */ + 0x0C /* Display on [display on][curson on][blinking on]. */ + }; /* The strings that are written to the LCD. */ -const char *pcStringsToDisplay[] = { - "Stellaris", - "Demo", - "One", - "www.FreeRTOS.org", - "" - }; - - /* Configure the LCD. */ - uxIndex = 0; - while( uxIndex < sizeof( ucCFGData ) ) - { - prvPDCWrite( PDC_LCD_CSR, ucCFGData[ uxIndex ] ); - uxIndex++; - vTaskDelay( mainCHAR_WRITE_DELAY ); - } - - /* Turn the LCD Backlight on. */ - prvPDCWrite( PDC_CSR, 0x01 ); - - /* Clear display. */ - vTaskDelay( mainCHAR_WRITE_DELAY ); - prvPDCWrite( PDC_LCD_CSR, LCD_CLEAR ); - - uxIndex = 0; - for( ;; ) - { - /* Display the string on the LCD. */ - prvWriteString( pcStringsToDisplay[ uxIndex ] ); - - /* Move on to the next string - wrapping if necessary. */ - uxIndex++; - if( *( pcStringsToDisplay[ uxIndex ] ) == 0x00 ) - { - uxIndex = 0; - /* Longer pause on the last string to be sent. */ - vTaskDelay( mainSTRING_WRITE_DELAY * 2 ); - } - - /* Wait until it is time to move onto the next string. */ - vTaskDelay( mainSTRING_WRITE_DELAY ); - } + const char * pcStringsToDisplay[] = + { + "Stellaris", + "Demo", + "One", + "www.FreeRTOS.org", + "" + }; + + /* Configure the LCD. */ + uxIndex = 0; + + while( uxIndex < sizeof( ucCFGData ) ) + { + prvPDCWrite( PDC_LCD_CSR, ucCFGData[ uxIndex ] ); + uxIndex++; + vTaskDelay( mainCHAR_WRITE_DELAY ); + } + + /* Turn the LCD Backlight on. */ + prvPDCWrite( PDC_CSR, 0x01 ); + + /* Clear display. */ + vTaskDelay( mainCHAR_WRITE_DELAY ); + prvPDCWrite( PDC_LCD_CSR, LCD_CLEAR ); + + uxIndex = 0; + + for( ; ; ) + { + /* Display the string on the LCD. */ + prvWriteString( pcStringsToDisplay[ uxIndex ] ); + + /* Move on to the next string - wrapping if necessary. */ + uxIndex++; + + if( *( pcStringsToDisplay[ uxIndex ] ) == 0x00 ) + { + uxIndex = 0; + /* Longer pause on the last string to be sent. */ + vTaskDelay( mainSTRING_WRITE_DELAY * 2 ); + } + + /* Wait until it is time to move onto the next string. */ + vTaskDelay( mainSTRING_WRITE_DELAY ); + } } /*-----------------------------------------------------------*/ static void vCommsRxTask( void * pvParameters ) { -static char cRxedChar, cExpectedChar; - - /* Set the char we expect to receive to the start of the string. */ - cExpectedChar = mainFIRST_TX_CHAR; - - for( ;; ) - { - /* Wait for a character to be received. */ - xQueueReceive( xCommsQueue, ( void * ) &cRxedChar, mainCOMMS_RX_DELAY ); - - /* Was the character received (if any) the expected character. */ - if( cRxedChar != cExpectedChar ) - { - /* Got an unexpected character. This can sometimes occur when - reseting the system using the debugger leaving characters already - in the UART registers. */ - uxErrorStatus = pdFAIL; - - /* Resync by waiting for the end of the current string. */ - while( cRxedChar != mainLAST_TX_CHAR ) - { - while( !xQueueReceive( xCommsQueue, ( void * ) &cRxedChar, portMAX_DELAY ) ); - } - - /* The next expected character is the start of the string again. */ - cExpectedChar = mainFIRST_TX_CHAR; - } - else - { - if( cExpectedChar == mainLAST_TX_CHAR ) - { - /* We have reached the end of the string - we now expect to - receive the first character in the string again. The LED is - toggled to indicate that the entire string was received without - error. */ - vParTestToggleLED( mainCOMMS_RX_LED ); - cExpectedChar = mainFIRST_TX_CHAR; - } - else - { - /* We got the expected character, we now expect to receive the - next character in the string. */ - cExpectedChar++; - } - } - } + static char cRxedChar, cExpectedChar; + + /* Set the char we expect to receive to the start of the string. */ + cExpectedChar = mainFIRST_TX_CHAR; + + for( ; ; ) + { + /* Wait for a character to be received. */ + xQueueReceive( xCommsQueue, ( void * ) &cRxedChar, mainCOMMS_RX_DELAY ); + + /* Was the character received (if any) the expected character. */ + if( cRxedChar != cExpectedChar ) + { + /* Got an unexpected character. This can sometimes occur when + * reseting the system using the debugger leaving characters already + * in the UART registers. */ + uxErrorStatus = pdFAIL; + + /* Resync by waiting for the end of the current string. */ + while( cRxedChar != mainLAST_TX_CHAR ) + { + while( !xQueueReceive( xCommsQueue, ( void * ) &cRxedChar, portMAX_DELAY ) ) + { + } + } + + /* The next expected character is the start of the string again. */ + cExpectedChar = mainFIRST_TX_CHAR; + } + else + { + if( cExpectedChar == mainLAST_TX_CHAR ) + { + /* We have reached the end of the string - we now expect to + * receive the first character in the string again. The LED is + * toggled to indicate that the entire string was received without + * error. */ + vParTestToggleLED( mainCOMMS_RX_LED ); + cExpectedChar = mainFIRST_TX_CHAR; + } + else + { + /* We got the expected character, we now expect to receive the + * next character in the string. */ + cExpectedChar++; + } + } + } } /*-----------------------------------------------------------*/ -static void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex ) +static void vSerialTxCoRoutine( CoRoutineHandle_t xHandle, + unsigned portBASE_TYPE uxIndex ) { -TickType_t xDelayPeriod; -static unsigned long *pulRandomBytes = mainFIRST_PROGRAM_BYTES; - - /* Co-routine MUST start with a call to crSTART. */ - crSTART( xHandle ); - - for(;;) - { - /* Was the previously transmitted string received correctly? */ - if( uxErrorStatus != pdPASS ) - { - /* An error was encountered so set the error LED. */ - vSetErrorLED(); - } - - /* The next character to Tx is the first in the string. */ - cNextChar = mainFIRST_TX_CHAR; - - UARTIntDisable( UART0_BASE, UART_INT_TX ); - { - /* Send the first character. */ - if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) - { - HWREG( UART0_BASE + UART_O_DR ) = cNextChar; - } - - /* Move the variable to the char to Tx on so the ISR transmits - the next character in the string once this one has completed. */ - cNextChar++; - } - UARTIntEnable(UART0_BASE, UART_INT_TX); - - /* Toggle the LED to show a new string is being transmitted. */ + TickType_t xDelayPeriod; + static unsigned long * pulRandomBytes = mainFIRST_PROGRAM_BYTES; + + /* Co-routine MUST start with a call to crSTART. */ + crSTART( xHandle ); + + for( ; ; ) + { + /* Was the previously transmitted string received correctly? */ + if( uxErrorStatus != pdPASS ) + { + /* An error was encountered so set the error LED. */ + vSetErrorLED(); + } + + /* The next character to Tx is the first in the string. */ + cNextChar = mainFIRST_TX_CHAR; + + UARTIntDisable( UART0_BASE, UART_INT_TX ); + { + /* Send the first character. */ + if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) + { + HWREG( UART0_BASE + UART_O_DR ) = cNextChar; + } + + /* Move the variable to the char to Tx on so the ISR transmits + * the next character in the string once this one has completed. */ + cNextChar++; + } + UARTIntEnable( UART0_BASE, UART_INT_TX ); + + /* Toggle the LED to show a new string is being transmitted. */ vParTestToggleLED( mainCOMMS_TX_LED ); - /* Delay before we start the string off again. A pseudo-random delay - is used as this will provide a better test. */ - xDelayPeriod = xTaskGetTickCount() + ( *pulRandomBytes ); + /* Delay before we start the string off again. A pseudo-random delay + * is used as this will provide a better test. */ + xDelayPeriod = xTaskGetTickCount() + ( *pulRandomBytes ); - pulRandomBytes++; - if( pulRandomBytes > mainTOTAL_PROGRAM_MEMORY ) - { - pulRandomBytes = mainFIRST_PROGRAM_BYTES; - } + pulRandomBytes++; - /* Make sure we don't wait too long... */ - xDelayPeriod &= mainMAX_TX_DELAY; + if( pulRandomBytes > mainTOTAL_PROGRAM_MEMORY ) + { + pulRandomBytes = mainFIRST_PROGRAM_BYTES; + } - /* ...but we do want to wait. */ - if( xDelayPeriod < mainMIN_TX_DELAY ) - { - xDelayPeriod = mainMIN_TX_DELAY; - } + /* Make sure we don't wait too long... */ + xDelayPeriod &= mainMAX_TX_DELAY; - /* Block for the random(ish) time. */ - crDELAY( xHandle, xDelayPeriod ); + /* ...but we do want to wait. */ + if( xDelayPeriod < mainMIN_TX_DELAY ) + { + xDelayPeriod = mainMIN_TX_DELAY; + } + + /* Block for the random(ish) time. */ + crDELAY( xHandle, xDelayPeriod ); } - /* Co-routine MUST end with a call to crEND. */ - crEND(); + /* Co-routine MUST end with a call to crEND. */ + crEND(); } /*-----------------------------------------------------------*/ static void vSerialInit( void ) { - /* Enable the UART. GPIOA has already been initialised. */ - SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); + /* Enable the UART. GPIOA has already been initialised. */ + SysCtlPeripheralEnable( SYSCTL_PERIPH_UART0 ); - /* Set GPIO A0 and A1 as peripheral function. They are used to output the - UART signals. */ - GPIODirModeSet( GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_DIR_MODE_HW ); + /* Set GPIO A0 and A1 as peripheral function. They are used to output the + * UART signals. */ + GPIODirModeSet( GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_DIR_MODE_HW ); - /* Configure the UART for 8-N-1 operation. */ - UARTConfigSet( UART0_BASE, mainBAUD_RATE, UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE ); + /* Configure the UART for 8-N-1 operation. */ + UARTConfigSet( UART0_BASE, mainBAUD_RATE, UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE ); - /* We dont want to use the fifo. This is for test purposes to generate - as many interrupts as possible. */ - HWREG( UART0_BASE + UART_O_LCR_H ) &= ~mainFIFO_SET; + /* We dont want to use the fifo. This is for test purposes to generate + * as many interrupts as possible. */ + HWREG( UART0_BASE + UART_O_LCR_H ) &= ~mainFIFO_SET; - /* Enable both Rx and Tx interrupts. */ - HWREG( UART0_BASE + UART_O_IM ) |= ( UART_INT_TX | UART_INT_RX ); - IntEnable( INT_UART0 ); + /* Enable both Rx and Tx interrupts. */ + HWREG( UART0_BASE + UART_O_IM ) |= ( UART_INT_TX | UART_INT_RX ); + IntEnable( INT_UART0 ); } /*-----------------------------------------------------------*/ -void vUART_ISR(void) +void vUART_ISR( void ) { -unsigned long ulStatus; -char cRxedChar; -portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; - - /* What caused the interrupt. */ - ulStatus = UARTIntStatus( UART0_BASE, pdTRUE ); - - /* Clear the interrupt. */ - UARTIntClear( UART0_BASE, ulStatus ); - - /* Was an Rx interrupt pending? */ - if( ulStatus & UART_INT_RX ) - { - if( ( HWREG(UART0_BASE + UART_O_FR ) & UART_FR_RXFF ) ) - { - /* Get the char from the buffer and post it onto the queue of - Rxed chars. Posting the character should wake the task that is - blocked on the queue waiting for characters. */ - cRxedChar = ( char ) HWREG( UART0_BASE + UART_O_DR ); - xQueueSendFromISR( xCommsQueue, &cRxedChar, &xHigherPriorityTaskWoken ); - } - } - - /* Was a Tx interrupt pending? */ - if( ulStatus & UART_INT_TX ) - { - /* Send the next character in the string. We are not using the FIFO. */ - if( cNextChar <= mainLAST_TX_CHAR ) - { - if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) - { - HWREG( UART0_BASE + UART_O_DR ) = cNextChar; - } - cNextChar++; - } - } - - /* If a task was woken by the character being received then we force - a context switch to occur in case the task is of higher priority than - the currently executing task (i.e. the task that this interrupt - interrupted.) */ - portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); + unsigned long ulStatus; + char cRxedChar; + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + + /* What caused the interrupt. */ + ulStatus = UARTIntStatus( UART0_BASE, pdTRUE ); + + /* Clear the interrupt. */ + UARTIntClear( UART0_BASE, ulStatus ); + + /* Was an Rx interrupt pending? */ + if( ulStatus & UART_INT_RX ) + { + if( ( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_RXFF ) ) + { + /* Get the char from the buffer and post it onto the queue of + * Rxed chars. Posting the character should wake the task that is + * blocked on the queue waiting for characters. */ + cRxedChar = ( char ) HWREG( UART0_BASE + UART_O_DR ); + xQueueSendFromISR( xCommsQueue, &cRxedChar, &xHigherPriorityTaskWoken ); + } + } + + /* Was a Tx interrupt pending? */ + if( ulStatus & UART_INT_TX ) + { + /* Send the next character in the string. We are not using the FIFO. */ + if( cNextChar <= mainLAST_TX_CHAR ) + { + if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) + { + HWREG( UART0_BASE + UART_O_DR ) = cNextChar; + } + + cNextChar++; + } + } + + /* If a task was woken by the character being received then we force + * a context switch to occur in case the task is of higher priority than + * the currently executing task (i.e. the task that this interrupt + * interrupted.) */ + portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); } /*-----------------------------------------------------------*/ -static void prvPDCWrite( char cAddress, char cData ) +static void prvPDCWrite( char cAddress, + char cData ) { - vTaskSuspendAll(); - { - PDCWrite( cAddress, cData ); - } - xTaskResumeAll(); + vTaskSuspendAll(); + { + PDCWrite( cAddress, cData ); + } + xTaskResumeAll(); } /*-----------------------------------------------------------*/ void vSetErrorLED( void ) { - vParTestSetLED( mainCOMMS_FAIL_LED, pdTRUE ); + vParTestSetLED( mainCOMMS_FAIL_LED, pdTRUE ); } /*-----------------------------------------------------------*/ void prvSetAndCheckRegisters( void ) { - /* Fill the general purpose registers with known values. */ - __asm volatile( " mov r11, #10\n" - " add r0, r11, #1\n" - " add r1, r11, #2\n" - " add r2, r11, #3\n" - " add r3, r11, #4\n" - " add r4, r11, #5\n" - " add r5, r11, #6\n" - " add r6, r11, #7\n" - " add r7, r11, #8\n" - " add r8, r11, #9\n" - " add r9, r11, #10\n" - " add r10, r11, #11\n" - " add r12, r11, #12" ); - - /* Check the values are as expected. */ - __asm volatile( " cmp r11, #10\n" - " bne set_error_led\n" - " cmp r0, #11\n" - " bne set_error_led\n" - " cmp r1, #12\n" - " bne set_error_led\n" - " cmp r2, #13\n" - " bne set_error_led\n" - " cmp r3, #14\n" - " bne set_error_led\n" - " cmp r4, #15\n" - " bne set_error_led\n" - " cmp r5, #16\n" - " bne set_error_led\n" - " cmp r6, #17\n" - " bne set_error_led\n" - " cmp r7, #18\n" - " bne set_error_led\n" - " cmp r8, #19\n" - " bne set_error_led\n" - " cmp r9, #20\n" - " bne set_error_led\n" - " cmp r10, #21\n" - " bne set_error_led\n" - " cmp r12, #22\n" - " bne set_error_led\n" - " bx lr" ); - - __asm volatile( "set_error_led:\n" - " push {r14}\n" - " ldr r1, =vSetErrorLED\n" - " blx r1\n" - " pop {r14}\n" - " bx lr" ); + /* Fill the general purpose registers with known values. */ + __asm volatile ( " mov r11, #10\n" + " add r0, r11, #1\n" + " add r1, r11, #2\n" + " add r2, r11, #3\n" + " add r3, r11, #4\n" + " add r4, r11, #5\n" + " add r5, r11, #6\n" + " add r6, r11, #7\n" + " add r7, r11, #8\n" + " add r8, r11, #9\n" + " add r9, r11, #10\n" + " add r10, r11, #11\n" + " add r12, r11, #12" ); + + /* Check the values are as expected. */ + __asm volatile ( " cmp r11, #10\n" + " bne set_error_led\n" + " cmp r0, #11\n" + " bne set_error_led\n" + " cmp r1, #12\n" + " bne set_error_led\n" + " cmp r2, #13\n" + " bne set_error_led\n" + " cmp r3, #14\n" + " bne set_error_led\n" + " cmp r4, #15\n" + " bne set_error_led\n" + " cmp r5, #16\n" + " bne set_error_led\n" + " cmp r6, #17\n" + " bne set_error_led\n" + " cmp r7, #18\n" + " bne set_error_led\n" + " cmp r8, #19\n" + " bne set_error_led\n" + " cmp r9, #20\n" + " bne set_error_led\n" + " cmp r10, #21\n" + " bne set_error_led\n" + " cmp r12, #22\n" + " bne set_error_led\n" + " bx lr" ); + + __asm volatile ( "set_error_led:\n" + " push {r14}\n" + " ldr r1, =vSetErrorLED\n" + " blx r1\n" + " pop {r14}\n" + " bx lr" ); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo1/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo1/FreeRTOSConfig.h index f40fc8b4c6a..b0fcdfa7082 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo1/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo1/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo1/ParTest.c b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo1/ParTest.c index d5da78b98ce..3e9d9f87067 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo1/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo1/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo1/main.c b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo1/main.c index a2396ef463e..7cd2f38888a 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo1/main.c +++ b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo1/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo2/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo2/FreeRTOSConfig.h index 2e47fc415a6..a11b7bc853e 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo2/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo2/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo2/ParTest.c b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo2/ParTest.c index d5da78b98ce..3e9d9f87067 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo2/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo2/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo2/main.c b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo2/main.c index 57964efbd2d..5eda934131d 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo2/main.c +++ b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo2/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo3/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo3/FreeRTOSConfig.h index 03625393592..20af123ec8e 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo3/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo3/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo3/ParTest.c b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo3/ParTest.c index 0a9c463029c..480e35f7c46 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo3/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo3/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo3/main.c b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo3/main.c index e962859e177..f83f82b783e 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo3/main.c +++ b/FreeRTOS/Demo/CORTEX_LM3S102_Rowley/Demo3/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S316_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_LM3S316_IAR/FreeRTOSConfig.h index d072f6355a3..feb90263231 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S316_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_LM3S316_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S316_IAR/ParTest/ParTest.c b/FreeRTOS/Demo/CORTEX_LM3S316_IAR/ParTest/ParTest.c index d5da78b98ce..3e9d9f87067 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S316_IAR/ParTest/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_LM3S316_IAR/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S316_IAR/commstest.c b/FreeRTOS/Demo/CORTEX_LM3S316_IAR/commstest.c index 8642c37437b..6a19353684e 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S316_IAR/commstest.c +++ b/FreeRTOS/Demo/CORTEX_LM3S316_IAR/commstest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S316_IAR/commstest.h b/FreeRTOS/Demo/CORTEX_LM3S316_IAR/commstest.h index da5ed000ec0..112bf83b693 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S316_IAR/commstest.h +++ b/FreeRTOS/Demo/CORTEX_LM3S316_IAR/commstest.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S316_IAR/main.c b/FreeRTOS/Demo/CORTEX_LM3S316_IAR/main.c index 548bfa4e0ee..18540370e42 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S316_IAR/main.c +++ b/FreeRTOS/Demo/CORTEX_LM3S316_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -24,15 +24,15 @@ * */ -/* - * This demo application creates eight co-routines and four tasks (five - * including the idle task). The co-routines execute as part of the idle task +/* + * This demo application creates eight co-routines and four tasks (five + * including the idle task). The co-routines execute as part of the idle task * hook. The application is limited in size to allow its compilation using * the KickStart version of the IAR compiler. * - * Six of the created co-routines are the standard 'co-routine flash' - * co-routines contained within the Demo/Common/Minimal/crflash.c file and - * documented on the FreeRTOS.org WEB site. + * Six of the created co-routines are the standard 'co-routine flash' + * co-routines contained within the Demo/Common/Minimal/crflash.c file and + * documented on the FreeRTOS.org WEB site. * * The 'LCD Task' waits on a message queue for messages informing it what and * where to display text. This is the only task that accesses the LCD @@ -45,34 +45,34 @@ * The 'ADC Co-routine' periodically reads the ADC input that is connected to * the light sensor, forms a short message from the value, and then sends this * message to the LCD Task using the same message queue. The ADC readings are - * displayed on the bottom row of the LCD. + * displayed on the bottom row of the LCD. * * The eighth co-routine and final task control the transmission and reception - * of a string to UART 0. The co-routine periodically sends the first + * of a string to UART 0. The co-routine periodically sends the first * character of the string to the UART, with the UART's TxEnd interrupt being - * used to transmit the remaining characters. The UART's RxEnd interrupt - * receives the characters and places them on a queue to be processed by the - * 'COMs Rx' task. An error is latched should an unexpected character be - * received, or any character be received out of sequence. + * used to transmit the remaining characters. The UART's RxEnd interrupt + * receives the characters and places them on a queue to be processed by the + * 'COMs Rx' task. An error is latched should an unexpected character be + * received, or any character be received out of sequence. * - * A loopback connector is required to ensure that each character transmitted + * A loopback connector is required to ensure that each character transmitted * on the UART is also received on the same UART. For test purposes the UART * FIFO's are not utalised in order to maximise the interrupt overhead. Also - * a pseudo random interval is used between the start of each transmission in - * order that the resultant interrupts are more randomly distributed and + * a pseudo random interval is used between the start of each transmission in + * order that the resultant interrupts are more randomly distributed and * therefore more likely to highlight any problems. * * The flash co-routines control LED's zero to four. LED five is toggled each * time the string is transmitted on the UART. LED six is toggled each time - * the string is CORRECTLY received on the UART. LED seven is latched on + * the string is CORRECTLY received on the UART. LED seven is latched on * should an error be detected in any task or co-routine. * - * In addition the idle task makes repetitive calls to - * vSetAndCheckRegisters(). This simply loads the general purpose registers - * with a known value, then checks each register to ensure the held value is - * still correct. As a low priority task this checking routine is likely to - * get repeatedly swapped in and out. A register being found to contain an - * incorrect value is therefore indicative of an error in the task switching + * In addition the idle task makes repetitive calls to + * vSetAndCheckRegisters(). This simply loads the general purpose registers + * with a known value, then checks each register to ensure the held value is + * still correct. As a low priority task this checking routine is likely to + * get repeatedly swapped in and out. A register being found to contain an + * incorrect value is therefore indicative of an error in the task switching * mechanism. * */ @@ -95,43 +95,43 @@ #include "DriverLib.h" /* The time to delay between writing each character to the LCD. */ -#define mainCHAR_WRITE_DELAY ( 2 / portTICK_PERIOD_MS ) +#define mainCHAR_WRITE_DELAY ( 2 / portTICK_PERIOD_MS ) /* The time to delay between writing each string to the LCD. */ -#define mainSTRING_WRITE_DELAY ( 400 / portTICK_PERIOD_MS ) +#define mainSTRING_WRITE_DELAY ( 400 / portTICK_PERIOD_MS ) -#define mainADC_DELAY ( 200 / portTICK_PERIOD_MS ) +#define mainADC_DELAY ( 200 / portTICK_PERIOD_MS ) /* The number of flash co-routines to create. */ -#define mainNUM_FLASH_CO_ROUTINES ( 5 ) +#define mainNUM_FLASH_CO_ROUTINES ( 5 ) /* The length of the queue used to send messages to the LCD task. */ -#define mainLCD_QUEUE_LEN ( 3 ) +#define mainLCD_QUEUE_LEN ( 3 ) -/* The priority of the co-routine used to initiate the transmission of the -string on UART 0. */ -#define mainTX_CO_ROUTINE_PRIORITY ( 1 ) -#define mainADC_CO_ROUTINE_PRIORITY ( 2 ) +/* The priority of the co-routine used to initiate the transmission of the + * string on UART 0. */ +#define mainTX_CO_ROUTINE_PRIORITY ( 1 ) +#define mainADC_CO_ROUTINE_PRIORITY ( 2 ) /* Only one of each co-routine is created so its index is not important. */ -#define mainTX_CO_ROUTINE_INDEX ( 0 ) -#define mainADC_CO_ROUTINE_INDEX ( 0 ) +#define mainTX_CO_ROUTINE_INDEX ( 0 ) +#define mainADC_CO_ROUTINE_INDEX ( 0 ) /* The task priorities. */ -#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainMSG_TASK_PRIORITY ( mainLCD_TASK_PRIORITY - 1 ) -#define mainCOMMS_RX_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainMSG_TASK_PRIORITY ( mainLCD_TASK_PRIORITY - 1 ) +#define mainCOMMS_RX_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The LCD had two rows. */ -#define mainTOP_ROW 0 -#define mainBOTTOM_ROW 1 +#define mainTOP_ROW 0 +#define mainBOTTOM_ROW 1 /* Dimension for the buffer into which the ADC value string is written. */ -#define mainMAX_ADC_STRING_LEN 20 +#define mainMAX_ADC_STRING_LEN 20 /* The LED that is lit should an error be detected in any of the tasks or -co-routines. */ -#define mainFAIL_LED ( 7 ) + * co-routines. */ +#define mainFAIL_LED ( 7 ) /*-----------------------------------------------------------*/ @@ -149,7 +149,8 @@ static void prvLCDMessageTask( void * pvParameters ); * The co-routine that reads the ADC and sends messages for display on the * bottom row of the LCD. */ -static void prvADCCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex ); +static void prvADCCoRoutine( CoRoutineHandle_t xHandle, + unsigned portBASE_TYPE uxIndex ); /* * Function to simply set a known value into the general purpose registers @@ -159,14 +160,15 @@ static void prvADCCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE u extern void vSetAndCheckRegisters( void ); /* - * Latch the LED that indicates that an error has occurred. + * Latch the LED that indicates that an error has occurred. */ void vSetErrorLED( void ); /* * Thread safe write to the PDC. */ -static void prvPDCWrite( char cAddress, char cData ); +static void prvPDCWrite( char cAddress, + char cData ); /* * Sets up the hardware used by the demo. @@ -179,12 +181,12 @@ static void prvSetupHardware( void ); /* The structure that is passed on the LCD message queue. */ typedef struct { - char **ppcMessageToDisplay; /*<< Points to a char* pointing to the message to display. */ - portBASE_TYPE xRow; /*<< The row on which the message should be displayed. */ + char ** ppcMessageToDisplay; /*<< Points to a char* pointing to the message to display. */ + portBASE_TYPE xRow; /*<< The row on which the message should be displayed. */ } xLCDMessage; /* Error flag set to pdFAIL if an error is encountered in the tasks/co-routines -defined within this file. */ + * defined within this file. */ unsigned portBASE_TYPE uxErrorStatus = pdPASS; /* The queue used to transmit messages to the LCD task. */ @@ -197,242 +199,250 @@ static QueueHandle_t xLCDQueue; */ void main( void ) { - /* Create the queue used by tasks wanting to write to the LCD. */ - xLCDQueue = xQueueCreate( mainLCD_QUEUE_LEN, sizeof( xLCDMessage ) ); - - /* Setup the ports used by the demo and the clock. */ - prvSetupHardware(); - - /* Create the co-routines that flash the LED's. */ - vStartFlashCoRoutines( mainNUM_FLASH_CO_ROUTINES ); - - /* Create the co-routine that initiates the transmission of characters - on the UART and the task that receives them, as described at the top of - this file. */ - xCoRoutineCreate( vSerialTxCoRoutine, mainTX_CO_ROUTINE_PRIORITY, mainTX_CO_ROUTINE_INDEX ); - xTaskCreate( vCommsRxTask, "CMS", configMINIMAL_STACK_SIZE, NULL, mainCOMMS_RX_TASK_PRIORITY, NULL ); - - /* Create the task that waits for messages to display on the LCD, plus the - task and co-routine that send messages for display (as described at the top - of this file. */ - xTaskCreate( prvLCDTask, "LCD", configMINIMAL_STACK_SIZE, ( void * ) &xLCDQueue, mainLCD_TASK_PRIORITY, NULL ); - xTaskCreate( prvLCDMessageTask, "MSG", configMINIMAL_STACK_SIZE, ( void * ) &xLCDQueue, mainMSG_TASK_PRIORITY, NULL ); - xCoRoutineCreate( prvADCCoRoutine, mainADC_CO_ROUTINE_PRIORITY, mainADC_CO_ROUTINE_INDEX ); - - /* Start the scheduler running the tasks and co-routines just created. */ - vTaskStartScheduler(); - - /* Should not get here unless we did not have enough memory to start the - scheduler. */ - for( ;; ); + /* Create the queue used by tasks wanting to write to the LCD. */ + xLCDQueue = xQueueCreate( mainLCD_QUEUE_LEN, sizeof( xLCDMessage ) ); + + /* Setup the ports used by the demo and the clock. */ + prvSetupHardware(); + + /* Create the co-routines that flash the LED's. */ + vStartFlashCoRoutines( mainNUM_FLASH_CO_ROUTINES ); + + /* Create the co-routine that initiates the transmission of characters + * on the UART and the task that receives them, as described at the top of + * this file. */ + xCoRoutineCreate( vSerialTxCoRoutine, mainTX_CO_ROUTINE_PRIORITY, mainTX_CO_ROUTINE_INDEX ); + xTaskCreate( vCommsRxTask, "CMS", configMINIMAL_STACK_SIZE, NULL, mainCOMMS_RX_TASK_PRIORITY, NULL ); + + /* Create the task that waits for messages to display on the LCD, plus the + * task and co-routine that send messages for display (as described at the top + * of this file. */ + xTaskCreate( prvLCDTask, "LCD", configMINIMAL_STACK_SIZE, ( void * ) &xLCDQueue, mainLCD_TASK_PRIORITY, NULL ); + xTaskCreate( prvLCDMessageTask, "MSG", configMINIMAL_STACK_SIZE, ( void * ) &xLCDQueue, mainMSG_TASK_PRIORITY, NULL ); + xCoRoutineCreate( prvADCCoRoutine, mainADC_CO_ROUTINE_PRIORITY, mainADC_CO_ROUTINE_INDEX ); + + /* Start the scheduler running the tasks and co-routines just created. */ + vTaskStartScheduler(); + + /* Should not get here unless we did not have enough memory to start the + * scheduler. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ static void prvLCDMessageTask( void * pvParameters ) { /* The strings that are written to the LCD. */ -char *pcStringsToDisplay[] = { - "IAR ", - "Stellaris ", - "Demo ", - "www.FreeRTOS.org", - "" - }; - -QueueHandle_t *pxLCDQueue; -xLCDMessage xMessageToSend; -portBASE_TYPE xIndex = 0; - - /* To test the parameter passing mechanism, the queue on which messages are - posted is passed in as a parameter even though it is available as a file - scope variable anyway. */ - pxLCDQueue = ( QueueHandle_t * ) pvParameters; - - for( ;; ) - { - /* Wait until it is time to move onto the next string. */ - vTaskDelay( mainSTRING_WRITE_DELAY ); - - /* Create the message object to send to the LCD task. */ - xMessageToSend.ppcMessageToDisplay = &pcStringsToDisplay[ xIndex ]; - xMessageToSend.xRow = mainTOP_ROW; - - /* Post the message to be displayed. */ - if( !xQueueSend( *pxLCDQueue, ( void * ) &xMessageToSend, 0 ) ) - { - uxErrorStatus = pdFAIL; - } - - /* Move onto the next message, wrapping when necessary. */ - xIndex++; - if( *( pcStringsToDisplay[ xIndex ] ) == 0x00 ) - { - xIndex = 0; - - /* Delay longer before going back to the start of the messages. */ - vTaskDelay( mainSTRING_WRITE_DELAY * 2 ); - } - } + char * pcStringsToDisplay[] = + { + "IAR ", + "Stellaris ", + "Demo ", + "www.FreeRTOS.org", + "" + }; + + QueueHandle_t * pxLCDQueue; + xLCDMessage xMessageToSend; + portBASE_TYPE xIndex = 0; + + /* To test the parameter passing mechanism, the queue on which messages are + * posted is passed in as a parameter even though it is available as a file + * scope variable anyway. */ + pxLCDQueue = ( QueueHandle_t * ) pvParameters; + + for( ; ; ) + { + /* Wait until it is time to move onto the next string. */ + vTaskDelay( mainSTRING_WRITE_DELAY ); + + /* Create the message object to send to the LCD task. */ + xMessageToSend.ppcMessageToDisplay = &pcStringsToDisplay[ xIndex ]; + xMessageToSend.xRow = mainTOP_ROW; + + /* Post the message to be displayed. */ + if( !xQueueSend( *pxLCDQueue, ( void * ) &xMessageToSend, 0 ) ) + { + uxErrorStatus = pdFAIL; + } + + /* Move onto the next message, wrapping when necessary. */ + xIndex++; + + if( *( pcStringsToDisplay[ xIndex ] ) == 0x00 ) + { + xIndex = 0; + + /* Delay longer before going back to the start of the messages. */ + vTaskDelay( mainSTRING_WRITE_DELAY * 2 ); + } + } } /*-----------------------------------------------------------*/ void prvLCDTask( void * pvParameters ) { -unsigned portBASE_TYPE uxIndex; -QueueHandle_t *pxLCDQueue; -xLCDMessage xReceivedMessage; -char *pcString; -const unsigned char ucCFGData[] = { - 0x30, /* Set data bus to 8-bits. */ - 0x30, - 0x30, - 0x3C, /* Number of lines/font. */ - 0x08, /* Display off. */ - 0x01, /* Display clear. */ - 0x06, /* Entry mode [cursor dir][shift]. */ - 0x0C /* Display on [display on][curson on][blinking on]. */ - }; - - /* To test the parameter passing mechanism, the queue on which messages are - received is passed in as a parameter even though it is available as a file - scope variable anyway. */ - pxLCDQueue = ( QueueHandle_t * ) pvParameters; - - /* Configure the LCD. */ - uxIndex = 0; - while( uxIndex < sizeof( ucCFGData ) ) - { - prvPDCWrite( PDC_LCD_CSR, ucCFGData[ uxIndex ] ); - uxIndex++; - vTaskDelay( mainCHAR_WRITE_DELAY ); - } - - /* Turn the LCD Backlight on. */ - prvPDCWrite( PDC_CSR, 0x01 ); - - /* Clear display. */ - vTaskDelay( mainCHAR_WRITE_DELAY ); - prvPDCWrite( PDC_LCD_CSR, LCD_CLEAR ); - - uxIndex = 0; - for( ;; ) - { - /* Wait for a message to arrive. */ - if( xQueueReceive( *pxLCDQueue, &xReceivedMessage, portMAX_DELAY ) ) - { - /* Which row does the received message say to write to? */ - PDCLCDSetPos( 0, xReceivedMessage.xRow ); - - /* Where is the string we are going to display? */ - pcString = *xReceivedMessage.ppcMessageToDisplay; - - while( *pcString ) - { - /* Don't write out the string too quickly as LCD's are usually - pretty slow devices. */ - vTaskDelay( mainCHAR_WRITE_DELAY ); - prvPDCWrite( PDC_LCD_RAM, *pcString ); - pcString++; - } - } - } + unsigned portBASE_TYPE uxIndex; + QueueHandle_t * pxLCDQueue; + xLCDMessage xReceivedMessage; + char * pcString; + const unsigned char ucCFGData[] = + { + 0x30, /* Set data bus to 8-bits. */ + 0x30, + 0x30, + 0x3C, /* Number of lines/font. */ + 0x08, /* Display off. */ + 0x01, /* Display clear. */ + 0x06, /* Entry mode [cursor dir][shift]. */ + 0x0C /* Display on [display on][curson on][blinking on]. */ + }; + + /* To test the parameter passing mechanism, the queue on which messages are + * received is passed in as a parameter even though it is available as a file + * scope variable anyway. */ + pxLCDQueue = ( QueueHandle_t * ) pvParameters; + + /* Configure the LCD. */ + uxIndex = 0; + + while( uxIndex < sizeof( ucCFGData ) ) + { + prvPDCWrite( PDC_LCD_CSR, ucCFGData[ uxIndex ] ); + uxIndex++; + vTaskDelay( mainCHAR_WRITE_DELAY ); + } + + /* Turn the LCD Backlight on. */ + prvPDCWrite( PDC_CSR, 0x01 ); + + /* Clear display. */ + vTaskDelay( mainCHAR_WRITE_DELAY ); + prvPDCWrite( PDC_LCD_CSR, LCD_CLEAR ); + + uxIndex = 0; + + for( ; ; ) + { + /* Wait for a message to arrive. */ + if( xQueueReceive( *pxLCDQueue, &xReceivedMessage, portMAX_DELAY ) ) + { + /* Which row does the received message say to write to? */ + PDCLCDSetPos( 0, xReceivedMessage.xRow ); + + /* Where is the string we are going to display? */ + pcString = *xReceivedMessage.ppcMessageToDisplay; + + while( *pcString ) + { + /* Don't write out the string too quickly as LCD's are usually + * pretty slow devices. */ + vTaskDelay( mainCHAR_WRITE_DELAY ); + prvPDCWrite( PDC_LCD_RAM, *pcString ); + pcString++; + } + } + } } /*-----------------------------------------------------------*/ -static void prvADCCoRoutine( CoRoutineHandle_t xHandle, unsigned portBASE_TYPE uxIndex ) +static void prvADCCoRoutine( CoRoutineHandle_t xHandle, + unsigned portBASE_TYPE uxIndex ) { -static unsigned long ulADCValue; -static char cMessageBuffer[ mainMAX_ADC_STRING_LEN ]; -static char *pcMessage; -static xLCDMessage xMessageToSend; - - /* Co-routines MUST start with a call to crSTART(). */ - crSTART( xHandle ); - - for( ;; ) - { - /* Start an ADC conversion. */ - ADCProcessorTrigger( ADC_BASE, 0 ); - - /* Simply delay - when we unblock the result should be available */ - crDELAY( xHandle, mainADC_DELAY ); - - /* Get the ADC result. */ - ADCSequenceDataGet( ADC_BASE, 0, &ulADCValue ); - - /* Create a string with the result. */ - sprintf( cMessageBuffer, "ADC = %d ", ulADCValue ); - pcMessage = cMessageBuffer; - - /* Configure the message we are going to send for display. */ - xMessageToSend.ppcMessageToDisplay = ( char** ) &pcMessage; - xMessageToSend.xRow = mainBOTTOM_ROW; - - /* Send the string to the LCD task for display. We are sending - on a task queue so do not have the option to block. */ - if( !xQueueSend( xLCDQueue, ( void * ) &xMessageToSend, 0 ) ) - { - uxErrorStatus = pdFAIL; - } - } - - /* Co-routines MUST end with a call to crEND(). */ - crEND(); + static unsigned long ulADCValue; + static char cMessageBuffer[ mainMAX_ADC_STRING_LEN ]; + static char * pcMessage; + static xLCDMessage xMessageToSend; + + /* Co-routines MUST start with a call to crSTART(). */ + crSTART( xHandle ); + + for( ; ; ) + { + /* Start an ADC conversion. */ + ADCProcessorTrigger( ADC_BASE, 0 ); + + /* Simply delay - when we unblock the result should be available */ + crDELAY( xHandle, mainADC_DELAY ); + + /* Get the ADC result. */ + ADCSequenceDataGet( ADC_BASE, 0, &ulADCValue ); + + /* Create a string with the result. */ + sprintf( cMessageBuffer, "ADC = %d ", ulADCValue ); + pcMessage = cMessageBuffer; + + /* Configure the message we are going to send for display. */ + xMessageToSend.ppcMessageToDisplay = ( char ** ) &pcMessage; + xMessageToSend.xRow = mainBOTTOM_ROW; + + /* Send the string to the LCD task for display. We are sending + * on a task queue so do not have the option to block. */ + if( !xQueueSend( xLCDQueue, ( void * ) &xMessageToSend, 0 ) ) + { + uxErrorStatus = pdFAIL; + } + } + + /* Co-routines MUST end with a call to crEND(). */ + crEND(); } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Setup the PLL. */ - SysCtlClockSet( SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ ); - - /* Initialise the hardware used to talk to the LCD, LED's and UART. */ - PDCInit(); - vParTestInitialise(); - vSerialInit(); - - /* The ADC is used to read the light sensor. */ - SysCtlPeripheralEnable( SYSCTL_PERIPH_ADC ); - ADCSequenceConfigure( ADC_BASE, 3, ADC_TRIGGER_PROCESSOR, 0); + /* Setup the PLL. */ + SysCtlClockSet( SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ ); + + /* Initialise the hardware used to talk to the LCD, LED's and UART. */ + PDCInit(); + vParTestInitialise(); + vSerialInit(); + + /* The ADC is used to read the light sensor. */ + SysCtlPeripheralEnable( SYSCTL_PERIPH_ADC ); + ADCSequenceConfigure( ADC_BASE, 3, ADC_TRIGGER_PROCESSOR, 0 ); ADCSequenceStepConfigure( ADC_BASE, 0, 0, ADC_CTL_CH0 | ADC_CTL_END ); ADCSequenceEnable( ADC_BASE, 0 ); - } /*-----------------------------------------------------------*/ -static void prvPDCWrite( char cAddress, char cData ) +static void prvPDCWrite( char cAddress, + char cData ) { - vTaskSuspendAll(); - { - PDCWrite( cAddress, cData ); - } - xTaskResumeAll(); + vTaskSuspendAll(); + { + PDCWrite( cAddress, cData ); + } + xTaskResumeAll(); } /*-----------------------------------------------------------*/ void vSetErrorLED( void ) { - vParTestSetLED( mainFAIL_LED, pdTRUE ); + vParTestSetLED( mainFAIL_LED, pdTRUE ); } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* The co-routines are executed in the idle task using the idle task - hook. */ - for( ;; ) - { - /* Schedule the co-routines. */ - vCoRoutineSchedule(); - - /* Run the register check function between each co-routine. */ - vSetAndCheckRegisters(); - - /* See if the comms task and co-routine has found any errors. */ - if( uxGetCommsStatus() != pdPASS ) - { - vParTestSetLED( mainFAIL_LED, pdTRUE ); - } - } + /* The co-routines are executed in the idle task using the idle task + * hook. */ + for( ; ; ) + { + /* Schedule the co-routines. */ + vCoRoutineSchedule(); + + /* Run the register check function between each co-routine. */ + vSetAndCheckRegisters(); + + /* See if the comms task and co-routine has found any errors. */ + if( uxGetCommsStatus() != pdPASS ) + { + vParTestSetLED( mainFAIL_LED, pdTRUE ); + } + } } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/FreeRTOSConfig.h index 94dc2edb1c9..ab1923b6c60 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/LocalDemoFiles/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/LocalDemoFiles/IntQueueTimer.c index 879de40e1f6..a410a401d9f 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/LocalDemoFiles/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/LocalDemoFiles/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/LocalDemoFiles/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/LocalDemoFiles/IntQueueTimer.h index 8b6b382c6dd..17320c8902f 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/LocalDemoFiles/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/LocalDemoFiles/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/LocalDemoFiles/timertest.c b/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/LocalDemoFiles/timertest.c index e2aa5f26082..bc756b01299 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/LocalDemoFiles/timertest.c +++ b/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/LocalDemoFiles/timertest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/main.c b/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/main.c index 5d79c25e139..0ad6eb0684b 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/main.c +++ b/FreeRTOS/Demo/CORTEX_LM3S6965_GCC_QEMU/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -49,10 +49,10 @@ * "qemu-system-arm -machine lm3s6965evb -s -S -kernel [pat_to]\RTOSDemo.elf" * * To enable FreeRTOS+Trace: - * 1) Add #include "trcRecorder.h" to the bottom of FreeRTOSConfig.h. - * 2) Call vTraceEnable( TRC_START ); at the top of main. - * 3) Ensure the "FreeRTOS+Trace Recorder" folder in the Project Explorer - * window is not excluded from the build. + * 1) Add #include "trcRecorder.h" to the bottom of FreeRTOSConfig.h. + * 2) Call vTraceEnable( TRC_START ); at the top of main. + * 3) Ensure the "FreeRTOS+Trace Recorder" folder in the Project Explorer + * window is not excluded from the build. * * To retrieve the trace files: * 1) Use the Memory windows in the Debug perspective to dump RAM from the @@ -60,10 +60,10 @@ */ /************************************************************************* - * Please ensure to read http://www.freertos.org/portlm3sx965.html - * which provides information on configuring and running this demo for the - * various Luminary Micro EKs. - *************************************************************************/ +* Please ensure to read http://www.freertos.org/portlm3sx965.html +* which provides information on configuring and running this demo for the +* various Luminary Micro EKs. +*************************************************************************/ /* Standard includes. */ #include @@ -101,37 +101,37 @@ /*-----------------------------------------------------------*/ /* The time between cycles of the 'check' functionality (defined within the -tick hook. */ -#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) + * tick hook. */ +#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) /* Task stack sizes. */ -#define mainOLED_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE + 40 ) -#define mainMESSAGE_BUFFER_TASKS_STACK_SIZE ( 100 ) +#define mainOLED_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE + 40 ) +#define mainMESSAGE_BUFFER_TASKS_STACK_SIZE ( 100 ) /* Task priorities. */ -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) /* The maximum number of message that can be waiting for display at any one -time. */ -#define mainOLED_QUEUE_SIZE ( 3 ) + * time. */ +#define mainOLED_QUEUE_SIZE ( 3 ) /* Dimensions the buffer into which the jitter time is written. */ -#define mainMAX_MSG_LEN 25 +#define mainMAX_MSG_LEN 25 /* The period of the system clock in nano seconds. This is used to calculate -the jitter time in nano seconds. */ -#define mainNS_PER_CLOCK ( ( uint32_t ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) ) + * the jitter time in nano seconds. */ +#define mainNS_PER_CLOCK ( ( uint32_t ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) ) /* Constants used when writing strings to the display. */ -#define mainCHARACTER_HEIGHT ( 9 ) -#define mainMAX_ROWS_128 ( mainCHARACTER_HEIGHT * 14 ) -#define mainMAX_ROWS_96 ( mainCHARACTER_HEIGHT * 10 ) -#define mainMAX_ROWS_64 ( mainCHARACTER_HEIGHT * 7 ) -#define mainFULL_SCALE ( 15 ) -#define ulSSI_FREQUENCY ( 3500000UL ) +#define mainCHARACTER_HEIGHT ( 9 ) +#define mainMAX_ROWS_128 ( mainCHARACTER_HEIGHT * 14 ) +#define mainMAX_ROWS_96 ( mainCHARACTER_HEIGHT * 10 ) +#define mainMAX_ROWS_64 ( mainCHARACTER_HEIGHT * 7 ) +#define mainFULL_SCALE ( 15 ) +#define ulSSI_FREQUENCY ( 3500000UL ) /*-----------------------------------------------------------*/ @@ -141,7 +141,7 @@ the jitter time in nano seconds. */ * access the display directly. Other tasks wanting to display a message send * the message to the gatekeeper. */ -static void prvOLEDTask( void *pvParameters ); +static void prvOLEDTask( void * pvParameters ); /* * Configure the hardware for the demo. @@ -157,7 +157,8 @@ extern void vSetupHighFrequencyTimer( void ); /* * Hook functions that can get called by the kernel. */ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /* @@ -176,294 +177,315 @@ const char * const pcWelcomeMessage = " www.FreeRTOS.org"; /*-----------------------------------------------------------*/ /************************************************************************* - * Please ensure to read http://www.freertos.org/portlm3sx965.html - * which provides information on configuring and running this demo for the - * various Luminary Micro EKs. - *************************************************************************/ +* Please ensure to read http://www.freertos.org/portlm3sx965.html +* which provides information on configuring and running this demo for the +* various Luminary Micro EKs. +*************************************************************************/ int main( void ) { - /* Initialise the trace recorder. Use of the trace recorder is optional. - See http://www.FreeRTOS.org/trace for more information and the comments at - the top of this file regarding enabling trace in this demo. - vTraceEnable( TRC_START ); */ - - prvSetupHardware(); - - /* Create the queue used by the OLED task. Messages for display on the OLED - are received via this queue. */ - xOLEDQueue = xQueueCreate( mainOLED_QUEUE_SIZE, sizeof( char * ) ); - - /* Start the standard demo tasks. */ - vStartRecursiveMutexTasks(); - vCreateBlockTimeTasks(); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartQueuePeekTasks(); - vStartQueueSetTasks(); - vStartEventGroupTasks(); - vStartMessageBufferTasks( mainMESSAGE_BUFFER_TASKS_STACK_SIZE ); - vStartStreamBufferTasks(); - - /* Start the tasks defined within this file/specific to this demo. */ - xTaskCreate( prvOLEDTask, "OLED", mainOLED_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - - /* The suicide tasks must be created last as they need to know how many - tasks were running prior to their creation in order to ascertain whether - or not the correct/expected number of tasks are running at any given time. */ - vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - - /* Uncomment the following line to configure the high frequency interrupt - used to measure the interrupt jitter time. - vSetupHighFrequencyTimer(); */ - - /* Start the scheduler. */ - vTaskStartScheduler(); - - /* Will only get here if there was insufficient memory to create the idle - task. */ - for( ;; ); + /* Initialise the trace recorder. Use of the trace recorder is optional. + * See http://www.FreeRTOS.org/trace for more information and the comments at + * the top of this file regarding enabling trace in this demo. + * vTraceEnable( TRC_START ); */ + + prvSetupHardware(); + + /* Create the queue used by the OLED task. Messages for display on the OLED + * are received via this queue. */ + xOLEDQueue = xQueueCreate( mainOLED_QUEUE_SIZE, sizeof( char * ) ); + + /* Start the standard demo tasks. */ + vStartRecursiveMutexTasks(); + vCreateBlockTimeTasks(); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartQueuePeekTasks(); + vStartQueueSetTasks(); + vStartEventGroupTasks(); + vStartMessageBufferTasks( mainMESSAGE_BUFFER_TASKS_STACK_SIZE ); + vStartStreamBufferTasks(); + + /* Start the tasks defined within this file/specific to this demo. */ + xTaskCreate( prvOLEDTask, "OLED", mainOLED_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + + /* The suicide tasks must be created last as they need to know how many + * tasks were running prior to their creation in order to ascertain whether + * or not the correct/expected number of tasks are running at any given time. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + + /* Uncomment the following line to configure the high frequency interrupt + * used to measure the interrupt jitter time. + * vSetupHighFrequencyTimer(); */ + + /* Start the scheduler. */ + vTaskStartScheduler(); + + /* Will only get here if there was insufficient memory to create the idle + * task. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void prvSetupHardware( void ) { /* If running on Rev A2 silicon, turn the LDO voltage up to 2.75V. This is - a workaround to allow the PLL to operate reliably. */ + * a workaround to allow the PLL to operate reliably. */ if( DEVICE_IS_REVA2 ) { SysCtlLDOSet( SYSCTL_LDO_2_75V ); } - /* Set the clocking to run from the PLL at 50 MHz */ - SysCtlClockSet( SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ ); + /* Set the clocking to run from the PLL at 50 MHz */ + SysCtlClockSet( SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ ); - /* Initialise the UART - QEMU usage does not seem to require this - initialisation. */ - SysCtlPeripheralEnable( SYSCTL_PERIPH_UART0 ); - UARTEnable( UART0_BASE ); + /* Initialise the UART - QEMU usage does not seem to require this + * initialisation. */ + SysCtlPeripheralEnable( SYSCTL_PERIPH_UART0 ); + UARTEnable( UART0_BASE ); } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { -static const char * pcMessage = "PASS"; -static uint32_t ulTicksSinceLastDisplay = 0; -BaseType_t xHigherPriorityTaskWoken = pdFALSE; - - /* Called from every tick interrupt. Have enough ticks passed to make it - time to perform our health status check again? */ - ulTicksSinceLastDisplay++; - if( ulTicksSinceLastDisplay >= mainCHECK_DELAY ) - { - ulTicksSinceLastDisplay = 0; - - /* Has an error been found in any task? */ - if( xAreStreamBufferTasksStillRunning() != pdTRUE ) - { - pcMessage = "ERROR IN STRM"; - } - else if( xAreMessageBufferTasksStillRunning() != pdTRUE ) - { - pcMessage = "ERROR IN MSG"; - } - else if( xIsCreateTaskStillRunning() != pdTRUE ) - { - pcMessage = "ERROR IN CREATE"; - } - else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - pcMessage = "ERROR IN BLOCK TIME"; - } - else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - pcMessage = "ERROR IN SEMAPHORE"; - } - else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) - { - pcMessage = "ERROR IN PEEK Q"; - } - else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - pcMessage = "ERROR IN REC MUTEX"; - } - else if( xAreQueueSetTasksStillRunning() != pdPASS ) - { - pcMessage = "ERROR IN Q SET"; - } - else if( xAreEventGroupTasksStillRunning() != pdTRUE ) - { - pcMessage = "ERROR IN EVNT GRP"; - } - - /* Send the message to the OLED gatekeeper for display. */ - xHigherPriorityTaskWoken = pdFALSE; - xQueueSendFromISR( xOLEDQueue, &pcMessage, &xHigherPriorityTaskWoken ); - } - - /* Write to a queue that is in use as part of the queue set demo to - demonstrate using queue sets from an ISR. */ - vQueueSetAccessQueueSetFromISR(); - - /* Call the event group ISR tests. */ - vPeriodicEventGroupsProcessing(); - - /* Exercise stream buffers from interrupts. */ - vPeriodicStreamBufferProcessing(); + static const char * pcMessage = "PASS"; + static uint32_t ulTicksSinceLastDisplay = 0; + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + + /* Called from every tick interrupt. Have enough ticks passed to make it + * time to perform our health status check again? */ + ulTicksSinceLastDisplay++; + + if( ulTicksSinceLastDisplay >= mainCHECK_DELAY ) + { + ulTicksSinceLastDisplay = 0; + + /* Has an error been found in any task? */ + if( xAreStreamBufferTasksStillRunning() != pdTRUE ) + { + pcMessage = "ERROR IN STRM"; + } + else if( xAreMessageBufferTasksStillRunning() != pdTRUE ) + { + pcMessage = "ERROR IN MSG"; + } + else if( xIsCreateTaskStillRunning() != pdTRUE ) + { + pcMessage = "ERROR IN CREATE"; + } + else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + pcMessage = "ERROR IN BLOCK TIME"; + } + else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + pcMessage = "ERROR IN SEMAPHORE"; + } + else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) + { + pcMessage = "ERROR IN PEEK Q"; + } + else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + pcMessage = "ERROR IN REC MUTEX"; + } + else if( xAreQueueSetTasksStillRunning() != pdPASS ) + { + pcMessage = "ERROR IN Q SET"; + } + else if( xAreEventGroupTasksStillRunning() != pdTRUE ) + { + pcMessage = "ERROR IN EVNT GRP"; + } + + /* Send the message to the OLED gatekeeper for display. */ + xHigherPriorityTaskWoken = pdFALSE; + xQueueSendFromISR( xOLEDQueue, &pcMessage, &xHigherPriorityTaskWoken ); + } + + /* Write to a queue that is in use as part of the queue set demo to + * demonstrate using queue sets from an ISR. */ + vQueueSetAccessQueueSetFromISR(); + + /* Call the event group ISR tests. */ + vPeriodicEventGroupsProcessing(); + + /* Exercise stream buffers from interrupts. */ + vPeriodicStreamBufferProcessing(); } /*-----------------------------------------------------------*/ static void prvPrintString( const char * pcString ) { - while( *pcString != 0x00 ) - { - UARTCharPut( UART0_BASE, *pcString ); - pcString++; - } + while( *pcString != 0x00 ) + { + UARTCharPut( UART0_BASE, *pcString ); + pcString++; + } } /*-----------------------------------------------------------*/ -void prvOLEDTask( void *pvParameters ) +void prvOLEDTask( void * pvParameters ) { -const char *pcMessage; -uint32_t ulY, ulMaxY; -static char cMessage[ mainMAX_MSG_LEN ]; -const unsigned char *pucImage; + const char * pcMessage; + uint32_t ulY, ulMaxY; + static char cMessage[ mainMAX_MSG_LEN ]; + const unsigned char * pucImage; /* Functions to access the OLED. The one used depends on the dev kit -being used. */ -void ( *vOLEDInit )( uint32_t ) = NULL; -void ( *vOLEDStringDraw )( const char *, uint32_t, uint32_t, unsigned char ) = NULL; -void ( *vOLEDImageDraw )( const unsigned char *, uint32_t, uint32_t, uint32_t, uint32_t ) = NULL; -void ( *vOLEDClear )( void ) = NULL; - - /* Prevent warnings about unused parameters. */ - ( void ) pvParameters; - - /* Map the OLED access functions to the driver functions that are appropriate - for the evaluation kit being used. */ - configASSERT( ( HWREG( SYSCTL_DID1 ) & SYSCTL_DID1_PRTNO_MASK ) == SYSCTL_DID1_PRTNO_6965 ); - vOLEDInit = OSRAM128x64x4Init; - vOLEDStringDraw = OSRAM128x64x4StringDraw; - vOLEDImageDraw = OSRAM128x64x4ImageDraw; - vOLEDClear = OSRAM128x64x4Clear; - ulMaxY = mainMAX_ROWS_64; - pucImage = pucBasicBitmap; - ulY = ulMaxY; - - /* Initialise the OLED and display a startup message. */ - vOLEDInit( ulSSI_FREQUENCY ); - vOLEDStringDraw( "POWERED BY FreeRTOS", 0, 0, mainFULL_SCALE ); - vOLEDImageDraw( pucImage, 0, mainCHARACTER_HEIGHT + 1, bmpBITMAP_WIDTH, bmpBITMAP_HEIGHT ); - - for( ;; ) - { - /* Wait for a message to arrive that requires displaying. */ - xQueueReceive( xOLEDQueue, &pcMessage, portMAX_DELAY ); - - /* Write the message on the next available row. */ - ulY += mainCHARACTER_HEIGHT; - if( ulY >= ulMaxY ) - { - ulY = mainCHARACTER_HEIGHT; - vOLEDClear(); - vOLEDStringDraw( pcWelcomeMessage, 0, 0, mainFULL_SCALE ); - } - - /* Display the message along with the maximum jitter time from the - high priority time test. */ - sprintf( cMessage, "%s %u", pcMessage, ( unsigned int ) xTaskGetTickCount() ); - vOLEDStringDraw( cMessage, 0, ulY, mainFULL_SCALE ); - prvPrintString( cMessage ); - prvPrintString( "\r\n" ); - } + * being used. */ + void ( * vOLEDInit )( uint32_t ) = NULL; + void ( * vOLEDStringDraw )( const char *, + uint32_t, + uint32_t, + unsigned char ) = NULL; + void ( * vOLEDImageDraw )( const unsigned char *, + uint32_t, + uint32_t, + uint32_t, + uint32_t ) = NULL; + void ( * vOLEDClear )( void ) = NULL; + + /* Prevent warnings about unused parameters. */ + ( void ) pvParameters; + + /* Map the OLED access functions to the driver functions that are appropriate + * for the evaluation kit being used. */ + configASSERT( ( HWREG( SYSCTL_DID1 ) & SYSCTL_DID1_PRTNO_MASK ) == SYSCTL_DID1_PRTNO_6965 ); + vOLEDInit = OSRAM128x64x4Init; + vOLEDStringDraw = OSRAM128x64x4StringDraw; + vOLEDImageDraw = OSRAM128x64x4ImageDraw; + vOLEDClear = OSRAM128x64x4Clear; + ulMaxY = mainMAX_ROWS_64; + pucImage = pucBasicBitmap; + ulY = ulMaxY; + + /* Initialise the OLED and display a startup message. */ + vOLEDInit( ulSSI_FREQUENCY ); + vOLEDStringDraw( "POWERED BY FreeRTOS", 0, 0, mainFULL_SCALE ); + vOLEDImageDraw( pucImage, 0, mainCHARACTER_HEIGHT + 1, bmpBITMAP_WIDTH, bmpBITMAP_HEIGHT ); + + for( ; ; ) + { + /* Wait for a message to arrive that requires displaying. */ + xQueueReceive( xOLEDQueue, &pcMessage, portMAX_DELAY ); + + /* Write the message on the next available row. */ + ulY += mainCHARACTER_HEIGHT; + + if( ulY >= ulMaxY ) + { + ulY = mainCHARACTER_HEIGHT; + vOLEDClear(); + vOLEDStringDraw( pcWelcomeMessage, 0, 0, mainFULL_SCALE ); + } + + /* Display the message along with the maximum jitter time from the + * high priority time test. */ + sprintf( cMessage, "%s %u", pcMessage, ( unsigned int ) xTaskGetTickCount() ); + vOLEDStringDraw( cMessage, 0, ulY, mainFULL_SCALE ); + prvPrintString( cMessage ); + prvPrintString( "\r\n" ); + } } /*-----------------------------------------------------------*/ -volatile char *pcOverflowedTask = NULL; /* Prevent task name being optimised away. */ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +volatile char * pcOverflowedTask = NULL; /* Prevent task name being optimised away. */ +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pxTask; - pcOverflowedTask = pcTaskName; - vAssertCalled( __FILE__, __LINE__ ); - for( ;; ); + ( void ) pxTask; + pcOverflowedTask = pcTaskName; + vAssertCalled( __FILE__, __LINE__ ); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -void vAssertCalled( const char *pcFile, uint32_t ulLine ) +void vAssertCalled( const char * pcFile, + uint32_t ulLine ) { -volatile uint32_t ulSetTo1InDebuggerToExit = 0; - - taskENTER_CRITICAL(); - { - while( ulSetTo1InDebuggerToExit == 0 ) - { - /* Nothing to do here. Set the loop variable to a non zero value in - the debugger to step out of this function to the point that caused - the assertion. */ - ( void ) pcFile; - ( void ) ulLine; - } - } - taskEXIT_CRITICAL(); + volatile uint32_t ulSetTo1InDebuggerToExit = 0; + + taskENTER_CRITICAL(); + { + while( ulSetTo1InDebuggerToExit == 0 ) + { + /* Nothing to do here. Set the loop variable to a non zero value in + * the debugger to step out of this function to the point that caused + * the assertion. */ + ( void ) pcFile; + ( void ) ulLine; + } + } + taskEXIT_CRITICAL(); } /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an -implementation of vApplicationGetIdleTaskMemory() to provide the memory that is -used by the Idle task. */ -void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) + * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is + * used by the Idle task. */ +void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, + StackType_t ** ppxIdleTaskStackBuffer, + uint32_t * pulIdleTaskStackSize ) { /* If the buffers to be provided to the Idle task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xIdleTaskTCB; -static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Idle task's - state will be stored. */ - *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; - - /* Pass out the array that will be used as the Idle task's stack. */ - *ppxIdleTaskStackBuffer = uxIdleTaskStack; - - /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xIdleTaskTCB; + static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Idle task's + * state will be stored. */ + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + + /* Pass out the array that will be used as the Idle task's stack. */ + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + + /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the -application must provide an implementation of vApplicationGetTimerTaskMemory() -to provide the memory that is used by the Timer service task. */ -void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) + * application must provide an implementation of vApplicationGetTimerTaskMemory() + * to provide the memory that is used by the Timer service task. */ +void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, + StackType_t ** ppxTimerTaskStackBuffer, + uint32_t * pulTimerTaskStackSize ) { /* If the buffers to be provided to the Timer task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xTimerTaskTCB; -static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Timer - task's state will be stored. */ - *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; - - /* Pass out the array that will be used as the Timer task's stack. */ - *ppxTimerTaskStackBuffer = uxTimerTaskStack; - - /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xTimerTaskTCB; + static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Timer + * task's state will be stored. */ + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + + /* Pass out the array that will be used as the Timer task's stack. */ + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + + /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } /*-----------------------------------------------------------*/ -char * _sbrk_r (struct _reent *r, int incr) +char * _sbrk_r( struct _reent * r, + int incr ) { - /* Just to keep the linker quiet. */ - ( void ) r; - ( void ) incr; + /* Just to keep the linker quiet. */ + ( void ) r; + ( void ) incr; - /* Check this function is never called by forcing an assert() if it is. */ - configASSERT( incr == -1 ); + /* Check this function is never called by forcing an assert() if it is. */ + configASSERT( incr == -1 ); - return NULL; + return NULL; } diff --git a/FreeRTOS/Demo/CORTEX_LM3S811_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_LM3S811_GCC/FreeRTOSConfig.h index 51a78debfb4..e8fb43c297a 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S811_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_LM3S811_GCC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S811_GCC/main.c b/FreeRTOS/Demo/CORTEX_LM3S811_GCC/main.c index c0e29d0ff7b..530dd4b5d71 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S811_GCC/main.c +++ b/FreeRTOS/Demo/CORTEX_LM3S811_GCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -80,26 +80,27 @@ #include "BlockQ.h" /* Delay between cycles of the 'check' task. */ -#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) +#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) /* UART configuration - note this does not use the FIFO so is not very -efficient. */ -#define mainBAUD_RATE ( 19200 ) -#define mainFIFO_SET ( 0x10 ) + * efficient. */ +#define mainBAUD_RATE ( 19200 ) +#define mainFIFO_SET ( 0x10 ) /* Demo task priorities. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* Demo board specifics. */ -#define mainPUSH_BUTTON GPIO_PIN_4 +#define mainPUSH_BUTTON GPIO_PIN_4 /* Misc. */ -#define mainQUEUE_SIZE ( 3 ) -#define mainDEBOUNCE_DELAY ( ( TickType_t ) 150 / portTICK_PERIOD_MS ) -#define mainNO_DELAY ( ( TickType_t ) 0 ) +#define mainQUEUE_SIZE ( 3 ) +#define mainDEBOUNCE_DELAY ( ( TickType_t ) 150 / portTICK_PERIOD_MS ) +#define mainNO_DELAY ( ( TickType_t ) 0 ) + /* * Configure the processor and peripherals for this demo. */ @@ -108,25 +109,25 @@ static void prvSetupHardware( void ); /* * The 'check' task, as described at the top of this file. */ -static void vCheckTask( void *pvParameters ); +static void vCheckTask( void * pvParameters ); /* * The task that is woken by the ISR that processes GPIO interrupts originating * from the push button. */ -static void vButtonHandlerTask( void *pvParameters ); +static void vButtonHandlerTask( void * pvParameters ); /* * The task that controls access to the LCD. */ -static void vPrintTask( void *pvParameter ); +static void vPrintTask( void * pvParameter ); /* String that is transmitted on the UART. */ -static char *cMessage = "Task woken by button interrupt! --- "; -static volatile char *pcNextChar; +static char * cMessage = "Task woken by button interrupt! --- "; +static volatile char * pcNextChar; /* The semaphore used to wake the button handler task from within the GPIO -interrupt handler. */ + * interrupt handler. */ SemaphoreHandle_t xButtonSemaphore; /* The queue used to send strings to the print task for display on the LCD. */ @@ -136,224 +137,226 @@ QueueHandle_t xPrintQueue; int main( void ) { - /* Configure the clocks, UART and GPIO. */ - prvSetupHardware(); + /* Configure the clocks, UART and GPIO. */ + prvSetupHardware(); - /* Create the semaphore used to wake the button handler task from the GPIO - ISR. */ - vSemaphoreCreateBinary( xButtonSemaphore ); - xSemaphoreTake( xButtonSemaphore, 0 ); + /* Create the semaphore used to wake the button handler task from the GPIO + * ISR. */ + vSemaphoreCreateBinary( xButtonSemaphore ); + xSemaphoreTake( xButtonSemaphore, 0 ); - /* Create the queue used to pass message to vPrintTask. */ - xPrintQueue = xQueueCreate( mainQUEUE_SIZE, sizeof( char * ) ); + /* Create the queue used to pass message to vPrintTask. */ + xPrintQueue = xQueueCreate( mainQUEUE_SIZE, sizeof( char * ) ); - /* Start the standard demo tasks. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + /* Start the standard demo tasks. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - /* Start the tasks defined within the file. */ - xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - xTaskCreate( vButtonHandlerTask, "Status", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY + 1, NULL ); - xTaskCreate( vPrintTask, "Print", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL ); + /* Start the tasks defined within the file. */ + xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + xTaskCreate( vButtonHandlerTask, "Status", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY + 1, NULL ); + xTaskCreate( vPrintTask, "Print", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL ); - /* Start the scheduler. */ - vTaskStartScheduler(); + /* Start the scheduler. */ + vTaskStartScheduler(); - /* Will only get here if there was insufficient heap to start the - scheduler. */ + /* Will only get here if there was insufficient heap to start the + * scheduler. */ - return 0; + return 0; } /*-----------------------------------------------------------*/ -static void vCheckTask( void *pvParameters ) +static void vCheckTask( void * pvParameters ) { -portBASE_TYPE xErrorOccurred = pdFALSE; -TickType_t xLastExecutionTime; -const char *pcPassMessage = "PASS"; -const char *pcFailMessage = "FAIL"; - - /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() - works correctly. */ - xLastExecutionTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Perform this check every mainCHECK_DELAY milliseconds. */ - vTaskDelayUntil( &xLastExecutionTime, mainCHECK_DELAY ); - - /* Has an error been found in any task? */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - /* Send either a pass or fail message. If an error is found it is - never cleared again. We do not write directly to the LCD, but instead - queue a message for display by the print task. */ - if( xErrorOccurred == pdTRUE ) - { - xQueueSend( xPrintQueue, &pcFailMessage, portMAX_DELAY ); - } - else - { - xQueueSend( xPrintQueue, &pcPassMessage, portMAX_DELAY ); - } - } + portBASE_TYPE xErrorOccurred = pdFALSE; + TickType_t xLastExecutionTime; + const char * pcPassMessage = "PASS"; + const char * pcFailMessage = "FAIL"; + + /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() + * works correctly. */ + xLastExecutionTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Perform this check every mainCHECK_DELAY milliseconds. */ + vTaskDelayUntil( &xLastExecutionTime, mainCHECK_DELAY ); + + /* Has an error been found in any task? */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + /* Send either a pass or fail message. If an error is found it is + * never cleared again. We do not write directly to the LCD, but instead + * queue a message for display by the print task. */ + if( xErrorOccurred == pdTRUE ) + { + xQueueSend( xPrintQueue, &pcFailMessage, portMAX_DELAY ); + } + else + { + xQueueSend( xPrintQueue, &pcPassMessage, portMAX_DELAY ); + } + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Setup the PLL. */ - SysCtlClockSet( SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ ); + /* Setup the PLL. */ + SysCtlClockSet( SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ ); - /* Setup the push button. */ - SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC); - GPIODirModeSet(GPIO_PORTC_BASE, mainPUSH_BUTTON, GPIO_DIR_MODE_IN); - GPIOIntTypeSet( GPIO_PORTC_BASE, mainPUSH_BUTTON,GPIO_FALLING_EDGE ); - IntPrioritySet( INT_GPIOC, configKERNEL_INTERRUPT_PRIORITY ); - GPIOPinIntEnable( GPIO_PORTC_BASE, mainPUSH_BUTTON ); - IntEnable( INT_GPIOC ); + /* Setup the push button. */ + SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOC ); + GPIODirModeSet( GPIO_PORTC_BASE, mainPUSH_BUTTON, GPIO_DIR_MODE_IN ); + GPIOIntTypeSet( GPIO_PORTC_BASE, mainPUSH_BUTTON, GPIO_FALLING_EDGE ); + IntPrioritySet( INT_GPIOC, configKERNEL_INTERRUPT_PRIORITY ); + GPIOPinIntEnable( GPIO_PORTC_BASE, mainPUSH_BUTTON ); + IntEnable( INT_GPIOC ); - /* Enable the UART. */ - SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); - SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + /* Enable the UART. */ + SysCtlPeripheralEnable( SYSCTL_PERIPH_UART0 ); + SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOA ); - /* Set GPIO A0 and A1 as peripheral function. They are used to output the - UART signals. */ - GPIODirModeSet( GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_DIR_MODE_HW ); + /* Set GPIO A0 and A1 as peripheral function. They are used to output the + * UART signals. */ + GPIODirModeSet( GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_DIR_MODE_HW ); - /* Configure the UART for 8-N-1 operation. */ - UARTConfigSet( UART0_BASE, mainBAUD_RATE, UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE ); + /* Configure the UART for 8-N-1 operation. */ + UARTConfigSet( UART0_BASE, mainBAUD_RATE, UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE ); - /* We don't want to use the fifo. This is for test purposes to generate - as many interrupts as possible. */ - HWREG( UART0_BASE + UART_O_LCR_H ) &= ~mainFIFO_SET; + /* We don't want to use the fifo. This is for test purposes to generate + * as many interrupts as possible. */ + HWREG( UART0_BASE + UART_O_LCR_H ) &= ~mainFIFO_SET; - /* Enable Tx interrupts. */ - HWREG( UART0_BASE + UART_O_IM ) |= UART_INT_TX; - IntPrioritySet( INT_UART0, configKERNEL_INTERRUPT_PRIORITY ); - IntEnable( INT_UART0 ); + /* Enable Tx interrupts. */ + HWREG( UART0_BASE + UART_O_IM ) |= UART_INT_TX; + IntPrioritySet( INT_UART0, configKERNEL_INTERRUPT_PRIORITY ); + IntEnable( INT_UART0 ); - /* Initialise the LCD> */ + /* Initialise the LCD> */ OSRAMInit( false ); - OSRAMStringDraw("www.FreeRTOS.org", 0, 0); - OSRAMStringDraw("LM3S811 demo", 16, 1); + OSRAMStringDraw( "www.FreeRTOS.org", 0, 0 ); + OSRAMStringDraw( "LM3S811 demo", 16, 1 ); } /*-----------------------------------------------------------*/ -static void vButtonHandlerTask( void *pvParameters ) +static void vButtonHandlerTask( void * pvParameters ) { -const char *pcInterruptMessage = "Int"; - - for( ;; ) - { - /* Wait for a GPIO interrupt to wake this task. */ - while( xSemaphoreTake( xButtonSemaphore, portMAX_DELAY ) != pdPASS ); - - /* Start the Tx of the message on the UART. */ - UARTIntDisable( UART0_BASE, UART_INT_TX ); - { - pcNextChar = cMessage; - - /* Send the first character. */ - if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) - { - HWREG( UART0_BASE + UART_O_DR ) = *pcNextChar; - } - - pcNextChar++; - } - UARTIntEnable(UART0_BASE, UART_INT_TX); - - /* Queue a message for the print task to display on the LCD. */ - xQueueSend( xPrintQueue, &pcInterruptMessage, portMAX_DELAY ); - - /* Make sure we don't process bounces. */ - vTaskDelay( mainDEBOUNCE_DELAY ); - xSemaphoreTake( xButtonSemaphore, mainNO_DELAY ); - } + const char * pcInterruptMessage = "Int"; + + for( ; ; ) + { + /* Wait for a GPIO interrupt to wake this task. */ + while( xSemaphoreTake( xButtonSemaphore, portMAX_DELAY ) != pdPASS ) + { + } + + /* Start the Tx of the message on the UART. */ + UARTIntDisable( UART0_BASE, UART_INT_TX ); + { + pcNextChar = cMessage; + + /* Send the first character. */ + if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) + { + HWREG( UART0_BASE + UART_O_DR ) = *pcNextChar; + } + + pcNextChar++; + } + UARTIntEnable( UART0_BASE, UART_INT_TX ); + + /* Queue a message for the print task to display on the LCD. */ + xQueueSend( xPrintQueue, &pcInterruptMessage, portMAX_DELAY ); + + /* Make sure we don't process bounces. */ + vTaskDelay( mainDEBOUNCE_DELAY ); + xSemaphoreTake( xButtonSemaphore, mainNO_DELAY ); + } } /*-----------------------------------------------------------*/ -void vUART_ISR(void) +void vUART_ISR( void ) { -unsigned long ulStatus; - - /* What caused the interrupt. */ - ulStatus = UARTIntStatus( UART0_BASE, pdTRUE ); - - /* Clear the interrupt. */ - UARTIntClear( UART0_BASE, ulStatus ); - - /* Was a Tx interrupt pending? */ - if( ulStatus & UART_INT_TX ) - { - /* Send the next character in the string. We are not using the FIFO. */ - if( *pcNextChar != 0 ) - { - if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) - { - HWREG( UART0_BASE + UART_O_DR ) = *pcNextChar; - } - pcNextChar++; - } - } + unsigned long ulStatus; + + /* What caused the interrupt. */ + ulStatus = UARTIntStatus( UART0_BASE, pdTRUE ); + + /* Clear the interrupt. */ + UARTIntClear( UART0_BASE, ulStatus ); + + /* Was a Tx interrupt pending? */ + if( ulStatus & UART_INT_TX ) + { + /* Send the next character in the string. We are not using the FIFO. */ + if( *pcNextChar != 0 ) + { + if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) + { + HWREG( UART0_BASE + UART_O_DR ) = *pcNextChar; + } + + pcNextChar++; + } + } } /*-----------------------------------------------------------*/ void vGPIO_ISR( void ) { -portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; - /* Clear the interrupt. */ - GPIOPinIntClear(GPIO_PORTC_BASE, mainPUSH_BUTTON); + /* Clear the interrupt. */ + GPIOPinIntClear( GPIO_PORTC_BASE, mainPUSH_BUTTON ); - /* Wake the button handler task. */ - xSemaphoreGiveFromISR( xButtonSemaphore, &xHigherPriorityTaskWoken ); + /* Wake the button handler task. */ + xSemaphoreGiveFromISR( xButtonSemaphore, &xHigherPriorityTaskWoken ); - portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); + portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); } /*-----------------------------------------------------------*/ -static void vPrintTask( void *pvParameters ) +static void vPrintTask( void * pvParameters ) { -char *pcMessage; -unsigned portBASE_TYPE uxLine = 0, uxRow = 0; - - for( ;; ) - { - /* Wait for a message to arrive. */ - xQueueReceive( xPrintQueue, &pcMessage, portMAX_DELAY ); - - /* Write the message to the LCD. */ - uxRow++; - uxLine++; - OSRAMClear(); - OSRAMStringDraw( pcMessage, uxLine & 0x3f, uxRow & 0x01); - } + char * pcMessage; + unsigned portBASE_TYPE uxLine = 0, uxRow = 0; + + for( ; ; ) + { + /* Wait for a message to arrive. */ + xQueueReceive( xPrintQueue, &pcMessage, portMAX_DELAY ); + + /* Write the message to the LCD. */ + uxRow++; + uxLine++; + OSRAMClear(); + OSRAMStringDraw( pcMessage, uxLine & 0x3f, uxRow & 0x01 ); + } } - diff --git a/FreeRTOS/Demo/CORTEX_LM3S811_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_LM3S811_IAR/FreeRTOSConfig.h index 3b70ce5063b..4b65e3c2291 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S811_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_LM3S811_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S811_IAR/main.c b/FreeRTOS/Demo/CORTEX_LM3S811_IAR/main.c index 21d881556f5..73f89ceee6f 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S811_IAR/main.c +++ b/FreeRTOS/Demo/CORTEX_LM3S811_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -80,26 +80,27 @@ #include "BlockQ.h" /* Delay between cycles of the 'check' task. */ -#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) +#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) /* UART configuration - note this does not use the FIFO so is not very -efficient. */ -#define mainBAUD_RATE ( 19200 ) -#define mainFIFO_SET ( 0x10 ) + * efficient. */ +#define mainBAUD_RATE ( 19200 ) +#define mainFIFO_SET ( 0x10 ) /* Demo task priorities. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* Demo board specifics. */ -#define mainPUSH_BUTTON GPIO_PIN_4 +#define mainPUSH_BUTTON GPIO_PIN_4 /* Misc. */ -#define mainQUEUE_SIZE ( 3 ) -#define mainDEBOUNCE_DELAY ( ( TickType_t ) 150 / portTICK_PERIOD_MS ) -#define mainNO_DELAY ( ( TickType_t ) 0 ) +#define mainQUEUE_SIZE ( 3 ) +#define mainDEBOUNCE_DELAY ( ( TickType_t ) 150 / portTICK_PERIOD_MS ) +#define mainNO_DELAY ( ( TickType_t ) 0 ) + /* * Configure the processor and peripherals for this demo. */ @@ -108,25 +109,25 @@ static void prvSetupHardware( void ); /* * The 'check' task, as described at the top of this file. */ -static void vCheckTask( void *pvParameters ); +static void vCheckTask( void * pvParameters ); /* * The task that is woken by the ISR that processes GPIO interrupts originating * from the push button. */ -static void vButtonHandlerTask( void *pvParameters ); +static void vButtonHandlerTask( void * pvParameters ); /* * The task that controls access to the LCD. */ -static void vPrintTask( void *pvParameter ); +static void vPrintTask( void * pvParameter ); /* String that is transmitted on the UART. */ -static char *cMessage = "Task woken by button interrupt! --- "; -static volatile char *pcNextChar; +static char * cMessage = "Task woken by button interrupt! --- "; +static volatile char * pcNextChar; /* The semaphore used to wake the button handler task from within the GPIO -interrupt handler. */ + * interrupt handler. */ SemaphoreHandle_t xButtonSemaphore; /* The queue used to send strings to the print task for display on the LCD. */ @@ -136,223 +137,225 @@ QueueHandle_t xPrintQueue; int main( void ) { - /* Configure the clocks, UART and GPIO. */ - prvSetupHardware(); + /* Configure the clocks, UART and GPIO. */ + prvSetupHardware(); - /* Create the semaphore used to wake the button handler task from the GPIO - ISR. */ - vSemaphoreCreateBinary( xButtonSemaphore ); - xSemaphoreTake( xButtonSemaphore, 0 ); + /* Create the semaphore used to wake the button handler task from the GPIO + * ISR. */ + vSemaphoreCreateBinary( xButtonSemaphore ); + xSemaphoreTake( xButtonSemaphore, 0 ); - /* Create the queue used to pass message to vPrintTask. */ - xPrintQueue = xQueueCreate( mainQUEUE_SIZE, sizeof( char * ) ); + /* Create the queue used to pass message to vPrintTask. */ + xPrintQueue = xQueueCreate( mainQUEUE_SIZE, sizeof( char * ) ); - /* Start the standard demo tasks. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + /* Start the standard demo tasks. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - /* Start the tasks defined within the file. */ - xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - xTaskCreate( vButtonHandlerTask, "Status", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY + 1, NULL ); - xTaskCreate( vPrintTask, "Print", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL ); + /* Start the tasks defined within the file. */ + xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + xTaskCreate( vButtonHandlerTask, "Status", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY + 1, NULL ); + xTaskCreate( vPrintTask, "Print", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL ); - /* Start the scheduler. */ - vTaskStartScheduler(); + /* Start the scheduler. */ + vTaskStartScheduler(); - /* Will only get here if there was insufficient heap to start the - scheduler. */ + /* Will only get here if there was insufficient heap to start the + * scheduler. */ - return 0; + return 0; } /*-----------------------------------------------------------*/ -static void vCheckTask( void *pvParameters ) +static void vCheckTask( void * pvParameters ) { -portBASE_TYPE xErrorOccurred = pdFALSE; -TickType_t xLastExecutionTime; -const char *pcPassMessage = "PASS"; -const char *pcFailMessage = "FAIL"; - - /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() - works correctly. */ - xLastExecutionTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Perform this check every mainCHECK_DELAY milliseconds. */ - vTaskDelayUntil( &xLastExecutionTime, mainCHECK_DELAY ); - - /* Has an error been found in any task? */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - /* Send either a pass or fail message. If an error is found it is - never cleared again. We do not write directly to the LCD, but instead - queue a message for display by the print task. */ - if( xErrorOccurred == pdTRUE ) - { - xQueueSend( xPrintQueue, &pcFailMessage, portMAX_DELAY ); - } - else - { - xQueueSend( xPrintQueue, &pcPassMessage, portMAX_DELAY ); - } - } + portBASE_TYPE xErrorOccurred = pdFALSE; + TickType_t xLastExecutionTime; + const char * pcPassMessage = "PASS"; + const char * pcFailMessage = "FAIL"; + + /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() + * works correctly. */ + xLastExecutionTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Perform this check every mainCHECK_DELAY milliseconds. */ + vTaskDelayUntil( &xLastExecutionTime, mainCHECK_DELAY ); + + /* Has an error been found in any task? */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + /* Send either a pass or fail message. If an error is found it is + * never cleared again. We do not write directly to the LCD, but instead + * queue a message for display by the print task. */ + if( xErrorOccurred == pdTRUE ) + { + xQueueSend( xPrintQueue, &pcFailMessage, portMAX_DELAY ); + } + else + { + xQueueSend( xPrintQueue, &pcPassMessage, portMAX_DELAY ); + } + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Setup the PLL. */ - SysCtlClockSet( SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ ); + /* Setup the PLL. */ + SysCtlClockSet( SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ ); - /* Setup the push button. */ - SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC); - GPIODirModeSet(GPIO_PORTC_BASE, mainPUSH_BUTTON, GPIO_DIR_MODE_IN); - GPIOIntTypeSet( GPIO_PORTC_BASE, mainPUSH_BUTTON,GPIO_FALLING_EDGE ); - IntPrioritySet( INT_GPIOC, configKERNEL_INTERRUPT_PRIORITY ); - GPIOPinIntEnable( GPIO_PORTC_BASE, mainPUSH_BUTTON ); - IntEnable( INT_GPIOC ); + /* Setup the push button. */ + SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOC ); + GPIODirModeSet( GPIO_PORTC_BASE, mainPUSH_BUTTON, GPIO_DIR_MODE_IN ); + GPIOIntTypeSet( GPIO_PORTC_BASE, mainPUSH_BUTTON, GPIO_FALLING_EDGE ); + IntPrioritySet( INT_GPIOC, configKERNEL_INTERRUPT_PRIORITY ); + GPIOPinIntEnable( GPIO_PORTC_BASE, mainPUSH_BUTTON ); + IntEnable( INT_GPIOC ); - /* Enable the UART. */ - SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); - SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + /* Enable the UART. */ + SysCtlPeripheralEnable( SYSCTL_PERIPH_UART0 ); + SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOA ); - /* Set GPIO A0 and A1 as peripheral function. They are used to output the - UART signals. */ - GPIODirModeSet( GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_DIR_MODE_HW ); + /* Set GPIO A0 and A1 as peripheral function. They are used to output the + * UART signals. */ + GPIODirModeSet( GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_DIR_MODE_HW ); - /* Configure the UART for 8-N-1 operation. */ - UARTConfigSetExpClk( UART0_BASE, SysCtlClockGet(), mainBAUD_RATE, UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE ); + /* Configure the UART for 8-N-1 operation. */ + UARTConfigSetExpClk( UART0_BASE, SysCtlClockGet(), mainBAUD_RATE, UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE ); - /* We don't want to use the fifo. This is for test purposes to generate - as many interrupts as possible. */ - HWREG( UART0_BASE + UART_O_LCR_H ) &= ~mainFIFO_SET; + /* We don't want to use the fifo. This is for test purposes to generate + * as many interrupts as possible. */ + HWREG( UART0_BASE + UART_O_LCR_H ) &= ~mainFIFO_SET; - /* Enable Tx interrupts. */ - HWREG( UART0_BASE + UART_O_IM ) |= UART_INT_TX; - IntPrioritySet( INT_UART0, configKERNEL_INTERRUPT_PRIORITY ); - IntEnable( INT_UART0 ); + /* Enable Tx interrupts. */ + HWREG( UART0_BASE + UART_O_IM ) |= UART_INT_TX; + IntPrioritySet( INT_UART0, configKERNEL_INTERRUPT_PRIORITY ); + IntEnable( INT_UART0 ); - /* Initialise the LCD> */ + /* Initialise the LCD> */ OSRAMInit( false ); - OSRAMStringDraw("www.FreeRTOS.org", 0, 0); - OSRAMStringDraw("LM3S811 demo", 16, 1); + OSRAMStringDraw( "www.FreeRTOS.org", 0, 0 ); + OSRAMStringDraw( "LM3S811 demo", 16, 1 ); } /*-----------------------------------------------------------*/ -static void vButtonHandlerTask( void *pvParameters ) +static void vButtonHandlerTask( void * pvParameters ) { -const char *pcInterruptMessage = "Int"; - - for( ;; ) - { - /* Wait for a GPIO interrupt to wake this task. */ - while( xSemaphoreTake( xButtonSemaphore, portMAX_DELAY ) != pdPASS ); - - /* Start the Tx of the message on the UART. */ - UARTIntDisable( UART0_BASE, UART_INT_TX ); - { - pcNextChar = cMessage; - - /* Send the first character. */ - if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) - { - HWREG( UART0_BASE + UART_O_DR ) = *pcNextChar; - } - - pcNextChar++; - } - UARTIntEnable(UART0_BASE, UART_INT_TX); - - /* Queue a message for the print task to display on the LCD. */ - xQueueSend( xPrintQueue, &pcInterruptMessage, portMAX_DELAY ); - - /* Make sure we don't process bounces. */ - vTaskDelay( mainDEBOUNCE_DELAY ); - xSemaphoreTake( xButtonSemaphore, mainNO_DELAY ); - } + const char * pcInterruptMessage = "Int"; + + for( ; ; ) + { + /* Wait for a GPIO interrupt to wake this task. */ + while( xSemaphoreTake( xButtonSemaphore, portMAX_DELAY ) != pdPASS ) + { + } + + /* Start the Tx of the message on the UART. */ + UARTIntDisable( UART0_BASE, UART_INT_TX ); + { + pcNextChar = cMessage; + + /* Send the first character. */ + if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) + { + HWREG( UART0_BASE + UART_O_DR ) = *pcNextChar; + } + + pcNextChar++; + } + UARTIntEnable( UART0_BASE, UART_INT_TX ); + + /* Queue a message for the print task to display on the LCD. */ + xQueueSend( xPrintQueue, &pcInterruptMessage, portMAX_DELAY ); + + /* Make sure we don't process bounces. */ + vTaskDelay( mainDEBOUNCE_DELAY ); + xSemaphoreTake( xButtonSemaphore, mainNO_DELAY ); + } } /*-----------------------------------------------------------*/ -void vUART_ISR(void) +void vUART_ISR( void ) { -unsigned long ulStatus; - - /* What caused the interrupt. */ - ulStatus = UARTIntStatus( UART0_BASE, pdTRUE ); - - /* Clear the interrupt. */ - UARTIntClear( UART0_BASE, ulStatus ); - - /* Was a Tx interrupt pending? */ - if( ulStatus & UART_INT_TX ) - { - /* Send the next character in the string. We are not using the FIFO. */ - if( *pcNextChar != NULL ) - { - if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) - { - HWREG( UART0_BASE + UART_O_DR ) = *pcNextChar; - } - pcNextChar++; - } - } + unsigned long ulStatus; + + /* What caused the interrupt. */ + ulStatus = UARTIntStatus( UART0_BASE, pdTRUE ); + + /* Clear the interrupt. */ + UARTIntClear( UART0_BASE, ulStatus ); + + /* Was a Tx interrupt pending? */ + if( ulStatus & UART_INT_TX ) + { + /* Send the next character in the string. We are not using the FIFO. */ + if( *pcNextChar != NULL ) + { + if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) + { + HWREG( UART0_BASE + UART_O_DR ) = *pcNextChar; + } + + pcNextChar++; + } + } } /*-----------------------------------------------------------*/ void vGPIO_ISR( void ) { -portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; - /* Clear the interrupt. */ - GPIOPinIntClear(GPIO_PORTC_BASE, mainPUSH_BUTTON); + /* Clear the interrupt. */ + GPIOPinIntClear( GPIO_PORTC_BASE, mainPUSH_BUTTON ); - /* Wake the button handler task. */ - xSemaphoreGiveFromISR( xButtonSemaphore, &xHigherPriorityTaskWoken ); - portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); + /* Wake the button handler task. */ + xSemaphoreGiveFromISR( xButtonSemaphore, &xHigherPriorityTaskWoken ); + portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); } /*-----------------------------------------------------------*/ -static void vPrintTask( void *pvParameters ) +static void vPrintTask( void * pvParameters ) { -char *pcMessage; -unsigned portBASE_TYPE uxLine = 0, uxRow = 0; - - for( ;; ) - { - /* Wait for a message to arrive. */ - xQueueReceive( xPrintQueue, &pcMessage, portMAX_DELAY ); - - /* Write the message to the LCD. */ - uxRow++; - uxLine++; - OSRAMClear(); - OSRAMStringDraw( pcMessage, uxLine & 0x3f, uxRow & 0x01); - } + char * pcMessage; + unsigned portBASE_TYPE uxLine = 0, uxRow = 0; + + for( ; ; ) + { + /* Wait for a message to arrive. */ + xQueueReceive( xPrintQueue, &pcMessage, portMAX_DELAY ); + + /* Write the message to the LCD. */ + uxRow++; + uxLine++; + OSRAMClear(); + OSRAMStringDraw( pcMessage, uxLine & 0x3f, uxRow & 0x01 ); + } } - diff --git a/FreeRTOS/Demo/CORTEX_LM3S811_KEIL/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_LM3S811_KEIL/FreeRTOSConfig.h index 618834c6299..fe6f0b34add 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S811_KEIL/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_LM3S811_KEIL/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S811_KEIL/heap/heap_1.c b/FreeRTOS/Demo/CORTEX_LM3S811_KEIL/heap/heap_1.c index e4dc81721bd..0665e863cd2 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S811_KEIL/heap/heap_1.c +++ b/FreeRTOS/Demo/CORTEX_LM3S811_KEIL/heap/heap_1.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_LM3S811_KEIL/main.c b/FreeRTOS/Demo/CORTEX_LM3S811_KEIL/main.c index f9df97d52a3..b063d868912 100644 --- a/FreeRTOS/Demo/CORTEX_LM3S811_KEIL/main.c +++ b/FreeRTOS/Demo/CORTEX_LM3S811_KEIL/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -26,16 +26,16 @@ /* - * This project contains an application demonstrating the use of the + * This project contains an application demonstrating the use of the * FreeRTOS.org mini real time scheduler on the Luminary Micro LM3S811 Eval * board. See http://www.FreeRTOS.org for more information. * - * main() simply sets up the hardware, creates all the demo application tasks, + * main() simply sets up the hardware, creates all the demo application tasks, * then starts the scheduler. http://www.freertos.org/a00102.html provides - * more information on the standard demo tasks. + * more information on the standard demo tasks. * * In addition to a subset of the standard demo application tasks, main.c also - * defines the following tasks: + * defines the following tasks: * * + A 'Print' task. The print task is the only task permitted to access the * LCD - thus ensuring mutual exclusion and consistent access to the resource. @@ -44,12 +44,12 @@ * blocked - only waking when a message is queued for display. * * + A 'Button handler' task. The eval board contains a user push button that - * is configured to generate interrupts. The interrupt handler uses a - * semaphore to wake the button handler task - demonstrating how the priority + * is configured to generate interrupts. The interrupt handler uses a + * semaphore to wake the button handler task - demonstrating how the priority * mechanism can be used to defer interrupt processing to the task level. The * button handler task sends a message both to the LCD (via the print task) and * the UART where it can be viewed using a dumb terminal (via the UART to USB - * converter on the eval board). NOTES: The dumb terminal must be closed in + * converter on the eval board). NOTES: The dumb terminal must be closed in * order to reflash the microcontroller. A very basic interrupt driven UART * driver is used that does not use the FIFO. 19200 baud is used. * @@ -80,281 +80,287 @@ #include "BlockQ.h" /* Delay between cycles of the 'check' task. */ -#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) +#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) -/* UART configuration - note this does not use the FIFO so is not very -efficient. */ -#define mainBAUD_RATE ( 19200 ) -#define mainFIFO_SET ( 0x10 ) +/* UART configuration - note this does not use the FIFO so is not very + * efficient. */ +#define mainBAUD_RATE ( 19200 ) +#define mainFIFO_SET ( 0x10 ) /* Demo task priorities. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* Demo board specifics. */ -#define mainPUSH_BUTTON GPIO_PIN_4 +#define mainPUSH_BUTTON GPIO_PIN_4 /* Misc. */ -#define mainQUEUE_SIZE ( 3 ) -#define mainDEBOUNCE_DELAY ( ( TickType_t ) 150 / portTICK_PERIOD_MS ) -#define mainNO_DELAY ( ( TickType_t ) 0 ) +#define mainQUEUE_SIZE ( 3 ) +#define mainDEBOUNCE_DELAY ( ( TickType_t ) 150 / portTICK_PERIOD_MS ) +#define mainNO_DELAY ( ( TickType_t ) 0 ) + /* - * Configure the processor and peripherals for this demo. + * Configure the processor and peripherals for this demo. */ static void prvSetupHardware( void ); /* * The 'check' task, as described at the top of this file. */ -static void vCheckTask( void *pvParameters ); +static void vCheckTask( void * pvParameters ); /* * The task that is woken by the ISR that processes GPIO interrupts originating * from the push button. */ -static void vButtonHandlerTask( void *pvParameters ); +static void vButtonHandlerTask( void * pvParameters ); /* * The task that controls access to the LCD. */ -static void vPrintTask( void *pvParameter ); +static void vPrintTask( void * pvParameter ); /* String that is transmitted on the UART. */ -static char *cMessage = "Task woken by button interrupt! --- "; -static volatile char *pcNextChar; +static char * cMessage = "Task woken by button interrupt! --- "; +static volatile char * pcNextChar; /* The semaphore used to wake the button handler task from within the GPIO -interrupt handler. */ + * interrupt handler. */ SemaphoreHandle_t xButtonSemaphore; /* The queue used to send strings to the print task for display on the LCD. */ QueueHandle_t xPrintQueue; /* Newer library version. */ -extern void UARTConfigSetExpClk(unsigned long ulBase, unsigned long ulUARTClk, unsigned long ulBaud, unsigned long ulConfig); +extern void UARTConfigSetExpClk( unsigned long ulBase, + unsigned long ulUARTClk, + unsigned long ulBaud, + unsigned long ulConfig ); /*-----------------------------------------------------------*/ int main( void ) { - /* Configure the clocks, UART and GPIO. */ - prvSetupHardware(); + /* Configure the clocks, UART and GPIO. */ + prvSetupHardware(); - /* Create the semaphore used to wake the button handler task from the GPIO - ISR. */ - vSemaphoreCreateBinary( xButtonSemaphore ); - xSemaphoreTake( xButtonSemaphore, 0 ); + /* Create the semaphore used to wake the button handler task from the GPIO + * ISR. */ + vSemaphoreCreateBinary( xButtonSemaphore ); + xSemaphoreTake( xButtonSemaphore, 0 ); - /* Create the queue used to pass message to vPrintTask. */ - xPrintQueue = xQueueCreate( mainQUEUE_SIZE, sizeof( char * ) ); + /* Create the queue used to pass message to vPrintTask. */ + xPrintQueue = xQueueCreate( mainQUEUE_SIZE, sizeof( char * ) ); - /* Start the standard demo tasks. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + /* Start the standard demo tasks. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - /* Start the tasks defined within the file. */ - xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - xTaskCreate( vButtonHandlerTask, "Status", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY + 1, NULL ); - xTaskCreate( vPrintTask, "Print", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL ); + /* Start the tasks defined within the file. */ + xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + xTaskCreate( vButtonHandlerTask, "Status", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY + 1, NULL ); + xTaskCreate( vPrintTask, "Print", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL ); - /* Start the scheduler. */ - vTaskStartScheduler(); + /* Start the scheduler. */ + vTaskStartScheduler(); - /* Will only get here if there was insufficient heap to start the - scheduler. */ + /* Will only get here if there was insufficient heap to start the + * scheduler. */ - return 0; + return 0; } /*-----------------------------------------------------------*/ -static void vCheckTask( void *pvParameters ) +static void vCheckTask( void * pvParameters ) { -portBASE_TYPE xErrorOccurred = pdFALSE; -TickType_t xLastExecutionTime; -const char *pcPassMessage = "PASS"; -const char *pcFailMessage = "FAIL"; - - /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() - works correctly. */ - xLastExecutionTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Perform this check every mainCHECK_DELAY milliseconds. */ - vTaskDelayUntil( &xLastExecutionTime, mainCHECK_DELAY ); - - /* Has an error been found in any task? */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - xErrorOccurred = pdTRUE; - } - - /* Send either a pass or fail message. If an error is found it is - never cleared again. We do not write directly to the LCD, but instead - queue a message for display by the print task. */ - if( xErrorOccurred == pdTRUE ) - { - xQueueSend( xPrintQueue, &pcFailMessage, portMAX_DELAY ); - } - else - { - xQueueSend( xPrintQueue, &pcPassMessage, portMAX_DELAY ); - } - } + portBASE_TYPE xErrorOccurred = pdFALSE; + TickType_t xLastExecutionTime; + const char * pcPassMessage = "PASS"; + const char * pcFailMessage = "FAIL"; + + /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() + * works correctly. */ + xLastExecutionTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Perform this check every mainCHECK_DELAY milliseconds. */ + vTaskDelayUntil( &xLastExecutionTime, mainCHECK_DELAY ); + + /* Has an error been found in any task? */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + xErrorOccurred = pdTRUE; + } + + /* Send either a pass or fail message. If an error is found it is + * never cleared again. We do not write directly to the LCD, but instead + * queue a message for display by the print task. */ + if( xErrorOccurred == pdTRUE ) + { + xQueueSend( xPrintQueue, &pcFailMessage, portMAX_DELAY ); + } + else + { + xQueueSend( xPrintQueue, &pcPassMessage, portMAX_DELAY ); + } + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Setup the PLL. */ - SysCtlClockSet( SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ ); + /* Setup the PLL. */ + SysCtlClockSet( SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ ); - /* Setup the push button. */ - SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC); - GPIODirModeSet(GPIO_PORTC_BASE, mainPUSH_BUTTON, GPIO_DIR_MODE_IN); - GPIOIntTypeSet( GPIO_PORTC_BASE, mainPUSH_BUTTON,GPIO_FALLING_EDGE ); - IntPrioritySet( INT_GPIOC, configKERNEL_INTERRUPT_PRIORITY ); - GPIOPinIntEnable( GPIO_PORTC_BASE, mainPUSH_BUTTON ); - IntEnable( INT_GPIOC ); + /* Setup the push button. */ + SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOC ); + GPIODirModeSet( GPIO_PORTC_BASE, mainPUSH_BUTTON, GPIO_DIR_MODE_IN ); + GPIOIntTypeSet( GPIO_PORTC_BASE, mainPUSH_BUTTON, GPIO_FALLING_EDGE ); + IntPrioritySet( INT_GPIOC, configKERNEL_INTERRUPT_PRIORITY ); + GPIOPinIntEnable( GPIO_PORTC_BASE, mainPUSH_BUTTON ); + IntEnable( INT_GPIOC ); - /* Enable the UART. */ - SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); - SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + /* Enable the UART. */ + SysCtlPeripheralEnable( SYSCTL_PERIPH_UART0 ); + SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOA ); - /* Set GPIO A0 and A1 as peripheral function. They are used to output the - UART signals. */ - GPIODirModeSet( GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_DIR_MODE_HW ); + /* Set GPIO A0 and A1 as peripheral function. They are used to output the + * UART signals. */ + GPIODirModeSet( GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_DIR_MODE_HW ); - /* Configure the UART for 8-N-1 operation. */ - UARTConfigSetExpClk( UART0_BASE, SysCtlClockGet(), mainBAUD_RATE, UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE ); + /* Configure the UART for 8-N-1 operation. */ + UARTConfigSetExpClk( UART0_BASE, SysCtlClockGet(), mainBAUD_RATE, UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE ); - /* We don't want to use the fifo. This is for test purposes to generate - as many interrupts as possible. */ - HWREG( UART0_BASE + UART_O_LCR_H ) &= ~mainFIFO_SET; + /* We don't want to use the fifo. This is for test purposes to generate + * as many interrupts as possible. */ + HWREG( UART0_BASE + UART_O_LCR_H ) &= ~mainFIFO_SET; - /* Enable Tx interrupts. */ - HWREG( UART0_BASE + UART_O_IM ) |= UART_INT_TX; - IntPrioritySet( INT_UART0, configKERNEL_INTERRUPT_PRIORITY ); - IntEnable( INT_UART0 ); + /* Enable Tx interrupts. */ + HWREG( UART0_BASE + UART_O_IM ) |= UART_INT_TX; + IntPrioritySet( INT_UART0, configKERNEL_INTERRUPT_PRIORITY ); + IntEnable( INT_UART0 ); - /* Initialise the LCD> */ + /* Initialise the LCD> */ OSRAMInit( false ); - OSRAMStringDraw("www.FreeRTOS.org", 0, 0); - OSRAMStringDraw("LM3S811 demo", 16, 1); + OSRAMStringDraw( "www.FreeRTOS.org", 0, 0 ); + OSRAMStringDraw( "LM3S811 demo", 16, 1 ); } /*-----------------------------------------------------------*/ -static void vButtonHandlerTask( void *pvParameters ) +static void vButtonHandlerTask( void * pvParameters ) { -const char *pcInterruptMessage = "Int"; - - for( ;; ) - { - /* Wait for a GPIO interrupt to wake this task. */ - while( xSemaphoreTake( xButtonSemaphore, portMAX_DELAY ) != pdPASS ); - - /* Start the Tx of the message on the UART. */ - UARTIntDisable( UART0_BASE, UART_INT_TX ); - { - pcNextChar = cMessage; - - /* Send the first character. */ - if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) - { - HWREG( UART0_BASE + UART_O_DR ) = *pcNextChar; - } - - pcNextChar++; - } - UARTIntEnable(UART0_BASE, UART_INT_TX); - - /* Queue a message for the print task to display on the LCD. */ - xQueueSend( xPrintQueue, &pcInterruptMessage, portMAX_DELAY ); - - /* Make sure we don't process bounces. */ - vTaskDelay( mainDEBOUNCE_DELAY ); - xSemaphoreTake( xButtonSemaphore, mainNO_DELAY ); - } + const char * pcInterruptMessage = "Int"; + + for( ; ; ) + { + /* Wait for a GPIO interrupt to wake this task. */ + while( xSemaphoreTake( xButtonSemaphore, portMAX_DELAY ) != pdPASS ) + { + } + + /* Start the Tx of the message on the UART. */ + UARTIntDisable( UART0_BASE, UART_INT_TX ); + { + pcNextChar = cMessage; + + /* Send the first character. */ + if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) + { + HWREG( UART0_BASE + UART_O_DR ) = *pcNextChar; + } + + pcNextChar++; + } + UARTIntEnable( UART0_BASE, UART_INT_TX ); + + /* Queue a message for the print task to display on the LCD. */ + xQueueSend( xPrintQueue, &pcInterruptMessage, portMAX_DELAY ); + + /* Make sure we don't process bounces. */ + vTaskDelay( mainDEBOUNCE_DELAY ); + xSemaphoreTake( xButtonSemaphore, mainNO_DELAY ); + } } /*-----------------------------------------------------------*/ -void vUART_ISR(void) +void vUART_ISR( void ) { -unsigned long ulStatus; - - /* What caused the interrupt. */ - ulStatus = UARTIntStatus( UART0_BASE, pdTRUE ); - - /* Clear the interrupt. */ - UARTIntClear( UART0_BASE, ulStatus ); - - /* Was a Tx interrupt pending? */ - if( ulStatus & UART_INT_TX ) - { - /* Send the next character in the string. We are not using the FIFO. */ - if( *pcNextChar != NULL ) - { - if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) - { - HWREG( UART0_BASE + UART_O_DR ) = *pcNextChar; - } - pcNextChar++; - } - } + unsigned long ulStatus; + + /* What caused the interrupt. */ + ulStatus = UARTIntStatus( UART0_BASE, pdTRUE ); + + /* Clear the interrupt. */ + UARTIntClear( UART0_BASE, ulStatus ); + + /* Was a Tx interrupt pending? */ + if( ulStatus & UART_INT_TX ) + { + /* Send the next character in the string. We are not using the FIFO. */ + if( *pcNextChar != NULL ) + { + if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) + { + HWREG( UART0_BASE + UART_O_DR ) = *pcNextChar; + } + + pcNextChar++; + } + } } /*-----------------------------------------------------------*/ void vGPIO_ISR( void ) { -portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; - /* Clear the interrupt. */ - GPIOPinIntClear( GPIO_PORTC_BASE, mainPUSH_BUTTON ); + /* Clear the interrupt. */ + GPIOPinIntClear( GPIO_PORTC_BASE, mainPUSH_BUTTON ); - /* Wake the button handler task. */ - xSemaphoreGiveFromISR( xButtonSemaphore, &xHigherPriorityTaskWoken ); - portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); + /* Wake the button handler task. */ + xSemaphoreGiveFromISR( xButtonSemaphore, &xHigherPriorityTaskWoken ); + portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); } /*-----------------------------------------------------------*/ -static void vPrintTask( void *pvParameters ) +static void vPrintTask( void * pvParameters ) { -char *pcMessage; -unsigned portBASE_TYPE uxLine = 0, uxRow = 0; - - for( ;; ) - { - /* Wait for a message to arrive. */ - xQueueReceive( xPrintQueue, &pcMessage, portMAX_DELAY ); - - /* Write the message to the LCD. */ - uxRow++; - uxLine++; - OSRAMClear(); - OSRAMStringDraw( pcMessage, uxLine & 0x3f, uxRow & 0x01); - } + char * pcMessage; + unsigned portBASE_TYPE uxLine = 0, uxRow = 0; + + for( ; ; ) + { + /* Wait for a message to arrive. */ + xQueueReceive( xPrintQueue, &pcMessage, portMAX_DELAY ); + + /* Write the message to the LCD. */ + uxRow++; + uxLine++; + OSRAMClear(); + OSRAMStringDraw( pcMessage, uxLine & 0x3f, uxRow & 0x01 ); + } } - diff --git a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/RegTest.c b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/RegTest.c index b586e787f96..67decbd4367 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/Sample-CLI-commands.c b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/Sample-CLI-commands.c index 7cec93be492..2b1330073d6 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/Sample-CLI-commands.c +++ b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/Sample-CLI-commands.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/UARTCommandConsole.c b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/UARTCommandConsole.c index 121dd82b79c..4e5c71178b5 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/UARTCommandConsole.c +++ b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/UARTCommandConsole.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/UARTCommandConsole.h b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/UARTCommandConsole.h index c3f7ae9b0ca..9308b9d5e4c 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/UARTCommandConsole.h +++ b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/UARTCommandConsole.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/config/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/config/FreeRTOSConfig.h index 7dc4074e6aa..f881546b622 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/config/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/config/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main-blinky.c b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main-blinky.c index 5ffeccd0565..9debd95da44 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main-blinky.c +++ b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main-blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main-full.c b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main-full.c index 07e968a3422..ac29b69cd1c 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main-full.c +++ b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main-full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main.c b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main.c index fc898ba7467..67634647549 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main.c +++ b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/GCC_specific/RegTest.c b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/GCC_specific/RegTest.c index d30016443e3..b7c5ed68951 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/GCC_specific/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/GCC_specific/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/GCC_specific/compiler_attributes.h b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/GCC_specific/compiler_attributes.h index 93072195267..ac3a0735bfd 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/GCC_specific/compiler_attributes.h +++ b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/GCC_specific/compiler_attributes.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/IAR_specific/compiler_attributes.h b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/IAR_specific/compiler_attributes.h index 1bbd07079b3..8f4cb190eb6 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/IAR_specific/compiler_attributes.h +++ b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/IAR_specific/compiler_attributes.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/Keil_specific/compiler_attributes.h b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/Keil_specific/compiler_attributes.h index cd466aec9ff..81babfbc207 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/Keil_specific/compiler_attributes.h +++ b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/Keil_specific/compiler_attributes.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/FreeRTOSConfig.h index 0921050794e..a0fbe27d722 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/IntQueueTimer.c index be20e5693d8..b253f6e2122 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/IntQueueTimer.h index 4fb214c4093..dc540323649 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/main_blinky.c b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/main_blinky.c index 7af0f79c6c1..0571629af4a 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/main_full.c b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/main_full.c index 02afdb276a8..b7610e633df 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M0+_LPC51U68_GCC_IAR_KEIL/app/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Config/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Config/FreeRTOSConfig.h index 447dc868a3e..b8866b443d2 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Config/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Config/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/GCC/RegTestsAsm.c b/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/GCC/RegTestsAsm.c index 00582f8a71e..9522a872f21 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/GCC/RegTestsAsm.c +++ b/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/GCC/RegTestsAsm.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/RegTests.c b/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/RegTests.c index a0f38f25c4b..60d05a6419d 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/RegTests.c +++ b/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/RegTests.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/RegTests.h b/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/RegTests.h index 5b5dffe9785..260603083d9 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/RegTests.h +++ b/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/RegTests.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/app_main.c b/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/app_main.c index d22febf0a02..bd00a879215 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/app_main.c +++ b/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/app_main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/app_main.h b/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/app_main.h index ec3f68f3427..24cdd99b367 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/app_main.h +++ b/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/app_main.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/main_blinky.c b/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/main_blinky.c index c74f52f6964..f1567ad0f79 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/main_full.c b/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/main_full.c index 4e9e752388c..f61378a7cbb 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M0+_NUCLEO_L010RB_GCC_IAR/Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/Atollic_Specific/RegTest.c b/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/Atollic_Specific/RegTest.c index 3abe65c1ee2..cdad1036b54 100644 --- a/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/Atollic_Specific/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/Atollic_Specific/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/FreeRTOSConfig.h index 5539843f79b..e3a1cbd6f52 100644 --- a/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/ParTest_XMC1100.c b/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/ParTest_XMC1100.c index da473014e6a..b948ffdb117 100644 --- a/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/ParTest_XMC1100.c +++ b/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/ParTest_XMC1100.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/ParTest_XMC1200.c b/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/ParTest_XMC1200.c index d8fde20516d..8c88ae9308c 100644 --- a/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/ParTest_XMC1200.c +++ b/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/ParTest_XMC1200.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/ParTest_XMC1300.c b/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/ParTest_XMC1300.c index fc2d2c3ca48..ef04cce9d12 100644 --- a/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/ParTest_XMC1300.c +++ b/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/ParTest_XMC1300.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/main-blinky.c b/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/main-blinky.c index 0e34d7fe02b..30a5bf011d1 100644 --- a/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/main-blinky.c +++ b/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/main-blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -70,32 +70,32 @@ #include "partest.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /* Values passed to the two tasks just to check the task parameter -functionality. */ -#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) -#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) + * functionality. */ +#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) +#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) /* The number of the LED that is toggled. */ -#define mainLED_TO_TOGGLE ( 0 ) +#define mainLED_TO_TOGGLE ( 0 ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * Called by main() to create the simply blinky style application if @@ -117,85 +117,86 @@ static QueueHandle_t xQueue = NULL; void main_blinky( void ) { - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); - - if( xQueue != NULL ) - { - /* Start the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ - mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ - - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Start the tasks and timer running. */ - 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 insufficient FreeRTOS heap memory available for the idle and/or - timer tasks to be created. See the memory management section on the - FreeRTOS web site for more details. */ - for( ;; ); + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); + + if( xQueue != NULL ) + { + /* Start the two tasks as described in the comments at the top of this + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ + + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Start the tasks and timer running. */ + 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 insufficient FreeRTOS heap memory available for the idle and/or + * timer tasks to be created. See the memory management section on the + * FreeRTOS web site for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, the constant used converts ticks - to ms. While in the Blocked state this task will not consume any CPU - time. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - - /* 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 - will not block - it shouldn't need to block as the queue should always - be empty at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, the constant used converts ticks + * to ms. While in the Blocked state this task will not consume any CPU + * time. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + + /* 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 + * will not block - it shouldn't need to block as the queue should always + * be empty at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it the expected value? If it is, toggle the LED. */ - if( ulReceivedValue == 100UL ) - { - vParTestToggleLED( mainLED_TO_TOGGLE ); - ulReceivedValue = 0U; - } - } + unsigned long ulReceivedValue; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it the expected value? If it is, toggle the LED. */ + if( ulReceivedValue == 100UL ) + { + vParTestToggleLED( mainLED_TO_TOGGLE ); + ulReceivedValue = 0U; + } + } } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/main-full.c b/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/main-full.c index f542efeda5f..3568197cc61 100644 --- a/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/main-full.c +++ b/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/main-full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -91,28 +91,28 @@ #include "QueueSet.h" /* The period after which the check timer will expire 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 mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS ) + * been reported by any of the standard demo tasks. ms are converted to the + * 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 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_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) + * 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_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) /* A block time of zero simply means "don't block". */ -#define mainDONT_BLOCK ( 0UL ) +#define mainDONT_BLOCK ( 0UL ) /* The base toggle rate used by the flash timers. Each toggle rate is a -multiple of this. */ -#define mainFLASH_TIMER_BASE_RATE ( 200UL / portTICK_PERIOD_MS ) + * multiple of this. */ +#define mainFLASH_TIMER_BASE_RATE ( 200UL / portTICK_PERIOD_MS ) /* The LED toggle by the check timer. */ -#define mainCHECK_LED ( 4 ) +#define mainCHECK_LED ( 4 ) /* The LED toggled each time the task implemented by the prvSemaphoreTakeTask() -function takes the semaphore that is given by the tick hook function. */ -#define mainSEMAPHORE_LED ( 3 ) + * function takes the semaphore that is given by the tick hook function. */ +#define mainSEMAPHORE_LED ( 3 ) /*-----------------------------------------------------------*/ @@ -120,8 +120,8 @@ function takes the semaphore that is given by the tick hook function. */ * Register check tasks, as described at the top of this file. The nature of * these files necessitates that they are written in an assembly. */ -extern void vRegTest1Task( void *pvParameters ); -extern void vRegTest2Task( void *pvParameters ); +extern void vRegTest1Task( void * pvParameters ); +extern void vRegTest2Task( void * pvParameters ); /* * The hardware only has a single LED. Simply toggle it. @@ -143,7 +143,7 @@ static void prvFlashTimerCallback( TimerHandle_t xTimer ); * The task that toggles an LED each time the semaphore 'given' by the tick * hook function (which is defined in main.c) is 'taken' in the task. */ -static void prvSemaphoreTakeTask( void *pvParameters ); +static void prvSemaphoreTakeTask( void * pvParameters ); /* * Called by main() to create the comprehensive test/demo application if @@ -154,210 +154,214 @@ void main_full( void ); /*-----------------------------------------------------------*/ /* The following two variables are used to communicate the status of the -register check tasks to the check software timer. If the variables keep -incrementing, then the register check tasks have not discovered any errors. If -a variable stops incrementing, then an error has been found. */ + * register check tasks to the check software timer. If the variables keep + * incrementing, then the register check tasks have not discovered any errors. If + * a variable stops incrementing, then an error has been found. */ volatile unsigned long ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL; /* The semaphore that is given by the tick hook function (defined in main.c) -and taken by the task implemented by the prvSemaphoreTakeTask() function. The -task toggles LED mainSEMAPHORE_LED each time the semaphore is taken. */ + * and taken by the task implemented by the prvSemaphoreTakeTask() function. The + * task toggles LED mainSEMAPHORE_LED each time the semaphore is taken. */ SemaphoreHandle_t xLEDSemaphore = NULL; /*-----------------------------------------------------------*/ void main_full( void ) { -TimerHandle_t xTimer = NULL; -unsigned long ulTimer; -const unsigned long ulTimersToCreate = 3L; + TimerHandle_t xTimer = NULL; + unsigned long ulTimer; + const unsigned long ulTimersToCreate = 3L; + /* The register test tasks are asm functions that don't use a stack. The -stack allocated just has to be large enough to hold the task context, and -for the additional required for the stack overflow checking to work (if -configured). */ -const size_t xRegTestStackSize = 25U; - - /* Create the standard demo tasks */ - vCreateBlockTimeTasks(); - vStartDynamicPriorityTasks(); - vStartCountingSemaphoreTasks(); - vStartRecursiveMutexTasks(); - vStartQueueOverwriteTask( tskIDLE_PRIORITY ); - vStartQueueSetTasks(); - - /* Create that is given from the tick hook function, and the task that - toggles an LED each time the semaphore is given. */ - vSemaphoreCreateBinary( xLEDSemaphore ); - xTaskCreate( prvSemaphoreTakeTask, /* Function that implements the task. */ - "Sem", /* Text name of the task. */ - configMINIMAL_STACK_SIZE, /* Stack allocated to the task (in words). */ - NULL, /* The task parameter is not used. */ - configMAX_PRIORITIES - 2, /* The priority of the task. */ - NULL ); /* Don't receive a handle back, it is not needed. */ - - /* Create the register test tasks as described at the top of this file. - These are naked functions that don't use any stack. A stack still has - to be allocated to hold the task context. */ - xTaskCreate( vRegTest1Task, /* Function that implements the task. */ - "Reg1", /* Text name of the task. */ - xRegTestStackSize, /* Stack allocated to the task. */ - NULL, /* The task parameter is not used. */ - tskIDLE_PRIORITY, /* The priority to assign to the task. */ - NULL ); /* Don't receive a handle back, it is not needed. */ - - xTaskCreate( vRegTest2Task, /* Function that implements the task. */ - "Reg2", /* Text name of the task. */ - xRegTestStackSize, /* Stack allocated to the task. */ - NULL, /* The task parameter is not used. */ - tskIDLE_PRIORITY, /* The priority to assign to the task. */ - NULL ); /* Don't receive a handle back, it is not needed. */ - - /* Create the three flash timers. */ - for( ulTimer = 0UL; ulTimer < ulTimersToCreate; ulTimer++ ) - { - xTimer = xTimerCreate( "FlashTimer", /* A text name, purely to help debugging. */ - ( mainFLASH_TIMER_BASE_RATE * ( ulTimer + 1UL ) ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) ulTimer, /* The ID is used to hold the number of the LED that will be flashed. */ - prvFlashTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - if( xTimer != NULL ) - { - xTimerStart( xTimer, mainDONT_BLOCK ); - } - } - - /* Create the software timer that performs the 'check' functionality, - as described at the top of this file. */ - xTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ - ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - /* If the software timer was created successfully, start it. It won't - actually start running until the scheduler starts. A block time of - zero is used in this call, although any value could be used as the block - time will be ignored because the scheduler has not started yet. */ - if( xTimer != NULL ) - { - xTimerStart( xTimer, mainDONT_BLOCK ); - } - - /* Start the kernel. From here on, only tasks and interrupts will run. */ - 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 insufficient FreeRTOS heap memory available for the idle and/or timer - tasks to be created. See the memory management section on the FreeRTOS web - site, or the FreeRTOS tutorial books for more details. */ - for( ;; ); + * stack allocated just has to be large enough to hold the task context, and + * for the additional required for the stack overflow checking to work (if + * configured). */ + const size_t xRegTestStackSize = 25U; + + /* Create the standard demo tasks */ + vCreateBlockTimeTasks(); + vStartDynamicPriorityTasks(); + vStartCountingSemaphoreTasks(); + vStartRecursiveMutexTasks(); + vStartQueueOverwriteTask( tskIDLE_PRIORITY ); + vStartQueueSetTasks(); + + /* Create that is given from the tick hook function, and the task that + * toggles an LED each time the semaphore is given. */ + vSemaphoreCreateBinary( xLEDSemaphore ); + xTaskCreate( prvSemaphoreTakeTask, /* Function that implements the task. */ + "Sem", /* Text name of the task. */ + configMINIMAL_STACK_SIZE, /* Stack allocated to the task (in words). */ + NULL, /* The task parameter is not used. */ + configMAX_PRIORITIES - 2, /* The priority of the task. */ + NULL ); /* Don't receive a handle back, it is not needed. */ + + /* Create the register test tasks as described at the top of this file. + * These are naked functions that don't use any stack. A stack still has + * to be allocated to hold the task context. */ + xTaskCreate( vRegTest1Task, /* Function that implements the task. */ + "Reg1", /* Text name of the task. */ + xRegTestStackSize, /* Stack allocated to the task. */ + NULL, /* The task parameter is not used. */ + tskIDLE_PRIORITY, /* The priority to assign to the task. */ + NULL ); /* Don't receive a handle back, it is not needed. */ + + xTaskCreate( vRegTest2Task, /* Function that implements the task. */ + "Reg2", /* Text name of the task. */ + xRegTestStackSize, /* Stack allocated to the task. */ + NULL, /* The task parameter is not used. */ + tskIDLE_PRIORITY, /* The priority to assign to the task. */ + NULL ); /* Don't receive a handle back, it is not needed. */ + + /* Create the three flash timers. */ + for( ulTimer = 0UL; ulTimer < ulTimersToCreate; ulTimer++ ) + { + xTimer = xTimerCreate( "FlashTimer", /* A text name, purely to help debugging. */ + ( mainFLASH_TIMER_BASE_RATE * ( ulTimer + 1UL ) ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) ulTimer, /* The ID is used to hold the number of the LED that will be flashed. */ + prvFlashTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + if( xTimer != NULL ) + { + xTimerStart( xTimer, mainDONT_BLOCK ); + } + } + + /* Create the software timer that performs the 'check' functionality, + * as described at the top of this file. */ + xTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ + ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + /* If the software timer was created successfully, start it. It won't + * actually start running until the scheduler starts. A block time of + * zero is used in this call, although any value could be used as the block + * time will be ignored because the scheduler has not started yet. */ + if( xTimer != NULL ) + { + xTimerStart( xTimer, mainDONT_BLOCK ); + } + + /* Start the kernel. From here on, only tasks and interrupts will run. */ + 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 insufficient FreeRTOS heap memory available for the idle and/or timer + * tasks to be created. See the memory management section on the FreeRTOS web + * site, or the FreeRTOS tutorial books for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ /* See the description at the top of this file. */ static void prvCheckTimerCallback( TimerHandle_t xTimer ) { -static long lChangedTimerPeriodAlready = pdFALSE; -static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; -unsigned long ulErrorFound = pdFALSE; - - /* Check all the demo and test tasks to ensure that they are all still - running, and that none have detected an error. */ - if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) - { - ulErrorFound |= ( 0x01UL << 0UL ); - } - - if( xAreBlockTimeTestTasksStillRunning() != pdPASS ) - { - ulErrorFound |= ( 0x01UL << 1UL ); - } - - if( xAreCountingSemaphoreTasksStillRunning() != pdPASS ) - { - ulErrorFound |= ( 0x01UL << 2UL ); - } - - if( xAreRecursiveMutexTasksStillRunning() != pdPASS ) - { - ulErrorFound |= ( 0x01UL << 3UL ); - } - - /* Check that the register test 1 task is still running. */ - if( ulLastRegTest1Value == ulRegTest1LoopCounter ) - { - ulErrorFound |= ( 0x01UL << 4UL ); - } - ulLastRegTest1Value = ulRegTest1LoopCounter; - - /* Check that the register test 2 task is still running. */ - if( ulLastRegTest2Value == ulRegTest2LoopCounter ) - { - ulErrorFound |= ( 0x01UL << 5UL ); - } - ulLastRegTest2Value = ulRegTest2LoopCounter; - - if( xAreQueueSetTasksStillRunning() != pdPASS ) - { - ulErrorFound |= ( 0x01UL << 6UL ); - } - - if( xIsQueueOverwriteTaskStillRunning() != pdPASS ) - { - ulErrorFound |= ( 0x01UL << 7UL ); - } - - /* Toggle the check LED to give an indication of the system status. If - the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then - everything is ok. A faster toggle indicates an error. */ - vParTestToggleLED( mainCHECK_LED ); - - /* Have any errors been latched in ulErrorFound? If so, shorten the - period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. - This will result in an increase in the rate at which mainCHECK_LED - toggles. */ - if( ulErrorFound != pdFALSE ) - { - if( lChangedTimerPeriodAlready == pdFALSE ) - { - lChangedTimerPeriodAlready = pdTRUE; - - /* This call to xTimerChangePeriod() uses a zero block time. - Functions called from inside of a timer callback function must - *never* attempt to block. */ - xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); - } - } + static long lChangedTimerPeriodAlready = pdFALSE; + static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; + unsigned long ulErrorFound = pdFALSE; + + /* Check all the demo and test tasks to ensure that they are all still + * running, and that none have detected an error. */ + if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) + { + ulErrorFound |= ( 0x01UL << 0UL ); + } + + if( xAreBlockTimeTestTasksStillRunning() != pdPASS ) + { + ulErrorFound |= ( 0x01UL << 1UL ); + } + + if( xAreCountingSemaphoreTasksStillRunning() != pdPASS ) + { + ulErrorFound |= ( 0x01UL << 2UL ); + } + + if( xAreRecursiveMutexTasksStillRunning() != pdPASS ) + { + ulErrorFound |= ( 0x01UL << 3UL ); + } + + /* Check that the register test 1 task is still running. */ + if( ulLastRegTest1Value == ulRegTest1LoopCounter ) + { + ulErrorFound |= ( 0x01UL << 4UL ); + } + + ulLastRegTest1Value = ulRegTest1LoopCounter; + + /* Check that the register test 2 task is still running. */ + if( ulLastRegTest2Value == ulRegTest2LoopCounter ) + { + ulErrorFound |= ( 0x01UL << 5UL ); + } + + ulLastRegTest2Value = ulRegTest2LoopCounter; + + if( xAreQueueSetTasksStillRunning() != pdPASS ) + { + ulErrorFound |= ( 0x01UL << 6UL ); + } + + if( xIsQueueOverwriteTaskStillRunning() != pdPASS ) + { + ulErrorFound |= ( 0x01UL << 7UL ); + } + + /* Toggle the check LED to give an indication of the system status. If + * the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then + * everything is ok. A faster toggle indicates an error. */ + vParTestToggleLED( mainCHECK_LED ); + + /* Have any errors been latched in ulErrorFound? If so, shorten the + * period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. + * This will result in an increase in the rate at which mainCHECK_LED + * toggles. */ + if( ulErrorFound != pdFALSE ) + { + if( lChangedTimerPeriodAlready == pdFALSE ) + { + lChangedTimerPeriodAlready = pdTRUE; + + /* This call to xTimerChangePeriod() uses a zero block time. + * Functions called from inside of a timer callback function must + * never* attempt to block. */ + xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); + } + } } /*-----------------------------------------------------------*/ -static void prvSemaphoreTakeTask( void *pvParameters ) +static void prvSemaphoreTakeTask( void * pvParameters ) { - configASSERT( xLEDSemaphore ); - - for( ;; ) - { - /* Wait to obtain the semaphore - which is given by the tick hook - function every 50ms. */ - xSemaphoreTake( xLEDSemaphore, portMAX_DELAY ); - vParTestToggleLED( mainSEMAPHORE_LED ); - } + configASSERT( xLEDSemaphore ); + + for( ; ; ) + { + /* Wait to obtain the semaphore - which is given by the tick hook + * function every 50ms. */ + xSemaphoreTake( xLEDSemaphore, portMAX_DELAY ); + vParTestToggleLED( mainSEMAPHORE_LED ); + } } /*-----------------------------------------------------------*/ static void prvFlashTimerCallback( TimerHandle_t xTimer ) { -unsigned long ulLED; + unsigned long ulLED; - /* This callback function is assigned to three separate software timers. - Each timer toggles a different LED. Obtain the number of the LED that - this timer is toggling. */ - ulLED = ( unsigned long ) pvTimerGetTimerID( xTimer ); + /* This callback function is assigned to three separate software timers. + * Each timer toggles a different LED. Obtain the number of the LED that + * this timer is toggling. */ + ulLED = ( unsigned long ) pvTimerGetTimerID( xTimer ); - /* Toggle the LED. */ - vParTestToggleLED( ulLED ); + /* Toggle the LED. */ + vParTestToggleLED( ulLED ); } - diff --git a/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/main.c b/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/main.c index 3d1a747b83b..2ccca66e118 100644 --- a/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/main.c +++ b/FreeRTOS/Demo/CORTEX_M0_Infineon_XMC1000_IAR_Keil_GCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -54,8 +54,8 @@ #include "QueueSet.h" /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 /*-----------------------------------------------------------*/ @@ -82,146 +82,149 @@ extern void SystemCoreClockUpdate( void ); int main( void ) { - /* Prepare the hardware to run this demo. */ - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* Prepare the hardware to run this demo. */ + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - SystemCoreClockUpdate(); - vParTestInitialise(); + SystemCoreClockUpdate(); + vParTestInitialise(); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* This function will be called by each tick interrupt if - configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - added here, but the tick hook is called from an interrupt context, so - code must not attempt to block, and only the interrupt safe FreeRTOS API - functions can be used (those that end in FromISR()). The code in this - tick hook implementation is for demonstration only - it has no real - purpose. It just gives a semaphore every 50ms. The semaphore unblocks a - task that then toggles an LED. Additionally, the call to - vQueueSetAccessQueueSetFromISR() is part of the "standard demo tasks" - functionality. */ - - /* The semaphore and associated task are not created when the simple blinky - demo is used. */ - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 - { - static unsigned long ulLastGiveTime = 0UL; - const unsigned long ulRate = 50UL / portTICK_PERIOD_MS; - extern SemaphoreHandle_t xLEDSemaphore; - - configASSERT( xLEDSemaphore ); - - if( ( xTaskGetTickCountFromISR() - ulLastGiveTime ) > ulRate ) - { - /* The second parameter is normally used to determine if a context - switch should be performed or not. In this case the function is - being performed from the tick hook, so the scheduler will make that - assessment before returning to a task anyway - so the parameter is - not needed and is just set to NULL. */ - xSemaphoreGiveFromISR( xLEDSemaphore, NULL ); - ulLastGiveTime += ulRate; - } - - /* Write to a queue that is in use as part of the queue set demo to - demonstrate using queue sets from an ISR. */ - vQueueSetAccessQueueSetFromISR(); - } - #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */ + /* This function will be called by each tick interrupt if + * configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + * added here, but the tick hook is called from an interrupt context, so + * code must not attempt to block, and only the interrupt safe FreeRTOS API + * functions can be used (those that end in FromISR()). The code in this + * tick hook implementation is for demonstration only - it has no real + * purpose. It just gives a semaphore every 50ms. The semaphore unblocks a + * task that then toggles an LED. Additionally, the call to + * vQueueSetAccessQueueSetFromISR() is part of the "standard demo tasks" + * functionality. */ + + /* The semaphore and associated task are not created when the simple blinky + * demo is used. */ + #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 + { + static unsigned long ulLastGiveTime = 0UL; + const unsigned long ulRate = 50UL / portTICK_PERIOD_MS; + extern SemaphoreHandle_t xLEDSemaphore; + + configASSERT( xLEDSemaphore ); + + if( ( xTaskGetTickCountFromISR() - ulLastGiveTime ) > ulRate ) + { + /* The second parameter is normally used to determine if a context + * switch should be performed or not. In this case the function is + * being performed from the tick hook, so the scheduler will make that + * assessment before returning to a task anyway - so the parameter is + * not needed and is just set to NULL. */ + xSemaphoreGiveFromISR( xLEDSemaphore, NULL ); + ulLastGiveTime += ulRate; + } + + /* Write to a queue that is in use as part of the queue set demo to + * demonstrate using queue sets from an ISR. */ + vQueueSetAccessQueueSetFromISR(); + } + #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */ } /*-----------------------------------------------------------*/ #ifdef JUST_AN_EXAMPLE_ISR -void Dummy_IRQHandler(void) -{ -long lHigherPriorityTaskWoken = pdFALSE; - - /* Clear the interrupt if necessary. */ - Dummy_ClearITPendingBit(); - - /* This interrupt does nothing more than demonstrate how to synchronise a - task with an interrupt. A semaphore is used for this purpose. Note - lHigherPriorityTaskWoken is initialised to zero. Only FreeRTOS API functions - that end in "FromISR" can be called from an ISR. */ - xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken ); - - /* If there was a task that was blocked on the semaphore, and giving the - semaphore caused the task to unblock, and the unblocked task has a priority - higher than the current Running state task (the task that this interrupt - interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE - internally within xSemaphoreGiveFromISR(). Passing pdTRUE into the - portEND_SWITCHING_ISR() macro will result in a context switch being pended to - ensure this interrupt returns directly to the unblocked, higher priority, - task. Passing pdFALSE into portEND_SWITCHING_ISR() has no effect. */ - portEND_SWITCHING_ISR( lHigherPriorityTaskWoken ); -} + void Dummy_IRQHandler( void ) + { + long lHigherPriorityTaskWoken = pdFALSE; + + /* Clear the interrupt if necessary. */ + Dummy_ClearITPendingBit(); + + /* This interrupt does nothing more than demonstrate how to synchronise a + * task with an interrupt. A semaphore is used for this purpose. Note + * lHigherPriorityTaskWoken is initialised to zero. Only FreeRTOS API functions + * that end in "FromISR" can be called from an ISR. */ + xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken ); + + /* If there was a task that was blocked on the semaphore, and giving the + * semaphore caused the task to unblock, and the unblocked task has a priority + * higher than the current Running state task (the task that this interrupt + * interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE + * internally within xSemaphoreGiveFromISR(). Passing pdTRUE into the + * portEND_SWITCHING_ISR() macro will result in a context switch being pended to + * ensure this interrupt returns directly to the unblocked, higher priority, + * task. Passing pdFALSE into portEND_SWITCHING_ISR() has no effect. */ + portEND_SWITCHING_ISR( lHigherPriorityTaskWoken ); + } #endif /* JUST_AN_EXAMPLE_ISR */ - - - - diff --git a/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOSConfig.h index 2f6a9f1aa08..87c66963579 100644 --- a/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/IntQueueTimer.c index 74d0a46a2d8..8f9b18a4b21 100644 --- a/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/IntQueueTimer.h index 4fb214c4093..dc540323649 100644 --- a/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/RegTest.c b/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/RegTest.c index d30016443e3..b7c5ed68951 100644 --- a/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/main-blinky.c b/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/main-blinky.c index 820c640a04f..cd1a8069ab7 100644 --- a/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/main-blinky.c +++ b/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/main-blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/main-full.c b/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/main-full.c index 1c5c271c0ce..d04270fd48b 100644 --- a/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/main-full.c +++ b/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/main-full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/main.c b/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/main.c index 435b1611a5c..dceda6c78ce 100644 --- a/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/main.c +++ b/FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/FreeRTOSConfig.h index 16842cc05ce..02d3a2fc3d0 100644 --- a/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/ParTest.c b/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/ParTest.c index c1d215fd849..2e64f513ade 100644 --- a/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/main-blinky.c b/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/main-blinky.c index e57c70ec77b..56de5f45d3c 100644 --- a/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/main-blinky.c +++ b/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/main-blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -73,29 +73,29 @@ #include "stm320518_eval.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /* Values passed to the two tasks just to check the task parameter -functionality. */ -#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) -#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) + * functionality. */ +#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) +#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * Called by main() to create the simply blinky style application if @@ -117,85 +117,86 @@ static QueueHandle_t xQueue = NULL; void main_blinky( void ) { - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); - - if( xQueue != NULL ) - { - /* Start the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ - mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ - - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Start the tasks and timer running. */ - 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 insufficient FreeRTOS heap memory available for the idle and/or - timer tasks to be created. See the memory management section on the - FreeRTOS web site for more details. */ - for( ;; ); + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); + + if( xQueue != NULL ) + { + /* Start the two tasks as described in the comments at the top of this + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ + + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Start the tasks and timer running. */ + 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 insufficient FreeRTOS heap memory available for the idle and/or + * timer tasks to be created. See the memory management section on the + * FreeRTOS web site for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, the constant used converts ticks - to ms. While in the Blocked state this task will not consume any CPU - time. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - - /* 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 - will not block - it shouldn't need to block as the queue should always - be empty at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, the constant used converts ticks + * to ms. While in the Blocked state this task will not consume any CPU + * time. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + + /* 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 + * will not block - it shouldn't need to block as the queue should always + * be empty at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it the expected value? If it is, toggle the LED. */ - if( ulReceivedValue == 100UL ) - { - vParTestToggleLED( LED1 ); - ulReceivedValue = 0U; - } - } + unsigned long ulReceivedValue; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it the expected value? If it is, toggle the LED. */ + if( ulReceivedValue == 100UL ) + { + vParTestToggleLED( LED1 ); + ulReceivedValue = 0U; + } + } } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/main-full.c b/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/main-full.c index 01c369cfc8d..e65dbe8bf39 100644 --- a/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/main-full.c +++ b/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/main-full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -87,32 +87,32 @@ #include "stm320518_eval.h" /* The period after which the check timer will expire 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 mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS ) + * been reported by any of the standard demo tasks. ms are converted to the + * 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 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_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) + * 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_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) /* A block time of zero simply means "don't block". */ -#define mainDONT_BLOCK ( 0UL ) +#define mainDONT_BLOCK ( 0UL ) /* The base toggle rate used by the flash timers. Each toggle rate is a -multiple of this. */ -#define mainFLASH_TIMER_BASE_RATE ( 200UL / portTICK_PERIOD_MS ) + * multiple of this. */ +#define mainFLASH_TIMER_BASE_RATE ( 200UL / portTICK_PERIOD_MS ) /* The LED toggle by the check timer. */ -#define mainCHECK_LED ( 3 ) +#define mainCHECK_LED ( 3 ) /*-----------------------------------------------------------*/ /* * Register check tasks, as described at the top of this file. The nature of * these files necessitates that they are written in an assembly. */ -extern void vRegTest1Task( void *pvParameters ); -extern void vRegTest2Task( void *pvParameters ); +extern void vRegTest1Task( void * pvParameters ); +extern void vRegTest2Task( void * pvParameters ); /* * The hardware only has a single LED. Simply toggle it. @@ -139,170 +139,174 @@ void main_full( void ); /*-----------------------------------------------------------*/ /* The following two variables are used to communicate the status of the -register check tasks to the check software timer. If the variables keep -incrementing, then the register check tasks have not discovered any errors. If -a variable stops incrementing, then an error has been found. */ + * register check tasks to the check software timer. If the variables keep + * incrementing, then the register check tasks have 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 ) { -TimerHandle_t xTimer = NULL; -unsigned long ulTimer; -const unsigned long ulTimersToCreate = 3L; + TimerHandle_t xTimer = NULL; + unsigned long ulTimer; + const unsigned long ulTimersToCreate = 3L; + /* The register test tasks are asm functions that don't use a stack. The -stack allocated just has to be large enough to hold the task context, and -for the additional required for the stack overflow checking to work (if -configured). */ -const size_t xRegTestStackSize = 25U; - - /* Create the standard demo tasks */ - vCreateBlockTimeTasks(); - vStartCountingSemaphoreTasks(); - vStartRecursiveMutexTasks(); - vStartDynamicPriorityTasks(); - - /* Create the register test tasks as described at the top of this file. - These are naked functions that don't use any stack. A stack still has - to be allocated to hold the task context. */ - xTaskCreate( vRegTest1Task, /* Function that implements the task. */ - "Reg1", /* Text name of the task. */ - xRegTestStackSize, /* Stack allocated to the task. */ - NULL, /* The task parameter is not used. */ - tskIDLE_PRIORITY, /* The priority to assign to the task. */ - NULL ); /* Don't receive a handle back, it is not needed. */ - - xTaskCreate( vRegTest2Task, /* Function that implements the task. */ - "Reg2", /* Text name of the task. */ - xRegTestStackSize, /* Stack allocated to the task. */ - NULL, /* The task parameter is not used. */ - tskIDLE_PRIORITY, /* The priority to assign to the task. */ - NULL ); /* Don't receive a handle back, it is not needed. */ - - /* Create the three flash timers. */ - for( ulTimer = 0UL; ulTimer < ulTimersToCreate; ulTimer++ ) - { - xTimer = xTimerCreate( "FlashTimer", /* A text name, purely to help debugging. */ - ( mainFLASH_TIMER_BASE_RATE * ( ulTimer + 1UL ) ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) ulTimer, /* The ID is used to hold the number of the LED that will be flashed. */ - prvFlashTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - if( xTimer != NULL ) - { - xTimerStart( xTimer, mainDONT_BLOCK ); - } - } - - /* Create the software timer that performs the 'check' functionality, - as described at the top of this file. */ - xTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ - ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - /* If the software timer was created successfully, start it. It won't - actually start running until the scheduler starts. A block time of - zero is used in this call, although any value could be used as the block - time will be ignored because the scheduler has not started yet. */ - if( xTimer != NULL ) - { - xTimerStart( xTimer, mainDONT_BLOCK ); - } - - /* Start the kernel. From here on, only tasks and interrupts will run. */ - 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 insufficient FreeRTOS heap memory available for the idle and/or timer - tasks to be created. See the memory management section on the FreeRTOS web - site, or the FreeRTOS tutorial books for more details. */ - for( ;; ); + * stack allocated just has to be large enough to hold the task context, and + * for the additional required for the stack overflow checking to work (if + * configured). */ + const size_t xRegTestStackSize = 25U; + + /* Create the standard demo tasks */ + vCreateBlockTimeTasks(); + vStartCountingSemaphoreTasks(); + vStartRecursiveMutexTasks(); + vStartDynamicPriorityTasks(); + + /* Create the register test tasks as described at the top of this file. + * These are naked functions that don't use any stack. A stack still has + * to be allocated to hold the task context. */ + xTaskCreate( vRegTest1Task, /* Function that implements the task. */ + "Reg1", /* Text name of the task. */ + xRegTestStackSize, /* Stack allocated to the task. */ + NULL, /* The task parameter is not used. */ + tskIDLE_PRIORITY, /* The priority to assign to the task. */ + NULL ); /* Don't receive a handle back, it is not needed. */ + + xTaskCreate( vRegTest2Task, /* Function that implements the task. */ + "Reg2", /* Text name of the task. */ + xRegTestStackSize, /* Stack allocated to the task. */ + NULL, /* The task parameter is not used. */ + tskIDLE_PRIORITY, /* The priority to assign to the task. */ + NULL ); /* Don't receive a handle back, it is not needed. */ + + /* Create the three flash timers. */ + for( ulTimer = 0UL; ulTimer < ulTimersToCreate; ulTimer++ ) + { + xTimer = xTimerCreate( "FlashTimer", /* A text name, purely to help debugging. */ + ( mainFLASH_TIMER_BASE_RATE * ( ulTimer + 1UL ) ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) ulTimer, /* The ID is used to hold the number of the LED that will be flashed. */ + prvFlashTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + if( xTimer != NULL ) + { + xTimerStart( xTimer, mainDONT_BLOCK ); + } + } + + /* Create the software timer that performs the 'check' functionality, + * as described at the top of this file. */ + xTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ + ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + /* If the software timer was created successfully, start it. It won't + * actually start running until the scheduler starts. A block time of + * zero is used in this call, although any value could be used as the block + * time will be ignored because the scheduler has not started yet. */ + if( xTimer != NULL ) + { + xTimerStart( xTimer, mainDONT_BLOCK ); + } + + /* Start the kernel. From here on, only tasks and interrupts will run. */ + 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 insufficient FreeRTOS heap memory available for the idle and/or timer + * tasks to be created. See the memory management section on the FreeRTOS web + * site, or the FreeRTOS tutorial books for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ /* See the description at the top of this file. */ static void prvCheckTimerCallback( TimerHandle_t xTimer ) { -static long lChangedTimerPeriodAlready = pdFALSE; -static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; -unsigned long ulErrorFound = pdFALSE; - - /* Check all the demo and test tasks to ensure that they are all still - running, and that none have detected an error. */ - if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) - { - ulErrorFound |= ( 0x01UL << 0UL ); - } - - if( xAreBlockTimeTestTasksStillRunning() != pdPASS ) - { - ulErrorFound |= ( 0x01UL << 1UL ); - } - - if( xAreCountingSemaphoreTasksStillRunning() != pdPASS ) - { - ulErrorFound |= ( 0x01UL << 2UL ); - } - - if( xAreRecursiveMutexTasksStillRunning() != pdPASS ) - { - ulErrorFound |= ( 0x01UL << 3UL ); - } - - /* Check that the register test 1 task is still running. */ - if( ulLastRegTest1Value == ulRegTest1LoopCounter ) - { - ulErrorFound |= ( 0x01UL << 4UL ); - } - ulLastRegTest1Value = ulRegTest1LoopCounter; - - /* Check that the register test 2 task is still running. */ - if( ulLastRegTest2Value == ulRegTest2LoopCounter ) - { - ulErrorFound |= ( 0x01UL << 5UL ); - } - ulLastRegTest2Value = ulRegTest2LoopCounter; - - /* Toggle the check LED to give an indication of the system status. If - the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then - everything is ok. A faster toggle indicates an error. */ - vParTestToggleLED( mainCHECK_LED ); - - /* Have any errors been latched in ulErrorFound? If so, shorten the - period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. - This will result in an increase in the rate at which mainCHECK_LED - toggles. */ - if( ulErrorFound != pdFALSE ) - { - if( lChangedTimerPeriodAlready == pdFALSE ) - { - lChangedTimerPeriodAlready = pdTRUE; - - /* This call to xTimerChangePeriod() uses a zero block time. - Functions called from inside of a timer callback function must - *never* attempt to block. */ - xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); - } - } + static long lChangedTimerPeriodAlready = pdFALSE; + static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; + unsigned long ulErrorFound = pdFALSE; + + /* Check all the demo and test tasks to ensure that they are all still + * running, and that none have detected an error. */ + if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) + { + ulErrorFound |= ( 0x01UL << 0UL ); + } + + if( xAreBlockTimeTestTasksStillRunning() != pdPASS ) + { + ulErrorFound |= ( 0x01UL << 1UL ); + } + + if( xAreCountingSemaphoreTasksStillRunning() != pdPASS ) + { + ulErrorFound |= ( 0x01UL << 2UL ); + } + + if( xAreRecursiveMutexTasksStillRunning() != pdPASS ) + { + ulErrorFound |= ( 0x01UL << 3UL ); + } + + /* Check that the register test 1 task is still running. */ + if( ulLastRegTest1Value == ulRegTest1LoopCounter ) + { + ulErrorFound |= ( 0x01UL << 4UL ); + } + + ulLastRegTest1Value = ulRegTest1LoopCounter; + + /* Check that the register test 2 task is still running. */ + if( ulLastRegTest2Value == ulRegTest2LoopCounter ) + { + ulErrorFound |= ( 0x01UL << 5UL ); + } + + ulLastRegTest2Value = ulRegTest2LoopCounter; + + /* Toggle the check LED to give an indication of the system status. If + * the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then + * everything is ok. A faster toggle indicates an error. */ + vParTestToggleLED( mainCHECK_LED ); + + /* Have any errors been latched in ulErrorFound? If so, shorten the + * period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. + * This will result in an increase in the rate at which mainCHECK_LED + * toggles. */ + if( ulErrorFound != pdFALSE ) + { + if( lChangedTimerPeriodAlready == pdFALSE ) + { + lChangedTimerPeriodAlready = pdTRUE; + + /* This call to xTimerChangePeriod() uses a zero block time. + * Functions called from inside of a timer callback function must + * never* attempt to block. */ + xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); + } + } } /*-----------------------------------------------------------*/ static void prvFlashTimerCallback( TimerHandle_t xTimer ) { -unsigned long ulLED; + unsigned long ulLED; - /* This callback function is assigned to three separate software timers. - Each timer toggles a different LED. Obtain the number of the LED that - this timer is toggling. */ - ulLED = ( unsigned long ) pvTimerGetTimerID( xTimer ); + /* This callback function is assigned to three separate software timers. + * Each timer toggles a different LED. Obtain the number of the LED that + * this timer is toggling. */ + ulLED = ( unsigned long ) pvTimerGetTimerID( xTimer ); - /* Toggle the LED. */ - vParTestToggleLED( ulLED ); + /* Toggle the LED. */ + vParTestToggleLED( ulLED ); } - diff --git a/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/main.c b/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/main.c index 8ef2e5d12d8..49f2293565b 100644 --- a/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/main.c +++ b/FreeRTOS/Demo/CORTEX_M0_STM32F0518_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -52,8 +52,8 @@ #include "ParTest.h" /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 /*-----------------------------------------------------------*/ @@ -65,7 +65,7 @@ or 0 to run the more comprehensive test and demo application. */ static void prvSetupHardware( void ); /* 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. */ extern void main_blinky( void ); extern void main_full( void ); @@ -73,113 +73,116 @@ extern void main_full( void ); int main( void ) { - /* Prepare the hardware to run this demo. */ - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* Prepare the hardware to run this demo. */ + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - vParTestInitialise(); + vParTestInitialise(); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* This function will be called by each tick interrupt if - configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - added here, but the tick hook is called from an interrupt context, so - code must not attempt to block, and only the interrupt safe FreeRTOS API - functions can be used (those that end in FromISR()). */ + /* This function will be called by each tick interrupt if + * configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + * added here, but the tick hook is called from an interrupt context, so + * code must not attempt to block, and only the interrupt safe FreeRTOS API + * functions can be used (those that end in FromISR()). */ } /*-----------------------------------------------------------*/ #ifdef JUST_AN_EXAMPLE_ISR -void Dummy_IRQHandler(void) -{ -long lHigherPriorityTaskWoken = pdFALSE; - - /* Clear the interrupt if necessary. */ - Dummy_ClearITPendingBit(); - - /* This interrupt does nothing more than demonstrate how to synchronise a - task with an interrupt. A semaphore is used for this purpose. Note - lHigherPriorityTaskWoken is initialised to zero. Only FreeRTOS API functions - that end in "FromISR" can be called from an ISR. */ - xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken ); - - /* If there was a task that was blocked on the semaphore, and giving the - semaphore caused the task to unblock, and the unblocked task has a priority - higher than the current Running state task (the task that this interrupt - interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE - internally within xSemaphoreGiveFromISR(). Passing pdTRUE into the - portEND_SWITCHING_ISR() macro will result in a context switch being pended to - ensure this interrupt returns directly to the unblocked, higher priority, - task. Passing pdFALSE into portEND_SWITCHING_ISR() has no effect. */ - portEND_SWITCHING_ISR( lHigherPriorityTaskWoken ); -} + void Dummy_IRQHandler( void ) + { + long lHigherPriorityTaskWoken = pdFALSE; + + /* Clear the interrupt if necessary. */ + Dummy_ClearITPendingBit(); + + /* This interrupt does nothing more than demonstrate how to synchronise a + * task with an interrupt. A semaphore is used for this purpose. Note + * lHigherPriorityTaskWoken is initialised to zero. Only FreeRTOS API functions + * that end in "FromISR" can be called from an ISR. */ + xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken ); + + /* If there was a task that was blocked on the semaphore, and giving the + * semaphore caused the task to unblock, and the unblocked task has a priority + * higher than the current Running state task (the task that this interrupt + * interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE + * internally within xSemaphoreGiveFromISR(). Passing pdTRUE into the + * portEND_SWITCHING_ISR() macro will result in a context switch being pended to + * ensure this interrupt returns directly to the unblocked, higher priority, + * task. Passing pdFALSE into portEND_SWITCHING_ISR() has no effect. */ + portEND_SWITCHING_ISR( lHigherPriorityTaskWoken ); + } #endif /* JUST_AN_EXAMPLE_ISR */ - - - - diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/FreeRTOSConfig.h index a33a6d57252..d6e3ed498dc 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/GCC_Specific/RegTest.c b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/GCC_Specific/RegTest.c index 482e67d665c..1a723787285 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/GCC_Specific/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/GCC_Specific/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/Keil_Specific/RegTest.c b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/Keil_Specific/RegTest.c index 9420227f298..f7d1be225a3 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/Keil_Specific/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/Keil_Specific/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main.c b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main.c index 6776e320967..c0c1f176245 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main.c +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -52,9 +52,9 @@ #include "task.h" /* Hardware register addresses. */ -#define mainVTOR ( * ( uint32_t * ) 0xE000ED08 ) -#define mainNVIC_AUX_ACTLR ( * ( uint32_t * ) 0xE000E008 ) -#define mainEC_INTERRUPT_CONTROL ( * ( volatile uint32_t * ) 0x4000FC18 ) +#define mainVTOR ( *( uint32_t * ) 0xE000ED08 ) +#define mainNVIC_AUX_ACTLR ( *( uint32_t * ) 0xE000E008 ) +#define mainEC_INTERRUPT_CONTROL ( *( volatile uint32_t * ) 0x4000FC18 ) /*-----------------------------------------------------------*/ @@ -67,193 +67,197 @@ static void prvSetupHardware( void ); * main_low_power() is used when configCREATE_LOW_POWER_DEMO is set to 1. * main_full() is used when configCREATE_LOW_POWER_DEMO is set to 0. */ -#if( configCREATE_LOW_POWER_DEMO == 1 ) +#if ( configCREATE_LOW_POWER_DEMO == 1 ) - extern void main_low_power( void ); + extern void main_low_power( void ); #else - extern void main_full( void ); + extern void main_full( void ); - /* Some of the tests and examples executed as part of the full demo make use - of the tick hook to call API functions from an interrupt context. */ - extern void vFullDemoTickHook( void ); +/* Some of the tests and examples executed as part of the full demo make use + * of the tick hook to call API functions from an interrupt context. */ + extern void vFullDemoTickHook( void ); #endif /* #if configCREATE_LOW_POWER_DEMO == 1 */ /* Prototypes for the standard FreeRTOS callback/hook functions implemented -within this file. */ + * within this file. */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /*-----------------------------------------------------------*/ /* The variable that is incremented to represent each LED toggle. On the -clicker hardware the LED state is set to the value of the least significant bit -of this variable. On other hardware, where an LED is not used, the LED just -keeps a count of the number of times the LED would otherwise have been toggled. -See the comments in main_low_power.c and main_full.c for information on the -expected LED toggle rate). */ + * clicker hardware the LED state is set to the value of the least significant bit + * of this variable. On other hardware, where an LED is not used, the LED just + * keeps a count of the number of times the LED would otherwise have been toggled. + * See the comments in main_low_power.c and main_full.c for information on the + * expected LED toggle rate). */ volatile uint32_t ulLED = 0; /*-----------------------------------------------------------*/ int main( void ) { - /* See http://www.freertos.org/Microchip_CEC1302_ARM_Cortex-M4F_Low_Power_Demo.html */ - - /* Configure the hardware ready to run the demo. */ - prvSetupHardware(); - - /* The configCREATE_LOW_POWER_DEMO setting is described at the top - of this file. */ - #if( configCREATE_LOW_POWER_DEMO == 1 ) - { - /* The low power demo also demonstrated aggregated interrupts, so clear - the interrupt control register to disable the alternative NVIC vectors. */ - mainEC_INTERRUPT_CONTROL = pdFALSE; - - main_low_power(); - } - #else - { - /* The full demo also demonstrated disaggregated interrupts, so set the - interrupt control register to enable the alternative NVIC vectors. */ - mainEC_INTERRUPT_CONTROL = pdTRUE; - - main_full(); - } - #endif - - /* Should not get here. */ - return 0; + /* See http://www.freertos.org/Microchip_CEC1302_ARM_Cortex-M4F_Low_Power_Demo.html */ + + /* Configure the hardware ready to run the demo. */ + prvSetupHardware(); + + /* The configCREATE_LOW_POWER_DEMO setting is described at the top + * of this file. */ + #if ( configCREATE_LOW_POWER_DEMO == 1 ) + { + /* The low power demo also demonstrated aggregated interrupts, so clear + * the interrupt control register to disable the alternative NVIC vectors. */ + mainEC_INTERRUPT_CONTROL = pdFALSE; + + main_low_power(); + } + #else + { + /* The full demo also demonstrated disaggregated interrupts, so set the + * interrupt control register to enable the alternative NVIC vectors. */ + mainEC_INTERRUPT_CONTROL = pdTRUE; + + main_full(); + } + #endif /* if ( configCREATE_LOW_POWER_DEMO == 1 ) */ + + /* Should not get here. */ + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { -extern void system_set_ec_clock( void ); -extern unsigned long __Vectors[]; + extern void system_set_ec_clock( void ); + extern unsigned long __Vectors[]; - /* Disable M4 write buffer: fix CEC1302 hardware bug. */ - mainNVIC_AUX_ACTLR |= 0x07; + /* Disable M4 write buffer: fix CEC1302 hardware bug. */ + mainNVIC_AUX_ACTLR |= 0x07; - system_set_ec_clock(); + system_set_ec_clock(); - /* Assuming downloading code via the debugger - so ensure the hardware - is using the vector table downloaded with the application. */ - mainVTOR = ( uint32_t ) __Vectors; + /* Assuming downloading code via the debugger - so ensure the hardware + * is using the vector table downloaded with the application. */ + mainVTOR = ( uint32_t ) __Vectors; } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ - - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ + + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; + ( void ) pcTaskName; + ( void ) pxTask; - /* 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. */ + /* 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. */ - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile size_t xFreeHeapSpace; - - /* This is just a trivial example of an idle hook. It is called on each - cycle of the idle task. It must *NOT* attempt to block. In this case the - idle task just queries the amount of FreeRTOS heap that remains. See the - memory management section on the http://www.FreeRTOS.org web site for memory - management options. If there is a lot of heap memory free then the - configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up - RAM. */ - xFreeHeapSpace = xPortGetFreeHeapSize(); - - /* Remove compiler warning about xFreeHeapSpace being set but never used. */ - ( void ) xFreeHeapSpace; + volatile size_t xFreeHeapSpace; + + /* This is just a trivial example of an idle hook. It is called on each + * cycle of the idle task. It must *NOT* attempt to block. In this case the + * idle task just queries the amount of FreeRTOS heap that remains. See the + * memory management section on the http://www.FreeRTOS.org web site for memory + * management options. If there is a lot of heap memory free then the + * configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up + * RAM. */ + xFreeHeapSpace = xPortGetFreeHeapSize(); + + /* Remove compiler warning about xFreeHeapSpace being set but never used. */ + ( void ) xFreeHeapSpace; } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* The full demo includes tests that run from the tick hook. */ - #if( configCREATE_LOW_POWER_DEMO == 0 ) - { - /* Some of the tests and demo tasks executed by the full demo include - interaction from an interrupt - for which the tick interrupt is used - via the tick hook function. */ - vFullDemoTickHook(); - } - #endif + /* The full demo includes tests that run from the tick hook. */ + #if ( configCREATE_LOW_POWER_DEMO == 0 ) + { + /* Some of the tests and demo tasks executed by the full demo include + * interaction from an interrupt - for which the tick interrupt is used + * via the tick hook function. */ + vFullDemoTickHook(); + } + #endif } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an -implementation of vApplicationGetIdleTaskMemory() to provide the memory that is -used by the Idle task. */ -void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) + * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is + * used by the Idle task. */ +void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, + StackType_t ** ppxIdleTaskStackBuffer, + uint32_t * pulIdleTaskStackSize ) { /* If the buffers to be provided to the Idle task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xIdleTaskTCB; -static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Idle task's - state will be stored. */ - *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; - - /* Pass out the array that will be used as the Idle task's stack. */ - *ppxIdleTaskStackBuffer = uxIdleTaskStack; - - /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xIdleTaskTCB; + static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Idle task's + * state will be stored. */ + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + + /* Pass out the array that will be used as the Idle task's stack. */ + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + + /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the -application must provide an implementation of vApplicationGetTimerTaskMemory() -to provide the memory that is used by the Timer service task. */ -void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) + * application must provide an implementation of vApplicationGetTimerTaskMemory() + * to provide the memory that is used by the Timer service task. */ +void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, + StackType_t ** ppxTimerTaskStackBuffer, + uint32_t * pulTimerTaskStackSize ) { /* If the buffers to be provided to the Timer task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xTimerTaskTCB; -static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Timer - task's state will be stored. */ - *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; - - /* Pass out the array that will be used as the Timer task's stack. */ - *ppxTimerTaskStackBuffer = uxTimerTaskStack; - - /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xTimerTaskTCB; + static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Timer + * task's state will be stored. */ + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + + /* Pass out the array that will be used as the Timer task's stack. */ + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + + /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } - - diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_full/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_full/IntQueueTimer.c index 9b85da82024..346b13f56dc 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_full/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_full/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_full/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_full/IntQueueTimer.h index 76d462f796c..8f1a766766e 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_full/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_full/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_full/main_full.c b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_full/main_full.c index 3566e3592ca..8a2b05a68d9 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_full/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_full/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_low_power/low_power_tick_config.c b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_low_power/low_power_tick_config.c index f8c47508a2e..feee7668cd2 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_low_power/low_power_tick_config.c +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_low_power/low_power_tick_config.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_low_power/main_low_power.c b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_low_power/main_low_power.c index 0d0b4d3c39a..718844f39a5 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_low_power/main_low_power.c +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_low_power/main_low_power.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/FreeRTOSConfig.h index da54c2eac91..866bc2dbbe8 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/MikroC_Specific/RegTest.c b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/MikroC_Specific/RegTest.c index bc559cbf0ba..e3b8362adae 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/MikroC_Specific/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/MikroC_Specific/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main.c b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main.c index 15bda9aab3e..9ccd54252e0 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main.c +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -47,11 +47,11 @@ #include "task.h" /* Hardware register addresses and value. */ -#define mainVTOR ( * ( uint32_t * ) 0xE000ED08 ) -#define mainNVIC_AUX_ACTLR ( * ( uint32_t * ) 0xE000E008 ) -#define mainEC_INTERRUPT_CONTROL ( * ( volatile uint32_t * ) 0x4000FC18 ) -#define mainMMCR_PCR_PROCESSOR_CLOCK_CONTROL ( * ( volatile uint32_t * )( 0x40080120 ) ) -#define mainCPU_CLOCK_DIVIDER 1 +#define mainVTOR ( *( uint32_t * ) 0xE000ED08 ) +#define mainNVIC_AUX_ACTLR ( *( uint32_t * ) 0xE000E008 ) +#define mainEC_INTERRUPT_CONTROL ( *( volatile uint32_t * ) 0x4000FC18 ) +#define mainMMCR_PCR_PROCESSOR_CLOCK_CONTROL ( *( volatile uint32_t * ) ( 0x40080120 ) ) +#define mainCPU_CLOCK_DIVIDER 1 /*-----------------------------------------------------------*/ @@ -64,186 +64,190 @@ static void prvSetupHardware( void ); * main_low_power() is used when configCREATE_LOW_POWER_DEMO is set to 1. * main_full() is used when configCREATE_LOW_POWER_DEMO is set to 0. */ -#if( configCREATE_LOW_POWER_DEMO == 1 ) +#if ( configCREATE_LOW_POWER_DEMO == 1 ) - extern void main_low_power( void ); + extern void main_low_power( void ); #else - extern void main_full( void ); + extern void main_full( void ); - /* Some of the tests and examples executed as part of the full demo make use - of the tick hook to call API functions from an interrupt context. */ - extern void vFullDemoTickHook( void ); +/* Some of the tests and examples executed as part of the full demo make use + * of the tick hook to call API functions from an interrupt context. */ + extern void vFullDemoTickHook( void ); #endif /* #if configCREATE_LOW_POWER_DEMO == 1 */ /* Prototypes for the standard FreeRTOS callback/hook functions implemented -within this file. */ + * within this file. */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /*-----------------------------------------------------------*/ /* The variable that is incremented to represent each LED toggle. On the -clicker hardware the LED state is set to the value of the least significant bit -of this variable. On other hardware, where an LED is not used, the LED just -keeps a count of the number of times the LED would otherwise have been toggled. -See the comments in main_low_power.c and main_full.c for information on the -expected LED toggle rate). */ + * clicker hardware the LED state is set to the value of the least significant bit + * of this variable. On other hardware, where an LED is not used, the LED just + * keeps a count of the number of times the LED would otherwise have been toggled. + * See the comments in main_low_power.c and main_full.c for information on the + * expected LED toggle rate). */ volatile uint32_t ulLED = 0; /*-----------------------------------------------------------*/ int main( void ) { - /* Configure the hardware ready to run the demo. */ - prvSetupHardware(); - - /* The configCREATE_LOW_POWER_DEMO setting is described at the top - of this file. */ - #if( configCREATE_LOW_POWER_DEMO == 1 ) - { - main_low_power(); - } - #else - { - main_full(); - } - #endif - - /* Should not get here. */ - return 0; + /* Configure the hardware ready to run the demo. */ + prvSetupHardware(); + + /* The configCREATE_LOW_POWER_DEMO setting is described at the top + * of this file. */ + #if ( configCREATE_LOW_POWER_DEMO == 1 ) + { + main_low_power(); + } + #else + { + main_full(); + } + #endif + + /* Should not get here. */ + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Disable M4 write buffer: fix MEC1322 hardware bug. */ - mainNVIC_AUX_ACTLR |= 0x07; + /* Disable M4 write buffer: fix MEC1322 hardware bug. */ + mainNVIC_AUX_ACTLR |= 0x07; - /* Set divider to 8 for 8MHz operation, MCLK in silicon chip is 64MHz, - CPU=MCLK/Divider. */ - mainMMCR_PCR_PROCESSOR_CLOCK_CONTROL = mainCPU_CLOCK_DIVIDER; + /* Set divider to 8 for 8MHz operation, MCLK in silicon chip is 64MHz, + * CPU=MCLK/Divider. */ + mainMMCR_PCR_PROCESSOR_CLOCK_CONTROL = mainCPU_CLOCK_DIVIDER; - /* Enable alternative NVIC vectors. */ - mainEC_INTERRUPT_CONTROL = pdTRUE; + /* Enable alternative NVIC vectors. */ + mainEC_INTERRUPT_CONTROL = pdTRUE; - /* Initialise the LED on the clicker board. */ - GPIO_Digital_Output( &GPIO_PORT_150_157, _GPIO_PINMASK_4 | _GPIO_PINMASK_5 ); - GPIO_OUTPUT_PIN_154_bit = 0; - GPIO_OUTPUT_PIN_155_bit = 0; + /* Initialise the LED on the clicker board. */ + GPIO_Digital_Output( &GPIO_PORT_150_157, _GPIO_PINMASK_4 | _GPIO_PINMASK_5 ); + GPIO_OUTPUT_PIN_154_bit = 0; + GPIO_OUTPUT_PIN_155_bit = 0; } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ - - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ + + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; + ( void ) pcTaskName; + ( void ) pxTask; - /* 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. */ + /* 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. */ - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile size_t xFreeHeapSpace; - - /* This is just a trivial example of an idle hook. It is called on each - cycle of the idle task. It must *NOT* attempt to block. In this case the - idle task just queries the amount of FreeRTOS heap that remains. See the - memory management section on the http://www.FreeRTOS.org web site for memory - management options. If there is a lot of heap memory free then the - configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up - RAM. */ - xFreeHeapSpace = xPortGetFreeHeapSize(); - - /* Remove compiler warning about xFreeHeapSpace being set but never used. */ - ( void ) xFreeHeapSpace; + volatile size_t xFreeHeapSpace; + + /* This is just a trivial example of an idle hook. It is called on each + * cycle of the idle task. It must *NOT* attempt to block. In this case the + * idle task just queries the amount of FreeRTOS heap that remains. See the + * memory management section on the http://www.FreeRTOS.org web site for memory + * management options. If there is a lot of heap memory free then the + * configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up + * RAM. */ + xFreeHeapSpace = xPortGetFreeHeapSize(); + + /* Remove compiler warning about xFreeHeapSpace being set but never used. */ + ( void ) xFreeHeapSpace; } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* The full demo includes tests that run from the tick hook. */ - #if( configCREATE_LOW_POWER_DEMO == 0 ) - { - /* Some of the tests and demo tasks executed by the full demo include - interaction from an interrupt - for which the tick interrupt is used - via the tick hook function. */ - vFullDemoTickHook(); - } - #endif + /* The full demo includes tests that run from the tick hook. */ + #if ( configCREATE_LOW_POWER_DEMO == 0 ) + { + /* Some of the tests and demo tasks executed by the full demo include + * interaction from an interrupt - for which the tick interrupt is used + * via the tick hook function. */ + vFullDemoTickHook(); + } + #endif } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an -implementation of vApplicationGetIdleTaskMemory() to provide the memory that is -used by the Idle task. */ -void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) + * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is + * used by the Idle task. */ +void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, + StackType_t ** ppxIdleTaskStackBuffer, + uint32_t * pulIdleTaskStackSize ) { /* If the buffers to be provided to the Idle task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xIdleTaskTCB; -static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Idle task's - state will be stored. */ - *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; - - /* Pass out the array that will be used as the Idle task's stack. */ - *ppxIdleTaskStackBuffer = uxIdleTaskStack; - - /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xIdleTaskTCB; + static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Idle task's + * state will be stored. */ + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + + /* Pass out the array that will be used as the Idle task's stack. */ + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + + /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the -application must provide an implementation of vApplicationGetTimerTaskMemory() -to provide the memory that is used by the Timer service task. */ -void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) + * application must provide an implementation of vApplicationGetTimerTaskMemory() + * to provide the memory that is used by the Timer service task. */ +void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, + StackType_t ** ppxTimerTaskStackBuffer, + uint32_t * pulTimerTaskStackSize ) { /* If the buffers to be provided to the Timer task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xTimerTaskTCB; -static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Timer - task's state will be stored. */ - *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; - - /* Pass out the array that will be used as the Timer task's stack. */ - *ppxTimerTaskStackBuffer = uxTimerTaskStack; - - /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xTimerTaskTCB; + static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Timer + * task's state will be stored. */ + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + + /* Pass out the array that will be used as the Timer task's stack. */ + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + + /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } - - diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_full/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_full/IntQueueTimer.c index 99006b97198..8ea7f5c99d8 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_full/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_full/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_full/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_full/IntQueueTimer.h index 76d462f796c..8f1a766766e 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_full/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_full/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_full/main_full.c b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_full/main_full.c index 88fe4e1438f..5d48a47f8c8 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_full/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_full/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_low_power/low_power_tick_config.c b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_low_power/low_power_tick_config.c index e21486bdb3c..c4ab6a97e9d 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_low_power/low_power_tick_config.c +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_low_power/low_power_tick_config.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_low_power/main_low_power.c b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_low_power/main_low_power.c index e4aa0a84808..a1c47d5a02f 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_low_power/main_low_power.c +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC1302_MikroC/main_low_power/main_low_power.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC_MEC_17xx_51xx_Keil_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M4F_CEC_MEC_17xx_51xx_Keil_GCC/FreeRTOSConfig.h index 92c3851a670..29b7c47de25 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC_MEC_17xx_51xx_Keil_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC_MEC_17xx_51xx_Keil_GCC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_CEC_MEC_17xx_51xx_Keil_GCC/main.c b/FreeRTOS/Demo/CORTEX_M4F_CEC_MEC_17xx_51xx_Keil_GCC/main.c index 309c3a164da..626794a19e3 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_CEC_MEC_17xx_51xx_Keil_GCC/main.c +++ b/FreeRTOS/Demo/CORTEX_M4F_CEC_MEC_17xx_51xx_Keil_GCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -44,17 +44,17 @@ #include "queue.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( pdMS_TO_TICKS( 1000UL ) ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( pdMS_TO_TICKS( 1000UL ) ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH_IN_ITEMS ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH_IN_ITEMS ( 1 ) /*-----------------------------------------------------------*/ @@ -67,20 +67,20 @@ static void prvSetupHardware( void ); * Simple routine to print a string to ITM for viewing in the Keil serial debug * viewer. */ -static void prvITMPrintString( const char *pcString ); +static void prvITMPrintString( const char * pcString ); /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /*-----------------------------------------------------------*/ /* configSUPPORT_STATIC_ALLOCATION is 1 and configSUPPORT_DYNAMIC_ALLOCATION is -0 so the queue structure and the queue storage area can only be statically -allocated. See http://TBD for more information. -The queue storage area is dimensioned to hold just one 32-bit value. */ + * 0 so the queue structure and the queue storage area can only be statically + * allocated. See http://TBD for more information. + * The queue storage area is dimensioned to hold just one 32-bit value. */ static StaticQueue_t xStaticQueue; static uint8_t ucQueueStorageArea[ mainQUEUE_LENGTH_IN_ITEMS * sizeof( uint32_t ) ]; @@ -88,8 +88,8 @@ static uint8_t ucQueueStorageArea[ mainQUEUE_LENGTH_IN_ITEMS * sizeof( uint32_t static QueueHandle_t xQueue = NULL; /* configSUPPORT_STATIC_ALLOCATION is 1 and configSUPPORT_DYNAMIC_ALLOCATION is -0 so the task structure and the stacks used by the tasks can only be statically -allocated. See http://TBD for more information. */ + * 0 so the task structure and the stacks used by the tasks can only be statically + * allocated. See http://TBD for more information. */ StaticTask_t xRxTCBBuffer, xTxTCBBuffer; static StackType_t uxRxStackBuffer[ configMINIMAL_STACK_SIZE ], uxTxStackBuffer[ configMINIMAL_STACK_SIZE ]; @@ -97,170 +97,179 @@ static StackType_t uxRxStackBuffer[ configMINIMAL_STACK_SIZE ], uxTxStackBuffer[ int main( void ) { - /* Set up the hardware ready to run the demo. */ - prvSetupHardware(); - prvITMPrintString( "Starting\r\n" ); - - /* Create the queue. xQueueCreateStatic() has two more parameters than the - xQueueCreate() function. The first new parameter is a pointer to the - pre-allocated queue storage area. The second new parameter is a pointer to - the StaticQueue_t structure that will hold the queue state information in - an anonymous way. */ - xQueue = xQueueCreateStatic( mainQUEUE_LENGTH_IN_ITEMS, /* The maximum number of items the queue can hold. */ - sizeof( uint32_t ), /* The size of each item. */ - ucQueueStorageArea, /* The buffer used to hold items within the queue. */ - &xStaticQueue ); /* The static queue structure that will hold the state of the queue. */ - - /* Create the two tasks as described in the comments at the top of this - file. */ - xTaskCreateStatic( prvQueueReceiveTask, /* Function that implements the task. */ - "Rx", /* Human readable name for the task. */ - configMINIMAL_STACK_SIZE, /* Task's stack size, in words (not bytes!). */ - NULL, /* Parameter to pass into the task. */ - mainQUEUE_RECEIVE_TASK_PRIORITY,/* The priority of the task. */ - &( uxRxStackBuffer[ 0 ] ), /* The buffer to use as the task's stack. */ - &xRxTCBBuffer ); /* The variable that will hold that task's TCB. */ - - xTaskCreateStatic( prvQueueSendTask, /* Function that implements the task. */ - "Tx", /* Human readable name for the task. */ - configMINIMAL_STACK_SIZE, /* Task's stack size, in words (not bytes!). */ - NULL, /* Parameter to pass into the task. */ - mainQUEUE_SEND_TASK_PRIORITY, /* The priority of the task. */ - &( uxTxStackBuffer[ 0 ] ), /* The buffer to use as the task's stack. */ - &xTxTCBBuffer ); /* The variable that will hold that task's TCB. */ - - /* Start the scheduler. */ - vTaskStartScheduler(); - - /* If dynamic memory allocation was used then the following code line would - be reached if there was insufficient heap memory available to create either - the timer or idle tasks. As this project is using static memory allocation - then the following line should never be reached. */ - for( ;; ); + /* Set up the hardware ready to run the demo. */ + prvSetupHardware(); + prvITMPrintString( "Starting\r\n" ); + + /* Create the queue. xQueueCreateStatic() has two more parameters than the + * xQueueCreate() function. The first new parameter is a pointer to the + * pre-allocated queue storage area. The second new parameter is a pointer to + * the StaticQueue_t structure that will hold the queue state information in + * an anonymous way. */ + xQueue = xQueueCreateStatic( mainQUEUE_LENGTH_IN_ITEMS, /* The maximum number of items the queue can hold. */ + sizeof( uint32_t ), /* The size of each item. */ + ucQueueStorageArea, /* The buffer used to hold items within the queue. */ + &xStaticQueue ); /* The static queue structure that will hold the state of the queue. */ + + /* Create the two tasks as described in the comments at the top of this + * file. */ + xTaskCreateStatic( prvQueueReceiveTask, /* Function that implements the task. */ + "Rx", /* Human readable name for the task. */ + configMINIMAL_STACK_SIZE, /* Task's stack size, in words (not bytes!). */ + NULL, /* Parameter to pass into the task. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority of the task. */ + &( uxRxStackBuffer[ 0 ] ), /* The buffer to use as the task's stack. */ + &xRxTCBBuffer ); /* The variable that will hold that task's TCB. */ + + xTaskCreateStatic( prvQueueSendTask, /* Function that implements the task. */ + "Tx", /* Human readable name for the task. */ + configMINIMAL_STACK_SIZE, /* Task's stack size, in words (not bytes!). */ + NULL, /* Parameter to pass into the task. */ + mainQUEUE_SEND_TASK_PRIORITY, /* The priority of the task. */ + &( uxTxStackBuffer[ 0 ] ), /* The buffer to use as the task's stack. */ + &xTxTCBBuffer ); /* The variable that will hold that task's TCB. */ + + /* Start the scheduler. */ + vTaskStartScheduler(); + + /* If dynamic memory allocation was used then the following code line would + * be reached if there was insufficient heap memory available to create either + * the timer or idle tasks. As this project is using static memory allocation + * then the following line should never be reached. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, the constant used converts ticks - to ms. While in the Blocked state this task will not consume any CPU - time. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - - /* 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 - will not block - it shouldn't need to block as the queue should always - be empty at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, the constant used converts ticks + * to ms. While in the Blocked state this task will not consume any CPU + * time. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + + /* 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 + * will not block - it shouldn't need to block as the queue should always + * be empty at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it the expected value? If it is, toggle the LED. */ - if( ulReceivedValue == 100UL ) - { - /* Output a string in lieu of using an LED. */ - prvITMPrintString( "Toggle!\r\n" ); - } - } + unsigned long ulReceivedValue; + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it the expected value? If it is, toggle the LED. */ + if( ulReceivedValue == 100UL ) + { + /* Output a string in lieu of using an LED. */ + prvITMPrintString( "Toggle!\r\n" ); + } + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - SystemInit(); - SystemCoreClockUpdate(); + SystemInit(); + SystemCoreClockUpdate(); } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - /* If configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2 then this - function will automatically get called if a task overflows its stack. */ - ( void ) pxTask; - ( void ) pcTaskName; - for( ;; ); + /* If configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2 then this + * function will automatically get called if a task overflows its stack. */ + ( void ) pxTask; + ( void ) pcTaskName; + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an -implementation of vApplicationGetIdleTaskMemory() to provide the memory that is -used by the Idle task. */ -void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) + * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is + * used by the Idle task. */ +void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, + StackType_t ** ppxIdleTaskStackBuffer, + uint32_t * pulIdleTaskStackSize ) { /* If the buffers to be provided to the Idle task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xIdleTaskTCB; -static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Idle task's - state will be stored. */ - *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; - - /* Pass out the array that will be used as the Idle task's stack. */ - *ppxIdleTaskStackBuffer = uxIdleTaskStack; - - /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xIdleTaskTCB; + static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Idle task's + * state will be stored. */ + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + + /* Pass out the array that will be used as the Idle task's stack. */ + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + + /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the -application must provide an implementation of vApplicationGetTimerTaskMemory() -to provide the memory that is used by the Timer service task. */ -void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) + * application must provide an implementation of vApplicationGetTimerTaskMemory() + * to provide the memory that is used by the Timer service task. */ +void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, + StackType_t ** ppxTimerTaskStackBuffer, + uint32_t * pulTimerTaskStackSize ) { /* If the buffers to be provided to the Timer task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xTimerTaskTCB; -static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Timer - task's state will be stored. */ - *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; - - /* Pass out the array that will be used as the Timer task's stack. */ - *ppxTimerTaskStackBuffer = uxTimerTaskStack; - - /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xTimerTaskTCB; + static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Timer + * task's state will be stored. */ + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + + /* Pass out the array that will be used as the Timer task's stack. */ + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + + /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } /*-----------------------------------------------------------*/ -static void prvITMPrintString( const char *pcString ) +static void prvITMPrintString( const char * pcString ) { - while( *pcString != 0x00 ) - { - ITM_SendChar( *pcString ); - pcString++; - } + while( *pcString != 0x00 ) + { + ITM_SendChar( *pcString ); + pcString++; + } } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_GCC_Dave/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_GCC_Dave/FreeRTOSConfig.h index f70d68fbe2f..fcf6bf2e888 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_GCC_Dave/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_GCC_Dave/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_GCC_Dave/main.c b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_GCC_Dave/main.c index c88c8bd3c82..4e4d5aae3ea 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_GCC_Dave/main.c +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_GCC_Dave/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -62,8 +62,8 @@ #include "task.h" /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 /*-----------------------------------------------------------*/ @@ -83,111 +83,118 @@ extern void main_full( void ); int main( void ) { - /* Prepare the hardware to run this demo. */ - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* Prepare the hardware to run this demo. */ + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - configCONFIGURE_LED(); + configCONFIGURE_LED(); - /* Ensure all priority bits are assigned as preemption priority bits. */ - NVIC_SetPriorityGrouping( 0 ); + /* Ensure all priority bits are assigned as preemption priority bits. */ + NVIC_SetPriorityGrouping( 0 ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* This function will be called by each tick interrupt if - configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - added here, but the tick hook is called from an interrupt context, so - code must not attempt to block, and only the interrupt safe FreeRTOS API - functions can be used (those that end in FromISR()). */ + /* This function will be called by each tick interrupt if + * configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + * added here, but the tick hook is called from an interrupt context, so + * code must not attempt to block, and only the interrupt safe FreeRTOS API + * functions can be used (those that end in FromISR()). */ } /*-----------------------------------------------------------*/ #ifdef JUST_AN_EXAMPLE_ISR -void Dummy_IRQHandler(void) -{ -long lHigherPriorityTaskWoken = pdFALSE; - - /* Clear the interrupt if necessary. */ - Dummy_ClearITPendingBit(); - - /* This interrupt does nothing more than demonstrate how to synchronise a - task with an interrupt. A semaphore is used for this purpose. Note - lHigherPriorityTaskWoken is initialised to zero. */ - xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken ); - - /* If there was a task that was blocked on the semaphore, and giving the - semaphore caused the task to unblock, and the unblocked task has a priority - higher than the current Running state task (the task that this interrupt - interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE - internally within xSemaphoreGiveFromISR(). Passing pdTRUE into the - portEND_SWITCHING_ISR() macro will result in a context switch being pended to - ensure this interrupt returns directly to the unblocked, higher priority, - task. Passing pdFALSE into portEND_SWITCHING_ISR() has no effect. */ - portEND_SWITCHING_ISR( lHigherPriorityTaskWoken ); -} + void Dummy_IRQHandler( void ) + { + long lHigherPriorityTaskWoken = pdFALSE; + + /* Clear the interrupt if necessary. */ + Dummy_ClearITPendingBit(); + + /* This interrupt does nothing more than demonstrate how to synchronise a + * task with an interrupt. A semaphore is used for this purpose. Note + * lHigherPriorityTaskWoken is initialised to zero. */ + xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken ); + + /* If there was a task that was blocked on the semaphore, and giving the + * semaphore caused the task to unblock, and the unblocked task has a priority + * higher than the current Running state task (the task that this interrupt + * interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE + * internally within xSemaphoreGiveFromISR(). Passing pdTRUE into the + * portEND_SWITCHING_ISR() macro will result in a context switch being pended to + * ensure this interrupt returns directly to the unblocked, higher priority, + * task. Passing pdFALSE into portEND_SWITCHING_ISR() has no effect. */ + portEND_SWITCHING_ISR( lHigherPriorityTaskWoken ); + } #endif /* JUST_AN_EXAMPLE_ISR */ diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_GCC_Dave/main_blinky.c b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_GCC_Dave/main_blinky.c index 9840f5aad2c..5994c0986fe 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_GCC_Dave/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_GCC_Dave/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -70,30 +70,30 @@ #include "semphr.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /* Values passed to the two tasks just to check the task parameter -functionality. */ -#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) -#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) + * functionality. */ +#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) +#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * Called by main() to create the simply blinky style application if @@ -110,85 +110,86 @@ static QueueHandle_t xQueue = NULL; void main_blinky( void ) { - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); - - if( xQueue != NULL ) - { - /* Start the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ - mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ - - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Start the tasks and timer running. */ - 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 insufficient FreeRTOS heap memory available for the idle and/or - timer tasks to be created. See the memory management section on the - FreeRTOS web site for more details. */ - for( ;; ); + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); + + if( xQueue != NULL ) + { + /* Start the two tasks as described in the comments at the top of this + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ + + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Start the tasks and timer running. */ + 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 insufficient FreeRTOS heap memory available for the idle and/or + * timer tasks to be created. See the memory management section on the + * FreeRTOS web site for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, the constant used converts ticks - to ms. While in the Blocked state this task will not consume any CPU - time. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - - /* 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 - will not block - it shouldn't need to block as the queue should always - be empty at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, the constant used converts ticks + * to ms. While in the Blocked state this task will not consume any CPU + * time. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + + /* 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 + * will not block - it shouldn't need to block as the queue should always + * be empty at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it the expected value? If it is, toggle the LED. */ - if( ulReceivedValue == 100UL ) - { - configTOGGLE_LED(); - ulReceivedValue = 0U; - } - } + unsigned long ulReceivedValue; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it the expected value? If it is, toggle the LED. */ + if( ulReceivedValue == 100UL ) + { + configTOGGLE_LED(); + ulReceivedValue = 0U; + } + } } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_GCC_Dave/main_full.c b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_GCC_Dave/main_full.c index e68a8bc5213..1cc02a43909 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_GCC_Dave/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_GCC_Dave/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -83,24 +83,24 @@ #include "recmutex.h" /* Priorities for the demo application tasks. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2UL ) -#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 mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2UL ) +#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 ) /* A block time of zero simply means "don't block". */ -#define mainDONT_BLOCK ( 0UL ) +#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 mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS ) + * 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 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_PERIOD_MS constant. */ -#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) + * 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_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) /*-----------------------------------------------------------*/ @@ -114,514 +114,518 @@ static void prvCheckTimerCallback( TimerHandle_t xTimer ); * 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. */ -static void prvRegTest1Task( void *pvParameters ) __attribute__((naked)); -static void prvRegTest2Task( void *pvParameters ) __attribute__((naked)); +static void prvRegTest1Task( void * pvParameters ) __attribute__( ( naked ) ); +static void prvRegTest2Task( void * pvParameters ) __attribute__( ( naked ) ); /*-----------------------------------------------------------*/ /* The following two variables are used to communicate the status of the -register check tasks to the check software timer. If the variables keep -incrementing, then the register check tasks have not discovered any errors. If -a variable stops incrementing, then an error has been found. */ + * register check tasks to the check software timer. If the variables keep + * incrementing, then the register check tasks have 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 ) { -TimerHandle_t xCheckTimer = NULL; - - /* Start all the other standard demo/test tasks. The have not particular - functionality, but do demonstrate how to use the FreeRTOS API and test the - kernel port. */ - vStartDynamicPriorityTasks(); - vCreateBlockTimeTasks(); - vStartCountingSemaphoreTasks(); - vStartGenericQueueTasks( tskIDLE_PRIORITY ); - vStartRecursiveMutexTasks(); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartMathTasks( mainFLOP_TASK_PRIORITY ); - - /* Create the register check tasks, as described at the top of this - file */ - xTaskCreate( prvRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); - xTaskCreate( prvRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); - - /* Create the software timer that performs the 'check' functionality, - as described at the top of this file. */ - xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ - ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - if( xCheckTimer != NULL ) - { - xTimerStart( xCheckTimer, mainDONT_BLOCK ); - } - - /* 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 - insufficient FreeRTOS heap memory available for the idle and/or timer tasks - to be created. See the memory management section on the FreeRTOS web site - for more details. */ - for( ;; ); + TimerHandle_t xCheckTimer = NULL; + + /* Start all the other standard demo/test tasks. The have not particular + * functionality, but do demonstrate how to use the FreeRTOS API and test the + * kernel port. */ + vStartDynamicPriorityTasks(); + vCreateBlockTimeTasks(); + vStartCountingSemaphoreTasks(); + vStartGenericQueueTasks( tskIDLE_PRIORITY ); + vStartRecursiveMutexTasks(); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartMathTasks( mainFLOP_TASK_PRIORITY ); + + /* Create the register check tasks, as described at the top of this + * file */ + xTaskCreate( prvRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( prvRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); + + /* Create the software timer that performs the 'check' functionality, + * as described at the top of this file. */ + xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ + ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + if( xCheckTimer != NULL ) + { + xTimerStart( xCheckTimer, mainDONT_BLOCK ); + } + + /* 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 + * insufficient FreeRTOS heap memory available for the idle and/or timer tasks + * to be created. See the memory management section on the FreeRTOS web site + * for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ static void prvCheckTimerCallback( TimerHandle_t xTimer ) { -static long lChangedTimerPeriodAlready = pdFALSE; -static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; -unsigned long ulErrorFound = pdFALSE; - - /* 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( xAreMathsTaskStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - /* Check that the register test 1 task is still running. */ - if( ulLastRegTest1Value == ulRegTest1LoopCounter ) - { - ulErrorFound = pdTRUE; - } - ulLastRegTest1Value = ulRegTest1LoopCounter; - - /* Check that the register test 2 task is still running. */ - if( ulLastRegTest2Value == ulRegTest2LoopCounter ) - { - ulErrorFound = pdTRUE; - } - ulLastRegTest2Value = ulRegTest2LoopCounter; - - /* Toggle the check LED to give an indication of the system status. If - the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then - everything is ok. A faster toggle indicates an error. */ - configTOGGLE_LED(); - - /* Have any errors been latch in ulErrorFound? If so, shorten the - period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. - This will result in an increase in the rate at which mainCHECK_LED - toggles. */ - if( ulErrorFound != pdFALSE ) - { - if( lChangedTimerPeriodAlready == pdFALSE ) - { - lChangedTimerPeriodAlready = pdTRUE; - - /* This call to xTimerChangePeriod() uses a zero block time. - Functions called from inside of a timer callback function must - *never* attempt to block. */ - xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); - } - } + static long lChangedTimerPeriodAlready = pdFALSE; + static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; + unsigned long ulErrorFound = pdFALSE; + + /* 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( xAreMathsTaskStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + /* Check that the register test 1 task is still running. */ + if( ulLastRegTest1Value == ulRegTest1LoopCounter ) + { + ulErrorFound = pdTRUE; + } + + ulLastRegTest1Value = ulRegTest1LoopCounter; + + /* Check that the register test 2 task is still running. */ + if( ulLastRegTest2Value == ulRegTest2LoopCounter ) + { + ulErrorFound = pdTRUE; + } + + ulLastRegTest2Value = ulRegTest2LoopCounter; + + /* Toggle the check LED to give an indication of the system status. If + * the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then + * everything is ok. A faster toggle indicates an error. */ + configTOGGLE_LED(); + + /* Have any errors been latch in ulErrorFound? If so, shorten the + * period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. + * This will result in an increase in the rate at which mainCHECK_LED + * toggles. */ + if( ulErrorFound != pdFALSE ) + { + if( lChangedTimerPeriodAlready == pdFALSE ) + { + lChangedTimerPeriodAlready = pdTRUE; + + /* This call to xTimerChangePeriod() uses a zero block time. + * Functions called from inside of a timer callback function must + * never* attempt to block. */ + xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); + } + } } /*-----------------------------------------------------------*/ /* This is a naked function. */ -static void prvRegTest1Task( void *pvParameters ) +static void prvRegTest1Task( void * pvParameters ) { - __asm volatile - ( - " /* Fill the core registers with known values. */ \n" - " mov r0, #100 \n" - " mov r1, #101 \n" - " mov r2, #102 \n" - " mov r3, #103 \n" - " mov r4, #104 \n" - " mov r5, #105 \n" - " mov r6, #106 \n" - " mov r7, #107 \n" - " mov r8, #108 \n" - " mov r9, #109 \n" - " mov r10, #110 \n" - " mov r11, #111 \n" - " mov r12, #112 \n" - " \n" - " /* Fill the VFP registers with known values. */ \n" - " vmov d0, r0, r1 \n" - " vmov d1, r2, r3 \n" - " vmov d2, r4, r5 \n" - " vmov d3, r6, r7 \n" - " vmov d4, r8, r9 \n" - " vmov d5, r10, r11 \n" - " vmov d6, r0, r1 \n" - " vmov d7, r2, r3 \n" - " vmov d8, r4, r5 \n" - " vmov d9, r6, r7 \n" - " vmov d10, r8, r9 \n" - " vmov d11, r10, r11 \n" - " vmov d12, r0, r1 \n" - " vmov d13, r2, r3 \n" - " vmov d14, r4, r5 \n" - " vmov d15, r6, r7 \n" - " \n" - "reg1_loop: \n" - " /* Check all the VFP registers still contain the values set above.\n" - " First save registers that are clobbered by the test. */ \n" - " push { r0-r1 } \n" - " \n" - " vmov r0, r1, d0 \n" - " cmp r0, #100 \n" - " bne reg1_error_loopf \n" - " cmp r1, #101 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d1 \n" - " cmp r0, #102 \n" - " bne reg1_error_loopf \n" - " cmp r1, #103 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d2 \n" - " cmp r0, #104 \n" - " bne reg1_error_loopf \n" - " cmp r1, #105 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d3 \n" - " cmp r0, #106 \n" - " bne reg1_error_loopf \n" - " cmp r1, #107 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d4 \n" - " cmp r0, #108 \n" - " bne reg1_error_loopf \n" - " cmp r1, #109 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d5 \n" - " cmp r0, #110 \n" - " bne reg1_error_loopf \n" - " cmp r1, #111 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d6 \n" - " cmp r0, #100 \n" - " bne reg1_error_loopf \n" - " cmp r1, #101 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d7 \n" - " cmp r0, #102 \n" - " bne reg1_error_loopf \n" - " cmp r1, #103 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d8 \n" - " cmp r0, #104 \n" - " bne reg1_error_loopf \n" - " cmp r1, #105 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d9 \n" - " cmp r0, #106 \n" - " bne reg1_error_loopf \n" - " cmp r1, #107 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d10 \n" - " cmp r0, #108 \n" - " bne reg1_error_loopf \n" - " cmp r1, #109 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d11 \n" - " cmp r0, #110 \n" - " bne reg1_error_loopf \n" - " cmp r1, #111 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d12 \n" - " cmp r0, #100 \n" - " bne reg1_error_loopf \n" - " cmp r1, #101 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d13 \n" - " cmp r0, #102 \n" - " bne reg1_error_loopf \n" - " cmp r1, #103 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d14 \n" - " cmp r0, #104 \n" - " bne reg1_error_loopf \n" - " cmp r1, #105 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d15 \n" - " cmp r0, #106 \n" - " bne reg1_error_loopf \n" - " cmp r1, #107 \n" - " bne reg1_error_loopf \n" - " \n" - " /* Restore the registers that were clobbered by the test. */\n" - " pop {r0-r1} \n" - " \n" - " /* VFP register test passed. Jump to the core register test. */\n" - " b reg1_loopf_pass \n" - " \n" - "reg1_error_loopf: \n" - " /* If this line is hit then a VFP register value was found to be\n" - " incorrect. */ \n" - " b reg1_error_loopf \n" - " \n" - "reg1_loopf_pass: \n" - " \n" - " cmp r0, #100 \n" - " bne reg1_error_loop \n" - " cmp r1, #101 \n" - " bne reg1_error_loop \n" - " cmp r2, #102 \n" - " bne reg1_error_loop \n" - " cmp r3, #103 \n" - " bne reg1_error_loop \n" - " cmp r4, #104 \n" - " bne reg1_error_loop \n" - " cmp r5, #105 \n" - " bne reg1_error_loop \n" - " cmp r6, #106 \n" - " bne reg1_error_loop \n" - " cmp r7, #107 \n" - " bne reg1_error_loop \n" - " cmp r8, #108 \n" - " bne reg1_error_loop \n" - " cmp r9, #109 \n" - " bne reg1_error_loop \n" - " cmp r10, #110 \n" - " bne reg1_error_loop \n" - " cmp r11, #111 \n" - " bne reg1_error_loop \n" - " cmp r12, #112 \n" - " bne reg1_error_loop \n" - " \n" - " /* Everything passed, increment the loop counter. */ \n" - " push { r0-r1 } \n" - " ldr r0, =ulRegTest1LoopCounter \n" - " ldr r1, [r0] \n" - " adds r1, r1, #1 \n" - " str r1, [r0] \n" - " pop { r0-r1 } \n" - " \n" - " /* Start again. */ \n" - " b reg1_loop \n" - " \n" - "reg1_error_loop: \n" - " /* If this line is hit then there was an error in a core register value.\n" - " The loop ensures the loop counter stops incrementing. */\n" - " b reg1_error_loop \n" - " nop " - ); + __asm volatile + ( + " /* Fill the core registers with known values. */ \n" + " mov r0, #100 \n" + " mov r1, #101 \n" + " mov r2, #102 \n" + " mov r3, #103 \n" + " mov r4, #104 \n" + " mov r5, #105 \n" + " mov r6, #106 \n" + " mov r7, #107 \n" + " mov r8, #108 \n" + " mov r9, #109 \n" + " mov r10, #110 \n" + " mov r11, #111 \n" + " mov r12, #112 \n" + " \n" + " /* Fill the VFP registers with known values. */ \n" + " vmov d0, r0, r1 \n" + " vmov d1, r2, r3 \n" + " vmov d2, r4, r5 \n" + " vmov d3, r6, r7 \n" + " vmov d4, r8, r9 \n" + " vmov d5, r10, r11 \n" + " vmov d6, r0, r1 \n" + " vmov d7, r2, r3 \n" + " vmov d8, r4, r5 \n" + " vmov d9, r6, r7 \n" + " vmov d10, r8, r9 \n" + " vmov d11, r10, r11 \n" + " vmov d12, r0, r1 \n" + " vmov d13, r2, r3 \n" + " vmov d14, r4, r5 \n" + " vmov d15, r6, r7 \n" + " \n" + "reg1_loop: \n" + " /* Check all the VFP registers still contain the values set above.\n" + " First save registers that are clobbered by the test. */ \n" + " push { r0-r1 } \n" + " \n" + " vmov r0, r1, d0 \n" + " cmp r0, #100 \n" + " bne reg1_error_loopf \n" + " cmp r1, #101 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d1 \n" + " cmp r0, #102 \n" + " bne reg1_error_loopf \n" + " cmp r1, #103 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d2 \n" + " cmp r0, #104 \n" + " bne reg1_error_loopf \n" + " cmp r1, #105 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d3 \n" + " cmp r0, #106 \n" + " bne reg1_error_loopf \n" + " cmp r1, #107 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d4 \n" + " cmp r0, #108 \n" + " bne reg1_error_loopf \n" + " cmp r1, #109 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d5 \n" + " cmp r0, #110 \n" + " bne reg1_error_loopf \n" + " cmp r1, #111 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d6 \n" + " cmp r0, #100 \n" + " bne reg1_error_loopf \n" + " cmp r1, #101 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d7 \n" + " cmp r0, #102 \n" + " bne reg1_error_loopf \n" + " cmp r1, #103 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d8 \n" + " cmp r0, #104 \n" + " bne reg1_error_loopf \n" + " cmp r1, #105 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d9 \n" + " cmp r0, #106 \n" + " bne reg1_error_loopf \n" + " cmp r1, #107 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d10 \n" + " cmp r0, #108 \n" + " bne reg1_error_loopf \n" + " cmp r1, #109 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d11 \n" + " cmp r0, #110 \n" + " bne reg1_error_loopf \n" + " cmp r1, #111 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d12 \n" + " cmp r0, #100 \n" + " bne reg1_error_loopf \n" + " cmp r1, #101 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d13 \n" + " cmp r0, #102 \n" + " bne reg1_error_loopf \n" + " cmp r1, #103 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d14 \n" + " cmp r0, #104 \n" + " bne reg1_error_loopf \n" + " cmp r1, #105 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d15 \n" + " cmp r0, #106 \n" + " bne reg1_error_loopf \n" + " cmp r1, #107 \n" + " bne reg1_error_loopf \n" + " \n" + " /* Restore the registers that were clobbered by the test. */\n" + " pop {r0-r1} \n" + " \n" + " /* VFP register test passed. Jump to the core register test. */\n" + " b reg1_loopf_pass \n" + " \n" + "reg1_error_loopf: \n" + " /* If this line is hit then a VFP register value was found to be\n" + " incorrect. */ \n" + " b reg1_error_loopf \n" + " \n" + "reg1_loopf_pass: \n" + " \n" + " cmp r0, #100 \n" + " bne reg1_error_loop \n" + " cmp r1, #101 \n" + " bne reg1_error_loop \n" + " cmp r2, #102 \n" + " bne reg1_error_loop \n" + " cmp r3, #103 \n" + " bne reg1_error_loop \n" + " cmp r4, #104 \n" + " bne reg1_error_loop \n" + " cmp r5, #105 \n" + " bne reg1_error_loop \n" + " cmp r6, #106 \n" + " bne reg1_error_loop \n" + " cmp r7, #107 \n" + " bne reg1_error_loop \n" + " cmp r8, #108 \n" + " bne reg1_error_loop \n" + " cmp r9, #109 \n" + " bne reg1_error_loop \n" + " cmp r10, #110 \n" + " bne reg1_error_loop \n" + " cmp r11, #111 \n" + " bne reg1_error_loop \n" + " cmp r12, #112 \n" + " bne reg1_error_loop \n" + " \n" + " /* Everything passed, increment the loop counter. */ \n" + " push { r0-r1 } \n" + " ldr r0, =ulRegTest1LoopCounter \n" + " ldr r1, [r0] \n" + " adds r1, r1, #1 \n" + " str r1, [r0] \n" + " pop { r0-r1 } \n" + " \n" + " /* Start again. */ \n" + " b reg1_loop \n" + " \n" + "reg1_error_loop: \n" + " /* If this line is hit then there was an error in a core register value.\n" + " The loop ensures the loop counter stops incrementing. */\n" + " b reg1_error_loop \n" + " nop " + ); } /*-----------------------------------------------------------*/ /* This is a naked function. */ -static void prvRegTest2Task( void *pvParameters ) +static void prvRegTest2Task( void * pvParameters ) { - __asm volatile - ( - " /* Set all the core registers to known values. */ \n" - " mov r0, #-1 \n" - " mov r1, #1 \n" - " mov r2, #2 \n" - " mov r3, #3 \n" - " mov r4, #4 \n" - " mov r5, #5 \n" - " mov r6, #6 \n" - " mov r7, #7 \n" - " mov r8, #8 \n" - " mov r9, #9 \n" - " mov r10, #10 \n" - " mov r11, #11 \n" - " mov r12, #12 \n" - " \n" - " /* Set all the VFP to known values. */ \n" - " vmov d0, r0, r1 \n" - " vmov d1, r2, r3 \n" - " vmov d2, r4, r5 \n" - " vmov d3, r6, r7 \n" - " vmov d4, r8, r9 \n" - " vmov d5, r10, r11 \n" - " vmov d6, r0, r1 \n" - " vmov d7, r2, r3 \n" - " vmov d8, r4, r5 \n" - " vmov d9, r6, r7 \n" - " vmov d10, r8, r9 \n" - " vmov d11, r10, r11 \n" - " vmov d12, r0, r1 \n" - " vmov d13, r2, r3 \n" - " vmov d14, r4, r5 \n" - " vmov d15, r6, r7 \n" - " \n" - "reg2_loop: \n" - " \n" - " /* Check all the VFP registers still contain the values set above.\n" - " First save registers that are clobbered by the test. */ \n" - " push { r0-r1 } \n" - " \n" - " vmov r0, r1, d0 \n" - " cmp r0, #-1 \n" - " bne reg2_error_loopf \n" - " cmp r1, #1 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d1 \n" - " cmp r0, #2 \n" - " bne reg2_error_loopf \n" - " cmp r1, #3 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d2 \n" - " cmp r0, #4 \n" - " bne reg2_error_loopf \n" - " cmp r1, #5 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d3 \n" - " cmp r0, #6 \n" - " bne reg2_error_loopf \n" - " cmp r1, #7 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d4 \n" - " cmp r0, #8 \n" - " bne reg2_error_loopf \n" - " cmp r1, #9 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d5 \n" - " cmp r0, #10 \n" - " bne reg2_error_loopf \n" - " cmp r1, #11 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d6 \n" - " cmp r0, #-1 \n" - " bne reg2_error_loopf \n" - " cmp r1, #1 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d7 \n" - " cmp r0, #2 \n" - " bne reg2_error_loopf \n" - " cmp r1, #3 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d8 \n" - " cmp r0, #4 \n" - " bne reg2_error_loopf \n" - " cmp r1, #5 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d9 \n" - " cmp r0, #6 \n" - " bne reg2_error_loopf \n" - " cmp r1, #7 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d10 \n" - " cmp r0, #8 \n" - " bne reg2_error_loopf \n" - " cmp r1, #9 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d11 \n" - " cmp r0, #10 \n" - " bne reg2_error_loopf \n" - " cmp r1, #11 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d12 \n" - " cmp r0, #-1 \n" - " bne reg2_error_loopf \n" - " cmp r1, #1 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d13 \n" - " cmp r0, #2 \n" - " bne reg2_error_loopf \n" - " cmp r1, #3 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d14 \n" - " cmp r0, #4 \n" - " bne reg2_error_loopf \n" - " cmp r1, #5 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d15 \n" - " cmp r0, #6 \n" - " bne reg2_error_loopf \n" - " cmp r1, #7 \n" - " bne reg2_error_loopf \n" - " \n" - " /* Restore the registers that were clobbered by the test. */\n" - " pop {r0-r1} \n" - " \n" - " /* VFP register test passed. Jump to the core register test. */\n" - " b reg2_loopf_pass \n" - " \n" - "reg2_error_loopf: \n" - " /* If this line is hit then a VFP register value was found to be\n" - " incorrect. */ \n" - " b reg2_error_loopf \n" - " \n" - "reg2_loopf_pass: \n" - " \n" - " cmp r0, #-1 \n" - " bne reg2_error_loop \n" - " cmp r1, #1 \n" - " bne reg2_error_loop \n" - " cmp r2, #2 \n" - " bne reg2_error_loop \n" - " cmp r3, #3 \n" - " bne reg2_error_loop \n" - " cmp r4, #4 \n" - " bne reg2_error_loop \n" - " cmp r5, #5 \n" - " bne reg2_error_loop \n" - " cmp r6, #6 \n" - " bne reg2_error_loop \n" - " cmp r7, #7 \n" - " bne reg2_error_loop \n" - " cmp r8, #8 \n" - " bne reg2_error_loop \n" - " cmp r9, #9 \n" - " bne reg2_error_loop \n" - " cmp r10, #10 \n" - " bne reg2_error_loop \n" - " cmp r11, #11 \n" - " bne reg2_error_loop \n" - " cmp r12, #12 \n" - " bne reg2_error_loop \n" - " \n" - " /* Increment the loop counter to indicate this test is still functioning\n" - " correctly. */ \n" - " push { r0-r1 } \n" - " ldr r0, =ulRegTest2LoopCounter \n" - " ldr r1, [r0] \n" - " adds r1, r1, #1 \n" - " str r1, [r0] \n" - " \n" - " /* Yield to increase test coverage. */ \n" - " movs r0, #0x01 \n" - " ldr r1, =0xe000ed04 \n" /*NVIC_INT_CTRL */ - " lsl r0, #28 \n" /* Shift to PendSV bit */ - " str r0, [r1] \n" - " dsb \n" - " pop { r0-r1 } \n" - " \n" - " /* Start again. */ \n" - " b reg2_loop \n" - " \n" - "reg2_error_loop: \n" - " /* If this line is hit then there was an error in a core register value.\n" - " This loop ensures the loop counter variable stops incrementing. */\n" - " b reg2_error_loop \n" - " nop \n" - ); + __asm volatile + ( + " /* Set all the core registers to known values. */ \n" + " mov r0, #-1 \n" + " mov r1, #1 \n" + " mov r2, #2 \n" + " mov r3, #3 \n" + " mov r4, #4 \n" + " mov r5, #5 \n" + " mov r6, #6 \n" + " mov r7, #7 \n" + " mov r8, #8 \n" + " mov r9, #9 \n" + " mov r10, #10 \n" + " mov r11, #11 \n" + " mov r12, #12 \n" + " \n" + " /* Set all the VFP to known values. */ \n" + " vmov d0, r0, r1 \n" + " vmov d1, r2, r3 \n" + " vmov d2, r4, r5 \n" + " vmov d3, r6, r7 \n" + " vmov d4, r8, r9 \n" + " vmov d5, r10, r11 \n" + " vmov d6, r0, r1 \n" + " vmov d7, r2, r3 \n" + " vmov d8, r4, r5 \n" + " vmov d9, r6, r7 \n" + " vmov d10, r8, r9 \n" + " vmov d11, r10, r11 \n" + " vmov d12, r0, r1 \n" + " vmov d13, r2, r3 \n" + " vmov d14, r4, r5 \n" + " vmov d15, r6, r7 \n" + " \n" + "reg2_loop: \n" + " \n" + " /* Check all the VFP registers still contain the values set above.\n" + " First save registers that are clobbered by the test. */ \n" + " push { r0-r1 } \n" + " \n" + " vmov r0, r1, d0 \n" + " cmp r0, #-1 \n" + " bne reg2_error_loopf \n" + " cmp r1, #1 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d1 \n" + " cmp r0, #2 \n" + " bne reg2_error_loopf \n" + " cmp r1, #3 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d2 \n" + " cmp r0, #4 \n" + " bne reg2_error_loopf \n" + " cmp r1, #5 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d3 \n" + " cmp r0, #6 \n" + " bne reg2_error_loopf \n" + " cmp r1, #7 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d4 \n" + " cmp r0, #8 \n" + " bne reg2_error_loopf \n" + " cmp r1, #9 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d5 \n" + " cmp r0, #10 \n" + " bne reg2_error_loopf \n" + " cmp r1, #11 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d6 \n" + " cmp r0, #-1 \n" + " bne reg2_error_loopf \n" + " cmp r1, #1 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d7 \n" + " cmp r0, #2 \n" + " bne reg2_error_loopf \n" + " cmp r1, #3 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d8 \n" + " cmp r0, #4 \n" + " bne reg2_error_loopf \n" + " cmp r1, #5 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d9 \n" + " cmp r0, #6 \n" + " bne reg2_error_loopf \n" + " cmp r1, #7 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d10 \n" + " cmp r0, #8 \n" + " bne reg2_error_loopf \n" + " cmp r1, #9 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d11 \n" + " cmp r0, #10 \n" + " bne reg2_error_loopf \n" + " cmp r1, #11 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d12 \n" + " cmp r0, #-1 \n" + " bne reg2_error_loopf \n" + " cmp r1, #1 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d13 \n" + " cmp r0, #2 \n" + " bne reg2_error_loopf \n" + " cmp r1, #3 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d14 \n" + " cmp r0, #4 \n" + " bne reg2_error_loopf \n" + " cmp r1, #5 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d15 \n" + " cmp r0, #6 \n" + " bne reg2_error_loopf \n" + " cmp r1, #7 \n" + " bne reg2_error_loopf \n" + " \n" + " /* Restore the registers that were clobbered by the test. */\n" + " pop {r0-r1} \n" + " \n" + " /* VFP register test passed. Jump to the core register test. */\n" + " b reg2_loopf_pass \n" + " \n" + "reg2_error_loopf: \n" + " /* If this line is hit then a VFP register value was found to be\n" + " incorrect. */ \n" + " b reg2_error_loopf \n" + " \n" + "reg2_loopf_pass: \n" + " \n" + " cmp r0, #-1 \n" + " bne reg2_error_loop \n" + " cmp r1, #1 \n" + " bne reg2_error_loop \n" + " cmp r2, #2 \n" + " bne reg2_error_loop \n" + " cmp r3, #3 \n" + " bne reg2_error_loop \n" + " cmp r4, #4 \n" + " bne reg2_error_loop \n" + " cmp r5, #5 \n" + " bne reg2_error_loop \n" + " cmp r6, #6 \n" + " bne reg2_error_loop \n" + " cmp r7, #7 \n" + " bne reg2_error_loop \n" + " cmp r8, #8 \n" + " bne reg2_error_loop \n" + " cmp r9, #9 \n" + " bne reg2_error_loop \n" + " cmp r10, #10 \n" + " bne reg2_error_loop \n" + " cmp r11, #11 \n" + " bne reg2_error_loop \n" + " cmp r12, #12 \n" + " bne reg2_error_loop \n" + " \n" + " /* Increment the loop counter to indicate this test is still functioning\n" + " correctly. */ \n" + " push { r0-r1 } \n" + " ldr r0, =ulRegTest2LoopCounter \n" + " ldr r1, [r0] \n" + " adds r1, r1, #1 \n" + " str r1, [r0] \n" + " \n" + " /* Yield to increase test coverage. */ \n" + " movs r0, #0x01 \n" + " ldr r1, =0xe000ed04 \n"/*NVIC_INT_CTRL */ + " lsl r0, #28 \n"/* Shift to PendSV bit */ + " str r0, [r1] \n" + " dsb \n" + " pop { r0-r1 } \n" + " \n" + " /* Start again. */ \n" + " b reg2_loop \n" + " \n" + "reg2_error_loop: \n" + " /* If this line is hit then there was an error in a core register value.\n" + " This loop ensures the loop counter variable stops incrementing. */\n" + " b reg2_error_loop \n" + " nop \n" + ); } diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_IAR/FreeRTOSConfig.h index ee26f774d79..539760ac729 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_IAR/main.c b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_IAR/main.c index 900dbdf0619..13a72681040 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_IAR/main.c +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -59,8 +59,8 @@ #include "QueueOverwrite.h" /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 /*-----------------------------------------------------------*/ @@ -80,122 +80,129 @@ extern void main_full( void ); int main( void ) { - /* Prepare the hardware to run this demo. */ - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* Prepare the hardware to run this demo. */ + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - configCONFIGURE_LED(); + configCONFIGURE_LED(); - /* Ensure all priority bits are assigned as preemption priority bits. */ - NVIC_SetPriorityGrouping( 0 ); + /* Ensure all priority bits are assigned as preemption priority bits. */ + NVIC_SetPriorityGrouping( 0 ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* This function will be called by each tick interrupt if - configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - added here, but the tick hook is called from an interrupt context, so - code must not attempt to block, and only the interrupt safe FreeRTOS API - functions can be used (those that end in FromISR()). */ - - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 - { - /* Write to a queue that is in use as part of the queue set demo to - demonstrate using queue sets from an ISR. */ - vQueueSetAccessQueueSetFromISR(); - - /* Test the ISR safe queue overwrite functions. */ - vQueueOverwritePeriodicISRDemo(); - } - #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */ + /* This function will be called by each tick interrupt if + * configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + * added here, but the tick hook is called from an interrupt context, so + * code must not attempt to block, and only the interrupt safe FreeRTOS API + * functions can be used (those that end in FromISR()). */ + + #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 + { + /* Write to a queue that is in use as part of the queue set demo to + * demonstrate using queue sets from an ISR. */ + vQueueSetAccessQueueSetFromISR(); + + /* Test the ISR safe queue overwrite functions. */ + vQueueOverwritePeriodicISRDemo(); + } + #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */ } /*-----------------------------------------------------------*/ #ifdef JUST_AN_EXAMPLE_ISR -void Dummy_IRQHandler(void) -{ -long lHigherPriorityTaskWoken = pdFALSE; - - /* Clear the interrupt if necessary. */ - Dummy_ClearITPendingBit(); - - /* This interrupt does nothing more than demonstrate how to synchronise a - task with an interrupt. A semaphore is used for this purpose. Note - lHigherPriorityTaskWoken is initialised to zero. */ - xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken ); - - /* If there was a task that was blocked on the semaphore, and giving the - semaphore caused the task to unblock, and the unblocked task has a priority - higher than the current Running state task (the task that this interrupt - interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE - internally within xSemaphoreGiveFromISR(). Passing pdTRUE into the - portEND_SWITCHING_ISR() macro will result in a context switch being pended to - ensure this interrupt returns directly to the unblocked, higher priority, - task. Passing pdFALSE into portEND_SWITCHING_ISR() has no effect. */ - portEND_SWITCHING_ISR( lHigherPriorityTaskWoken ); -} + void Dummy_IRQHandler( void ) + { + long lHigherPriorityTaskWoken = pdFALSE; + + /* Clear the interrupt if necessary. */ + Dummy_ClearITPendingBit(); + + /* This interrupt does nothing more than demonstrate how to synchronise a + * task with an interrupt. A semaphore is used for this purpose. Note + * lHigherPriorityTaskWoken is initialised to zero. */ + xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken ); + + /* If there was a task that was blocked on the semaphore, and giving the + * semaphore caused the task to unblock, and the unblocked task has a priority + * higher than the current Running state task (the task that this interrupt + * interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE + * internally within xSemaphoreGiveFromISR(). Passing pdTRUE into the + * portEND_SWITCHING_ISR() macro will result in a context switch being pended to + * ensure this interrupt returns directly to the unblocked, higher priority, + * task. Passing pdFALSE into portEND_SWITCHING_ISR() has no effect. */ + portEND_SWITCHING_ISR( lHigherPriorityTaskWoken ); + } #endif /* JUST_AN_EXAMPLE_ISR */ diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_IAR/main_blinky.c b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_IAR/main_blinky.c index 9840f5aad2c..5994c0986fe 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_IAR/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_IAR/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -70,30 +70,30 @@ #include "semphr.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /* Values passed to the two tasks just to check the task parameter -functionality. */ -#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) -#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) + * functionality. */ +#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) +#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * Called by main() to create the simply blinky style application if @@ -110,85 +110,86 @@ static QueueHandle_t xQueue = NULL; void main_blinky( void ) { - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); - - if( xQueue != NULL ) - { - /* Start the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ - mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ - - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Start the tasks and timer running. */ - 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 insufficient FreeRTOS heap memory available for the idle and/or - timer tasks to be created. See the memory management section on the - FreeRTOS web site for more details. */ - for( ;; ); + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); + + if( xQueue != NULL ) + { + /* Start the two tasks as described in the comments at the top of this + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ + + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Start the tasks and timer running. */ + 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 insufficient FreeRTOS heap memory available for the idle and/or + * timer tasks to be created. See the memory management section on the + * FreeRTOS web site for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, the constant used converts ticks - to ms. While in the Blocked state this task will not consume any CPU - time. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - - /* 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 - will not block - it shouldn't need to block as the queue should always - be empty at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, the constant used converts ticks + * to ms. While in the Blocked state this task will not consume any CPU + * time. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + + /* 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 + * will not block - it shouldn't need to block as the queue should always + * be empty at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it the expected value? If it is, toggle the LED. */ - if( ulReceivedValue == 100UL ) - { - configTOGGLE_LED(); - ulReceivedValue = 0U; - } - } + unsigned long ulReceivedValue; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it the expected value? If it is, toggle the LED. */ + if( ulReceivedValue == 100UL ) + { + configTOGGLE_LED(); + ulReceivedValue = 0U; + } + } } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_IAR/main_full.c b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_IAR/main_full.c index 34d02cc8472..2c290d7aba2 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_IAR/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_IAR/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -85,24 +85,24 @@ #include "QueueOverwrite.h" /* Priorities for the demo application tasks. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2UL ) -#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 mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2UL ) +#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 ) /* A block time of zero simply means "don't block". */ -#define mainDONT_BLOCK ( 0UL ) +#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 mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS ) + * 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 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_PERIOD_MS constant. */ -#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) + * 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_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) /*-----------------------------------------------------------*/ @@ -116,144 +116,147 @@ static void prvCheckTimerCallback( TimerHandle_t xTimer ); * 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. */ -extern void vRegTest1Task( void *pvParameters ); -extern void vRegTest2Task( void *pvParameters ); +extern void vRegTest1Task( void * pvParameters ); +extern void vRegTest2Task( void * pvParameters ); /*-----------------------------------------------------------*/ /* The following two variables are used to communicate the status of the -register check tasks to the check software timer. If the variables keep -incrementing, then the register check tasks have not discovered any errors. If -a variable stops incrementing, then an error has been found. */ + * register check tasks to the check software timer. If the variables keep + * incrementing, then the register check tasks have 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 ) { -TimerHandle_t xCheckTimer = NULL; - - /* Start all the other standard demo/test tasks. The have not particular - functionality, but do demonstrate how to use the FreeRTOS API and test the - kernel port. */ - vStartQueueSetTasks(); - vStartQueueOverwriteTask( tskIDLE_PRIORITY ); - vStartDynamicPriorityTasks(); - vCreateBlockTimeTasks(); - vStartGenericQueueTasks( tskIDLE_PRIORITY ); - vStartRecursiveMutexTasks(); - vStartMathTasks( mainFLOP_TASK_PRIORITY ); - - /* Create the register check tasks, as described at the top of this - file */ - xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); - xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); - - /* Create the software timer that performs the 'check' functionality, - as described at the top of this file. */ - xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ - ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - if( xCheckTimer != NULL ) - { - xTimerStart( xCheckTimer, mainDONT_BLOCK ); - } - - /* 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 - insufficient FreeRTOS heap memory available for the idle and/or timer tasks - to be created. See the memory management section on the FreeRTOS web site - for more details. */ - for( ;; ); + TimerHandle_t xCheckTimer = NULL; + + /* Start all the other standard demo/test tasks. The have not particular + * functionality, but do demonstrate how to use the FreeRTOS API and test the + * kernel port. */ + vStartQueueSetTasks(); + vStartQueueOverwriteTask( tskIDLE_PRIORITY ); + vStartDynamicPriorityTasks(); + vCreateBlockTimeTasks(); + vStartGenericQueueTasks( tskIDLE_PRIORITY ); + vStartRecursiveMutexTasks(); + vStartMathTasks( mainFLOP_TASK_PRIORITY ); + + /* Create the register check tasks, as described at the top of this + * file */ + xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); + + /* Create the software timer that performs the 'check' functionality, + * as described at the top of this file. */ + xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ + ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + if( xCheckTimer != NULL ) + { + xTimerStart( xCheckTimer, mainDONT_BLOCK ); + } + + /* 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 + * insufficient FreeRTOS heap memory available for the idle and/or timer tasks + * to be created. See the memory management section on the FreeRTOS web site + * for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ static void prvCheckTimerCallback( TimerHandle_t xTimer ) { -static long lChangedTimerPeriodAlready = pdFALSE; -static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; -unsigned long ulErrorFound = pdFALSE; - - /* 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( xAreMathsTaskStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xAreQueueSetTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xIsQueueOverwriteTaskStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - /* Check that the register test 1 task is still running. */ - if( ulLastRegTest1Value == ulRegTest1LoopCounter ) - { - ulErrorFound = pdTRUE; - } - ulLastRegTest1Value = ulRegTest1LoopCounter; - - /* Check that the register test 2 task is still running. */ - if( ulLastRegTest2Value == ulRegTest2LoopCounter ) - { - ulErrorFound = pdTRUE; - } - ulLastRegTest2Value = ulRegTest2LoopCounter; - - /* Toggle the check LED to give an indication of the system status. If - the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then - everything is ok. A faster toggle indicates an error. */ - configTOGGLE_LED(); - - /* Have any errors been latch in ulErrorFound? If so, shorten the - period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. - This will result in an increase in the rate at which mainCHECK_LED - toggles. */ - if( ulErrorFound != pdFALSE ) - { - if( lChangedTimerPeriodAlready == pdFALSE ) - { - lChangedTimerPeriodAlready = pdTRUE; - - /* This call to xTimerChangePeriod() uses a zero block time. - Functions called from inside of a timer callback function must - *never* attempt to block. */ - xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); - } - } + static long lChangedTimerPeriodAlready = pdFALSE; + static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; + unsigned long ulErrorFound = pdFALSE; + + /* 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( xAreMathsTaskStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreQueueSetTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xIsQueueOverwriteTaskStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + /* Check that the register test 1 task is still running. */ + if( ulLastRegTest1Value == ulRegTest1LoopCounter ) + { + ulErrorFound = pdTRUE; + } + + ulLastRegTest1Value = ulRegTest1LoopCounter; + + /* Check that the register test 2 task is still running. */ + if( ulLastRegTest2Value == ulRegTest2LoopCounter ) + { + ulErrorFound = pdTRUE; + } + + ulLastRegTest2Value = ulRegTest2LoopCounter; + + /* Toggle the check LED to give an indication of the system status. If + * the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then + * everything is ok. A faster toggle indicates an error. */ + configTOGGLE_LED(); + + /* Have any errors been latch in ulErrorFound? If so, shorten the + * period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. + * This will result in an increase in the rate at which mainCHECK_LED + * toggles. */ + if( ulErrorFound != pdFALSE ) + { + if( lChangedTimerPeriodAlready == pdFALSE ) + { + lChangedTimerPeriodAlready = pdTRUE; + + /* This call to xTimerChangePeriod() uses a zero block time. + * Functions called from inside of a timer callback function must + * never* attempt to block. */ + xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); + } + } } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/FreeRTOSConfig.h index 709a9415005..09b12ed166f 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/RegTest.c b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/RegTest.c index bc1813c1192..7aacf425da4 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/main.c b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/main.c index 92609f51783..baea7446573 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/main.c +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -35,9 +35,9 @@ * This file implements the code that is not demo specific, including the * hardware setup and FreeRTOS hook functions. * - * + * * Additional code: - * + * * This demo does not contain a non-kernel interrupt service routine that * can be used as an example for application writers to use as a reference. * Therefore, the framework of a dummy (not installed) handler is provided @@ -55,8 +55,8 @@ #include "task.h" /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 /*-----------------------------------------------------------*/ @@ -65,9 +65,9 @@ or 0 to run the more comprehensive test and demo application. */ */ static void prvSetupHardware( void ); -/* +/* * 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. */ extern void main_blinky( void ); extern void main_full( void ); @@ -76,111 +76,118 @@ extern void main_full( void ); int main( void ) { - /* Prepare the hardware to run this demo. */ - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* Prepare the hardware to run this demo. */ + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - configCONFIGURE_LED(); - - /* Ensure all priority bits are assigned as preemption priority bits. */ - NVIC_SetPriorityGrouping( 0 ); + configCONFIGURE_LED(); + + /* Ensure all priority bits are assigned as preemption priority bits. */ + NVIC_SetPriorityGrouping( 0 ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* This function will be called by each tick interrupt if - configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - added here, but the tick hook is called from an interrupt context, so - code must not attempt to block, and only the interrupt safe FreeRTOS API - functions can be used (those that end in FromISR()). */ + /* This function will be called by each tick interrupt if + * configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + * added here, but the tick hook is called from an interrupt context, so + * code must not attempt to block, and only the interrupt safe FreeRTOS API + * functions can be used (those that end in FromISR()). */ } /*-----------------------------------------------------------*/ #ifdef JUST_AN_EXAMPLE_ISR -void Dummy_IRQHandler(void) -{ -long lHigherPriorityTaskWoken = pdFALSE; - - /* Clear the interrupt if necessary. */ - Dummy_ClearITPendingBit(); - - /* This interrupt does nothing more than demonstrate how to synchronise a - task with an interrupt. A semaphore is used for this purpose. Note - lHigherPriorityTaskWoken is initialised to zero. */ - xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken ); - - /* If there was a task that was blocked on the semaphore, and giving the - semaphore caused the task to unblock, and the unblocked task has a priority - higher than the current Running state task (the task that this interrupt - interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE - internally within xSemaphoreGiveFromISR(). Passing pdTRUE into the - portEND_SWITCHING_ISR() macro will result in a context switch being pended to - ensure this interrupt returns directly to the unblocked, higher priority, - task. Passing pdFALSE into portEND_SWITCHING_ISR() has no effect. */ - portEND_SWITCHING_ISR( lHigherPriorityTaskWoken ); -} + void Dummy_IRQHandler( void ) + { + long lHigherPriorityTaskWoken = pdFALSE; + + /* Clear the interrupt if necessary. */ + Dummy_ClearITPendingBit(); + + /* This interrupt does nothing more than demonstrate how to synchronise a + * task with an interrupt. A semaphore is used for this purpose. Note + * lHigherPriorityTaskWoken is initialised to zero. */ + xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken ); + + /* If there was a task that was blocked on the semaphore, and giving the + * semaphore caused the task to unblock, and the unblocked task has a priority + * higher than the current Running state task (the task that this interrupt + * interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE + * internally within xSemaphoreGiveFromISR(). Passing pdTRUE into the + * portEND_SWITCHING_ISR() macro will result in a context switch being pended to + * ensure this interrupt returns directly to the unblocked, higher priority, + * task. Passing pdFALSE into portEND_SWITCHING_ISR() has no effect. */ + portEND_SWITCHING_ISR( lHigherPriorityTaskWoken ); + } #endif /* JUST_AN_EXAMPLE_ISR */ diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/main_blinky.c b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/main_blinky.c index 9840f5aad2c..5994c0986fe 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -70,30 +70,30 @@ #include "semphr.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /* Values passed to the two tasks just to check the task parameter -functionality. */ -#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) -#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) + * functionality. */ +#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) +#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * Called by main() to create the simply blinky style application if @@ -110,85 +110,86 @@ static QueueHandle_t xQueue = NULL; void main_blinky( void ) { - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); - - if( xQueue != NULL ) - { - /* Start the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ - mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ - - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Start the tasks and timer running. */ - 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 insufficient FreeRTOS heap memory available for the idle and/or - timer tasks to be created. See the memory management section on the - FreeRTOS web site for more details. */ - for( ;; ); + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); + + if( xQueue != NULL ) + { + /* Start the two tasks as described in the comments at the top of this + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ + + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Start the tasks and timer running. */ + 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 insufficient FreeRTOS heap memory available for the idle and/or + * timer tasks to be created. See the memory management section on the + * FreeRTOS web site for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, the constant used converts ticks - to ms. While in the Blocked state this task will not consume any CPU - time. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - - /* 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 - will not block - it shouldn't need to block as the queue should always - be empty at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, the constant used converts ticks + * to ms. While in the Blocked state this task will not consume any CPU + * time. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + + /* 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 + * will not block - it shouldn't need to block as the queue should always + * be empty at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it the expected value? If it is, toggle the LED. */ - if( ulReceivedValue == 100UL ) - { - configTOGGLE_LED(); - ulReceivedValue = 0U; - } - } + unsigned long ulReceivedValue; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it the expected value? If it is, toggle the LED. */ + if( ulReceivedValue == 100UL ) + { + configTOGGLE_LED(); + ulReceivedValue = 0U; + } + } } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/main_full.c b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/main_full.c index a26e429dba9..7f6c3a5959c 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Keil/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -83,24 +83,24 @@ #include "recmutex.h" /* Priorities for the demo application tasks. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2UL ) -#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 mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2UL ) +#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 ) /* A block time of zero simply means "don't block". */ -#define mainDONT_BLOCK ( 0UL ) +#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 mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS ) + * 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 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_PERIOD_MS constant. */ -#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) + * 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_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) /*-----------------------------------------------------------*/ @@ -114,139 +114,142 @@ static void prvCheckTimerCallback( TimerHandle_t xTimer ); * 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. */ -extern void vRegTest1Task( void *pvParameters ); -extern void vRegTest2Task( void *pvParameters ); +extern void vRegTest1Task( void * pvParameters ); +extern void vRegTest2Task( void * pvParameters ); /*-----------------------------------------------------------*/ /* The following two variables are used to communicate the status of the -register check tasks to the check software timer. If the variables keep -incrementing, then the register check tasks have not discovered any errors. If -a variable stops incrementing, then an error has been found. */ + * register check tasks to the check software timer. If the variables keep + * incrementing, then the register check tasks have 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 ) { -TimerHandle_t xCheckTimer = NULL; - - /* Start all the other standard demo/test tasks. The have not particular - functionality, but do demonstrate how to use the FreeRTOS API and test the - kernel port. */ - vStartDynamicPriorityTasks(); - vCreateBlockTimeTasks(); - vStartCountingSemaphoreTasks(); - vStartGenericQueueTasks( tskIDLE_PRIORITY ); - vStartRecursiveMutexTasks(); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartMathTasks( mainFLOP_TASK_PRIORITY ); - - /* Create the register check tasks, as described at the top of this - file */ - xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); - xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); - - /* Create the software timer that performs the 'check' functionality, - as described at the top of this file. */ - xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ - ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - if( xCheckTimer != NULL ) - { - xTimerStart( xCheckTimer, mainDONT_BLOCK ); - } - - /* 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 - insufficient FreeRTOS heap memory available for the idle and/or timer tasks - to be created. See the memory management section on the FreeRTOS web site - for more details. */ - for( ;; ); + TimerHandle_t xCheckTimer = NULL; + + /* Start all the other standard demo/test tasks. The have not particular + * functionality, but do demonstrate how to use the FreeRTOS API and test the + * kernel port. */ + vStartDynamicPriorityTasks(); + vCreateBlockTimeTasks(); + vStartCountingSemaphoreTasks(); + vStartGenericQueueTasks( tskIDLE_PRIORITY ); + vStartRecursiveMutexTasks(); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartMathTasks( mainFLOP_TASK_PRIORITY ); + + /* Create the register check tasks, as described at the top of this + * file */ + xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); + + /* Create the software timer that performs the 'check' functionality, + * as described at the top of this file. */ + xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ + ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + if( xCheckTimer != NULL ) + { + xTimerStart( xCheckTimer, mainDONT_BLOCK ); + } + + /* 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 + * insufficient FreeRTOS heap memory available for the idle and/or timer tasks + * to be created. See the memory management section on the FreeRTOS web site + * for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ static void prvCheckTimerCallback( TimerHandle_t xTimer ) { -static long lChangedTimerPeriodAlready = pdFALSE; -static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; -unsigned long ulErrorFound = pdFALSE; - - /* 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( xAreMathsTaskStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - /* Check that the register test 1 task is still running. */ - if( ulLastRegTest1Value == ulRegTest1LoopCounter ) - { - ulErrorFound = pdTRUE; - } - ulLastRegTest1Value = ulRegTest1LoopCounter; - - /* Check that the register test 2 task is still running. */ - if( ulLastRegTest2Value == ulRegTest2LoopCounter ) - { - ulErrorFound = pdTRUE; - } - ulLastRegTest2Value = ulRegTest2LoopCounter; - - /* Toggle the check LED to give an indication of the system status. If - the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then - everything is ok. A faster toggle indicates an error. */ - configTOGGLE_LED(); - - /* Have any errors been latch in ulErrorFound? If so, shorten the - period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. - This will result in an increase in the rate at which mainCHECK_LED - toggles. */ - if( ulErrorFound != pdFALSE ) - { - if( lChangedTimerPeriodAlready == pdFALSE ) - { - lChangedTimerPeriodAlready = pdTRUE; - - /* This call to xTimerChangePeriod() uses a zero block time. - Functions called from inside of a timer callback function must - *never* attempt to block. */ - xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); - } - } + static long lChangedTimerPeriodAlready = pdFALSE; + static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; + unsigned long ulErrorFound = pdFALSE; + + /* 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( xAreMathsTaskStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + /* Check that the register test 1 task is still running. */ + if( ulLastRegTest1Value == ulRegTest1LoopCounter ) + { + ulErrorFound = pdTRUE; + } + + ulLastRegTest1Value = ulRegTest1LoopCounter; + + /* Check that the register test 2 task is still running. */ + if( ulLastRegTest2Value == ulRegTest2LoopCounter ) + { + ulErrorFound = pdTRUE; + } + + ulLastRegTest2Value = ulRegTest2LoopCounter; + + /* Toggle the check LED to give an indication of the system status. If + * the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then + * everything is ok. A faster toggle indicates an error. */ + configTOGGLE_LED(); + + /* Have any errors been latch in ulErrorFound? If so, shorten the + * period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. + * This will result in an increase in the rate at which mainCHECK_LED + * toggles. */ + if( ulErrorFound != pdFALSE ) + { + if( lChangedTimerPeriodAlready == pdFALSE ) + { + lChangedTimerPeriodAlready = pdTRUE; + + /* This call to xTimerChangePeriod() uses a zero block time. + * Functions called from inside of a timer callback function must + * never* attempt to block. */ + xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); + } + } } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Tasking/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Tasking/FreeRTOSConfig.h index ad800272095..ff4498b539c 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Tasking/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Tasking/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Tasking/main.c b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Tasking/main.c index 1400b86d118..5181d741659 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Tasking/main.c +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Tasking/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -47,10 +47,10 @@ * that is found on the FreeRTOS.org web site. */ -/* +/* * The following #error directive is to remind users that a batch file must be - * executed prior to this project being built. The batch file *cannot* be - * executed from within the IDE! Once it has been executed, re-open or refresh + * executed prior to this project being built. The batch file *cannot* be + * executed from within the IDE! Once it has been executed, re-open or refresh * the Eclipse project and remove the #error line below. */ #error Ensure CreateProjectDirectoryStructure.bat has been executed before building. See comment immediately above. @@ -68,8 +68,8 @@ #include "QueueOverwrite.h" /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 /*-----------------------------------------------------------*/ @@ -89,128 +89,131 @@ extern void main_full( void ); int main( void ) { - /* Prepare the hardware to run this demo. */ - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* Prepare the hardware to run this demo. */ + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - configCONFIGURE_LED(); + configCONFIGURE_LED(); - /* Ensure all priority bits are assigned as preemption priority bits. */ - NVIC_SetPriorityGrouping( 0 ); + /* Ensure all priority bits are assigned as preemption priority bits. */ + NVIC_SetPriorityGrouping( 0 ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ) - { - __asm volatile( "NOP" ); - }; + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + __asm volatile ( "NOP" ); + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ) - { - __asm volatile( "NOP" ); - } + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + __asm volatile ( "NOP" ); + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* This function will be called by each tick interrupt if - configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - added here, but the tick hook is called from an interrupt context, so - code must not attempt to block, and only the interrupt safe FreeRTOS API - functions can be used (those that end in FromISR()). */ - - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 - { - /* Write to a queue that is in use as part of the queue set demo to - demonstrate using queue sets from an ISR. */ - vQueueSetAccessQueueSetFromISR(); - - /* Test the ISR safe queue overwrite functions. */ - vQueueOverwritePeriodicISRDemo(); - } - #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */ + /* This function will be called by each tick interrupt if + * configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + * added here, but the tick hook is called from an interrupt context, so + * code must not attempt to block, and only the interrupt safe FreeRTOS API + * functions can be used (those that end in FromISR()). */ + + #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 + { + /* Write to a queue that is in use as part of the queue set demo to + * demonstrate using queue sets from an ISR. */ + vQueueSetAccessQueueSetFromISR(); + + /* Test the ISR safe queue overwrite functions. */ + vQueueOverwritePeriodicISRDemo(); + } + #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */ } /*-----------------------------------------------------------*/ #ifdef JUST_AN_EXAMPLE_ISR -void Dummy_IRQHandler(void) -{ -long lHigherPriorityTaskWoken = pdFALSE; - - /* Clear the interrupt if necessary. */ - Dummy_ClearITPendingBit(); - - /* This interrupt does nothing more than demonstrate how to synchronise a - task with an interrupt. A semaphore is used for this purpose. Note - lHigherPriorityTaskWoken is initialised to zero. */ - xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken ); - - /* If there was a task that was blocked on the semaphore, and giving the - semaphore caused the task to unblock, and the unblocked task has a priority - higher than the current Running state task (the task that this interrupt - interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE - internally within xSemaphoreGiveFromISR(). Passing pdTRUE into the - portEND_SWITCHING_ISR() macro will result in a context switch being pended to - ensure this interrupt returns directly to the unblocked, higher priority, - task. Passing pdFALSE into portEND_SWITCHING_ISR() has no effect. */ - portEND_SWITCHING_ISR( lHigherPriorityTaskWoken ); -} + void Dummy_IRQHandler( void ) + { + long lHigherPriorityTaskWoken = pdFALSE; + + /* Clear the interrupt if necessary. */ + Dummy_ClearITPendingBit(); + + /* This interrupt does nothing more than demonstrate how to synchronise a + * task with an interrupt. A semaphore is used for this purpose. Note + * lHigherPriorityTaskWoken is initialised to zero. */ + xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken ); + + /* If there was a task that was blocked on the semaphore, and giving the + * semaphore caused the task to unblock, and the unblocked task has a priority + * higher than the current Running state task (the task that this interrupt + * interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE + * internally within xSemaphoreGiveFromISR(). Passing pdTRUE into the + * portEND_SWITCHING_ISR() macro will result in a context switch being pended to + * ensure this interrupt returns directly to the unblocked, higher priority, + * task. Passing pdFALSE into portEND_SWITCHING_ISR() has no effect. */ + portEND_SWITCHING_ISR( lHigherPriorityTaskWoken ); + } #endif /* JUST_AN_EXAMPLE_ISR */ diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Tasking/main_blinky.c b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Tasking/main_blinky.c index e32fb48780c..8b4a91fd8dd 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Tasking/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Tasking/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -70,30 +70,30 @@ #include "semphr.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /* Values passed to the two tasks just to check the task parameter -functionality. */ -#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) -#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) + * functionality. */ +#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) +#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * Called by main() to create the simply blinky style application if @@ -110,88 +110,87 @@ static QueueHandle_t xQueue = NULL; void main_blinky( void ) { - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); - - if( xQueue != NULL ) - { - /* Start the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ - mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ - - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Start the tasks and timer running. */ - 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 insufficient FreeRTOS heap memory available for the idle and/or - timer tasks to be created. See the memory management section on the - FreeRTOS web site for more details. */ - for( ;; ) - { - __asm volatile( "NOP" ); - } + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); + + if( xQueue != NULL ) + { + /* Start the two tasks as described in the comments at the top of this + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ + + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Start the tasks and timer running. */ + 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 insufficient FreeRTOS heap memory available for the idle and/or + * timer tasks to be created. See the memory management section on the + * FreeRTOS web site for more details. */ + for( ; ; ) + { + __asm volatile ( "NOP" ); + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, the constant used converts ticks - to ms. While in the Blocked state this task will not consume any CPU - time. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - - /* 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 - will not block - it shouldn't need to block as the queue should always - be empty at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, the constant used converts ticks + * to ms. While in the Blocked state this task will not consume any CPU + * time. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + + /* 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 + * will not block - it shouldn't need to block as the queue should always + * be empty at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it the expected value? If it is, toggle the LED. */ - if( ulReceivedValue == 100UL ) - { - configTOGGLE_LED(); - ulReceivedValue = 0U; - } - } + unsigned long ulReceivedValue; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it the expected value? If it is, toggle the LED. */ + if( ulReceivedValue == 100UL ) + { + configTOGGLE_LED(); + ulReceivedValue = 0U; + } + } } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Tasking/main_full.c b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Tasking/main_full.c index 3c0694dd1f2..c749c29b0c5 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Tasking/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4000_Tasking/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -85,24 +85,24 @@ #include "QueueOverwrite.h" /* Priorities for the demo application tasks. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2UL ) -#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 mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2UL ) +#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 ) /* A block time of zero simply means "don't block". */ -#define mainDONT_BLOCK ( 0UL ) +#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 mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS ) + * 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 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_PERIOD_MS constant. */ -#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) + * 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_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) /*-----------------------------------------------------------*/ @@ -116,499 +116,498 @@ static void prvCheckTimerCallback( TimerHandle_t xTimer ); * 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. */ -static void vRegTest1Task( void *pvParameters ); -static void vRegTest2Task( void *pvParameters ); +static void vRegTest1Task( void * pvParameters ); +static void vRegTest2Task( void * pvParameters ); /*-----------------------------------------------------------*/ /* The following two variables are used to communicate the status of the -register check tasks to the check software timer. If the variables keep -incrementing, then the register check tasks have not discovered any errors. If -a variable stops incrementing, then an error has been found. */ + * register check tasks to the check software timer. If the variables keep + * incrementing, then the register check tasks have 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 ) { -TimerHandle_t xCheckTimer = NULL; - - /* Start all the other standard demo/test tasks. The have not particular - functionality, but do demonstrate how to use the FreeRTOS API and test the - kernel port. */ - vStartQueueSetTasks(); - vStartQueueOverwriteTask( tskIDLE_PRIORITY ); - vStartDynamicPriorityTasks(); - vCreateBlockTimeTasks(); - vStartGenericQueueTasks( tskIDLE_PRIORITY ); - vStartRecursiveMutexTasks(); - vStartMathTasks( mainFLOP_TASK_PRIORITY ); - - /* Create the register check tasks, as described at the top of this - file */ - xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); - xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); - - /* Create the software timer that performs the 'check' functionality, - as described at the top of this file. */ - xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ - ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - if( xCheckTimer != NULL ) - { - xTimerStart( xCheckTimer, mainDONT_BLOCK ); - } - - /* 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 - insufficient FreeRTOS heap memory available for the idle and/or timer tasks - to be created. See the memory management section on the FreeRTOS web site - for more details. */ - for( ;; ) - { - __asm volatile( "NOP" ); - } + TimerHandle_t xCheckTimer = NULL; + + /* Start all the other standard demo/test tasks. The have not particular + * functionality, but do demonstrate how to use the FreeRTOS API and test the + * kernel port. */ + vStartQueueSetTasks(); + vStartQueueOverwriteTask( tskIDLE_PRIORITY ); + vStartDynamicPriorityTasks(); + vCreateBlockTimeTasks(); + vStartGenericQueueTasks( tskIDLE_PRIORITY ); + vStartRecursiveMutexTasks(); + vStartMathTasks( mainFLOP_TASK_PRIORITY ); + + /* Create the register check tasks, as described at the top of this + * file */ + xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); + + /* Create the software timer that performs the 'check' functionality, + * as described at the top of this file. */ + xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ + ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + if( xCheckTimer != NULL ) + { + xTimerStart( xCheckTimer, mainDONT_BLOCK ); + } + + /* 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 + * insufficient FreeRTOS heap memory available for the idle and/or timer tasks + * to be created. See the memory management section on the FreeRTOS web site + * for more details. */ + for( ; ; ) + { + __asm volatile ( "NOP" ); + } } /*-----------------------------------------------------------*/ static void prvCheckTimerCallback( TimerHandle_t xTimer ) { -static long lChangedTimerPeriodAlready = pdFALSE; -static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; -unsigned long ulErrorFound = pdFALSE; - - /* 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( xAreMathsTaskStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xAreQueueSetTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xIsQueueOverwriteTaskStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - /* Check that the register test 1 task is still running. */ - if( ulLastRegTest1Value == ulRegTest1LoopCounter ) - { - ulErrorFound = pdTRUE; - } - ulLastRegTest1Value = ulRegTest1LoopCounter; - - /* Check that the register test 2 task is still running. */ - if( ulLastRegTest2Value == ulRegTest2LoopCounter ) - { - ulErrorFound = pdTRUE; - } - ulLastRegTest2Value = ulRegTest2LoopCounter; - - /* Toggle the check LED to give an indication of the system status. If - the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then - everything is ok. A faster toggle indicates an error. */ - configTOGGLE_LED(); - - /* Have any errors been latch in ulErrorFound? If so, shorten the - period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. - This will result in an increase in the rate at which mainCHECK_LED - toggles. */ - if( ulErrorFound != pdFALSE ) - { - if( lChangedTimerPeriodAlready == pdFALSE ) - { - lChangedTimerPeriodAlready = pdTRUE; - - /* This call to xTimerChangePeriod() uses a zero block time. - Functions called from inside of a timer callback function must - *never* attempt to block. */ - xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); - } - } + static long lChangedTimerPeriodAlready = pdFALSE; + static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; + unsigned long ulErrorFound = pdFALSE; + + /* 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( xAreMathsTaskStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreQueueSetTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xIsQueueOverwriteTaskStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + /* Check that the register test 1 task is still running. */ + if( ulLastRegTest1Value == ulRegTest1LoopCounter ) + { + ulErrorFound = pdTRUE; + } + + ulLastRegTest1Value = ulRegTest1LoopCounter; + + /* Check that the register test 2 task is still running. */ + if( ulLastRegTest2Value == ulRegTest2LoopCounter ) + { + ulErrorFound = pdTRUE; + } + + ulLastRegTest2Value = ulRegTest2LoopCounter; + + /* Toggle the check LED to give an indication of the system status. If + * the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then + * everything is ok. A faster toggle indicates an error. */ + configTOGGLE_LED(); + + /* Have any errors been latch in ulErrorFound? If so, shorten the + * period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. + * This will result in an increase in the rate at which mainCHECK_LED + * toggles. */ + if( ulErrorFound != pdFALSE ) + { + if( lChangedTimerPeriodAlready == pdFALSE ) + { + lChangedTimerPeriodAlready = pdTRUE; + + /* This call to xTimerChangePeriod() uses a zero block time. + * Functions called from inside of a timer callback function must + * never* attempt to block. */ + xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); + } + } } /*-----------------------------------------------------------*/ /* This is a naked function. */ -static void vRegTest1Task( void *pvParameters ) +static void vRegTest1Task( void * pvParameters ) { - __asm volatile - ( - " \n" /* Fill the core registers with known values. */ - " mov r0, #100 \n" - " mov r1, #101 \n" - " mov r2, #102 \n" - " mov r3, #103 \n" - " mov r4, #104 \n" - " mov r5, #105 \n" - " mov r6, #106 \n" - " mov r7, #107 \n" - " mov r8, #108 \n" - " mov r9, #109 \n" - " mov r10, #110 \n" - " mov r11, #111 \n" - " mov r12, #112 \n" - " \n" - " vmov d0, r0, r1 \n" /* Fill the VFP registers with known values. */ - " vmov d1, r2, r3 \n" - " vmov d2, r4, r5 \n" - " vmov d3, r6, r7 \n" - " vmov d4, r8, r9 \n" - " vmov d5, r10, r11 \n" - " vmov d6, r0, r1 \n" - " vmov d7, r2, r3 \n" - " vmov d8, r4, r5 \n" - " vmov d9, r6, r7 \n" - " vmov d10, r8, r9 \n" - " vmov d11, r10, r11 \n" - " vmov d12, r0, r1 \n" - " vmov d13, r2, r3 \n" - " vmov d14, r4, r5 \n" - " vmov d15, r6, r7 \n" - " \n" - "reg1_loop: \n" /* Check all the VFP registers still contain the values set above." */ - " push { r0-r1 } \n" /* First save registers that are clobbered by the test. */ - " \n" - " vmov r0, r1, d0 \n" - " cmp r0, #100 \n" - " bne reg1_error_loopf \n" - " cmp r1, #101 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d1 \n" - " cmp r0, #102 \n" - " bne reg1_error_loopf \n" - " cmp r1, #103 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d2 \n" - " cmp r0, #104 \n" - " bne reg1_error_loopf \n" - " cmp r1, #105 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d3 \n" - " cmp r0, #106 \n" - " bne reg1_error_loopf \n" - " cmp r1, #107 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d4 \n" - " cmp r0, #108 \n" - " bne reg1_error_loopf \n" - " cmp r1, #109 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d5 \n" - " cmp r0, #110 \n" - " bne reg1_error_loopf \n" - " cmp r1, #111 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d6 \n" - " cmp r0, #100 \n" - " bne reg1_error_loopf \n" - " cmp r1, #101 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d7 \n" - " cmp r0, #102 \n" - " bne reg1_error_loopf \n" - " cmp r1, #103 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d8 \n" - " cmp r0, #104 \n" - " bne reg1_error_loopf \n" - " cmp r1, #105 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d9 \n" - " cmp r0, #106 \n" - " bne reg1_error_loopf \n" - " cmp r1, #107 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d10 \n" - " cmp r0, #108 \n" - " bne reg1_error_loopf \n" - " cmp r1, #109 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d11 \n" - " cmp r0, #110 \n" - " bne reg1_error_loopf \n" - " cmp r1, #111 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d12 \n" - " cmp r0, #100 \n" - " bne reg1_error_loopf \n" - " cmp r1, #101 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d13 \n" - " cmp r0, #102 \n" - " bne reg1_error_loopf \n" - " cmp r1, #103 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d14 \n" - " cmp r0, #104 \n" - " bne reg1_error_loopf \n" - " cmp r1, #105 \n" - " bne reg1_error_loopf \n" - " vmov r0, r1, d15 \n" - " cmp r0, #106 \n" - " bne reg1_error_loopf \n" - " cmp r1, #107 \n" - " bne reg1_error_loopf \n" - " \n" - " pop {r0-r1} \n" /* Restore the registers that were clobbered by the test. */ - " \n" - " b reg1_loopf_pass \n" /* VFP register test passed. Jump to the core register test. */ - " \n" - "reg1_error_loopf: \n" - " b reg1_error_loopf \n" /* If this line is hit then a VFP register value was found to be\n incorrect. */ - " \n" - "reg1_loopf_pass: \n" - " \n" - " cmp r0, #100 \n" - " bne reg1_error_loop \n" - " cmp r1, #101 \n" - " bne reg1_error_loop \n" - " cmp r2, #102 \n" - " bne reg1_error_loop \n" - " cmp r3, #103 \n" - " bne reg1_error_loop \n" - " cmp r4, #104 \n" - " bne reg1_error_loop \n" - " cmp r5, #105 \n" - " bne reg1_error_loop \n" - " cmp r6, #106 \n" - " bne reg1_error_loop \n" - " cmp r7, #107 \n" - " bne reg1_error_loop \n" - " cmp r8, #108 \n" - " bne reg1_error_loop \n" - " cmp r9, #109 \n" - " bne reg1_error_loop \n" - " cmp r10, #110 \n" - " bne reg1_error_loop \n" - " cmp r11, #111 \n" - " bne reg1_error_loop \n" - " cmp r12, #112 \n" - " bne reg1_error_loop \n" - " \n" - " push { r0-r1 } \n" /* Everything passed, increment the loop counter. */ - " ldr r0, =ulRegTest1LoopCounter \n" - " ldr r1, [r0] \n" - " adds r1, r1, #1 \n" - " str r1, [r0] \n" - " pop { r0-r1 } \n" - " \n" - " b reg1_loop \n" /* Start again. */ - " \n" - "reg1_error_loop: \n" /* If this line is hit then there was an error in a core register value. */ - " b reg1_error_loop \n" /* The loop ensures the loop counter stops incrementing. */ - " nop " - ); + __asm volatile + ( + " \n"/* Fill the core registers with known values. */ + " mov r0, #100 \n" + " mov r1, #101 \n" + " mov r2, #102 \n" + " mov r3, #103 \n" + " mov r4, #104 \n" + " mov r5, #105 \n" + " mov r6, #106 \n" + " mov r7, #107 \n" + " mov r8, #108 \n" + " mov r9, #109 \n" + " mov r10, #110 \n" + " mov r11, #111 \n" + " mov r12, #112 \n" + " \n" + " vmov d0, r0, r1 \n"/* Fill the VFP registers with known values. */ + " vmov d1, r2, r3 \n" + " vmov d2, r4, r5 \n" + " vmov d3, r6, r7 \n" + " vmov d4, r8, r9 \n" + " vmov d5, r10, r11 \n" + " vmov d6, r0, r1 \n" + " vmov d7, r2, r3 \n" + " vmov d8, r4, r5 \n" + " vmov d9, r6, r7 \n" + " vmov d10, r8, r9 \n" + " vmov d11, r10, r11 \n" + " vmov d12, r0, r1 \n" + " vmov d13, r2, r3 \n" + " vmov d14, r4, r5 \n" + " vmov d15, r6, r7 \n" + " \n" + "reg1_loop: \n"/* Check all the VFP registers still contain the values set above." */ + " push { r0-r1 } \n"/* First save registers that are clobbered by the test. */ + " \n" + " vmov r0, r1, d0 \n" + " cmp r0, #100 \n" + " bne reg1_error_loopf \n" + " cmp r1, #101 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d1 \n" + " cmp r0, #102 \n" + " bne reg1_error_loopf \n" + " cmp r1, #103 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d2 \n" + " cmp r0, #104 \n" + " bne reg1_error_loopf \n" + " cmp r1, #105 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d3 \n" + " cmp r0, #106 \n" + " bne reg1_error_loopf \n" + " cmp r1, #107 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d4 \n" + " cmp r0, #108 \n" + " bne reg1_error_loopf \n" + " cmp r1, #109 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d5 \n" + " cmp r0, #110 \n" + " bne reg1_error_loopf \n" + " cmp r1, #111 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d6 \n" + " cmp r0, #100 \n" + " bne reg1_error_loopf \n" + " cmp r1, #101 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d7 \n" + " cmp r0, #102 \n" + " bne reg1_error_loopf \n" + " cmp r1, #103 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d8 \n" + " cmp r0, #104 \n" + " bne reg1_error_loopf \n" + " cmp r1, #105 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d9 \n" + " cmp r0, #106 \n" + " bne reg1_error_loopf \n" + " cmp r1, #107 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d10 \n" + " cmp r0, #108 \n" + " bne reg1_error_loopf \n" + " cmp r1, #109 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d11 \n" + " cmp r0, #110 \n" + " bne reg1_error_loopf \n" + " cmp r1, #111 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d12 \n" + " cmp r0, #100 \n" + " bne reg1_error_loopf \n" + " cmp r1, #101 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d13 \n" + " cmp r0, #102 \n" + " bne reg1_error_loopf \n" + " cmp r1, #103 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d14 \n" + " cmp r0, #104 \n" + " bne reg1_error_loopf \n" + " cmp r1, #105 \n" + " bne reg1_error_loopf \n" + " vmov r0, r1, d15 \n" + " cmp r0, #106 \n" + " bne reg1_error_loopf \n" + " cmp r1, #107 \n" + " bne reg1_error_loopf \n" + " \n" + " pop {r0-r1} \n"/* Restore the registers that were clobbered by the test. */ + " \n" + " b reg1_loopf_pass \n"/* VFP register test passed. Jump to the core register test. */ + " \n" + "reg1_error_loopf: \n" + " b reg1_error_loopf \n"/* If this line is hit then a VFP register value was found to be\n incorrect. */ + " \n" + "reg1_loopf_pass: \n" + " \n" + " cmp r0, #100 \n" + " bne reg1_error_loop \n" + " cmp r1, #101 \n" + " bne reg1_error_loop \n" + " cmp r2, #102 \n" + " bne reg1_error_loop \n" + " cmp r3, #103 \n" + " bne reg1_error_loop \n" + " cmp r4, #104 \n" + " bne reg1_error_loop \n" + " cmp r5, #105 \n" + " bne reg1_error_loop \n" + " cmp r6, #106 \n" + " bne reg1_error_loop \n" + " cmp r7, #107 \n" + " bne reg1_error_loop \n" + " cmp r8, #108 \n" + " bne reg1_error_loop \n" + " cmp r9, #109 \n" + " bne reg1_error_loop \n" + " cmp r10, #110 \n" + " bne reg1_error_loop \n" + " cmp r11, #111 \n" + " bne reg1_error_loop \n" + " cmp r12, #112 \n" + " bne reg1_error_loop \n" + " \n" + " push { r0-r1 } \n"/* Everything passed, increment the loop counter. */ + " ldr r0, =ulRegTest1LoopCounter \n" + " ldr r1, [r0] \n" + " adds r1, r1, #1 \n" + " str r1, [r0] \n" + " pop { r0-r1 } \n" + " \n" + " b reg1_loop \n"/* Start again. */ + " \n" + "reg1_error_loop: \n"/* If this line is hit then there was an error in a core register value. */ + " b reg1_error_loop \n"/* The loop ensures the loop counter stops incrementing. */ + " nop " + ); } /*-----------------------------------------------------------*/ /* This is a naked function. */ -static void vRegTest2Task( void *pvParameters ) +static void vRegTest2Task( void * pvParameters ) { - __asm volatile - ( - " mov r0, #-1 \n" /* Set all the core registers to known values. */ - " mov r1, #1 \n" - " mov r2, #2 \n" - " mov r3, #3 \n" - " mov r4, #4 \n" - " mov r5, #5 \n" - " mov r6, #6 \n" - " mov r7, #7 \n" - " mov r8, #8 \n" - " mov r9, #9 \n" - " mov r10, #10 \n" - " mov r11, #11 \n" - " mov r12, #12 \n" - " \n" - " vmov d0, r0, r1 \n" /* Set all the VFP to known values. */ - " vmov d1, r2, r3 \n" - " vmov d2, r4, r5 \n" - " vmov d3, r6, r7 \n" - " vmov d4, r8, r9 \n" - " vmov d5, r10, r11 \n" - " vmov d6, r0, r1 \n" - " vmov d7, r2, r3 \n" - " vmov d8, r4, r5 \n" - " vmov d9, r6, r7 \n" - " vmov d10, r8, r9 \n" - " vmov d11, r10, r11 \n" - " vmov d12, r0, r1 \n" - " vmov d13, r2, r3 \n" - " vmov d14, r4, r5 \n" - " vmov d15, r6, r7 \n" - " \n" - "reg2_loop: \n" - " \n" - " push { r0-r1 } \n" /* Check all the VFP registers still contain the values set above. */ - " vmov r0, r1, d0 \n" /*First save registers that are clobbered by the test. */ - " cmp r0, #-1 \n" - " bne reg2_error_loopf \n" - " cmp r1, #1 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d1 \n" - " cmp r0, #2 \n" - " bne reg2_error_loopf \n" - " cmp r1, #3 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d2 \n" - " cmp r0, #4 \n" - " bne reg2_error_loopf \n" - " cmp r1, #5 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d3 \n" - " cmp r0, #6 \n" - " bne reg2_error_loopf \n" - " cmp r1, #7 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d4 \n" - " cmp r0, #8 \n" - " bne reg2_error_loopf \n" - " cmp r1, #9 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d5 \n" - " cmp r0, #10 \n" - " bne reg2_error_loopf \n" - " cmp r1, #11 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d6 \n" - " cmp r0, #-1 \n" - " bne reg2_error_loopf \n" - " cmp r1, #1 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d7 \n" - " cmp r0, #2 \n" - " bne reg2_error_loopf \n" - " cmp r1, #3 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d8 \n" - " cmp r0, #4 \n" - " bne reg2_error_loopf \n" - " cmp r1, #5 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d9 \n" - " cmp r0, #6 \n" - " bne reg2_error_loopf \n" - " cmp r1, #7 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d10 \n" - " cmp r0, #8 \n" - " bne reg2_error_loopf \n" - " cmp r1, #9 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d11 \n" - " cmp r0, #10 \n" - " bne reg2_error_loopf \n" - " cmp r1, #11 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d12 \n" - " cmp r0, #-1 \n" - " bne reg2_error_loopf \n" - " cmp r1, #1 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d13 \n" - " cmp r0, #2 \n" - " bne reg2_error_loopf \n" - " cmp r1, #3 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d14 \n" - " cmp r0, #4 \n" - " bne reg2_error_loopf \n" - " cmp r1, #5 \n" - " bne reg2_error_loopf \n" - " vmov r0, r1, d15 \n" - " cmp r0, #6 \n" - " bne reg2_error_loopf \n" - " cmp r1, #7 \n" - " bne reg2_error_loopf \n" - " \n" - " pop {r0-r1} \n" /* Restore the registers that were clobbered by the test. */ - " \n" - " b reg2_loopf_pass \n" /* VFP register test passed. Jump to the core register test. */ - " \n" - "reg2_error_loopf: \n" - " b reg2_error_loopf \n" /* If this line is hit then a VFP register value was found to be incorrect. */ - " \n" - "reg2_loopf_pass: \n" - " \n" - " cmp r0, #-1 \n" - " bne reg2_error_loop \n" - " cmp r1, #1 \n" - " bne reg2_error_loop \n" - " cmp r2, #2 \n" - " bne reg2_error_loop \n" - " cmp r3, #3 \n" - " bne reg2_error_loop \n" - " cmp r4, #4 \n" - " bne reg2_error_loop \n" - " cmp r5, #5 \n" - " bne reg2_error_loop \n" - " cmp r6, #6 \n" - " bne reg2_error_loop \n" - " cmp r7, #7 \n" - " bne reg2_error_loop \n" - " cmp r8, #8 \n" - " bne reg2_error_loop \n" - " cmp r9, #9 \n" - " bne reg2_error_loop \n" - " cmp r10, #10 \n" - " bne reg2_error_loop \n" - " cmp r11, #11 \n" - " bne reg2_error_loop \n" - " cmp r12, #12 \n" - " bne reg2_error_loop \n" - " \n" - " push { r0-r1 } \n" /* Increment the loop counter to indicate this test is still functioning correctly. */ - " ldr r0, =ulRegTest2LoopCounter \n" - " ldr r1, [r0] \n" - " adds r1, r1, #1 \n" - " str r1, [r0] \n" - " \n" - " movs r0, #0x01 \n" /* Yield to increase test coverage. */ - " ldr r1, =0xe000ed04 \n" /*NVIC_INT_CTRL */ - " lsl r0, r0, #28 \n" /* Shift to PendSV bit */ - " str r0, [r1] \n" - " dsb \n" - " pop { r0-r1 } \n" - " \n" - " b reg2_loop \n" /* Start again. */ - " \n" - "reg2_error_loop: \n" /* If this line is hit then there was an error in a core register value. */ - " b reg2_error_loop \n" /* This loop ensures the loop counter variable stops incrementing. */ - " nop \n" - ); + __asm volatile + ( + " mov r0, #-1 \n"/* Set all the core registers to known values. */ + " mov r1, #1 \n" + " mov r2, #2 \n" + " mov r3, #3 \n" + " mov r4, #4 \n" + " mov r5, #5 \n" + " mov r6, #6 \n" + " mov r7, #7 \n" + " mov r8, #8 \n" + " mov r9, #9 \n" + " mov r10, #10 \n" + " mov r11, #11 \n" + " mov r12, #12 \n" + " \n" + " vmov d0, r0, r1 \n"/* Set all the VFP to known values. */ + " vmov d1, r2, r3 \n" + " vmov d2, r4, r5 \n" + " vmov d3, r6, r7 \n" + " vmov d4, r8, r9 \n" + " vmov d5, r10, r11 \n" + " vmov d6, r0, r1 \n" + " vmov d7, r2, r3 \n" + " vmov d8, r4, r5 \n" + " vmov d9, r6, r7 \n" + " vmov d10, r8, r9 \n" + " vmov d11, r10, r11 \n" + " vmov d12, r0, r1 \n" + " vmov d13, r2, r3 \n" + " vmov d14, r4, r5 \n" + " vmov d15, r6, r7 \n" + " \n" + "reg2_loop: \n" + " \n" + " push { r0-r1 } \n"/* Check all the VFP registers still contain the values set above. */ + " vmov r0, r1, d0 \n"/*First save registers that are clobbered by the test. */ + " cmp r0, #-1 \n" + " bne reg2_error_loopf \n" + " cmp r1, #1 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d1 \n" + " cmp r0, #2 \n" + " bne reg2_error_loopf \n" + " cmp r1, #3 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d2 \n" + " cmp r0, #4 \n" + " bne reg2_error_loopf \n" + " cmp r1, #5 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d3 \n" + " cmp r0, #6 \n" + " bne reg2_error_loopf \n" + " cmp r1, #7 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d4 \n" + " cmp r0, #8 \n" + " bne reg2_error_loopf \n" + " cmp r1, #9 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d5 \n" + " cmp r0, #10 \n" + " bne reg2_error_loopf \n" + " cmp r1, #11 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d6 \n" + " cmp r0, #-1 \n" + " bne reg2_error_loopf \n" + " cmp r1, #1 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d7 \n" + " cmp r0, #2 \n" + " bne reg2_error_loopf \n" + " cmp r1, #3 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d8 \n" + " cmp r0, #4 \n" + " bne reg2_error_loopf \n" + " cmp r1, #5 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d9 \n" + " cmp r0, #6 \n" + " bne reg2_error_loopf \n" + " cmp r1, #7 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d10 \n" + " cmp r0, #8 \n" + " bne reg2_error_loopf \n" + " cmp r1, #9 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d11 \n" + " cmp r0, #10 \n" + " bne reg2_error_loopf \n" + " cmp r1, #11 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d12 \n" + " cmp r0, #-1 \n" + " bne reg2_error_loopf \n" + " cmp r1, #1 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d13 \n" + " cmp r0, #2 \n" + " bne reg2_error_loopf \n" + " cmp r1, #3 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d14 \n" + " cmp r0, #4 \n" + " bne reg2_error_loopf \n" + " cmp r1, #5 \n" + " bne reg2_error_loopf \n" + " vmov r0, r1, d15 \n" + " cmp r0, #6 \n" + " bne reg2_error_loopf \n" + " cmp r1, #7 \n" + " bne reg2_error_loopf \n" + " \n" + " pop {r0-r1} \n"/* Restore the registers that were clobbered by the test. */ + " \n" + " b reg2_loopf_pass \n"/* VFP register test passed. Jump to the core register test. */ + " \n" + "reg2_error_loopf: \n" + " b reg2_error_loopf \n"/* If this line is hit then a VFP register value was found to be incorrect. */ + " \n" + "reg2_loopf_pass: \n" + " \n" + " cmp r0, #-1 \n" + " bne reg2_error_loop \n" + " cmp r1, #1 \n" + " bne reg2_error_loop \n" + " cmp r2, #2 \n" + " bne reg2_error_loop \n" + " cmp r3, #3 \n" + " bne reg2_error_loop \n" + " cmp r4, #4 \n" + " bne reg2_error_loop \n" + " cmp r5, #5 \n" + " bne reg2_error_loop \n" + " cmp r6, #6 \n" + " bne reg2_error_loop \n" + " cmp r7, #7 \n" + " bne reg2_error_loop \n" + " cmp r8, #8 \n" + " bne reg2_error_loop \n" + " cmp r9, #9 \n" + " bne reg2_error_loop \n" + " cmp r10, #10 \n" + " bne reg2_error_loop \n" + " cmp r11, #11 \n" + " bne reg2_error_loop \n" + " cmp r12, #12 \n" + " bne reg2_error_loop \n" + " \n" + " push { r0-r1 } \n"/* Increment the loop counter to indicate this test is still functioning correctly. */ + " ldr r0, =ulRegTest2LoopCounter \n" + " ldr r1, [r0] \n" + " adds r1, r1, #1 \n" + " str r1, [r0] \n" + " \n" + " movs r0, #0x01 \n"/* Yield to increase test coverage. */ + " ldr r1, =0xe000ed04 \n"/*NVIC_INT_CTRL */ + " lsl r0, r0, #28 \n"/* Shift to PendSV bit */ + " str r0, [r1] \n" + " dsb \n" + " pop { r0-r1 } \n" + " \n" + " b reg2_loop \n"/* Start again. */ + " \n" + "reg2_error_loop: \n"/* If this line is hit then there was an error in a core register value. */ + " b reg2_error_loop \n"/* This loop ensures the loop counter variable stops incrementing. */ + " nop \n" + ); } - - - diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4500_GCC_Atollic/src/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4500_GCC_Atollic/src/FreeRTOSConfig.h index ab48d59d0ae..a88e6060788 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4500_GCC_Atollic/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4500_GCC_Atollic/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4500_GCC_Atollic/src/main.c b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4500_GCC_Atollic/src/main.c index 2533b196dec..6aeecbfd782 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4500_GCC_Atollic/src/main.c +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4500_GCC_Atollic/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4500_GCC_Atollic/src/main_blinky.c b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4500_GCC_Atollic/src/main_blinky.c index 6bc71e54b00..111355d3ce7 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4500_GCC_Atollic/src/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4500_GCC_Atollic/src/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4500_GCC_Atollic/src/main_full.c b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4500_GCC_Atollic/src/main_full.c index f27a01f3b22..fed47ebe7cf 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4500_GCC_Atollic/src/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M4F_Infineon_XMC4500_GCC_Atollic/src/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_M0_LPC43xx_Keil/M4/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M4F_M0_LPC43xx_Keil/M4/FreeRTOSConfig.h index a6b183c4b04..0d5e57261f5 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_M0_LPC43xx_Keil/M4/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M4F_M0_LPC43xx_Keil/M4/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_M0_LPC43xx_Keil/M4/ParTest.c b/FreeRTOS/Demo/CORTEX_M4F_M0_LPC43xx_Keil/M4/ParTest.c index afb7941f381..bfc4086970e 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_M0_LPC43xx_Keil/M4/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_M4F_M0_LPC43xx_Keil/M4/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_M0_LPC43xx_Keil/M4/RegTest.c b/FreeRTOS/Demo/CORTEX_M4F_M0_LPC43xx_Keil/M4/RegTest.c index d77cd279ecb..44b4a3950d9 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_M0_LPC43xx_Keil/M4/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_M4F_M0_LPC43xx_Keil/M4/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_M0_LPC43xx_Keil/M4/main.c b/FreeRTOS/Demo/CORTEX_M4F_M0_LPC43xx_Keil/M4/main.c index d47e418ec8d..156c82ab68f 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_M0_LPC43xx_Keil/M4/main.c +++ b/FreeRTOS/Demo/CORTEX_M4F_M0_LPC43xx_Keil/M4/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/FreeRTOSConfig.h index a3f89533b13..1f2637a1db6 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/IntQueueTimer.c index cbdb78d7815..0a624dde752 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/IntQueueTimer.h index 76d462f796c..8f1a766766e 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/RegTest.c b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/RegTest.c index 9bf2730e56a..fa7df389c61 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/RunTimeStatsTimer.c b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/RunTimeStatsTimer.c index f489b004a7d..93626766142 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/RunTimeStatsTimer.c +++ b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/RunTimeStatsTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/main_full.c b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/main_full.c index 66eff7fcc90..6540c64efcf 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/serial.c b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/serial.c index 43b818db0d6..ffab414d684 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/serial.c +++ b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/Full_Demo/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/SimplyBlinkyDemo/main_blinky.c b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/SimplyBlinkyDemo/main_blinky.c index fc7c3929a91..0fbd8822b67 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/SimplyBlinkyDemo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/SimplyBlinkyDemo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/main.c b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/main.c index 92fab1043c9..d38fbf2d5a8 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/main.c +++ b/FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -57,8 +57,8 @@ /*-----------------------------------------------------------*/ /* NOTE: If an IAR build results in an undefined "reference to __write" linker -error then set the printf formatter project option to "tiny" and the scanf -formatter project option to "small". */ + * error then set the printf formatter project option to "tiny" and the scanf + * formatter project option to "small". */ /* * Set up the hardware ready to run this demo. @@ -76,99 +76,107 @@ extern void main_full( void ); int main( void ) { - /* See http://www.FreeRTOS.org/TI_MSP432_Free_RTOS_Demo.html for instructions. */ - - /* Prepare the hardware to run this demo. */ - prvSetupHardware(); - - /* The configCREATE_SIMPLE_TICKLESS_DEMO setting is described at the top - of this file. */ - #if( configCREATE_SIMPLE_TICKLESS_DEMO == 1 ) - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* See http://www.FreeRTOS.org/TI_MSP432_Free_RTOS_Demo.html for instructions. */ + + /* Prepare the hardware to run this demo. */ + prvSetupHardware(); + + /* The configCREATE_SIMPLE_TICKLESS_DEMO setting is described at the top + * of this file. */ + #if ( configCREATE_SIMPLE_TICKLESS_DEMO == 1 ) + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { -extern void FPU_enableModule( void ); + extern void FPU_enableModule( void ); - /* The clocks are not configured here, but inside main_full() and - main_blinky() as the full demo uses a fast clock and the blinky demo uses - a slow clock. */ + /* The clocks are not configured here, but inside main_full() and + * main_blinky() as the full demo uses a fast clock and the blinky demo uses + * a slow clock. */ - /* Stop the watchdog timer. */ - MAP_WDT_A_holdTimer(); + /* Stop the watchdog timer. */ + MAP_WDT_A_holdTimer(); - /* Ensure the FPU is enabled. */ - FPU_enableModule(); + /* Ensure the FPU is enabled. */ + FPU_enableModule(); - /* Selecting P1.2 and P1.3 in UART mode and P1.0 as output (LED) */ - MAP_GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_P1, GPIO_PIN2 | GPIO_PIN3, GPIO_PRIMARY_MODULE_FUNCTION ); - MAP_GPIO_setOutputLowOnPin( GPIO_PORT_P1, GPIO_PIN0 ); - MAP_GPIO_setAsOutputPin( GPIO_PORT_P1, GPIO_PIN0 ); + /* Selecting P1.2 and P1.3 in UART mode and P1.0 as output (LED) */ + MAP_GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_P1, GPIO_PIN2 | GPIO_PIN3, GPIO_PRIMARY_MODULE_FUNCTION ); + MAP_GPIO_setOutputLowOnPin( GPIO_PORT_P1, GPIO_PIN0 ); + MAP_GPIO_setAsOutputPin( GPIO_PORT_P1, GPIO_PIN0 ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -void *malloc( size_t xSize ) +void * malloc( size_t xSize ) { - /* There should not be a heap defined, so trap any attempts to call - malloc. */ - Interrupt_disableMaster(); - for( ;; ); + /* There should not be a heap defined, so trap any attempts to call + * malloc. */ + Interrupt_disableMaster(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ - - diff --git a/FreeRTOS/Demo/CORTEX_M4F_STM32F407ZG-SK/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M4F_STM32F407ZG-SK/FreeRTOSConfig.h index 7ce23d402a7..e4f63745f2f 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_STM32F407ZG-SK/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M4F_STM32F407ZG-SK/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_STM32F407ZG-SK/ParTest.c b/FreeRTOS/Demo/CORTEX_M4F_STM32F407ZG-SK/ParTest.c index fdfdb753327..46f9cbaf342 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_STM32F407ZG-SK/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_M4F_STM32F407ZG-SK/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4F_STM32F407ZG-SK/main.c b/FreeRTOS/Demo/CORTEX_M4F_STM32F407ZG-SK/main.c index 7ae4290edae..f21d4b4aac4 100644 --- a/FreeRTOS/Demo/CORTEX_M4F_STM32F407ZG-SK/main.c +++ b/FreeRTOS/Demo/CORTEX_M4F_STM32F407ZG-SK/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -129,35 +129,35 @@ #include "stm32f4xx_conf.h" /* Priorities for the demo application tasks. */ -#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1UL ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2UL ) -#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 mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1UL ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2UL ) +#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 ) /* The LED used by the check timer. */ -#define mainCHECK_LED ( 3UL ) +#define mainCHECK_LED ( 3UL ) /* A block time of zero simply means "don't block". */ -#define mainDONT_BLOCK ( 0UL ) +#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 mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS ) + * 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 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_PERIOD_MS constant. */ -#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) + * 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_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) /* Set mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY to 1 to create a simple demo. -Set mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY to 0 to create a much more -comprehensive test application. See the comments at the top of this file, and -the documentation page on the http://www.FreeRTOS.org web site for more -information. */ -#define mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY 0 + * Set mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY to 0 to create a much more + * comprehensive test application. See the comments at the top of this file, and + * the documentation page on the http://www.FreeRTOS.org web site for more + * information. */ +#define mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY 0 /*-----------------------------------------------------------*/ @@ -182,8 +182,8 @@ static void prvSetupNestedFPUInterruptsTest( void ); * 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. */ -extern void vRegTest1Task( void *pvParameters ); -extern void vRegTest2Task( void *pvParameters ); +extern void vRegTest1Task( void * pvParameters ); +extern void vRegTest2Task( void * pvParameters ); extern void vRegTestClearFlopRegistersToParameterValue( unsigned long ulValue ); extern unsigned long ulRegTestCheckFlopRegistersContainParameterValue( unsigned long ulValue ); @@ -192,7 +192,7 @@ extern unsigned long ulRegTestCheckFlopRegistersContainParameterValue( unsigned * to demonstrate how to write interrupt service routines, and how to * synchronise a task with an interrupt. */ -static void prvButtonTestTask( void *pvParameters ); +static void prvButtonTestTask( void * pvParameters ); /* * This file can be used to create either a simple LED flasher example, or a @@ -208,422 +208,433 @@ static void prvOptionallyCreateComprehensveTestApplication( void ); /*-----------------------------------------------------------*/ /* The following two variables are used to communicate the status of the -register check tasks to the check software timer. If the variables keep -incrementing, then the register check tasks have not discovered any errors. If -a variable stops incrementing, then an error has been found. */ + * register check tasks to the check software timer. If the variables keep + * incrementing, then the register check tasks have not discovered any errors. If + * a variable stops incrementing, then an error has been found. */ volatile unsigned long ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL; /* The following variables are used to verify that the interrupt nesting depth -is as intended. ulFPUInterruptNesting is incremented on entry to an interrupt -that uses the FPU, and decremented on exit of the same interrupt. -ulMaxFPUInterruptNesting latches the highest value reached by -ulFPUInterruptNesting. These variables have no other purpose. */ + * is as intended. ulFPUInterruptNesting is incremented on entry to an interrupt + * that uses the FPU, and decremented on exit of the same interrupt. + * ulMaxFPUInterruptNesting latches the highest value reached by + * ulFPUInterruptNesting. These variables have no other purpose. */ volatile unsigned long ulFPUInterruptNesting = 0UL, ulMaxFPUInterruptNesting = 0UL; /* The semaphore used to demonstrate a task being synchronised with an -interrupt. */ + * interrupt. */ static SemaphoreHandle_t xTestSemaphore = NULL; /* The variable that is incremented by the task synchronised with the button -interrupt. */ + * interrupt. */ volatile unsigned long ulButtonPressCounts = 0UL; /*-----------------------------------------------------------*/ -int main(void) +int main( void ) { - /* Configure the hardware ready to run the test. */ - prvSetupHardware(); - - /* Start standard demo/test application flash tasks. See the comments at - the top of this file. The LED flash tasks are always created. The other - tasks are only created if mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY is set to - 0 (at the top of this file). See the comments at the top of this file for - more information. */ - vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY ); - - /* The following function will only create more tasks and timers if - mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY is set to 0 (at the top of this - file). See the comments at the top of this file for more information. */ - prvOptionallyCreateComprehensveTestApplication(); - - /* 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 - insufficient FreeRTOS heap memory available for the idle and/or timer tasks - to be created. See the memory management section on the FreeRTOS web site - for more details. */ - for( ;; ); + /* Configure the hardware ready to run the test. */ + prvSetupHardware(); + + /* Start standard demo/test application flash tasks. See the comments at + * the top of this file. The LED flash tasks are always created. The other + * tasks are only created if mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY is set to + * 0 (at the top of this file). See the comments at the top of this file for + * more information. */ + vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY ); + + /* The following function will only create more tasks and timers if + * mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY is set to 0 (at the top of this + * file). See the comments at the top of this file for more information. */ + prvOptionallyCreateComprehensveTestApplication(); + + /* 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 + * insufficient FreeRTOS heap memory available for the idle and/or timer tasks + * to be created. See the memory management section on the FreeRTOS web site + * for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ static void prvCheckTimerCallback( TimerHandle_t xTimer ) { -static long lChangedTimerPeriodAlready = pdFALSE; -static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; -long lErrorFound = pdFALSE; - - /* 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( xAreMathsTaskStillRunning() != pdTRUE ) - { - lErrorFound = pdTRUE; - } - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - lErrorFound = pdTRUE; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - lErrorFound = pdTRUE; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - lErrorFound = pdTRUE; - } - - if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - lErrorFound = pdTRUE; - } - - if ( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - lErrorFound = pdTRUE; - } - - if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - lErrorFound = pdTRUE; - } - - if( xIsCreateTaskStillRunning() != pdTRUE ) - { - lErrorFound = pdTRUE; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - lErrorFound = pdTRUE; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - lErrorFound = pdTRUE; - } - - /* Check that the register test 1 task is still running. */ - if( ulLastRegTest1Value == ulRegTest1LoopCounter ) - { - lErrorFound = pdTRUE; - } - ulLastRegTest1Value = ulRegTest1LoopCounter; - - /* Check that the register test 2 task is still running. */ - if( ulLastRegTest2Value == ulRegTest2LoopCounter ) - { - lErrorFound = pdTRUE; - } - ulLastRegTest2Value = ulRegTest2LoopCounter; - - /* Toggle the check LED to give an indication of the system status. If - the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then - everything is ok. A faster toggle indicates an error. */ - vParTestToggleLED( mainCHECK_LED ); - - /* Have any errors been latch in lErrorFound? If so, shorten the - period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. - This will result in an increase in the rate at which mainCHECK_LED - toggles. */ - if( lErrorFound != pdFALSE ) - { - if( lChangedTimerPeriodAlready == pdFALSE ) - { - lChangedTimerPeriodAlready = pdTRUE; - - /* This call to xTimerChangePeriod() uses a zero block time. - Functions called from inside of a timer callback function must - *never* attempt to block. */ - xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); - } - } + static long lChangedTimerPeriodAlready = pdFALSE; + static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; + long lErrorFound = pdFALSE; + + /* 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( xAreMathsTaskStillRunning() != pdTRUE ) + { + lErrorFound = pdTRUE; + } + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + lErrorFound = pdTRUE; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + lErrorFound = pdTRUE; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + lErrorFound = pdTRUE; + } + + if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + lErrorFound = pdTRUE; + } + + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + lErrorFound = pdTRUE; + } + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + lErrorFound = pdTRUE; + } + + if( xIsCreateTaskStillRunning() != pdTRUE ) + { + lErrorFound = pdTRUE; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + lErrorFound = pdTRUE; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + lErrorFound = pdTRUE; + } + + /* Check that the register test 1 task is still running. */ + if( ulLastRegTest1Value == ulRegTest1LoopCounter ) + { + lErrorFound = pdTRUE; + } + + ulLastRegTest1Value = ulRegTest1LoopCounter; + + /* Check that the register test 2 task is still running. */ + if( ulLastRegTest2Value == ulRegTest2LoopCounter ) + { + lErrorFound = pdTRUE; + } + + ulLastRegTest2Value = ulRegTest2LoopCounter; + + /* Toggle the check LED to give an indication of the system status. If + * the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then + * everything is ok. A faster toggle indicates an error. */ + vParTestToggleLED( mainCHECK_LED ); + + /* Have any errors been latch in lErrorFound? If so, shorten the + * period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. + * This will result in an increase in the rate at which mainCHECK_LED + * toggles. */ + if( lErrorFound != pdFALSE ) + { + if( lChangedTimerPeriodAlready == pdFALSE ) + { + lChangedTimerPeriodAlready = pdTRUE; + + /* This call to xTimerChangePeriod() uses a zero block time. + * Functions called from inside of a timer callback function must + * never* attempt to block. */ + xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); + } + } } /*-----------------------------------------------------------*/ -static void prvButtonTestTask( void *pvParameters ) +static void prvButtonTestTask( void * pvParameters ) { - configASSERT( xTestSemaphore ); - - /* This is the task used as an example of how to synchronise a task with - an interrupt. Each time the button interrupt gives the semaphore, this task - will unblock, increment its execution counter, then return to block - again. */ - - /* Take the semaphore before started to ensure it is in the correct - state. */ - xSemaphoreTake( xTestSemaphore, mainDONT_BLOCK ); - - for( ;; ) - { - xSemaphoreTake( xTestSemaphore, portMAX_DELAY ); - ulButtonPressCounts++; - } + configASSERT( xTestSemaphore ); + + /* This is the task used as an example of how to synchronise a task with + * an interrupt. Each time the button interrupt gives the semaphore, this task + * will unblock, increment its execution counter, then return to block + * again. */ + + /* Take the semaphore before started to ensure it is in the correct + * state. */ + xSemaphoreTake( xTestSemaphore, mainDONT_BLOCK ); + + for( ; ; ) + { + xSemaphoreTake( xTestSemaphore, portMAX_DELAY ); + ulButtonPressCounts++; + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Setup STM32 system (clock, PLL and Flash configuration) */ - SystemInit(); + /* Setup STM32 system (clock, PLL and Flash configuration) */ + SystemInit(); - /* Ensure all priority bits are assigned as preemption priority bits. */ - NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); + /* Ensure all priority bits are assigned as preemption priority bits. */ + NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); - /* Setup the LED outputs. */ - vParTestInitialise(); + /* Setup the LED outputs. */ + vParTestInitialise(); - /* Configure the button input. This configures the interrupt to use the - lowest interrupt priority, so it is ok to use the ISR safe FreeRTOS API - from the button interrupt handler. */ - STM_EVAL_PBInit( BUTTON_USER, BUTTON_MODE_EXTI ); + /* Configure the button input. This configures the interrupt to use the + * lowest interrupt priority, so it is ok to use the ISR safe FreeRTOS API + * from the button interrupt handler. */ + STM_EVAL_PBInit( BUTTON_USER, BUTTON_MODE_EXTI ); } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - #if ( mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY == 0 ) - { - /* Just to verify that the interrupt nesting behaves as expected, - increment ulFPUInterruptNesting on entry, and decrement it on exit. */ - ulFPUInterruptNesting++; - - /* Fill the FPU registers with 0. */ - vRegTestClearFlopRegistersToParameterValue( 0UL ); - - /* Trigger a timer 2 interrupt, which will fill the registers with a - different value and itself trigger a timer 3 interrupt. Note that the - timers are not actually used. The timer 2 and 3 interrupt vectors are - just used for convenience. */ - NVIC_SetPendingIRQ( TIM2_IRQn ); - - /* Ensure that, after returning from the nested interrupts, all the FPU - registers contain the value to which they were set by the tick hook - function. */ - configASSERT( ulRegTestCheckFlopRegistersContainParameterValue( 0UL ) ); - - ulFPUInterruptNesting--; - } - #endif + #if ( mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY == 0 ) + { + /* Just to verify that the interrupt nesting behaves as expected, + * increment ulFPUInterruptNesting on entry, and decrement it on exit. */ + ulFPUInterruptNesting++; + + /* Fill the FPU registers with 0. */ + vRegTestClearFlopRegistersToParameterValue( 0UL ); + + /* Trigger a timer 2 interrupt, which will fill the registers with a + * different value and itself trigger a timer 3 interrupt. Note that the + * timers are not actually used. The timer 2 and 3 interrupt vectors are + * just used for convenience. */ + NVIC_SetPendingIRQ( TIM2_IRQn ); + + /* Ensure that, after returning from the nested interrupts, all the FPU + * registers contain the value to which they were set by the tick hook + * function. */ + configASSERT( ulRegTestCheckFlopRegistersContainParameterValue( 0UL ) ); + + ulFPUInterruptNesting--; + } + #endif /* if ( mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY == 0 ) */ } /*-----------------------------------------------------------*/ static void prvSetupNestedFPUInterruptsTest( void ) { -NVIC_InitTypeDef NVIC_InitStructure; - - /* Enable the TIM2 interrupt in the NVIC. The timer itself is not used, - just its interrupt vector to force nesting from software. TIM2 must have - a lower priority than TIM3, and both must have priorities above - configMAX_SYSCALL_INTERRUPT_PRIORITY. */ - NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY - 1; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; - NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - NVIC_Init( &NVIC_InitStructure ); - - /* Enable the TIM3 interrupt in the NVIC. The timer itself is not used, - just its interrupt vector to force nesting from software. TIM2 must have - a lower priority than TIM3, and both must have priorities above - configMAX_SYSCALL_INTERRUPT_PRIORITY. */ - NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY - 2; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; - NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - NVIC_Init( &NVIC_InitStructure ); + NVIC_InitTypeDef NVIC_InitStructure; + + /* Enable the TIM2 interrupt in the NVIC. The timer itself is not used, + * just its interrupt vector to force nesting from software. TIM2 must have + * a lower priority than TIM3, and both must have priorities above + * configMAX_SYSCALL_INTERRUPT_PRIORITY. */ + NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn; + NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY - 1; + NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; + NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; + NVIC_Init( &NVIC_InitStructure ); + + /* Enable the TIM3 interrupt in the NVIC. The timer itself is not used, + * just its interrupt vector to force nesting from software. TIM2 must have + * a lower priority than TIM3, and both must have priorities above + * configMAX_SYSCALL_INTERRUPT_PRIORITY. */ + NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn; + NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY - 2; + NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; + NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; + NVIC_Init( &NVIC_InitStructure ); } /*-----------------------------------------------------------*/ void TIM3_IRQHandler( void ) { - /* Just to verify that the interrupt nesting behaves as expected, increment - ulFPUInterruptNesting on entry, and decrement it on exit. */ - ulFPUInterruptNesting++; - - /* This is the highest priority interrupt in the chain of forced nesting - interrupts, so latch the maximum value reached by ulFPUInterruptNesting. - This is done purely to allow verification that the nesting depth reaches - that intended. */ - if( ulFPUInterruptNesting > ulMaxFPUInterruptNesting ) - { - ulMaxFPUInterruptNesting = ulFPUInterruptNesting; - } - - /* Fill the FPU registers with 99 to overwrite the values written by - TIM2_IRQHandler(). */ - vRegTestClearFlopRegistersToParameterValue( 99UL ); - - ulFPUInterruptNesting--; + /* Just to verify that the interrupt nesting behaves as expected, increment + * ulFPUInterruptNesting on entry, and decrement it on exit. */ + ulFPUInterruptNesting++; + + /* This is the highest priority interrupt in the chain of forced nesting + * interrupts, so latch the maximum value reached by ulFPUInterruptNesting. + * This is done purely to allow verification that the nesting depth reaches + * that intended. */ + if( ulFPUInterruptNesting > ulMaxFPUInterruptNesting ) + { + ulMaxFPUInterruptNesting = ulFPUInterruptNesting; + } + + /* Fill the FPU registers with 99 to overwrite the values written by + * TIM2_IRQHandler(). */ + vRegTestClearFlopRegistersToParameterValue( 99UL ); + + ulFPUInterruptNesting--; } /*-----------------------------------------------------------*/ void TIM2_IRQHandler( void ) { - /* Just to verify that the interrupt nesting behaves as expected, increment - ulFPUInterruptNesting on entry, and decrement it on exit. */ - ulFPUInterruptNesting++; + /* Just to verify that the interrupt nesting behaves as expected, increment + * ulFPUInterruptNesting on entry, and decrement it on exit. */ + ulFPUInterruptNesting++; - /* Fill the FPU registers with 1. */ - vRegTestClearFlopRegistersToParameterValue( 1UL ); + /* Fill the FPU registers with 1. */ + vRegTestClearFlopRegistersToParameterValue( 1UL ); - /* Trigger a timer 3 interrupt, which will fill the registers with a - different value. */ - NVIC_SetPendingIRQ( TIM3_IRQn ); + /* Trigger a timer 3 interrupt, which will fill the registers with a + * different value. */ + NVIC_SetPendingIRQ( TIM3_IRQn ); - /* Ensure that, after returning from the nesting interrupt, all the FPU - registers contain the value to which they were set by this interrupt - function. */ - configASSERT( ulRegTestCheckFlopRegistersContainParameterValue( 1UL ) ); + /* Ensure that, after returning from the nesting interrupt, all the FPU + * registers contain the value to which they were set by this interrupt + * function. */ + configASSERT( ulRegTestCheckFlopRegistersContainParameterValue( 1UL ) ); - ulFPUInterruptNesting--; + ulFPUInterruptNesting--; } /*-----------------------------------------------------------*/ static void prvOptionallyCreateComprehensveTestApplication( void ) { - #if ( mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY == 0 ) - { - TimerHandle_t xCheckTimer = NULL; - - /* Configure the interrupts used to test FPU registers being used from - nested interrupts. */ - prvSetupNestedFPUInterruptsTest(); - - /* Start all the other standard demo/test tasks. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vStartDynamicPriorityTasks(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vCreateBlockTimeTasks(); - vStartCountingSemaphoreTasks(); - vStartGenericQueueTasks( tskIDLE_PRIORITY ); - vStartRecursiveMutexTasks(); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - - /* Most importantly, start the tasks that use the FPU. */ - vStartMathTasks( mainFLOP_TASK_PRIORITY ); - - /* Create the register check tasks, as described at the top of this - file */ - xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); - xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); - - /* Create the semaphore that is used to demonstrate a task being - synchronised with an interrupt. */ - vSemaphoreCreateBinary( xTestSemaphore ); - - /* Create the task that is unblocked by the demonstration interrupt. */ - xTaskCreate( prvButtonTestTask, "BtnTest", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); - - /* Create the software timer that performs the 'check' functionality, - as described at the top of this file. */ - xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ - ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - if( xCheckTimer != NULL ) - { - xTimerStart( xCheckTimer, mainDONT_BLOCK ); - } - - /* This task has to be created last as it keeps account of the number of - tasks it expects to see running. */ - vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - } - #else /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */ - { - /* Just to prevent compiler warnings when the configuration options are - set such that these static functions are not used. */ - ( void ) vRegTest1Task; - ( void ) vRegTest2Task; - ( void ) prvCheckTimerCallback; - ( void ) prvSetupNestedFPUInterruptsTest; - } - #endif /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */ + #if ( mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY == 0 ) + { + TimerHandle_t xCheckTimer = NULL; + + /* Configure the interrupts used to test FPU registers being used from + * nested interrupts. */ + prvSetupNestedFPUInterruptsTest(); + + /* Start all the other standard demo/test tasks. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartDynamicPriorityTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vCreateBlockTimeTasks(); + vStartCountingSemaphoreTasks(); + vStartGenericQueueTasks( tskIDLE_PRIORITY ); + vStartRecursiveMutexTasks(); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + + /* Most importantly, start the tasks that use the FPU. */ + vStartMathTasks( mainFLOP_TASK_PRIORITY ); + + /* Create the register check tasks, as described at the top of this + * file */ + xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); + + /* Create the semaphore that is used to demonstrate a task being + * synchronised with an interrupt. */ + vSemaphoreCreateBinary( xTestSemaphore ); + + /* Create the task that is unblocked by the demonstration interrupt. */ + xTaskCreate( prvButtonTestTask, "BtnTest", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL ); + + /* Create the software timer that performs the 'check' functionality, + * as described at the top of this file. */ + xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ + ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + if( xCheckTimer != NULL ) + { + xTimerStart( xCheckTimer, mainDONT_BLOCK ); + } + + /* This task has to be created last as it keeps account of the number of + * tasks it expects to see running. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + } + #else /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */ + { + /* Just to prevent compiler warnings when the configuration options are + * set such that these static functions are not used. */ + ( void ) vRegTest1Task; + ( void ) vRegTest2Task; + ( void ) prvCheckTimerCallback; + ( void ) prvSetupNestedFPUInterruptsTest; + } + #endif /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */ } /*-----------------------------------------------------------*/ -void EXTI9_5_IRQHandler(void) +void EXTI9_5_IRQHandler( void ) { -long lHigherPriorityTaskWoken = pdFALSE; - - /* Only line 6 is enabled, so there is no need to test which line generated - the interrupt. */ - EXTI_ClearITPendingBit( EXTI_Line6 ); - - /* This interrupt does nothing more than demonstrate how to synchronise a - task with an interrupt. First the handler releases a semaphore. - lHigherPriorityTaskWoken has been initialised to zero. */ - xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken ); - - /* If there was a task that was blocked on the semaphore, and giving the - semaphore caused the task to unblock, and the unblocked task has a priority - higher than the currently executing task (the task that this interrupt - interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE. - Passing pdTRUE into the following macro call will cause this interrupt to - return directly to the unblocked, higher priority, task. */ - portEND_SWITCHING_ISR( lHigherPriorityTaskWoken ); + long lHigherPriorityTaskWoken = pdFALSE; + + /* Only line 6 is enabled, so there is no need to test which line generated + * the interrupt. */ + EXTI_ClearITPendingBit( EXTI_Line6 ); + + /* This interrupt does nothing more than demonstrate how to synchronise a + * task with an interrupt. First the handler releases a semaphore. + * lHigherPriorityTaskWoken has been initialised to zero. */ + xSemaphoreGiveFromISR( xTestSemaphore, &lHigherPriorityTaskWoken ); + + /* If there was a task that was blocked on the semaphore, and giving the + * semaphore caused the task to unblock, and the unblocked task has a priority + * higher than the currently executing task (the task that this interrupt + * interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE. + * Passing pdTRUE into the following macro call will cause this interrupt to + * return directly to the unblocked, higher priority, task. */ + portEND_SWITCHING_ISR( lHigherPriorityTaskWoken ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/ParTest.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/ParTest.c index f261b35cd72..1cc110a5f9f 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/SAM4L_low_power_tick_management.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/SAM4L_low_power_tick_management.c index bea8f9678c8..ee7d5440954 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/SAM4L_low_power_tick_management.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/SAM4L_low_power_tick_management.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/config/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/config/FreeRTOSConfig.h index 0a67d27f995..47198881bd5 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/config/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/config/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/main.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/main.c index 6e67891e62d..a75521e1fc3 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/main.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/main_full.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/main_full.c index c5ac083b059..fce48cc3729 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/main_low_power.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/main_low_power.c index 3a23b19d7ef..f16c4581212 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/main_low_power.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/main_low_power.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/Common-Demo-Source/comtest.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/Common-Demo-Source/comtest.c index c8084146fef..b57e2d94fe3 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/Common-Demo-Source/comtest.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/Common-Demo-Source/comtest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/Common-Demo-Source/include/demo_serial.h b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/Common-Demo-Source/include/demo_serial.h index 2c7134c8d2d..4aa2e649ca7 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/Common-Demo-Source/include/demo_serial.h +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/Common-Demo-Source/include/demo_serial.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/FreeRTOSConfig.h index c572d38d4bc..fb91b79120f 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/IntQueueTimer.c index d67a31a720b..c880deb6ccb 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/IntQueueTimer.h index 76d462f796c..8f1a766766e 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/ParTest.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/ParTest.c index e41bc54b844..9f94e562865 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c index a5f5650fcec..9a5fbe5d79a 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_blinky.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_blinky.c index a75c9f0ff99..0a1d346db0c 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c index 9bc65b72a85..d4cc051ec17 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/serial.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/serial.c index 19db7df9f32..5ca62bb180f 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/serial.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/FreeRTOSConfig.h index da995a41890..fd9fd421711 100644 --- a/FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/Full_Demo/main_full.c b/FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/Full_Demo/main_full.c index 47e7d24430d..cda65e7f4d6 100644 --- a/FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/Simply_Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/Simply_Blinky_Demo/main_blinky.c index c6a208c43fa..e4039abd9fd 100644 --- a/FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/Simply_Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/Simply_Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/main.c b/FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/main.c index e3e0f7a9fcf..d7a01ad86c9 100644 --- a/FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/main.c +++ b/FreeRTOS/Demo/CORTEX_M4_SimpleLink_CC3220SF_CCS/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -74,26 +74,26 @@ extern void main_full( void ); int main( void ) { - /* See http://www.FreeRTOS.org/TI_CC3220_SimpleLink_FreeRTOS_Demo.html for - instructions. */ - - - /* Prepare the hardware to run this demo. */ - prvSetupHardware(); - - /* The configCREATE_SIMPLE_TICKLESS_DEMO setting is described at the top - of this file. */ - #if( configCREATE_SIMPLE_TICKLESS_DEMO == 1 ) - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* See http://www.FreeRTOS.org/TI_CC3220_SimpleLink_FreeRTOS_Demo.html for + * instructions. */ + + + /* Prepare the hardware to run this demo. */ + prvSetupHardware(); + + /* The configCREATE_SIMPLE_TICKLESS_DEMO setting is described at the top + * of this file. */ + #if ( configCREATE_SIMPLE_TICKLESS_DEMO == 1 ) + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ @@ -108,7 +108,7 @@ static void prvSetupHardware( void ) void vMainToggleLED( void ) { -static uint32_t ulLEDState = Board_GPIO_LED_OFF; + static uint32_t ulLEDState = Board_GPIO_LED_OFF; ulLEDState = !ulLEDState; GPIO_write( Board_LED0, ulLEDState ); @@ -117,119 +117,135 @@ static uint32_t ulLEDState = Board_GPIO_LED_OFF; void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -void *malloc( size_t xSize ) +void * malloc( size_t xSize ) { - /* There should not be a heap defined, so trap any attempts to call - malloc. */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* There should not be a heap defined, so trap any attempts to call + * malloc. */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an -implementation of vApplicationGetIdleTaskMemory() to provide the memory that is -used by the Idle task. */ -void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) + * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is + * used by the Idle task. */ +void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, + StackType_t ** ppxIdleTaskStackBuffer, + uint32_t * pulIdleTaskStackSize ) { /* If the buffers to be provided to the Idle task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xIdleTaskTCB; -static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xIdleTaskTCB; + static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; /* Pass out a pointer to the StaticTask_t structure in which the Idle task's - state will be stored. */ + * state will be stored. */ *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; /* Pass out the array that will be used as the Idle task's stack. */ *ppxIdleTaskStackBuffer = uxIdleTaskStack; /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the -application must provide an implementation of vApplicationGetTimerTaskMemory() -to provide the memory that is used by the Timer service task. */ -void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) + * application must provide an implementation of vApplicationGetTimerTaskMemory() + * to provide the memory that is used by the Timer service task. */ +void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, + StackType_t ** ppxTimerTaskStackBuffer, + uint32_t * pulTimerTaskStackSize ) { /* If the buffers to be provided to the Timer task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xTimerTaskTCB; -static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xTimerTaskTCB; + static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; /* Pass out a pointer to the StaticTask_t structure in which the Timer - task's state will be stored. */ + * task's state will be stored. */ *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; /* Pass out the array that will be used as the Timer task's stack. */ *ppxTimerTaskStackBuffer = uxTimerTaskStack; /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } /*-----------------------------------------------------------*/ /* Catch asserts so the file and line number of the assert can be viewed. */ -void vMainAssertCalled( const char *pcFileName, uint32_t ulLineNumber ) +void vMainAssertCalled( const char * pcFileName, + uint32_t ulLineNumber ) { -volatile BaseType_t xSetToNonZeroToStepOutOfLoop = 0; + volatile BaseType_t xSetToNonZeroToStepOutOfLoop = 0; taskENTER_CRITICAL(); + while( xSetToNonZeroToStepOutOfLoop == 0 ) { /* Use the variables to prevent compiler warnings and in an attempt to - ensure they can be viewed in the debugger. If the variables get - optimised away then set copy their values to file scope or globals then - view the variables they are copied to. */ + * ensure they can be viewed in the debugger. If the variables get + * optimised away then set copy their values to file scope or globals then + * view the variables they are copied to. */ ( void ) pcFileName; ( void ) ulLineNumber; } @@ -237,11 +253,11 @@ volatile BaseType_t xSetToNonZeroToStepOutOfLoop = 0; /*-----------------------------------------------------------*/ /* To enable the libraries to build. */ -void PowerCC32XX_enterLPDS( void *driverlibFunc ) +void PowerCC32XX_enterLPDS( void * driverlibFunc ) { ( void ) driverlibFunc; /* This function is not implemented so trap any calls to it by halting - here. */ - configASSERT( driverlibFunc == NULL ); + * here. */ + configASSERT( driverlibFunc == NULL ); } diff --git a/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/CM4/include/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/CM4/include/FreeRTOSConfig.h index b7fae017de4..ab42364c463 100644 --- a/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/CM4/include/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/CM4/include/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/CM4/main.c b/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/CM4/main.c index 493c2daa993..ea363df9f7a 100644 --- a/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/CM4/main.c +++ b/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/CM4/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/CM7/include/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/CM7/include/FreeRTOSConfig.h index b29497510d0..3d1825f04d9 100644 --- a/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/CM7/include/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/CM7/include/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/CM7/main.c b/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/CM7/main.c index fe96d4cab0b..9b052a0094b 100644 --- a/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/CM7/main.c +++ b/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/CM7/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/MessageBufferLocations.h b/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/MessageBufferLocations.h index 2d76c307232..8ef72a8cdf9 100644 --- a/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/MessageBufferLocations.h +++ b/FreeRTOS/Demo/CORTEX_M7_M4_AMP_STM32H745I_Discovery_IAR/MessageBufferLocations.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Blinky_Demo/main_blinky.c index 0cf74d55373..22fdac45fa3 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/FreeRTOSConfig.h index 4eddd07c8ba..94fd86c3002 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Full_Demo/IntQueueTimer.c index 3e0389297fa..93d1ca1bddc 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Full_Demo/IntQueueTimer.h index 76d462f796c..8f1a766766e 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Full_Demo/RegTest_GCC.c b/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Full_Demo/RegTest_GCC.c index 482e67d665c..1a723787285 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Full_Demo/RegTest_GCC.c +++ b/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Full_Demo/RegTest_GCC.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Full_Demo/main_full.c b/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Full_Demo/main_full.c index 05430c8dcb9..802fe71a3f8 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/main.c b/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/main.c index 25b87554b7b..0340f412f1e 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/main.c +++ b/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Blinky_Demo/main_blinky.c index a85b3aaf3c9..4a8a8412dfe 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/FreeRTOSConfig.h index 5ab825a02d4..d107a30514c 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Full_Demo/IntQueueTimer.c index 84fecc47001..bc79a119005 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Full_Demo/IntQueueTimer.h index 76d462f796c..8f1a766766e 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Full_Demo/RegTest_GCC.c b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Full_Demo/RegTest_GCC.c index 482e67d665c..1a723787285 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Full_Demo/RegTest_GCC.c +++ b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Full_Demo/RegTest_GCC.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Full_Demo/main_full.c b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Full_Demo/main_full.c index 45e0019d125..bc5a9f61b6d 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/main.c b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/main.c index efdd3d48b04..ac35588b819 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/main.c +++ b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_AtmelStudio/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -57,8 +57,8 @@ #include "board.h" /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 /*-----------------------------------------------------------*/ @@ -72,49 +72,50 @@ static void prvSetupHardware( void ); * main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0. */ #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 - extern void main_blinky( void ); + extern void main_blinky( void ); #else - extern void main_full( void ); + extern void main_full( void ); #endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */ /* Prototypes for the standard FreeRTOS callback/hook functions implemented -within this file. */ + * within this file. */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /*-----------------------------------------------------------*/ int main( void ) { - /* Configure the hardware ready to run the demo. */ - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* Configure the hardware ready to run the demo. */ + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Disable watchdog. */ - WDT_Disable( WDT ); - WDT_Disable( ( Wdt * ) RSWDT ); + /* Disable watchdog. */ + WDT_Disable( WDT ); + WDT_Disable( ( Wdt * ) RSWDT ); - SCB_EnableICache(); - SCB_EnableDCache(); + SCB_EnableICache(); + SCB_EnableDCache(); LED_Configure( 0 ); LED_Configure( 1 ); @@ -123,70 +124,71 @@ static void prvSetupHardware( void ) void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ - - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ + + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; + ( void ) pcTaskName; + ( void ) pxTask; - /* 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. */ + /* 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. */ - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile size_t xFreeHeapSpace; - - /* This is just a trivial example of an idle hook. It is called on each - cycle of the idle task. It must *NOT* attempt to block. In this case the - idle task just queries the amount of FreeRTOS heap that remains. See the - memory management section on the http://www.FreeRTOS.org web site for memory - management options. If there is a lot of heap memory free then the - configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up - RAM. */ - xFreeHeapSpace = xPortGetFreeHeapSize(); - - /* Remove compiler warning about xFreeHeapSpace being set but never used. */ - ( void ) xFreeHeapSpace; + volatile size_t xFreeHeapSpace; + + /* This is just a trivial example of an idle hook. It is called on each + * cycle of the idle task. It must *NOT* attempt to block. In this case the + * idle task just queries the amount of FreeRTOS heap that remains. See the + * memory management section on the http://www.FreeRTOS.org web site for memory + * management options. If there is a lot of heap memory free then the + * configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up + * RAM. */ + xFreeHeapSpace = xPortGetFreeHeapSize(); + + /* Remove compiler warning about xFreeHeapSpace being set but never used. */ + ( void ) xFreeHeapSpace; } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 - { - /* The full demo includes a software timer demo/test that requires - prodding periodically from the tick interrupt. */ - vTimerPeriodicISRTests(); + #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 + { + /* The full demo includes a software timer demo/test that requires + * prodding periodically from the tick interrupt. */ + vTimerPeriodicISRTests(); - /* Call the periodic queue overwrite from ISR demo. */ - vQueueOverwritePeriodicISRDemo(); + /* Call the periodic queue overwrite from ISR demo. */ + vQueueOverwritePeriodicISRDemo(); - /* Call the periodic event group from ISR demo. */ - vPeriodicEventGroupsProcessing(); + /* Call the periodic event group from ISR demo. */ + vPeriodicEventGroupsProcessing(); - /* Call the code that uses a mutex from an ISR. */ - vInterruptSemaphorePeriodicTest(); + /* Call the code that uses a mutex from an ISR. */ + vInterruptSemaphorePeriodicTest(); - /* Call the code that 'gives' a task notification from an ISR. */ - xNotifyTaskFromISR(); - } - #endif + /* Call the code that 'gives' a task notification from an ISR. */ + xNotifyTaskFromISR(); + } + #endif /* if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 */ } /*-----------------------------------------------------------*/ @@ -194,5 +196,5 @@ void vApplicationTickHook( void ) int __write( int x ); int __write( int x ) { - return x; + return x; } diff --git a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Blinky_Demo/main_blinky.c index a85b3aaf3c9..4a8a8412dfe 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/FreeRTOSConfig.h index 5ab825a02d4..d107a30514c 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Full_Demo/IntQueueTimer.c index 74df398b840..2ef2f6815e0 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Full_Demo/IntQueueTimer.h index 76d462f796c..8f1a766766e 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Full_Demo/RegTest.c b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Full_Demo/RegTest.c index c0c7ed28a9a..54d3d3dd3fe 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Full_Demo/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Full_Demo/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Full_Demo/main_full.c b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Full_Demo/main_full.c index 45e0019d125..bc5a9f61b6d 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/main.c b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/main.c index e8fd7f277fe..2458f45a54b 100644 --- a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/main.c +++ b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -57,8 +57,8 @@ #include "board.h" /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 /*-----------------------------------------------------------*/ @@ -72,49 +72,50 @@ static void prvSetupHardware( void ); * main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0. */ #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 - extern void main_blinky( void ); + extern void main_blinky( void ); #else - extern void main_full( void ); + extern void main_full( void ); #endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */ /* Prototypes for the standard FreeRTOS callback/hook functions implemented -within this file. */ + * within this file. */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /*-----------------------------------------------------------*/ int main( void ) { - /* Configure the hardware ready to run the demo. */ - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* Configure the hardware ready to run the demo. */ + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Disable watchdog. */ - WDT_Disable( WDT0 ); - WDT_Disable( WDT1 ); + /* Disable watchdog. */ + WDT_Disable( WDT0 ); + WDT_Disable( WDT1 ); - SCB_EnableICache(); - SCB_EnableDCache(); + SCB_EnableICache(); + SCB_EnableDCache(); LED_Configure( 0 ); LED_Configure( 1 ); @@ -123,70 +124,71 @@ static void prvSetupHardware( void ) void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ - - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ + + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; + ( void ) pcTaskName; + ( void ) pxTask; - /* 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. */ + /* 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. */ - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile size_t xFreeHeapSpace; - - /* This is just a trivial example of an idle hook. It is called on each - cycle of the idle task. It must *NOT* attempt to block. In this case the - idle task just queries the amount of FreeRTOS heap that remains. See the - memory management section on the http://www.FreeRTOS.org web site for memory - management options. If there is a lot of heap memory free then the - configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up - RAM. */ - xFreeHeapSpace = xPortGetFreeHeapSize(); - - /* Remove compiler warning about xFreeHeapSpace being set but never used. */ - ( void ) xFreeHeapSpace; + volatile size_t xFreeHeapSpace; + + /* This is just a trivial example of an idle hook. It is called on each + * cycle of the idle task. It must *NOT* attempt to block. In this case the + * idle task just queries the amount of FreeRTOS heap that remains. See the + * memory management section on the http://www.FreeRTOS.org web site for memory + * management options. If there is a lot of heap memory free then the + * configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up + * RAM. */ + xFreeHeapSpace = xPortGetFreeHeapSize(); + + /* Remove compiler warning about xFreeHeapSpace being set but never used. */ + ( void ) xFreeHeapSpace; } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 - { - /* The full demo includes a software timer demo/test that requires - prodding periodically from the tick interrupt. */ - vTimerPeriodicISRTests(); + #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 + { + /* The full demo includes a software timer demo/test that requires + * prodding periodically from the tick interrupt. */ + vTimerPeriodicISRTests(); - /* Call the periodic queue overwrite from ISR demo. */ - vQueueOverwritePeriodicISRDemo(); + /* Call the periodic queue overwrite from ISR demo. */ + vQueueOverwritePeriodicISRDemo(); - /* Call the periodic event group from ISR demo. */ - vPeriodicEventGroupsProcessing(); + /* Call the periodic event group from ISR demo. */ + vPeriodicEventGroupsProcessing(); - /* Call the code that uses a mutex from an ISR. */ - vInterruptSemaphorePeriodicTest(); + /* Call the code that uses a mutex from an ISR. */ + vInterruptSemaphorePeriodicTest(); - /* Call the code that 'gives' a task notification from an ISR. */ - xNotifyTaskFromISR(); - } - #endif + /* Call the code that 'gives' a task notification from an ISR. */ + xNotifyTaskFromISR(); + } + #endif /* if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 */ } /*-----------------------------------------------------------*/ @@ -194,5 +196,5 @@ void vApplicationTickHook( void ) int __write( int x ); int __write( int x ) { - return x; + return x; } diff --git a/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Blinky_Demo/main_blinky.c index 5e04a62830e..fe003fd12b1 100644 --- a/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/FreeRTOSConfig.h index 8ed50eab391..ccf52defa10 100644 --- a/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Full_Demo/IntQueueTimer.c index c6187709135..ec0d3cdb3ed 100644 --- a/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Full_Demo/IntQueueTimer.h index 76d462f796c..8f1a766766e 100644 --- a/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Full_Demo/RegTest_Keil.c b/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Full_Demo/RegTest_Keil.c index c0c7ed28a9a..54d3d3dd3fe 100644 --- a/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Full_Demo/RegTest_Keil.c +++ b/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Full_Demo/RegTest_Keil.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Full_Demo/main_full.c b/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Full_Demo/main_full.c index 6179a08f143..aceed381504 100644 --- a/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/main.c b/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/main.c index 07b417aa96f..e5c071a3bdc 100644 --- a/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/main.c +++ b/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL_IAR_Keil/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -42,7 +42,7 @@ #include "semphr.h" /* Standard demo includes - these are needed here as the tick hook function is -defined in this file. */ + * defined in this file. */ #include "TimerDemo.h" #include "QueueOverwrite.h" #include "EventGroupsDemo.h" @@ -51,8 +51,8 @@ defined in this file. */ #include "TaskNotify.h" /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 /*-----------------------------------------------------------*/ @@ -70,212 +70,212 @@ static void prvSystemClockConfig( void ); * 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. */ -#if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - extern void main_blinky( void ); +#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + extern void main_blinky( void ); #else - extern void main_full( void ); + extern void main_full( void ); #endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */ /* Prototypes for the standard FreeRTOS callback/hook functions implemented -within this file. */ + * within this file. */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /*-----------------------------------------------------------*/ int main( void ) { - /* Configure the hardware ready to run the demo. */ - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* Configure the hardware ready to run the demo. */ + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { -GPIO_InitTypeDef GPIO_InitStruct; + GPIO_InitTypeDef GPIO_InitStruct; - /* Configure Flash prefetch and Instruction cache through ART accelerator. */ - #if( ART_ACCLERATOR_ENABLE != 0 ) - { - __HAL_FLASH_ART_ENABLE(); - } - #endif /* ART_ACCLERATOR_ENABLE */ + /* Configure Flash prefetch and Instruction cache through ART accelerator. */ + #if ( ART_ACCLERATOR_ENABLE != 0 ) + { + __HAL_FLASH_ART_ENABLE(); + } + #endif /* ART_ACCLERATOR_ENABLE */ - /* Set Interrupt Group Priority */ - HAL_NVIC_SetPriorityGrouping( NVIC_PRIORITYGROUP_4 ); + /* Set Interrupt Group Priority */ + HAL_NVIC_SetPriorityGrouping( NVIC_PRIORITYGROUP_4 ); - /* Init the low level hardware. */ - HAL_MspInit(); + /* Init the low level hardware. */ + HAL_MspInit(); - /* Configure the System clock to have a frequency of 200 MHz */ - prvSystemClockConfig(); + /* Configure the System clock to have a frequency of 200 MHz */ + prvSystemClockConfig(); - /* Enable GPIOB Clock (to be able to program the configuration - registers) and configure for LED output. */ - __GPIOG_CLK_ENABLE(); - __HAL_RCC_GPIOF_CLK_ENABLE(); + /* Enable GPIOB Clock (to be able to program the configuration + * registers) and configure for LED output. */ + __GPIOG_CLK_ENABLE(); + __HAL_RCC_GPIOF_CLK_ENABLE(); - GPIO_InitStruct.Pin = GPIO_PIN_10; - GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStruct.Pull = GPIO_PULLUP; - GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; - HAL_GPIO_Init( GPIOF, &GPIO_InitStruct ); + GPIO_InitStruct.Pin = GPIO_PIN_10; + GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_InitStruct.Pull = GPIO_PULLUP; + GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; + HAL_GPIO_Init( GPIOF, &GPIO_InitStruct ); - /* MCO2 : Pin PC9 */ - HAL_RCC_MCOConfig( RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_1 ); + /* MCO2 : Pin PC9 */ + HAL_RCC_MCOConfig( RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_1 ); } /*-----------------------------------------------------------*/ static void prvSystemClockConfig( void ) { - /* The system Clock is configured as follow : - System Clock source = PLL (HSE) - SYSCLK(Hz) = 200000000 - HCLK(Hz) = 200000000 - AHB Prescaler = 1 - APB1 Prescaler = 4 - APB2 Prescaler = 2 - HSE Frequency(Hz) = 25000000 - PLL_M = 25 - PLL_N = 400 - PLL_P = 2 - PLL_Q = 7 - VDD(V) = 3.3 - Main regulator output voltage = Scale1 mode - Flash Latency(WS) = 7 */ - RCC_ClkInitTypeDef RCC_ClkInitStruct; - RCC_OscInitTypeDef RCC_OscInitStruct; - - /* Enable HSE Oscillator and activate PLL with HSE as source */ - RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; - RCC_OscInitStruct.HSEState = RCC_HSE_ON; - RCC_OscInitStruct.HSIState = RCC_HSI_OFF; - RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; - RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; - RCC_OscInitStruct.PLL.PLLM = 25; - RCC_OscInitStruct.PLL.PLLN = 400; - RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; - RCC_OscInitStruct.PLL.PLLQ = 7; - HAL_RCC_OscConfig(&RCC_OscInitStruct); - - /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 - clocks dividers */ - RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2); - RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; - RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; - RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; - RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; - configASSERT( HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_7) == HAL_OK ); + /* The system Clock is configured as follow : + * System Clock source = PLL (HSE) + * SYSCLK(Hz) = 200000000 + * HCLK(Hz) = 200000000 + * AHB Prescaler = 1 + * APB1 Prescaler = 4 + * APB2 Prescaler = 2 + * HSE Frequency(Hz) = 25000000 + * PLL_M = 25 + * PLL_N = 400 + * PLL_P = 2 + * PLL_Q = 7 + * VDD(V) = 3.3 + * Main regulator output voltage = Scale1 mode + * Flash Latency(WS) = 7 */ + RCC_ClkInitTypeDef RCC_ClkInitStruct; + RCC_OscInitTypeDef RCC_OscInitStruct; + + /* Enable HSE Oscillator and activate PLL with HSE as source */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.HSEState = RCC_HSE_ON; + RCC_OscInitStruct.HSIState = RCC_HSI_OFF; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; + RCC_OscInitStruct.PLL.PLLM = 25; + RCC_OscInitStruct.PLL.PLLN = 400; + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; + RCC_OscInitStruct.PLL.PLLQ = 7; + HAL_RCC_OscConfig( &RCC_OscInitStruct ); + + /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 + * clocks dividers */ + RCC_ClkInitStruct.ClockType = ( RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2 ); + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; + configASSERT( HAL_RCC_ClockConfig( &RCC_ClkInitStruct, FLASH_LATENCY_7 ) == HAL_OK ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ - - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ + + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; + ( void ) pcTaskName; + ( void ) pxTask; - /* 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. */ + /* 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. */ - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile size_t xFreeHeapSpace; - - /* This is just a trivial example of an idle hook. It is called on each - cycle of the idle task. It must *NOT* attempt to block. In this case the - idle task just queries the amount of FreeRTOS heap that remains. See the - memory management section on the http://www.FreeRTOS.org web site for memory - management options. If there is a lot of heap memory free then the - configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up - RAM. */ - xFreeHeapSpace = xPortGetFreeHeapSize(); - - /* Remove compiler warning about xFreeHeapSpace being set but never used. */ - ( void ) xFreeHeapSpace; + volatile size_t xFreeHeapSpace; + + /* This is just a trivial example of an idle hook. It is called on each + * cycle of the idle task. It must *NOT* attempt to block. In this case the + * idle task just queries the amount of FreeRTOS heap that remains. See the + * memory management section on the http://www.FreeRTOS.org web site for memory + * management options. If there is a lot of heap memory free then the + * configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up + * RAM. */ + xFreeHeapSpace = xPortGetFreeHeapSize(); + + /* Remove compiler warning about xFreeHeapSpace being set but never used. */ + ( void ) xFreeHeapSpace; } /*-----------------------------------------------------------*/ -void vAssertCalled( uint32_t ulLine, const char *pcFile ) +void vAssertCalled( uint32_t ulLine, + const char * pcFile ) { -volatile unsigned long ul = 0; - - ( void ) pcFile; - ( void ) ulLine; - - taskENTER_CRITICAL(); - { - /* Set ul to a non-zero value using the debugger to step out of this - function. */ - while( ul == 0 ) - { - __NOP(); - } - } - taskEXIT_CRITICAL(); + volatile unsigned long ul = 0; + + ( void ) pcFile; + ( void ) ulLine; + + taskENTER_CRITICAL(); + { + /* Set ul to a non-zero value using the debugger to step out of this + * function. */ + while( ul == 0 ) + { + __NOP(); + } + } + taskEXIT_CRITICAL(); } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 ) - { - /* The full demo includes a software timer demo/test that requires - prodding periodically from the tick interrupt. */ - vTimerPeriodicISRTests(); + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 ) + { + /* The full demo includes a software timer demo/test that requires + * prodding periodically from the tick interrupt. */ + vTimerPeriodicISRTests(); - /* Call the periodic queue overwrite from ISR demo. */ - vQueueOverwritePeriodicISRDemo(); + /* Call the periodic queue overwrite from ISR demo. */ + vQueueOverwritePeriodicISRDemo(); - /* Call the periodic event group from ISR demo. */ - vPeriodicEventGroupsProcessing(); + /* Call the periodic event group from ISR demo. */ + vPeriodicEventGroupsProcessing(); - /* Call the code that uses a mutex from an ISR. */ - vInterruptSemaphorePeriodicTest(); + /* Call the code that uses a mutex from an ISR. */ + vInterruptSemaphorePeriodicTest(); - /* Use a queue set from an ISR. */ - vQueueSetAccessQueueSetFromISR(); + /* Use a queue set from an ISR. */ + vQueueSetAccessQueueSetFromISR(); - /* Use task notifications from an ISR. */ - xNotifyTaskFromISR(); - } - #endif + /* Use task notifications from an ISR. */ + xNotifyTaskFromISR(); + } + #endif /* if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 ) */ } /*-----------------------------------------------------------*/ - - - diff --git a/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/FreeRTOSConfig.h index 222259642f3..59043cfd308 100644 --- a/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/ParTest.c b/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/ParTest.c index 0f3a4613638..d52df6a8a41 100644 --- a/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/main-full.c b/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/main-full.c index fb9ce8044d9..a42d5bcc4ff 100644 --- a/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/main-full.c +++ b/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/main-full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -135,77 +135,77 @@ #include "dynamic.h" /* The rate at which data is sent to the queue, specified in milliseconds, and -converted to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * converted to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /* The LED toggled by the check timer callback function. This is an LED in the -second digit of the two digit 7 segment display. See the documentation page -for this demo on the FreeRTOS.org web site to see which LED this relates to. */ -#define mainCHECK_LED ( 1UL << 3UL ) + * second digit of the two digit 7 segment display. See the documentation page + * for this demo on the FreeRTOS.org web site to see which LED this relates to. */ +#define mainCHECK_LED ( 1UL << 3UL ) /* The LED toggle by the queue receive task. This is an LED in the second digit -of the two digit 7 segment display. See the documentation page for this demo on -the FreeRTOS.org web site to see which LED this relates to. */ -#define mainTASK_CONTROLLED_LED 0x07UL + * of the two digit 7 segment display. See the documentation page for this demo on + * the FreeRTOS.org web site to see which LED this relates to. */ +#define mainTASK_CONTROLLED_LED 0x07UL /* The LED turned on by the button interrupt, and turned off by the LED timer. -This is an LED in the second digit of the two digit 7 segment display. See the -documentation page for this demo on the FreeRTOS.org web site to see which LED -this relates to. */ -#define mainTIMER_CONTROLLED_LED 0x05UL + * This is an LED in the second digit of the two digit 7 segment display. See the + * documentation page for this demo on the FreeRTOS.org web site to see which LED + * this relates to. */ +#define mainTIMER_CONTROLLED_LED 0x05UL /* The LED used by the comtest tasks. See the comtest.c file for more -information. The LEDs used by the comtest task are in the second digit of the -two digit 7 segment display. See the documentation page for this demo on the -FreeRTOS.org web site to see which LEDs this relates to. */ -#define mainCOM_TEST_LED 0x03UL + * information. The LEDs used by the comtest task are in the second digit of the + * two digit 7 segment display. See the documentation page for this demo on the + * FreeRTOS.org web site to see which LEDs this relates to. */ +#define mainCOM_TEST_LED 0x03UL /* Constant used by the standard timer test functions. */ -#define mainTIMER_TEST_PERIOD ( 50 ) +#define mainTIMER_TEST_PERIOD ( 50 ) /* Priorities used by the various different standard demo tasks. */ -#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* Priorities defined in this main-full.c file. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The period at 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 mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS ) + * 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 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_PERIOD_MS constant. */ -#define mainERROR_CHECK_TIMER_PERIOD_MS ( 500UL / portTICK_PERIOD_MS ) + * 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_TIMER_PERIOD_MS ( 500UL / portTICK_PERIOD_MS ) /* The period at which the digit counter timer will expire, in ms, and converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainDIGIT_COUNTER_TIMER_PERIOD_MS ( 250UL / portTICK_PERIOD_MS ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainDIGIT_COUNTER_TIMER_PERIOD_MS ( 250UL / portTICK_PERIOD_MS ) /* The LED will remain on until the button has not been pushed for a full -5000ms. */ -#define mainLED_TIMER_PERIOD_MS ( 5000UL / portTICK_PERIOD_MS ) + * 5000ms. */ +#define mainLED_TIMER_PERIOD_MS ( 5000UL / portTICK_PERIOD_MS ) /* A zero block time. */ -#define mainDONT_BLOCK ( 0UL ) +#define mainDONT_BLOCK ( 0UL ) /* Baud rate used by the comtest tasks. */ -#define mainCOM_TEST_BAUD_RATE ( 115200UL ) +#define mainCOM_TEST_BAUD_RATE ( 115200UL ) /*-----------------------------------------------------------*/ @@ -218,8 +218,8 @@ static void prvSetupHardware( void ); * The application specific (not common demo) tasks as described in the comments * at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * The LED timer callback function. This does nothing but switch an LED off. @@ -240,7 +240,8 @@ static void prvDigitCounterTimerCallback( TimerHandle_t xTimer ); * This is not a 'standard' partest function, so the prototype is not in * partest.h, and is instead included here. */ -void vParTestSetLEDFromISR( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue ); +void vParTestSetLEDFromISR( unsigned portBASE_TYPE uxLED, + signed portBASE_TYPE xValue ); /*-----------------------------------------------------------*/ @@ -248,394 +249,401 @@ void vParTestSetLEDFromISR( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE x static QueueHandle_t xQueue = NULL; /* The LED software timer. This uses prvLEDTimerCallback() as it's callback -function. */ + * function. */ static TimerHandle_t xLEDTimer = NULL; /* The digit counter software timer. This displays a counting digit on one half -of the seven segment displays. */ + * of the seven segment displays. */ static TimerHandle_t xDigitCounterTimer = NULL; /* The check timer. This uses prvCheckTimerCallback() as its callback -function. */ + * function. */ static TimerHandle_t xCheckTimer = NULL; /* If an error is detected in a standard demo task, then pcStatusMessage will -be set to point to a string that identifies the offending task. This is just -to make debugging easier. */ -static const char *pcStatusMessage = NULL; + * be set to point to a string that identifies the offending task. This is just + * to make debugging easier. */ +static const char * pcStatusMessage = NULL; /*-----------------------------------------------------------*/ -int main(void) +int main( void ) { - /* Configure the NVIC, LED outputs and button inputs. */ - prvSetupHardware(); - - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); - - if( xQueue != NULL ) - { - /* Start the two application specific demo tasks, as described in the - comments at the top of this file. */ - xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL ); - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Create the software timer that is responsible for turning off the LED - if the button is not pushed within 5000ms, as described at the top of - this file. */ - xLEDTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */ - ( mainLED_TIMER_PERIOD_MS ),/* The timer period, in this case 5000ms (5s). */ - pdFALSE, /* This is a one-shot timer, so xAutoReload is set to pdFALSE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvLEDTimerCallback /* The callback function that switches the LED off. */ - ); - - /* Create the software timer that performs the 'check' functionality, - as described at the top of this file. */ - xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ - ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - /* Create the software timer that performs the 'digit counting' - functionality, as described at the top of this file. */ - xDigitCounterTimer = xTimerCreate( "DigitCounter", /* A text name, purely to help debugging. */ - ( mainDIGIT_COUNTER_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvDigitCounterTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - /* Create a lot of 'standard demo' tasks. Over 40 tasks are created in - this demo. For a much simpler demo, select the 'blinky' build - configuration. */ - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vCreateBlockTimeTasks(); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); - vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY ); - vStartQueuePeekTasks(); - vStartRecursiveMutexTasks(); - vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartCountingSemaphoreTasks(); - vStartDynamicPriorityTasks(); - - /* The suicide tasks must be created last, as they need to know how many - tasks were running prior to their creation in order to ascertain whether - or not the correct/expected number of tasks are running at any given - time. */ - vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - - /* Start the tasks and timer running. */ - 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 - insufficient FreeRTOS heap memory available for the idle and/or timer tasks - to be created. See the memory management section on the FreeRTOS web site - for more details. */ - for( ;; ); + /* Configure the NVIC, LED outputs and button inputs. */ + prvSetupHardware(); + + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); + + if( xQueue != NULL ) + { + /* Start the two application specific demo tasks, as described in the + * comments at the top of this file. */ + xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL ); + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Create the software timer that is responsible for turning off the LED + * if the button is not pushed within 5000ms, as described at the top of + * this file. */ + xLEDTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */ + ( mainLED_TIMER_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */ + pdFALSE, /* This is a one-shot timer, so xAutoReload is set to pdFALSE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvLEDTimerCallback /* The callback function that switches the LED off. */ + ); + + /* Create the software timer that performs the 'check' functionality, + * as described at the top of this file. */ + xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ + ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + /* Create the software timer that performs the 'digit counting' + * functionality, as described at the top of this file. */ + xDigitCounterTimer = xTimerCreate( "DigitCounter", /* A text name, purely to help debugging. */ + ( mainDIGIT_COUNTER_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvDigitCounterTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + /* Create a lot of 'standard demo' tasks. Over 40 tasks are created in + * this demo. For a much simpler demo, select the 'blinky' build + * configuration. */ + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vCreateBlockTimeTasks(); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); + vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY ); + vStartQueuePeekTasks(); + vStartRecursiveMutexTasks(); + vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartCountingSemaphoreTasks(); + vStartDynamicPriorityTasks(); + + /* The suicide tasks must be created last, as they need to know how many + * tasks were running prior to their creation in order to ascertain whether + * or not the correct/expected number of tasks are running at any given + * time. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + + /* Start the tasks and timer running. */ + 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 + * insufficient FreeRTOS heap memory available for the idle and/or timer tasks + * to be created. See the memory management section on the FreeRTOS web site + * for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ static void prvCheckTimerCallback( TimerHandle_t xTimer ) { - /* Check the standard demo tasks are running without error. Latch the - latest reported error in the pcStatusMessage character pointer. */ - if( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: GenQueue"; - } - - if( xAreQueuePeekTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: QueuePeek\r\n"; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: BlockQueue\r\n"; - } - - if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: BlockTime\r\n"; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: SemTest\r\n"; - } - - if( xIsCreateTaskStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: Death\r\n"; - } - - if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: RecMutex\r\n"; - } - - if( xAreComTestTasksStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: ComTest\r\n"; - } - - if( xAreTimerDemoTasksStillRunning( ( mainCHECK_TIMER_PERIOD_MS ) ) != pdTRUE ) - { - pcStatusMessage = "Error: TimerDemo"; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: PollQueue"; - } - - if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: CountSem"; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: DynamicPriority"; - } - - /* Toggle the check LED to give an indication of the system status. If - the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then - everything is ok. A faster toggle indicates an error. vParTestToggleLED() - is not used to toggle this particular LED as it is on a different IP port - to to the LEDs controlled by ParTest.c. A critical section is not required - as the only other place this port is accessed is from another timer - and - only one timer can be running at any one time. */ - if( ( FM3_GPIO->PDOR3 & mainCHECK_LED ) != 0 ) - { - FM3_GPIO->PDOR3 &= ~mainCHECK_LED; - } - else - { - FM3_GPIO->PDOR3 |= mainCHECK_LED; - } - - /* Have any errors been latch in pcStatusMessage? If so, shorten the - period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. - This will result in an increase in the rate at which mainCHECK_LED - toggles. */ - if( pcStatusMessage != NULL ) - { - /* This call to xTimerChangePeriod() uses a zero block time. Functions - called from inside of a timer callback function must *never* attempt - to block. */ - xTimerChangePeriod( xCheckTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); - } + /* Check the standard demo tasks are running without error. Latch the + * latest reported error in the pcStatusMessage character pointer. */ + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: GenQueue"; + } + + if( xAreQueuePeekTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: QueuePeek\r\n"; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: BlockQueue\r\n"; + } + + if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: BlockTime\r\n"; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: SemTest\r\n"; + } + + if( xIsCreateTaskStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: Death\r\n"; + } + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: RecMutex\r\n"; + } + + if( xAreComTestTasksStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: ComTest\r\n"; + } + + if( xAreTimerDemoTasksStillRunning( ( mainCHECK_TIMER_PERIOD_MS ) ) != pdTRUE ) + { + pcStatusMessage = "Error: TimerDemo"; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: PollQueue"; + } + + if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: CountSem"; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: DynamicPriority"; + } + + /* Toggle the check LED to give an indication of the system status. If + * the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then + * everything is ok. A faster toggle indicates an error. vParTestToggleLED() + * is not used to toggle this particular LED as it is on a different IP port + * to to the LEDs controlled by ParTest.c. A critical section is not required + * as the only other place this port is accessed is from another timer - and + * only one timer can be running at any one time. */ + if( ( FM3_GPIO->PDOR3 & mainCHECK_LED ) != 0 ) + { + FM3_GPIO->PDOR3 &= ~mainCHECK_LED; + } + else + { + FM3_GPIO->PDOR3 |= mainCHECK_LED; + } + + /* Have any errors been latch in pcStatusMessage? If so, shorten the + * period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. + * This will result in an increase in the rate at which mainCHECK_LED + * toggles. */ + if( pcStatusMessage != NULL ) + { + /* This call to xTimerChangePeriod() uses a zero block time. Functions + * called from inside of a timer callback function must *never* attempt + * to block. */ + xTimerChangePeriod( xCheckTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); + } } /*-----------------------------------------------------------*/ static void prvLEDTimerCallback( TimerHandle_t xTimer ) { - /* The timer has expired - so no button pushes have occurred in the last - five seconds - turn the LED off. */ - vParTestSetLED( mainTIMER_CONTROLLED_LED, pdFALSE ); + /* The timer has expired - so no button pushes have occurred in the last + * five seconds - turn the LED off. */ + vParTestSetLED( mainTIMER_CONTROLLED_LED, pdFALSE ); } /*-----------------------------------------------------------*/ static void prvDigitCounterTimerCallback( TimerHandle_t xTimer ) { /* Define the bit patterns that display numbers on the seven segment display. */ -static const unsigned short usNumbersPatterns[] = { 0x8004, 0xF204, 0x4804, 0x6004, 0x3204, 0x2404, 0x0404, 0xF104, 0x0004, 0x2004 }; -static long lCounter = 0L; -const long lNumberOfDigits = 10L; -unsigned short usCheckLEDState; - - /* Unfortunately the LED uses the same port as the digit counter, so remember - the state of the check LED. A critical section is not required to access - the port as only one timer can be executing at any one time. */ - usCheckLEDState = ( FM3_GPIO->PDOR3 & mainCHECK_LED ); - - /* Display the next number, counting up. */ - FM3_GPIO->PDOR3 = usNumbersPatterns[ lCounter ] | usCheckLEDState; - - /* Move onto the next digit. */ - lCounter++; - - /* Ensure the counter does not go off the end of the array. */ - if( lCounter >= lNumberOfDigits ) - { - lCounter = 0L; - } + static const unsigned short usNumbersPatterns[] = { 0x8004, 0xF204, 0x4804, 0x6004, 0x3204, 0x2404, 0x0404, 0xF104, 0x0004, 0x2004 }; + static long lCounter = 0L; + const long lNumberOfDigits = 10L; + unsigned short usCheckLEDState; + + /* Unfortunately the LED uses the same port as the digit counter, so remember + * the state of the check LED. A critical section is not required to access + * the port as only one timer can be executing at any one time. */ + usCheckLEDState = ( FM3_GPIO->PDOR3 & mainCHECK_LED ); + + /* Display the next number, counting up. */ + FM3_GPIO->PDOR3 = usNumbersPatterns[ lCounter ] | usCheckLEDState; + + /* Move onto the next digit. */ + lCounter++; + + /* Ensure the counter does not go off the end of the array. */ + if( lCounter >= lNumberOfDigits ) + { + lCounter = 0L; + } } /*-----------------------------------------------------------*/ /* The ISR executed when the user button is pushed. */ void INT0_7_Handler( void ) { -portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; - - /* The button was pushed, so ensure the LED is on before resetting the - LED timer. The LED timer will turn the LED off if the button is not - pushed within 5000ms. */ - vParTestSetLEDFromISR( mainTIMER_CONTROLLED_LED, pdTRUE ); - - /* This interrupt safe FreeRTOS function can be called from this interrupt - because the interrupt priority is below the - configMAX_SYSCALL_INTERRUPT_PRIORITY setting in FreeRTOSConfig.h. */ - xTimerResetFromISR( xLEDTimer, &xHigherPriorityTaskWoken ); - - /* Clear the interrupt before leaving. This just clears all the interrupts - for simplicity, as only one is actually used in this simple demo anyway. */ - FM3_EXTI->EICL = 0x0000; - - /* If calling xTimerResetFromISR() caused a task (in this case the timer - service/daemon task) to unblock, and the unblocked task has a priority - higher than or equal to the task that was interrupted, then - xHigherPriorityTaskWoken will now be set to pdTRUE, and calling - portEND_SWITCHING_ISR() will ensure the unblocked task runs next. */ - portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + + /* The button was pushed, so ensure the LED is on before resetting the + * LED timer. The LED timer will turn the LED off if the button is not + * pushed within 5000ms. */ + vParTestSetLEDFromISR( mainTIMER_CONTROLLED_LED, pdTRUE ); + + /* This interrupt safe FreeRTOS function can be called from this interrupt + * because the interrupt priority is below the + * configMAX_SYSCALL_INTERRUPT_PRIORITY setting in FreeRTOSConfig.h. */ + xTimerResetFromISR( xLEDTimer, &xHigherPriorityTaskWoken ); + + /* Clear the interrupt before leaving. This just clears all the interrupts + * for simplicity, as only one is actually used in this simple demo anyway. */ + FM3_EXTI->EICL = 0x0000; + + /* If calling xTimerResetFromISR() caused a task (in this case the timer + * service/daemon task) to unblock, and the unblocked task has a priority + * higher than or equal to the task that was interrupted, then + * xHigherPriorityTaskWoken will now be set to pdTRUE, and calling + * portEND_SWITCHING_ISR() will ensure the unblocked task runs next. */ + portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; - - /* The timer command queue will have been filled when the timer test tasks - were created in main() (this is part of the test they perform). Therefore, - while the check and digit counter timers can be created in main(), they - cannot be started from main(). Once the scheduler has started, the timer - service task will drain the command queue, and now the check and digit - counter timers can be started successfully. */ - xTimerStart( xCheckTimer, portMAX_DELAY ); - xTimerStart( xDigitCounterTimer, portMAX_DELAY ); - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, the constant used converts ticks - to ms. While in the Blocked state this task will not consume any CPU - time. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - - /* Send to the queue - causing the queue receive task to unblock and - toggle an 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 - be empty at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, mainDONT_BLOCK ); - } + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; + + /* The timer command queue will have been filled when the timer test tasks + * were created in main() (this is part of the test they perform). Therefore, + * while the check and digit counter timers can be created in main(), they + * cannot be started from main(). Once the scheduler has started, the timer + * service task will drain the command queue, and now the check and digit + * counter timers can be started successfully. */ + xTimerStart( xCheckTimer, portMAX_DELAY ); + xTimerStart( xDigitCounterTimer, portMAX_DELAY ); + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, the constant used converts ticks + * to ms. While in the Blocked state this task will not consume any CPU + * time. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + + /* Send to the queue - causing the queue receive task to unblock and + * toggle an 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 + * be empty at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, mainDONT_BLOCK ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it the expected value? If it is, toggle the LED. */ - if( ulReceivedValue == 100UL ) - { - vParTestToggleLED( mainTASK_CONTROLLED_LED ); - } - } + unsigned long ulReceivedValue; + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it the expected value? If it is, toggle the LED. */ + if( ulReceivedValue == 100UL ) + { + vParTestToggleLED( mainTASK_CONTROLLED_LED ); + } + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { -const unsigned short usButtonInputBit = 0x01U; + const unsigned short usButtonInputBit = 0x01U; - SystemInit(); - SystemCoreClockUpdate(); + SystemInit(); + SystemCoreClockUpdate(); - /* Initialise the IO used for the LEDs on the 7 segment displays. */ - vParTestInitialise(); + /* Initialise the IO used for the LEDs on the 7 segment displays. */ + vParTestInitialise(); - /* Set the switches to input (P18->P1F). */ - FM3_GPIO->DDR5 = 0x0000; - FM3_GPIO->PFR5 = 0x0000; + /* Set the switches to input (P18->P1F). */ + FM3_GPIO->DDR5 = 0x0000; + FM3_GPIO->PFR5 = 0x0000; - /* Assign the button input as GPIO. */ - FM3_GPIO->PFR5 |= usButtonInputBit; + /* Assign the button input as GPIO. */ + FM3_GPIO->PFR5 |= usButtonInputBit; - /* Button interrupt on falling edge. */ - FM3_EXTI->ELVR = 0x0003; + /* Button interrupt on falling edge. */ + FM3_EXTI->ELVR = 0x0003; - /* Clear all external interrupts. */ - FM3_EXTI->EICL = 0x0000; + /* Clear all external interrupts. */ + FM3_EXTI->EICL = 0x0000; - /* Enable the button interrupt. */ - FM3_EXTI->ENIR |= usButtonInputBit; + /* Enable the button interrupt. */ + FM3_EXTI->ENIR |= usButtonInputBit; - /* Setup the GPIO and the NVIC for the switch used in this simple demo. */ - NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY ); + /* Setup the GPIO and the NVIC for the switch used in this simple demo. */ + NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY ); NVIC_EnableIRQ( EXINT0_7_IRQn ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ - for( ;; ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* Run time stack overflow checking is performed if - configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook - function is called if a stack overflow is detected. */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* Run time stack overflow checking is performed if + * configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook + * function is called if a stack overflow is detected. */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile size_t xFreeStackSpace; - - /* This function is called on each cycle of the idle task. In this case it - does nothing useful, other than report the amount of FreeRTOS heap that - remains unallocated. */ - xFreeStackSpace = xPortGetFreeHeapSize(); - - if( xFreeStackSpace > 100 ) - { - /* By now, the kernel has allocated everything it is going to, so - if there is a lot of heap remaining unallocated then - the value of configTOTAL_HEAP_SIZE in FreeRTOSConfig.h can be - reduced accordingly. */ - } + volatile size_t xFreeStackSpace; + + /* This function is called on each cycle of the idle task. In this case it + * does nothing useful, other than report the amount of FreeRTOS heap that + * remains unallocated. */ + xFreeStackSpace = xPortGetFreeHeapSize(); + + if( xFreeStackSpace > 100 ) + { + /* By now, the kernel has allocated everything it is going to, so + * if there is a lot of heap remaining unallocated then + * the value of configTOTAL_HEAP_SIZE in FreeRTOSConfig.h can be + * reduced accordingly. */ + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* Call the periodic timer test, which tests the timer API functions that - can be called from an ISR. */ - vTimerPeriodicISRTests(); + /* Call the periodic timer test, which tests the timer API functions that + * can be called from an ISR. */ + vTimerPeriodicISRTests(); } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/main_blinky.c b/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/main_blinky.c index 7ce854a9428..9611e387d1a 100644 --- a/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -84,23 +84,23 @@ #include "mcu.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue, specified in milliseconds, and -converted to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * converted to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /* The LED toggle by the queue receive task. */ -#define mainTASK_CONTROLLED_LED ( 1UL << 3UL ) +#define mainTASK_CONTROLLED_LED ( 1UL << 3UL ) /* The LED turned on by the button interrupt, and turned off by the LED timer. */ -#define mainTIMER_CONTROLLED_LED ( 1UL << 2UL ) +#define mainTIMER_CONTROLLED_LED ( 1UL << 2UL ) /*-----------------------------------------------------------*/ @@ -112,8 +112,8 @@ static void prvSetupHardware( void ); /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * The LED timer callback function. This does nothing but switch off the @@ -127,240 +127,243 @@ static void vLEDTimerCallback( TimerHandle_t xTimer ); static QueueHandle_t xQueue = NULL; /* The LED software timer. This uses vLEDTimerCallback() as its callback -function. */ + * function. */ static TimerHandle_t xLEDTimer = NULL; /*-----------------------------------------------------------*/ -int main(void) +int main( void ) { - /* Configure the NVIC, LED outputs and button inputs. */ - prvSetupHardware(); - - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); - - if( xQueue != NULL ) - { - /* Start the two tasks as described in the comments at the top of this - file. */ - xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL ); - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Create the software timer that is responsible for turning off the LED - if the button is not pushed within 5000ms, as described at the top of - this file. */ - xLEDTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */ - ( 5000 / portTICK_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */ - pdFALSE, /* This is a one-shot timer, so xAutoReload is set to pdFALSE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - vLEDTimerCallback /* The callback function that switches the LED off. */ - ); - - /* Start the tasks and timer running. */ - 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 - insufficient FreeRTOS heap memory available for the idle and/or timer tasks - to be created. See the memory management section on the FreeRTOS web site - for more details. */ - for( ;; ); + /* Configure the NVIC, LED outputs and button inputs. */ + prvSetupHardware(); + + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); + + if( xQueue != NULL ) + { + /* Start the two tasks as described in the comments at the top of this + * file. */ + xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL ); + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Create the software timer that is responsible for turning off the LED + * if the button is not pushed within 5000ms, as described at the top of + * this file. */ + xLEDTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */ + ( 5000 / portTICK_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */ + pdFALSE, /* This is a one-shot timer, so xAutoReload is set to pdFALSE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + vLEDTimerCallback /* The callback function that switches the LED off. */ + ); + + /* Start the tasks and timer running. */ + 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 + * insufficient FreeRTOS heap memory available for the idle and/or timer tasks + * to be created. See the memory management section on the FreeRTOS web site + * for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ static void vLEDTimerCallback( TimerHandle_t xTimer ) { - /* The timer has expired - so no button pushes have occurred in the last - five seconds - turn the LED off. NOTE - accessing the LED port should use - a critical section because it is accessed from multiple tasks, and the - button interrupt - in this trivial case, for simplicity, the critical - section is omitted. */ - FM3_GPIO->PDOR3 |= mainTIMER_CONTROLLED_LED; + /* The timer has expired - so no button pushes have occurred in the last + * five seconds - turn the LED off. NOTE - accessing the LED port should use + * a critical section because it is accessed from multiple tasks, and the + * button interrupt - in this trivial case, for simplicity, the critical + * section is omitted. */ + FM3_GPIO->PDOR3 |= mainTIMER_CONTROLLED_LED; } /*-----------------------------------------------------------*/ /* The ISR executed when the user button is pushed. */ void INT0_7_Handler( void ) { -portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; - - /* The button was pushed, so ensure the LED is on before resetting the - LED timer. The LED timer will turn the LED off if the button is not - pushed within 5000ms. */ - FM3_GPIO->PDOR3 &= ~mainTIMER_CONTROLLED_LED; - - /* This interrupt safe FreeRTOS function can be called from this interrupt - because the interrupt priority is below the - configMAX_SYSCALL_INTERRUPT_PRIORITY setting in FreeRTOSConfig.h. */ - xTimerResetFromISR( xLEDTimer, &xHigherPriorityTaskWoken ); - - /* Clear the interrupt before leaving. This just clears all the interrupts - for simplicity, as only one is actually used in this simple demo anyway. */ - FM3_EXTI->EICL = 0x0000; - - /* If calling xTimerResetFromISR() caused a task (in this case the timer - service/daemon task) to unblock, and the unblocked task has a priority - higher than or equal to the task that was interrupted, then - xHigherPriorityTaskWoken will now be set to pdTRUE, and calling - portEND_SWITCHING_ISR() will ensure the unblocked task runs next. */ - portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + + /* The button was pushed, so ensure the LED is on before resetting the + * LED timer. The LED timer will turn the LED off if the button is not + * pushed within 5000ms. */ + FM3_GPIO->PDOR3 &= ~mainTIMER_CONTROLLED_LED; + + /* This interrupt safe FreeRTOS function can be called from this interrupt + * because the interrupt priority is below the + * configMAX_SYSCALL_INTERRUPT_PRIORITY setting in FreeRTOSConfig.h. */ + xTimerResetFromISR( xLEDTimer, &xHigherPriorityTaskWoken ); + + /* Clear the interrupt before leaving. This just clears all the interrupts + * for simplicity, as only one is actually used in this simple demo anyway. */ + FM3_EXTI->EICL = 0x0000; + + /* If calling xTimerResetFromISR() caused a task (in this case the timer + * service/daemon task) to unblock, and the unblocked task has a priority + * higher than or equal to the task that was interrupted, then + * xHigherPriorityTaskWoken will now be set to pdTRUE, and calling + * portEND_SWITCHING_ISR() will ensure the unblocked task runs next. */ + portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, the constant used converts ticks - to ms. While in the Blocked state this task will not consume any CPU - time. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - - /* Send to the queue - causing the queue receive task to unblock and - toggle an 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 - be empty at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0 ); - } + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, the constant used converts ticks + * to ms. While in the Blocked state this task will not consume any CPU + * time. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + + /* Send to the queue - causing the queue receive task to unblock and + * toggle an 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 + * be empty at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0 ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it the expected value? If it is, toggle the LED. */ - if( ulReceivedValue == 100UL ) - { - /* NOTE - accessing the LED port should use a critical section - because it is accessed from multiple tasks, and the button interrupt - - in this trivial case, for simplicity, the critical section is - omitted. */ - if( ( FM3_GPIO->PDOR3 & mainTASK_CONTROLLED_LED ) != 0 ) - { - FM3_GPIO->PDOR3 &= ~mainTASK_CONTROLLED_LED; - } - else - { - FM3_GPIO->PDOR3 |= mainTASK_CONTROLLED_LED; - } - } - } + unsigned long ulReceivedValue; + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it the expected value? If it is, toggle the LED. */ + if( ulReceivedValue == 100UL ) + { + /* NOTE - accessing the LED port should use a critical section + * because it is accessed from multiple tasks, and the button interrupt + * - in this trivial case, for simplicity, the critical section is + * omitted. */ + if( ( FM3_GPIO->PDOR3 & mainTASK_CONTROLLED_LED ) != 0 ) + { + FM3_GPIO->PDOR3 &= ~mainTASK_CONTROLLED_LED; + } + else + { + FM3_GPIO->PDOR3 |= mainTASK_CONTROLLED_LED; + } + } + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { -const unsigned short usButtonInputBit = 0x01U; + const unsigned short usButtonInputBit = 0x01U; - SystemInit(); - SystemCoreClockUpdate(); + SystemInit(); + SystemCoreClockUpdate(); - /* Analog inputs are not used on the LED outputs. */ - FM3_GPIO->ADE = 0x0000; + /* Analog inputs are not used on the LED outputs. */ + FM3_GPIO->ADE = 0x0000; - /* Set to output. */ - FM3_GPIO->DDR1 |= 0xFFFF; - FM3_GPIO->DDR3 |= 0xFFFF; + /* Set to output. */ + FM3_GPIO->DDR1 |= 0xFFFF; + FM3_GPIO->DDR3 |= 0xFFFF; - /* Set as GPIO. */ - FM3_GPIO->PFR1 &= 0x0000; - FM3_GPIO->PFR3 &= 0x0000; + /* Set as GPIO. */ + FM3_GPIO->PFR1 &= 0x0000; + FM3_GPIO->PFR3 &= 0x0000; - /* Start with all LEDs off. */ - FM3_GPIO->PDOR3 = 0xFFFF; - FM3_GPIO->PDOR1 = 0xFFFF; + /* Start with all LEDs off. */ + FM3_GPIO->PDOR3 = 0xFFFF; + FM3_GPIO->PDOR1 = 0xFFFF; - /* Set the switches to input (P18->P1F). */ - FM3_GPIO->DDR5 = 0x0000; - FM3_GPIO->PFR5 = 0x0000; + /* Set the switches to input (P18->P1F). */ + FM3_GPIO->DDR5 = 0x0000; + FM3_GPIO->PFR5 = 0x0000; - /* Assign the button input as GPIO. */ - FM3_GPIO->PFR5 |= usButtonInputBit; + /* Assign the button input as GPIO. */ + FM3_GPIO->PFR5 |= usButtonInputBit; - /* Button interrupt on falling edge. */ - FM3_EXTI->ELVR = 0x0003; + /* Button interrupt on falling edge. */ + FM3_EXTI->ELVR = 0x0003; - /* Clear all external interrupts. */ - FM3_EXTI->EICL = 0x0000; + /* Clear all external interrupts. */ + FM3_EXTI->EICL = 0x0000; - /* Enable the button interrupt. */ - FM3_EXTI->ENIR |= usButtonInputBit; + /* Enable the button interrupt. */ + FM3_EXTI->ENIR |= usButtonInputBit; - /* Setup the GPIO and the NVIC for the switch used in this simple demo. */ - NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY ); + /* Setup the GPIO and the NVIC for the switch used in this simple demo. */ + NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY ); NVIC_EnableIRQ( EXINT0_7_IRQn ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ - for( ;; ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* Run time stack overflow checking is performed if - configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook - function is called if a stack overflow is detected. */ - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* Run time stack overflow checking is performed if + * configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook + * function is called if a stack overflow is detected. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* A tick hook is used by the "Full" build configuration. The Full and - blinky build configurations share a FreeRTOSConfig.h header file, so this - simple build configuration also has to define a tick hook - even though it - does not actually use it for anything. */ + /* A tick hook is used by the "Full" build configuration. The Full and + * blinky build configurations share a FreeRTOSConfig.h header file, so this + * simple build configuration also has to define a tick hook - even though it + * does not actually use it for anything. */ } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile size_t xFreeHeapSpace; - - /* This function is called on each cycle of the idle task. In this case it - does nothing useful, other than report the amount of FreeRTOS heap that - remains unallocated. */ - xFreeHeapSpace = xPortGetFreeHeapSize(); - - if( xFreeHeapSpace > 100 ) - { - /* By now, the kernel has allocated everything it is going to, so - if there is a lot of heap remaining unallocated then - the value of configTOTAL_HEAP_SIZE in FreeRTOSConfig.h can be - reduced accordingly. */ - } + volatile size_t xFreeHeapSpace; + + /* This function is called on each cycle of the idle task. In this case it + * does nothing useful, other than report the amount of FreeRTOS heap that + * remains unallocated. */ + xFreeHeapSpace = xPortGetFreeHeapSize(); + + if( xFreeHeapSpace > 100 ) + { + /* By now, the kernel has allocated everything it is going to, so + * if there is a lot of heap remaining unallocated then + * the value of configTOTAL_HEAP_SIZE in FreeRTOSConfig.h can be + * reduced accordingly. */ + } } /*-----------------------------------------------------------*/ - - - - diff --git a/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/serial.c b/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/serial.c index b7b18094d61..db59a134878 100644 --- a/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/serial.c +++ b/FreeRTOS/Demo/CORTEX_MB9A310_IAR_Keil/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/FreeRTOSConfig.h index 414af4167e7..aff770ec947 100644 --- a/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/ParTest.c b/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/ParTest.c index 5f9bfc41ede..76cb536bcda 100644 --- a/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/main-full.c b/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/main-full.c index 05b55f82732..998d5f32221 100644 --- a/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/main-full.c +++ b/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/main-full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -136,77 +136,77 @@ #include "dynamic.h" /* The rate at which data is sent to the queue, specified in milliseconds, and -converted to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * converted to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /* The LED toggled by the check timer callback function. This is an LED in the -second digit of the two digit 7 segment display. See the documentation page -for this demo on the FreeRTOS.org web site to see which LED this relates to. */ -#define mainCHECK_LED 0x07UL + * second digit of the two digit 7 segment display. See the documentation page + * for this demo on the FreeRTOS.org web site to see which LED this relates to. */ +#define mainCHECK_LED 0x07UL /* The LED toggle by the queue receive task. This is an LED in the second digit -of the two digit 7 segment display. See the documentation page for this demo on -the FreeRTOS.org web site to see which LED this relates to. */ -#define mainTASK_CONTROLLED_LED 0x06UL + * of the two digit 7 segment display. See the documentation page for this demo on + * the FreeRTOS.org web site to see which LED this relates to. */ +#define mainTASK_CONTROLLED_LED 0x06UL /* The LED turned on by the button interrupt, and turned off by the LED timer. -This is an LED in the second digit of the two digit 7 segment display. See the -documentation page for this demo on the FreeRTOS.org web site to see which LED -this relates to. */ -#define mainTIMER_CONTROLLED_LED 0x05UL + * This is an LED in the second digit of the two digit 7 segment display. See the + * documentation page for this demo on the FreeRTOS.org web site to see which LED + * this relates to. */ +#define mainTIMER_CONTROLLED_LED 0x05UL /* The LED used by the comtest tasks. See the comtest.c file for more -information. The LEDs used by the comtest task are in the second digit of the -two digit 7 segment display. See the documentation page for this demo on the -FreeRTOS.org web site to see which LEDs this relates to. */ -#define mainCOM_TEST_LED ( 3 ) + * information. The LEDs used by the comtest task are in the second digit of the + * two digit 7 segment display. See the documentation page for this demo on the + * FreeRTOS.org web site to see which LEDs this relates to. */ +#define mainCOM_TEST_LED ( 3 ) /* Constant used by the standard timer test functions. */ -#define mainTIMER_TEST_PERIOD ( 50 ) +#define mainTIMER_TEST_PERIOD ( 50 ) /* Priorities used by the various different standard demo tasks. */ -#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* Priorities defined in this main-full.c file. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The period at 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 mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS ) + * 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 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_PERIOD_MS constant. */ -#define mainERROR_CHECK_TIMER_PERIOD_MS ( 500UL / portTICK_PERIOD_MS ) + * 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_TIMER_PERIOD_MS ( 500UL / portTICK_PERIOD_MS ) /* The period at which the digit counter timer will expire, in ms, and converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainDIGIT_COUNTER_TIMER_PERIOD_MS ( 250UL / portTICK_PERIOD_MS ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainDIGIT_COUNTER_TIMER_PERIOD_MS ( 250UL / portTICK_PERIOD_MS ) /* The LED will remain on until the button has not been pushed for a full -5000ms. */ -#define mainLED_TIMER_PERIOD_MS ( 5000UL / portTICK_PERIOD_MS ) + * 5000ms. */ +#define mainLED_TIMER_PERIOD_MS ( 5000UL / portTICK_PERIOD_MS ) /* A zero block time. */ -#define mainDONT_BLOCK ( 0UL ) +#define mainDONT_BLOCK ( 0UL ) /* Baud rate used by the comtest tasks. */ -#define mainCOM_TEST_BAUD_RATE ( 115200UL ) +#define mainCOM_TEST_BAUD_RATE ( 115200UL ) /*-----------------------------------------------------------*/ @@ -219,8 +219,8 @@ static void prvSetupHardware( void ); * The application specific (not common demo) tasks as described in the comments * at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * The LED timer callback function. This does nothing but switch an LED off. @@ -241,7 +241,8 @@ static void prvDigitCounterTimerCallback( TimerHandle_t xTimer ); * This is not a 'standard' partest function, so the prototype is not in * partest.h, and is instead included here. */ -void vParTestSetLEDFromISR( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue ); +void vParTestSetLEDFromISR( unsigned portBASE_TYPE uxLED, + signed portBASE_TYPE xValue ); /*-----------------------------------------------------------*/ @@ -249,377 +250,384 @@ void vParTestSetLEDFromISR( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE x static QueueHandle_t xQueue = NULL; /* The LED software timer. This uses prvLEDTimerCallback() as it's callback -function. */ + * function. */ static TimerHandle_t xLEDTimer = NULL; /* The digit counter software timer. This displays a counting digit on one half -of the seven segment displays. */ + * of the seven segment displays. */ static TimerHandle_t xDigitCounterTimer = NULL; /* The check timer. This uses prvCheckTimerCallback() as its callback -function. */ + * function. */ static TimerHandle_t xCheckTimer = NULL; /* If an error is detected in a standard demo task, then pcStatusMessage will -be set to point to a string that identifies the offending task. This is just -to make debugging easier. */ -static const char *pcStatusMessage = NULL; + * be set to point to a string that identifies the offending task. This is just + * to make debugging easier. */ +static const char * pcStatusMessage = NULL; /*-----------------------------------------------------------*/ -int main(void) +int main( void ) { - /* Configure the NVIC, LED outputs and button inputs. */ - prvSetupHardware(); - - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); - - if( xQueue != NULL ) - { - /* Start the two application specific demo tasks, as described in the - comments at the top of this file. */ - xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL ); - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Create the software timer that is responsible for turning off the LED - if the button is not pushed within 5000ms, as described at the top of - this file. */ - xLEDTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */ - ( mainLED_TIMER_PERIOD_MS ),/* The timer period, in this case 5000ms (5s). */ - pdFALSE, /* This is a one-shot timer, so xAutoReload is set to pdFALSE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvLEDTimerCallback /* The callback function that switches the LED off. */ - ); - - /* Create the software timer that performs the 'check' functionality, - as described at the top of this file. */ - xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ - ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - /* Create the software timer that performs the 'digit counting' - functionality, as described at the top of this file. */ - xDigitCounterTimer = xTimerCreate( "DigitCounter", /* A text name, purely to help debugging. */ - ( mainDIGIT_COUNTER_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvDigitCounterTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - /* Create a lot of 'standard demo' tasks. Over 40 tasks are created in - this demo. For a much simpler demo, select the 'blinky' build - configuration. */ - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vCreateBlockTimeTasks(); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); - vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY ); - vStartQueuePeekTasks(); - vStartRecursiveMutexTasks(); - vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartCountingSemaphoreTasks(); - vStartDynamicPriorityTasks(); - - /* The suicide tasks must be created last, as they need to know how many - tasks were running prior to their creation in order to ascertain whether - or not the correct/expected number of tasks are running at any given - time. */ - vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - - /* Start the tasks and timer running. */ - 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 - insufficient FreeRTOS heap memory available for the idle and/or timer tasks - to be created. See the memory management section on the FreeRTOS web site - for more details. */ - for( ;; ); + /* Configure the NVIC, LED outputs and button inputs. */ + prvSetupHardware(); + + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); + + if( xQueue != NULL ) + { + /* Start the two application specific demo tasks, as described in the + * comments at the top of this file. */ + xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL ); + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Create the software timer that is responsible for turning off the LED + * if the button is not pushed within 5000ms, as described at the top of + * this file. */ + xLEDTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */ + ( mainLED_TIMER_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */ + pdFALSE, /* This is a one-shot timer, so xAutoReload is set to pdFALSE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvLEDTimerCallback /* The callback function that switches the LED off. */ + ); + + /* Create the software timer that performs the 'check' functionality, + * as described at the top of this file. */ + xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ + ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + /* Create the software timer that performs the 'digit counting' + * functionality, as described at the top of this file. */ + xDigitCounterTimer = xTimerCreate( "DigitCounter", /* A text name, purely to help debugging. */ + ( mainDIGIT_COUNTER_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvDigitCounterTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + /* Create a lot of 'standard demo' tasks. Over 40 tasks are created in + * this demo. For a much simpler demo, select the 'blinky' build + * configuration. */ + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vCreateBlockTimeTasks(); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); + vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY ); + vStartQueuePeekTasks(); + vStartRecursiveMutexTasks(); + vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartCountingSemaphoreTasks(); + vStartDynamicPriorityTasks(); + + /* The suicide tasks must be created last, as they need to know how many + * tasks were running prior to their creation in order to ascertain whether + * or not the correct/expected number of tasks are running at any given + * time. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + + /* Start the tasks and timer running. */ + 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 + * insufficient FreeRTOS heap memory available for the idle and/or timer tasks + * to be created. See the memory management section on the FreeRTOS web site + * for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ static void prvCheckTimerCallback( TimerHandle_t xTimer ) { - /* Check the standard demo tasks are running without error. Latch the - latest reported error in the pcStatusMessage character pointer. */ - if( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: GenQueue"; - } - - if( xAreQueuePeekTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: QueuePeek\r\n"; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: BlockQueue\r\n"; - } - - if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: BlockTime\r\n"; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: SemTest\r\n"; - } - - if( xIsCreateTaskStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: Death\r\n"; - } - - if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: RecMutex\r\n"; - } - - if( xAreComTestTasksStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: ComTest\r\n"; - } - - if( xAreTimerDemoTasksStillRunning( ( mainCHECK_TIMER_PERIOD_MS ) ) != pdTRUE ) - { - pcStatusMessage = "Error: TimerDemo"; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: PollQueue"; - } - - if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: CountSem"; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: DynamicPriority"; - } - - /* Toggle the check LED to give an indication of the system status. If - the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then - everything is ok. A faster toggle indicates an error. */ - vParTestToggleLED( mainCHECK_LED ); - - /* Have any errors been latch in pcStatusMessage? If so, shorten the - period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. - This will result in an increase in the rate at which mainCHECK_LED - toggles. */ - if( pcStatusMessage != NULL ) - { - /* This call to xTimerChangePeriod() uses a zero block time. Functions - called from inside of a timer callback function must *never* attempt - to block. */ - xTimerChangePeriod( xCheckTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); - } + /* Check the standard demo tasks are running without error. Latch the + * latest reported error in the pcStatusMessage character pointer. */ + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: GenQueue"; + } + + if( xAreQueuePeekTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: QueuePeek\r\n"; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: BlockQueue\r\n"; + } + + if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: BlockTime\r\n"; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: SemTest\r\n"; + } + + if( xIsCreateTaskStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: Death\r\n"; + } + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: RecMutex\r\n"; + } + + if( xAreComTestTasksStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: ComTest\r\n"; + } + + if( xAreTimerDemoTasksStillRunning( ( mainCHECK_TIMER_PERIOD_MS ) ) != pdTRUE ) + { + pcStatusMessage = "Error: TimerDemo"; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: PollQueue"; + } + + if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: CountSem"; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: DynamicPriority"; + } + + /* Toggle the check LED to give an indication of the system status. If + * the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then + * everything is ok. A faster toggle indicates an error. */ + vParTestToggleLED( mainCHECK_LED ); + + /* Have any errors been latch in pcStatusMessage? If so, shorten the + * period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. + * This will result in an increase in the rate at which mainCHECK_LED + * toggles. */ + if( pcStatusMessage != NULL ) + { + /* This call to xTimerChangePeriod() uses a zero block time. Functions + * called from inside of a timer callback function must *never* attempt + * to block. */ + xTimerChangePeriod( xCheckTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); + } } /*-----------------------------------------------------------*/ static void prvLEDTimerCallback( TimerHandle_t xTimer ) { - /* The timer has expired - so no button pushes have occurred in the last - five seconds - turn the LED off. */ - vParTestSetLED( mainTIMER_CONTROLLED_LED, pdFALSE ); + /* The timer has expired - so no button pushes have occurred in the last + * five seconds - turn the LED off. */ + vParTestSetLED( mainTIMER_CONTROLLED_LED, pdFALSE ); } /*-----------------------------------------------------------*/ static void prvDigitCounterTimerCallback( TimerHandle_t xTimer ) { /* Define the bit patterns that display numbers on the seven segment display. */ -static const unsigned short usNumbersPatterns[] = { 0xC000U, 0xF900U, 0xA400U, 0xB000U, 0x9900U, 0x9200U, 0x8200U, 0xF800U, 0x8000U, 0x9000U }; -static long lCounter = 0L; -const long lNumberOfDigits = 10L; + static const unsigned short usNumbersPatterns[] = { 0xC000U, 0xF900U, 0xA400U, 0xB000U, 0x9900U, 0x9200U, 0x8200U, 0xF800U, 0x8000U, 0x9000U }; + static long lCounter = 0L; + const long lNumberOfDigits = 10L; - /* Display the next number, counting up. */ - FM3_GPIO->PDOR1 = usNumbersPatterns[ lCounter ]; + /* Display the next number, counting up. */ + FM3_GPIO->PDOR1 = usNumbersPatterns[ lCounter ]; - /* Move onto the next digit. */ - lCounter++; + /* Move onto the next digit. */ + lCounter++; - /* Ensure the counter does not go off the end of the array. */ - if( lCounter >= lNumberOfDigits ) - { - lCounter = 0L; - } + /* Ensure the counter does not go off the end of the array. */ + if( lCounter >= lNumberOfDigits ) + { + lCounter = 0L; + } } /*-----------------------------------------------------------*/ /* The ISR executed when the user button is pushed. */ void INT0_7_Handler( void ) { -portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; - - /* The button was pushed, so ensure the LED is on before resetting the - LED timer. The LED timer will turn the LED off if the button is not - pushed within 5000ms. */ - vParTestSetLEDFromISR( mainTIMER_CONTROLLED_LED, pdTRUE ); - - /* This interrupt safe FreeRTOS function can be called from this interrupt - because the interrupt priority is below the - configMAX_SYSCALL_INTERRUPT_PRIORITY setting in FreeRTOSConfig.h. */ - xTimerResetFromISR( xLEDTimer, &xHigherPriorityTaskWoken ); - - /* Clear the interrupt before leaving. This just clears all the interrupts - for simplicity, as only one is actually used in this simple demo anyway. */ - FM3_EXTI->EICL = 0x0000; - - /* If calling xTimerResetFromISR() caused a task (in this case the timer - service/daemon task) to unblock, and the unblocked task has a priority - higher than or equal to the task that was interrupted, then - xHigherPriorityTaskWoken will now be set to pdTRUE, and calling - portEND_SWITCHING_ISR() will ensure the unblocked task runs next. */ - portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + + /* The button was pushed, so ensure the LED is on before resetting the + * LED timer. The LED timer will turn the LED off if the button is not + * pushed within 5000ms. */ + vParTestSetLEDFromISR( mainTIMER_CONTROLLED_LED, pdTRUE ); + + /* This interrupt safe FreeRTOS function can be called from this interrupt + * because the interrupt priority is below the + * configMAX_SYSCALL_INTERRUPT_PRIORITY setting in FreeRTOSConfig.h. */ + xTimerResetFromISR( xLEDTimer, &xHigherPriorityTaskWoken ); + + /* Clear the interrupt before leaving. This just clears all the interrupts + * for simplicity, as only one is actually used in this simple demo anyway. */ + FM3_EXTI->EICL = 0x0000; + + /* If calling xTimerResetFromISR() caused a task (in this case the timer + * service/daemon task) to unblock, and the unblocked task has a priority + * higher than or equal to the task that was interrupted, then + * xHigherPriorityTaskWoken will now be set to pdTRUE, and calling + * portEND_SWITCHING_ISR() will ensure the unblocked task runs next. */ + portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; - - /* The timer command queue will have been filled when the timer test tasks - were created in main() (this is part of the test they perform). Therefore, - while the check and digit counter timers can be created in main(), they - cannot be started from main(). Once the scheduler has started, the timer - service task will drain the command queue, and now the check and digit - counter timers can be started successfully. */ - xTimerStart( xCheckTimer, portMAX_DELAY ); - xTimerStart( xDigitCounterTimer, portMAX_DELAY ); - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, the constant used converts ticks - to ms. While in the Blocked state this task will not consume any CPU - time. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - - /* Send to the queue - causing the queue receive task to unblock and - toggle an 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 - be empty at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, mainDONT_BLOCK ); - } + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; + + /* The timer command queue will have been filled when the timer test tasks + * were created in main() (this is part of the test they perform). Therefore, + * while the check and digit counter timers can be created in main(), they + * cannot be started from main(). Once the scheduler has started, the timer + * service task will drain the command queue, and now the check and digit + * counter timers can be started successfully. */ + xTimerStart( xCheckTimer, portMAX_DELAY ); + xTimerStart( xDigitCounterTimer, portMAX_DELAY ); + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, the constant used converts ticks + * to ms. While in the Blocked state this task will not consume any CPU + * time. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + + /* Send to the queue - causing the queue receive task to unblock and + * toggle an 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 + * be empty at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, mainDONT_BLOCK ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it the expected value? If it is, toggle the LED. */ - if( ulReceivedValue == 100UL ) - { - vParTestToggleLED( mainTASK_CONTROLLED_LED ); - } - } + unsigned long ulReceivedValue; + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it the expected value? If it is, toggle the LED. */ + if( ulReceivedValue == 100UL ) + { + vParTestToggleLED( mainTASK_CONTROLLED_LED ); + } + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { -const unsigned short usButtonInputBit = 0x01U; + const unsigned short usButtonInputBit = 0x01U; - SystemInit(); - SystemCoreClockUpdate(); + SystemInit(); + SystemCoreClockUpdate(); - /* Initialise the IO used for the LEDs on the 7 segment displays. */ - vParTestInitialise(); + /* Initialise the IO used for the LEDs on the 7 segment displays. */ + vParTestInitialise(); - /* Set the switches to input (P18->P1F). */ - FM3_GPIO->DDR5 = 0x0000; - FM3_GPIO->PFR5 = 0x0000; + /* Set the switches to input (P18->P1F). */ + FM3_GPIO->DDR5 = 0x0000; + FM3_GPIO->PFR5 = 0x0000; - /* Assign the button input as GPIO. */ - FM3_GPIO->PFR1 |= usButtonInputBit; + /* Assign the button input as GPIO. */ + FM3_GPIO->PFR1 |= usButtonInputBit; - /* Button interrupt on falling edge. */ - FM3_EXTI->ELVR = 0x0003; + /* Button interrupt on falling edge. */ + FM3_EXTI->ELVR = 0x0003; - /* Clear all external interrupts. */ - FM3_EXTI->EICL = 0x0000; + /* Clear all external interrupts. */ + FM3_EXTI->EICL = 0x0000; - /* Enable the button interrupt. */ - FM3_EXTI->ENIR |= usButtonInputBit; + /* Enable the button interrupt. */ + FM3_EXTI->ENIR |= usButtonInputBit; - /* Setup the GPIO and the NVIC for the switch used in this simple demo. */ - NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY ); + /* Setup the GPIO and the NVIC for the switch used in this simple demo. */ + NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY ); NVIC_EnableIRQ( EXINT0_7_IRQn ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ - for( ;; ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* Run time stack overflow checking is performed if - configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook - function is called if a stack overflow is detected. */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* Run time stack overflow checking is performed if + * configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook + * function is called if a stack overflow is detected. */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile size_t xFreeStackSpace; - - /* This function is called on each cycle of the idle task. In this case it - does nothing useful, other than report the amount of FreeRTOS heap that - remains unallocated. */ - xFreeStackSpace = xPortGetFreeHeapSize(); - - if( xFreeStackSpace > 100 ) - { - /* By now, the kernel has allocated everything it is going to, so - if there is a lot of heap remaining unallocated then - the value of configTOTAL_HEAP_SIZE in FreeRTOSConfig.h can be - reduced accordingly. */ - } + volatile size_t xFreeStackSpace; + + /* This function is called on each cycle of the idle task. In this case it + * does nothing useful, other than report the amount of FreeRTOS heap that + * remains unallocated. */ + xFreeStackSpace = xPortGetFreeHeapSize(); + + if( xFreeStackSpace > 100 ) + { + /* By now, the kernel has allocated everything it is going to, so + * if there is a lot of heap remaining unallocated then + * the value of configTOTAL_HEAP_SIZE in FreeRTOSConfig.h can be + * reduced accordingly. */ + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* Call the periodic timer test, which tests the timer API functions that - can be called from an ISR. */ - vTimerPeriodicISRTests(); + /* Call the periodic timer test, which tests the timer API functions that + * can be called from an ISR. */ + vTimerPeriodicISRTests(); } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/main_blinky.c b/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/main_blinky.c index 618efa2d810..bdc689dd542 100644 --- a/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -85,23 +85,23 @@ #include "system_mb9bf50x.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue, specified in milliseconds, and -converted to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * converted to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /* The LED toggle by the queue receive task. */ -#define mainTASK_CONTROLLED_LED 0x8000UL +#define mainTASK_CONTROLLED_LED 0x8000UL /* The LED turned on by the button interrupt, and turned off by the LED timer. */ -#define mainTIMER_CONTROLLED_LED 0x8000UL +#define mainTIMER_CONTROLLED_LED 0x8000UL /*-----------------------------------------------------------*/ @@ -113,8 +113,8 @@ static void prvSetupHardware( void ); /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * The LED timer callback function. This does nothing but switch off the @@ -128,241 +128,244 @@ static void vLEDTimerCallback( TimerHandle_t xTimer ); static QueueHandle_t xQueue = NULL; /* The LED software timer. This uses vLEDTimerCallback() as its callback -function. */ + * function. */ static TimerHandle_t xLEDTimer = NULL; /*-----------------------------------------------------------*/ -int main(void) +int main( void ) { - /* Configure the NVIC, LED outputs and button inputs. */ - prvSetupHardware(); - - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); - - if( xQueue != NULL ) - { - /* Start the two tasks as described in the comments at the top of this - file. */ - xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL ); - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Create the software timer that is responsible for turning off the LED - if the button is not pushed within 5000ms, as described at the top of - this file. */ - xLEDTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */ - ( 5000 / portTICK_PERIOD_MS ),/* The timer period, in this case 5000ms (5s). */ - pdFALSE, /* This is a one-shot timer, so xAutoReload is set to pdFALSE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - vLEDTimerCallback /* The callback function that switches the LED off. */ - ); - - /* Start the tasks and timer running. */ - 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 - insufficient FreeRTOS heap memory available for the idle and/or timer tasks - to be created. See the memory management section on the FreeRTOS web site - for more details. */ - for( ;; ); + /* Configure the NVIC, LED outputs and button inputs. */ + prvSetupHardware(); + + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); + + if( xQueue != NULL ) + { + /* Start the two tasks as described in the comments at the top of this + * file. */ + xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL ); + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Create the software timer that is responsible for turning off the LED + * if the button is not pushed within 5000ms, as described at the top of + * this file. */ + xLEDTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */ + ( 5000 / portTICK_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */ + pdFALSE, /* This is a one-shot timer, so xAutoReload is set to pdFALSE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + vLEDTimerCallback /* The callback function that switches the LED off. */ + ); + + /* Start the tasks and timer running. */ + 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 + * insufficient FreeRTOS heap memory available for the idle and/or timer tasks + * to be created. See the memory management section on the FreeRTOS web site + * for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ static void vLEDTimerCallback( TimerHandle_t xTimer ) { - /* The timer has expired - so no button pushes have occurred in the last - five seconds - turn the LED off. NOTE - accessing the LED port should use - a critical section because it is accessed from multiple tasks, and the - button interrupt - in this trivial case, for simplicity, the critical - section is omitted. */ - FM3_GPIO->PDOR1 |= mainTIMER_CONTROLLED_LED; + /* The timer has expired - so no button pushes have occurred in the last + * five seconds - turn the LED off. NOTE - accessing the LED port should use + * a critical section because it is accessed from multiple tasks, and the + * button interrupt - in this trivial case, for simplicity, the critical + * section is omitted. */ + FM3_GPIO->PDOR1 |= mainTIMER_CONTROLLED_LED; } /*-----------------------------------------------------------*/ /* The ISR executed when the user button is pushed. */ void INT0_7_Handler( void ) { -portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; - - /* The button was pushed, so ensure the LED is on before resetting the - LED timer. The LED timer will turn the LED off if the button is not - pushed within 5000ms. */ - FM3_GPIO->PDOR1 &= ~mainTIMER_CONTROLLED_LED; - - /* This interrupt safe FreeRTOS function can be called from this interrupt - because the interrupt priority is below the - configMAX_SYSCALL_INTERRUPT_PRIORITY setting in FreeRTOSConfig.h. */ - xTimerResetFromISR( xLEDTimer, &xHigherPriorityTaskWoken ); - - /* Clear the interrupt before leaving. This just clears all the interrupts - for simplicity, as only one is actually used in this simple demo anyway. */ - FM3_EXTI->EICL = 0x0000; - - /* If calling xTimerResetFromISR() caused a task (in this case the timer - service/daemon task) to unblock, and the unblocked task has a priority - higher than or equal to the task that was interrupted, then - xHigherPriorityTaskWoken will now be set to pdTRUE, and calling - portEND_SWITCHING_ISR() will ensure the unblocked task runs next. */ - portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + + /* The button was pushed, so ensure the LED is on before resetting the + * LED timer. The LED timer will turn the LED off if the button is not + * pushed within 5000ms. */ + FM3_GPIO->PDOR1 &= ~mainTIMER_CONTROLLED_LED; + + /* This interrupt safe FreeRTOS function can be called from this interrupt + * because the interrupt priority is below the + * configMAX_SYSCALL_INTERRUPT_PRIORITY setting in FreeRTOSConfig.h. */ + xTimerResetFromISR( xLEDTimer, &xHigherPriorityTaskWoken ); + + /* Clear the interrupt before leaving. This just clears all the interrupts + * for simplicity, as only one is actually used in this simple demo anyway. */ + FM3_EXTI->EICL = 0x0000; + + /* If calling xTimerResetFromISR() caused a task (in this case the timer + * service/daemon task) to unblock, and the unblocked task has a priority + * higher than or equal to the task that was interrupted, then + * xHigherPriorityTaskWoken will now be set to pdTRUE, and calling + * portEND_SWITCHING_ISR() will ensure the unblocked task runs next. */ + portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, the constant used converts ticks - to ms. While in the Blocked state this task will not consume any CPU - time. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - - /* Send to the queue - causing the queue receive task to unblock and - toggle an 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 - be empty at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0 ); - } + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, the constant used converts ticks + * to ms. While in the Blocked state this task will not consume any CPU + * time. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + + /* Send to the queue - causing the queue receive task to unblock and + * toggle an 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 + * be empty at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0 ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it the expected value? If it is, toggle the LED. */ - if( ulReceivedValue == 100UL ) - { - /* NOTE - accessing the LED port should use a critical section - because it is accessed from multiple tasks, and the button interrupt - - in this trivial case, for simplicity, the critical section is - omitted. */ - if( ( FM3_GPIO->PDOR3 & mainTASK_CONTROLLED_LED ) != 0 ) - { - FM3_GPIO->PDOR3 &= ~mainTASK_CONTROLLED_LED; - } - else - { - FM3_GPIO->PDOR3 |= mainTASK_CONTROLLED_LED; - } - } - } + unsigned long ulReceivedValue; + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it the expected value? If it is, toggle the LED. */ + if( ulReceivedValue == 100UL ) + { + /* NOTE - accessing the LED port should use a critical section + * because it is accessed from multiple tasks, and the button interrupt + * - in this trivial case, for simplicity, the critical section is + * omitted. */ + if( ( FM3_GPIO->PDOR3 & mainTASK_CONTROLLED_LED ) != 0 ) + { + FM3_GPIO->PDOR3 &= ~mainTASK_CONTROLLED_LED; + } + else + { + FM3_GPIO->PDOR3 |= mainTASK_CONTROLLED_LED; + } + } + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { -const unsigned short usButtonInputBit = 0x01U; -const unsigned short usGPIOState = 0xFF00U; + const unsigned short usButtonInputBit = 0x01U; + const unsigned short usGPIOState = 0xFF00U; - SystemInit(); - SystemCoreClockUpdate(); + SystemInit(); + SystemCoreClockUpdate(); - /* Analog inputs are not used on the LED outputs. */ - FM3_GPIO->ADE = 0x00FF; + /* Analog inputs are not used on the LED outputs. */ + FM3_GPIO->ADE = 0x00FF; - /* LED seg1 to GPIO output (P18->P1F). */ - FM3_GPIO->DDR1 = 0xFF00; - FM3_GPIO->PFR1 = 0x0000; + /* LED seg1 to GPIO output (P18->P1F). */ + FM3_GPIO->DDR1 = 0xFF00; + FM3_GPIO->PFR1 = 0x0000; - /* LED seg2 to GPIO output (P30->P3F). */ - FM3_GPIO->DDR3 = 0xFF00; - FM3_GPIO->PFR3 = 0x0000; + /* LED seg2 to GPIO output (P30->P3F). */ + FM3_GPIO->DDR3 = 0xFF00; + FM3_GPIO->PFR3 = 0x0000; - /* Start with all LEDs off. */ - FM3_GPIO->PDOR3 = usGPIOState; - FM3_GPIO->PDOR1 = usGPIOState; + /* Start with all LEDs off. */ + FM3_GPIO->PDOR3 = usGPIOState; + FM3_GPIO->PDOR1 = usGPIOState; - /* Set the switches to input (P18->P1F). */ - FM3_GPIO->DDR5 = 0x0000; - FM3_GPIO->PFR5 = 0x0000; + /* Set the switches to input (P18->P1F). */ + FM3_GPIO->DDR5 = 0x0000; + FM3_GPIO->PFR5 = 0x0000; - /* Assign the button input as GPIO. */ - FM3_GPIO->PFR1 |= usButtonInputBit; + /* Assign the button input as GPIO. */ + FM3_GPIO->PFR1 |= usButtonInputBit; - /* Button interrupt on falling edge. */ - FM3_EXTI->ELVR = 0x0003; + /* Button interrupt on falling edge. */ + FM3_EXTI->ELVR = 0x0003; - /* Clear all external interrupts. */ - FM3_EXTI->EICL = 0x0000; + /* Clear all external interrupts. */ + FM3_EXTI->EICL = 0x0000; - /* Enable the button interrupt. */ - FM3_EXTI->ENIR |= usButtonInputBit; + /* Enable the button interrupt. */ + FM3_EXTI->ENIR |= usButtonInputBit; - /* Setup the GPIO and the NVIC for the switch used in this simple demo. */ - NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY ); + /* Setup the GPIO and the NVIC for the switch used in this simple demo. */ + NVIC_SetPriority( EXINT0_7_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY ); NVIC_EnableIRQ( EXINT0_7_IRQn ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ - for( ;; ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* Run time stack overflow checking is performed if - configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook - function is called if a stack overflow is detected. */ - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* Run time stack overflow checking is performed if + * configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook + * function is called if a stack overflow is detected. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* A tick hook is used by the "Full" build configuration. The Full and - blinky build configurations share a FreeRTOSConfig.h header file, so this - simple build configuration also has to define a tick hook - even though it - does not actually use it for anything. */ + /* A tick hook is used by the "Full" build configuration. The Full and + * blinky build configurations share a FreeRTOSConfig.h header file, so this + * simple build configuration also has to define a tick hook - even though it + * does not actually use it for anything. */ } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile size_t xFreeHeapSpace; - - /* This function is called on each cycle of the idle task. In this case it - does nothing useful, other than report the amount of FreeRTOS heap that - remains unallocated. */ - xFreeHeapSpace = xPortGetFreeHeapSize(); - - if( xFreeHeapSpace > 100 ) - { - /* By now, the kernel has allocated everything it is going to, so - if there is a lot of heap remaining unallocated then - the value of configTOTAL_HEAP_SIZE in FreeRTOSConfig.h can be - reduced accordingly. */ - } + volatile size_t xFreeHeapSpace; + + /* This function is called on each cycle of the idle task. In this case it + * does nothing useful, other than report the amount of FreeRTOS heap that + * remains unallocated. */ + xFreeHeapSpace = xPortGetFreeHeapSize(); + + if( xFreeHeapSpace > 100 ) + { + /* By now, the kernel has allocated everything it is going to, so + * if there is a lot of heap remaining unallocated then + * the value of configTOTAL_HEAP_SIZE in FreeRTOSConfig.h can be + * reduced accordingly. */ + } } /*-----------------------------------------------------------*/ - - - - diff --git a/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/serial.c b/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/serial.c index 9543039ccd5..78883d89b2b 100644 --- a/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/serial.c +++ b/FreeRTOS/Demo/CORTEX_MB9B500_IAR_Keil/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/FreeRTOSConfig.h index 3a122e4a9c6..095f3df7635 100644 --- a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/IntQueueTimer.c index 582a220efd9..b47c8e5fd1a 100644 --- a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/IntQueueTimer.h index 0b63235944f..e393ad8274d 100644 --- a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/build/gcc/startup_gcc.c b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/build/gcc/startup_gcc.c index ee3ac05a744..d0531116cce 100644 --- a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/build/gcc/startup_gcc.c +++ b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/build/gcc/startup_gcc.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main.c b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main.c index 838dcf57e85..e24439f3e8d 100644 --- a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main.c +++ b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -55,25 +55,25 @@ #include /* This project provides two demo applications. A simple blinky style demo -application, and a more comprehensive test and demo application. The -mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is used to select between the two. - -If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is 1 then the blinky demo will be built. -The blinky demo is implemented and described in main_blinky.c. - -If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is not 1 then the comprehensive test and -demo application will be built. The comprehensive test and demo application is -implemented and described in main_full.c. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 + * application, and a more comprehensive test and demo application. The + * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is used to select between the two. + * + * If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is 1 then the blinky demo will be built. + * The blinky demo is implemented and described in main_blinky.c. + * + * If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is not 1 then the comprehensive test and + * demo application will be built. The comprehensive test and demo application is + * implemented and described in main_full.c. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 /* printf() output uses the UART. These constants define the addresses of the -required UART registers. */ -#define UART0_ADDRESS ( 0x40004000UL ) -#define UART0_DATA ( * ( ( ( volatile uint32_t * )( UART0_ADDRESS + 0UL ) ) ) ) -#define UART0_STATE ( * ( ( ( volatile uint32_t * )( UART0_ADDRESS + 4UL ) ) ) ) -#define UART0_CTRL ( * ( ( ( volatile uint32_t * )( UART0_ADDRESS + 8UL ) ) ) ) -#define UART0_BAUDDIV ( * ( ( ( volatile uint32_t * )( UART0_ADDRESS + 16UL ) ) ) ) -#define TX_BUFFER_MASK ( 1UL ) + * required UART registers. */ +#define UART0_ADDRESS ( 0x40004000UL ) +#define UART0_DATA ( *( ( ( volatile uint32_t * ) ( UART0_ADDRESS + 0UL ) ) ) ) +#define UART0_STATE ( *( ( ( volatile uint32_t * ) ( UART0_ADDRESS + 4UL ) ) ) ) +#define UART0_CTRL ( *( ( ( volatile uint32_t * ) ( UART0_ADDRESS + 8UL ) ) ) ) +#define UART0_BAUDDIV ( *( ( ( volatile uint32_t * ) ( UART0_ADDRESS + 16UL ) ) ) ) +#define TX_BUFFER_MASK ( 1UL ) /* * main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1. @@ -98,212 +98,230 @@ static void prvUARTInit( void ); void main( void ) { - /* See https://www.freertos.org/freertos-on-qemu-mps2-an385-model.html for - instructions. */ - - /* Hardware initialisation. printf() output uses the UART for IO. */ - prvUARTInit(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - { - main_blinky(); - } - #else - { - main_full(); - } - #endif + /* See https://www.freertos.org/freertos-on-qemu-mps2-an385-model.html for + * instructions. */ + + /* Hardware initialisation. printf() output uses the UART for IO. */ + prvUARTInit(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + { + main_blinky(); + } + #else + { + main_full(); + } + #endif } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - pvPortMalloc() is called internally by the kernel whenever a task, queue, - timer or semaphore is created using the dynamic allocation (as opposed to - static allocation) option. It is also called by various parts of the - demo application. If heap_1.c, heap_2.c or heap_4.c is being 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 to query the size of free heap space that remains - (although it does not provide information on how the remaining heap might be - fragmented). See http://www.freertos.org/a00111.html for more - information. */ - printf( "\r\n\r\nMalloc failed\r\n" ); - portDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * pvPortMalloc() is called internally by the kernel whenever a task, queue, + * timer or semaphore is created using the dynamic allocation (as opposed to + * static allocation) option. It is also called by various parts of the + * demo application. If heap_1.c, heap_2.c or heap_4.c is being 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 to query the size of free heap space that remains + * (although it does not provide information on how the remaining heap might be + * fragmented). See http://www.freertos.org/a00111.html for more + * information. */ + printf( "\r\n\r\nMalloc failed\r\n" ); + portDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - specified, or call vTaskDelay()). If application tasks make use of the - vTaskDelete() API function to delete themselves then it is also important - that vApplicationIdleHook() is permitted to return to its calling function, - because it is the responsibility of the idle task to clean up memory - allocated by the kernel to any task that has since deleted itself. */ + /* 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 + * specified, or call vTaskDelay()). If application tasks make use of the + * vTaskDelete() API function to delete themselves then it is also important + * that vApplicationIdleHook() is permitted to return to its calling function, + * because it is the responsibility of the idle task to clean up memory + * allocated by the kernel to any task that has since deleted itself. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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. */ - printf( "\r\n\r\nStack overflow in %s\r\n", pcTaskName ); - portDISABLE_INTERRUPTS(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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. */ + printf( "\r\n\r\nStack overflow in %s\r\n", pcTaskName ); + portDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* This function will be called by each tick interrupt if - configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - added here, but the tick hook is called from an interrupt context, so - code must not attempt to block, and only the interrupt safe FreeRTOS API - functions can be used (those that end in FromISR()). */ - - #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) - { - extern void vFullDemoTickHookFunction( void ); - - vFullDemoTickHookFunction(); - } - #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */ + /* This function will be called by each tick interrupt if + * configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + * added here, but the tick hook is called from an interrupt context, so + * code must not attempt to block, and only the interrupt safe FreeRTOS API + * functions can be used (those that end in FromISR()). */ + + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) + { + extern void vFullDemoTickHookFunction( void ); + + vFullDemoTickHookFunction(); + } + #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */ } /*-----------------------------------------------------------*/ void vApplicationDaemonTaskStartupHook( void ) { - /* This function will be called once only, when the daemon task starts to - execute (sometimes called the timer task). This is useful if the - application includes initialisation code that would benefit from executing - after the scheduler has been started. */ + /* This function will be called once only, when the daemon task starts to + * execute (sometimes called the timer task). This is useful if the + * application includes initialisation code that would benefit from executing + * after the scheduler has been started. */ } /*-----------------------------------------------------------*/ -void vAssertCalled( const char *pcFileName, uint32_t ulLine ) +void vAssertCalled( const char * pcFileName, + uint32_t ulLine ) { -volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0; - - /* Called if an assertion passed to configASSERT() fails. See - http://www.freertos.org/a00110.html#configASSERT for more information. */ - - printf( "ASSERT! Line %d, file %s\r\n", ( int ) ulLine, pcFileName ); - - taskENTER_CRITICAL(); - { - /* You can step out of this function to debug the assertion by using - the debugger to set ulSetToNonZeroInDebuggerToContinue to a non-zero - value. */ - while( ulSetToNonZeroInDebuggerToContinue == 0 ) - { - __asm volatile( "NOP" ); - __asm volatile( "NOP" ); - } - } - taskEXIT_CRITICAL(); + volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0; + + /* Called if an assertion passed to configASSERT() fails. See + * http://www.freertos.org/a00110.html#configASSERT for more information. */ + + printf( "ASSERT! Line %d, file %s\r\n", ( int ) ulLine, pcFileName ); + + taskENTER_CRITICAL(); + { + /* You can step out of this function to debug the assertion by using + * the debugger to set ulSetToNonZeroInDebuggerToContinue to a non-zero + * value. */ + while( ulSetToNonZeroInDebuggerToContinue == 0 ) + { + __asm volatile ( "NOP" ); + __asm volatile ( "NOP" ); + } + } + taskEXIT_CRITICAL(); } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an -implementation of vApplicationGetIdleTaskMemory() to provide the memory that is -used by the Idle task. */ -void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) + * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is + * used by the Idle task. */ +void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, + StackType_t ** ppxIdleTaskStackBuffer, + uint32_t * pulIdleTaskStackSize ) { /* If the buffers to be provided to the Idle task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xIdleTaskTCB; -static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Idle task's - state will be stored. */ - *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; - - /* Pass out the array that will be used as the Idle task's stack. */ - *ppxIdleTaskStackBuffer = uxIdleTaskStack; - - /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xIdleTaskTCB; + static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Idle task's + * state will be stored. */ + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + + /* Pass out the array that will be used as the Idle task's stack. */ + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + + /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the -application must provide an implementation of vApplicationGetTimerTaskMemory() -to provide the memory that is used by the Timer service task. */ -void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) + * application must provide an implementation of vApplicationGetTimerTaskMemory() + * to provide the memory that is used by the Timer service task. */ +void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, + StackType_t ** ppxTimerTaskStackBuffer, + uint32_t * pulTimerTaskStackSize ) { /* If the buffers to be provided to the Timer task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xTimerTaskTCB; -static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Timer - task's state will be stored. */ - *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; - - /* Pass out the array that will be used as the Timer task's stack. */ - *ppxTimerTaskStackBuffer = uxTimerTaskStack; - - /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xTimerTaskTCB; + static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Timer + * task's state will be stored. */ + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + + /* Pass out the array that will be used as the Timer task's stack. */ + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + + /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } /*-----------------------------------------------------------*/ static void prvUARTInit( void ) { - UART0_BAUDDIV = 16; - UART0_CTRL = 1; + UART0_BAUDDIV = 16; + UART0_CTRL = 1; } /*-----------------------------------------------------------*/ -int __write( int iFile, char *pcString, int iStringLength ) +int __write( int iFile, + char * pcString, + int iStringLength ) { - int iNextChar; + int iNextChar; + + /* Avoid compiler warnings about unused parameters. */ + ( void ) iFile; - /* Avoid compiler warnings about unused parameters. */ - ( void ) iFile; + /* Output the formatted string to the UART. */ + for( iNextChar = 0; iNextChar < iStringLength; iNextChar++ ) + { + while( ( UART0_STATE & TX_BUFFER_MASK ) != 0 ) + { + } - /* Output the formatted string to the UART. */ - for( iNextChar = 0; iNextChar < iStringLength; iNextChar++ ) - { - while( ( UART0_STATE & TX_BUFFER_MASK ) != 0 ); - UART0_DATA = *pcString; - pcString++; - } + UART0_DATA = *pcString; + pcString++; + } - return iStringLength; + return iStringLength; } /*-----------------------------------------------------------*/ -void *malloc( size_t size ) +void * malloc( size_t size ) { - ( void ) size; + ( void ) size; - /* This project uses heap_4 so doesn't set up a heap for use by the C - library - but something is calling the C library malloc(). See - https://freertos.org/a00111.html for more information. */ - printf( "\r\n\r\nUnexpected call to malloc() - should be usine pvPortMalloc()\r\n" ); - portDISABLE_INTERRUPTS(); - for( ;; ); + /* This project uses heap_4 so doesn't set up a heap for use by the C + * library - but something is calling the C library malloc(). See + * https://freertos.org/a00111.html for more information. */ + printf( "\r\n\r\nUnexpected call to malloc() - should be usine pvPortMalloc()\r\n" ); + portDISABLE_INTERRUPTS(); + for( ; ; ) + { + } } - diff --git a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main_blinky.c b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main_blinky.c index 27d0d2a293d..7fcc3b8050c 100644 --- a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -66,29 +66,29 @@ #include "queue.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The times are converted from -milliseconds to ticks using the pdMS_TO_TICKS() macro. */ -#define mainTASK_SEND_FREQUENCY_MS pdMS_TO_TICKS( 200UL ) -#define mainTIMER_SEND_FREQUENCY_MS pdMS_TO_TICKS( 2000UL ) + * milliseconds to ticks using the pdMS_TO_TICKS() macro. */ +#define mainTASK_SEND_FREQUENCY_MS pdMS_TO_TICKS( 200UL ) +#define mainTIMER_SEND_FREQUENCY_MS pdMS_TO_TICKS( 2000UL ) /* The number of items the queue can hold at once. */ -#define mainQUEUE_LENGTH ( 2 ) +#define mainQUEUE_LENGTH ( 2 ) /* The values sent to the queue receive task from the queue send task and the -queue send software timer respectively. */ -#define mainVALUE_SENT_FROM_TASK ( 100UL ) -#define mainVALUE_SENT_FROM_TIMER ( 200UL ) + * queue send software timer respectively. */ +#define mainVALUE_SENT_FROM_TASK ( 100UL ) +#define mainVALUE_SENT_FROM_TIMER ( 200UL ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * The callback function executed when the software timer expires. @@ -108,128 +108,128 @@ static TimerHandle_t xTimer = NULL; /*** SEE THE COMMENTS AT THE TOP OF THIS FILE ***/ void main_blinky( void ) { -const TickType_t xTimerPeriod = mainTIMER_SEND_FREQUENCY_MS; - - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); - - if( xQueue != NULL ) - { - /* Start the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - NULL, /* The parameter passed to the task - not used in this simple case. */ - mainQUEUE_RECEIVE_TASK_PRIORITY,/* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ - - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Create the software timer, but don't start it yet. */ - xTimer = xTimerCreate( "Timer", /* The text name assigned to the software timer - for debug only as it is not used by the kernel. */ - xTimerPeriod, /* The period of the software timer in ticks. */ - pdTRUE, /* xAutoReload is set to pdTRUE, so this is an auto-reload timer. */ - NULL, /* The timer's ID is not used. */ - prvQueueSendTimerCallback );/* The function executed when the timer expires. */ - - xTimerStart( xTimer, 0 ); /* The scheduler has not started so use a block time of 0. */ - - /* Start the tasks and timer running. */ - 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 insufficient FreeRTOS heap memory available for the idle and/or - timer tasks to be created. See the memory management section on the - FreeRTOS web site for more details. NOTE: This demo uses static allocation - for the idle and timer tasks so this line should never execute. */ - for( ;; ); + const TickType_t xTimerPeriod = mainTIMER_SEND_FREQUENCY_MS; + + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); + + if( xQueue != NULL ) + { + /* Start the two tasks as described in the comments at the top of this + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + NULL, /* The parameter passed to the task - not used in this simple case. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ + + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Create the software timer, but don't start it yet. */ + xTimer = xTimerCreate( "Timer", /* The text name assigned to the software timer - for debug only as it is not used by the kernel. */ + xTimerPeriod, /* The period of the software timer in ticks. */ + pdTRUE, /* xAutoReload is set to pdTRUE, so this is an auto-reload timer. */ + NULL, /* The timer's ID is not used. */ + prvQueueSendTimerCallback ); /* The function executed when the timer expires. */ + + xTimerStart( xTimer, 0 ); /* The scheduler has not started so use a block time of 0. */ + + /* Start the tasks and timer running. */ + 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 insufficient FreeRTOS heap memory available for the idle and/or + * timer tasks to be created. See the memory management section on the + * FreeRTOS web site for more details. NOTE: This demo uses static allocation + * for the idle and timer tasks so this line should never execute. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const TickType_t xBlockTime = mainTASK_SEND_FREQUENCY_MS; -const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TASK; - - /* Prevent the compiler warning about the unused parameter. */ - ( void ) pvParameters; - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, pdMS_TO_TICKS() was used to - convert a time specified in milliseconds into a time specified in ticks. - While in the Blocked state this task will not consume any CPU time. */ - vTaskDelayUntil( &xNextWakeTime, xBlockTime ); - - /* Send to the queue - causing the queue receive task to unblock and - write to the console. 0 is used as the block time so the send operation - will not block - it shouldn't need to block as the queue should always - have at least one space at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } + TickType_t xNextWakeTime; + const TickType_t xBlockTime = mainTASK_SEND_FREQUENCY_MS; + const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TASK; + + /* Prevent the compiler warning about the unused parameter. */ + ( void ) pvParameters; + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, pdMS_TO_TICKS() was used to + * convert a time specified in milliseconds into a time specified in ticks. + * While in the Blocked state this task will not consume any CPU time. */ + vTaskDelayUntil( &xNextWakeTime, xBlockTime ); + + /* Send to the queue - causing the queue receive task to unblock and + * write to the console. 0 is used as the block time so the send operation + * will not block - it shouldn't need to block as the queue should always + * have at least one space at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } } /*-----------------------------------------------------------*/ static void prvQueueSendTimerCallback( TimerHandle_t xTimerHandle ) { -const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TIMER; + const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TIMER; - /* This is the software timer callback function. The software timer has a - period of two seconds and is reset each time a key is pressed. This - callback function will execute if the timer expires, which will only happen - if a key is not pressed for two seconds. */ + /* This is the software timer callback function. The software timer has a + * period of two seconds and is reset each time a key is pressed. This + * callback function will execute if the timer expires, which will only happen + * if a key is not pressed for two seconds. */ - /* Avoid compiler warnings resulting from the unused parameter. */ - ( void ) xTimerHandle; + /* Avoid compiler warnings resulting from the unused parameter. */ + ( void ) xTimerHandle; - /* Send to the queue - causing the queue receive task to unblock and - write out a message. This function is called from the timer/daemon task, so - must not block. Hence the block time is set to 0. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); + /* Send to the queue - causing the queue receive task to unblock and + * write out a message. This function is called from the timer/daemon task, so + * must not block. Hence the block time is set to 0. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -uint32_t ulReceivedValue; - - /* Prevent the compiler warning about the unused parameter. */ - ( void ) pvParameters; - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. It will not use any CPU time while it is in the - Blocked state. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it an expected value? */ - if( ulReceivedValue == mainVALUE_SENT_FROM_TASK ) - { - /* It is normally not good to call printf() from an embedded system, - although it is ok in this simulated case. */ - printf( "Message received from task\r\n" ); - } - else if( ulReceivedValue == mainVALUE_SENT_FROM_TIMER ) - { - printf( "Message received from software timer\r\n" ); - } - else - { - printf( "Unexpected message\r\n" ); - } - } + uint32_t ulReceivedValue; + + /* Prevent the compiler warning about the unused parameter. */ + ( void ) pvParameters; + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. It will not use any CPU time while it is in the + * Blocked state. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it an expected value? */ + if( ulReceivedValue == mainVALUE_SENT_FROM_TASK ) + { + /* It is normally not good to call printf() from an embedded system, + * although it is ok in this simulated case. */ + printf( "Message received from task\r\n" ); + } + else if( ulReceivedValue == mainVALUE_SENT_FROM_TIMER ) + { + printf( "Message received from software timer\r\n" ); + } + else + { + printf( "Unexpected message\r\n" ); + } + } } /*-----------------------------------------------------------*/ - - diff --git a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main_full.c b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main_full.c index 0838a4d64cd..fd205845b41 100644 --- a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main_full.c +++ b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -98,222 +98,224 @@ /*-----------------------------------------------------------*/ /* Task priorities. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) /* Stack sizes are defined relative to configMINIMAL_STACK_SIZE so they scale -across projects that have that constant set differently - in this case the -constant is different depending on the compiler in use. */ -#define mainMESSAGE_BUFFER_STACK_SIZE ( configMINIMAL_STACK_SIZE + ( configMINIMAL_STACK_SIZE >> 1 ) ) -#define mainCHECK_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE + ( configMINIMAL_STACK_SIZE >> 1 ) ) + * across projects that have that constant set differently - in this case the + * constant is different depending on the compiler in use. */ +#define mainMESSAGE_BUFFER_STACK_SIZE ( configMINIMAL_STACK_SIZE + ( configMINIMAL_STACK_SIZE >> 1 ) ) +#define mainCHECK_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE + ( configMINIMAL_STACK_SIZE >> 1 ) ) /*-----------------------------------------------------------*/ /* The task that checks the operation of all the other standard demo tasks, as * described at the top of this file. */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); /*-----------------------------------------------------------*/ void main_full( void ) { - /* Start the standard demo tasks. */ - vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); - vStartInterruptQueueTasks(); - vStartRecursiveMutexTasks(); - vCreateBlockTimeTasks(); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartQueuePeekTasks(); - vStartQueueSetTasks(); - vStartEventGroupTasks(); - vStartMessageBufferTasks( mainMESSAGE_BUFFER_STACK_SIZE ); - vStartStreamBufferTasks(); - vCreateAbortDelayTasks(); - vStartCountingSemaphoreTasks(); - vStartDynamicPriorityTasks(); - vStartMessageBufferAMPTasks( configMINIMAL_STACK_SIZE ); - vStartQueueOverwriteTask( tskIDLE_PRIORITY ); - vStartQueueSetPollingTask(); - vStartStaticallyAllocatedTasks(); - vStartTaskNotifyTask(); - vStartTaskNotifyArrayTask(); - vStartTimerDemoTask( 50 ); - vStartStreamBufferInterruptDemo(); - vStartInterruptSemaphoreTasks(); + /* Start the standard demo tasks. */ + vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); + vStartInterruptQueueTasks(); + vStartRecursiveMutexTasks(); + vCreateBlockTimeTasks(); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartQueuePeekTasks(); + vStartQueueSetTasks(); + vStartEventGroupTasks(); + vStartMessageBufferTasks( mainMESSAGE_BUFFER_STACK_SIZE ); + vStartStreamBufferTasks(); + vCreateAbortDelayTasks(); + vStartCountingSemaphoreTasks(); + vStartDynamicPriorityTasks(); + vStartMessageBufferAMPTasks( configMINIMAL_STACK_SIZE ); + vStartQueueOverwriteTask( tskIDLE_PRIORITY ); + vStartQueueSetPollingTask(); + vStartStaticallyAllocatedTasks(); + vStartTaskNotifyTask(); + vStartTaskNotifyArrayTask(); + vStartTimerDemoTask( 50 ); + vStartStreamBufferInterruptDemo(); + vStartInterruptSemaphoreTasks(); - /* The suicide tasks must be created last as they need to know how many - tasks were running prior to their creation in order to ascertain whether - or not the correct/expected number of tasks are running at any given time. */ - vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + /* The suicide tasks must be created last as they need to know how many + * tasks were running prior to their creation in order to ascertain whether + * or not the correct/expected number of tasks are running at any given time. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - xTaskCreate( prvCheckTask, "Check", mainCHECK_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( prvCheckTask, "Check", mainCHECK_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - /* Start the scheduler. */ - vTaskStartScheduler(); + /* Start the scheduler. */ + vTaskStartScheduler(); - /* If configSUPPORT_STATIC_ALLOCATION was false then execution would only - get here if there was insufficient heap memory to create either the idle or - timer tasks. As static allocation is used execution should never be able - to reach here. */ - for( ;; ); + /* If configSUPPORT_STATIC_ALLOCATION was false then execution would only + * get here if there was insufficient heap memory to create either the idle or + * timer tasks. As static allocation is used execution should never be able + * to reach here. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ /* See the comments at the top of this file. */ -static void prvCheckTask( void *pvParameters ) +static void prvCheckTask( void * pvParameters ) { -static const char * pcMessage = "PASS"; -const TickType_t xTaskPeriod = pdMS_TO_TICKS( 5000UL ); -TickType_t xPreviousWakeTime; -extern uint32_t ulNestCount; + static const char * pcMessage = "PASS"; + const TickType_t xTaskPeriod = pdMS_TO_TICKS( 5000UL ); + TickType_t xPreviousWakeTime; + extern uint32_t ulNestCount; /* Avoid warning about unused parameter. */ ( void ) pvParameters; - xPreviousWakeTime = xTaskGetTickCount(); + xPreviousWakeTime = xTaskGetTickCount(); - for( ;; ) - { - vTaskDelayUntil( &xPreviousWakeTime, xTaskPeriod ); + for( ; ; ) + { + vTaskDelayUntil( &xPreviousWakeTime, xTaskPeriod ); - /* Has an error been found in any task? */ - if( xAreStreamBufferTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreStreamBufferTasksStillRunning() returned false"; - } - else if( xAreMessageBufferTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreMessageBufferTasksStillRunning() returned false"; - } - if( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreGenericQueueTasksStillRunning() returned false"; - } - else if( xIsCreateTaskStillRunning() != pdTRUE ) - { - pcMessage = "xIsCreateTaskStillRunning() returned false"; - } - else if( xAreIntQueueTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreIntQueueTasksStillRunning() returned false"; - } - else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreBlockTimeTestTasksStillRunning() returned false"; - } - else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreSemaphoreTasksStillRunning() returned false"; - } - else if( xArePollingQueuesStillRunning() != pdTRUE ) - { - pcMessage = "xArePollingQueuesStillRunning() returned false"; - } - else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreQueuePeekTasksStillRunning() returned false"; - } - else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreRecursiveMutexTasksStillRunning() returned false"; - } - else if( xAreQueueSetTasksStillRunning() != pdPASS ) - { - pcMessage = "xAreQueueSetTasksStillRunning() returned false"; - } - else if( xAreEventGroupTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreEventGroupTasksStillRunning() returned false"; - } - else if( xAreAbortDelayTestTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreAbortDelayTestTasksStillRunning() returned false"; - } - else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreCountingSemaphoreTasksStillRunning() returned false"; - } - else if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreDynamicPriorityTasksStillRunning() returned false"; - } - else if( xAreMessageBufferAMPTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreMessageBufferAMPTasksStillRunning() returned false"; - } - else if( xIsQueueOverwriteTaskStillRunning() != pdTRUE ) - { - pcMessage = "xIsQueueOverwriteTaskStillRunning() returned false"; - } - else if( xAreQueueSetPollTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreQueueSetPollTasksStillRunning() returned false"; - } - else if( xAreStaticAllocationTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreStaticAllocationTasksStillRunning() returned false"; - } - else if( xAreTaskNotificationTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreTaskNotificationTasksStillRunning() returned false"; - } - else if( xAreTaskNotificationArrayTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreTaskNotificationArrayTasksStillRunning() returned false"; - } - else if( xAreTimerDemoTasksStillRunning( xTaskPeriod ) != pdTRUE ) - { - pcMessage = "xAreTimerDemoTasksStillRunning() returned false"; - } - else if( xIsInterruptStreamBufferDemoStillRunning() != pdTRUE ) - { - pcMessage = "xIsInterruptStreamBufferDemoStillRunning() returned false"; - } - else if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE ) - { - pcMessage = "xAreInterruptSemaphoreTasksStillRunning() returned false"; - } + /* Has an error been found in any task? */ + if( xAreStreamBufferTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreStreamBufferTasksStillRunning() returned false"; + } + else if( xAreMessageBufferTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreMessageBufferTasksStillRunning() returned false"; + } - /* It is normally not good to call printf() from an embedded system, - although it is ok in this simulated case. */ - printf( "%s : %d (%d)\r\n", pcMessage, (int) xTaskGetTickCount(), ( int ) ulNestCount ); - } + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreGenericQueueTasksStillRunning() returned false"; + } + else if( xIsCreateTaskStillRunning() != pdTRUE ) + { + pcMessage = "xIsCreateTaskStillRunning() returned false"; + } + else if( xAreIntQueueTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreIntQueueTasksStillRunning() returned false"; + } + else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreBlockTimeTestTasksStillRunning() returned false"; + } + else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreSemaphoreTasksStillRunning() returned false"; + } + else if( xArePollingQueuesStillRunning() != pdTRUE ) + { + pcMessage = "xArePollingQueuesStillRunning() returned false"; + } + else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreQueuePeekTasksStillRunning() returned false"; + } + else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreRecursiveMutexTasksStillRunning() returned false"; + } + else if( xAreQueueSetTasksStillRunning() != pdPASS ) + { + pcMessage = "xAreQueueSetTasksStillRunning() returned false"; + } + else if( xAreEventGroupTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreEventGroupTasksStillRunning() returned false"; + } + else if( xAreAbortDelayTestTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreAbortDelayTestTasksStillRunning() returned false"; + } + else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreCountingSemaphoreTasksStillRunning() returned false"; + } + else if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreDynamicPriorityTasksStillRunning() returned false"; + } + else if( xAreMessageBufferAMPTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreMessageBufferAMPTasksStillRunning() returned false"; + } + else if( xIsQueueOverwriteTaskStillRunning() != pdTRUE ) + { + pcMessage = "xIsQueueOverwriteTaskStillRunning() returned false"; + } + else if( xAreQueueSetPollTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreQueueSetPollTasksStillRunning() returned false"; + } + else if( xAreStaticAllocationTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreStaticAllocationTasksStillRunning() returned false"; + } + else if( xAreTaskNotificationTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreTaskNotificationTasksStillRunning() returned false"; + } + else if( xAreTaskNotificationArrayTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreTaskNotificationArrayTasksStillRunning() returned false"; + } + else if( xAreTimerDemoTasksStillRunning( xTaskPeriod ) != pdTRUE ) + { + pcMessage = "xAreTimerDemoTasksStillRunning() returned false"; + } + else if( xIsInterruptStreamBufferDemoStillRunning() != pdTRUE ) + { + pcMessage = "xIsInterruptStreamBufferDemoStillRunning() returned false"; + } + else if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE ) + { + pcMessage = "xAreInterruptSemaphoreTasksStillRunning() returned false"; + } + + /* It is normally not good to call printf() from an embedded system, + * although it is ok in this simulated case. */ + printf( "%s : %d (%d)\r\n", pcMessage, ( int ) xTaskGetTickCount(), ( int ) ulNestCount ); + } } /*-----------------------------------------------------------*/ void vFullDemoTickHookFunction( void ) { - /* Write to a queue that is in use as part of the queue set demo to - demonstrate using queue sets from an ISR. */ - vQueueSetAccessQueueSetFromISR(); + /* Write to a queue that is in use as part of the queue set demo to + * demonstrate using queue sets from an ISR. */ + vQueueSetAccessQueueSetFromISR(); - /* Call the event group ISR tests. */ - vPeriodicEventGroupsProcessing(); + /* Call the event group ISR tests. */ + vPeriodicEventGroupsProcessing(); - /* Exercise stream buffers from interrupts. */ - vPeriodicStreamBufferProcessing(); + /* Exercise stream buffers from interrupts. */ + vPeriodicStreamBufferProcessing(); - /* Exercise using queue overwrites from interrupts. */ - vQueueOverwritePeriodicISRDemo(); + /* Exercise using queue overwrites from interrupts. */ + vQueueOverwritePeriodicISRDemo(); - /* Exercise using Queue Sets from interrupts. */ - vQueueSetPollingInterruptAccess(); + /* Exercise using Queue Sets from interrupts. */ + vQueueSetPollingInterruptAccess(); - /* Exercise using task notifications from interrupts. */ - xNotifyTaskFromISR(); - xNotifyArrayTaskFromISR(); + /* Exercise using task notifications from interrupts. */ + xNotifyTaskFromISR(); + xNotifyArrayTaskFromISR(); - /* Exercise software timers from interrupts. */ - vTimerPeriodicISRTests(); + /* Exercise software timers from interrupts. */ + vTimerPeriodicISRTests(); - /* Exercise stream buffers from interrupts. */ - vBasicStreamBufferSendFromISR(); + /* Exercise stream buffers from interrupts. */ + vBasicStreamBufferSendFromISR(); - /* Exercise semaphores from interrupts. */ - vInterruptSemaphorePeriodicTest(); + /* Exercise semaphores from interrupts. */ + vInterruptSemaphorePeriodicTest(); } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_MPU_CEC_MEC_17xx_51xx_Keil_GCC/GCC_Specific/RegTest.c b/FreeRTOS/Demo/CORTEX_MPU_CEC_MEC_17xx_51xx_Keil_GCC/GCC_Specific/RegTest.c index 57412954d1c..06a1c6b54b9 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_CEC_MEC_17xx_51xx_Keil_GCC/GCC_Specific/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_MPU_CEC_MEC_17xx_51xx_Keil_GCC/GCC_Specific/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_CEC_MEC_17xx_51xx_Keil_GCC/Keil_Specific/RegTest.c b/FreeRTOS/Demo/CORTEX_MPU_CEC_MEC_17xx_51xx_Keil_GCC/Keil_Specific/RegTest.c index 0821c57f703..c9cae6af16a 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_CEC_MEC_17xx_51xx_Keil_GCC/Keil_Specific/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_MPU_CEC_MEC_17xx_51xx_Keil_GCC/Keil_Specific/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_CEC_MEC_17xx_51xx_Keil_GCC/main.c b/FreeRTOS/Demo/CORTEX_MPU_CEC_MEC_17xx_51xx_Keil_GCC/main.c index c8fd35b9a3a..cb2fdf705d6 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_CEC_MEC_17xx_51xx_Keil_GCC/main.c +++ b/FreeRTOS/Demo/CORTEX_MPU_CEC_MEC_17xx_51xx_Keil_GCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -55,22 +55,22 @@ /*-----------------------------------------------------------*/ /* Misc constants. */ -#define mainDONT_BLOCK ( 0 ) +#define mainDONT_BLOCK ( 0 ) /* GCC specifics. */ -#define mainALIGN_TO( x ) __attribute__((aligned(x))) +#define mainALIGN_TO( x ) __attribute__( ( aligned( x ) ) ) /* Hardware register addresses. */ -#define mainVTOR ( * ( volatile uint32_t * ) 0xE000ED08 ) +#define mainVTOR ( *( volatile uint32_t * ) 0xE000ED08 ) /* The period of the timer must be less than the rate at which -configPRINT_SYSTEM_STATUS messages are sent to the check task - otherwise the -check task will think the timer has stopped. */ -#define mainTIMER_PERIOD pdMS_TO_TICKS( 200 ) + * configPRINT_SYSTEM_STATUS messages are sent to the check task - otherwise the + * check task will think the timer has stopped. */ +#define mainTIMER_PERIOD pdMS_TO_TICKS( 200 ) /* The name of the task that is deleted by the Idle task is used in a couple of -places, so is #defined. */ -#define mainTASK_TO_DELETE_NAME "DeleteMe" + * places, so is #defined. */ +#define mainTASK_TO_DELETE_NAME "DeleteMe" /*-----------------------------------------------------------*/ /* Prototypes for functions that implement tasks. -----------*/ @@ -98,8 +98,8 @@ places, so is #defined. */ * User mode, and vRegTest2Implementation() receives the task handle using its * parameter. */ -extern void vRegTest1Implementation( void *pvParameters ); -extern void vRegTest2Implementation( void *pvParameters ); +extern void vRegTest1Implementation( void * pvParameters ); +extern void vRegTest2Implementation( void * pvParameters ); /* * The second two register test tasks are similar to the first two, but do test @@ -110,9 +110,9 @@ extern void vRegTest2Implementation( void *pvParameters ); * * The functions ending 'Implementation' are called by the register check tasks. */ -static void prvRegTest3Task( void *pvParameters ); +static void prvRegTest3Task( void * pvParameters ); extern void vRegTest3Implementation( void ); -static void prvRegTest4Task( void *pvParameters ); +static void prvRegTest4Task( void * pvParameters ); extern void vRegTest4Implementation( void ); /* @@ -130,27 +130,27 @@ extern void vRegTest4Implementation( void ); * either pass or fail to the terminal, depending on the status of the reg * test tasks. */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); /* * Prototype for a task created in User mode using the original vTaskCreate() * API function. The task demonstrates the characteristics of such a task, * before simply deleting itself. */ -static void prvOldStyleUserModeTask( void *pvParameters ); +static void prvOldStyleUserModeTask( void * pvParameters ); /* * Prototype for a task created in Privileged mode using the original * vTaskCreate() API function. The task demonstrates the characteristics of * such a task, before simply deleting itself. */ -static void prvOldStylePrivilegedModeTask( void *pvParameters ); +static void prvOldStylePrivilegedModeTask( void * pvParameters ); /* * A task that exercises the API of various RTOS objects before being deleted by * the Idle task. This is done for MPU API code coverage test purposes. */ -static void prvTaskToDelete( void *pvParameters ); +static void prvTaskToDelete( void * pvParameters ); /* * Functions called by prvTaskToDelete() to exercise the MPU API. @@ -169,7 +169,7 @@ static void prvSetupHardware( void ); * is simpler to call from asm code than the normal vTaskDelete() API function. * It has the noinline attribute because it is called from asm code. */ -void vMainDeleteMe( void ) __attribute__((noinline)); +void vMainDeleteMe( void ) __attribute__( ( noinline ) ); /* * Used by the first two reg test tasks and a software timer callback function @@ -178,7 +178,8 @@ void vMainDeleteMe( void ) __attribute__((noinline)); * task detects an error it will delete itself, and in so doing prevent itself * from sending any more 'I'm Alive' messages to the check task. */ -void vMainSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber ); +void vMainSendImAlive( QueueHandle_t xHandle, + uint32_t ulTaskNumber ); /* * The check task is created with access to three memory regions (plus its @@ -200,118 +201,118 @@ static void prvTimerCallback( TimerHandle_t xExpiredTimer ); * Simple routine to print a string to ITM for viewing in the Keil serial debug * viewer. */ -static void prvITMPrintString( const char *pcString ); +static void prvITMPrintString( const char * pcString ); /*-----------------------------------------------------------*/ /* The handle of the queue used to communicate between tasks and between tasks -and interrupts. Note that this is a global scope variable that falls outside of -any MPU region. As such other techniques have to be used to allow the tasks -to gain access to the queue. See the comments in the tasks themselves for -further information. */ + * and interrupts. Note that this is a global scope variable that falls outside of + * any MPU region. As such other techniques have to be used to allow the tasks + * to gain access to the queue. See the comments in the tasks themselves for + * further information. */ QueueHandle_t xGlobalScopeCheckQueue = NULL; /* Holds the handle of a task that is deleted in the idle task hook - this is -done for code coverage test purposes only. */ + * done for code coverage test purposes only. */ static TaskHandle_t xTaskToDelete = NULL; /* The timer that periodically sends data to the check task on the queue. */ static TimerHandle_t xTimer = NULL; -#if defined ( __GNUC__ ) - extern uint32_t __FLASH_segment_start__[]; - extern uint32_t __FLASH_segment_end__[]; - extern uint32_t __SRAM_segment_start__[]; - extern uint32_t __SRAM_segment_end__[]; - extern uint32_t __privileged_functions_start__[]; - extern uint32_t __privileged_functions_end__[]; - extern uint32_t __privileged_data_start__[]; - extern uint32_t __privileged_data_end__[]; - extern uint32_t __privileged_functions_actual_end__[]; - extern uint32_t __privileged_data_actual_end__[]; -#else - extern uint32_t Image$$ER_FREERTOS_SYSTEM_CALLS$$Base; - extern uint32_t Image$$ER_FREERTOS_SYSTEM_CALLS$$Limit; - - const uint32_t * __FLASH_segment_start__ = ( uint32_t * ) 0xE0000UL; - const uint32_t * __FLASH_segment_end__ = ( uint32_t * ) 0x100000UL; - const uint32_t * __SRAM_segment_start__ = ( uint32_t * ) 0x100000UL; - const uint32_t * __SRAM_segment_end__ = ( uint32_t * ) 0x120000UL; - const uint32_t * __privileged_functions_start__ = ( uint32_t * ) 0xE0000UL; - const uint32_t * __privileged_functions_end__ = ( uint32_t * ) 0xF0000UL; - const uint32_t * __syscalls_flash_start__ = ( uint32_t * ) &( Image$$ER_FREERTOS_SYSTEM_CALLS$$Base ); - const uint32_t * __syscalls_flash_end__ = ( uint32_t * ) &( Image$$ER_FREERTOS_SYSTEM_CALLS$$Limit ); - const uint32_t * __privileged_data_start__ = ( uint32_t * ) 0x100000UL; - const uint32_t * __privileged_data_end__ = ( uint32_t * ) 0x108000UL; -#endif +#if defined( __GNUC__ ) + extern uint32_t __FLASH_segment_start__[]; + extern uint32_t __FLASH_segment_end__[]; + extern uint32_t __SRAM_segment_start__[]; + extern uint32_t __SRAM_segment_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; + extern uint32_t __privileged_data_start__[]; + extern uint32_t __privileged_data_end__[]; + extern uint32_t __privileged_functions_actual_end__[]; + extern uint32_t __privileged_data_actual_end__[]; +#else /* if defined( __GNUC__ ) */ + extern uint32_t Image$$ER_FREERTOS_SYSTEM_CALLS$$Base; + extern uint32_t Image$$ER_FREERTOS_SYSTEM_CALLS$$Limit; + + const uint32_t * __FLASH_segment_start__ = ( uint32_t * ) 0xE0000UL; + const uint32_t * __FLASH_segment_end__ = ( uint32_t * ) 0x100000UL; + const uint32_t * __SRAM_segment_start__ = ( uint32_t * ) 0x100000UL; + const uint32_t * __SRAM_segment_end__ = ( uint32_t * ) 0x120000UL; + const uint32_t * __privileged_functions_start__ = ( uint32_t * ) 0xE0000UL; + const uint32_t * __privileged_functions_end__ = ( uint32_t * ) 0xF0000UL; + const uint32_t * __syscalls_flash_start__ = ( uint32_t * ) &( Image$$ER_FREERTOS_SYSTEM_CALLS$$Base ); + const uint32_t * __syscalls_flash_end__ = ( uint32_t * ) &( Image$$ER_FREERTOS_SYSTEM_CALLS$$Limit ); + const uint32_t * __privileged_data_start__ = ( uint32_t * ) 0x100000UL; + const uint32_t * __privileged_data_end__ = ( uint32_t * ) 0x108000UL; +#endif /* if defined( __GNUC__ ) */ /*-----------------------------------------------------------*/ /* Data used by the 'check' task. ---------------------------*/ /*-----------------------------------------------------------*/ /* Define the constants used to allocate the check task stack. Note that the -stack size is defined in words, not bytes. */ -#define mainCHECK_TASK_STACK_SIZE_WORDS 128 -#define mainCHECK_TASK_STACK_ALIGNMENT ( mainCHECK_TASK_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) + * stack size is defined in words, not bytes. */ +#define mainCHECK_TASK_STACK_SIZE_WORDS 128 +#define mainCHECK_TASK_STACK_ALIGNMENT ( mainCHECK_TASK_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) /* Declare the stack that will be used by the check task. The kernel will - automatically create an MPU region for the stack. The stack alignment must - match its size, so if 128 words are reserved for the stack then it must be - aligned to ( 128 * 4 ) bytes. */ + * automatically create an MPU region for the stack. The stack alignment must + * match its size, so if 128 words are reserved for the stack then it must be + * aligned to ( 128 * 4 ) bytes. */ static portSTACK_TYPE xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS ] mainALIGN_TO( mainCHECK_TASK_STACK_ALIGNMENT ); /* Declare three arrays - an MPU region will be created for each array -using the TaskParameters_t structure below. THIS IS JUST TO DEMONSTRATE THE -MPU FUNCTIONALITY, the data is not used by the check tasks primary function -of monitoring the reg test tasks and printing out status information. - -Note that the arrays allocate slightly more RAM than is actually assigned to -the MPU region. This is to permit writes off the end of the array to be -detected even when the arrays are placed in adjacent memory locations (with no -gaps between them). The align size must be a power of two. */ -#define mainREAD_WRITE_ARRAY_SIZE 130 -#define mainREAD_WRITE_ALIGN_SIZE 128 + * using the TaskParameters_t structure below. THIS IS JUST TO DEMONSTRATE THE + * MPU FUNCTIONALITY, the data is not used by the check tasks primary function + * of monitoring the reg test tasks and printing out status information. + * + * Note that the arrays allocate slightly more RAM than is actually assigned to + * the MPU region. This is to permit writes off the end of the array to be + * detected even when the arrays are placed in adjacent memory locations (with no + * gaps between them). The align size must be a power of two. */ +#define mainREAD_WRITE_ARRAY_SIZE 130 +#define mainREAD_WRITE_ALIGN_SIZE 128 char cReadWriteArray[ mainREAD_WRITE_ARRAY_SIZE ] mainALIGN_TO( mainREAD_WRITE_ALIGN_SIZE ); -#define mainREAD_ONLY_ARRAY_SIZE 260 -#define mainREAD_ONLY_ALIGN_SIZE 256 +#define mainREAD_ONLY_ARRAY_SIZE 260 +#define mainREAD_ONLY_ALIGN_SIZE 256 char cReadOnlyArray[ mainREAD_ONLY_ARRAY_SIZE ] mainALIGN_TO( mainREAD_ONLY_ALIGN_SIZE ); -#define mainPRIVILEGED_ONLY_ACCESS_ARRAY_SIZE 130 -#define mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE 128 +#define mainPRIVILEGED_ONLY_ACCESS_ARRAY_SIZE 130 +#define mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE 128 char cPrivilegedOnlyAccessArray[ mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ] mainALIGN_TO( mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ); /* The following two variables are used to communicate the status of the second -two register check tasks (tasks 3 and 4) to the check task. If the variables -keep incrementing, then the register check tasks have not discovered any errors. -If a variable stops incrementing, then an error has been found. The variables -overlay the array that the check task has access to so they can be read by the -check task without causing a memory fault. The check task has the highest -priority so will have finished with the array before the register test tasks -start to access it. */ -volatile uint32_t *pulRegTest3LoopCounter = ( uint32_t * ) &( cReadWriteArray[ 0 ] ), *pulRegTest4LoopCounter = ( uint32_t * ) &( cReadWriteArray[ 4 ] ); + * two register check tasks (tasks 3 and 4) to the check task. If the variables + * keep incrementing, then the register check tasks have not discovered any errors. + * If a variable stops incrementing, then an error has been found. The variables + * overlay the array that the check task has access to so they can be read by the + * check task without causing a memory fault. The check task has the highest + * priority so will have finished with the array before the register test tasks + * start to access it. */ +volatile uint32_t * pulRegTest3LoopCounter = ( uint32_t * ) &( cReadWriteArray[ 0 ] ), * pulRegTest4LoopCounter = ( uint32_t * ) &( cReadWriteArray[ 4 ] ); /* Fill in a TaskParameters_t structure to define the check task - this is the -structure passed to the xTaskCreateRestricted() function. */ + * structure passed to the xTaskCreateRestricted() function. */ static const TaskParameters_t xCheckTaskParameters = { - prvCheckTask, /* pvTaskCode - the function that implements the task. */ - "Check", /* pcName */ - mainCHECK_TASK_STACK_SIZE_WORDS, /* usStackDepth - defined in words, not bytes. */ - ( void * ) 0x12121212, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */ - ( tskIDLE_PRIORITY + 1 ) | portPRIVILEGE_BIT,/* uxPriority - this is the highest priority task in the system. The task is created in privileged mode to demonstrate accessing the privileged only data. */ - xCheckTaskStack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ - - /* xRegions - In this case the xRegions array is used to create MPU regions - for all three of the arrays declared directly above. Each MPU region is - created with different parameters. Again, THIS IS JUST TO DEMONSTRATE THE - MPU FUNCTIONALITY, the data is not used by the check tasks primary function - of monitoring the reg test tasks and printing out status information.*/ - { - /* Base address Length Parameters */ - { cReadWriteArray, mainREAD_WRITE_ALIGN_SIZE, portMPU_REGION_READ_WRITE }, - { cReadOnlyArray, mainREAD_ONLY_ALIGN_SIZE, portMPU_REGION_READ_ONLY }, - { cPrivilegedOnlyAccessArray, mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE, portMPU_REGION_PRIVILEGED_READ_WRITE } - } + prvCheckTask, /* pvTaskCode - the function that implements the task. */ + "Check", /* pcName */ + mainCHECK_TASK_STACK_SIZE_WORDS, /* usStackDepth - defined in words, not bytes. */ + ( void * ) 0x12121212, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */ + ( tskIDLE_PRIORITY + 1 ) | portPRIVILEGE_BIT, /* uxPriority - this is the highest priority task in the system. The task is created in privileged mode to demonstrate accessing the privileged only data. */ + xCheckTaskStack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ + + /* xRegions - In this case the xRegions array is used to create MPU regions + * for all three of the arrays declared directly above. Each MPU region is + * created with different parameters. Again, THIS IS JUST TO DEMONSTRATE THE + * MPU FUNCTIONALITY, the data is not used by the check tasks primary function + * of monitoring the reg test tasks and printing out status information.*/ + { + /* Base address Length Parameters */ + { cReadWriteArray, mainREAD_WRITE_ALIGN_SIZE, portMPU_REGION_READ_WRITE }, + { cReadOnlyArray, mainREAD_ONLY_ALIGN_SIZE, portMPU_REGION_READ_ONLY }, + { cPrivilegedOnlyAccessArray, mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE, portMPU_REGION_PRIVILEGED_READ_WRITE } + } }; @@ -321,49 +322,49 @@ static const TaskParameters_t xCheckTaskParameters = /*-----------------------------------------------------------*/ /* Define the constants used to allocate the reg test task stacks. Note that -that stack size is defined in words, not bytes. */ -#define mainREG_TEST_STACK_SIZE_WORDS 128 -#define mainREG_TEST_STACK_ALIGNMENT ( mainREG_TEST_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) + * that stack size is defined in words, not bytes. */ +#define mainREG_TEST_STACK_SIZE_WORDS 128 +#define mainREG_TEST_STACK_ALIGNMENT ( mainREG_TEST_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) /* Declare the stacks that will be used by the reg test tasks. The kernel will -automatically create an MPU region for the stack. The stack alignment must -match its size, so if 128 words are reserved for the stack then it must be -aligned to ( 128 * 4 ) bytes. */ + * automatically create an MPU region for the stack. The stack alignment must + * match its size, so if 128 words are reserved for the stack then it must be + * aligned to ( 128 * 4 ) bytes. */ static portSTACK_TYPE xRegTest1Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_TO( mainREG_TEST_STACK_ALIGNMENT ); static portSTACK_TYPE xRegTest2Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_TO( mainREG_TEST_STACK_ALIGNMENT ); /* Fill in a TaskParameters_t structure per reg test task to define the tasks. */ static const TaskParameters_t xRegTest1Parameters = { - vRegTest1Implementation, /* pvTaskCode - the function that implements the task. */ - "RegTest1", /* pcName */ - mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */ - ( void * ) configREG_TEST_TASK_1_PARAMETER, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */ - tskIDLE_PRIORITY | portPRIVILEGE_BIT, /* uxPriority - note that this task is created with privileges to demonstrate one method of passing a queue handle into the task. */ - xRegTest1Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ - { /* xRegions - this task does not use any non-stack data hence all members are zero. */ - /* Base address Length Parameters */ - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 } - } + vRegTest1Implementation, /* pvTaskCode - the function that implements the task. */ + "RegTest1", /* pcName */ + mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */ + ( void * ) configREG_TEST_TASK_1_PARAMETER, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */ + tskIDLE_PRIORITY | portPRIVILEGE_BIT, /* uxPriority - note that this task is created with privileges to demonstrate one method of passing a queue handle into the task. */ + xRegTest1Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ + { /* xRegions - this task does not use any non-stack data hence all members are zero. */ + /* Base address Length Parameters */ + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 } + } }; /*-----------------------------------------------------------*/ static TaskParameters_t xRegTest2Parameters = { - vRegTest2Implementation, /* pvTaskCode - the function that implements the task. */ - "RegTest2", /* pcName */ - mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */ - ( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */ - tskIDLE_PRIORITY, /* uxPriority */ - xRegTest2Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ - { /* xRegions - this task does not use any non-stack data hence all members are zero. */ - /* Base address Length Parameters */ - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 } - } + vRegTest2Implementation, /* pvTaskCode - the function that implements the task. */ + "RegTest2", /* pcName */ + mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */ + ( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */ + tskIDLE_PRIORITY, /* uxPriority */ + xRegTest2Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ + { /* xRegions - this task does not use any non-stack data hence all members are zero. */ + /* Base address Length Parameters */ + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 } + } }; /*-----------------------------------------------------------*/ @@ -373,768 +374,789 @@ static TaskParameters_t xRegTest2Parameters = /*-----------------------------------------------------------*/ /* Define the constants used to allocate the stack of the task that is -deleted. Note that that stack size is defined in words, not bytes. */ -#define mainDELETE_TASK_STACK_SIZE_WORDS 128 -#define mainTASK_TO_DELETE_STACK_ALIGNMENT ( mainDELETE_TASK_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) + * deleted. Note that that stack size is defined in words, not bytes. */ +#define mainDELETE_TASK_STACK_SIZE_WORDS 128 +#define mainTASK_TO_DELETE_STACK_ALIGNMENT ( mainDELETE_TASK_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) /* Declare the stack that will be used by the task that gets deleted. The -kernel will automatically create an MPU region for the stack. The stack -alignment must match its size, so if 128 words are reserved for the stack -then it must be aligned to ( 128 * 4 ) bytes. */ + * kernel will automatically create an MPU region for the stack. The stack + * alignment must match its size, so if 128 words are reserved for the stack + * then it must be aligned to ( 128 * 4 ) bytes. */ static portSTACK_TYPE xDeleteTaskStack[ mainDELETE_TASK_STACK_SIZE_WORDS ] mainALIGN_TO( mainTASK_TO_DELETE_STACK_ALIGNMENT ); static TaskParameters_t xTaskToDeleteParameters = { - prvTaskToDelete, /* pvTaskCode - the function that implements the task. */ - mainTASK_TO_DELETE_NAME, /* pcName */ - mainDELETE_TASK_STACK_SIZE_WORDS, /* usStackDepth */ - ( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */ - tskIDLE_PRIORITY + 1, /* uxPriority */ - xDeleteTaskStack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ - { /* xRegions - this task does not use any non-stack data hence all members are zero. */ - /* Base address Length Parameters */ - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 } - } + prvTaskToDelete, /* pvTaskCode - the function that implements the task. */ + mainTASK_TO_DELETE_NAME, /* pcName */ + mainDELETE_TASK_STACK_SIZE_WORDS, /* usStackDepth */ + ( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */ + tskIDLE_PRIORITY + 1, /* uxPriority */ + xDeleteTaskStack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ + { /* xRegions - this task does not use any non-stack data hence all members are zero. */ + /* Base address Length Parameters */ + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 } + } }; /*-----------------------------------------------------------*/ int main( void ) { - prvSetupHardware(); + prvSetupHardware(); - prvITMPrintString( "Starting\r\n" ); + prvITMPrintString( "Starting\r\n" ); - /* Create the queue used to pass "I'm alive" messages to the check task. */ - xGlobalScopeCheckQueue = xQueueCreate( 1, sizeof( uint32_t ) ); + /* Create the queue used to pass "I'm alive" messages to the check task. */ + xGlobalScopeCheckQueue = xQueueCreate( 1, sizeof( uint32_t ) ); - /* One check task uses the task parameter to receive the queue handle. - This allows the file scope variable to be accessed from within the task. - The pvParameters member of xRegTest2Parameters can only be set after the - queue has been created so is set here. */ - xRegTest2Parameters.pvParameters = xGlobalScopeCheckQueue; + /* One check task uses the task parameter to receive the queue handle. + * This allows the file scope variable to be accessed from within the task. + * The pvParameters member of xRegTest2Parameters can only be set after the + * queue has been created so is set here. */ + xRegTest2Parameters.pvParameters = xGlobalScopeCheckQueue; - /* Create three test tasks. Handles to the created tasks are not required, - hence the second parameter is NULL. */ - xTaskCreateRestricted( &xRegTest1Parameters, NULL ); + /* Create three test tasks. Handles to the created tasks are not required, + * hence the second parameter is NULL. */ + xTaskCreateRestricted( &xRegTest1Parameters, NULL ); xTaskCreateRestricted( &xRegTest2Parameters, NULL ); - xTaskCreateRestricted( &xCheckTaskParameters, NULL ); - - /* Create a task that does nothing but ensure some of the MPU API functions - can be called correctly, then get deleted. This is done for code coverage - test purposes only. The task's handle is saved in xTaskToDelete so it can - get deleted in the idle task hook. */ - xTaskCreateRestricted( &xTaskToDeleteParameters, &xTaskToDelete ); - - /* Create the tasks that are created using the original xTaskCreate() API - function. */ - xTaskCreate( prvOldStyleUserModeTask, /* The function that implements the task. */ - "Task1", /* Text name for the task. */ - 100, /* Stack depth in words. */ - NULL, /* Task parameters. */ - 3, /* Priority and mode (user in this case). */ - NULL /* Handle. */ - ); - - xTaskCreate( prvOldStylePrivilegedModeTask, /* The function that implements the task. */ - "Task2", /* Text name for the task. */ - 100, /* Stack depth in words. */ - NULL, /* Task parameters. */ - ( 3 | portPRIVILEGE_BIT ), /* Priority and mode. */ - NULL /* Handle. */ - ); - - /* Create the third and fourth register check tasks, as described at the top - of this file. */ - xTaskCreate( prvRegTest3Task, "Reg3", configMINIMAL_STACK_SIZE, configREG_TEST_TASK_3_PARAMETER, tskIDLE_PRIORITY, NULL ); - xTaskCreate( prvRegTest4Task, "Reg4", configMINIMAL_STACK_SIZE, configREG_TEST_TASK_4_PARAMETER, tskIDLE_PRIORITY, NULL ); - - /* Create and start the software timer. */ - xTimer = xTimerCreate( "Timer", /* Test name for the timer. */ - mainTIMER_PERIOD, /* Period of the timer. */ - pdTRUE, /* The timer will auto-reload itself. */ - ( void * ) 0, /* The timer's ID is used to count the number of times it expires - initialise this to 0. */ - prvTimerCallback ); /* The function called when the timer expires. */ - configASSERT( xTimer ); - xTimerStart( xTimer, mainDONT_BLOCK ); - - /* Start the scheduler. */ - vTaskStartScheduler(); - - /* Will only get here if there was insufficient memory to create the idle - task. */ - for( ;; ); + xTaskCreateRestricted( &xCheckTaskParameters, NULL ); + + /* Create a task that does nothing but ensure some of the MPU API functions + * can be called correctly, then get deleted. This is done for code coverage + * test purposes only. The task's handle is saved in xTaskToDelete so it can + * get deleted in the idle task hook. */ + xTaskCreateRestricted( &xTaskToDeleteParameters, &xTaskToDelete ); + + /* Create the tasks that are created using the original xTaskCreate() API + * function. */ + xTaskCreate( prvOldStyleUserModeTask, /* The function that implements the task. */ + "Task1", /* Text name for the task. */ + 100, /* Stack depth in words. */ + NULL, /* Task parameters. */ + 3, /* Priority and mode (user in this case). */ + NULL /* Handle. */ + ); + + xTaskCreate( prvOldStylePrivilegedModeTask, /* The function that implements the task. */ + "Task2", /* Text name for the task. */ + 100, /* Stack depth in words. */ + NULL, /* Task parameters. */ + ( 3 | portPRIVILEGE_BIT ), /* Priority and mode. */ + NULL /* Handle. */ + ); + + /* Create the third and fourth register check tasks, as described at the top + * of this file. */ + xTaskCreate( prvRegTest3Task, "Reg3", configMINIMAL_STACK_SIZE, configREG_TEST_TASK_3_PARAMETER, tskIDLE_PRIORITY, NULL ); + xTaskCreate( prvRegTest4Task, "Reg4", configMINIMAL_STACK_SIZE, configREG_TEST_TASK_4_PARAMETER, tskIDLE_PRIORITY, NULL ); + + /* Create and start the software timer. */ + xTimer = xTimerCreate( "Timer", /* Test name for the timer. */ + mainTIMER_PERIOD, /* Period of the timer. */ + pdTRUE, /* The timer will auto-reload itself. */ + ( void * ) 0, /* The timer's ID is used to count the number of times it expires - initialise this to 0. */ + prvTimerCallback ); /* The function called when the timer expires. */ + configASSERT( xTimer ); + xTimerStart( xTimer, mainDONT_BLOCK ); + + /* Start the scheduler. */ + vTaskStartScheduler(); + + /* Will only get here if there was insufficient memory to create the idle + * task. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvCheckTask( void *pvParameters ) +static void prvCheckTask( void * pvParameters ) { /* This task is created in privileged mode so can access the file scope -queue variable. Take a stack copy of this before the task is set into user -mode. Once that task is in user mode the file scope queue variable will no -longer be accessible but the stack copy will. */ -QueueHandle_t xQueue = xGlobalScopeCheckQueue; -int32_t lMessage; -uint32_t ulStillAliveCounts[ 3 ] = { 0 }; -const char *pcStatusMessage = "PASS\r\n"; -uint32_t ulLastRegTest3CountValue = 0, ulLastRegTest4Value = 0; + * queue variable. Take a stack copy of this before the task is set into user + * mode. Once that task is in user mode the file scope queue variable will no + * longer be accessible but the stack copy will. */ + QueueHandle_t xQueue = xGlobalScopeCheckQueue; + int32_t lMessage; + uint32_t ulStillAliveCounts[ 3 ] = { 0 }; + const char * pcStatusMessage = "PASS\r\n"; + uint32_t ulLastRegTest3CountValue = 0, ulLastRegTest4Value = 0; /* The register test tasks that also test the floating point registers increment -a counter on each iteration of their loop. The counters are inside the array -that this task has access to. */ -volatile uint32_t *pulOverlaidCounter3 = ( uint32_t * ) &( cReadWriteArray[ 0 ] ), *pulOverlaidCounter4 = ( uint32_t * ) &( cReadWriteArray[ 4 ] ); - - /* Just to remove compiler warning. */ - ( void ) pvParameters; - - /* Demonstrate how the various memory regions can and can't be accessed. - The task privilege level is set down to user mode within this function. */ - prvTestMemoryRegions(); - - /* Clear overlaid reg test counters before entering the loop below. */ - *pulOverlaidCounter3 = 0UL; - *pulOverlaidCounter4 = 0UL; - - /* This loop performs the main function of the task, which is blocking - on a message queue then processing each message as it arrives. */ - for( ;; ) - { - /* Wait for the next message to arrive. */ - xQueueReceive( xQueue, &lMessage, portMAX_DELAY ); - - switch( lMessage ) - { - case configREG_TEST_1_STILL_EXECUTING : - case configREG_TEST_2_STILL_EXECUTING : - case configTIMER_STILL_EXECUTING : - /* Message from the first or second register check task, or - the timer callback function. Increment the count of the - number of times the message source has sent the message as - the message source must still be executed. */ - ( ulStillAliveCounts[ lMessage ] )++; - break; - - case configPRINT_SYSTEM_STATUS : - /* Message from tick hook, time to print out the system - status. If messages have stopped arriving from either of - the first two reg test task or the timer callback then the - status must be set to fail. */ - if( ( ulStillAliveCounts[ 0 ] == 0 ) || ( ulStillAliveCounts[ 1 ] == 0 ) || ( ulStillAliveCounts[ 2 ] == 0 ) ) - { - /* One or both of the test tasks are no longer sending - 'still alive' messages. */ - pcStatusMessage = "FAIL\r\n"; - } - else - { - /* Reset the count of 'still alive' messages. */ - memset( ( void * ) ulStillAliveCounts, 0x00, sizeof( ulStillAliveCounts ) ); - } - - /* Check that the register test 3 task is still incrementing - its counter, and therefore still running. */ - if( ulLastRegTest3CountValue == *pulOverlaidCounter3 ) - { - pcStatusMessage = "FAIL\r\n"; - } - ulLastRegTest3CountValue = *pulOverlaidCounter3; - - /* Check that the register test 4 task is still incrementing - its counter, and therefore still running. */ - if( ulLastRegTest4Value == *pulOverlaidCounter4 ) - { - pcStatusMessage = "FAIL\r\n"; - } - ulLastRegTest4Value = *pulOverlaidCounter4; - - /**** print pcStatusMessage here. ****/ - prvITMPrintString( pcStatusMessage ); - break; - - default : - /* Something unexpected happened. Delete this task so the - error is apparent (no output will be displayed). */ - vMainDeleteMe(); - break; - } - } + * a counter on each iteration of their loop. The counters are inside the array + * that this task has access to. */ + volatile uint32_t * pulOverlaidCounter3 = ( uint32_t * ) &( cReadWriteArray[ 0 ] ), * pulOverlaidCounter4 = ( uint32_t * ) &( cReadWriteArray[ 4 ] ); + + /* Just to remove compiler warning. */ + ( void ) pvParameters; + + /* Demonstrate how the various memory regions can and can't be accessed. + * The task privilege level is set down to user mode within this function. */ + prvTestMemoryRegions(); + + /* Clear overlaid reg test counters before entering the loop below. */ + *pulOverlaidCounter3 = 0UL; + *pulOverlaidCounter4 = 0UL; + + /* This loop performs the main function of the task, which is blocking + * on a message queue then processing each message as it arrives. */ + for( ; ; ) + { + /* Wait for the next message to arrive. */ + xQueueReceive( xQueue, &lMessage, portMAX_DELAY ); + + switch( lMessage ) + { + case configREG_TEST_1_STILL_EXECUTING: + case configREG_TEST_2_STILL_EXECUTING: + case configTIMER_STILL_EXECUTING: + + /* Message from the first or second register check task, or + * the timer callback function. Increment the count of the + * number of times the message source has sent the message as + * the message source must still be executed. */ + ( ulStillAliveCounts[ lMessage ] )++; + break; + + case configPRINT_SYSTEM_STATUS: + + /* Message from tick hook, time to print out the system + * status. If messages have stopped arriving from either of + * the first two reg test task or the timer callback then the + * status must be set to fail. */ + if( ( ulStillAliveCounts[ 0 ] == 0 ) || ( ulStillAliveCounts[ 1 ] == 0 ) || ( ulStillAliveCounts[ 2 ] == 0 ) ) + { + /* One or both of the test tasks are no longer sending + * 'still alive' messages. */ + pcStatusMessage = "FAIL\r\n"; + } + else + { + /* Reset the count of 'still alive' messages. */ + memset( ( void * ) ulStillAliveCounts, 0x00, sizeof( ulStillAliveCounts ) ); + } + + /* Check that the register test 3 task is still incrementing + * its counter, and therefore still running. */ + if( ulLastRegTest3CountValue == *pulOverlaidCounter3 ) + { + pcStatusMessage = "FAIL\r\n"; + } + + ulLastRegTest3CountValue = *pulOverlaidCounter3; + + /* Check that the register test 4 task is still incrementing + * its counter, and therefore still running. */ + if( ulLastRegTest4Value == *pulOverlaidCounter4 ) + { + pcStatusMessage = "FAIL\r\n"; + } + + ulLastRegTest4Value = *pulOverlaidCounter4; + + /**** print pcStatusMessage here. ****/ + prvITMPrintString( pcStatusMessage ); + break; + + default: + + /* Something unexpected happened. Delete this task so the + * error is apparent (no output will be displayed). */ + vMainDeleteMe(); + break; + } + } } /*-----------------------------------------------------------*/ static void prvTestMemoryRegions( void ) { -int32_t x; -char cTemp; - - /* The check task (from which this function is called) is created in the - Privileged mode. The privileged array can be both read from and written - to while this task is privileged. */ - cPrivilegedOnlyAccessArray[ 0 ] = 'a'; - if( cPrivilegedOnlyAccessArray[ 0 ] != 'a' ) - { - /* Something unexpected happened. Delete this task so the error is - apparent (no output will be displayed). */ - vMainDeleteMe(); - } - - /* Writing off the end of the RAM allocated to this task will *NOT* cause a - protection fault because the task is still executing in a privileged mode. - Uncomment the following to test. */ - /*cPrivilegedOnlyAccessArray[ mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ] = 'a';*/ - - /* Now set the task into user mode. */ - portSWITCH_TO_USER_MODE(); - - /* Accessing the privileged only array will now cause a fault. Uncomment - the following line to test. */ - /*cPrivilegedOnlyAccessArray[ 0 ] = 'a';*/ - - /* The read/write array can still be successfully read and written. */ - for( x = 0; x < mainREAD_WRITE_ALIGN_SIZE; x++ ) - { - cReadWriteArray[ x ] = 'a'; - if( cReadWriteArray[ x ] != 'a' ) - { - /* Something unexpected happened. Delete this task so the error is - apparent (no output will be displayed). */ - vMainDeleteMe(); - } - } - - /* But attempting to read or write off the end of the RAM allocated to this - task will cause a fault. Uncomment either of the following two lines to - test. */ - /* cReadWriteArray[ 0 ] = cReadWriteArray[ -1 ]; */ - /* cReadWriteArray[ mainREAD_WRITE_ALIGN_SIZE ] = 0x00; */ - - /* The read only array can be successfully read... */ - for( x = 0; x < mainREAD_ONLY_ALIGN_SIZE; x++ ) - { - cTemp = cReadOnlyArray[ x ]; - } - - /* ...but cannot be written. Uncomment the following line to test. */ - /* cReadOnlyArray[ 0 ] = 'a'; */ - - /* Writing to the first and last locations in the stack array should not - cause a protection fault. Note that doing this will cause the kernel to - detect a stack overflow if configCHECK_FOR_STACK_OVERFLOW is greater than - 1, hence the test is commented out by default. */ - /* xCheckTaskStack[ 0 ] = 0; - xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS - 1 ] = 0; */ - - /* Writing off either end of the stack array should cause a protection - fault, uncomment either of the following two lines to test. */ - /* xCheckTaskStack[ -1 ] = 0; */ - /* xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS ] = 0; */ - - ( void ) cTemp; + int32_t x; + char cTemp; + + /* The check task (from which this function is called) is created in the + * Privileged mode. The privileged array can be both read from and written + * to while this task is privileged. */ + cPrivilegedOnlyAccessArray[ 0 ] = 'a'; + + if( cPrivilegedOnlyAccessArray[ 0 ] != 'a' ) + { + /* Something unexpected happened. Delete this task so the error is + * apparent (no output will be displayed). */ + vMainDeleteMe(); + } + + /* Writing off the end of the RAM allocated to this task will *NOT* cause a + * protection fault because the task is still executing in a privileged mode. + * Uncomment the following to test. */ + /*cPrivilegedOnlyAccessArray[ mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ] = 'a';*/ + + /* Now set the task into user mode. */ + portSWITCH_TO_USER_MODE(); + + /* Accessing the privileged only array will now cause a fault. Uncomment + * the following line to test. */ + /*cPrivilegedOnlyAccessArray[ 0 ] = 'a';*/ + + /* The read/write array can still be successfully read and written. */ + for( x = 0; x < mainREAD_WRITE_ALIGN_SIZE; x++ ) + { + cReadWriteArray[ x ] = 'a'; + + if( cReadWriteArray[ x ] != 'a' ) + { + /* Something unexpected happened. Delete this task so the error is + * apparent (no output will be displayed). */ + vMainDeleteMe(); + } + } + + /* But attempting to read or write off the end of the RAM allocated to this + * task will cause a fault. Uncomment either of the following two lines to + * test. */ + /* cReadWriteArray[ 0 ] = cReadWriteArray[ -1 ]; */ + /* cReadWriteArray[ mainREAD_WRITE_ALIGN_SIZE ] = 0x00; */ + + /* The read only array can be successfully read... */ + for( x = 0; x < mainREAD_ONLY_ALIGN_SIZE; x++ ) + { + cTemp = cReadOnlyArray[ x ]; + } + + /* ...but cannot be written. Uncomment the following line to test. */ + /* cReadOnlyArray[ 0 ] = 'a'; */ + + /* Writing to the first and last locations in the stack array should not + * cause a protection fault. Note that doing this will cause the kernel to + * detect a stack overflow if configCHECK_FOR_STACK_OVERFLOW is greater than + * 1, hence the test is commented out by default. */ + + /* xCheckTaskStack[ 0 ] = 0; + * xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS - 1 ] = 0; */ + + /* Writing off either end of the stack array should cause a protection + * fault, uncomment either of the following two lines to test. */ + /* xCheckTaskStack[ -1 ] = 0; */ + /* xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS ] = 0; */ + + ( void ) cTemp; } /*-----------------------------------------------------------*/ static void prvExerciseEventGroupAPI( void ) { -EventGroupHandle_t xEventGroup; -EventBits_t xBits; -const EventBits_t xBitsToWaitFor = ( EventBits_t ) 0xff, xBitToClear = ( EventBits_t ) 0x01; - - /* Exercise some event group functions. */ - xEventGroup = xEventGroupCreate(); - configASSERT( xEventGroup ); - - /* No bits should be set. */ - xBits = xEventGroupWaitBits( xEventGroup, xBitsToWaitFor, pdTRUE, pdFALSE, mainDONT_BLOCK ); - configASSERT( xBits == ( EventBits_t ) 0 ); - - /* Set bits and read back to ensure the bits were set. */ - xEventGroupSetBits( xEventGroup, xBitsToWaitFor ); - xBits = xEventGroupGetBits( xEventGroup ); - configASSERT( xBits == xBitsToWaitFor ); - - /* Clear a bit and read back again using a different API function. */ - xEventGroupClearBits( xEventGroup, xBitToClear ); - xBits = xEventGroupSync( xEventGroup, 0x00, xBitsToWaitFor, mainDONT_BLOCK ); - configASSERT( xBits == ( xBitsToWaitFor & ~xBitToClear ) ); - - /* Finished with the event group. */ - vEventGroupDelete( xEventGroup ); + EventGroupHandle_t xEventGroup; + EventBits_t xBits; + const EventBits_t xBitsToWaitFor = ( EventBits_t ) 0xff, xBitToClear = ( EventBits_t ) 0x01; + + /* Exercise some event group functions. */ + xEventGroup = xEventGroupCreate(); + configASSERT( xEventGroup ); + + /* No bits should be set. */ + xBits = xEventGroupWaitBits( xEventGroup, xBitsToWaitFor, pdTRUE, pdFALSE, mainDONT_BLOCK ); + configASSERT( xBits == ( EventBits_t ) 0 ); + + /* Set bits and read back to ensure the bits were set. */ + xEventGroupSetBits( xEventGroup, xBitsToWaitFor ); + xBits = xEventGroupGetBits( xEventGroup ); + configASSERT( xBits == xBitsToWaitFor ); + + /* Clear a bit and read back again using a different API function. */ + xEventGroupClearBits( xEventGroup, xBitToClear ); + xBits = xEventGroupSync( xEventGroup, 0x00, xBitsToWaitFor, mainDONT_BLOCK ); + configASSERT( xBits == ( xBitsToWaitFor & ~xBitToClear ) ); + + /* Finished with the event group. */ + vEventGroupDelete( xEventGroup ); } /*-----------------------------------------------------------*/ static void prvExerciseSemaphoreAPI( void ) { -SemaphoreHandle_t xSemaphore; -const UBaseType_t uxMaxCount = 5, uxInitialCount = 0; - - /* Most of the semaphore API is common to the queue API and is already being - used. This function uses a few semaphore functions that are unique to the - RTOS objects, rather than generic and used by queues also. - - First create and use a counting semaphore. */ - xSemaphore = xSemaphoreCreateCounting( uxMaxCount, uxInitialCount ); - configASSERT( xSemaphore ); - - /* Give the semaphore a couple of times and ensure the count is returned - correctly. */ - xSemaphoreGive( xSemaphore ); - xSemaphoreGive( xSemaphore ); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 2 ); - vSemaphoreDelete( xSemaphore ); - - /* Create a recursive mutex, and ensure the mutex holder and count are - returned returned correctly. */ - xSemaphore = xSemaphoreCreateRecursiveMutex(); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); - configASSERT( xSemaphore ); - xSemaphoreTakeRecursive( xSemaphore, mainDONT_BLOCK ); - xSemaphoreTakeRecursive( xSemaphore, mainDONT_BLOCK ); - configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetCurrentTaskHandle() ); - configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetHandle( mainTASK_TO_DELETE_NAME ) ); - xSemaphoreGiveRecursive( xSemaphore ); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 0 ); - xSemaphoreGiveRecursive( xSemaphore ); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); - configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == NULL ); - vSemaphoreDelete( xSemaphore ); - - /* Create a normal mutex, and sure the mutex holder and count are returned - returned correctly. */ - xSemaphore = xSemaphoreCreateMutex(); - configASSERT( xSemaphore ); - xSemaphoreTake( xSemaphore, mainDONT_BLOCK ); - xSemaphoreTake( xSemaphore, mainDONT_BLOCK ); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 0 ); /* Not recursive so can only be 1. */ - configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetCurrentTaskHandle() ); - xSemaphoreGive( xSemaphore ); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); - configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == NULL ); - vSemaphoreDelete( xSemaphore ); + SemaphoreHandle_t xSemaphore; + const UBaseType_t uxMaxCount = 5, uxInitialCount = 0; + + /* Most of the semaphore API is common to the queue API and is already being + * used. This function uses a few semaphore functions that are unique to the + * RTOS objects, rather than generic and used by queues also. + * + * First create and use a counting semaphore. */ + xSemaphore = xSemaphoreCreateCounting( uxMaxCount, uxInitialCount ); + configASSERT( xSemaphore ); + + /* Give the semaphore a couple of times and ensure the count is returned + * correctly. */ + xSemaphoreGive( xSemaphore ); + xSemaphoreGive( xSemaphore ); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 2 ); + vSemaphoreDelete( xSemaphore ); + + /* Create a recursive mutex, and ensure the mutex holder and count are + * returned returned correctly. */ + xSemaphore = xSemaphoreCreateRecursiveMutex(); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); + configASSERT( xSemaphore ); + xSemaphoreTakeRecursive( xSemaphore, mainDONT_BLOCK ); + xSemaphoreTakeRecursive( xSemaphore, mainDONT_BLOCK ); + configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetCurrentTaskHandle() ); + configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetHandle( mainTASK_TO_DELETE_NAME ) ); + xSemaphoreGiveRecursive( xSemaphore ); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 0 ); + xSemaphoreGiveRecursive( xSemaphore ); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); + configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == NULL ); + vSemaphoreDelete( xSemaphore ); + + /* Create a normal mutex, and sure the mutex holder and count are returned + * returned correctly. */ + xSemaphore = xSemaphoreCreateMutex(); + configASSERT( xSemaphore ); + xSemaphoreTake( xSemaphore, mainDONT_BLOCK ); + xSemaphoreTake( xSemaphore, mainDONT_BLOCK ); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 0 ); /* Not recursive so can only be 1. */ + configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetCurrentTaskHandle() ); + xSemaphoreGive( xSemaphore ); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); + configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == NULL ); + vSemaphoreDelete( xSemaphore ); } /*-----------------------------------------------------------*/ static void prvExerciseTaskNotificationAPI( void ) { -uint32_t ulNotificationValue; -BaseType_t xReturned; - - /* The task should not yet have a notification pending. */ - xReturned = xTaskNotifyWait( 0, 0, &ulNotificationValue, mainDONT_BLOCK ); - configASSERT( xReturned == pdFAIL ); - configASSERT( ulNotificationValue == 0UL ); - - /* Exercise the 'give' and 'take' versions of the notification API. */ - xTaskNotifyGive( xTaskGetCurrentTaskHandle() ); - xTaskNotifyGive( xTaskGetCurrentTaskHandle() ); - ulNotificationValue = ulTaskNotifyTake( pdTRUE, mainDONT_BLOCK ); - configASSERT( ulNotificationValue == 2 ); - - /* Exercise the 'notify' and 'clear' API. */ - ulNotificationValue = 20; - xTaskNotify( xTaskGetCurrentTaskHandle(), ulNotificationValue, eSetValueWithOverwrite ); - ulNotificationValue = 0; - xReturned = xTaskNotifyWait( 0, 0, &ulNotificationValue, mainDONT_BLOCK ); - configASSERT( xReturned == pdPASS ); - configASSERT( ulNotificationValue == 20 ); - xTaskNotify( xTaskGetCurrentTaskHandle(), ulNotificationValue, eSetValueWithOverwrite ); - xReturned = xTaskNotifyStateClear( NULL ); - configASSERT( xReturned == pdTRUE ); /* First time a notification was pending. */ - xReturned = xTaskNotifyStateClear( NULL ); - configASSERT( xReturned == pdFALSE ); /* Second time the notification was already clear. */ + uint32_t ulNotificationValue; + BaseType_t xReturned; + + /* The task should not yet have a notification pending. */ + xReturned = xTaskNotifyWait( 0, 0, &ulNotificationValue, mainDONT_BLOCK ); + configASSERT( xReturned == pdFAIL ); + configASSERT( ulNotificationValue == 0UL ); + + /* Exercise the 'give' and 'take' versions of the notification API. */ + xTaskNotifyGive( xTaskGetCurrentTaskHandle() ); + xTaskNotifyGive( xTaskGetCurrentTaskHandle() ); + ulNotificationValue = ulTaskNotifyTake( pdTRUE, mainDONT_BLOCK ); + configASSERT( ulNotificationValue == 2 ); + + /* Exercise the 'notify' and 'clear' API. */ + ulNotificationValue = 20; + xTaskNotify( xTaskGetCurrentTaskHandle(), ulNotificationValue, eSetValueWithOverwrite ); + ulNotificationValue = 0; + xReturned = xTaskNotifyWait( 0, 0, &ulNotificationValue, mainDONT_BLOCK ); + configASSERT( xReturned == pdPASS ); + configASSERT( ulNotificationValue == 20 ); + xTaskNotify( xTaskGetCurrentTaskHandle(), ulNotificationValue, eSetValueWithOverwrite ); + xReturned = xTaskNotifyStateClear( NULL ); + configASSERT( xReturned == pdTRUE ); /* First time a notification was pending. */ + xReturned = xTaskNotifyStateClear( NULL ); + configASSERT( xReturned == pdFALSE ); /* Second time the notification was already clear. */ } /*-----------------------------------------------------------*/ -static void prvTaskToDelete( void *pvParameters ) +static void prvTaskToDelete( void * pvParameters ) { - /* Remove compiler warnings about unused parameters. */ - ( void ) pvParameters; - - /* Check the enter and exit critical macros are working correctly. If the - SVC priority is below configMAX_SYSCALL_INTERRUPT_PRIORITY then this will - fault. */ - taskENTER_CRITICAL(); - taskEXIT_CRITICAL(); - - /* Exercise the API of various RTOS objects. */ - prvExerciseEventGroupAPI(); - prvExerciseSemaphoreAPI(); - prvExerciseTaskNotificationAPI(); - - /* For code coverage test purposes it is deleted by the Idle task. */ - configASSERT( uxTaskGetStackHighWaterMark( NULL ) > 0 ); - vTaskSuspend( NULL ); + /* Remove compiler warnings about unused parameters. */ + ( void ) pvParameters; + + /* Check the enter and exit critical macros are working correctly. If the + * SVC priority is below configMAX_SYSCALL_INTERRUPT_PRIORITY then this will + * fault. */ + taskENTER_CRITICAL(); + taskEXIT_CRITICAL(); + + /* Exercise the API of various RTOS objects. */ + prvExerciseEventGroupAPI(); + prvExerciseSemaphoreAPI(); + prvExerciseTaskNotificationAPI(); + + /* For code coverage test purposes it is deleted by the Idle task. */ + configASSERT( uxTaskGetStackHighWaterMark( NULL ) > 0 ); + vTaskSuspend( NULL ); } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile const uint32_t *pul; -volatile uint32_t ulReadData; - - /* The idle task, and therefore this function, run in Supervisor mode and - can therefore access all memory. Try reading from corners of flash and - RAM to ensure a memory fault does not occur. - - Start with the edges of the privileged data area. */ - pul = __privileged_data_start__; - ulReadData = *pul; - pul = __privileged_data_end__ - 1; - ulReadData = *pul; - - /* Next the standard SRAM area. */ - pul = __SRAM_segment_end__ - 1; - ulReadData = *pul; - - /* And the standard Flash area - the start of which is marked for - privileged access only. */ - pul = __FLASH_segment_start__; - ulReadData = *pul; - pul = __FLASH_segment_end__ - 1; - ulReadData = *pul; - - /* Reading off the end of Flash or SRAM space should cause a fault. - Uncomment one of the following two pairs of lines to test. */ - - /* pul = __FLASH_segment_end__ + 4; - ulReadData = *pul; */ - - /* pul = __SRAM_segment_end__ + 1; - ulReadData = *pul; */ - - /* One task is created purely so it can be deleted - done for code coverage - test purposes. */ - if( xTaskToDelete != NULL ) - { - vTaskDelete( xTaskToDelete ); - xTaskToDelete = NULL; - } - - ( void ) ulReadData; + volatile const uint32_t * pul; + volatile uint32_t ulReadData; + + /* The idle task, and therefore this function, run in Supervisor mode and + * can therefore access all memory. Try reading from corners of flash and + * RAM to ensure a memory fault does not occur. + * + * Start with the edges of the privileged data area. */ + pul = __privileged_data_start__; + ulReadData = *pul; + pul = __privileged_data_end__ - 1; + ulReadData = *pul; + + /* Next the standard SRAM area. */ + pul = __SRAM_segment_end__ - 1; + ulReadData = *pul; + + /* And the standard Flash area - the start of which is marked for + * privileged access only. */ + pul = __FLASH_segment_start__; + ulReadData = *pul; + pul = __FLASH_segment_end__ - 1; + ulReadData = *pul; + + /* Reading off the end of Flash or SRAM space should cause a fault. + * Uncomment one of the following two pairs of lines to test. */ + + /* pul = __FLASH_segment_end__ + 4; + * ulReadData = *pul; */ + + /* pul = __SRAM_segment_end__ + 1; + * ulReadData = *pul; */ + + /* One task is created purely so it can be deleted - done for code coverage + * test purposes. */ + if( xTaskToDelete != NULL ) + { + vTaskDelete( xTaskToDelete ); + xTaskToDelete = NULL; + } + + ( void ) ulReadData; } /*-----------------------------------------------------------*/ -static void prvOldStyleUserModeTask( void *pvParameters ) +static void prvOldStyleUserModeTask( void * pvParameters ) { -const volatile uint32_t *pulStandardPeripheralRegister = ( volatile uint32_t * ) 0x40000000; -volatile const uint32_t *pul; -volatile uint32_t ulReadData; + const volatile uint32_t * pulStandardPeripheralRegister = ( volatile uint32_t * ) 0x40000000; + volatile const uint32_t * pul; + volatile uint32_t ulReadData; /* The following lines are commented out to prevent the unused variable -compiler warnings when the tests that use the variable are also commented out. */ + * compiler warnings when the tests that use the variable are also commented out. */ /* extern uint32_t __privileged_functions_start__[]; */ /* const volatile uint32_t *pulSystemPeripheralRegister = ( volatile uint32_t * ) 0xe000e014; */ - ( void ) pvParameters; - - /* This task is created in User mode using the original xTaskCreate() API - function. It should have access to all Flash and RAM except that marked - as Privileged access only. Reading from the start and end of the non- - privileged RAM should not cause a problem (the privileged RAM is the first - block at the bottom of the RAM memory). */ - pul = __privileged_data_end__ + 1; - ulReadData = *pul; - pul = __SRAM_segment_end__ - 1; - ulReadData = *pul; - - /* Likewise reading from the start and end of the non-privileged Flash - should not be a problem (the privileged Flash is the first block at the - bottom of the Flash memory). */ - pul = __privileged_functions_end__ + 1; - ulReadData = *pul; - pul = __FLASH_segment_end__ - 1; - ulReadData = *pul; - - /* Standard peripherals are accessible. */ - ulReadData = *pulStandardPeripheralRegister; - - /* System peripherals are not accessible. Uncomment the following line - to test. Also uncomment the declaration of pulSystemPeripheralRegister - at the top of this function. - ulReadData = *pulSystemPeripheralRegister; */ - - /* Reading from anywhere inside the privileged Flash or RAM should cause a - fault. This can be tested by uncommenting any of the following pairs of - lines. Also uncomment the declaration of __privileged_functions_start__ - at the top of this function. */ - - /* pul = __privileged_functions_start__; - ulReadData = *pul; */ - - /*pul = __privileged_functions_end__ - 1; - ulReadData = *pul;*/ - - /*pul = __privileged_data_start__; - ulReadData = *pul;*/ - - /*pul = __privileged_data_end__ - 1; - ulReadData = *pul;*/ - - /* Must not just run off the end of a task function, so delete this task. - Note that because this task was created using xTaskCreate() the stack was - allocated dynamically and I have not included any code to free it again. */ - vTaskDelete( NULL ); - - ( void ) ulReadData; + ( void ) pvParameters; + + /* This task is created in User mode using the original xTaskCreate() API + * function. It should have access to all Flash and RAM except that marked + * as Privileged access only. Reading from the start and end of the non- + * privileged RAM should not cause a problem (the privileged RAM is the first + * block at the bottom of the RAM memory). */ + pul = __privileged_data_end__ + 1; + ulReadData = *pul; + pul = __SRAM_segment_end__ - 1; + ulReadData = *pul; + + /* Likewise reading from the start and end of the non-privileged Flash + * should not be a problem (the privileged Flash is the first block at the + * bottom of the Flash memory). */ + pul = __privileged_functions_end__ + 1; + ulReadData = *pul; + pul = __FLASH_segment_end__ - 1; + ulReadData = *pul; + + /* Standard peripherals are accessible. */ + ulReadData = *pulStandardPeripheralRegister; + + /* System peripherals are not accessible. Uncomment the following line + * to test. Also uncomment the declaration of pulSystemPeripheralRegister + * at the top of this function. + * ulReadData = *pulSystemPeripheralRegister; */ + + /* Reading from anywhere inside the privileged Flash or RAM should cause a + * fault. This can be tested by uncommenting any of the following pairs of + * lines. Also uncomment the declaration of __privileged_functions_start__ + * at the top of this function. */ + + /* pul = __privileged_functions_start__; + * ulReadData = *pul; */ + + /*pul = __privileged_functions_end__ - 1; + * ulReadData = *pul;*/ + + /*pul = __privileged_data_start__; + * ulReadData = *pul;*/ + + /*pul = __privileged_data_end__ - 1; + * ulReadData = *pul;*/ + + /* Must not just run off the end of a task function, so delete this task. + * Note that because this task was created using xTaskCreate() the stack was + * allocated dynamically and I have not included any code to free it again. */ + vTaskDelete( NULL ); + + ( void ) ulReadData; } /*-----------------------------------------------------------*/ -static void prvOldStylePrivilegedModeTask( void *pvParameters ) +static void prvOldStylePrivilegedModeTask( void * pvParameters ) { -volatile const uint32_t *pul; -volatile uint32_t ulReadData; -const volatile uint32_t *pulSystemPeripheralRegister = ( volatile uint32_t * ) 0xe000e014; /* Systick */ + volatile const uint32_t * pul; + volatile uint32_t ulReadData; + const volatile uint32_t * pulSystemPeripheralRegister = ( volatile uint32_t * ) 0xe000e014; /* Systick */ + /*const volatile uint32_t *pulStandardPeripheralRegister = ( volatile uint32_t * ) 0x40000000;*/ - ( void ) pvParameters; - - /* This task is created in Privileged mode using the original xTaskCreate() - API function. It should have access to all Flash and RAM including that - marked as Privileged access only. So reading from the start and end of the - non-privileged RAM should not cause a problem (the privileged RAM is the - first block at the bottom of the RAM memory). */ - pul = __privileged_data_end__ + 1; - ulReadData = *pul; - pul = __SRAM_segment_end__ - 1; - ulReadData = *pul; - - /* Likewise reading from the start and end of the non-privileged Flash - should not be a problem (the privileged Flash is the first block at the - bottom of the Flash memory). */ - pul = __privileged_functions_end__ + 1; - ulReadData = *pul; - pul = __FLASH_segment_end__ - 1; - ulReadData = *pul; - - /* Reading from anywhere inside the privileged Flash or RAM should also - not be a problem. */ - pul = __privileged_functions_start__; - ulReadData = *pul; - pul = __privileged_functions_end__ - 1; - ulReadData = *pul; - pul = __privileged_data_start__; - ulReadData = *pul; - pul = __privileged_data_end__ - 1; - ulReadData = *pul; - - /* Finally, accessing both System and normal peripherals should both be - possible. */ - ulReadData = *pulSystemPeripheralRegister; - /*ulReadData = *pulStandardPeripheralRegister;*/ - - /* Must not just run off the end of a task function, so delete this task. - Note that because this task was created using xTaskCreate() the stack was - allocated dynamically and I have not included any code to free it again. */ - vTaskDelete( NULL ); - - ( void ) ulReadData; + ( void ) pvParameters; + + /* This task is created in Privileged mode using the original xTaskCreate() + * API function. It should have access to all Flash and RAM including that + * marked as Privileged access only. So reading from the start and end of the + * non-privileged RAM should not cause a problem (the privileged RAM is the + * first block at the bottom of the RAM memory). */ + pul = __privileged_data_end__ + 1; + ulReadData = *pul; + pul = __SRAM_segment_end__ - 1; + ulReadData = *pul; + + /* Likewise reading from the start and end of the non-privileged Flash + * should not be a problem (the privileged Flash is the first block at the + * bottom of the Flash memory). */ + pul = __privileged_functions_end__ + 1; + ulReadData = *pul; + pul = __FLASH_segment_end__ - 1; + ulReadData = *pul; + + /* Reading from anywhere inside the privileged Flash or RAM should also + * not be a problem. */ + pul = __privileged_functions_start__; + ulReadData = *pul; + pul = __privileged_functions_end__ - 1; + ulReadData = *pul; + pul = __privileged_data_start__; + ulReadData = *pul; + pul = __privileged_data_end__ - 1; + ulReadData = *pul; + + /* Finally, accessing both System and normal peripherals should both be + * possible. */ + ulReadData = *pulSystemPeripheralRegister; + /*ulReadData = *pulStandardPeripheralRegister;*/ + + /* Must not just run off the end of a task function, so delete this task. + * Note that because this task was created using xTaskCreate() the stack was + * allocated dynamically and I have not included any code to free it again. */ + vTaskDelete( NULL ); + + ( void ) ulReadData; } /*-----------------------------------------------------------*/ void vMainDeleteMe( void ) { - vTaskDelete( NULL ); + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ -void vMainSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber ) +void vMainSendImAlive( QueueHandle_t xHandle, + uint32_t ulTaskNumber ) { - if( xHandle != NULL ) - { - xQueueSend( xHandle, &ulTaskNumber, mainDONT_BLOCK ); - } + if( xHandle != NULL ) + { + xQueueSend( xHandle, &ulTaskNumber, mainDONT_BLOCK ); + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - extern void SystemInit( void ); - extern uint32_t __Vectors[]; - - /* Assuming downloading code via the debugger - so ensure the hardware - is using the vector table downloaded with the application. */ - mainVTOR = ( uint32_t ) __Vectors; - - #if ( ( configASSERT_DEFINED == 1 ) && ( defined ( __GNUC__ ) ) ) - { - /* Sanity check linker configuration sizes sections adequately. */ - const uint32_t ulPrivilegedFunctionsActualEnd = ( uint32_t ) __privileged_functions_actual_end__; - const uint32_t ulPrivilegedDataActualEnd = ( uint32_t ) __privileged_data_actual_end__; - const uint32_t ulPrivilegedFunctionsEnd = ( uint32_t ) __privileged_functions_end__; - const uint32_t ulPrivilegedDataEnd = ( uint32_t ) __privileged_data_end__; - - configASSERT( ulPrivilegedFunctionsActualEnd < ulPrivilegedFunctionsEnd ); - configASSERT( ulPrivilegedDataActualEnd < ulPrivilegedDataEnd ); - - /* Clear the privileged data to 0 as the C start up code is only set to - clear the non-privileged bss. */ - memset( ( void * ) __privileged_data_start__, 0x00, ( size_t ) __privileged_data_actual_end__ - ( size_t ) __privileged_data_start__ ); - } - #endif - - SystemInit(); - SystemCoreClockUpdate(); + extern void SystemInit( void ); + extern uint32_t __Vectors[]; + + /* Assuming downloading code via the debugger - so ensure the hardware + * is using the vector table downloaded with the application. */ + mainVTOR = ( uint32_t ) __Vectors; + + #if ( ( configASSERT_DEFINED == 1 ) && ( defined( __GNUC__ ) ) ) + { + /* Sanity check linker configuration sizes sections adequately. */ + const uint32_t ulPrivilegedFunctionsActualEnd = ( uint32_t ) __privileged_functions_actual_end__; + const uint32_t ulPrivilegedDataActualEnd = ( uint32_t ) __privileged_data_actual_end__; + const uint32_t ulPrivilegedFunctionsEnd = ( uint32_t ) __privileged_functions_end__; + const uint32_t ulPrivilegedDataEnd = ( uint32_t ) __privileged_data_end__; + + configASSERT( ulPrivilegedFunctionsActualEnd < ulPrivilegedFunctionsEnd ); + configASSERT( ulPrivilegedDataActualEnd < ulPrivilegedDataEnd ); + + /* Clear the privileged data to 0 as the C start up code is only set to + * clear the non-privileged bss. */ + memset( ( void * ) __privileged_data_start__, 0x00, ( size_t ) __privileged_data_actual_end__ - ( size_t ) __privileged_data_start__ ); + } + #endif /* if ( ( configASSERT_DEFINED == 1 ) && ( defined( __GNUC__ ) ) ) */ + + SystemInit(); + SystemCoreClockUpdate(); } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { -static uint32_t ulCallCount = 0; -const uint32_t ulCallsBetweenSends = pdMS_TO_TICKS( 5000 ); -const uint32_t ulMessage = configPRINT_SYSTEM_STATUS; -portBASE_TYPE xDummy; - - /* If configUSE_TICK_HOOK is set to 1 then this function will get called - from each RTOS tick. It is called from the tick interrupt and therefore - will be executing in the privileged state. */ - - ulCallCount++; - - /* Is it time to print out the pass/fail message again? */ - if( ulCallCount >= ulCallsBetweenSends ) - { - ulCallCount = 0; - - /* Send a message to the check task to command it to check that all - the tasks are still running then print out the status. - - This is running in an ISR so has to use the "FromISR" version of - xQueueSend(). Because it is in an ISR it is running with privileges - so can access xGlobalScopeCheckQueue directly. */ - xQueueSendFromISR( xGlobalScopeCheckQueue, &ulMessage, &xDummy ); - } + static uint32_t ulCallCount = 0; + const uint32_t ulCallsBetweenSends = pdMS_TO_TICKS( 5000 ); + const uint32_t ulMessage = configPRINT_SYSTEM_STATUS; + portBASE_TYPE xDummy; + + /* If configUSE_TICK_HOOK is set to 1 then this function will get called + * from each RTOS tick. It is called from the tick interrupt and therefore + * will be executing in the privileged state. */ + + ulCallCount++; + + /* Is it time to print out the pass/fail message again? */ + if( ulCallCount >= ulCallsBetweenSends ) + { + ulCallCount = 0; + + /* Send a message to the check task to command it to check that all + * the tasks are still running then print out the status. + * + * This is running in an ISR so has to use the "FromISR" version of + * xQueueSend(). Because it is in an ISR it is running with privileges + * so can access xGlobalScopeCheckQueue directly. */ + xQueueSendFromISR( xGlobalScopeCheckQueue, &ulMessage, &xDummy ); + } } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - /* If configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2 then this - function will automatically get called if a task overflows its stack. */ - ( void ) pxTask; - ( void ) pcTaskName; - for( ;; ); + /* If configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2 then this + * function will automatically get called if a task overflows its stack. */ + ( void ) pxTask; + ( void ) pcTaskName; + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* If configUSE_MALLOC_FAILED_HOOK is set to 1 then this function will - be called automatically if a call to pvPortMalloc() fails. pvPortMalloc() - is called automatically when a task, queue or semaphore is created. */ - for( ;; ); + /* If configUSE_MALLOC_FAILED_HOOK is set to 1 then this function will + * be called automatically if a call to pvPortMalloc() fails. pvPortMalloc() + * is called automatically when a task, queue or semaphore is created. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ static void prvTimerCallback( TimerHandle_t xExpiredTimer ) { -uint32_t ulCount; + uint32_t ulCount; - /* The count of the number of times this timer has expired is saved in the - timer's ID. Obtain the current count. */ - ulCount = ( uint32_t ) pvTimerGetTimerID( xTimer ); + /* The count of the number of times this timer has expired is saved in the + * timer's ID. Obtain the current count. */ + ulCount = ( uint32_t ) pvTimerGetTimerID( xTimer ); - /* Increment the count, and save it back into the timer's ID. */ - ulCount++; - vTimerSetTimerID( xTimer, ( void * ) ulCount ); + /* Increment the count, and save it back into the timer's ID. */ + ulCount++; + vTimerSetTimerID( xTimer, ( void * ) ulCount ); - /* Let the check task know the timer is still running. */ - vMainSendImAlive( xGlobalScopeCheckQueue, configTIMER_STILL_EXECUTING ); + /* Let the check task know the timer is still running. */ + vMainSendImAlive( xGlobalScopeCheckQueue, configTIMER_STILL_EXECUTING ); } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an -implementation of vApplicationGetIdleTaskMemory() to provide the memory that is -used by the Idle task. */ -void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) + * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is + * used by the Idle task. */ +void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, + StackType_t ** ppxIdleTaskStackBuffer, + uint32_t * pulIdleTaskStackSize ) { /* If the buffers to be provided to the Idle task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xIdleTaskTCB; -static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Idle task's - state will be stored. */ - *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; - - /* Pass out the array that will be used as the Idle task's stack. */ - *ppxIdleTaskStackBuffer = uxIdleTaskStack; - - /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xIdleTaskTCB; + static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Idle task's + * state will be stored. */ + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + + /* Pass out the array that will be used as the Idle task's stack. */ + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + + /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the -application must provide an implementation of vApplicationGetTimerTaskMemory() -to provide the memory that is used by the Timer service task. */ -void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) + * application must provide an implementation of vApplicationGetTimerTaskMemory() + * to provide the memory that is used by the Timer service task. */ +void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, + StackType_t ** ppxTimerTaskStackBuffer, + uint32_t * pulTimerTaskStackSize ) { /* If the buffers to be provided to the Timer task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xTimerTaskTCB; -static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Timer - task's state will be stored. */ - *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; - - /* Pass out the array that will be used as the Timer task's stack. */ - *ppxTimerTaskStackBuffer = uxTimerTaskStack; - - /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xTimerTaskTCB; + static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Timer + * task's state will be stored. */ + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + + /* Pass out the array that will be used as the Timer task's stack. */ + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + + /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } /*-----------------------------------------------------------*/ -static void prvITMPrintString( const char *pcString ) +static void prvITMPrintString( const char * pcString ) { - while( *pcString != 0x00 ) - { - ITM_SendChar( *pcString ); - pcString++; - } + while( *pcString != 0x00 ) + { + ITM_SendChar( *pcString ); + pcString++; + } } /*-----------------------------------------------------------*/ -static void prvRegTest3Task( void *pvParameters ) +static void prvRegTest3Task( 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 == configREG_TEST_TASK_3_PARAMETER ) - { - /* Start the part of the test that is written in assembler. */ - vRegTest3Implementation(); - } - - /* 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 - not being incremented and flag an error. */ - vTaskDelete( NULL ); + /* 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 == configREG_TEST_TASK_3_PARAMETER ) + { + /* Start the part of the test that is written in assembler. */ + vRegTest3Implementation(); + } + + /* 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 + * not being incremented and flag an error. */ + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ -static void prvRegTest4Task( void *pvParameters ) +static void prvRegTest4Task( 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 == configREG_TEST_TASK_4_PARAMETER ) - { - /* Start the part of the test that is written in assembler. */ - vRegTest4Implementation(); - } - - /* 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 - not being incremented and flag an error. */ - vTaskDelete( NULL ); + /* 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 == configREG_TEST_TASK_4_PARAMETER ) + { + /* Start the part of the test that is written in assembler. */ + vRegTest4Implementation(); + } + + /* 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 + * not being incremented and flag an error. */ + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_MPU_LPC54018_MCUXpresso/Demo/main.c b/FreeRTOS/Demo/CORTEX_MPU_LPC54018_MCUXpresso/Demo/main.c index d902d965200..ee8fda1c92b 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_LPC54018_MCUXpresso/Demo/main.c +++ b/FreeRTOS/Demo/CORTEX_MPU_LPC54018_MCUXpresso/Demo/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_LPC54018_MCUXpresso/Demo/mpu_demo.c b/FreeRTOS/Demo/CORTEX_MPU_LPC54018_MCUXpresso/Demo/mpu_demo.c index d348648da27..d7f651f20e1 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_LPC54018_MCUXpresso/Demo/mpu_demo.c +++ b/FreeRTOS/Demo/CORTEX_MPU_LPC54018_MCUXpresso/Demo/mpu_demo.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_LPC54018_MCUXpresso/Demo/mpu_demo.h b/FreeRTOS/Demo/CORTEX_MPU_LPC54018_MCUXpresso/Demo/mpu_demo.h index 753dedbb213..279d995fc41 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_LPC54018_MCUXpresso/Demo/mpu_demo.h +++ b/FreeRTOS/Demo/CORTEX_MPU_LPC54018_MCUXpresso/Demo/mpu_demo.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/CORTEX_MPU_LPC54018_MCUXpresso/Projects/MCUXpresso/Startup/memfault_handler.c b/FreeRTOS/Demo/CORTEX_MPU_LPC54018_MCUXpresso/Projects/MCUXpresso/Startup/memfault_handler.c index 08089fed022..4c5226fa9e7 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_LPC54018_MCUXpresso/Projects/MCUXpresso/Startup/memfault_handler.c +++ b/FreeRTOS/Demo/CORTEX_MPU_LPC54018_MCUXpresso/Projects/MCUXpresso/Startup/memfault_handler.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects/IAR/NonSecure/main_ns.c b/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects/IAR/NonSecure/main_ns.c index 900ed89e6b7..b3847c03998 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects/IAR/NonSecure/main_ns.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects/IAR/NonSecure/main_ns.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects/IAR/Secure/main_s.c b/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects/IAR/Secure/main_s.c index 48653a444c3..915a6a9ea2d 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects/IAR/Secure/main_s.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects/IAR/Secure/main_s.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects/Keil/NonSecure/main_ns.c b/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects/Keil/NonSecure/main_ns.c index c702e95cdd6..d97be0a85aa 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects/Keil/NonSecure/main_ns.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects/Keil/NonSecure/main_ns.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects/Keil/Secure/main_s.c b/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects/Keil/Secure/main_s.c index d247ecc1656..0cc1558b923 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects/Keil/Secure/main_s.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects/Keil/Secure/main_s.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects_NTZ/IAR/main.c b/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects_NTZ/IAR/main.c index 09311b03620..40f222a240c 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects_NTZ/IAR/main.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects_NTZ/IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects_NTZ/Keil/main.c b/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects_NTZ/Keil/main.c index 471ef6c4849..3ac6bc4ee62 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects_NTZ/Keil/main.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/Projects_NTZ/Keil/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/RegTests/reg_tests.c b/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/RegTests/reg_tests.c index 7ae69babd16..0c13f3daf25 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/RegTests/reg_tests.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/RegTests/reg_tests.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/RegTests/reg_tests.h b/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/RegTests/reg_tests.h index 0837aad72d6..544ea775c29 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/RegTests/reg_tests.h +++ b/FreeRTOS/Demo/CORTEX_MPU_M23_Nuvoton_NuMaker_PFM_M2351_IAR_GCC/RegTests/reg_tests.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NTZ_Nordic_NRF9160_SES/Source/main.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_NTZ_Nordic_NRF9160_SES/Source/main.c index 98646f1cf23..6b4da7f1678 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NTZ_Nordic_NRF9160_SES/Source/main.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NTZ_Nordic_NRF9160_SES/Source/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NTZ_Nordic_NRF9160_SES/Source/reg_tests.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_NTZ_Nordic_NRF9160_SES/Source/reg_tests.c index be47547c0eb..2358727e051 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NTZ_Nordic_NRF9160_SES/Source/reg_tests.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NTZ_Nordic_NRF9160_SES/Source/reg_tests.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NTZ_Nordic_NRF9160_SES/Source/reg_tests.h b/FreeRTOS/Demo/CORTEX_MPU_M33F_NTZ_Nordic_NRF9160_SES/Source/reg_tests.h index 0837aad72d6..544ea775c29 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NTZ_Nordic_NRF9160_SES/Source/reg_tests.h +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NTZ_Nordic_NRF9160_SES/Source/reg_tests.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NSC_Functions/nsc_printf.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NSC_Functions/nsc_printf.c index d3d04719f6a..8076816f8bd 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NSC_Functions/nsc_printf.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NSC_Functions/nsc_printf.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NSC_Functions/nsc_printf.h b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NSC_Functions/nsc_printf.h index 1362b455699..faf9bfefdba 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NSC_Functions/nsc_printf.h +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/NSC_Functions/nsc_printf.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/fault_handler.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/fault_handler.c index 0a6d1b9abfd..edb03e029b7 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/fault_handler.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects/MCUXpresso/NonSecure/fault_handler.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects_NTZ/MCUXpresso/FaultHandler/fault_handler.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects_NTZ/MCUXpresso/FaultHandler/fault_handler.c index 0a6d1b9abfd..edb03e029b7 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects_NTZ/MCUXpresso/FaultHandler/fault_handler.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/Projects_NTZ/MCUXpresso/FaultHandler/fault_handler.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/RegTests/reg_tests.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/RegTests/reg_tests.c index 1492dfea973..445cf30e065 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/RegTests/reg_tests.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/RegTests/reg_tests.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/RegTests/reg_tests.h b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/RegTests/reg_tests.h index 0837aad72d6..544ea775c29 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/RegTests/reg_tests.h +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/RegTests/reg_tests.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/User/NTZ/main.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/User/NTZ/main.c index 340418c0061..35c07707f11 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/User/NTZ/main.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/User/NTZ/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/User/NonSecure/main_ns.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/User/NonSecure/main_ns.c index 532355c9728..d35a51aee2b 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/User/NonSecure/main_ns.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/User/NonSecure/main_ns.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/User/Secure/main_s.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/User/Secure/main_s.c index 636b5b9f9e1..de77d0b2b92 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/User/Secure/main_s.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_NXP_LPC55S69_MCUXpresso/User/Secure/main_s.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_Nordic_NRF9160_SES/NonSecure/main_ns.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_Nordic_NRF9160_SES/NonSecure/main_ns.c index 3d0ac1c2ec7..d08cc46a12a 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_Nordic_NRF9160_SES/NonSecure/main_ns.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_Nordic_NRF9160_SES/NonSecure/main_ns.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_Nordic_NRF9160_SES/NonSecure/reg_tests.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_Nordic_NRF9160_SES/NonSecure/reg_tests.c index 2c9fc5ca9ef..fd05824d4b7 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_Nordic_NRF9160_SES/NonSecure/reg_tests.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_Nordic_NRF9160_SES/NonSecure/reg_tests.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_Nordic_NRF9160_SES/NonSecure/reg_tests.h b/FreeRTOS/Demo/CORTEX_MPU_M33F_Nordic_NRF9160_SES/NonSecure/reg_tests.h index 0837aad72d6..544ea775c29 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_Nordic_NRF9160_SES/NonSecure/reg_tests.h +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_Nordic_NRF9160_SES/NonSecure/reg_tests.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_Nordic_NRF9160_SES/Secure/main_s.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_Nordic_NRF9160_SES/Secure/main_s.c index bce4d1ca84f..9f54c99a988 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_Nordic_NRF9160_SES/Secure/main_s.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_Nordic_NRF9160_SES/Secure/main_s.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/main_ns.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/main_ns.c index f9fbc3d52db..442720633a6 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/main_ns.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/main_ns.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/reg_tests.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/reg_tests.c index ce607bccdfa..22ebb5cf433 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/reg_tests.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/reg_tests.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/reg_tests.h b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/reg_tests.h index be1426b178b..0a8d7401528 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/reg_tests.h +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/NonSecure/reg_tests.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/main_s.c b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/main_s.c index 0f48bd584d3..badcacacf2e 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/main_s.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M33F_Simulator_Keil_GCC/Secure/main_s.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/app_main.c b/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/app_main.c index c4c2ac9a790..3f4b856a6eb 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/app_main.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/app_main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -70,8 +70,8 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask, void vApplicationMallocFailedHook( void ) { /* If configUSE_MALLOC_FAILED_HOOK is set to 1 then this function will - * be called automatically if a call to pvPortMalloc() fails. pvPortMalloc() - * is called automatically when a task, queue or semaphore is created. */ + * be called automatically if a call to pvPortMalloc() fails. pvPortMalloc() + * is called automatically when a task, queue or semaphore is created. */ printf( "Application Malloc Failed Hook called\n" ); for( ; ; ) diff --git a/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/app_main.h b/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/app_main.h index 0cf3a6ff713..676db4e07cc 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/app_main.h +++ b/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/app_main.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/init/startup.c b/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/init/startup.c index 5deb2bfad9e..425bea09ed9 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/init/startup.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/init/startup.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/main.c b/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/main.c index 32165199a07..d24cfa890ed 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/main.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/mpu_demo.c b/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/mpu_demo.c index 35c1d829e7a..1d8b4127a19 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/mpu_demo.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/mpu_demo.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/mpu_demo.h b/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/mpu_demo.h index b85104c2cd5..5aca0b4974d 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/mpu_demo.h +++ b/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/mpu_demo.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/syscall.c b/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/syscall.c index 09e49c21b79..7ec4aa2fd21 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/syscall.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC/syscall.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/app_main.c b/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/app_main.c index 5591ca24ff1..ad1cb6cf43e 100755 --- a/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/app_main.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/app_main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/app_main.h b/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/app_main.h index 0cf3a6ff713..676db4e07cc 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/app_main.h +++ b/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/app_main.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/mpu_demo.c b/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/mpu_demo.c index d348648da27..d7f651f20e1 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/mpu_demo.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/mpu_demo.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/mpu_demo.h b/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/mpu_demo.h index 753dedbb213..279d995fc41 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/mpu_demo.h +++ b/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/mpu_demo.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/reg_tests.c b/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/reg_tests.c index 01a2fdd150f..e7bcff5f7f1 100755 --- a/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/reg_tests.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/reg_tests.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/reg_tests.h b/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/reg_tests.h index 0837aad72d6..544ea775c29 100755 --- a/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/reg_tests.h +++ b/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/reg_tests.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/reg_tests_asm.c b/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/reg_tests_asm.c index 60fd1ed9f09..e96fc4077b3 100755 --- a/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/reg_tests_asm.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Demo/reg_tests_asm.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Projects/GCC/Startup/memfault_handler.c b/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Projects/GCC/Startup/memfault_handler.c index 08089fed022..4c5226fa9e7 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Projects/GCC/Startup/memfault_handler.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Projects/GCC/Startup/memfault_handler.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/GCC/reg_tests_asm.c b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/GCC/reg_tests_asm.c index 3c02e6921f7..504793443c3 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/GCC/reg_tests_asm.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/GCC/reg_tests_asm.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/app_main.c b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/app_main.c index 761b1ba237b..b95bd5f4d1f 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/app_main.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/app_main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/app_main.h b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/app_main.h index ec3f68f3427..24cdd99b367 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/app_main.h +++ b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/app_main.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/mpu_demo.c b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/mpu_demo.c index a8d1b874271..d1398cb6a7d 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/mpu_demo.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/mpu_demo.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/mpu_demo.h b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/mpu_demo.h index 98d489c8aa1..8130d3b9af7 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/mpu_demo.h +++ b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/mpu_demo.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/reg_tests.c b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/reg_tests.c index d4efebfb675..550cc6df2f3 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/reg_tests.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/reg_tests.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/reg_tests.h b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/reg_tests.h index 0837aad72d6..544ea775c29 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/reg_tests.h +++ b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Demo/reg_tests.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Projects/GCC/Startup/memfault_handler.c b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Projects/GCC/Startup/memfault_handler.c index 17001f89d76..cf41af8bb6e 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Projects/GCC/Startup/memfault_handler.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Projects/GCC/Startup/memfault_handler.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Projects/Keil/memfault_handler.c b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Projects/Keil/memfault_handler.c index 84ceb512ae2..843c3906bc3 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Projects/Keil/memfault_handler.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Projects/Keil/memfault_handler.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Projects/Keil_V5/memfault_handler.c b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Projects/Keil_V5/memfault_handler.c index 6c14c6ff08c..28ba72b319a 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Projects/Keil_V5/memfault_handler.c +++ b/FreeRTOS/Demo/CORTEX_MPU_M7_NUCLEO_H743ZI2_GCC_IAR_Keil/Projects/Keil_V5/memfault_handler.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Demo/app_main.c b/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Demo/app_main.c index 0ed000aacea..80f640c279b 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Demo/app_main.c +++ b/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Demo/app_main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Demo/app_main.h b/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Demo/app_main.h index 0cf3a6ff713..676db4e07cc 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Demo/app_main.h +++ b/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Demo/app_main.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Demo/mpu_demo.c b/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Demo/mpu_demo.c index d348648da27..d7f651f20e1 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Demo/mpu_demo.c +++ b/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Demo/mpu_demo.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Demo/mpu_demo.h b/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Demo/mpu_demo.h index 286c534d9d8..279d995fc41 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Demo/mpu_demo.h +++ b/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Demo/mpu_demo.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Projects/GCC/Startup/memfault_handler.c b/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Projects/GCC/Startup/memfault_handler.c index 08089fed022..4c5226fa9e7 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Projects/GCC/Startup/memfault_handler.c +++ b/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Projects/GCC/Startup/memfault_handler.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Projects/Keil/memfault_handler.c b/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Projects/Keil/memfault_handler.c index b4589e05d93..7ffad820603 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Projects/Keil/memfault_handler.c +++ b/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_GCC_IAR_Keil/Projects/Keil/memfault_handler.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/RegTest.c b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/RegTest.c index 0af4655930c..4b9552e0b23 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RegTest.c b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RegTest.c index 1f7f98fe7a2..3cc36fbd5aa 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/main.c b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/main.c index 73f7246302d..2a4ebfde762 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/main.c +++ b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/main.c @@ -53,22 +53,22 @@ /*-----------------------------------------------------------*/ /* Misc constants. */ -#define mainDONT_BLOCK ( 0 ) +#define mainDONT_BLOCK ( 0 ) /* GCC specifics. */ -#define mainALIGN_TO( x ) __attribute__((aligned(x))) +#define mainALIGN_TO( x ) __attribute__( ( aligned( x ) ) ) /* Hardware register addresses. */ -#define mainVTOR ( * ( volatile uint32_t * ) 0xE000ED08 ) +#define mainVTOR ( *( volatile uint32_t * ) 0xE000ED08 ) /* The period of the timer must be less than the rate at which -configPRINT_SYSTEM_STATUS messages are sent to the check task - otherwise the -check task will think the timer has stopped. */ -#define mainTIMER_PERIOD pdMS_TO_TICKS( 200 ) + * configPRINT_SYSTEM_STATUS messages are sent to the check task - otherwise the + * check task will think the timer has stopped. */ +#define mainTIMER_PERIOD pdMS_TO_TICKS( 200 ) /* The name of the task that is deleted by the Idle task is used in a couple of -places, so is #defined. */ -#define mainTASK_TO_DELETE_NAME "DeleteMe" + * places, so is #defined. */ +#define mainTASK_TO_DELETE_NAME "DeleteMe" /*-----------------------------------------------------------*/ /* Prototypes for functions that implement tasks. -----------*/ @@ -96,8 +96,8 @@ places, so is #defined. */ * User mode, and vRegTest2Implementation() receives the task handle using its * parameter. */ -extern void vRegTest1Implementation( void *pvParameters ); -extern void vRegTest2Implementation( void *pvParameters ); +extern void vRegTest1Implementation( void * pvParameters ); +extern void vRegTest2Implementation( void * pvParameters ); /* * The second two register test tasks are similar to the first two, but do test @@ -108,9 +108,9 @@ extern void vRegTest2Implementation( void *pvParameters ); * * The functions ending 'Implementation' are called by the register check tasks. */ -static void prvRegTest3Task( void *pvParameters ); +static void prvRegTest3Task( void * pvParameters ); extern void vRegTest3Implementation( void ); -static void prvRegTest4Task( void *pvParameters ); +static void prvRegTest4Task( void * pvParameters ); extern void vRegTest4Implementation( void ); /* @@ -128,7 +128,7 @@ extern void vRegTest4Implementation( void ); * either pass or fail to the terminal, depending on the status of the reg * test tasks (no write is performed in the simulator!). */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); /* * Prototype for a task created in User mode using the original vTaskCreate() @@ -147,13 +147,13 @@ static void prvOldStyleUserModeTask( void ); * vTaskCreate() API function. The task demonstrates the characteristics of * such a task, before simply deleting itself. */ -static void prvOldStylePrivilegedModeTask( void *pvParameters ); +static void prvOldStylePrivilegedModeTask( void * pvParameters ); /* * A task that exercises the API of various RTOS objects before being deleted by * the Idle task. This is done for MPU API code coverage test purposes. */ -static void prvTaskToDelete( void *pvParameters ); +static void prvTaskToDelete( void * pvParameters ); /* * Functions called by prvTaskToDelete() to exercise the MPU API. @@ -174,7 +174,7 @@ static void prvSetupHardware( void ); * is simpler to call from asm code than the normal vTaskDelete() API function. * It has the noinline attribute because it is called from asm code. */ -void vMainDeleteMe( void ) __attribute__((noinline)); +void vMainDeleteMe( void ) __attribute__( ( noinline ) ); /* * Used by the first two reg test tasks and a software timer callback function @@ -183,7 +183,8 @@ void vMainDeleteMe( void ) __attribute__((noinline)); * task detects an error it will delete itself, and in so doing prevent itself * from sending any more 'I'm Alive' messages to the check task. */ -void vMainSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber ); +void vMainSendImAlive( QueueHandle_t xHandle, + uint32_t ulTaskNumber ); /* * The check task is created with access to three memory regions (plus its @@ -205,20 +206,21 @@ static void prvTimerCallback( TimerHandle_t xExpiredTimer ); * The callback function and a function that is pended used when exercising the * timer API. */ -static void prvPendedFunctionCall( void *pvParameter1, uint32_t ulParameter2 ); +static void prvPendedFunctionCall( void * pvParameter1, + uint32_t ulParameter2 ); static void prvTestTimerCallback( TimerHandle_t xTimer ); /*-----------------------------------------------------------*/ /* The handle of the queue used to communicate between tasks and between tasks -and interrupts. Note that this is a global scope variable that falls outside of -any MPU region. As such other techniques have to be used to allow the tasks -to gain access to the queue. See the comments in the tasks themselves for -further information. */ + * and interrupts. Note that this is a global scope variable that falls outside of + * any MPU region. As such other techniques have to be used to allow the tasks + * to gain access to the queue. See the comments in the tasks themselves for + * further information. */ QueueHandle_t xGlobalScopeCheckQueue = NULL; /* Holds the handle of a task that is deleted in the idle task hook - this is -done for code coverage test purposes only. */ + * done for code coverage test purposes only. */ static TaskHandle_t xTaskToDelete = NULL; /* The timer that periodically sends data to the check task on the queue. */ @@ -227,102 +229,102 @@ static TimerHandle_t xTimer = NULL; /* Just used to check start up code for initialised an uninitialised data. */ volatile uint32_t ul1 = 0x123, ul2 = 0; -#if defined ( __GNUC__ ) - /* Memory map read directl from linker variables. */ - extern uint32_t __FLASH_segment_start__[]; - extern uint32_t __FLASH_segment_end__[]; - extern uint32_t __SRAM_segment_start__[]; - extern uint32_t __SRAM_segment_end__[]; - extern uint32_t __privileged_functions_start__[]; - extern uint32_t __privileged_functions_end__[]; - extern uint32_t __privileged_data_start__[]; - extern uint32_t __privileged_data_end__[]; - extern uint32_t __privileged_functions_actual_end__[]; - extern uint32_t __privileged_data_actual_end__[]; -#else - extern uint32_t Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Base; - extern uint32_t Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Limit; - - /* Must be set manually to match memory map. */ - const uint32_t * __FLASH_segment_start__ = ( uint32_t * ) 0x00000000UL; - const uint32_t * __FLASH_segment_end__ = ( uint32_t * ) 0x00080000UL; - const uint32_t * __SRAM_segment_start__ = ( uint32_t * ) 0x20000000UL; - const uint32_t * __SRAM_segment_end__ = ( uint32_t * ) 0x20008000UL; - const uint32_t * __privileged_functions_start__ = ( uint32_t * ) 0x00000000UL; - const uint32_t * __privileged_functions_end__ = ( uint32_t * ) 0x00010000UL; - const uint32_t * __syscalls_flash_start__ = ( uint32_t * ) &( Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Base ); - const uint32_t * __syscalls_flash_end__ = ( uint32_t * ) &( Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Limit ); - const uint32_t * __privileged_data_start__ = ( uint32_t * ) 0x20000000UL; - const uint32_t * __privileged_data_end__ = ( uint32_t * ) 0x20004000UL; -#endif +#if defined( __GNUC__ ) + /* Memory map read directl from linker variables. */ + extern uint32_t __FLASH_segment_start__[]; + extern uint32_t __FLASH_segment_end__[]; + extern uint32_t __SRAM_segment_start__[]; + extern uint32_t __SRAM_segment_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; + extern uint32_t __privileged_data_start__[]; + extern uint32_t __privileged_data_end__[]; + extern uint32_t __privileged_functions_actual_end__[]; + extern uint32_t __privileged_data_actual_end__[]; +#else /* if defined( __GNUC__ ) */ + extern uint32_t Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Base; + extern uint32_t Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Limit; + +/* Must be set manually to match memory map. */ + const uint32_t * __FLASH_segment_start__ = ( uint32_t * ) 0x00000000UL; + const uint32_t * __FLASH_segment_end__ = ( uint32_t * ) 0x00080000UL; + const uint32_t * __SRAM_segment_start__ = ( uint32_t * ) 0x20000000UL; + const uint32_t * __SRAM_segment_end__ = ( uint32_t * ) 0x20008000UL; + const uint32_t * __privileged_functions_start__ = ( uint32_t * ) 0x00000000UL; + const uint32_t * __privileged_functions_end__ = ( uint32_t * ) 0x00010000UL; + const uint32_t * __syscalls_flash_start__ = ( uint32_t * ) &( Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Base ); + const uint32_t * __syscalls_flash_end__ = ( uint32_t * ) &( Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Limit ); + const uint32_t * __privileged_data_start__ = ( uint32_t * ) 0x20000000UL; + const uint32_t * __privileged_data_end__ = ( uint32_t * ) 0x20004000UL; +#endif /* if defined( __GNUC__ ) */ /*-----------------------------------------------------------*/ /* Data used by the 'check' task. ---------------------------*/ /*-----------------------------------------------------------*/ /* Define the constants used to allocate the check task stack. Note that the -stack size is defined in words, not bytes. */ -#define mainCHECK_TASK_STACK_SIZE_WORDS 128 -#define mainCHECK_TASK_STACK_ALIGNMENT ( mainCHECK_TASK_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) + * stack size is defined in words, not bytes. */ +#define mainCHECK_TASK_STACK_SIZE_WORDS 128 +#define mainCHECK_TASK_STACK_ALIGNMENT ( mainCHECK_TASK_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) /* Declare the stack that will be used by the check task. The kernel will - automatically create an MPU region for the stack. The stack alignment must - match its size, so if 128 words are reserved for the stack then it must be - aligned to ( 128 * 4 ) bytes. */ + * automatically create an MPU region for the stack. The stack alignment must + * match its size, so if 128 words are reserved for the stack then it must be + * aligned to ( 128 * 4 ) bytes. */ static portSTACK_TYPE xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS ] mainALIGN_TO( mainCHECK_TASK_STACK_ALIGNMENT ); /* Declare three arrays - an MPU region will be created for each array -using the TaskParameters_t structure below. THIS IS JUST TO DEMONSTRATE THE -MPU FUNCTIONALITY, the data is not used by the check tasks primary function -of monitoring the reg test tasks and printing out status information. - -Note that the arrays allocate slightly more RAM than is actually assigned to -the MPU region. This is to permit writes off the end of the array to be -detected even when the arrays are placed in adjacent memory locations (with no -gaps between them). The align size must be a power of two. */ -#define mainREAD_WRITE_ARRAY_SIZE 130 -#define mainREAD_WRITE_ALIGN_SIZE 128 + * using the TaskParameters_t structure below. THIS IS JUST TO DEMONSTRATE THE + * MPU FUNCTIONALITY, the data is not used by the check tasks primary function + * of monitoring the reg test tasks and printing out status information. + * + * Note that the arrays allocate slightly more RAM than is actually assigned to + * the MPU region. This is to permit writes off the end of the array to be + * detected even when the arrays are placed in adjacent memory locations (with no + * gaps between them). The align size must be a power of two. */ +#define mainREAD_WRITE_ARRAY_SIZE 130 +#define mainREAD_WRITE_ALIGN_SIZE 128 char cReadWriteArray[ mainREAD_WRITE_ARRAY_SIZE ] mainALIGN_TO( mainREAD_WRITE_ALIGN_SIZE ); -#define mainREAD_ONLY_ARRAY_SIZE 260 -#define mainREAD_ONLY_ALIGN_SIZE 256 +#define mainREAD_ONLY_ARRAY_SIZE 260 +#define mainREAD_ONLY_ALIGN_SIZE 256 char cReadOnlyArray[ mainREAD_ONLY_ARRAY_SIZE ] mainALIGN_TO( mainREAD_ONLY_ALIGN_SIZE ); -#define mainPRIVILEGED_ONLY_ACCESS_ARRAY_SIZE 130 -#define mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE 128 +#define mainPRIVILEGED_ONLY_ACCESS_ARRAY_SIZE 130 +#define mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE 128 char cPrivilegedOnlyAccessArray[ mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ] mainALIGN_TO( mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ); /* The following two variables are used to communicate the status of the second -two register check tasks (tasks 3 and 4) to the check task. If the variables -keep incrementing, then the register check tasks have not discovered any errors. -If a variable stops incrementing, then an error has been found. The variables -overlay the array that the check task has access to so they can be read by the -check task without causing a memory fault. The check task has the highest -priority so will have finished with the array before the register test tasks -start to access it. */ -volatile uint32_t *pulRegTest3LoopCounter = ( uint32_t * ) &( cReadWriteArray[ 0 ] ), *pulRegTest4LoopCounter = ( uint32_t * ) &( cReadWriteArray[ 4 ] ); + * two register check tasks (tasks 3 and 4) to the check task. If the variables + * keep incrementing, then the register check tasks have not discovered any errors. + * If a variable stops incrementing, then an error has been found. The variables + * overlay the array that the check task has access to so they can be read by the + * check task without causing a memory fault. The check task has the highest + * priority so will have finished with the array before the register test tasks + * start to access it. */ +volatile uint32_t * pulRegTest3LoopCounter = ( uint32_t * ) &( cReadWriteArray[ 0 ] ), * pulRegTest4LoopCounter = ( uint32_t * ) &( cReadWriteArray[ 4 ] ); /* Fill in a TaskParameters_t structure to define the check task - this is the -structure passed to the xTaskCreateRestricted() function. */ + * structure passed to the xTaskCreateRestricted() function. */ static const TaskParameters_t xCheckTaskParameters = { - prvCheckTask, /* pvTaskCode - the function that implements the task. */ - "Check", /* pcName */ - mainCHECK_TASK_STACK_SIZE_WORDS, /* usStackDepth - defined in words, not bytes. */ - ( void * ) 0x12121212, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */ - ( tskIDLE_PRIORITY + 1 ) | portPRIVILEGE_BIT,/* uxPriority - this is the highest priority task in the system. The task is created in privileged mode to demonstrate accessing the privileged only data. */ - xCheckTaskStack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ - - /* xRegions - In this case the xRegions array is used to create MPU regions - for all three of the arrays declared directly above. Each MPU region is - created with different parameters. Again, THIS IS JUST TO DEMONSTRATE THE - MPU FUNCTIONALITY, the data is not used by the check tasks primary function - of monitoring the reg test tasks and printing out status information.*/ - { - /* Base address Length Parameters */ - { cReadWriteArray, mainREAD_WRITE_ALIGN_SIZE, portMPU_REGION_READ_WRITE }, - { cReadOnlyArray, mainREAD_ONLY_ALIGN_SIZE, portMPU_REGION_READ_ONLY }, - { cPrivilegedOnlyAccessArray, mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE, portMPU_REGION_PRIVILEGED_READ_WRITE } - } + prvCheckTask, /* pvTaskCode - the function that implements the task. */ + "Check", /* pcName */ + mainCHECK_TASK_STACK_SIZE_WORDS, /* usStackDepth - defined in words, not bytes. */ + ( void * ) 0x12121212, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */ + ( tskIDLE_PRIORITY + 1 ) | portPRIVILEGE_BIT, /* uxPriority - this is the highest priority task in the system. The task is created in privileged mode to demonstrate accessing the privileged only data. */ + xCheckTaskStack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ + + /* xRegions - In this case the xRegions array is used to create MPU regions + * for all three of the arrays declared directly above. Each MPU region is + * created with different parameters. Again, THIS IS JUST TO DEMONSTRATE THE + * MPU FUNCTIONALITY, the data is not used by the check tasks primary function + * of monitoring the reg test tasks and printing out status information.*/ + { + /* Base address Length Parameters */ + { cReadWriteArray, mainREAD_WRITE_ALIGN_SIZE, portMPU_REGION_READ_WRITE }, + { cReadOnlyArray, mainREAD_ONLY_ALIGN_SIZE, portMPU_REGION_READ_ONLY }, + { cPrivilegedOnlyAccessArray, mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE, portMPU_REGION_PRIVILEGED_READ_WRITE } + } }; @@ -332,14 +334,14 @@ static const TaskParameters_t xCheckTaskParameters = /*-----------------------------------------------------------*/ /* Define the constants used to allocate the reg test task stacks. Note that -that stack size is defined in words, not bytes. */ -#define mainREG_TEST_STACK_SIZE_WORDS 128 -#define mainREG_TEST_STACK_ALIGNMENT ( mainREG_TEST_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) + * that stack size is defined in words, not bytes. */ +#define mainREG_TEST_STACK_SIZE_WORDS 128 +#define mainREG_TEST_STACK_ALIGNMENT ( mainREG_TEST_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) /* Declare the stacks that will be used by the reg test tasks. The kernel will -automatically create an MPU region for the stack. The stack alignment must -match its size, so if 128 words are reserved for the stack then it must be -aligned to ( 128 * 4 ) bytes. */ + * automatically create an MPU region for the stack. The stack alignment must + * match its size, so if 128 words are reserved for the stack then it must be + * aligned to ( 128 * 4 ) bytes. */ static portSTACK_TYPE xRegTest1Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_TO( mainREG_TEST_STACK_ALIGNMENT ); static portSTACK_TYPE xRegTest2Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_TO( mainREG_TEST_STACK_ALIGNMENT ); static portSTACK_TYPE xRegTest3Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_TO( mainREG_TEST_STACK_ALIGNMENT ); @@ -348,69 +350,69 @@ static portSTACK_TYPE xRegTest4Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_ /* Fill in a TaskParameters_t structure per reg test task to define the tasks. */ static const TaskParameters_t xRegTest1Parameters = { - vRegTest1Implementation, /* pvTaskCode - the function that implements the task. */ - "RegTest1", /* pcName */ - mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */ - ( void * ) configREG_TEST_TASK_1_PARAMETER, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */ - tskIDLE_PRIORITY | portPRIVILEGE_BIT, /* uxPriority - note that this task is created with privileges to demonstrate one method of passing a queue handle into the task. */ - xRegTest1Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ - { /* xRegions - this task does not use any non-stack data hence all members are zero. */ - /* Base address Length Parameters */ - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 } - } + vRegTest1Implementation, /* pvTaskCode - the function that implements the task. */ + "RegTest1", /* pcName */ + mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */ + ( void * ) configREG_TEST_TASK_1_PARAMETER, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */ + tskIDLE_PRIORITY | portPRIVILEGE_BIT, /* uxPriority - note that this task is created with privileges to demonstrate one method of passing a queue handle into the task. */ + xRegTest1Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ + { /* xRegions - this task does not use any non-stack data hence all members are zero. */ + /* Base address Length Parameters */ + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 } + } }; /*-----------------------------------------------------------*/ static TaskParameters_t xRegTest2Parameters = { - vRegTest2Implementation, /* pvTaskCode - the function that implements the task. */ - "RegTest2", /* pcName */ - mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */ - ( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */ - tskIDLE_PRIORITY, /* uxPriority */ - xRegTest2Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ - { /* xRegions - this task does not use any non-stack data hence all members are zero. */ - /* Base address Length Parameters */ - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 } - } + vRegTest2Implementation, /* pvTaskCode - the function that implements the task. */ + "RegTest2", /* pcName */ + mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */ + ( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */ + tskIDLE_PRIORITY, /* uxPriority */ + xRegTest2Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ + { /* xRegions - this task does not use any non-stack data hence all members are zero. */ + /* Base address Length Parameters */ + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 } + } }; /*-----------------------------------------------------------*/ static const TaskParameters_t xRegTest3Parameters = { - prvRegTest3Task, /* pvTaskCode - the function that implements the task. */ - "RegTest3", /* pcName */ - mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */ - ( void * ) configREG_TEST_TASK_3_PARAMETER, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */ - tskIDLE_PRIORITY | portPRIVILEGE_BIT, /* uxPriority - note that this task is created with privileges to demonstrate one method of passing a queue handle into the task. */ - xRegTest3Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ - { /* xRegions - this task does not use any non-stack data hence all members are zero. */ - /* Base address Length Parameters */ - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 } - } + prvRegTest3Task, /* pvTaskCode - the function that implements the task. */ + "RegTest3", /* pcName */ + mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */ + ( void * ) configREG_TEST_TASK_3_PARAMETER, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */ + tskIDLE_PRIORITY | portPRIVILEGE_BIT, /* uxPriority - note that this task is created with privileges to demonstrate one method of passing a queue handle into the task. */ + xRegTest3Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ + { /* xRegions - this task does not use any non-stack data hence all members are zero. */ + /* Base address Length Parameters */ + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 } + } }; /*-----------------------------------------------------------*/ static const TaskParameters_t xRegTest4Parameters = { - prvRegTest4Task, /* pvTaskCode - the function that implements the task. */ - "RegTest4", /* pcName */ - mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */ - ( void * ) configREG_TEST_TASK_4_PARAMETER, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */ - tskIDLE_PRIORITY | portPRIVILEGE_BIT, /* uxPriority - note that this task is created with privileges to demonstrate one method of passing a queue handle into the task. */ - xRegTest4Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ - { /* xRegions - this task does not use any non-stack data hence all members are zero. */ - /* Base address Length Parameters */ - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 } - } + prvRegTest4Task, /* pvTaskCode - the function that implements the task. */ + "RegTest4", /* pcName */ + mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */ + ( void * ) configREG_TEST_TASK_4_PARAMETER, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */ + tskIDLE_PRIORITY | portPRIVILEGE_BIT, /* uxPriority - note that this task is created with privileges to demonstrate one method of passing a queue handle into the task. */ + xRegTest4Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ + { /* xRegions - this task does not use any non-stack data hence all members are zero. */ + /* Base address Length Parameters */ + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 } + } }; /*-----------------------------------------------------------*/ @@ -418,695 +420,709 @@ static const TaskParameters_t xRegTest4Parameters = /*-----------------------------------------------------------*/ /* Define the constants used to allocate the stack of the task that is -deleted. Note that that stack size is defined in words, not bytes. */ -#define mainDELETE_TASK_STACK_SIZE_WORDS 128 -#define mainTASK_TO_DELETE_STACK_ALIGNMENT ( mainDELETE_TASK_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) + * deleted. Note that that stack size is defined in words, not bytes. */ +#define mainDELETE_TASK_STACK_SIZE_WORDS 128 +#define mainTASK_TO_DELETE_STACK_ALIGNMENT ( mainDELETE_TASK_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) /* Declare the stack that will be used by the task that gets deleted. The -kernel will automatically create an MPU region for the stack. The stack -alignment must match its size, so if 128 words are reserved for the stack -then it must be aligned to ( 128 * 4 ) bytes. */ + * kernel will automatically create an MPU region for the stack. The stack + * alignment must match its size, so if 128 words are reserved for the stack + * then it must be aligned to ( 128 * 4 ) bytes. */ static portSTACK_TYPE xDeleteTaskStack[ mainDELETE_TASK_STACK_SIZE_WORDS ] mainALIGN_TO( mainTASK_TO_DELETE_STACK_ALIGNMENT ); static TaskParameters_t xTaskToDeleteParameters = { - prvTaskToDelete, /* pvTaskCode - the function that implements the task. */ - mainTASK_TO_DELETE_NAME, /* pcName */ - mainDELETE_TASK_STACK_SIZE_WORDS, /* usStackDepth */ - ( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */ - ( tskIDLE_PRIORITY + 1 ) | portPRIVILEGE_BIT, /* uxPriority - this task is privileged because it creates and deletes kernel objects. */ - xDeleteTaskStack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ - { /* xRegions - this task does not use any non-stack data hence all members are zero. */ - /* Base address Length Parameters */ - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 } - } + prvTaskToDelete, /* pvTaskCode - the function that implements the task. */ + mainTASK_TO_DELETE_NAME, /* pcName */ + mainDELETE_TASK_STACK_SIZE_WORDS, /* usStackDepth */ + ( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */ + ( tskIDLE_PRIORITY + 1 ) | portPRIVILEGE_BIT, /* uxPriority - this task is privileged because it creates and deletes kernel objects. */ + xDeleteTaskStack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ + { /* xRegions - this task does not use any non-stack data hence all members are zero. */ + /* Base address Length Parameters */ + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 } + } }; /*-----------------------------------------------------------*/ int main( void ) { - TaskHandle_t xRegTest1TaskHandle, xRegTest2TaskHandle, xCheckTaskHandle; - - /* Used to check linker configuration. */ - configASSERT( ul1 == 0x123 ); - configASSERT( ul2 == 0 ); - prvSetupHardware(); - - /* Create the queue used to pass "I'm alive" messages to the check task. */ - xGlobalScopeCheckQueue = xQueueCreate( 1, sizeof( uint32_t ) ); - - /* One check task uses the task parameter to receive the queue handle. - This allows the file scope variable to be accessed from within the task. - The pvParameters member of xRegTest2Parameters can only be set after the - queue has been created so is set here. */ - xRegTest2Parameters.pvParameters = xGlobalScopeCheckQueue; - - /* Create three test tasks. */ - xTaskCreateRestricted( &xRegTest1Parameters, &( xRegTest1TaskHandle ) ); - xTaskCreateRestricted( &xRegTest2Parameters, &( xRegTest2TaskHandle ) ); - xTaskCreateRestricted( &xCheckTaskParameters, &( xCheckTaskHandle ) ); - - vGrantAccessToQueue( xRegTest1TaskHandle, xGlobalScopeCheckQueue ); - vGrantAccessToQueue( xRegTest2TaskHandle, xGlobalScopeCheckQueue ); - vGrantAccessToQueue( xCheckTaskHandle, xGlobalScopeCheckQueue ); - - /* Create a task that does nothing but ensure some of the MPU API functions - can be called correctly, then get deleted. This is done for code coverage - test purposes only. The task's handle is saved in xTaskToDelete so it can - get deleted in the idle task hook. */ - xTaskCreateRestricted( &xTaskToDeleteParameters, &xTaskToDelete ); - - xTaskCreate( prvOldStylePrivilegedModeTask, /* The function that implements the task. */ - "Task2", /* Text name for the task. */ - 100, /* Stack depth in words. */ - NULL, /* Task parameters. */ - ( 3 | portPRIVILEGE_BIT ), /* Priority and mode. */ - NULL /* Handle. */ - ); - - /* Create the third and fourth register check tasks, as described at the top - of this file. */ - xTaskCreateRestricted( &xRegTest3Parameters, NULL ); - xTaskCreateRestricted( &xRegTest4Parameters, NULL ); - - /* Create and start the software timer. */ - xTimer = xTimerCreate( "Timer", /* Test name for the timer. */ - mainTIMER_PERIOD, /* Period of the timer. */ - pdTRUE, /* The timer will auto-reload itself. */ - ( void * ) 0, /* The timer's ID is used to count the number of times it expires - initialise this to 0. */ - prvTimerCallback ); /* The function called when the timer expires. */ - configASSERT( xTimer ); - xTimerStart( xTimer, mainDONT_BLOCK ); - - /* Start the scheduler. */ - vTaskStartScheduler(); - - /* Will only get here if there was insufficient memory to create the idle - task. */ - for( ;; ); + TaskHandle_t xRegTest1TaskHandle, xRegTest2TaskHandle, xCheckTaskHandle; + + /* Used to check linker configuration. */ + configASSERT( ul1 == 0x123 ); + configASSERT( ul2 == 0 ); + prvSetupHardware(); + + /* Create the queue used to pass "I'm alive" messages to the check task. */ + xGlobalScopeCheckQueue = xQueueCreate( 1, sizeof( uint32_t ) ); + + /* One check task uses the task parameter to receive the queue handle. + * This allows the file scope variable to be accessed from within the task. + * The pvParameters member of xRegTest2Parameters can only be set after the + * queue has been created so is set here. */ + xRegTest2Parameters.pvParameters = xGlobalScopeCheckQueue; + + /* Create three test tasks. */ + xTaskCreateRestricted( &xRegTest1Parameters, &( xRegTest1TaskHandle ) ); + xTaskCreateRestricted( &xRegTest2Parameters, &( xRegTest2TaskHandle ) ); + xTaskCreateRestricted( &xCheckTaskParameters, &( xCheckTaskHandle ) ); + + vGrantAccessToQueue( xRegTest1TaskHandle, xGlobalScopeCheckQueue ); + vGrantAccessToQueue( xRegTest2TaskHandle, xGlobalScopeCheckQueue ); + vGrantAccessToQueue( xCheckTaskHandle, xGlobalScopeCheckQueue ); + + /* Create a task that does nothing but ensure some of the MPU API functions + * can be called correctly, then get deleted. This is done for code coverage + * test purposes only. The task's handle is saved in xTaskToDelete so it can + * get deleted in the idle task hook. */ + xTaskCreateRestricted( &xTaskToDeleteParameters, &xTaskToDelete ); + + xTaskCreate( prvOldStylePrivilegedModeTask, /* The function that implements the task. */ + "Task2", /* Text name for the task. */ + 100, /* Stack depth in words. */ + NULL, /* Task parameters. */ + ( 3 | portPRIVILEGE_BIT ), /* Priority and mode. */ + NULL /* Handle. */ + ); + + /* Create the third and fourth register check tasks, as described at the top + * of this file. */ + xTaskCreateRestricted( &xRegTest3Parameters, NULL ); + xTaskCreateRestricted( &xRegTest4Parameters, NULL ); + + /* Create and start the software timer. */ + xTimer = xTimerCreate( "Timer", /* Test name for the timer. */ + mainTIMER_PERIOD, /* Period of the timer. */ + pdTRUE, /* The timer will auto-reload itself. */ + ( void * ) 0, /* The timer's ID is used to count the number of times it expires - initialise this to 0. */ + prvTimerCallback ); /* The function called when the timer expires. */ + configASSERT( xTimer ); + xTimerStart( xTimer, mainDONT_BLOCK ); + + /* Start the scheduler. */ + vTaskStartScheduler(); + + /* Will only get here if there was insufficient memory to create the idle + * task. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvCheckTask( void *pvParameters ) +static void prvCheckTask( void * pvParameters ) { /* This task is created in privileged mode so can access the file scope -queue variable. Take a stack copy of this before the task is set into user -mode. Once that task is in user mode the file scope queue variable will no -longer be accessible but the stack copy will. */ -QueueHandle_t xQueue = xGlobalScopeCheckQueue; -int32_t lMessage; -uint32_t ulStillAliveCounts[ 3 ] = { 0 }; -const char *pcStatusMessage = "PASS\r\n"; -uint32_t ulLastRegTest3CountValue = 0, ulLastRegTest4Value = 0; + * queue variable. Take a stack copy of this before the task is set into user + * mode. Once that task is in user mode the file scope queue variable will no + * longer be accessible but the stack copy will. */ + QueueHandle_t xQueue = xGlobalScopeCheckQueue; + int32_t lMessage; + uint32_t ulStillAliveCounts[ 3 ] = { 0 }; + const char * pcStatusMessage = "PASS\r\n"; + uint32_t ulLastRegTest3CountValue = 0, ulLastRegTest4Value = 0; /* The register test tasks that also test the floating point registers increment -a counter on each iteration of their loop. The counters are inside the array -that this task has access to. */ -volatile uint32_t *pulOverlaidCounter3 = ( uint32_t * ) &( cReadWriteArray[ 0 ] ), *pulOverlaidCounter4 = ( uint32_t * ) &( cReadWriteArray[ 4 ] ); + * a counter on each iteration of their loop. The counters are inside the array + * that this task has access to. */ + volatile uint32_t * pulOverlaidCounter3 = ( uint32_t * ) &( cReadWriteArray[ 0 ] ), * pulOverlaidCounter4 = ( uint32_t * ) &( cReadWriteArray[ 4 ] ); /* ulCycleCount is incremented on each cycle of the check task. It can be -viewed updating in the Keil watch window as the simulator does not print to -the ITM port. */ -volatile uint32_t ulCycleCount = 0; - - /* Just to remove compiler warning. */ - ( void ) pvParameters; - - /* Demonstrate how the various memory regions can and can't be accessed. - The task privilege level is set down to user mode within this function. */ - prvTestMemoryRegions(); - - /* Clear overlaid reg test counters before entering the loop below. */ - *pulOverlaidCounter3 = 0UL; - *pulOverlaidCounter4 = 0UL; - - /* This loop performs the main function of the task, which is blocking - on a message queue then processing each message as it arrives. */ - for( ;; ) - { - /* Wait for the next message to arrive. */ - xQueueReceive( xQueue, &lMessage, portMAX_DELAY ); - - switch( lMessage ) - { - case configREG_TEST_1_STILL_EXECUTING : - case configREG_TEST_2_STILL_EXECUTING : - case configTIMER_STILL_EXECUTING : - /* Message from the first or second register check task, or - the timer callback function. Increment the count of the - number of times the message source has sent the message as - the message source must still be executed. */ - ( ulStillAliveCounts[ lMessage ] )++; - break; - - case configPRINT_SYSTEM_STATUS : - /* Message from tick hook, time to print out the system - status. If messages have stopped arriving from either of - the first two reg test task or the timer callback then the - status must be set to fail. */ - if( ( ulStillAliveCounts[ 0 ] == 0 ) || ( ulStillAliveCounts[ 1 ] == 0 ) || ( ulStillAliveCounts[ 2 ] == 0 ) ) - { - /* One or both of the test tasks are no longer sending - 'still alive' messages. */ - pcStatusMessage = "FAIL\r\n"; - } - else - { - /* Reset the count of 'still alive' messages. */ - memset( ( void * ) ulStillAliveCounts, 0x00, sizeof( ulStillAliveCounts ) ); - } - - /* Check that the register test 3 task is still incrementing - its counter, and therefore still running. */ - if( ulLastRegTest3CountValue == *pulOverlaidCounter3 ) - { - pcStatusMessage = "FAIL\r\n"; - } - ulLastRegTest3CountValue = *pulOverlaidCounter3; - - /* Check that the register test 4 task is still incrementing - its counter, and therefore still running. */ - if( ulLastRegTest4Value == *pulOverlaidCounter4 ) - { - pcStatusMessage = "FAIL\r\n"; - } - ulLastRegTest4Value = *pulOverlaidCounter4; - - /**** Print pcStatusMessage here. ****/ - ( void ) pcStatusMessage; - - /* The cycle count can be viewed updating in the Keil watch - window if ITM printf is not being used. */ - ulCycleCount++; - break; - - default : - /* Something unexpected happened. Delete this task so the - error is apparent (no output will be displayed). */ - vMainDeleteMe(); - break; - } - } + * viewed updating in the Keil watch window as the simulator does not print to + * the ITM port. */ + volatile uint32_t ulCycleCount = 0; + + /* Just to remove compiler warning. */ + ( void ) pvParameters; + + /* Demonstrate how the various memory regions can and can't be accessed. + * The task privilege level is set down to user mode within this function. */ + prvTestMemoryRegions(); + + /* Clear overlaid reg test counters before entering the loop below. */ + *pulOverlaidCounter3 = 0UL; + *pulOverlaidCounter4 = 0UL; + + /* This loop performs the main function of the task, which is blocking + * on a message queue then processing each message as it arrives. */ + for( ; ; ) + { + /* Wait for the next message to arrive. */ + xQueueReceive( xQueue, &lMessage, portMAX_DELAY ); + + switch( lMessage ) + { + case configREG_TEST_1_STILL_EXECUTING: + case configREG_TEST_2_STILL_EXECUTING: + case configTIMER_STILL_EXECUTING: + + /* Message from the first or second register check task, or + * the timer callback function. Increment the count of the + * number of times the message source has sent the message as + * the message source must still be executed. */ + ( ulStillAliveCounts[ lMessage ] )++; + break; + + case configPRINT_SYSTEM_STATUS: + + /* Message from tick hook, time to print out the system + * status. If messages have stopped arriving from either of + * the first two reg test task or the timer callback then the + * status must be set to fail. */ + if( ( ulStillAliveCounts[ 0 ] == 0 ) || ( ulStillAliveCounts[ 1 ] == 0 ) || ( ulStillAliveCounts[ 2 ] == 0 ) ) + { + /* One or both of the test tasks are no longer sending + * 'still alive' messages. */ + pcStatusMessage = "FAIL\r\n"; + } + else + { + /* Reset the count of 'still alive' messages. */ + memset( ( void * ) ulStillAliveCounts, 0x00, sizeof( ulStillAliveCounts ) ); + } + + /* Check that the register test 3 task is still incrementing + * its counter, and therefore still running. */ + if( ulLastRegTest3CountValue == *pulOverlaidCounter3 ) + { + pcStatusMessage = "FAIL\r\n"; + } + + ulLastRegTest3CountValue = *pulOverlaidCounter3; + + /* Check that the register test 4 task is still incrementing + * its counter, and therefore still running. */ + if( ulLastRegTest4Value == *pulOverlaidCounter4 ) + { + pcStatusMessage = "FAIL\r\n"; + } + + ulLastRegTest4Value = *pulOverlaidCounter4; + + /**** Print pcStatusMessage here. ****/ + ( void ) pcStatusMessage; + + /* The cycle count can be viewed updating in the Keil watch + * window if ITM printf is not being used. */ + ulCycleCount++; + break; + + default: + + /* Something unexpected happened. Delete this task so the + * error is apparent (no output will be displayed). */ + vMainDeleteMe(); + break; + } + } } /*-----------------------------------------------------------*/ static void prvTestMemoryRegions( void ) { -int32_t x; -char cTemp; - - /* The check task (from which this function is called) is created in the - Privileged mode. The privileged array can be both read from and written - to while this task is privileged. */ - cPrivilegedOnlyAccessArray[ 0 ] = 'a'; - if( cPrivilegedOnlyAccessArray[ 0 ] != 'a' ) - { - /* Something unexpected happened. Delete this task so the error is - apparent (no output will be displayed). */ - vMainDeleteMe(); - } - - /* Writing off the end of the RAM allocated to this task will *NOT* cause a - protection fault because the task is still executing in a privileged mode. - Uncomment the following to test. */ - /*cPrivilegedOnlyAccessArray[ mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ] = 'a';*/ - - /* Now set the task into user mode. */ - portSWITCH_TO_USER_MODE(); - - /* Accessing the privileged only array will now cause a fault. Uncomment - the following line to test. */ - /*cPrivilegedOnlyAccessArray[ 0 ] = 'a';*/ - - /* The read/write array can still be successfully read and written. */ - for( x = 0; x < mainREAD_WRITE_ALIGN_SIZE; x++ ) - { - cReadWriteArray[ x ] = 'a'; - if( cReadWriteArray[ x ] != 'a' ) - { - /* Something unexpected happened. Delete this task so the error is - apparent (no output will be displayed). */ - vMainDeleteMe(); - } - } - - /* But attempting to read or write off the end of the RAM allocated to this - task will cause a fault. Uncomment either of the following two lines to - test. */ - /* cReadWriteArray[ 0 ] = cReadWriteArray[ -1 ]; */ - /* cReadWriteArray[ mainREAD_WRITE_ALIGN_SIZE ] = 0x00; */ - - /* The read only array can be successfully read... */ - for( x = 0; x < mainREAD_ONLY_ALIGN_SIZE; x++ ) - { - cTemp = cReadOnlyArray[ x ]; - } - - /* ...but cannot be written. Uncomment the following line to test. */ - /* cReadOnlyArray[ 0 ] = 'a'; */ - - /* Writing to the first and last locations in the stack array should not - cause a protection fault. Note that doing this will cause the kernel to - detect a stack overflow if configCHECK_FOR_STACK_OVERFLOW is greater than - 1, hence the test is commented out by default. */ - /* xCheckTaskStack[ 0 ] = 0; - xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS - 1 ] = 0; */ - - /* Writing off either end of the stack array should cause a protection - fault, uncomment either of the following two lines to test. */ - /* xCheckTaskStack[ -1 ] = 0; */ - /* xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS ] = 0; */ - - ( void ) cTemp; + int32_t x; + char cTemp; + + /* The check task (from which this function is called) is created in the + * Privileged mode. The privileged array can be both read from and written + * to while this task is privileged. */ + cPrivilegedOnlyAccessArray[ 0 ] = 'a'; + + if( cPrivilegedOnlyAccessArray[ 0 ] != 'a' ) + { + /* Something unexpected happened. Delete this task so the error is + * apparent (no output will be displayed). */ + vMainDeleteMe(); + } + + /* Writing off the end of the RAM allocated to this task will *NOT* cause a + * protection fault because the task is still executing in a privileged mode. + * Uncomment the following to test. */ + /*cPrivilegedOnlyAccessArray[ mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ] = 'a';*/ + + /* Now set the task into user mode. */ + portSWITCH_TO_USER_MODE(); + + /* Accessing the privileged only array will now cause a fault. Uncomment + * the following line to test. */ + /*cPrivilegedOnlyAccessArray[ 0 ] = 'a';*/ + + /* The read/write array can still be successfully read and written. */ + for( x = 0; x < mainREAD_WRITE_ALIGN_SIZE; x++ ) + { + cReadWriteArray[ x ] = 'a'; + + if( cReadWriteArray[ x ] != 'a' ) + { + /* Something unexpected happened. Delete this task so the error is + * apparent (no output will be displayed). */ + vMainDeleteMe(); + } + } + + /* But attempting to read or write off the end of the RAM allocated to this + * task will cause a fault. Uncomment either of the following two lines to + * test. */ + /* cReadWriteArray[ 0 ] = cReadWriteArray[ -1 ]; */ + /* cReadWriteArray[ mainREAD_WRITE_ALIGN_SIZE ] = 0x00; */ + + /* The read only array can be successfully read... */ + for( x = 0; x < mainREAD_ONLY_ALIGN_SIZE; x++ ) + { + cTemp = cReadOnlyArray[ x ]; + } + + /* ...but cannot be written. Uncomment the following line to test. */ + /* cReadOnlyArray[ 0 ] = 'a'; */ + + /* Writing to the first and last locations in the stack array should not + * cause a protection fault. Note that doing this will cause the kernel to + * detect a stack overflow if configCHECK_FOR_STACK_OVERFLOW is greater than + * 1, hence the test is commented out by default. */ + + /* xCheckTaskStack[ 0 ] = 0; + * xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS - 1 ] = 0; */ + + /* Writing off either end of the stack array should cause a protection + * fault, uncomment either of the following two lines to test. */ + /* xCheckTaskStack[ -1 ] = 0; */ + /* xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS ] = 0; */ + + ( void ) cTemp; } /*-----------------------------------------------------------*/ static void prvExerciseEventGroupAPI( void ) { -EventGroupHandle_t xEventGroup; -EventBits_t xBits; -const EventBits_t xBitsToWaitFor = ( EventBits_t ) 0xff, xBitToClear = ( EventBits_t ) 0x01; - - /* Exercise some event group functions. */ - xEventGroup = xEventGroupCreate(); - configASSERT( xEventGroup ); - - /* No bits should be set. */ - xBits = xEventGroupWaitBits( xEventGroup, xBitsToWaitFor, pdTRUE, pdFALSE, mainDONT_BLOCK ); - configASSERT( xBits == ( EventBits_t ) 0 ); - - /* Set bits and read back to ensure the bits were set. */ - xEventGroupSetBits( xEventGroup, xBitsToWaitFor ); - xBits = xEventGroupGetBits( xEventGroup ); - configASSERT( xBits == xBitsToWaitFor ); - - /* Clear a bit and read back again using a different API function. */ - xEventGroupClearBits( xEventGroup, xBitToClear ); - xBits = xEventGroupSync( xEventGroup, 0x00, xBitsToWaitFor, mainDONT_BLOCK ); - configASSERT( xBits == ( xBitsToWaitFor & ~xBitToClear ) ); - - /* Finished with the event group. */ - vEventGroupDelete( xEventGroup ); + EventGroupHandle_t xEventGroup; + EventBits_t xBits; + const EventBits_t xBitsToWaitFor = ( EventBits_t ) 0xff, xBitToClear = ( EventBits_t ) 0x01; + + /* Exercise some event group functions. */ + xEventGroup = xEventGroupCreate(); + configASSERT( xEventGroup ); + + /* No bits should be set. */ + xBits = xEventGroupWaitBits( xEventGroup, xBitsToWaitFor, pdTRUE, pdFALSE, mainDONT_BLOCK ); + configASSERT( xBits == ( EventBits_t ) 0 ); + + /* Set bits and read back to ensure the bits were set. */ + xEventGroupSetBits( xEventGroup, xBitsToWaitFor ); + xBits = xEventGroupGetBits( xEventGroup ); + configASSERT( xBits == xBitsToWaitFor ); + + /* Clear a bit and read back again using a different API function. */ + xEventGroupClearBits( xEventGroup, xBitToClear ); + xBits = xEventGroupSync( xEventGroup, 0x00, xBitsToWaitFor, mainDONT_BLOCK ); + configASSERT( xBits == ( xBitsToWaitFor & ~xBitToClear ) ); + + /* Finished with the event group. */ + vEventGroupDelete( xEventGroup ); } /*-----------------------------------------------------------*/ static void prvExerciseSemaphoreAPI( void ) { -SemaphoreHandle_t xSemaphore; -const UBaseType_t uxMaxCount = 5, uxInitialCount = 0; - - /* Most of the semaphore API is common to the queue API and is already being - used. This function uses a few semaphore functions that are unique to the - RTOS objects, rather than generic and used by queues also. - - First create and use a counting semaphore. */ - xSemaphore = xSemaphoreCreateCounting( uxMaxCount, uxInitialCount ); - configASSERT( xSemaphore ); - - /* Give the semaphore a couple of times and ensure the count is returned - correctly. */ - xSemaphoreGive( xSemaphore ); - xSemaphoreGive( xSemaphore ); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 2 ); - vSemaphoreDelete( xSemaphore ); - - /* Create a recursive mutex, and ensure the mutex holder and count are - returned returned correctly. */ - xSemaphore = xSemaphoreCreateRecursiveMutex(); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); - configASSERT( xSemaphore ); - xSemaphoreTakeRecursive( xSemaphore, mainDONT_BLOCK ); - xSemaphoreTakeRecursive( xSemaphore, mainDONT_BLOCK ); - configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetCurrentTaskHandle() ); - configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetHandle( mainTASK_TO_DELETE_NAME ) ); - xSemaphoreGiveRecursive( xSemaphore ); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 0 ); - xSemaphoreGiveRecursive( xSemaphore ); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); - configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == NULL ); - vSemaphoreDelete( xSemaphore ); - - /* Create a normal mutex, and sure the mutex holder and count are returned - returned correctly. */ - xSemaphore = xSemaphoreCreateMutex(); - configASSERT( xSemaphore ); - xSemaphoreTake( xSemaphore, mainDONT_BLOCK ); - xSemaphoreTake( xSemaphore, mainDONT_BLOCK ); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 0 ); /* Not recursive so can only be 1. */ - configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetCurrentTaskHandle() ); - xSemaphoreGive( xSemaphore ); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); - configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == NULL ); - vSemaphoreDelete( xSemaphore ); + SemaphoreHandle_t xSemaphore; + const UBaseType_t uxMaxCount = 5, uxInitialCount = 0; + + /* Most of the semaphore API is common to the queue API and is already being + * used. This function uses a few semaphore functions that are unique to the + * RTOS objects, rather than generic and used by queues also. + * + * First create and use a counting semaphore. */ + xSemaphore = xSemaphoreCreateCounting( uxMaxCount, uxInitialCount ); + configASSERT( xSemaphore ); + + /* Give the semaphore a couple of times and ensure the count is returned + * correctly. */ + xSemaphoreGive( xSemaphore ); + xSemaphoreGive( xSemaphore ); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 2 ); + vSemaphoreDelete( xSemaphore ); + + /* Create a recursive mutex, and ensure the mutex holder and count are + * returned returned correctly. */ + xSemaphore = xSemaphoreCreateRecursiveMutex(); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); + configASSERT( xSemaphore ); + xSemaphoreTakeRecursive( xSemaphore, mainDONT_BLOCK ); + xSemaphoreTakeRecursive( xSemaphore, mainDONT_BLOCK ); + configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetCurrentTaskHandle() ); + configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetHandle( mainTASK_TO_DELETE_NAME ) ); + xSemaphoreGiveRecursive( xSemaphore ); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 0 ); + xSemaphoreGiveRecursive( xSemaphore ); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); + configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == NULL ); + vSemaphoreDelete( xSemaphore ); + + /* Create a normal mutex, and sure the mutex holder and count are returned + * returned correctly. */ + xSemaphore = xSemaphoreCreateMutex(); + configASSERT( xSemaphore ); + xSemaphoreTake( xSemaphore, mainDONT_BLOCK ); + xSemaphoreTake( xSemaphore, mainDONT_BLOCK ); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 0 ); /* Not recursive so can only be 1. */ + configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetCurrentTaskHandle() ); + xSemaphoreGive( xSemaphore ); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); + configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == NULL ); + vSemaphoreDelete( xSemaphore ); } /*-----------------------------------------------------------*/ static void prvExerciseTaskNotificationAPI( void ) { -uint32_t ulNotificationValue; -BaseType_t xReturned; - - /* The task should not yet have a notification pending. */ - xReturned = xTaskNotifyWait( 0, 0, &ulNotificationValue, mainDONT_BLOCK ); - configASSERT( xReturned == pdFAIL ); - configASSERT( ulNotificationValue == 0UL ); - - /* Exercise the 'give' and 'take' versions of the notification API. */ - xTaskNotifyGive( xTaskGetCurrentTaskHandle() ); - xTaskNotifyGive( xTaskGetCurrentTaskHandle() ); - ulNotificationValue = ulTaskNotifyTake( pdTRUE, mainDONT_BLOCK ); - configASSERT( ulNotificationValue == 2 ); - - /* Exercise the 'notify' and 'clear' API. */ - ulNotificationValue = 20; - xTaskNotify( xTaskGetCurrentTaskHandle(), ulNotificationValue, eSetValueWithOverwrite ); - ulNotificationValue = 0; - xReturned = xTaskNotifyWait( 0, 0, &ulNotificationValue, mainDONT_BLOCK ); - configASSERT( xReturned == pdPASS ); - configASSERT( ulNotificationValue == 20 ); - xTaskNotify( xTaskGetCurrentTaskHandle(), ulNotificationValue, eSetValueWithOverwrite ); - xReturned = xTaskNotifyStateClear( NULL ); - configASSERT( xReturned == pdTRUE ); /* First time a notification was pending. */ - xReturned = xTaskNotifyStateClear( NULL ); - configASSERT( xReturned == pdFALSE ); /* Second time the notification was already clear. */ + uint32_t ulNotificationValue; + BaseType_t xReturned; + + /* The task should not yet have a notification pending. */ + xReturned = xTaskNotifyWait( 0, 0, &ulNotificationValue, mainDONT_BLOCK ); + configASSERT( xReturned == pdFAIL ); + configASSERT( ulNotificationValue == 0UL ); + + /* Exercise the 'give' and 'take' versions of the notification API. */ + xTaskNotifyGive( xTaskGetCurrentTaskHandle() ); + xTaskNotifyGive( xTaskGetCurrentTaskHandle() ); + ulNotificationValue = ulTaskNotifyTake( pdTRUE, mainDONT_BLOCK ); + configASSERT( ulNotificationValue == 2 ); + + /* Exercise the 'notify' and 'clear' API. */ + ulNotificationValue = 20; + xTaskNotify( xTaskGetCurrentTaskHandle(), ulNotificationValue, eSetValueWithOverwrite ); + ulNotificationValue = 0; + xReturned = xTaskNotifyWait( 0, 0, &ulNotificationValue, mainDONT_BLOCK ); + configASSERT( xReturned == pdPASS ); + configASSERT( ulNotificationValue == 20 ); + xTaskNotify( xTaskGetCurrentTaskHandle(), ulNotificationValue, eSetValueWithOverwrite ); + xReturned = xTaskNotifyStateClear( NULL ); + configASSERT( xReturned == pdTRUE ); /* First time a notification was pending. */ + xReturned = xTaskNotifyStateClear( NULL ); + configASSERT( xReturned == pdFALSE ); /* Second time the notification was already clear. */ } /*-----------------------------------------------------------*/ -static void prvTaskToDelete( void *pvParameters ) +static void prvTaskToDelete( void * pvParameters ) { - /* Remove compiler warnings about unused parameters. */ - ( void ) pvParameters; - - /* Check the enter and exit critical macros are working correctly. If the - SVC priority is below configMAX_SYSCALL_INTERRUPT_PRIORITY then this will - fault. */ - #if( configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS == 1 ) - { - taskENTER_CRITICAL(); - taskEXIT_CRITICAL(); - } - #endif - - /* Exercise the API of various RTOS objects. */ - prvExerciseEventGroupAPI(); - prvExerciseSemaphoreAPI(); - prvExerciseTaskNotificationAPI(); - prvExerciseStreamBufferAPI(); - prvExerciseTimerAPI(); - - /* For code coverage test purposes it is deleted by the Idle task. */ - configASSERT( uxTaskGetStackHighWaterMark( NULL ) > 0 ); - configASSERT( uxTaskGetStackHighWaterMark2( NULL ) > 0 ); - /* Run time stats are not being gathered - this is just to exercise - API. */ - configASSERT( ulTaskGetIdleRunTimeCounter() == 0 ); - vTaskSuspend( NULL ); + /* Remove compiler warnings about unused parameters. */ + ( void ) pvParameters; + + /* Check the enter and exit critical macros are working correctly. If the + * SVC priority is below configMAX_SYSCALL_INTERRUPT_PRIORITY then this will + * fault. */ + #if ( configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS == 1 ) + { + taskENTER_CRITICAL(); + taskEXIT_CRITICAL(); + } + #endif + + /* Exercise the API of various RTOS objects. */ + prvExerciseEventGroupAPI(); + prvExerciseSemaphoreAPI(); + prvExerciseTaskNotificationAPI(); + prvExerciseStreamBufferAPI(); + prvExerciseTimerAPI(); + + /* For code coverage test purposes it is deleted by the Idle task. */ + configASSERT( uxTaskGetStackHighWaterMark( NULL ) > 0 ); + configASSERT( uxTaskGetStackHighWaterMark2( NULL ) > 0 ); + + /* Run time stats are not being gathered - this is just to exercise + * API. */ + configASSERT( ulTaskGetIdleRunTimeCounter() == 0 ); + vTaskSuspend( NULL ); } /*-----------------------------------------------------------*/ -static void prvPendedFunctionCall( void *pvParameter1, uint32_t ulParameter2 ) +static void prvPendedFunctionCall( void * pvParameter1, + uint32_t ulParameter2 ) { -uint32_t *pulCounter = ( uint32_t * ) pvParameter1; + uint32_t * pulCounter = ( uint32_t * ) pvParameter1; - /* Increment the paramater to show the pended function has executed. */ - ( *pulCounter )++; + /* Increment the paramater to show the pended function has executed. */ + ( *pulCounter )++; } /*-----------------------------------------------------------*/ static void prvTestTimerCallback( TimerHandle_t xTimer ) { -uint32_t ulTimerID; + uint32_t ulTimerID; - /* Increment the timer's ID to show the callback has executed. */ - ulTimerID = ( uint32_t ) pvTimerGetTimerID( xTimer ); - ulTimerID++; - vTimerSetTimerID( xTimer, ( void * ) ulTimerID ); + /* Increment the timer's ID to show the callback has executed. */ + ulTimerID = ( uint32_t ) pvTimerGetTimerID( xTimer ); + ulTimerID++; + vTimerSetTimerID( xTimer, ( void * ) ulTimerID ); } /*-----------------------------------------------------------*/ static void prvExerciseTimerAPI( void ) { -TimerHandle_t xTimer; -const char * const pcTimerName = "TestTimer"; -const TickType_t x3ms = pdMS_TO_TICKS( 3 ); -uint32_t ulValueForTesting = 0; - - xTimer = xTimerCreate( pcTimerName, - x3ms, - pdFALSE, /* Created as a one-shot timer. */ - 0, - prvTestTimerCallback ); - configASSERT( xTimer ); - configASSERT( xTimerIsTimerActive( xTimer ) == pdFALSE ); - configASSERT( xTimerGetTimerDaemonTaskHandle() != NULL ); - configASSERT( strcmp( pcTimerName, pcTimerGetName( xTimer ) ) == 0 ); - configASSERT( xTimerGetPeriod( xTimer ) == x3ms ); - - /* Pend a function then wait for it to execute. All it does is increment - its parameter. */ - xTimerPendFunctionCall( prvPendedFunctionCall, &ulValueForTesting, 0, 0 ); - vTaskDelay( x3ms ); - configASSERT( ulValueForTesting == 1 ); - - /* Timer was created as a one-shot timer. Its callback just increments the - timer's ID - so set the ID to 0, let the timer run for a number of timeout - periods, then check the timer has only executed once. */ - vTimerSetTimerID( xTimer, ( void * ) 0 ); - xTimerStart( xTimer, 0 ); - vTaskDelay( 3UL * x3ms ); - configASSERT( ( ( uint32_t ) ( pvTimerGetTimerID( xTimer ) ) ) == 1UL ); - - /* Now change the timer to be an auto-reload timer and check it executes - the expected number of times. */ - vTimerSetReloadMode( xTimer, pdTRUE ); - xTimerStart( xTimer, 0 ); - vTaskDelay( 3UL * x3ms ); - configASSERT( ( uint32_t ) ( pvTimerGetTimerID( xTimer ) ) > 3UL ); - configASSERT( xTimerStop( xTimer, 0 ) != pdFAIL ); - - /* Clean up at the end. */ - xTimerDelete( xTimer, portMAX_DELAY ); + TimerHandle_t xTimer; + const char * const pcTimerName = "TestTimer"; + const TickType_t x3ms = pdMS_TO_TICKS( 3 ); + uint32_t ulValueForTesting = 0; + + xTimer = xTimerCreate( pcTimerName, + x3ms, + pdFALSE, /* Created as a one-shot timer. */ + 0, + prvTestTimerCallback ); + configASSERT( xTimer ); + configASSERT( xTimerIsTimerActive( xTimer ) == pdFALSE ); + configASSERT( xTimerGetTimerDaemonTaskHandle() != NULL ); + configASSERT( strcmp( pcTimerName, pcTimerGetName( xTimer ) ) == 0 ); + configASSERT( xTimerGetPeriod( xTimer ) == x3ms ); + + /* Pend a function then wait for it to execute. All it does is increment + * its parameter. */ + xTimerPendFunctionCall( prvPendedFunctionCall, &ulValueForTesting, 0, 0 ); + vTaskDelay( x3ms ); + configASSERT( ulValueForTesting == 1 ); + + /* Timer was created as a one-shot timer. Its callback just increments the + * timer's ID - so set the ID to 0, let the timer run for a number of timeout + * periods, then check the timer has only executed once. */ + vTimerSetTimerID( xTimer, ( void * ) 0 ); + xTimerStart( xTimer, 0 ); + vTaskDelay( 3UL * x3ms ); + configASSERT( ( ( uint32_t ) ( pvTimerGetTimerID( xTimer ) ) ) == 1UL ); + + /* Now change the timer to be an auto-reload timer and check it executes + * the expected number of times. */ + vTimerSetReloadMode( xTimer, pdTRUE ); + xTimerStart( xTimer, 0 ); + vTaskDelay( 3UL * x3ms ); + configASSERT( ( uint32_t ) ( pvTimerGetTimerID( xTimer ) ) > 3UL ); + configASSERT( xTimerStop( xTimer, 0 ) != pdFAIL ); + + /* Clean up at the end. */ + xTimerDelete( xTimer, portMAX_DELAY ); } /*-----------------------------------------------------------*/ static void prvExerciseStreamBufferAPI( void ) { -uint8_t ucBuffer[ 10 ]; -BaseType_t x, xRead; -size_t xReturned; -StreamBufferHandle_t xStreamBuffer; - - /* Just makes API calls to ensure the MPU versions are used. */ - - xStreamBuffer = xStreamBufferCreate( sizeof( ucBuffer ) , 1 ); - configASSERT( xStreamBuffer ); - - for( x = 0; x < ( sizeof( ucBuffer ) * 2 ); x++ ) - { - /* Write and check the value is written, then read and check the value - read is expected. */ - xReturned = xStreamBufferSend( xStreamBuffer, - ( void * ) &x, - sizeof( x ), - 0 ); - configASSERT( xReturned == sizeof( x ) ); - - xReturned = xStreamBufferReceive( xStreamBuffer, - ( void * ) &xRead, - sizeof( xRead ), - 0 ); - configASSERT( xReturned == sizeof( xRead ) ); - configASSERT( xRead == x ); - configASSERT( xStreamBufferIsFull( xStreamBuffer ) == pdFALSE ); - configASSERT( xStreamBufferIsEmpty( xStreamBuffer ) == pdTRUE ); - configASSERT( xStreamBufferSpacesAvailable( xStreamBuffer ) == sizeof( ucBuffer ) ); - configASSERT( xStreamBufferBytesAvailable( xStreamBuffer ) == 0 ); - } - - /* Call the functions that have not been exercised yet before finishing by - deleting the stream buffer. */ - configASSERT( xStreamBufferSetTriggerLevel( xStreamBuffer, 0 ) == pdTRUE ); - configASSERT( xStreamBufferReset( xStreamBuffer ) == pdPASS ); - vStreamBufferDelete( xStreamBuffer ); + uint8_t ucBuffer[ 10 ]; + BaseType_t x, xRead; + size_t xReturned; + StreamBufferHandle_t xStreamBuffer; + + /* Just makes API calls to ensure the MPU versions are used. */ + + xStreamBuffer = xStreamBufferCreate( sizeof( ucBuffer ), 1 ); + configASSERT( xStreamBuffer ); + + for( x = 0; x < ( sizeof( ucBuffer ) * 2 ); x++ ) + { + /* Write and check the value is written, then read and check the value + * read is expected. */ + xReturned = xStreamBufferSend( xStreamBuffer, + ( void * ) &x, + sizeof( x ), + 0 ); + configASSERT( xReturned == sizeof( x ) ); + + xReturned = xStreamBufferReceive( xStreamBuffer, + ( void * ) &xRead, + sizeof( xRead ), + 0 ); + configASSERT( xReturned == sizeof( xRead ) ); + configASSERT( xRead == x ); + configASSERT( xStreamBufferIsFull( xStreamBuffer ) == pdFALSE ); + configASSERT( xStreamBufferIsEmpty( xStreamBuffer ) == pdTRUE ); + configASSERT( xStreamBufferSpacesAvailable( xStreamBuffer ) == sizeof( ucBuffer ) ); + configASSERT( xStreamBufferBytesAvailable( xStreamBuffer ) == 0 ); + } + + /* Call the functions that have not been exercised yet before finishing by + * deleting the stream buffer. */ + configASSERT( xStreamBufferSetTriggerLevel( xStreamBuffer, 0 ) == pdTRUE ); + configASSERT( xStreamBufferReset( xStreamBuffer ) == pdPASS ); + vStreamBufferDelete( xStreamBuffer ); } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile const uint32_t *pul; -volatile uint32_t ulReadData; - - /* The idle task, and therefore this function, run in Supervisor mode and - can therefore access all memory. Try reading from corners of flash and - RAM to ensure a memory fault does not occur. - - Start with the edges of the privileged data area. */ - pul = __privileged_data_start__; - ulReadData = *pul; - pul = __privileged_data_end__ - 1; - ulReadData = *pul; - - /* Next the standard SRAM area. */ - pul = __SRAM_segment_end__ - 1; - ulReadData = *pul; - - /* And the standard Flash area - the start of which is marked for - privileged access only. */ - pul = __FLASH_segment_start__; - ulReadData = *pul; - pul = __FLASH_segment_end__ - 1; - ulReadData = *pul; - - /* Reading off the end of Flash or SRAM space should cause a fault. - Uncomment one of the following two pairs of lines to test. */ - - /* pul = __FLASH_segment_end__ + 4; - ulReadData = *pul; */ - - /* pul = __SRAM_segment_end__ + 1; - ulReadData = *pul; */ - - /* One task is created purely so it can be deleted - done for code coverage - test purposes. */ - if( xTaskToDelete != NULL ) - { - if( eTaskGetState( xTaskToDelete ) == eSuspended ) - { - /* The task has finished its tests and can be deleted. */ - vTaskDelete( xTaskToDelete ); - xTaskToDelete = NULL; - } - } - - ( void ) ulReadData; + volatile const uint32_t * pul; + volatile uint32_t ulReadData; + + /* The idle task, and therefore this function, run in Supervisor mode and + * can therefore access all memory. Try reading from corners of flash and + * RAM to ensure a memory fault does not occur. + * + * Start with the edges of the privileged data area. */ + pul = __privileged_data_start__; + ulReadData = *pul; + pul = __privileged_data_end__ - 1; + ulReadData = *pul; + + /* Next the standard SRAM area. */ + pul = __SRAM_segment_end__ - 1; + ulReadData = *pul; + + /* And the standard Flash area - the start of which is marked for + * privileged access only. */ + pul = __FLASH_segment_start__; + ulReadData = *pul; + pul = __FLASH_segment_end__ - 1; + ulReadData = *pul; + + /* Reading off the end of Flash or SRAM space should cause a fault. + * Uncomment one of the following two pairs of lines to test. */ + + /* pul = __FLASH_segment_end__ + 4; + * ulReadData = *pul; */ + + /* pul = __SRAM_segment_end__ + 1; + * ulReadData = *pul; */ + + /* One task is created purely so it can be deleted - done for code coverage + * test purposes. */ + if( xTaskToDelete != NULL ) + { + if( eTaskGetState( xTaskToDelete ) == eSuspended ) + { + /* The task has finished its tests and can be deleted. */ + vTaskDelete( xTaskToDelete ); + xTaskToDelete = NULL; + } + } + + ( void ) ulReadData; } /*-----------------------------------------------------------*/ static void prvOldStyleUserModeTask( void ) { /*const volatile uint32_t *pulStandardPeripheralRegister = ( volatile uint32_t * ) 0x40000000;*/ -volatile const uint32_t *pul; -volatile uint32_t ulReadData; + volatile const uint32_t * pul; + volatile uint32_t ulReadData; /* The following lines are commented out to prevent the unused variable -compiler warnings when the tests that use the variable are also commented out. */ + * compiler warnings when the tests that use the variable are also commented out. */ /* extern uint32_t __privileged_functions_start__[]; */ /* const volatile uint32_t *pulSystemPeripheralRegister = ( volatile uint32_t * ) 0xe000e014; */ - /* This task is created in User mode using the original xTaskCreate() API - function. It should have access to all Flash and RAM except that marked - as Privileged access only. Reading from the start and end of the non- - privileged RAM should not cause a problem (the privileged RAM is the first - block at the bottom of the RAM memory). */ - pul = __privileged_data_end__ + 1; - ulReadData = *pul; - pul = __SRAM_segment_end__ - 1; - ulReadData = *pul; - - /* Likewise reading from the start and end of the non-privileged Flash - should not be a problem (the privileged Flash is the first block at the - bottom of the Flash memory). */ - pul = __privileged_functions_end__ + 1; - ulReadData = *pul; - pul = __FLASH_segment_end__ - 1; - ulReadData = *pul; - - /* Standard peripherals are accessible. */ - /*ulReadData = *pulStandardPeripheralRegister;*/ - - /* System peripherals are not accessible. Uncomment the following line - to test. Also uncomment the declaration of pulSystemPeripheralRegister - at the top of this function. - ulReadData = *pulSystemPeripheralRegister; */ - - /* Reading from anywhere inside the privileged Flash or RAM should cause a - fault. This can be tested by uncommenting any of the following pairs of - lines. Also uncomment the declaration of __privileged_functions_start__ - at the top of this function. */ - - /*pul = __privileged_functions_start__; - ulReadData = *pul;*/ - - /*pul = __privileged_functions_end__ - 1; - ulReadData = *pul;*/ - - /*pul = __privileged_data_start__; - ulReadData = *pul;*/ - - /*pul = __privileged_data_end__ - 1; - ulReadData = *pul;*/ - - ( void ) ulReadData; + /* This task is created in User mode using the original xTaskCreate() API + * function. It should have access to all Flash and RAM except that marked + * as Privileged access only. Reading from the start and end of the non- + * privileged RAM should not cause a problem (the privileged RAM is the first + * block at the bottom of the RAM memory). */ + pul = __privileged_data_end__ + 1; + ulReadData = *pul; + pul = __SRAM_segment_end__ - 1; + ulReadData = *pul; + + /* Likewise reading from the start and end of the non-privileged Flash + * should not be a problem (the privileged Flash is the first block at the + * bottom of the Flash memory). */ + pul = __privileged_functions_end__ + 1; + ulReadData = *pul; + pul = __FLASH_segment_end__ - 1; + ulReadData = *pul; + + /* Standard peripherals are accessible. */ + /*ulReadData = *pulStandardPeripheralRegister;*/ + + /* System peripherals are not accessible. Uncomment the following line + * to test. Also uncomment the declaration of pulSystemPeripheralRegister + * at the top of this function. + * ulReadData = *pulSystemPeripheralRegister; */ + + /* Reading from anywhere inside the privileged Flash or RAM should cause a + * fault. This can be tested by uncommenting any of the following pairs of + * lines. Also uncomment the declaration of __privileged_functions_start__ + * at the top of this function. */ + + /*pul = __privileged_functions_start__; + * ulReadData = *pul;*/ + + /*pul = __privileged_functions_end__ - 1; + * ulReadData = *pul;*/ + + /*pul = __privileged_data_start__; + * ulReadData = *pul;*/ + + /*pul = __privileged_data_end__ - 1; + * ulReadData = *pul;*/ + + ( void ) ulReadData; } /*-----------------------------------------------------------*/ -static void prvOldStylePrivilegedModeTask( void *pvParameters ) +static void prvOldStylePrivilegedModeTask( void * pvParameters ) { -volatile const uint32_t *pul; -volatile uint32_t ulReadData; -const volatile uint32_t *pulSystemPeripheralRegister = ( volatile uint32_t * ) 0xe000e014; /* Systick */ + volatile const uint32_t * pul; + volatile uint32_t ulReadData; + const volatile uint32_t * pulSystemPeripheralRegister = ( volatile uint32_t * ) 0xe000e014; /* Systick */ + /*const volatile uint32_t *pulStandardPeripheralRegister = ( volatile uint32_t * ) 0x40000000;*/ - ( void ) pvParameters; - - /* This task is created in Privileged mode using the original xTaskCreate() - API function. It should have access to all Flash and RAM including that - marked as Privileged access only. So reading from the start and end of the - non-privileged RAM should not cause a problem (the privileged RAM is the - first block at the bottom of the RAM memory). */ - pul = __privileged_data_end__ + 1; - ulReadData = *pul; - pul = __SRAM_segment_end__ - 1; - ulReadData = *pul; - - /* Likewise reading from the start and end of the non-privileged Flash - should not be a problem (the privileged Flash is the first block at the - bottom of the Flash memory). */ - pul = __privileged_functions_end__ + 1; - ulReadData = *pul; - pul = __FLASH_segment_end__ - 1; - ulReadData = *pul; - - /* Reading from anywhere inside the privileged Flash or RAM should also - not be a problem. */ - pul = __privileged_functions_start__; - ulReadData = *pul; - pul = __privileged_functions_end__ - 1; - ulReadData = *pul; - pul = __privileged_data_start__; - ulReadData = *pul; - pul = __privileged_data_end__ - 1; - ulReadData = *pul; - - /* Finally, accessing both System and normal peripherals should both be - possible. */ - ulReadData = *pulSystemPeripheralRegister; - /*ulReadData = *pulStandardPeripheralRegister;*/ - - /* Must not just run off the end of a task function, so delete this task. - Note that because this task was created using xTaskCreate() the stack was - allocated dynamically and I have not included any code to free it again. */ - vTaskDelete( NULL ); - - ( void ) ulReadData; + ( void ) pvParameters; + + /* This task is created in Privileged mode using the original xTaskCreate() + * API function. It should have access to all Flash and RAM including that + * marked as Privileged access only. So reading from the start and end of the + * non-privileged RAM should not cause a problem (the privileged RAM is the + * first block at the bottom of the RAM memory). */ + pul = __privileged_data_end__ + 1; + ulReadData = *pul; + pul = __SRAM_segment_end__ - 1; + ulReadData = *pul; + + /* Likewise reading from the start and end of the non-privileged Flash + * should not be a problem (the privileged Flash is the first block at the + * bottom of the Flash memory). */ + pul = __privileged_functions_end__ + 1; + ulReadData = *pul; + pul = __FLASH_segment_end__ - 1; + ulReadData = *pul; + + /* Reading from anywhere inside the privileged Flash or RAM should also + * not be a problem. */ + pul = __privileged_functions_start__; + ulReadData = *pul; + pul = __privileged_functions_end__ - 1; + ulReadData = *pul; + pul = __privileged_data_start__; + ulReadData = *pul; + pul = __privileged_data_end__ - 1; + ulReadData = *pul; + + /* Finally, accessing both System and normal peripherals should both be + * possible. */ + ulReadData = *pulSystemPeripheralRegister; + /*ulReadData = *pulStandardPeripheralRegister;*/ + + /* Must not just run off the end of a task function, so delete this task. + * Note that because this task was created using xTaskCreate() the stack was + * allocated dynamically and I have not included any code to free it again. */ + vTaskDelete( NULL ); + + ( void ) ulReadData; } /*-----------------------------------------------------------*/ void vMainDeleteMe( void ) { - vTaskDelete( NULL ); + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ -void vMainSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber ) +void vMainSendImAlive( QueueHandle_t xHandle, + uint32_t ulTaskNumber ) { - if( xHandle != NULL ) - { - xQueueSend( xHandle, &ulTaskNumber, mainDONT_BLOCK ); - } + if( xHandle != NULL ) + { + xQueueSend( xHandle, &ulTaskNumber, mainDONT_BLOCK ); + } } /*-----------------------------------------------------------*/ @@ -1117,158 +1133,167 @@ static void prvSetupHardware( void ) void vApplicationTickHook( void ) { -static uint32_t ulCallCount = 0; -const uint32_t ulCallsBetweenSends = pdMS_TO_TICKS( 1000 ); -const uint32_t ulMessage = configPRINT_SYSTEM_STATUS; -portBASE_TYPE xDummy; - - /* If configUSE_TICK_HOOK is set to 1 then this function will get called - from each RTOS tick. It is called from the tick interrupt and therefore - will be executing in the privileged state. */ - - ulCallCount++; - - /* Is it time to print out the pass/fail message again? */ - if( ulCallCount >= ulCallsBetweenSends ) - { - ulCallCount = 0; - - /* Send a message to the check task to command it to check that all - the tasks are still running then print out the status. - - This is running in an ISR so has to use the "FromISR" version of - xQueueSend(). Because it is in an ISR it is running with privileges - so can access xGlobalScopeCheckQueue directly. */ - xQueueSendFromISR( xGlobalScopeCheckQueue, &ulMessage, &xDummy ); - } + static uint32_t ulCallCount = 0; + const uint32_t ulCallsBetweenSends = pdMS_TO_TICKS( 1000 ); + const uint32_t ulMessage = configPRINT_SYSTEM_STATUS; + portBASE_TYPE xDummy; + + /* If configUSE_TICK_HOOK is set to 1 then this function will get called + * from each RTOS tick. It is called from the tick interrupt and therefore + * will be executing in the privileged state. */ + + ulCallCount++; + + /* Is it time to print out the pass/fail message again? */ + if( ulCallCount >= ulCallsBetweenSends ) + { + ulCallCount = 0; + + /* Send a message to the check task to command it to check that all + * the tasks are still running then print out the status. + * + * This is running in an ISR so has to use the "FromISR" version of + * xQueueSend(). Because it is in an ISR it is running with privileges + * so can access xGlobalScopeCheckQueue directly. */ + xQueueSendFromISR( xGlobalScopeCheckQueue, &ulMessage, &xDummy ); + } } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - /* If configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2 then this - function will automatically get called if a task overflows its stack. */ - ( void ) pxTask; - ( void ) pcTaskName; - for( ;; ); + /* If configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2 then this + * function will automatically get called if a task overflows its stack. */ + ( void ) pxTask; + ( void ) pcTaskName; + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* If configUSE_MALLOC_FAILED_HOOK is set to 1 then this function will - be called automatically if a call to pvPortMalloc() fails. pvPortMalloc() - is called automatically when a task, queue or semaphore is created. */ - for( ;; ); + /* If configUSE_MALLOC_FAILED_HOOK is set to 1 then this function will + * be called automatically if a call to pvPortMalloc() fails. pvPortMalloc() + * is called automatically when a task, queue or semaphore is created. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ static void prvTimerCallback( TimerHandle_t xExpiredTimer ) { -uint32_t ulCount; + uint32_t ulCount; - /* The count of the number of times this timer has expired is saved in the - timer's ID. Obtain the current count. */ - ulCount = ( uint32_t ) pvTimerGetTimerID( xTimer ); + /* The count of the number of times this timer has expired is saved in the + * timer's ID. Obtain the current count. */ + ulCount = ( uint32_t ) pvTimerGetTimerID( xTimer ); - /* Increment the count, and save it back into the timer's ID. */ - ulCount++; - vTimerSetTimerID( xTimer, ( void * ) ulCount ); + /* Increment the count, and save it back into the timer's ID. */ + ulCount++; + vTimerSetTimerID( xTimer, ( void * ) ulCount ); - /* Let the check task know the timer is still running. */ - vMainSendImAlive( xGlobalScopeCheckQueue, configTIMER_STILL_EXECUTING ); + /* Let the check task know the timer is still running. */ + vMainSendImAlive( xGlobalScopeCheckQueue, configTIMER_STILL_EXECUTING ); } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an -implementation of vApplicationGetIdleTaskMemory() to provide the memory that is -used by the Idle task. */ -void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) + * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is + * used by the Idle task. */ +void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, + StackType_t ** ppxIdleTaskStackBuffer, + uint32_t * pulIdleTaskStackSize ) { /* If the buffers to be provided to the Idle task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xIdleTaskTCB; -static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Idle task's - state will be stored. */ - *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; - - /* Pass out the array that will be used as the Idle task's stack. */ - *ppxIdleTaskStackBuffer = uxIdleTaskStack; - - /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xIdleTaskTCB; + static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Idle task's + * state will be stored. */ + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + + /* Pass out the array that will be used as the Idle task's stack. */ + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + + /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the -application must provide an implementation of vApplicationGetTimerTaskMemory() -to provide the memory that is used by the Timer service task. */ -void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) + * application must provide an implementation of vApplicationGetTimerTaskMemory() + * to provide the memory that is used by the Timer service task. */ +void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, + StackType_t ** ppxTimerTaskStackBuffer, + uint32_t * pulTimerTaskStackSize ) { /* If the buffers to be provided to the Timer task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xTimerTaskTCB; -static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Timer - task's state will be stored. */ - *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; - - /* Pass out the array that will be used as the Timer task's stack. */ - *ppxTimerTaskStackBuffer = uxTimerTaskStack; - - /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xTimerTaskTCB; + static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Timer + * task's state will be stored. */ + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + + /* Pass out the array that will be used as the Timer task's stack. */ + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + + /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } /*-----------------------------------------------------------*/ -static void prvRegTest3Task( void *pvParameters ) +static void prvRegTest3Task( 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 == configREG_TEST_TASK_3_PARAMETER ) - { - /* Run the unprivileged mode access tests that used to be executed - form an unprivileged task created using the xTaskCreate() API. - Since the heap moved to the privileged data section xTaskCreate() can - no longer be used to create unprivileged tasks. */ - prvOldStyleUserModeTask(); - - /* Start the part of the test that is written in assembler. */ - vRegTest3Implementation(); - } - - /* 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 - not being incremented and flag an error. */ - vTaskDelete( NULL ); + /* 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 == configREG_TEST_TASK_3_PARAMETER ) + { + /* Run the unprivileged mode access tests that used to be executed + * form an unprivileged task created using the xTaskCreate() API. + * Since the heap moved to the privileged data section xTaskCreate() can + * no longer be used to create unprivileged tasks. */ + prvOldStyleUserModeTask(); + + /* Start the part of the test that is written in assembler. */ + vRegTest3Implementation(); + } + + /* 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 + * not being incremented and flag an error. */ + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ -static void prvRegTest4Task( void *pvParameters ) +static void prvRegTest4Task( 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 == configREG_TEST_TASK_4_PARAMETER ) - { - /* Start the part of the test that is written in assembler. */ - vRegTest4Implementation(); - } - - /* 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 - not being incremented and flag an error. */ - vTaskDelete( NULL ); + /* 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 == configREG_TEST_TASK_4_PARAMETER ) + { + /* Start the part of the test that is written in assembler. */ + vRegTest4Implementation(); + } + + /* 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 + * not being incremented and flag an error. */ + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_MPU_Static_Simulator_Keil_GCC/GCC_Specific/RegTest.c b/FreeRTOS/Demo/CORTEX_MPU_Static_Simulator_Keil_GCC/GCC_Specific/RegTest.c index 57412954d1c..06a1c6b54b9 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_Static_Simulator_Keil_GCC/GCC_Specific/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_MPU_Static_Simulator_Keil_GCC/GCC_Specific/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_Static_Simulator_Keil_GCC/Keil_Specific/RegTest.c b/FreeRTOS/Demo/CORTEX_MPU_Static_Simulator_Keil_GCC/Keil_Specific/RegTest.c index 0821c57f703..c9cae6af16a 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_Static_Simulator_Keil_GCC/Keil_Specific/RegTest.c +++ b/FreeRTOS/Demo/CORTEX_MPU_Static_Simulator_Keil_GCC/Keil_Specific/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_MPU_Static_Simulator_Keil_GCC/main.c b/FreeRTOS/Demo/CORTEX_MPU_Static_Simulator_Keil_GCC/main.c index b02b4427284..b85440d9e41 100644 --- a/FreeRTOS/Demo/CORTEX_MPU_Static_Simulator_Keil_GCC/main.c +++ b/FreeRTOS/Demo/CORTEX_MPU_Static_Simulator_Keil_GCC/main.c @@ -53,22 +53,22 @@ /*-----------------------------------------------------------*/ /* Misc constants. */ -#define mainDONT_BLOCK ( 0 ) +#define mainDONT_BLOCK ( 0 ) /* GCC specifics. */ -#define mainALIGN_TO( x ) __attribute__((aligned(x))) +#define mainALIGN_TO( x ) __attribute__( ( aligned( x ) ) ) /* Hardware register addresses. */ -#define mainVTOR ( * ( volatile uint32_t * ) 0xE000ED08 ) +#define mainVTOR ( *( volatile uint32_t * ) 0xE000ED08 ) /* The period of the timer must be less than the rate at which -configPRINT_SYSTEM_STATUS messages are sent to the check task - otherwise the -check task will think the timer has stopped. */ -#define mainTIMER_PERIOD pdMS_TO_TICKS( 200 ) + * configPRINT_SYSTEM_STATUS messages are sent to the check task - otherwise the + * check task will think the timer has stopped. */ +#define mainTIMER_PERIOD pdMS_TO_TICKS( 200 ) /* The name of the task that is deleted by the Idle task is used in a couple of -places, so is #defined. */ -#define mainTASK_TO_DELETE_NAME "DeleteMe" + * places, so is #defined. */ +#define mainTASK_TO_DELETE_NAME "DeleteMe" /*-----------------------------------------------------------*/ /* Prototypes for functions that implement tasks. -----------*/ @@ -96,8 +96,8 @@ places, so is #defined. */ * User mode, and vRegTest2Implementation() receives the task handle using its * parameter. */ -extern void vRegTest1Implementation( void *pvParameters ); -extern void vRegTest2Implementation( void *pvParameters ); +extern void vRegTest1Implementation( void * pvParameters ); +extern void vRegTest2Implementation( void * pvParameters ); /* * The second two register test tasks are similar to the first two, but do test @@ -113,9 +113,9 @@ extern void vRegTest2Implementation( void *pvParameters ); */ static StackType_t xRegTest3Stack[ configMINIMAL_STACK_SIZE ], xRegTest4Stack[ configMINIMAL_STACK_SIZE ]; static StaticTask_t xRegTest3Buffer, xRegTest4Buffer; -static void prvRegTest3Task( void *pvParameters ); +static void prvRegTest3Task( void * pvParameters ); extern void vRegTest3Implementation( void ); -static void prvRegTest4Task( void *pvParameters ); +static void prvRegTest4Task( void * pvParameters ); extern void vRegTest4Implementation( void ); /* @@ -133,7 +133,7 @@ extern void vRegTest4Implementation( void ); * either pass or fail to the terminal, depending on the status of the reg * test tasks (no write is performed in the simulator!). */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); /* * Prototype for a task created in User mode using the original vTaskCreate() @@ -145,7 +145,7 @@ static void prvCheckTask( void *pvParameters ); * this function are now called from an unprivileged register check task created * using the xTaskCreateRestricted() API. */ -static void prvOldStyleUserModeTask( void ); +static void prvOldStyleUserModeTask( void ); /* * Prototype for a task created in Privileged mode using the @@ -157,13 +157,13 @@ static void prvOldStyleUserModeTask( void ); */ static PRIVILEGED_DATA StackType_t xPrivilegedModeTaskStack[ configMINIMAL_STACK_SIZE ]; static PRIVILEGED_DATA StaticTask_t xPrivilegedModeTaskBuffer; -static void prvOldStylePrivilegedModeTask( void *pvParameters ); +static void prvOldStylePrivilegedModeTask( void * pvParameters ); /* * A task that exercises the API of various RTOS objects before being deleted by * the Idle task. This is done for MPU API code coverage test purposes. */ -static void prvTaskToDelete( void *pvParameters ); +static void prvTaskToDelete( void * pvParameters ); /* * Functions called by prvTaskToDelete() to exercise the MPU API. @@ -182,7 +182,7 @@ static void prvSetupHardware( void ); * is simpler to call from asm code than the normal vTaskDelete() API function. * It has the noinline attribute because it is called from asm code. */ -void vMainDeleteMe( void ) __attribute__((noinline)); +void vMainDeleteMe( void ) __attribute__( ( noinline ) ); /* * Used by the first two reg test tasks and a software timer callback function @@ -191,7 +191,8 @@ void vMainDeleteMe( void ) __attribute__((noinline)); * task detects an error it will delete itself, and in so doing prevent itself * from sending any more 'I'm Alive' messages to the check task. */ -void vMainSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber ); +void vMainSendImAlive( QueueHandle_t xHandle, + uint32_t ulTaskNumber ); /* * The check task is created with access to three memory regions (plus its @@ -212,130 +213,130 @@ static void prvTimerCallback( TimerHandle_t xExpiredTimer ); /*-----------------------------------------------------------*/ /* The handle of the queue used to communicate between tasks and between tasks -and interrupts. Note that this is a global scope variable that falls outside of -any MPU region. As such other techniques have to be used to allow the tasks -to gain access to the queue. See the comments in the tasks themselves for -further information. */ + * and interrupts. Note that this is a global scope variable that falls outside of + * any MPU region. As such other techniques have to be used to allow the tasks + * to gain access to the queue. See the comments in the tasks themselves for + * further information. */ QueueHandle_t xGlobalScopeCheckQueue = NULL; /* xGlobalScopeCheckQueue is created using xQueueCreateStatic(), so the storage -area and variable used to hold the queue data structure must also be provided. -These are placed in a prviliged segment. */ + * area and variable used to hold the queue data structure must also be provided. + * These are placed in a prviliged segment. */ static PRIVILEGED_DATA StaticQueue_t xGlobalScopeQueueBuffer; uint8_t PRIVILEGED_DATA ucGlobalScopeQueueStorageArea[ 1 * sizeof( uint32_t ) ]; /* Holds the handle of a task that is deleted in the idle task hook - this is -done for code coverage test purposes only. */ + * done for code coverage test purposes only. */ static TaskHandle_t xTaskToDelete = NULL; /* The timer that periodically sends data to the check task on the queue. This -is created with xTimerCreateStatic(), so the variable in which the timer's data -structure will be stored must also be provided. The structure is placed in the -kernel's privileged data region. */ + * is created with xTimerCreateStatic(), so the variable in which the timer's data + * structure will be stored must also be provided. The structure is placed in the + * kernel's privileged data region. */ static TimerHandle_t xTimer = NULL; static PRIVILEGED_DATA StaticTimer_t xTimerBuffer; -#if defined ( __GNUC__ ) - extern uint32_t __FLASH_segment_start__[]; - extern uint32_t __FLASH_segment_end__[]; - extern uint32_t __SRAM_segment_start__[]; - extern uint32_t __SRAM_segment_end__[]; - extern uint32_t __privileged_functions_start__[]; - extern uint32_t __privileged_functions_end__[]; - extern uint32_t __privileged_data_start__[]; - extern uint32_t __privileged_data_end__[]; - extern uint32_t __privileged_functions_actual_end__[]; - extern uint32_t __privileged_data_actual_end__[]; -#else - extern uint32_t Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Base; - extern uint32_t Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Limit; - - const uint32_t * __FLASH_segment_start__ = ( uint32_t * ) 0x00000000UL; - const uint32_t * __FLASH_segment_end__ = ( uint32_t * ) 0x00080000UL; - const uint32_t * __SRAM_segment_start__ = ( uint32_t * ) 0x20000000UL; - const uint32_t * __SRAM_segment_end__ = ( uint32_t * ) 0x20008000UL; - const uint32_t * __privileged_functions_start__ = ( uint32_t * ) 0x00000000UL; - const uint32_t * __privileged_functions_end__ = ( uint32_t * ) 0x00010000UL; - const uint32_t * __syscalls_flash_start__ = ( uint32_t * ) &( Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Base ); - const uint32_t * __syscalls_flash_end__ = ( uint32_t * ) &( Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Limit ); - const uint32_t * __privileged_data_start__ = ( uint32_t * ) 0x20000000UL; - const uint32_t * __privileged_data_end__ = ( uint32_t * ) 0x20004000UL; -#endif +#if defined( __GNUC__ ) + extern uint32_t __FLASH_segment_start__[]; + extern uint32_t __FLASH_segment_end__[]; + extern uint32_t __SRAM_segment_start__[]; + extern uint32_t __SRAM_segment_end__[]; + extern uint32_t __privileged_functions_start__[]; + extern uint32_t __privileged_functions_end__[]; + extern uint32_t __privileged_data_start__[]; + extern uint32_t __privileged_data_end__[]; + extern uint32_t __privileged_functions_actual_end__[]; + extern uint32_t __privileged_data_actual_end__[]; +#else /* if defined( __GNUC__ ) */ + extern uint32_t Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Base; + extern uint32_t Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Limit; + + const uint32_t * __FLASH_segment_start__ = ( uint32_t * ) 0x00000000UL; + const uint32_t * __FLASH_segment_end__ = ( uint32_t * ) 0x00080000UL; + const uint32_t * __SRAM_segment_start__ = ( uint32_t * ) 0x20000000UL; + const uint32_t * __SRAM_segment_end__ = ( uint32_t * ) 0x20008000UL; + const uint32_t * __privileged_functions_start__ = ( uint32_t * ) 0x00000000UL; + const uint32_t * __privileged_functions_end__ = ( uint32_t * ) 0x00010000UL; + const uint32_t * __syscalls_flash_start__ = ( uint32_t * ) &( Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Base ); + const uint32_t * __syscalls_flash_end__ = ( uint32_t * ) &( Image$$ER_IROM_FREERTOS_SYSTEM_CALLS$$Limit ); + const uint32_t * __privileged_data_start__ = ( uint32_t * ) 0x20000000UL; + const uint32_t * __privileged_data_end__ = ( uint32_t * ) 0x20004000UL; +#endif /* if defined( __GNUC__ ) */ /*-----------------------------------------------------------*/ /* Data used by the 'check' task. ---------------------------*/ /*-----------------------------------------------------------*/ /* Define the constants used to allocate the check task stack. Note that the -stack size is defined in words, not bytes. */ -#define mainCHECK_TASK_STACK_SIZE_WORDS 128 -#define mainCHECK_TASK_STACK_ALIGNMENT ( mainCHECK_TASK_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) + * stack size is defined in words, not bytes. */ +#define mainCHECK_TASK_STACK_SIZE_WORDS 128 +#define mainCHECK_TASK_STACK_ALIGNMENT ( mainCHECK_TASK_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) /* Declare the stack that will be used by the check task. The kernel will -automatically create an MPU region for the stack. The stack alignment must -match its size, so if 128 words are reserved for the stack then it must be -aligned to ( 128 * 4 ) bytes. */ + * automatically create an MPU region for the stack. The stack alignment must + * match its size, so if 128 words are reserved for the stack then it must be + * aligned to ( 128 * 4 ) bytes. */ static portSTACK_TYPE xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS ] mainALIGN_TO( mainCHECK_TASK_STACK_ALIGNMENT ); /* Declare the variable in which the check task's data structures will be -stored. PRIVILEGED_DATA is used to place this in the kernel's RAM segment. */ + * stored. PRIVILEGED_DATA is used to place this in the kernel's RAM segment. */ static PRIVILEGED_DATA StaticTask_t xCheckTaskBuffer; /* Declare three arrays - an MPU region will be created for each array -using the TaskParameters_t structure below. THIS IS JUST TO DEMONSTRATE THE -MPU FUNCTIONALITY, the data is not used by the check tasks primary function -of monitoring the reg test tasks and printing out status information. - -Note that the arrays allocate slightly more RAM than is actually assigned to -the MPU region. This is to permit writes off the end of the array to be -detected even when the arrays are placed in adjacent memory locations (with no -gaps between them). The align size must be a power of two. */ -#define mainREAD_WRITE_ARRAY_SIZE 130 -#define mainREAD_WRITE_ALIGN_SIZE 128 + * using the TaskParameters_t structure below. THIS IS JUST TO DEMONSTRATE THE + * MPU FUNCTIONALITY, the data is not used by the check tasks primary function + * of monitoring the reg test tasks and printing out status information. + * + * Note that the arrays allocate slightly more RAM than is actually assigned to + * the MPU region. This is to permit writes off the end of the array to be + * detected even when the arrays are placed in adjacent memory locations (with no + * gaps between them). The align size must be a power of two. */ +#define mainREAD_WRITE_ARRAY_SIZE 130 +#define mainREAD_WRITE_ALIGN_SIZE 128 char cReadWriteArray[ mainREAD_WRITE_ARRAY_SIZE ] mainALIGN_TO( mainREAD_WRITE_ALIGN_SIZE ); -#define mainREAD_ONLY_ARRAY_SIZE 260 -#define mainREAD_ONLY_ALIGN_SIZE 256 +#define mainREAD_ONLY_ARRAY_SIZE 260 +#define mainREAD_ONLY_ALIGN_SIZE 256 char cReadOnlyArray[ mainREAD_ONLY_ARRAY_SIZE ] mainALIGN_TO( mainREAD_ONLY_ALIGN_SIZE ); -#define mainPRIVILEGED_ONLY_ACCESS_ARRAY_SIZE 130 -#define mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE 128 +#define mainPRIVILEGED_ONLY_ACCESS_ARRAY_SIZE 130 +#define mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE 128 char cPrivilegedOnlyAccessArray[ mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ] mainALIGN_TO( mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ); /* The following two variables are used to communicate the status of the second -two register check tasks (tasks 3 and 4) to the check task. If the variables -keep incrementing, then the register check tasks have not discovered any errors. -If a variable stops incrementing, then an error has been found. The variables -overlay the array that the check task has access to so they can be read by the -check task without causing a memory fault. The check task has the highest -priority so will have finished with the array before the register test tasks -start to access it. */ -volatile uint32_t *pulRegTest3LoopCounter = ( uint32_t * ) &( cReadWriteArray[ 0 ] ), *pulRegTest4LoopCounter = ( uint32_t * ) &( cReadWriteArray[ 4 ] ); + * two register check tasks (tasks 3 and 4) to the check task. If the variables + * keep incrementing, then the register check tasks have not discovered any errors. + * If a variable stops incrementing, then an error has been found. The variables + * overlay the array that the check task has access to so they can be read by the + * check task without causing a memory fault. The check task has the highest + * priority so will have finished with the array before the register test tasks + * start to access it. */ +volatile uint32_t * pulRegTest3LoopCounter = ( uint32_t * ) &( cReadWriteArray[ 0 ] ), * pulRegTest4LoopCounter = ( uint32_t * ) &( cReadWriteArray[ 4 ] ); /* Fill in a TaskParameters_t structure to define the check task - this is the -structure passed to the xTaskCreateRestricted() function. */ + * structure passed to the xTaskCreateRestricted() function. */ static const TaskParameters_t xCheckTaskParameters = { - prvCheckTask, /* pvTaskCode - the function that implements the task. */ - "Check", /* pcName */ - mainCHECK_TASK_STACK_SIZE_WORDS, /* usStackDepth - defined in words, not bytes. */ - ( void * ) 0x12121212, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */ - ( tskIDLE_PRIORITY + 1 ) | portPRIVILEGE_BIT,/* uxPriority - this is the highest priority task in the system. The task is created in privileged mode to demonstrate accessing the privileged only data. */ - xCheckTaskStack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ - - /* xRegions - In this case the xRegions array is used to create MPU regions - for all three of the arrays declared directly above. Each MPU region is - created with different parameters. Again, THIS IS JUST TO DEMONSTRATE THE - MPU FUNCTIONALITY, the data is not used by the check tasks primary function - of monitoring the reg test tasks and printing out status information.*/ - { - /* Base address Length Parameters */ - { cReadWriteArray, mainREAD_WRITE_ALIGN_SIZE, portMPU_REGION_READ_WRITE }, - { cReadOnlyArray, mainREAD_ONLY_ALIGN_SIZE, portMPU_REGION_READ_ONLY }, - { cPrivilegedOnlyAccessArray, mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE, portMPU_REGION_PRIVILEGED_READ_WRITE } - }, - - &xCheckTaskBuffer /* Additional structure member present when the task is being created without any dynamic memory allocation. */ + prvCheckTask, /* pvTaskCode - the function that implements the task. */ + "Check", /* pcName */ + mainCHECK_TASK_STACK_SIZE_WORDS, /* usStackDepth - defined in words, not bytes. */ + ( void * ) 0x12121212, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */ + ( tskIDLE_PRIORITY + 1 ) | portPRIVILEGE_BIT, /* uxPriority - this is the highest priority task in the system. The task is created in privileged mode to demonstrate accessing the privileged only data. */ + xCheckTaskStack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ + + /* xRegions - In this case the xRegions array is used to create MPU regions + * for all three of the arrays declared directly above. Each MPU region is + * created with different parameters. Again, THIS IS JUST TO DEMONSTRATE THE + * MPU FUNCTIONALITY, the data is not used by the check tasks primary function + * of monitoring the reg test tasks and printing out status information.*/ + { + /* Base address Length Parameters */ + { cReadWriteArray, mainREAD_WRITE_ALIGN_SIZE, portMPU_REGION_READ_WRITE }, + { cReadOnlyArray, mainREAD_ONLY_ALIGN_SIZE, portMPU_REGION_READ_ONLY }, + { cPrivilegedOnlyAccessArray, mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE, portMPU_REGION_PRIVILEGED_READ_WRITE } + }, + + &xCheckTaskBuffer /* Additional structure member present when the task is being created without any dynamic memory allocation. */ }; @@ -344,58 +345,58 @@ static const TaskParameters_t xCheckTaskParameters = /*-----------------------------------------------------------*/ /* Define the constants used to allocate the reg test task stacks. Note that -that stack size is defined in words, not bytes. */ -#define mainREG_TEST_STACK_SIZE_WORDS 128 -#define mainREG_TEST_STACK_ALIGNMENT ( mainREG_TEST_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) + * that stack size is defined in words, not bytes. */ +#define mainREG_TEST_STACK_SIZE_WORDS 128 +#define mainREG_TEST_STACK_ALIGNMENT ( mainREG_TEST_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) /* Declare the stacks that will be used by the reg test tasks. The kernel will -automatically create an MPU region for the stack. The stack alignment must -match its size, so if 128 words are reserved for the stack then it must be -aligned to ( 128 * 4 ) bytes. */ + * automatically create an MPU region for the stack. The stack alignment must + * match its size, so if 128 words are reserved for the stack then it must be + * aligned to ( 128 * 4 ) bytes. */ static portSTACK_TYPE xRegTest1Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_TO( mainREG_TEST_STACK_ALIGNMENT ); static portSTACK_TYPE xRegTest2Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_TO( mainREG_TEST_STACK_ALIGNMENT ); /* The reg test tasks are created using the xTaskCreateRestrictedStatic() API -function, so variables that hold the task's data structures must also be -provided. The are placed in the kernel's privileged memory section. */ + * function, so variables that hold the task's data structures must also be + * provided. The are placed in the kernel's privileged memory section. */ static PRIVILEGED_DATA StaticTask_t xRegTest1TaskBuffer, xRegTest2TaskBuffer; /* Fill in a TaskParameters_t structure per reg test task to define the tasks. */ static const TaskParameters_t xRegTest1Parameters = { - vRegTest1Implementation, /* pvTaskCode - the function that implements the task. */ - "RegTest1", /* pcName */ - mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */ - ( void * ) configREG_TEST_TASK_1_PARAMETER, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */ - tskIDLE_PRIORITY | portPRIVILEGE_BIT, /* uxPriority - note that this task is created with privileges to demonstrate one method of passing a queue handle into the task. */ - xRegTest1Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ - { /* xRegions - this task does not use any non-stack data hence all members are zero. */ - /* Base address Length Parameters */ - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 } - }, - - &xRegTest1TaskBuffer /* Additional parameter required when the task is created with xTaskCreateRestrictedStatic(). */ + vRegTest1Implementation, /* pvTaskCode - the function that implements the task. */ + "RegTest1", /* pcName */ + mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */ + ( void * ) configREG_TEST_TASK_1_PARAMETER, /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */ + tskIDLE_PRIORITY | portPRIVILEGE_BIT, /* uxPriority - note that this task is created with privileges to demonstrate one method of passing a queue handle into the task. */ + xRegTest1Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ + { /* xRegions - this task does not use any non-stack data hence all members are zero. */ + /* Base address Length Parameters */ + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 } + }, + + &xRegTest1TaskBuffer /* Additional parameter required when the task is created with xTaskCreateRestrictedStatic(). */ }; /*-----------------------------------------------------------*/ static TaskParameters_t xRegTest2Parameters = { - vRegTest2Implementation, /* pvTaskCode - the function that implements the task. */ - "RegTest2", /* pcName */ - mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */ - ( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */ - tskIDLE_PRIORITY, /* uxPriority */ - xRegTest2Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ - { /* xRegions - this task does not use any non-stack data hence all members are zero. */ - /* Base address Length Parameters */ - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 } - }, - - &xRegTest2TaskBuffer /* Additional parameter required when the task is created with xTaskCreateRestrictedStatic(). */ + vRegTest2Implementation, /* pvTaskCode - the function that implements the task. */ + "RegTest2", /* pcName */ + mainREG_TEST_STACK_SIZE_WORDS, /* usStackDepth */ + ( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */ + tskIDLE_PRIORITY, /* uxPriority */ + xRegTest2Stack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ + { /* xRegions - this task does not use any non-stack data hence all members are zero. */ + /* Base address Length Parameters */ + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 } + }, + + &xRegTest2TaskBuffer /* Additional parameter required when the task is created with xTaskCreateRestrictedStatic(). */ }; /*-----------------------------------------------------------*/ @@ -403,37 +404,37 @@ static TaskParameters_t xRegTest2Parameters = /*-----------------------------------------------------------*/ /* Define the constants used to allocate the stack of the task that is -deleted. Note that the stack size is defined in words, not bytes. */ -#define mainDELETE_TASK_STACK_SIZE_WORDS 128 -#define mainTASK_TO_DELETE_STACK_ALIGNMENT ( mainDELETE_TASK_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) + * deleted. Note that the stack size is defined in words, not bytes. */ +#define mainDELETE_TASK_STACK_SIZE_WORDS 128 +#define mainTASK_TO_DELETE_STACK_ALIGNMENT ( mainDELETE_TASK_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) ) /* Declare the stack that will be used by the task that gets deleted. The -kernel will automatically create an MPU region for the stack. The stack -alignment must match its size, so if 128 words are reserved for the stack -then it must be aligned to ( 128 * 4 ) bytes. */ + * kernel will automatically create an MPU region for the stack. The stack + * alignment must match its size, so if 128 words are reserved for the stack + * then it must be aligned to ( 128 * 4 ) bytes. */ static portSTACK_TYPE xDeleteTaskStack[ mainDELETE_TASK_STACK_SIZE_WORDS ] mainALIGN_TO( mainTASK_TO_DELETE_STACK_ALIGNMENT ); /* The task that gets deleted is created using xTaskCreateRestrictedStatic(), -so the variable that stores the task's data structure must also be provided. -This is placed in the kernel's privileged data segment. */ + * so the variable that stores the task's data structure must also be provided. + * This is placed in the kernel's privileged data segment. */ static PRIVILEGED_DATA StaticTask_t xStaticDeleteTaskBuffer; static TaskParameters_t xTaskToDeleteParameters = { - prvTaskToDelete, /* pvTaskCode - the function that implements the task. */ - mainTASK_TO_DELETE_NAME, /* pcName */ - mainDELETE_TASK_STACK_SIZE_WORDS, /* usStackDepth */ - ( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */ - ( tskIDLE_PRIORITY + 1 ) | portPRIVILEGE_BIT, /* uxPriority - this task is privileged because it creates and deletes kernel objects. */ - xDeleteTaskStack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ - { /* xRegions - this task does not use any non-stack data hence all members are zero. */ - /* Base address Length Parameters */ - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 }, - { 0x00, 0x00, 0x00 } - }, - - &xStaticDeleteTaskBuffer /* Additional parameter required when xTaskCreateRestrictedStatic() is used. */ + prvTaskToDelete, /* pvTaskCode - the function that implements the task. */ + mainTASK_TO_DELETE_NAME, /* pcName */ + mainDELETE_TASK_STACK_SIZE_WORDS, /* usStackDepth */ + ( void * ) NULL, /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */ + ( tskIDLE_PRIORITY + 1 ) | portPRIVILEGE_BIT, /* uxPriority - this task is privileged because it creates and deletes kernel objects. */ + xDeleteTaskStack, /* puxStackBuffer - the array to use as the task stack, as declared above. */ + { /* xRegions - this task does not use any non-stack data hence all members are zero. */ + /* Base address Length Parameters */ + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 } + }, + + &xStaticDeleteTaskBuffer /* Additional parameter required when xTaskCreateRestrictedStatic() is used. */ }; /*-----------------------------------------------------------*/ @@ -442,549 +443,561 @@ volatile uint32_t ul1 = 0x123, ul2 = 0; int main( void ) { - TaskHandle_t xRegTest1TaskHandle, xRegTest2TaskHandle, xCheckTaskHandle; - - configASSERT( ul1 == 0x123 ); - configASSERT( ul2 == 0 ); - prvSetupHardware(); - - /* Create the queue used to pass "I'm alive" messages to the check task. */ - xGlobalScopeCheckQueue = xQueueCreateStatic( 1, sizeof( uint32_t ), ucGlobalScopeQueueStorageArea, &xGlobalScopeQueueBuffer ); - - /* One check task uses the task parameter to receive the queue handle. - This allows the file scope variable to be accessed from within the task. - The pvParameters member of xRegTest2Parameters can only be set after the - queue has been created so is set here. */ - xRegTest2Parameters.pvParameters = xGlobalScopeCheckQueue; - - /* Create three test tasks. */ - xTaskCreateRestrictedStatic( &xRegTest1Parameters, &( xRegTest1TaskHandle ) ); - xTaskCreateRestrictedStatic( &xRegTest2Parameters, &( xRegTest2TaskHandle ) ); - xTaskCreateRestrictedStatic( &xCheckTaskParameters, &( xCheckTaskHandle ) ); - - vGrantAccessToQueue( xRegTest1TaskHandle, xGlobalScopeCheckQueue ); - vGrantAccessToQueue( xRegTest2TaskHandle, xGlobalScopeCheckQueue ); - vGrantAccessToQueue( xCheckTaskHandle, xGlobalScopeCheckQueue ); - - /* Create a task that does nothing but ensure some of the MPU API functions - can be called correctly, then get deleted. This is done for code coverage - test purposes only. The task's handle is saved in xTaskToDelete so it can - get deleted in the idle task hook. */ - xTaskCreateRestrictedStatic( &xTaskToDeleteParameters, &xTaskToDelete ); - - /* Create the tasks that are created using the original xTaskCreate() API - function. */ - xTaskCreateStatic( prvOldStylePrivilegedModeTask, /* The function that implements the task. */ - "Task2", /* Text name for the task. */ - 100, /* Stack depth in words. */ - NULL, /* Task parameters. */ - ( 3 | portPRIVILEGE_BIT ), /* Priority and mode. */ - xPrivilegedModeTaskStack, /* Used as the task's stack. */ - &xPrivilegedModeTaskBuffer /* Used to hold the task's data structure. */ - ); - - /* Create the third and fourth register check tasks, as described at the top - of this file. */ - xTaskCreateStatic( prvRegTest3Task, "Reg3", configMINIMAL_STACK_SIZE, configREG_TEST_TASK_3_PARAMETER, tskIDLE_PRIORITY, xRegTest3Stack, &xRegTest3Buffer ); - xTaskCreateStatic( prvRegTest4Task, "Reg4", configMINIMAL_STACK_SIZE, configREG_TEST_TASK_4_PARAMETER, tskIDLE_PRIORITY, xRegTest4Stack, &xRegTest4Buffer ); - - /* Create and start the software timer. */ - xTimer = xTimerCreateStatic( "Timer", /* Test name for the timer. */ - mainTIMER_PERIOD, /* Period of the timer. */ - pdTRUE, /* The timer will auto-reload itself. */ - ( void * ) 0, /* The timer's ID is used to count the number of times it expires - initialise this to 0. */ - prvTimerCallback, /* The function called when the timer expires. */ - &xTimerBuffer ); /* The variable in which the created timer's data structure will be stored. */ - configASSERT( xTimer ); - xTimerStart( xTimer, mainDONT_BLOCK ); - - /* Start the scheduler. */ - vTaskStartScheduler(); - - /* Will only get here if there was insufficient memory to create the idle - task. */ - for( ;; ); + TaskHandle_t xRegTest1TaskHandle, xRegTest2TaskHandle, xCheckTaskHandle; + + configASSERT( ul1 == 0x123 ); + configASSERT( ul2 == 0 ); + prvSetupHardware(); + + /* Create the queue used to pass "I'm alive" messages to the check task. */ + xGlobalScopeCheckQueue = xQueueCreateStatic( 1, sizeof( uint32_t ), ucGlobalScopeQueueStorageArea, &xGlobalScopeQueueBuffer ); + + /* One check task uses the task parameter to receive the queue handle. + * This allows the file scope variable to be accessed from within the task. + * The pvParameters member of xRegTest2Parameters can only be set after the + * queue has been created so is set here. */ + xRegTest2Parameters.pvParameters = xGlobalScopeCheckQueue; + + /* Create three test tasks. */ + xTaskCreateRestrictedStatic( &xRegTest1Parameters, &( xRegTest1TaskHandle ) ); + xTaskCreateRestrictedStatic( &xRegTest2Parameters, &( xRegTest2TaskHandle ) ); + xTaskCreateRestrictedStatic( &xCheckTaskParameters, &( xCheckTaskHandle ) ); + + vGrantAccessToQueue( xRegTest1TaskHandle, xGlobalScopeCheckQueue ); + vGrantAccessToQueue( xRegTest2TaskHandle, xGlobalScopeCheckQueue ); + vGrantAccessToQueue( xCheckTaskHandle, xGlobalScopeCheckQueue ); + + /* Create a task that does nothing but ensure some of the MPU API functions + * can be called correctly, then get deleted. This is done for code coverage + * test purposes only. The task's handle is saved in xTaskToDelete so it can + * get deleted in the idle task hook. */ + xTaskCreateRestrictedStatic( &xTaskToDeleteParameters, &xTaskToDelete ); + + /* Create the tasks that are created using the original xTaskCreate() API + * function. */ + xTaskCreateStatic( prvOldStylePrivilegedModeTask, /* The function that implements the task. */ + "Task2", /* Text name for the task. */ + 100, /* Stack depth in words. */ + NULL, /* Task parameters. */ + ( 3 | portPRIVILEGE_BIT ), /* Priority and mode. */ + xPrivilegedModeTaskStack, /* Used as the task's stack. */ + &xPrivilegedModeTaskBuffer /* Used to hold the task's data structure. */ + ); + + /* Create the third and fourth register check tasks, as described at the top + * of this file. */ + xTaskCreateStatic( prvRegTest3Task, "Reg3", configMINIMAL_STACK_SIZE, configREG_TEST_TASK_3_PARAMETER, tskIDLE_PRIORITY, xRegTest3Stack, &xRegTest3Buffer ); + xTaskCreateStatic( prvRegTest4Task, "Reg4", configMINIMAL_STACK_SIZE, configREG_TEST_TASK_4_PARAMETER, tskIDLE_PRIORITY, xRegTest4Stack, &xRegTest4Buffer ); + + /* Create and start the software timer. */ + xTimer = xTimerCreateStatic( "Timer", /* Test name for the timer. */ + mainTIMER_PERIOD, /* Period of the timer. */ + pdTRUE, /* The timer will auto-reload itself. */ + ( void * ) 0, /* The timer's ID is used to count the number of times it expires - initialise this to 0. */ + prvTimerCallback, /* The function called when the timer expires. */ + &xTimerBuffer ); /* The variable in which the created timer's data structure will be stored. */ + configASSERT( xTimer ); + xTimerStart( xTimer, mainDONT_BLOCK ); + + /* Start the scheduler. */ + vTaskStartScheduler(); + + /* Will only get here if there was insufficient memory to create the idle + * task. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvCheckTask( void *pvParameters ) +static void prvCheckTask( void * pvParameters ) { /* This task is created in privileged mode so can access the file scope -queue variable. Take a stack copy of this before the task is set into user -mode. Once that task is in user mode the file scope queue variable will no -longer be accessible but the stack copy will. */ -QueueHandle_t xQueue = xGlobalScopeCheckQueue; -int32_t lMessage; -uint32_t ulStillAliveCounts[ 3 ] = { 0 }; -const char *pcStatusMessage = "PASS\r\n"; -uint32_t ulLastRegTest3CountValue = 0, ulLastRegTest4Value = 0; + * queue variable. Take a stack copy of this before the task is set into user + * mode. Once that task is in user mode the file scope queue variable will no + * longer be accessible but the stack copy will. */ + QueueHandle_t xQueue = xGlobalScopeCheckQueue; + int32_t lMessage; + uint32_t ulStillAliveCounts[ 3 ] = { 0 }; + const char * pcStatusMessage = "PASS\r\n"; + uint32_t ulLastRegTest3CountValue = 0, ulLastRegTest4Value = 0; /* The register test tasks that also test the floating point registers increment -a counter on each iteration of their loop. The counters are inside the array -that this task has access to. */ -volatile uint32_t *pulOverlaidCounter3 = ( uint32_t * ) &( cReadWriteArray[ 0 ] ), *pulOverlaidCounter4 = ( uint32_t * ) &( cReadWriteArray[ 4 ] ); + * a counter on each iteration of their loop. The counters are inside the array + * that this task has access to. */ + volatile uint32_t * pulOverlaidCounter3 = ( uint32_t * ) &( cReadWriteArray[ 0 ] ), * pulOverlaidCounter4 = ( uint32_t * ) &( cReadWriteArray[ 4 ] ); /* ulCycleCount is incremented on each cycle of the check task. It can be -viewed updating in the Keil watch window as the simulator does not print to -the ITM port. */ -volatile uint32_t ulCycleCount = 0; - - /* Just to remove compiler warning. */ - ( void ) pvParameters; - - /* Demonstrate how the various memory regions can and can't be accessed. - The task privilege level is set down to user mode within this function. */ - prvTestMemoryRegions(); - - /* Clear overlaid reg test counters before entering the loop below. */ - *pulOverlaidCounter3 = 0UL; - *pulOverlaidCounter4 = 0UL; - - /* This loop performs the main function of the task, which is blocking - on a message queue then processing each message as it arrives. */ - for( ;; ) - { - /* Wait for the next message to arrive. */ - xQueueReceive( xQueue, &lMessage, portMAX_DELAY ); - - switch( lMessage ) - { - case configREG_TEST_1_STILL_EXECUTING : - case configREG_TEST_2_STILL_EXECUTING : - case configTIMER_STILL_EXECUTING : - /* Message from the first or second register check task, or - the timer callback function. Increment the count of the - number of times the message source has sent the message as - the message source must still be executed. */ - ( ulStillAliveCounts[ lMessage ] )++; - break; - - case configPRINT_SYSTEM_STATUS : - /* Message from tick hook, time to print out the system - status. If messages have stopped arriving from either of - the first two reg test task or the timer callback then the - status must be set to fail. */ - if( ( ulStillAliveCounts[ 0 ] == 0 ) || ( ulStillAliveCounts[ 1 ] == 0 ) || ( ulStillAliveCounts[ 2 ] == 0 ) ) - { - /* One or both of the test tasks are no longer sending - 'still alive' messages. */ - pcStatusMessage = "FAIL\r\n"; - } - else - { - /* Reset the count of 'still alive' messages. */ - memset( ( void * ) ulStillAliveCounts, 0x00, sizeof( ulStillAliveCounts ) ); - } - - /* Check that the register test 3 task is still incrementing - its counter, and therefore still running. */ - if( ulLastRegTest3CountValue == *pulOverlaidCounter3 ) - { - pcStatusMessage = "FAIL\r\n"; - } - ulLastRegTest3CountValue = *pulOverlaidCounter3; - - /* Check that the register test 4 task is still incrementing - its counter, and therefore still running. */ - if( ulLastRegTest4Value == *pulOverlaidCounter4 ) - { - pcStatusMessage = "FAIL\r\n"; - } - ulLastRegTest4Value = *pulOverlaidCounter4; - - /**** Print pcStatusMessage here. ****/ - ( void ) pcStatusMessage; - - /* The cycle count can be viewed updating in the Keil watch - window if ITM printf is not being used. */ - ulCycleCount++; - break; - - default : - /* Something unexpected happened. Delete this task so the - error is apparent (no output will be displayed). */ - vMainDeleteMe(); - break; - } - } + * viewed updating in the Keil watch window as the simulator does not print to + * the ITM port. */ + volatile uint32_t ulCycleCount = 0; + + /* Just to remove compiler warning. */ + ( void ) pvParameters; + + /* Demonstrate how the various memory regions can and can't be accessed. + * The task privilege level is set down to user mode within this function. */ + prvTestMemoryRegions(); + + /* Clear overlaid reg test counters before entering the loop below. */ + *pulOverlaidCounter3 = 0UL; + *pulOverlaidCounter4 = 0UL; + + /* This loop performs the main function of the task, which is blocking + * on a message queue then processing each message as it arrives. */ + for( ; ; ) + { + /* Wait for the next message to arrive. */ + xQueueReceive( xQueue, &lMessage, portMAX_DELAY ); + + switch( lMessage ) + { + case configREG_TEST_1_STILL_EXECUTING: + case configREG_TEST_2_STILL_EXECUTING: + case configTIMER_STILL_EXECUTING: + + /* Message from the first or second register check task, or + * the timer callback function. Increment the count of the + * number of times the message source has sent the message as + * the message source must still be executed. */ + ( ulStillAliveCounts[ lMessage ] )++; + break; + + case configPRINT_SYSTEM_STATUS: + + /* Message from tick hook, time to print out the system + * status. If messages have stopped arriving from either of + * the first two reg test task or the timer callback then the + * status must be set to fail. */ + if( ( ulStillAliveCounts[ 0 ] == 0 ) || ( ulStillAliveCounts[ 1 ] == 0 ) || ( ulStillAliveCounts[ 2 ] == 0 ) ) + { + /* One or both of the test tasks are no longer sending + * 'still alive' messages. */ + pcStatusMessage = "FAIL\r\n"; + } + else + { + /* Reset the count of 'still alive' messages. */ + memset( ( void * ) ulStillAliveCounts, 0x00, sizeof( ulStillAliveCounts ) ); + } + + /* Check that the register test 3 task is still incrementing + * its counter, and therefore still running. */ + if( ulLastRegTest3CountValue == *pulOverlaidCounter3 ) + { + pcStatusMessage = "FAIL\r\n"; + } + + ulLastRegTest3CountValue = *pulOverlaidCounter3; + + /* Check that the register test 4 task is still incrementing + * its counter, and therefore still running. */ + if( ulLastRegTest4Value == *pulOverlaidCounter4 ) + { + pcStatusMessage = "FAIL\r\n"; + } + + ulLastRegTest4Value = *pulOverlaidCounter4; + + /**** Print pcStatusMessage here. ****/ + ( void ) pcStatusMessage; + + /* The cycle count can be viewed updating in the Keil watch + * window if ITM printf is not being used. */ + ulCycleCount++; + break; + + default: + + /* Something unexpected happened. Delete this task so the + * error is apparent (no output will be displayed). */ + vMainDeleteMe(); + break; + } + } } /*-----------------------------------------------------------*/ static void prvTestMemoryRegions( void ) { -int32_t x; -char cTemp; - - /* The check task (from which this function is called) is created in the - Privileged mode. The privileged array can be both read from and written - to while this task is privileged. */ - cPrivilegedOnlyAccessArray[ 0 ] = 'a'; - if( cPrivilegedOnlyAccessArray[ 0 ] != 'a' ) - { - /* Something unexpected happened. Delete this task so the error is - apparent (no output will be displayed). */ - vMainDeleteMe(); - } - - /* Writing off the end of the RAM allocated to this task will *NOT* cause a - protection fault because the task is still executing in a privileged mode. - Uncomment the following to test. */ - /*cPrivilegedOnlyAccessArray[ mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ] = 'a';*/ - - /* Now set the task into user mode. */ - portSWITCH_TO_USER_MODE(); - - /* Accessing the privileged only array will now cause a fault. Uncomment - the following line to test. */ - /*cPrivilegedOnlyAccessArray[ 0 ] = 'a';*/ - - /* The read/write array can still be successfully read and written. */ - for( x = 0; x < mainREAD_WRITE_ALIGN_SIZE; x++ ) - { - cReadWriteArray[ x ] = 'a'; - if( cReadWriteArray[ x ] != 'a' ) - { - /* Something unexpected happened. Delete this task so the error is - apparent (no output will be displayed). */ - vMainDeleteMe(); - } - } - - /* But attempting to read or write off the end of the RAM allocated to this - task will cause a fault. Uncomment either of the following two lines to - test. */ - /* cReadWriteArray[ 0 ] = cReadWriteArray[ -1 ]; */ - /* cReadWriteArray[ mainREAD_WRITE_ALIGN_SIZE ] = 0x00; */ - - /* The read only array can be successfully read... */ - for( x = 0; x < mainREAD_ONLY_ALIGN_SIZE; x++ ) - { - cTemp = cReadOnlyArray[ x ]; - } - - /* ...but cannot be written. Uncomment the following line to test. */ - /* cReadOnlyArray[ 0 ] = 'a'; */ - - /* Writing to the first and last locations in the stack array should not - cause a protection fault. Note that doing this will cause the kernel to - detect a stack overflow if configCHECK_FOR_STACK_OVERFLOW is greater than - 1, hence the test is commented out by default. */ - /* xCheckTaskStack[ 0 ] = 0; - xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS - 1 ] = 0; */ - - /* Writing off either end of the stack array should cause a protection - fault, uncomment either of the following two lines to test. */ - /* xCheckTaskStack[ -1 ] = 0; */ - /* xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS ] = 0; */ - - ( void ) cTemp; + int32_t x; + char cTemp; + + /* The check task (from which this function is called) is created in the + * Privileged mode. The privileged array can be both read from and written + * to while this task is privileged. */ + cPrivilegedOnlyAccessArray[ 0 ] = 'a'; + + if( cPrivilegedOnlyAccessArray[ 0 ] != 'a' ) + { + /* Something unexpected happened. Delete this task so the error is + * apparent (no output will be displayed). */ + vMainDeleteMe(); + } + + /* Writing off the end of the RAM allocated to this task will *NOT* cause a + * protection fault because the task is still executing in a privileged mode. + * Uncomment the following to test. */ + /*cPrivilegedOnlyAccessArray[ mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ] = 'a';*/ + + /* Now set the task into user mode. */ + portSWITCH_TO_USER_MODE(); + + /* Accessing the privileged only array will now cause a fault. Uncomment + * the following line to test. */ + /*cPrivilegedOnlyAccessArray[ 0 ] = 'a';*/ + + /* The read/write array can still be successfully read and written. */ + for( x = 0; x < mainREAD_WRITE_ALIGN_SIZE; x++ ) + { + cReadWriteArray[ x ] = 'a'; + + if( cReadWriteArray[ x ] != 'a' ) + { + /* Something unexpected happened. Delete this task so the error is + * apparent (no output will be displayed). */ + vMainDeleteMe(); + } + } + + /* But attempting to read or write off the end of the RAM allocated to this + * task will cause a fault. Uncomment either of the following two lines to + * test. */ + /* cReadWriteArray[ 0 ] = cReadWriteArray[ -1 ]; */ + /* cReadWriteArray[ mainREAD_WRITE_ALIGN_SIZE ] = 0x00; */ + + /* The read only array can be successfully read... */ + for( x = 0; x < mainREAD_ONLY_ALIGN_SIZE; x++ ) + { + cTemp = cReadOnlyArray[ x ]; + } + + /* ...but cannot be written. Uncomment the following line to test. */ + /* cReadOnlyArray[ 0 ] = 'a'; */ + + /* Writing to the first and last locations in the stack array should not + * cause a protection fault. Note that doing this will cause the kernel to + * detect a stack overflow if configCHECK_FOR_STACK_OVERFLOW is greater than + * 1, hence the test is commented out by default. */ + + /* xCheckTaskStack[ 0 ] = 0; + * xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS - 1 ] = 0; */ + + /* Writing off either end of the stack array should cause a protection + * fault, uncomment either of the following two lines to test. */ + /* xCheckTaskStack[ -1 ] = 0; */ + /* xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS ] = 0; */ + + ( void ) cTemp; } /*-----------------------------------------------------------*/ static void prvExerciseEventGroupAPI( void ) { -EventGroupHandle_t xEventGroup; -StaticEventGroup_t xEventGroupBuffer; -EventBits_t xBits; -const EventBits_t xBitsToWaitFor = ( EventBits_t ) 0xff, xBitToClear = ( EventBits_t ) 0x01; - - /* Exercise some event group functions. */ - xEventGroup = xEventGroupCreateStatic( &xEventGroupBuffer ); - configASSERT( xEventGroup ); - - /* No bits should be set. */ - xBits = xEventGroupWaitBits( xEventGroup, xBitsToWaitFor, pdTRUE, pdFALSE, mainDONT_BLOCK ); - configASSERT( xBits == ( EventBits_t ) 0 ); - - /* Set bits and read back to ensure the bits were set. */ - xEventGroupSetBits( xEventGroup, xBitsToWaitFor ); - xBits = xEventGroupGetBits( xEventGroup ); - configASSERT( xBits == xBitsToWaitFor ); - - /* Clear a bit and read back again using a different API function. */ - xEventGroupClearBits( xEventGroup, xBitToClear ); - xBits = xEventGroupSync( xEventGroup, 0x00, xBitsToWaitFor, mainDONT_BLOCK ); - configASSERT( xBits == ( xBitsToWaitFor & ~xBitToClear ) ); - - /* Finished with the event group. */ - vEventGroupDelete( xEventGroup ); + EventGroupHandle_t xEventGroup; + StaticEventGroup_t xEventGroupBuffer; + EventBits_t xBits; + const EventBits_t xBitsToWaitFor = ( EventBits_t ) 0xff, xBitToClear = ( EventBits_t ) 0x01; + + /* Exercise some event group functions. */ + xEventGroup = xEventGroupCreateStatic( &xEventGroupBuffer ); + configASSERT( xEventGroup ); + + /* No bits should be set. */ + xBits = xEventGroupWaitBits( xEventGroup, xBitsToWaitFor, pdTRUE, pdFALSE, mainDONT_BLOCK ); + configASSERT( xBits == ( EventBits_t ) 0 ); + + /* Set bits and read back to ensure the bits were set. */ + xEventGroupSetBits( xEventGroup, xBitsToWaitFor ); + xBits = xEventGroupGetBits( xEventGroup ); + configASSERT( xBits == xBitsToWaitFor ); + + /* Clear a bit and read back again using a different API function. */ + xEventGroupClearBits( xEventGroup, xBitToClear ); + xBits = xEventGroupSync( xEventGroup, 0x00, xBitsToWaitFor, mainDONT_BLOCK ); + configASSERT( xBits == ( xBitsToWaitFor & ~xBitToClear ) ); + + /* Finished with the event group. */ + vEventGroupDelete( xEventGroup ); } /*-----------------------------------------------------------*/ static void prvExerciseSemaphoreAPI( void ) { -SemaphoreHandle_t xSemaphore; -StaticSemaphore_t xSemaphoreBuffer; -const UBaseType_t uxMaxCount = 5, uxInitialCount = 0; - - /* Most of the semaphore API is common to the queue API and is already being - used. This function uses a few semaphore functions that are unique to the - RTOS objects, rather than generic and used by queues also. - - First create and use a counting semaphore. */ - xSemaphore = xSemaphoreCreateCountingStatic( uxMaxCount, uxInitialCount, &xSemaphoreBuffer ); - configASSERT( xSemaphore ); - - /* Give the semaphore a couple of times and ensure the count is returned - correctly. */ - xSemaphoreGive( xSemaphore ); - xSemaphoreGive( xSemaphore ); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 2 ); - vSemaphoreDelete( xSemaphore ); - - /* Create a recursive mutex, and ensure the mutex holder and count are - returned returned correctly. */ - xSemaphore = xSemaphoreCreateRecursiveMutexStatic( &xSemaphoreBuffer ); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); - configASSERT( xSemaphore ); - xSemaphoreTakeRecursive( xSemaphore, mainDONT_BLOCK ); - xSemaphoreTakeRecursive( xSemaphore, mainDONT_BLOCK ); - configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetCurrentTaskHandle() ); - configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetHandle( mainTASK_TO_DELETE_NAME ) ); - xSemaphoreGiveRecursive( xSemaphore ); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 0 ); - xSemaphoreGiveRecursive( xSemaphore ); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); - configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == NULL ); - vSemaphoreDelete( xSemaphore ); - - /* Create a normal mutex, and sure the mutex holder and count are returned - returned correctly. */ - xSemaphore = xSemaphoreCreateMutexStatic( &xSemaphoreBuffer ); - configASSERT( xSemaphore ); - xSemaphoreTake( xSemaphore, mainDONT_BLOCK ); - xSemaphoreTake( xSemaphore, mainDONT_BLOCK ); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 0 ); /* Not recursive so can only be 1. */ - configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetCurrentTaskHandle() ); - xSemaphoreGive( xSemaphore ); - configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); - configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == NULL ); - vSemaphoreDelete( xSemaphore ); + SemaphoreHandle_t xSemaphore; + StaticSemaphore_t xSemaphoreBuffer; + const UBaseType_t uxMaxCount = 5, uxInitialCount = 0; + + /* Most of the semaphore API is common to the queue API and is already being + * used. This function uses a few semaphore functions that are unique to the + * RTOS objects, rather than generic and used by queues also. + * + * First create and use a counting semaphore. */ + xSemaphore = xSemaphoreCreateCountingStatic( uxMaxCount, uxInitialCount, &xSemaphoreBuffer ); + configASSERT( xSemaphore ); + + /* Give the semaphore a couple of times and ensure the count is returned + * correctly. */ + xSemaphoreGive( xSemaphore ); + xSemaphoreGive( xSemaphore ); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 2 ); + vSemaphoreDelete( xSemaphore ); + + /* Create a recursive mutex, and ensure the mutex holder and count are + * returned returned correctly. */ + xSemaphore = xSemaphoreCreateRecursiveMutexStatic( &xSemaphoreBuffer ); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); + configASSERT( xSemaphore ); + xSemaphoreTakeRecursive( xSemaphore, mainDONT_BLOCK ); + xSemaphoreTakeRecursive( xSemaphore, mainDONT_BLOCK ); + configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetCurrentTaskHandle() ); + configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetHandle( mainTASK_TO_DELETE_NAME ) ); + xSemaphoreGiveRecursive( xSemaphore ); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 0 ); + xSemaphoreGiveRecursive( xSemaphore ); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); + configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == NULL ); + vSemaphoreDelete( xSemaphore ); + + /* Create a normal mutex, and sure the mutex holder and count are returned + * returned correctly. */ + xSemaphore = xSemaphoreCreateMutexStatic( &xSemaphoreBuffer ); + configASSERT( xSemaphore ); + xSemaphoreTake( xSemaphore, mainDONT_BLOCK ); + xSemaphoreTake( xSemaphore, mainDONT_BLOCK ); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 0 ); /* Not recursive so can only be 1. */ + configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == xTaskGetCurrentTaskHandle() ); + xSemaphoreGive( xSemaphore ); + configASSERT( uxSemaphoreGetCount( xSemaphore ) == 1 ); + configASSERT( xSemaphoreGetMutexHolder( xSemaphore ) == NULL ); + vSemaphoreDelete( xSemaphore ); } /*-----------------------------------------------------------*/ static void prvExerciseTaskNotificationAPI( void ) { -uint32_t ulNotificationValue; -BaseType_t xReturned; - - /* The task should not yet have a notification pending. */ - xReturned = xTaskNotifyWait( 0, 0, &ulNotificationValue, mainDONT_BLOCK ); - configASSERT( xReturned == pdFAIL ); - configASSERT( ulNotificationValue == 0UL ); - - /* Exercise the 'give' and 'take' versions of the notification API. */ - xTaskNotifyGive( xTaskGetCurrentTaskHandle() ); - xTaskNotifyGive( xTaskGetCurrentTaskHandle() ); - ulNotificationValue = ulTaskNotifyTake( pdTRUE, mainDONT_BLOCK ); - configASSERT( ulNotificationValue == 2 ); - - /* Exercise the 'notify' and 'clear' API. */ - ulNotificationValue = 20; - xTaskNotify( xTaskGetCurrentTaskHandle(), ulNotificationValue, eSetValueWithOverwrite ); - ulNotificationValue = 0; - xReturned = xTaskNotifyWait( 0, 0, &ulNotificationValue, mainDONT_BLOCK ); - configASSERT( xReturned == pdPASS ); - configASSERT( ulNotificationValue == 20 ); - xTaskNotify( xTaskGetCurrentTaskHandle(), ulNotificationValue, eSetValueWithOverwrite ); - xReturned = xTaskNotifyStateClear( NULL ); - configASSERT( xReturned == pdTRUE ); /* First time a notification was pending. */ - xReturned = xTaskNotifyStateClear( NULL ); - configASSERT( xReturned == pdFALSE ); /* Second time the notification was already clear. */ + uint32_t ulNotificationValue; + BaseType_t xReturned; + + /* The task should not yet have a notification pending. */ + xReturned = xTaskNotifyWait( 0, 0, &ulNotificationValue, mainDONT_BLOCK ); + configASSERT( xReturned == pdFAIL ); + configASSERT( ulNotificationValue == 0UL ); + + /* Exercise the 'give' and 'take' versions of the notification API. */ + xTaskNotifyGive( xTaskGetCurrentTaskHandle() ); + xTaskNotifyGive( xTaskGetCurrentTaskHandle() ); + ulNotificationValue = ulTaskNotifyTake( pdTRUE, mainDONT_BLOCK ); + configASSERT( ulNotificationValue == 2 ); + + /* Exercise the 'notify' and 'clear' API. */ + ulNotificationValue = 20; + xTaskNotify( xTaskGetCurrentTaskHandle(), ulNotificationValue, eSetValueWithOverwrite ); + ulNotificationValue = 0; + xReturned = xTaskNotifyWait( 0, 0, &ulNotificationValue, mainDONT_BLOCK ); + configASSERT( xReturned == pdPASS ); + configASSERT( ulNotificationValue == 20 ); + xTaskNotify( xTaskGetCurrentTaskHandle(), ulNotificationValue, eSetValueWithOverwrite ); + xReturned = xTaskNotifyStateClear( NULL ); + configASSERT( xReturned == pdTRUE ); /* First time a notification was pending. */ + xReturned = xTaskNotifyStateClear( NULL ); + configASSERT( xReturned == pdFALSE ); /* Second time the notification was already clear. */ } /*-----------------------------------------------------------*/ -static void prvTaskToDelete( void *pvParameters ) +static void prvTaskToDelete( void * pvParameters ) { - /* Remove compiler warnings about unused parameters. */ - ( void ) pvParameters; - - /* Check the enter and exit critical macros are working correctly. If the - SVC priority is below configMAX_SYSCALL_INTERRUPT_PRIORITY then this will - fault. */ - taskENTER_CRITICAL(); - taskEXIT_CRITICAL(); - - /* Exercise the API of various RTOS objects. */ - prvExerciseEventGroupAPI(); - prvExerciseSemaphoreAPI(); - prvExerciseTaskNotificationAPI(); - - /* For code coverage test purposes it is deleted by the Idle task. */ - configASSERT( uxTaskGetStackHighWaterMark( NULL ) > 0 ); - vTaskSuspend( NULL ); + /* Remove compiler warnings about unused parameters. */ + ( void ) pvParameters; + + /* Check the enter and exit critical macros are working correctly. If the + * SVC priority is below configMAX_SYSCALL_INTERRUPT_PRIORITY then this will + * fault. */ + taskENTER_CRITICAL(); + taskEXIT_CRITICAL(); + + /* Exercise the API of various RTOS objects. */ + prvExerciseEventGroupAPI(); + prvExerciseSemaphoreAPI(); + prvExerciseTaskNotificationAPI(); + + /* For code coverage test purposes it is deleted by the Idle task. */ + configASSERT( uxTaskGetStackHighWaterMark( NULL ) > 0 ); + vTaskSuspend( NULL ); } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile const uint32_t *pul; -volatile uint32_t ulReadData; - - /* The idle task, and therefore this function, run in Supervisor mode and - can therefore access all memory. Try reading from corners of flash and - RAM to ensure a memory fault does not occur. - - Start with the edges of the privileged data area. */ - pul = __privileged_data_start__; - ulReadData = *pul; - pul = __privileged_data_end__ - 1; - ulReadData = *pul; - - /* Next the standard SRAM area. */ - pul = __SRAM_segment_end__ - 1; - ulReadData = *pul; - - /* And the standard Flash area - the start of which is marked for - privileged access only. */ - pul = __FLASH_segment_start__; - ulReadData = *pul; - pul = __FLASH_segment_end__ - 1; - ulReadData = *pul; - - /* Reading off the end of Flash or SRAM space should cause a fault. - Uncomment one of the following two pairs of lines to test. */ - - /* pul = __FLASH_segment_end__ + 4; - ulReadData = *pul; */ - - /* pul = __SRAM_segment_end__ + 1; - ulReadData = *pul; */ - - /* One task is created purely so it can be deleted - done for code coverage - test purposes. */ - if( xTaskToDelete != NULL ) - { - vTaskDelete( xTaskToDelete ); - xTaskToDelete = NULL; - } - - ( void ) ulReadData; + volatile const uint32_t * pul; + volatile uint32_t ulReadData; + + /* The idle task, and therefore this function, run in Supervisor mode and + * can therefore access all memory. Try reading from corners of flash and + * RAM to ensure a memory fault does not occur. + * + * Start with the edges of the privileged data area. */ + pul = __privileged_data_start__; + ulReadData = *pul; + pul = __privileged_data_end__ - 1; + ulReadData = *pul; + + /* Next the standard SRAM area. */ + pul = __SRAM_segment_end__ - 1; + ulReadData = *pul; + + /* And the standard Flash area - the start of which is marked for + * privileged access only. */ + pul = __FLASH_segment_start__; + ulReadData = *pul; + pul = __FLASH_segment_end__ - 1; + ulReadData = *pul; + + /* Reading off the end of Flash or SRAM space should cause a fault. + * Uncomment one of the following two pairs of lines to test. */ + + /* pul = __FLASH_segment_end__ + 4; + * ulReadData = *pul; */ + + /* pul = __SRAM_segment_end__ + 1; + * ulReadData = *pul; */ + + /* One task is created purely so it can be deleted - done for code coverage + * test purposes. */ + if( xTaskToDelete != NULL ) + { + vTaskDelete( xTaskToDelete ); + xTaskToDelete = NULL; + } + + ( void ) ulReadData; } /*-----------------------------------------------------------*/ static void prvOldStyleUserModeTask( void ) { /*const volatile uint32_t *pulStandardPeripheralRegister = ( volatile uint32_t * ) 0x40000000;*/ -volatile const uint32_t *pul; -volatile uint32_t ulReadData; + volatile const uint32_t * pul; + volatile uint32_t ulReadData; /* The following lines are commented out to prevent the unused variable -compiler warnings when the tests that use the variable are also commented out. */ + * compiler warnings when the tests that use the variable are also commented out. */ /* extern uint32_t __privileged_functions_start__[]; */ /* const volatile uint32_t *pulSystemPeripheralRegister = ( volatile uint32_t * ) 0xe000e014; */ - /* This task is created in User mode using the original xTaskCreate() API - function. It should have access to all Flash and RAM except that marked - as Privileged access only. Reading from the start and end of the non- - privileged RAM should not cause a problem (the privileged RAM is the first - block at the bottom of the RAM memory). */ - pul = __privileged_data_end__ + 1; - ulReadData = *pul; - pul = __SRAM_segment_end__ - 1; - ulReadData = *pul; - - /* Likewise reading from the start and end of the non-privileged Flash - should not be a problem (the privileged Flash is the first block at the - bottom of the Flash memory). */ - pul = __privileged_functions_end__ + 1; - ulReadData = *pul; - pul = __FLASH_segment_end__ - 1; - ulReadData = *pul; - - /* Standard peripherals are accessible. */ - /*ulReadData = *pulStandardPeripheralRegister;*/ - - /* System peripherals are not accessible. Uncomment the following line - to test. Also uncomment the declaration of pulSystemPeripheralRegister - at the top of this function. - ulReadData = *pulSystemPeripheralRegister; */ - - /* Reading from anywhere inside the privileged Flash or RAM should cause a - fault. This can be tested by uncommenting any of the following pairs of - lines. Also uncomment the declaration of __privileged_functions_start__ - at the top of this function. */ - - /*pul = __privileged_functions_start__; - ulReadData = *pul;*/ - - /*pul = __privileged_functions_end__ - 1; - ulReadData = *pul;*/ - - /*pul = __privileged_data_start__; - ulReadData = *pul;*/ - - /*pul = __privileged_data_end__ - 1; - ulReadData = *pul;*/ - - ( void ) ulReadData; + /* This task is created in User mode using the original xTaskCreate() API + * function. It should have access to all Flash and RAM except that marked + * as Privileged access only. Reading from the start and end of the non- + * privileged RAM should not cause a problem (the privileged RAM is the first + * block at the bottom of the RAM memory). */ + pul = __privileged_data_end__ + 1; + ulReadData = *pul; + pul = __SRAM_segment_end__ - 1; + ulReadData = *pul; + + /* Likewise reading from the start and end of the non-privileged Flash + * should not be a problem (the privileged Flash is the first block at the + * bottom of the Flash memory). */ + pul = __privileged_functions_end__ + 1; + ulReadData = *pul; + pul = __FLASH_segment_end__ - 1; + ulReadData = *pul; + + /* Standard peripherals are accessible. */ + /*ulReadData = *pulStandardPeripheralRegister;*/ + + /* System peripherals are not accessible. Uncomment the following line + * to test. Also uncomment the declaration of pulSystemPeripheralRegister + * at the top of this function. + * ulReadData = *pulSystemPeripheralRegister; */ + + /* Reading from anywhere inside the privileged Flash or RAM should cause a + * fault. This can be tested by uncommenting any of the following pairs of + * lines. Also uncomment the declaration of __privileged_functions_start__ + * at the top of this function. */ + + /*pul = __privileged_functions_start__; + * ulReadData = *pul;*/ + + /*pul = __privileged_functions_end__ - 1; + * ulReadData = *pul;*/ + + /*pul = __privileged_data_start__; + * ulReadData = *pul;*/ + + /*pul = __privileged_data_end__ - 1; + * ulReadData = *pul;*/ + + ( void ) ulReadData; } /*-----------------------------------------------------------*/ -static void prvOldStylePrivilegedModeTask( void *pvParameters ) +static void prvOldStylePrivilegedModeTask( void * pvParameters ) { -volatile const uint32_t *pul; -volatile uint32_t ulReadData; -const volatile uint32_t *pulSystemPeripheralRegister = ( volatile uint32_t * ) 0xe000e014; /* Systick */ + volatile const uint32_t * pul; + volatile uint32_t ulReadData; + const volatile uint32_t * pulSystemPeripheralRegister = ( volatile uint32_t * ) 0xe000e014; /* Systick */ + /*const volatile uint32_t *pulStandardPeripheralRegister = ( volatile uint32_t * ) 0x40000000;*/ - ( void ) pvParameters; - - /* This task is created in Privileged mode using the original xTaskCreate() - API function. It should have access to all Flash and RAM including that - marked as Privileged access only. So reading from the start and end of the - non-privileged RAM should not cause a problem (the privileged RAM is the - first block at the bottom of the RAM memory). */ - pul = __privileged_data_end__ + 1; - ulReadData = *pul; - pul = __SRAM_segment_end__ - 1; - ulReadData = *pul; - - /* Likewise reading from the start and end of the non-privileged Flash - should not be a problem (the privileged Flash is the first block at the - bottom of the Flash memory). */ - pul = __privileged_functions_end__ + 1; - ulReadData = *pul; - pul = __FLASH_segment_end__ - 1; - ulReadData = *pul; - - /* Reading from anywhere inside the privileged Flash or RAM should also - not be a problem. */ - pul = __privileged_functions_start__; - ulReadData = *pul; - pul = __privileged_functions_end__ - 1; - ulReadData = *pul; - pul = __privileged_data_start__; - ulReadData = *pul; - pul = __privileged_data_end__ - 1; - ulReadData = *pul; - - /* Finally, accessing both System and normal peripherals should both be - possible. */ - ulReadData = *pulSystemPeripheralRegister; - /*ulReadData = *pulStandardPeripheralRegister;*/ - - /* Must not just run off the end of a task function, so delete this task. - Note that because this task was created using xTaskCreate() the stack was - allocated dynamically and I have not included any code to free it again. */ - vTaskDelete( NULL ); - - ( void ) ulReadData; + ( void ) pvParameters; + + /* This task is created in Privileged mode using the original xTaskCreate() + * API function. It should have access to all Flash and RAM including that + * marked as Privileged access only. So reading from the start and end of the + * non-privileged RAM should not cause a problem (the privileged RAM is the + * first block at the bottom of the RAM memory). */ + pul = __privileged_data_end__ + 1; + ulReadData = *pul; + pul = __SRAM_segment_end__ - 1; + ulReadData = *pul; + + /* Likewise reading from the start and end of the non-privileged Flash + * should not be a problem (the privileged Flash is the first block at the + * bottom of the Flash memory). */ + pul = __privileged_functions_end__ + 1; + ulReadData = *pul; + pul = __FLASH_segment_end__ - 1; + ulReadData = *pul; + + /* Reading from anywhere inside the privileged Flash or RAM should also + * not be a problem. */ + pul = __privileged_functions_start__; + ulReadData = *pul; + pul = __privileged_functions_end__ - 1; + ulReadData = *pul; + pul = __privileged_data_start__; + ulReadData = *pul; + pul = __privileged_data_end__ - 1; + ulReadData = *pul; + + /* Finally, accessing both System and normal peripherals should both be + * possible. */ + ulReadData = *pulSystemPeripheralRegister; + /*ulReadData = *pulStandardPeripheralRegister;*/ + + /* Must not just run off the end of a task function, so delete this task. + * Note that because this task was created using xTaskCreate() the stack was + * allocated dynamically and I have not included any code to free it again. */ + vTaskDelete( NULL ); + + ( void ) ulReadData; } /*-----------------------------------------------------------*/ void vMainDeleteMe( void ) { - vTaskDelete( NULL ); + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ -void vMainSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber ) +void vMainSendImAlive( QueueHandle_t xHandle, + uint32_t ulTaskNumber ) { - if( xHandle != NULL ) - { - xQueueSend( xHandle, &ulTaskNumber, mainDONT_BLOCK ); - } + if( xHandle != NULL ) + { + xQueueSend( xHandle, &ulTaskNumber, mainDONT_BLOCK ); + } } /*-----------------------------------------------------------*/ @@ -995,159 +1008,167 @@ static void prvSetupHardware( void ) void vApplicationTickHook( void ) { -static uint32_t ulCallCount = 0; -const uint32_t ulCallsBetweenSends = pdMS_TO_TICKS( 1000 ); -const uint32_t ulMessage = configPRINT_SYSTEM_STATUS; -portBASE_TYPE xDummy; - - /* If configUSE_TICK_HOOK is set to 1 then this function will get called - from each RTOS tick. It is called from the tick interrupt and therefore - will be executing in the privileged state. */ - - ulCallCount++; - - /* Is it time to print out the pass/fail message again? */ - if( ulCallCount >= ulCallsBetweenSends ) - { - ulCallCount = 0; - - /* Send a message to the check task to command it to check that all - the tasks are still running then print out the status. - - This is running in an ISR so has to use the "FromISR" version of - xQueueSend(). Because it is in an ISR it is running with privileges - so can access xGlobalScopeCheckQueue directly. */ - xQueueSendFromISR( xGlobalScopeCheckQueue, &ulMessage, &xDummy ); - } + static uint32_t ulCallCount = 0; + const uint32_t ulCallsBetweenSends = pdMS_TO_TICKS( 1000 ); + const uint32_t ulMessage = configPRINT_SYSTEM_STATUS; + portBASE_TYPE xDummy; + + /* If configUSE_TICK_HOOK is set to 1 then this function will get called + * from each RTOS tick. It is called from the tick interrupt and therefore + * will be executing in the privileged state. */ + + ulCallCount++; + + /* Is it time to print out the pass/fail message again? */ + if( ulCallCount >= ulCallsBetweenSends ) + { + ulCallCount = 0; + + /* Send a message to the check task to command it to check that all + * the tasks are still running then print out the status. + * + * This is running in an ISR so has to use the "FromISR" version of + * xQueueSend(). Because it is in an ISR it is running with privileges + * so can access xGlobalScopeCheckQueue directly. */ + xQueueSendFromISR( xGlobalScopeCheckQueue, &ulMessage, &xDummy ); + } } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - /* If configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2 then this - function will automatically get called if a task overflows its stack. */ - ( void ) pxTask; - ( void ) pcTaskName; - for( ;; ); + /* If configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2 then this + * function will automatically get called if a task overflows its stack. */ + ( void ) pxTask; + ( void ) pcTaskName; + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* If configUSE_MALLOC_FAILED_HOOK is set to 1 then this function will - be called automatically if a call to pvPortMalloc() fails. pvPortMalloc() - is called automatically when a task, queue or semaphore is created. */ - for( ;; ); + /* If configUSE_MALLOC_FAILED_HOOK is set to 1 then this function will + * be called automatically if a call to pvPortMalloc() fails. pvPortMalloc() + * is called automatically when a task, queue or semaphore is created. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ static void prvTimerCallback( TimerHandle_t xExpiredTimer ) { -uint32_t ulCount; + uint32_t ulCount; - /* The count of the number of times this timer has expired is saved in the - timer's ID. Obtain the current count. */ - ulCount = ( uint32_t ) pvTimerGetTimerID( xTimer ); + /* The count of the number of times this timer has expired is saved in the + * timer's ID. Obtain the current count. */ + ulCount = ( uint32_t ) pvTimerGetTimerID( xTimer ); - /* Increment the count, and save it back into the timer's ID. */ - ulCount++; - vTimerSetTimerID( xTimer, ( void * ) ulCount ); + /* Increment the count, and save it back into the timer's ID. */ + ulCount++; + vTimerSetTimerID( xTimer, ( void * ) ulCount ); - /* Let the check task know the timer is still running. */ - vMainSendImAlive( xGlobalScopeCheckQueue, configTIMER_STILL_EXECUTING ); + /* Let the check task know the timer is still running. */ + vMainSendImAlive( xGlobalScopeCheckQueue, configTIMER_STILL_EXECUTING ); } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an -implementation of vApplicationGetIdleTaskMemory() to provide the memory that is -used by the Idle task. */ -void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) + * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is + * used by the Idle task. */ +void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, + StackType_t ** ppxIdleTaskStackBuffer, + uint32_t * pulIdleTaskStackSize ) { /* If the buffers to be provided to the Idle task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xIdleTaskTCB; -static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Idle task's - state will be stored. */ - *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; - - /* Pass out the array that will be used as the Idle task's stack. */ - *ppxIdleTaskStackBuffer = uxIdleTaskStack; - - /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xIdleTaskTCB; + static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Idle task's + * state will be stored. */ + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + + /* Pass out the array that will be used as the Idle task's stack. */ + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + + /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the -application must provide an implementation of vApplicationGetTimerTaskMemory() -to provide the memory that is used by the Timer service task. */ -void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) + * application must provide an implementation of vApplicationGetTimerTaskMemory() + * to provide the memory that is used by the Timer service task. */ +void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, + StackType_t ** ppxTimerTaskStackBuffer, + uint32_t * pulTimerTaskStackSize ) { /* If the buffers to be provided to the Timer task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xTimerTaskTCB; -static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Timer - task's state will be stored. */ - *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; - - /* Pass out the array that will be used as the Timer task's stack. */ - *ppxTimerTaskStackBuffer = uxTimerTaskStack; - - /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xTimerTaskTCB; + static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Timer + * task's state will be stored. */ + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + + /* Pass out the array that will be used as the Timer task's stack. */ + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + + /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } /*-----------------------------------------------------------*/ -static void prvRegTest3Task( void *pvParameters ) +static void prvRegTest3Task( 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 == configREG_TEST_TASK_3_PARAMETER ) - { - /* Run the unprivileged mode access tests that used to be executed - form an unprivileged task created using the xTaskCreate() API. - Since the heap moved to the privileged data section xTaskCreate() can - no longer be used to create unprivileged tasks. */ - prvOldStyleUserModeTask(); - - /* Start the part of the test that is written in assembler. */ - vRegTest3Implementation(); - } - - /* 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 - not being incremented and flag an error. */ - vTaskDelete( NULL ); + /* 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 == configREG_TEST_TASK_3_PARAMETER ) + { + /* Run the unprivileged mode access tests that used to be executed + * form an unprivileged task created using the xTaskCreate() API. + * Since the heap moved to the privileged data section xTaskCreate() can + * no longer be used to create unprivileged tasks. */ + prvOldStyleUserModeTask(); + + /* Start the part of the test that is written in assembler. */ + vRegTest3Implementation(); + } + + /* 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 + * not being incremented and flag an error. */ + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ -static void prvRegTest4Task( void *pvParameters ) +static void prvRegTest4Task( 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 == configREG_TEST_TASK_4_PARAMETER ) - { - /* Start the part of the test that is written in assembler. */ - vRegTest4Implementation(); - } - - /* 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 - not being incremented and flag an error. */ - vTaskDelete( NULL ); + /* 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 == configREG_TEST_TASK_4_PARAMETER ) + { + /* Start the part of the test that is written in assembler. */ + vRegTest4Implementation(); + } + + /* 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 + * not being incremented and flag an error. */ + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ - - diff --git a/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Blinky_Demo/main_blinky.c index ecf1e4199a2..80b165448bb 100644 --- a/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/FreeRTOSConfig.h index 92833b4c55f..3ae14056162 100644 --- a/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/FreeRTOS_tick_config.c b/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/FreeRTOS_tick_config.c index d7bf163d60a..32aaa3b755a 100644 --- a/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/FreeRTOS_tick_config.c +++ b/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/FreeRTOS_tick_config.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Full_Demo/IntQueueTimer.c index 22bfce1d69c..518692f630e 100644 --- a/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Full_Demo/IntQueueTimer.h index 4fb214c4093..dc540323649 100644 --- a/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Full_Demo/main_full.c b/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Full_Demo/main_full.c index c96fbd6aaff..d0200529d1e 100644 --- a/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/main.c b/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/main.c index 556af543e00..5bbb7d4f436 100644 --- a/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/main.c +++ b/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/FreeRTOSConfig.h index d93f4bf6414..070cd6cf7bc 100644 --- a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/Library/het.c b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/Library/het.c index 7992b899948..035b23d7923 100644 --- a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/Library/het.c +++ b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/Library/het.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/Library/het.h b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/Library/het.h index 0eb75960cfa..dae762a5fc5 100644 --- a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/Library/het.h +++ b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/Library/het.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/ParTest.c b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/ParTest.c index 7dd526a8e0c..d04194c8506 100644 --- a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/flop_hercules.c b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/flop_hercules.c index aed535baa77..37f6cd6e6e9 100644 --- a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/flop_hercules.c +++ b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/flop_hercules.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/flop_hercules.h b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/flop_hercules.h index f9eaefe1b7f..1e2d046dd2d 100644 --- a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/flop_hercules.h +++ b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/flop_hercules.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/main.c b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/main.c index 8a34daa8130..bfcebf16c05 100644 --- a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/main.c +++ b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -45,15 +45,15 @@ #include "task.h" /* Standard demo includes - just needed for the LED (ParTest) initialisation -function. */ + * function. */ #include "partest.h" /* Library includes. */ #include "het.h" /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 /*-----------------------------------------------------------*/ @@ -72,87 +72,93 @@ extern void main_full( void ); /*-----------------------------------------------------------*/ /* See the documentation page for this demo on the FreeRTOS.org web site for -full information - including hardware setup requirements. */ + * full information - including hardware setup requirements. */ int main( void ) { - /* Prepare the hardware to run this demo. */ - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* Prepare the hardware to run this demo. */ + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Perform any configuration necessary to use the ParTest LED output - functions. */ - vParTestInitialise(); + /* Perform any configuration necessary to use the ParTest LED output + * functions. */ + vParTestInitialise(); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* This function will be called by each tick interrupt if - configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - added here, but the tick hook is called from an interrupt context, so - code must not attempt to block, and only the interrupt safe FreeRTOS API - functions can be used (those that end in FromISR()). */ + /* This function will be called by each tick interrupt if + * configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + * added here, but the tick hook is called from an interrupt context, so + * code must not attempt to block, and only the interrupt safe FreeRTOS API + * functions can be used (those that end in FromISR()). */ } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/main_blinky.c b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/main_blinky.c index 267edd4524e..84aa835f3a0 100644 --- a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -73,30 +73,30 @@ #include "partest.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /* Values passed to the two tasks just to check the task parameter -functionality. */ -#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) -#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) + * functionality. */ +#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) +#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * Called by main() to create the simply blinky style application if @@ -113,85 +113,86 @@ static QueueHandle_t xQueue = NULL; void main_blinky( void ) { - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); - - if( xQueue != NULL ) - { - /* Start the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ - mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ - - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Start the tasks and timer running. */ - 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 insufficient FreeRTOS heap memory available for the idle and/or - timer tasks to be created. See the memory management section on the - FreeRTOS web site for more details. */ - for( ;; ); + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); + + if( xQueue != NULL ) + { + /* Start the two tasks as described in the comments at the top of this + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ + + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Start the tasks and timer running. */ + 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 insufficient FreeRTOS heap memory available for the idle and/or + * timer tasks to be created. See the memory management section on the + * FreeRTOS web site for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, the constant used converts ticks - to ms. While in the Blocked state this task will not consume any CPU - time. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - - /* 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 - will not block - it shouldn't need to block as the queue should always - be empty at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, the constant used converts ticks + * to ms. While in the Blocked state this task will not consume any CPU + * time. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + + /* 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 + * will not block - it shouldn't need to block as the queue should always + * be empty at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it the expected value? If it is, toggle the LED. */ - if( ulReceivedValue == 100UL ) - { - vParTestToggleLED( 0 ); - ulReceivedValue = 0U; - } - } + unsigned long ulReceivedValue; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it the expected value? If it is, toggle the LED. */ + if( ulReceivedValue == 100UL ) + { + vParTestToggleLED( 0 ); + ulReceivedValue = 0U; + } + } } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/main_full.c b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/main_full.c index fcece0d32eb..dca3359f3ae 100644 --- a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/main_full.c +++ b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -95,26 +95,26 @@ #include "comtest.h" /* Priorities for the demo application tasks. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2UL ) -#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 mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2UL ) +#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 mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY ) /* A block time of zero simply means "don't block". */ -#define mainDONT_BLOCK ( 0UL ) +#define mainDONT_BLOCK ( 0UL ) /* The period after which the check timer will expire, converted to ticks. */ -#define mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS ) +#define mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS ) /* The period after which the LED timer will expire, converted to ticks. */ -#define mainLED_TIMER_PERIOD_MS ( 75UL / portTICK_PERIOD_MS ) +#define mainLED_TIMER_PERIOD_MS ( 75UL / portTICK_PERIOD_MS ) /* Constants for the ComTest tasks. */ -#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 19200 ) -#define mainCOM_TEST_LED ( 100 ) +#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 19200 ) +#define mainCOM_TEST_LED ( 100 ) /*-----------------------------------------------------------*/ @@ -131,211 +131,213 @@ static void prvLEDTimerCallback( TimerHandle_t xTimer ); /* * The reg test tasks, as described at the top of this file. */ -extern void vRegTestTask1( void *pvParameters ); -extern void vRegTestTask2( void *pvParameters ); +extern void vRegTestTask1( void * pvParameters ); +extern void vRegTestTask2( void * pvParameters ); /*-----------------------------------------------------------*/ /* Variables that are incremented on each iteration of the reg test tasks - -provided the tasks have not reported any errors. The check task 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. */ + * provided the tasks have not reported any errors. The check task 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. */ volatile unsigned long ulRegTest1Counter = 0, ulRegTest2Counter = 0; /*-----------------------------------------------------------*/ void main_full( void ) { -TimerHandle_t xTimer = NULL; - - /* Start all the standard demo/test tasks. These have not particular - functionality, but do demonstrate how to use the FreeRTOS API, and test the - kernel port. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vStartDynamicPriorityTasks(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vCreateBlockTimeTasks(); - vStartCountingSemaphoreTasks(); - vStartGenericQueueTasks( tskIDLE_PRIORITY ); - vStartRecursiveMutexTasks(); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartMathTasks( mainFLOP_TASK_PRIORITY ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - - /* Create the register test tasks, as described at the top of this file. */ - xTaskCreate( vRegTestTask1, "Reg1...", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - xTaskCreate( vRegTestTask2, "Reg2...", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - - - /* Create the software timer that performs the 'check' functionality, - as described at the top of this file. */ - xTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ - ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - if( xTimer != NULL ) - { - xTimerStart( xTimer, mainDONT_BLOCK ); - } - - /* Create the software timer that performs the 'LED spin' functionality, - as described at the top of this file. */ - xTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */ - ( mainLED_TIMER_PERIOD_MS ),/* The timer period, in this case 75ms. */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvLEDTimerCallback /* The callback function that toggles the white LEDs. */ - ); - - if( xTimer != NULL ) - { - xTimerStart( xTimer, mainDONT_BLOCK ); - } - - /* The set of tasks created by the following function call have to be - created last as they keep account of the number of tasks they expect to see - running. */ - vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - - /* 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 - insufficient FreeRTOS heap memory available for the idle and/or timer tasks - to be created. See the memory management section on the FreeRTOS web site - for more details. */ - for( ;; ); + TimerHandle_t xTimer = NULL; + + /* Start all the standard demo/test tasks. These have not particular + * functionality, but do demonstrate how to use the FreeRTOS API, and test the + * kernel port. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartDynamicPriorityTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vCreateBlockTimeTasks(); + vStartCountingSemaphoreTasks(); + vStartGenericQueueTasks( tskIDLE_PRIORITY ); + vStartRecursiveMutexTasks(); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartMathTasks( mainFLOP_TASK_PRIORITY ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + + /* Create the register test tasks, as described at the top of this file. */ + xTaskCreate( vRegTestTask1, "Reg1...", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vRegTestTask2, "Reg2...", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + + + /* Create the software timer that performs the 'check' functionality, + * as described at the top of this file. */ + xTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ + ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + if( xTimer != NULL ) + { + xTimerStart( xTimer, mainDONT_BLOCK ); + } + + /* Create the software timer that performs the 'LED spin' functionality, + * as described at the top of this file. */ + xTimer = xTimerCreate( "LEDTimer", /* A text name, purely to help debugging. */ + ( mainLED_TIMER_PERIOD_MS ), /* The timer period, in this case 75ms. */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvLEDTimerCallback /* The callback function that toggles the white LEDs. */ + ); + + if( xTimer != NULL ) + { + xTimerStart( xTimer, mainDONT_BLOCK ); + } + + /* The set of tasks created by the following function call have to be + * created last as they keep account of the number of tasks they expect to see + * running. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + + /* 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 + * insufficient FreeRTOS heap memory available for the idle and/or timer tasks + * to be created. See the memory management section on the FreeRTOS web site + * for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ static void prvCheckTimerCallback( TimerHandle_t xTimer ) { -static long lChangeToRedLEDsAlready = pdFALSE; -static unsigned long ulLastRegTest1Counter = 0, ulLastRegTest2Counter = 0; -unsigned long ulErrorFound = pdFALSE; + static long lChangeToRedLEDsAlready = pdFALSE; + static unsigned long ulLastRegTest1Counter = 0, ulLastRegTest2Counter = 0; + unsigned long ulErrorFound = pdFALSE; + /* LEDs are defaulted to use the Green LEDs. The Red LEDs are used if an error -is found. */ -static unsigned long ulLED1 = 8, ulLED2 = 11; -const unsigned long ulRedLED1 = 6, ulRedLED2 = 9; - - /* Check all the demo tasks (other than the flash tasks) to ensure - they are all still running, and that none have detected an error. */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xIsCreateTaskStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xAreMathsTaskStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - /* Check the reg test tasks are still cycling. They will stop - incrementing their loop counters if they encounter an error. */ - if( ulRegTest1Counter == ulLastRegTest1Counter ) - { - ulErrorFound = pdTRUE; - } - - if( ulRegTest2Counter == ulLastRegTest2Counter ) - { - ulErrorFound = pdTRUE; - } - - ulLastRegTest1Counter = ulRegTest1Counter; - ulLastRegTest2Counter = ulRegTest2Counter; - - /* Toggle the check LEDs to give an indication of the system status. If - the green LEDs are toggling, then no errors have been detected. If the red - LEDs are toggling, then an error has been reported in at least one task. */ - vParTestToggleLED( ulLED1 ); - vParTestToggleLED( ulLED2 ); - - /* Have any errors been latch in ulErrorFound? If so, ensure the gree LEDs - are off, then switch to using the red LEDs. */ - if( ulErrorFound != pdFALSE ) - { - if( lChangeToRedLEDsAlready == pdFALSE ) - { - lChangeToRedLEDsAlready = pdTRUE; - - /* An error has been found. Switch to use the red LEDs. */ - vParTestSetLED( ulLED1, pdFALSE ); - vParTestSetLED( ulLED2, pdFALSE ); - ulLED1 = ulRedLED1; - ulLED2 = ulRedLED2; - } - } + * is found. */ + static unsigned long ulLED1 = 8, ulLED2 = 11; + const unsigned long ulRedLED1 = 6, ulRedLED2 = 9; + + /* Check all the demo tasks (other than the flash tasks) to ensure + * they are all still running, and that none have detected an error. */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xIsCreateTaskStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreMathsTaskStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + /* Check the reg test tasks are still cycling. They will stop + * incrementing their loop counters if they encounter an error. */ + if( ulRegTest1Counter == ulLastRegTest1Counter ) + { + ulErrorFound = pdTRUE; + } + + if( ulRegTest2Counter == ulLastRegTest2Counter ) + { + ulErrorFound = pdTRUE; + } + + ulLastRegTest1Counter = ulRegTest1Counter; + ulLastRegTest2Counter = ulRegTest2Counter; + + /* Toggle the check LEDs to give an indication of the system status. If + * the green LEDs are toggling, then no errors have been detected. If the red + * LEDs are toggling, then an error has been reported in at least one task. */ + vParTestToggleLED( ulLED1 ); + vParTestToggleLED( ulLED2 ); + + /* Have any errors been latch in ulErrorFound? If so, ensure the gree LEDs + * are off, then switch to using the red LEDs. */ + if( ulErrorFound != pdFALSE ) + { + if( lChangeToRedLEDsAlready == pdFALSE ) + { + lChangeToRedLEDsAlready = pdTRUE; + + /* An error has been found. Switch to use the red LEDs. */ + vParTestSetLED( ulLED1, pdFALSE ); + vParTestSetLED( ulLED2, pdFALSE ); + ulLED1 = ulRedLED1; + ulLED2 = ulRedLED2; + } + } } /*-----------------------------------------------------------*/ static void prvLEDTimerCallback( TimerHandle_t xTimer ) { -const unsigned long ulNumWhiteLEDs = 6; -static unsigned long ulLit1 = 2, ulLit2 = 1; + const unsigned long ulNumWhiteLEDs = 6; + static unsigned long ulLit1 = 2, ulLit2 = 1; - vParTestSetLED( ulLit2, pdFALSE ); + vParTestSetLED( ulLit2, pdFALSE ); - ulLit2 = ulLit1; - ulLit1++; + ulLit2 = ulLit1; + ulLit1++; - if( ulLit1 >= ulNumWhiteLEDs ) - { - ulLit1 = 0; - } + if( ulLit1 >= ulNumWhiteLEDs ) + { + ulLit1 = 0; + } - vParTestSetLED( ulLit1, pdTRUE ); + vParTestSetLED( ulLit1, pdTRUE ); } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/serial.c b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/serial.c index d2725923fa4..cc075d4bc6a 100644 --- a/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/serial.c +++ b/FreeRTOS/Demo/CORTEX_R4_RM48_TMS570_CCS5/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/Blinky_Demo/main_blinky.c index 5890eb98a19..ecb52e5193b 100644 --- a/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/FreeRTOSConfig.h index a26ffd62416..d8117f78b2a 100644 --- a/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/FreeRTOS_tick_config.c b/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/FreeRTOS_tick_config.c index dc3fed4ebe6..5eaf11f0af8 100644 --- a/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/FreeRTOS_tick_config.c +++ b/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/FreeRTOS_tick_config.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/Full_Demo/IntQueueTimer.c index a8b723a3874..95d4fbc8a3e 100644 --- a/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/Full_Demo/IntQueueTimer.h index 4fb214c4093..dc540323649 100644 --- a/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/Full_Demo/main_full.c b/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/Full_Demo/main_full.c index 745cd2042b8..e448b317ed2 100644 --- a/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/main.c b/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/main.c index f143c471e3b..ba37bded830 100644 --- a/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/main.c +++ b/FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F100_Atollic/Simple_Demo_Source/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_STM32F100_Atollic/Simple_Demo_Source/FreeRTOSConfig.h index 68afe1a8a64..fce91014591 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F100_Atollic/Simple_Demo_Source/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_STM32F100_Atollic/Simple_Demo_Source/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F100_Atollic/Simple_Demo_Source/main.c b/FreeRTOS/Demo/CORTEX_STM32F100_Atollic/Simple_Demo_Source/main.c index bf0c3513c3f..3c96637827e 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F100_Atollic/Simple_Demo_Source/main.c +++ b/FreeRTOS/Demo/CORTEX_STM32F100_Atollic/Simple_Demo_Source/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/Drivers/STM32_USART.c b/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/Drivers/STM32_USART.c index 64fb86f56e6..9b7fd01f92a 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/Drivers/STM32_USART.c +++ b/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/Drivers/STM32_USART.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/Drivers/STM32_USART.h b/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/Drivers/STM32_USART.h index 5a9fbc4654d..276de7126e7 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/Drivers/STM32_USART.h +++ b/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/Drivers/STM32_USART.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/FreeRTOSConfig.h index 01bd522fa4f..626b041308c 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/ParTest/ParTest_MCBSTM32.c b/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/ParTest/ParTest_MCBSTM32.c index 2c91f576c94..816603a5c2c 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/ParTest/ParTest_MCBSTM32.c +++ b/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/ParTest/ParTest_MCBSTM32.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/ParTest/ParTest_ST_Eval.c b/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/ParTest/ParTest_ST_Eval.c index c0c9dc601be..8dcaf3f4cb0 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/ParTest/ParTest_ST_Eval.c +++ b/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/ParTest/ParTest_ST_Eval.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/main.c b/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/main.c index 7cd3ea50382..15a224eb662 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/main.c +++ b/FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -86,25 +86,25 @@ /* The time between cycles of the 'check' task - which depends on whether the -check task has detected an error or not. */ -#define mainCHECK_DELAY_NO_ERROR ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) -#define mainCHECK_DELAY_ERROR ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) + * check task has detected an error or not. */ +#define mainCHECK_DELAY_NO_ERROR ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) +#define mainCHECK_DELAY_ERROR ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) /* The LED controlled by the 'check' task. */ -#define mainCHECK_LED ( 3 ) +#define mainCHECK_LED ( 3 ) /* Task priorities. */ -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainECHO_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainECHO_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) /* COM port and baud rate used by the echo task. */ -#define mainCOM0 ( 0 ) -#define mainBAUD_RATE ( 115200 ) +#define mainCOM0 ( 0 ) +#define mainBAUD_RATE ( 115200 ) /*-----------------------------------------------------------*/ @@ -114,222 +114,235 @@ check task has detected an error or not. */ static void prvSetupHardware( void ); /* The 'check' task as described at the top of this file. */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); /* A simple task that echoes all the characters that are received on COM0 -(USART1). */ -static void prvUSARTEchoTask( void *pvParameters ); + * (USART1). */ +static void prvUSARTEchoTask( void * pvParameters ); /*-----------------------------------------------------------*/ int main( void ) { -#ifdef DEBUG - debug(); -#endif + #ifdef DEBUG + debug(); + #endif - /* Set up the clocks and memory interface. */ - prvSetupHardware(); + /* Set up the clocks and memory interface. */ + prvSetupHardware(); - /* Start the standard demo tasks. These are just here to exercise the - kernel port and provide examples of how the FreeRTOS API can be used. */ - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + /* Start the standard demo tasks. These are just here to exercise the + * kernel port and provide examples of how the FreeRTOS API can be used. */ + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY ); vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); - vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY ); + vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY ); vStartQueuePeekTasks(); vStartRecursiveMutexTasks(); - /* Create the 'echo' task, which is also defined within this file. */ - xTaskCreate( prvUSARTEchoTask, "Echo", configMINIMAL_STACK_SIZE, NULL, mainECHO_TASK_PRIORITY, NULL ); + /* Create the 'echo' task, which is also defined within this file. */ + xTaskCreate( prvUSARTEchoTask, "Echo", configMINIMAL_STACK_SIZE, NULL, mainECHO_TASK_PRIORITY, NULL ); - /* Create the 'check' task, which is also defined within this file. */ - xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + /* Create the 'check' task, which is also defined within this file. */ + xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); /* Start the scheduler. */ - vTaskStartScheduler(); + vTaskStartScheduler(); /* Will only get here if there was insufficient memory to create the idle - task. The idle task is created within vTaskStartScheduler(). */ - for( ;; ); + * task. The idle task is created within vTaskStartScheduler(). */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ /* Described at the top of this file. */ -static void prvCheckTask( void *pvParameters ) +static void prvCheckTask( void * pvParameters ) { -TickType_t xLastExecutionTime; -unsigned long ulTicksToWait = mainCHECK_DELAY_NO_ERROR; - - /* Just to remove the compiler warning about the unused parameter. */ - ( void ) pvParameters; - - /* Initialise the variable used to control our iteration rate prior to - its first use. */ - xLastExecutionTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Wait until it is time to run the tests again. */ - vTaskDelayUntil( &xLastExecutionTime, ulTicksToWait ); - - /* Has an error been found in any task? */ - if( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - /* Reduce the time between cycles of this task - which has the - effect of increasing the rate at which the 'check' LED toggles to - indicate the existence of an error to an observer. */ - ulTicksToWait = mainCHECK_DELAY_ERROR; - } - else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) - { - ulTicksToWait = mainCHECK_DELAY_ERROR; - } - else if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - ulTicksToWait = mainCHECK_DELAY_ERROR; - } - else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - ulTicksToWait = mainCHECK_DELAY_ERROR; - } - else if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - ulTicksToWait = mainCHECK_DELAY_ERROR; - } - else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - ulTicksToWait = mainCHECK_DELAY_ERROR; - } - - vParTestToggleLED( mainCHECK_LED ); - } + TickType_t xLastExecutionTime; + unsigned long ulTicksToWait = mainCHECK_DELAY_NO_ERROR; + + /* Just to remove the compiler warning about the unused parameter. */ + ( void ) pvParameters; + + /* Initialise the variable used to control our iteration rate prior to + * its first use. */ + xLastExecutionTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Wait until it is time to run the tests again. */ + vTaskDelayUntil( &xLastExecutionTime, ulTicksToWait ); + + /* Has an error been found in any task? */ + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + /* Reduce the time between cycles of this task - which has the + * effect of increasing the rate at which the 'check' LED toggles to + * indicate the existence of an error to an observer. */ + ulTicksToWait = mainCHECK_DELAY_ERROR; + } + else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) + { + ulTicksToWait = mainCHECK_DELAY_ERROR; + } + else if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + ulTicksToWait = mainCHECK_DELAY_ERROR; + } + else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + ulTicksToWait = mainCHECK_DELAY_ERROR; + } + else if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + ulTicksToWait = mainCHECK_DELAY_ERROR; + } + else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + ulTicksToWait = mainCHECK_DELAY_ERROR; + } + + vParTestToggleLED( mainCHECK_LED ); + } } /*-----------------------------------------------------------*/ /* Described at the top of this file. */ -static void prvUSARTEchoTask( void *pvParameters ) +static void prvUSARTEchoTask( void * pvParameters ) { -signed char cChar; + signed char cChar; /* String declared static to ensure it does not end up on the stack, no matter -what the optimisation level. */ -static const char *pcLongishString = -"ABBA was a Swedish pop music group formed in Stockholm in 1972, consisting of Anni-Frid Frida Lyngstad, " -"Bjrn Ulvaeus, Benny Andersson and Agnetha Fltskog. Throughout the band's existence, Fltskog and Ulvaeus " -"were a married couple, as were Lyngstad and Andersson - although both couples later divorced. They became one " -"of the most commercially successful acts in the history of popular music, and they topped the charts worldwide " -"from 1972 to 1983. ABBA gained international popularity employing catchy song hooks, simple lyrics, sound " -"effects (reverb, phasing) and a Wall of Sound achieved by overdubbing the female singers' voices in multiple " -"harmonies. As their popularity grew, they were sought after to tour Europe, Australia, and North America, drawing " -"crowds of ardent fans, notably in Australia. Touring became a contentious issue, being particularly cumbersome for " -"Fltskog, but they continued to release studio albums to widespread commercial success. At the height of their " -"popularity, however, both relationships began suffering strain that led ultimately to the collapse of first the " -"Ulvaeus-Fltskog marriage (in 1979) and then of the Andersson-Lyngstad marriage in 1981. In the late 1970s and early " -"1980s these relationship changes began manifesting in the group's music, as they produced more thoughtful, " -"introspective lyrics with different compositions."; - - /* Just to avoid compiler warnings. */ - ( void ) pvParameters; - - /* Initialise COM0, which is USART1 according to the STM32 libraries. */ - lCOMPortInit( mainCOM0, mainBAUD_RATE ); - - /* Try sending out a string all in one go, as a very basic test of the - lSerialPutString() function. */ + * what the optimisation level. */ + static const char * pcLongishString = + "ABBA was a Swedish pop music group formed in Stockholm in 1972, consisting of Anni-Frid Frida Lyngstad, " + "Bjrn Ulvaeus, Benny Andersson and Agnetha Fltskog. Throughout the band's existence, Fltskog and Ulvaeus " + "were a married couple, as were Lyngstad and Andersson - although both couples later divorced. They became one " + "of the most commercially successful acts in the history of popular music, and they topped the charts worldwide " + "from 1972 to 1983. ABBA gained international popularity employing catchy song hooks, simple lyrics, sound " + "effects (reverb, phasing) and a Wall of Sound achieved by overdubbing the female singers' voices in multiple " + "harmonies. As their popularity grew, they were sought after to tour Europe, Australia, and North America, drawing " + "crowds of ardent fans, notably in Australia. Touring became a contentious issue, being particularly cumbersome for " + "Fltskog, but they continued to release studio albums to widespread commercial success. At the height of their " + "popularity, however, both relationships began suffering strain that led ultimately to the collapse of first the " + "Ulvaeus-Fltskog marriage (in 1979) and then of the Andersson-Lyngstad marriage in 1981. In the late 1970s and early " + "1980s these relationship changes began manifesting in the group's music, as they produced more thoughtful, " + "introspective lyrics with different compositions."; + + /* Just to avoid compiler warnings. */ + ( void ) pvParameters; + + /* Initialise COM0, which is USART1 according to the STM32 libraries. */ + lCOMPortInit( mainCOM0, mainBAUD_RATE ); + + /* Try sending out a string all in one go, as a very basic test of the + * lSerialPutString() function. */ lSerialPutString( mainCOM0, pcLongishString, strlen( pcLongishString ) ); - for( ;; ) - { - /* Block to wait for a character to be received on COM0. */ - xSerialGetChar( mainCOM0, &cChar, portMAX_DELAY ); + for( ; ; ) + { + /* Block to wait for a character to be received on COM0. */ + xSerialGetChar( mainCOM0, &cChar, portMAX_DELAY ); - /* Write the received character back to COM0. */ - xSerialPutChar( mainCOM0, cChar, 0 ); - } + /* Write the received character back to COM0. */ + xSerialPutChar( mainCOM0, cChar, 0 ); + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* RCC system reset(for debug purpose). */ - RCC_DeInit (); + /* RCC system reset(for debug purpose). */ + RCC_DeInit(); /* Enable HSE. */ - RCC_HSEConfig( RCC_HSE_ON ); + RCC_HSEConfig( RCC_HSE_ON ); - /* Wait till HSE is ready. */ - while (RCC_GetFlagStatus(RCC_FLAG_HSERDY) == RESET); + /* Wait till HSE is ready. */ + while( RCC_GetFlagStatus( RCC_FLAG_HSERDY ) == RESET ) + { + } /* HCLK = SYSCLK. */ - RCC_HCLKConfig( RCC_SYSCLK_Div1 ); + RCC_HCLKConfig( RCC_SYSCLK_Div1 ); /* PCLK2 = HCLK. */ - RCC_PCLK2Config( RCC_HCLK_Div1 ); + RCC_PCLK2Config( RCC_HCLK_Div1 ); /* PCLK1 = HCLK/2. */ - RCC_PCLK1Config( RCC_HCLK_Div2 ); + RCC_PCLK1Config( RCC_HCLK_Div2 ); - /* ADCCLK = PCLK2/4. */ - RCC_ADCCLKConfig( RCC_PCLK2_Div4 ); + /* ADCCLK = PCLK2/4. */ + RCC_ADCCLKConfig( RCC_PCLK2_Div4 ); /* Flash 2 wait state. */ - *( volatile unsigned long * )0x40022000 = 0x01; + *( volatile unsigned long * ) 0x40022000 = 0x01; - /* PLLCLK = 8MHz * 9 = 72 MHz */ - RCC_PLLConfig( RCC_PLLSource_HSE_Div1, RCC_PLLMul_9 ); + /* PLLCLK = 8MHz * 9 = 72 MHz */ + RCC_PLLConfig( RCC_PLLSource_HSE_Div1, RCC_PLLMul_9 ); /* Enable PLL. */ - RCC_PLLCmd( ENABLE ); + RCC_PLLCmd( ENABLE ); - /* Wait till PLL is ready. */ - while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET); + /* Wait till PLL is ready. */ + while( RCC_GetFlagStatus( RCC_FLAG_PLLRDY ) == RESET ) + { + } - /* Select PLL as system clock source. */ - RCC_SYSCLKConfig (RCC_SYSCLKSource_PLLCLK); + /* Select PLL as system clock source. */ + RCC_SYSCLKConfig( RCC_SYSCLKSource_PLLCLK ); - /* Wait till PLL is used as system clock source. */ - while (RCC_GetSYSCLKSource() != 0x08); + /* Wait till PLL is used as system clock source. */ + while( RCC_GetSYSCLKSource() != 0x08 ) + { + } - /* Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE and AFIO clocks */ - RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |RCC_APB2Periph_GPIOC - | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE ); + /* Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE and AFIO clocks */ + RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC + | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE ); - /* Set the Vector Table base address at 0x08000000. */ - NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 ); + /* Set the Vector Table base address at 0x08000000. */ + NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 ); - NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); + NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); - /* Configure HCLK clock as SysTick clock source. */ - SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK ); + /* Configure HCLK clock as SysTick clock source. */ + SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK ); - /* Initialise the IO used for the LED outputs. */ - vParTestInitialise(); + /* Initialise the IO used for the LED outputs. */ + vParTestInitialise(); - /* SPI2 Periph clock enable */ - RCC_APB1PeriphClockCmd( RCC_APB1Periph_SPI2, ENABLE ); + /* SPI2 Periph clock enable */ + RCC_APB1PeriphClockCmd( RCC_APB1Periph_SPI2, ENABLE ); } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - /* This function will get called if a task overflows its stack. If the - parameters are corrupt then inspect pxCurrentTCB to find which was the - offending task. */ + /* This function will get called if a task overflows its stack. If the + * parameters are corrupt then inspect pxCurrentTCB to find which was the + * offending task. */ - ( void ) pxTask; - ( void ) pcTaskName; + ( void ) pxTask; + ( void ) pcTaskName; - for( ;; ); + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -void assert_failed( unsigned char *pucFile, unsigned long ulLine ) +void assert_failed( unsigned char * pucFile, + unsigned long ulLine ) { - ( void ) pucFile; - ( void ) ulLine; + ( void ) pucFile; + ( void ) ulLine; - for( ;; ); + for( ; ; ) + { + } } - diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_STM32F103_IAR/FreeRTOSConfig.h index e7eee4f720e..60f8559b174 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_STM32F103_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_IAR/ParTest/ParTest.c b/FreeRTOS/Demo/CORTEX_STM32F103_IAR/ParTest/ParTest.c index c0c9dc601be..8dcaf3f4cb0 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_IAR/ParTest/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_STM32F103_IAR/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_IAR/main.c b/FreeRTOS/Demo/CORTEX_STM32F103_IAR/main.c index ec1af839242..2496f2291ea 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_IAR/main.c +++ b/FreeRTOS/Demo/CORTEX_STM32F103_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -81,44 +81,44 @@ #include "comtest2.h" /* Task priorities. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) /* Constants related to the LCD. */ -#define mainMAX_LINE ( 240 ) -#define mainROW_INCREMENT ( 24 ) -#define mainMAX_COLUMN ( 20 ) -#define mainCOLUMN_START ( 319 ) -#define mainCOLUMN_INCREMENT ( 16 ) +#define mainMAX_LINE ( 240 ) +#define mainROW_INCREMENT ( 24 ) +#define mainMAX_COLUMN ( 20 ) +#define mainCOLUMN_START ( 319 ) +#define mainCOLUMN_INCREMENT ( 16 ) /* The maximum number of message that can be waiting for display at any one -time. */ -#define mainLCD_QUEUE_SIZE ( 3 ) + * time. */ +#define mainLCD_QUEUE_SIZE ( 3 ) /* The check task uses the sprintf function so requires a little more stack. */ -#define mainCHECK_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE + 50 ) +#define mainCHECK_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE + 50 ) /* Dimensions the buffer into which the jitter time is written. */ -#define mainMAX_MSG_LEN 25 +#define mainMAX_MSG_LEN 25 /* The time between cycles of the 'check' task. */ -#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) +#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) /* The number of nano seconds between each processor clock. */ -#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) ) +#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) ) /* Baud rate used by the comtest tasks. */ -#define mainCOM_TEST_BAUD_RATE ( 115200 ) +#define mainCOM_TEST_BAUD_RATE ( 115200 ) /* The LED used by the comtest tasks. See the comtest.c file for more -information. */ -#define mainCOM_TEST_LED ( 3 ) + * information. */ +#define mainCOM_TEST_LED ( 3 ) /*-----------------------------------------------------------*/ @@ -138,12 +138,13 @@ static void prvConfigureLCD( void ); * access the LCD directly. Other tasks wanting to display a message send * the message to the gatekeeper. */ -static void vLCDTask( void *pvParameters ); +static void vLCDTask( void * pvParameters ); /* * Retargets the C library printf function to the USART. */ -int fputc( int ch, FILE *f ); +int fputc( int ch, + FILE * f ); /* * Checks the status of all the demo tasks then prints a message to the @@ -155,7 +156,7 @@ int fputc( int ch, FILE *f ); * Messages are not written directly to the terminal, but passed to vLCDTask * via a queue. */ -static void vCheckTask( void *pvParameters ); +static void vCheckTask( void * pvParameters ); /* * Configures the timers and interrupts for the fast interrupt test as @@ -172,90 +173,92 @@ QueueHandle_t xLCDQueue; int main( void ) { -#ifdef DEBUG - debug(); -#endif + #ifdef DEBUG + debug(); + #endif - prvSetupHardware(); + prvSetupHardware(); - /* Create the queue used by the LCD task. Messages for display on the LCD - are received via this queue. */ - xLCDQueue = xQueueCreate( mainLCD_QUEUE_SIZE, sizeof( xLCDMessage ) ); + /* Create the queue used by the LCD task. Messages for display on the LCD + * are received via this queue. */ + xLCDQueue = xQueueCreate( mainLCD_QUEUE_SIZE, sizeof( xLCDMessage ) ); - /* Start the standard demo tasks. */ - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + /* Start the standard demo tasks. */ + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); vCreateBlockTimeTasks(); vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY ); - vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - /* Start the tasks defined within this file/specific to this demo. */ + /* Start the tasks defined within this file/specific to this demo. */ xTaskCreate( vCheckTask, "Check", mainCHECK_TASK_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - xTaskCreate( vLCDTask, "LCD", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vLCDTask, "LCD", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - /* The suicide tasks must be created last as they need to know how many - tasks were running prior to their creation in order to ascertain whether - or not the correct/expected number of tasks are running at any given time. */ + /* The suicide tasks must be created last as they need to know how many + * tasks were running prior to their creation in order to ascertain whether + * or not the correct/expected number of tasks are running at any given time. */ vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - /* Configure the timers used by the fast interrupt timer test. */ - vSetupTimerTest(); + /* Configure the timers used by the fast interrupt timer test. */ + vSetupTimerTest(); - /* Start the scheduler. */ - vTaskStartScheduler(); + /* Start the scheduler. */ + vTaskStartScheduler(); - /* Will only get here if there was not enough heap space to create the - idle task. */ - return 0; + /* Will only get here if there was not enough heap space to create the + * idle task. */ + return 0; } /*-----------------------------------------------------------*/ -void vLCDTask( void *pvParameters ) +void vLCDTask( void * pvParameters ) { -xLCDMessage xMessage; + xLCDMessage xMessage; - /* Initialise the LCD and display a startup message. */ - prvConfigureLCD(); - LCD_DrawMonoPict( ( unsigned long * ) pcBitmap ); + /* Initialise the LCD and display a startup message. */ + prvConfigureLCD(); + LCD_DrawMonoPict( ( unsigned long * ) pcBitmap ); - for( ;; ) - { - /* Wait for a message to arrive that requires displaying. */ - while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS ); + for( ; ; ) + { + /* Wait for a message to arrive that requires displaying. */ + while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS ) + { + } - /* Display the message. Print each message to a different position. */ - printf( ( char const * ) xMessage.pcMessage ); - } + /* Display the message. Print each message to a different position. */ + printf( ( char const * ) xMessage.pcMessage ); + } } /*-----------------------------------------------------------*/ -static void vCheckTask( void *pvParameters ) +static void vCheckTask( void * pvParameters ) { -TickType_t xLastExecutionTime; -xLCDMessage xMessage; -static signed char cPassMessage[ mainMAX_MSG_LEN ]; -extern unsigned short usMaxJitter; + TickType_t xLastExecutionTime; + xLCDMessage xMessage; + static signed char cPassMessage[ mainMAX_MSG_LEN ]; + extern unsigned short usMaxJitter; - xLastExecutionTime = xTaskGetTickCount(); - xMessage.pcMessage = cPassMessage; + xLastExecutionTime = xTaskGetTickCount(); + xMessage.pcMessage = cPassMessage; - for( ;; ) - { - /* Perform this check every mainCHECK_DELAY milliseconds. */ - vTaskDelayUntil( &xLastExecutionTime, mainCHECK_DELAY ); + for( ; ; ) + { + /* Perform this check every mainCHECK_DELAY milliseconds. */ + vTaskDelayUntil( &xLastExecutionTime, mainCHECK_DELAY ); - /* Has an error been found in any task? */ + /* Has an error been found in any task? */ if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN BLOCK Q\n"; - } - else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN BLOCK TIME\n"; - } + { + xMessage.pcMessage = "ERROR IN BLOCK Q\n"; + } + else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "ERROR IN BLOCK TIME\n"; + } else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { xMessage.pcMessage = "ERROR IN SEMAPHORE\n"; @@ -272,162 +275,165 @@ extern unsigned short usMaxJitter; { xMessage.pcMessage = "ERROR IN MATH\n"; } - else if( xAreComTestTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN COM TEST\n"; - } - else - { - sprintf( ( char * ) cPassMessage, "PASS [%uns]\n", ( ( unsigned long ) usMaxJitter ) * mainNS_PER_CLOCK ); - } - - /* Send the message to the LCD gatekeeper for display. */ - xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); - } + else if( xAreComTestTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "ERROR IN COM TEST\n"; + } + else + { + sprintf( ( char * ) cPassMessage, "PASS [%uns]\n", ( ( unsigned long ) usMaxJitter ) * mainNS_PER_CLOCK ); + } + + /* Send the message to the LCD gatekeeper for display. */ + xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Start with the clocks in their expected state. */ - RCC_DeInit(); + /* Start with the clocks in their expected state. */ + RCC_DeInit(); - /* Enable HSE (high speed external clock). */ - RCC_HSEConfig( RCC_HSE_ON ); + /* Enable HSE (high speed external clock). */ + RCC_HSEConfig( RCC_HSE_ON ); - /* Wait till HSE is ready. */ - while( RCC_GetFlagStatus( RCC_FLAG_HSERDY ) == RESET ) - { - } + /* Wait till HSE is ready. */ + while( RCC_GetFlagStatus( RCC_FLAG_HSERDY ) == RESET ) + { + } - /* 2 wait states required on the flash. */ - *( ( unsigned long * ) 0x40022000 ) = 0x02; + /* 2 wait states required on the flash. */ + *( ( unsigned long * ) 0x40022000 ) = 0x02; - /* HCLK = SYSCLK */ - RCC_HCLKConfig( RCC_SYSCLK_Div1 ); + /* HCLK = SYSCLK */ + RCC_HCLKConfig( RCC_SYSCLK_Div1 ); - /* PCLK2 = HCLK */ - RCC_PCLK2Config( RCC_HCLK_Div1 ); + /* PCLK2 = HCLK */ + RCC_PCLK2Config( RCC_HCLK_Div1 ); - /* PCLK1 = HCLK/2 */ - RCC_PCLK1Config( RCC_HCLK_Div2 ); + /* PCLK1 = HCLK/2 */ + RCC_PCLK1Config( RCC_HCLK_Div2 ); - /* PLLCLK = 8MHz * 9 = 72 MHz. */ - RCC_PLLConfig( RCC_PLLSource_HSE_Div1, RCC_PLLMul_9 ); + /* PLLCLK = 8MHz * 9 = 72 MHz. */ + RCC_PLLConfig( RCC_PLLSource_HSE_Div1, RCC_PLLMul_9 ); - /* Enable PLL. */ - RCC_PLLCmd( ENABLE ); + /* Enable PLL. */ + RCC_PLLCmd( ENABLE ); - /* Wait till PLL is ready. */ - while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET) - { - } + /* Wait till PLL is ready. */ + while( RCC_GetFlagStatus( RCC_FLAG_PLLRDY ) == RESET ) + { + } - /* Select PLL as system clock source. */ - RCC_SYSCLKConfig( RCC_SYSCLKSource_PLLCLK ); + /* Select PLL as system clock source. */ + RCC_SYSCLKConfig( RCC_SYSCLKSource_PLLCLK ); - /* Wait till PLL is used as system clock source. */ - while( RCC_GetSYSCLKSource() != 0x08 ) - { - } + /* Wait till PLL is used as system clock source. */ + while( RCC_GetSYSCLKSource() != 0x08 ) + { + } - /* Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE and AFIO clocks */ - RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |RCC_APB2Periph_GPIOC - | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE ); + /* Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE and AFIO clocks */ + RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC + | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE ); - /* SPI2 Periph clock enable */ - RCC_APB1PeriphClockCmd( RCC_APB1Periph_SPI2, ENABLE ); + /* SPI2 Periph clock enable */ + RCC_APB1PeriphClockCmd( RCC_APB1Periph_SPI2, ENABLE ); - /* Set the Vector Table base address at 0x08000000 */ - NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 ); + /* Set the Vector Table base address at 0x08000000 */ + NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 ); - NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); + NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); - /* Configure HCLK clock as SysTick clock source. */ - SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK ); + /* Configure HCLK clock as SysTick clock source. */ + SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK ); - vParTestInitialise(); + vParTestInitialise(); } /*-----------------------------------------------------------*/ static void prvConfigureLCD( void ) { -GPIO_InitTypeDef GPIO_InitStructure; + GPIO_InitTypeDef GPIO_InitStructure; - /* Configure LCD Back Light (PA8) as output push-pull */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; - GPIO_Init( GPIOA, &GPIO_InitStructure ); + /* Configure LCD Back Light (PA8) as output push-pull */ + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; + GPIO_Init( GPIOA, &GPIO_InitStructure ); - /* Set the Backlight Pin */ - GPIO_WriteBit(GPIOA, GPIO_Pin_8, Bit_SET); + /* Set the Backlight Pin */ + GPIO_WriteBit( GPIOA, GPIO_Pin_8, Bit_SET ); - /* Initialize the LCD */ - LCD_Init(); + /* Initialize the LCD */ + LCD_Init(); - /* Set the Back Color */ - LCD_SetBackColor( White ); + /* Set the Back Color */ + LCD_SetBackColor( White ); - /* Set the Text Color */ - LCD_SetTextColor( 0x051F ); + /* Set the Text Color */ + LCD_SetTextColor( 0x051F ); - LCD_Clear(); + LCD_Clear(); } /*-----------------------------------------------------------*/ -int fputc( int ch, FILE *f ) +int fputc( int ch, + FILE * f ) { -static unsigned short usColumn = 0, usRefColumn = mainCOLUMN_START; -static unsigned char ucLine = 0; - - if( ( usColumn == 0 ) && ( ucLine == 0 ) ) - { - LCD_Clear(); - } - - if( ch != '\n' ) - { - /* Display one character on LCD */ - LCD_DisplayChar( ucLine, usRefColumn, (u8) ch ); - - /* Decrement the column position by 16 */ - usRefColumn -= mainCOLUMN_INCREMENT; - - /* Increment the character counter */ - usColumn++; - if( usColumn == mainMAX_COLUMN ) - { - ucLine += mainROW_INCREMENT; - usRefColumn = mainCOLUMN_START; - usColumn = 0; - } - } - else - { - /* Move back to the first column of the next line. */ - ucLine += mainROW_INCREMENT; - usRefColumn = mainCOLUMN_START; - usColumn = 0; - } - - /* Wrap back to the top of the display. */ - if( ucLine >= mainMAX_LINE ) - { - ucLine = 0; - } - - return ch; + static unsigned short usColumn = 0, usRefColumn = mainCOLUMN_START; + static unsigned char ucLine = 0; + + if( ( usColumn == 0 ) && ( ucLine == 0 ) ) + { + LCD_Clear(); + } + + if( ch != '\n' ) + { + /* Display one character on LCD */ + LCD_DisplayChar( ucLine, usRefColumn, ( u8 ) ch ); + + /* Decrement the column position by 16 */ + usRefColumn -= mainCOLUMN_INCREMENT; + + /* Increment the character counter */ + usColumn++; + + if( usColumn == mainMAX_COLUMN ) + { + ucLine += mainROW_INCREMENT; + usRefColumn = mainCOLUMN_START; + usColumn = 0; + } + } + else + { + /* Move back to the first column of the next line. */ + ucLine += mainROW_INCREMENT; + usRefColumn = mainCOLUMN_START; + usColumn = 0; + } + + /* Wrap back to the top of the display. */ + if( ucLine >= mainMAX_LINE ) + { + ucLine = 0; + } + + return ch; } /*-----------------------------------------------------------*/ #ifdef DEBUG /* Keep the linker happy. */ -void assert_failed( unsigned char* pcFile, unsigned long ulLine ) -{ - for( ;; ) - { - } -} + void assert_failed( unsigned char * pcFile, + unsigned long ulLine ) + { + for( ; ; ) + { + } + } #endif diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_IAR/serial/serial.c b/FreeRTOS/Demo/CORTEX_STM32F103_IAR/serial/serial.c index 7b0274833ca..8d994607db3 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_IAR/serial/serial.c +++ b/FreeRTOS/Demo/CORTEX_STM32F103_IAR/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_IAR/timertest.c b/FreeRTOS/Demo/CORTEX_STM32F103_IAR/timertest.c index b2286980f56..9e15d651ea1 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_IAR/timertest.c +++ b/FreeRTOS/Demo/CORTEX_STM32F103_IAR/timertest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_Keil/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_STM32F103_Keil/FreeRTOSConfig.h index e7eee4f720e..60f8559b174 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_Keil/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_STM32F103_Keil/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_Keil/ParTest/ParTest.c b/FreeRTOS/Demo/CORTEX_STM32F103_Keil/ParTest/ParTest.c index c0c9dc601be..8dcaf3f4cb0 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_Keil/ParTest/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_STM32F103_Keil/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_Keil/main.c b/FreeRTOS/Demo/CORTEX_STM32F103_Keil/main.c index ec1af839242..2496f2291ea 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_Keil/main.c +++ b/FreeRTOS/Demo/CORTEX_STM32F103_Keil/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -81,44 +81,44 @@ #include "comtest2.h" /* Task priorities. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) /* Constants related to the LCD. */ -#define mainMAX_LINE ( 240 ) -#define mainROW_INCREMENT ( 24 ) -#define mainMAX_COLUMN ( 20 ) -#define mainCOLUMN_START ( 319 ) -#define mainCOLUMN_INCREMENT ( 16 ) +#define mainMAX_LINE ( 240 ) +#define mainROW_INCREMENT ( 24 ) +#define mainMAX_COLUMN ( 20 ) +#define mainCOLUMN_START ( 319 ) +#define mainCOLUMN_INCREMENT ( 16 ) /* The maximum number of message that can be waiting for display at any one -time. */ -#define mainLCD_QUEUE_SIZE ( 3 ) + * time. */ +#define mainLCD_QUEUE_SIZE ( 3 ) /* The check task uses the sprintf function so requires a little more stack. */ -#define mainCHECK_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE + 50 ) +#define mainCHECK_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE + 50 ) /* Dimensions the buffer into which the jitter time is written. */ -#define mainMAX_MSG_LEN 25 +#define mainMAX_MSG_LEN 25 /* The time between cycles of the 'check' task. */ -#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) +#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) /* The number of nano seconds between each processor clock. */ -#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) ) +#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) ) /* Baud rate used by the comtest tasks. */ -#define mainCOM_TEST_BAUD_RATE ( 115200 ) +#define mainCOM_TEST_BAUD_RATE ( 115200 ) /* The LED used by the comtest tasks. See the comtest.c file for more -information. */ -#define mainCOM_TEST_LED ( 3 ) + * information. */ +#define mainCOM_TEST_LED ( 3 ) /*-----------------------------------------------------------*/ @@ -138,12 +138,13 @@ static void prvConfigureLCD( void ); * access the LCD directly. Other tasks wanting to display a message send * the message to the gatekeeper. */ -static void vLCDTask( void *pvParameters ); +static void vLCDTask( void * pvParameters ); /* * Retargets the C library printf function to the USART. */ -int fputc( int ch, FILE *f ); +int fputc( int ch, + FILE * f ); /* * Checks the status of all the demo tasks then prints a message to the @@ -155,7 +156,7 @@ int fputc( int ch, FILE *f ); * Messages are not written directly to the terminal, but passed to vLCDTask * via a queue. */ -static void vCheckTask( void *pvParameters ); +static void vCheckTask( void * pvParameters ); /* * Configures the timers and interrupts for the fast interrupt test as @@ -172,90 +173,92 @@ QueueHandle_t xLCDQueue; int main( void ) { -#ifdef DEBUG - debug(); -#endif + #ifdef DEBUG + debug(); + #endif - prvSetupHardware(); + prvSetupHardware(); - /* Create the queue used by the LCD task. Messages for display on the LCD - are received via this queue. */ - xLCDQueue = xQueueCreate( mainLCD_QUEUE_SIZE, sizeof( xLCDMessage ) ); + /* Create the queue used by the LCD task. Messages for display on the LCD + * are received via this queue. */ + xLCDQueue = xQueueCreate( mainLCD_QUEUE_SIZE, sizeof( xLCDMessage ) ); - /* Start the standard demo tasks. */ - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + /* Start the standard demo tasks. */ + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); vCreateBlockTimeTasks(); vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY ); - vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - /* Start the tasks defined within this file/specific to this demo. */ + /* Start the tasks defined within this file/specific to this demo. */ xTaskCreate( vCheckTask, "Check", mainCHECK_TASK_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - xTaskCreate( vLCDTask, "LCD", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vLCDTask, "LCD", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - /* The suicide tasks must be created last as they need to know how many - tasks were running prior to their creation in order to ascertain whether - or not the correct/expected number of tasks are running at any given time. */ + /* The suicide tasks must be created last as they need to know how many + * tasks were running prior to their creation in order to ascertain whether + * or not the correct/expected number of tasks are running at any given time. */ vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - /* Configure the timers used by the fast interrupt timer test. */ - vSetupTimerTest(); + /* Configure the timers used by the fast interrupt timer test. */ + vSetupTimerTest(); - /* Start the scheduler. */ - vTaskStartScheduler(); + /* Start the scheduler. */ + vTaskStartScheduler(); - /* Will only get here if there was not enough heap space to create the - idle task. */ - return 0; + /* Will only get here if there was not enough heap space to create the + * idle task. */ + return 0; } /*-----------------------------------------------------------*/ -void vLCDTask( void *pvParameters ) +void vLCDTask( void * pvParameters ) { -xLCDMessage xMessage; + xLCDMessage xMessage; - /* Initialise the LCD and display a startup message. */ - prvConfigureLCD(); - LCD_DrawMonoPict( ( unsigned long * ) pcBitmap ); + /* Initialise the LCD and display a startup message. */ + prvConfigureLCD(); + LCD_DrawMonoPict( ( unsigned long * ) pcBitmap ); - for( ;; ) - { - /* Wait for a message to arrive that requires displaying. */ - while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS ); + for( ; ; ) + { + /* Wait for a message to arrive that requires displaying. */ + while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS ) + { + } - /* Display the message. Print each message to a different position. */ - printf( ( char const * ) xMessage.pcMessage ); - } + /* Display the message. Print each message to a different position. */ + printf( ( char const * ) xMessage.pcMessage ); + } } /*-----------------------------------------------------------*/ -static void vCheckTask( void *pvParameters ) +static void vCheckTask( void * pvParameters ) { -TickType_t xLastExecutionTime; -xLCDMessage xMessage; -static signed char cPassMessage[ mainMAX_MSG_LEN ]; -extern unsigned short usMaxJitter; + TickType_t xLastExecutionTime; + xLCDMessage xMessage; + static signed char cPassMessage[ mainMAX_MSG_LEN ]; + extern unsigned short usMaxJitter; - xLastExecutionTime = xTaskGetTickCount(); - xMessage.pcMessage = cPassMessage; + xLastExecutionTime = xTaskGetTickCount(); + xMessage.pcMessage = cPassMessage; - for( ;; ) - { - /* Perform this check every mainCHECK_DELAY milliseconds. */ - vTaskDelayUntil( &xLastExecutionTime, mainCHECK_DELAY ); + for( ; ; ) + { + /* Perform this check every mainCHECK_DELAY milliseconds. */ + vTaskDelayUntil( &xLastExecutionTime, mainCHECK_DELAY ); - /* Has an error been found in any task? */ + /* Has an error been found in any task? */ if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN BLOCK Q\n"; - } - else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN BLOCK TIME\n"; - } + { + xMessage.pcMessage = "ERROR IN BLOCK Q\n"; + } + else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "ERROR IN BLOCK TIME\n"; + } else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) { xMessage.pcMessage = "ERROR IN SEMAPHORE\n"; @@ -272,162 +275,165 @@ extern unsigned short usMaxJitter; { xMessage.pcMessage = "ERROR IN MATH\n"; } - else if( xAreComTestTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN COM TEST\n"; - } - else - { - sprintf( ( char * ) cPassMessage, "PASS [%uns]\n", ( ( unsigned long ) usMaxJitter ) * mainNS_PER_CLOCK ); - } - - /* Send the message to the LCD gatekeeper for display. */ - xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); - } + else if( xAreComTestTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "ERROR IN COM TEST\n"; + } + else + { + sprintf( ( char * ) cPassMessage, "PASS [%uns]\n", ( ( unsigned long ) usMaxJitter ) * mainNS_PER_CLOCK ); + } + + /* Send the message to the LCD gatekeeper for display. */ + xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Start with the clocks in their expected state. */ - RCC_DeInit(); + /* Start with the clocks in their expected state. */ + RCC_DeInit(); - /* Enable HSE (high speed external clock). */ - RCC_HSEConfig( RCC_HSE_ON ); + /* Enable HSE (high speed external clock). */ + RCC_HSEConfig( RCC_HSE_ON ); - /* Wait till HSE is ready. */ - while( RCC_GetFlagStatus( RCC_FLAG_HSERDY ) == RESET ) - { - } + /* Wait till HSE is ready. */ + while( RCC_GetFlagStatus( RCC_FLAG_HSERDY ) == RESET ) + { + } - /* 2 wait states required on the flash. */ - *( ( unsigned long * ) 0x40022000 ) = 0x02; + /* 2 wait states required on the flash. */ + *( ( unsigned long * ) 0x40022000 ) = 0x02; - /* HCLK = SYSCLK */ - RCC_HCLKConfig( RCC_SYSCLK_Div1 ); + /* HCLK = SYSCLK */ + RCC_HCLKConfig( RCC_SYSCLK_Div1 ); - /* PCLK2 = HCLK */ - RCC_PCLK2Config( RCC_HCLK_Div1 ); + /* PCLK2 = HCLK */ + RCC_PCLK2Config( RCC_HCLK_Div1 ); - /* PCLK1 = HCLK/2 */ - RCC_PCLK1Config( RCC_HCLK_Div2 ); + /* PCLK1 = HCLK/2 */ + RCC_PCLK1Config( RCC_HCLK_Div2 ); - /* PLLCLK = 8MHz * 9 = 72 MHz. */ - RCC_PLLConfig( RCC_PLLSource_HSE_Div1, RCC_PLLMul_9 ); + /* PLLCLK = 8MHz * 9 = 72 MHz. */ + RCC_PLLConfig( RCC_PLLSource_HSE_Div1, RCC_PLLMul_9 ); - /* Enable PLL. */ - RCC_PLLCmd( ENABLE ); + /* Enable PLL. */ + RCC_PLLCmd( ENABLE ); - /* Wait till PLL is ready. */ - while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET) - { - } + /* Wait till PLL is ready. */ + while( RCC_GetFlagStatus( RCC_FLAG_PLLRDY ) == RESET ) + { + } - /* Select PLL as system clock source. */ - RCC_SYSCLKConfig( RCC_SYSCLKSource_PLLCLK ); + /* Select PLL as system clock source. */ + RCC_SYSCLKConfig( RCC_SYSCLKSource_PLLCLK ); - /* Wait till PLL is used as system clock source. */ - while( RCC_GetSYSCLKSource() != 0x08 ) - { - } + /* Wait till PLL is used as system clock source. */ + while( RCC_GetSYSCLKSource() != 0x08 ) + { + } - /* Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE and AFIO clocks */ - RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |RCC_APB2Periph_GPIOC - | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE ); + /* Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE and AFIO clocks */ + RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC + | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE ); - /* SPI2 Periph clock enable */ - RCC_APB1PeriphClockCmd( RCC_APB1Periph_SPI2, ENABLE ); + /* SPI2 Periph clock enable */ + RCC_APB1PeriphClockCmd( RCC_APB1Periph_SPI2, ENABLE ); - /* Set the Vector Table base address at 0x08000000 */ - NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 ); + /* Set the Vector Table base address at 0x08000000 */ + NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 ); - NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); + NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); - /* Configure HCLK clock as SysTick clock source. */ - SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK ); + /* Configure HCLK clock as SysTick clock source. */ + SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK ); - vParTestInitialise(); + vParTestInitialise(); } /*-----------------------------------------------------------*/ static void prvConfigureLCD( void ) { -GPIO_InitTypeDef GPIO_InitStructure; + GPIO_InitTypeDef GPIO_InitStructure; - /* Configure LCD Back Light (PA8) as output push-pull */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; - GPIO_Init( GPIOA, &GPIO_InitStructure ); + /* Configure LCD Back Light (PA8) as output push-pull */ + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; + GPIO_Init( GPIOA, &GPIO_InitStructure ); - /* Set the Backlight Pin */ - GPIO_WriteBit(GPIOA, GPIO_Pin_8, Bit_SET); + /* Set the Backlight Pin */ + GPIO_WriteBit( GPIOA, GPIO_Pin_8, Bit_SET ); - /* Initialize the LCD */ - LCD_Init(); + /* Initialize the LCD */ + LCD_Init(); - /* Set the Back Color */ - LCD_SetBackColor( White ); + /* Set the Back Color */ + LCD_SetBackColor( White ); - /* Set the Text Color */ - LCD_SetTextColor( 0x051F ); + /* Set the Text Color */ + LCD_SetTextColor( 0x051F ); - LCD_Clear(); + LCD_Clear(); } /*-----------------------------------------------------------*/ -int fputc( int ch, FILE *f ) +int fputc( int ch, + FILE * f ) { -static unsigned short usColumn = 0, usRefColumn = mainCOLUMN_START; -static unsigned char ucLine = 0; - - if( ( usColumn == 0 ) && ( ucLine == 0 ) ) - { - LCD_Clear(); - } - - if( ch != '\n' ) - { - /* Display one character on LCD */ - LCD_DisplayChar( ucLine, usRefColumn, (u8) ch ); - - /* Decrement the column position by 16 */ - usRefColumn -= mainCOLUMN_INCREMENT; - - /* Increment the character counter */ - usColumn++; - if( usColumn == mainMAX_COLUMN ) - { - ucLine += mainROW_INCREMENT; - usRefColumn = mainCOLUMN_START; - usColumn = 0; - } - } - else - { - /* Move back to the first column of the next line. */ - ucLine += mainROW_INCREMENT; - usRefColumn = mainCOLUMN_START; - usColumn = 0; - } - - /* Wrap back to the top of the display. */ - if( ucLine >= mainMAX_LINE ) - { - ucLine = 0; - } - - return ch; + static unsigned short usColumn = 0, usRefColumn = mainCOLUMN_START; + static unsigned char ucLine = 0; + + if( ( usColumn == 0 ) && ( ucLine == 0 ) ) + { + LCD_Clear(); + } + + if( ch != '\n' ) + { + /* Display one character on LCD */ + LCD_DisplayChar( ucLine, usRefColumn, ( u8 ) ch ); + + /* Decrement the column position by 16 */ + usRefColumn -= mainCOLUMN_INCREMENT; + + /* Increment the character counter */ + usColumn++; + + if( usColumn == mainMAX_COLUMN ) + { + ucLine += mainROW_INCREMENT; + usRefColumn = mainCOLUMN_START; + usColumn = 0; + } + } + else + { + /* Move back to the first column of the next line. */ + ucLine += mainROW_INCREMENT; + usRefColumn = mainCOLUMN_START; + usColumn = 0; + } + + /* Wrap back to the top of the display. */ + if( ucLine >= mainMAX_LINE ) + { + ucLine = 0; + } + + return ch; } /*-----------------------------------------------------------*/ #ifdef DEBUG /* Keep the linker happy. */ -void assert_failed( unsigned char* pcFile, unsigned long ulLine ) -{ - for( ;; ) - { - } -} + void assert_failed( unsigned char * pcFile, + unsigned long ulLine ) + { + for( ; ; ) + { + } + } #endif diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_Keil/serial/serial.c b/FreeRTOS/Demo/CORTEX_STM32F103_Keil/serial/serial.c index 7b0274833ca..8d994607db3 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_Keil/serial/serial.c +++ b/FreeRTOS/Demo/CORTEX_STM32F103_Keil/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_Keil/timertest.c b/FreeRTOS/Demo/CORTEX_STM32F103_Keil/timertest.c index b2286980f56..9e15d651ea1 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_Keil/timertest.c +++ b/FreeRTOS/Demo/CORTEX_STM32F103_Keil/timertest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/FreeRTOSConfig.h index b5894479248..049ea975b4e 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/ParTest/ParTest.c b/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/ParTest/ParTest.c index b447aa1174f..f0bc53c04b2 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/ParTest/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/bitmap.h b/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/bitmap.h index 05117109622..19dc67d3dca 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/bitmap.h +++ b/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/bitmap.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/main.c b/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/main.c index 4a95aa48685..069f3e6bd6d 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/main.c +++ b/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -64,7 +64,7 @@ */ /* CircleOS includes. Some of the CircleOS peripheral functionality is -utilised, although CircleOS itself is not used. */ + * utilised, although CircleOS itself is not used. */ #include "circle.h" /* Standard includes. */ @@ -83,68 +83,68 @@ utilised, although CircleOS itself is not used. */ #include "QPeek.h" /* The bitmap used to display the FreeRTOS.org logo is stored in 16bit format -and therefore takes up a large proportion of the Flash space. Setting this -parameter to 0 excludes the bitmap from the build, freeing up Flash space for -extra code. */ -#define mainINCLUDE_BITMAP 0 + * and therefore takes up a large proportion of the Flash space. Setting this + * parameter to 0 excludes the bitmap from the build, freeing up Flash space for + * extra code. */ +#define mainINCLUDE_BITMAP 0 #if mainINCLUDE_BITMAP == 1 - #include "bitmap.h" + #include "bitmap.h" #endif /* Task priorities. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainGEN_Q_PRIORITY ( tskIDLE_PRIORITY + 0 ) -#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainGEN_Q_PRIORITY ( tskIDLE_PRIORITY + 0 ) +#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* Splash screen related constants. */ -#define mainBITMAP_Y ( 38 ) -#define mainBITMAP_X ( 18 ) -#define mainURL_Y ( 8 ) -#define mainURL_X ( 78 ) -#define mainSPLASH_SCREEN_DELAY ( 2000 / portTICK_PERIOD_MS ) +#define mainBITMAP_Y ( 38 ) +#define mainBITMAP_X ( 18 ) +#define mainURL_Y ( 8 ) +#define mainURL_X ( 78 ) +#define mainSPLASH_SCREEN_DELAY ( 2000 / portTICK_PERIOD_MS ) /* Text drawing related constants. */ -#define mainLCD_CHAR_HEIGHT ( 13 ) -#define mainLCD_MAX_Y ( 110 ) +#define mainLCD_CHAR_HEIGHT ( 13 ) +#define mainLCD_MAX_Y ( 110 ) /* The maximum number of message that can be waiting for display at any one -time. */ -#define mainLCD_QUEUE_SIZE ( 3 ) + * time. */ +#define mainLCD_QUEUE_SIZE ( 3 ) /* The check task uses the sprintf function so requires a little more stack. */ -#define mainCHECK_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE + 50 ) +#define mainCHECK_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE + 50 ) /* The LCD task calls some of the CircleOS functions (for MEMS and LCD access), -these can require a larger stack. */ -#define configLCD_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE + 50 ) + * these can require a larger stack. */ +#define configLCD_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE + 50 ) /* Dimensions the buffer into which the jitter time is written. */ -#define mainMAX_MSG_LEN 25 +#define mainMAX_MSG_LEN 25 /* The time between cycles of the 'check' task. */ -#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) +#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) /* The period at which the MEMS input should be updated. */ -#define mainMEMS_DELAY ( ( TickType_t ) 100 / portTICK_PERIOD_MS ) +#define mainMEMS_DELAY ( ( TickType_t ) 100 / portTICK_PERIOD_MS ) /* The rate at which the flash task toggles the LED. */ -#define mainFLASH_DELAY ( ( TickType_t ) 1000 / portTICK_PERIOD_MS ) +#define mainFLASH_DELAY ( ( TickType_t ) 1000 / portTICK_PERIOD_MS ) /* The number of nano seconds between each processor clock. */ -#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) ) +#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) ) /* The two types of message that can be sent to the LCD task. */ -#define mainUPDATE_BALL_MESSAGE ( 0 ) -#define mainWRITE_STRING_MESSAGE ( 1 ) +#define mainUPDATE_BALL_MESSAGE ( 0 ) +#define mainWRITE_STRING_MESSAGE ( 1 ) /* Type of the message sent to the LCD task. */ typedef struct { - portBASE_TYPE xMessageType; - signed char *pcMessage; + portBASE_TYPE xMessageType; + signed char * pcMessage; } xLCDMessage; /*-----------------------------------------------------------*/ @@ -160,7 +160,7 @@ static void prvSetupHardware( void ); * access the LCD directly. Other tasks wanting to display a message send * the message to the gatekeeper. */ -static void prvLCDTask( void *pvParameters ); +static void prvLCDTask( void * pvParameters ); /* * Checks the status of all the demo tasks then prints a message to the @@ -175,7 +175,7 @@ static void prvLCDTask( void *pvParameters ); * The check task also receives instructions to update the MEMS input, which * in turn can also lead to the LCD being updated. */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); /* * Configures the timers and interrupts for the fast interrupt test as @@ -187,12 +187,14 @@ extern void vSetupTimerTest( void ); * A cut down version of sprintf() used to percent the HUGE GCC library * equivalent from being included in the binary image. */ -extern int sprintf(char *out, const char *format, ...); +extern int sprintf( char * out, + const char * format, + ... ); /* * Simple toggle the LED periodically for timing verification. */ -static void prvFlashTask( void *pvParameters ); +static void prvFlashTask( void * pvParameters ); /*-----------------------------------------------------------*/ @@ -203,255 +205,257 @@ QueueHandle_t xLCDQueue; int main( void ) { - #ifdef DEBUG - debug(); - #endif + #ifdef DEBUG + debug(); + #endif - prvSetupHardware(); + prvSetupHardware(); - /* Create the queue used by the LCD task. Messages for display on the LCD - are received via this queue. */ - xLCDQueue = xQueueCreate( mainLCD_QUEUE_SIZE, sizeof( xLCDMessage ) ); + /* Create the queue used by the LCD task. Messages for display on the LCD + * are received via this queue. */ + xLCDQueue = xQueueCreate( mainLCD_QUEUE_SIZE, sizeof( xLCDMessage ) ); - /* Start the standard demo tasks. */ - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + /* Start the standard demo tasks. */ + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); vCreateBlockTimeTasks(); - vStartGenericQueueTasks( mainGEN_Q_PRIORITY ); - vStartQueuePeekTasks(); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartGenericQueueTasks( mainGEN_Q_PRIORITY ); + vStartQueuePeekTasks(); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - /* Start the tasks defined within this file/specific to this demo. */ + /* Start the tasks defined within this file/specific to this demo. */ xTaskCreate( prvCheckTask, "Check", mainCHECK_TASK_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - xTaskCreate( prvLCDTask, "LCD", configLCD_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - xTaskCreate( prvFlashTask, "Flash", configMINIMAL_STACK_SIZE, NULL, mainFLASH_TASK_PRIORITY, NULL ); + xTaskCreate( prvLCDTask, "LCD", configLCD_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( prvFlashTask, "Flash", configMINIMAL_STACK_SIZE, NULL, mainFLASH_TASK_PRIORITY, NULL ); - /* Configure the timers used by the fast interrupt timer test. */ - vSetupTimerTest(); + /* Configure the timers used by the fast interrupt timer test. */ + vSetupTimerTest(); - /* Start the scheduler. */ - vTaskStartScheduler(); + /* Start the scheduler. */ + vTaskStartScheduler(); - /* Will only get here if there was not enough heap space to create the - idle task. */ - return 0; + /* Will only get here if there was not enough heap space to create the + * idle task. */ + return 0; } /*-----------------------------------------------------------*/ -void prvLCDTask( void *pvParameters ) +void prvLCDTask( void * pvParameters ) { -xLCDMessage xMessage; -char cY = mainLCD_CHAR_HEIGHT; -const char * const pcString = "www.FreeRTOS.org"; -const char * const pcBlankLine = " "; - - DRAW_Init(); - - #if mainINCLUDE_BITMAP == 1 - DRAW_SetImage( pucImage, mainBITMAP_Y, mainBITMAP_X, bmpBITMAP_HEIGHT, bmpBITMAP_WIDTH ); - #endif - - LCD_SetScreenOrientation( V9 ); - DRAW_DisplayString( mainURL_Y, mainURL_X, pcString, strlen( pcString ) ); - vTaskDelay( mainSPLASH_SCREEN_DELAY ); - LCD_FillRect( 0, 0, CHIP_SCREEN_WIDTH, CHIP_SCREEN_HEIGHT, RGB_WHITE ); - - for( ;; ) - { - /* Wait for a message to arrive that requires displaying. */ - while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS ); - - /* Check the message type. */ - if( xMessage.xMessageType == mainUPDATE_BALL_MESSAGE ) - { - /* Read the MEMS and update the ball display on the LCD if required. */ - MEMS_Handler(); - POINTER_Handler(); - } - else - { - /* A text string was sent. First blank off the old text string, then - draw the new text on the next line down. */ - DRAW_DisplayString( 0, cY, pcBlankLine, strlen( pcBlankLine ) ); - - cY -= mainLCD_CHAR_HEIGHT; - if( cY <= ( mainLCD_CHAR_HEIGHT - 1 ) ) - { - /* Wrap the line onto which we are going to write the text. */ - cY = mainLCD_MAX_Y; - } - - /* Display the message. */ - DRAW_DisplayString( 0, cY, xMessage.pcMessage, strlen( xMessage.pcMessage ) ); - } - } + xLCDMessage xMessage; + char cY = mainLCD_CHAR_HEIGHT; + const char * const pcString = "www.FreeRTOS.org"; + const char * const pcBlankLine = " "; + + DRAW_Init(); + + #if mainINCLUDE_BITMAP == 1 + DRAW_SetImage( pucImage, mainBITMAP_Y, mainBITMAP_X, bmpBITMAP_HEIGHT, bmpBITMAP_WIDTH ); + #endif + + LCD_SetScreenOrientation( V9 ); + DRAW_DisplayString( mainURL_Y, mainURL_X, pcString, strlen( pcString ) ); + vTaskDelay( mainSPLASH_SCREEN_DELAY ); + LCD_FillRect( 0, 0, CHIP_SCREEN_WIDTH, CHIP_SCREEN_HEIGHT, RGB_WHITE ); + + for( ; ; ) + { + /* Wait for a message to arrive that requires displaying. */ + while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS ) + { + } + + /* Check the message type. */ + if( xMessage.xMessageType == mainUPDATE_BALL_MESSAGE ) + { + /* Read the MEMS and update the ball display on the LCD if required. */ + MEMS_Handler(); + POINTER_Handler(); + } + else + { + /* A text string was sent. First blank off the old text string, then + * draw the new text on the next line down. */ + DRAW_DisplayString( 0, cY, pcBlankLine, strlen( pcBlankLine ) ); + + cY -= mainLCD_CHAR_HEIGHT; + + if( cY <= ( mainLCD_CHAR_HEIGHT - 1 ) ) + { + /* Wrap the line onto which we are going to write the text. */ + cY = mainLCD_MAX_Y; + } + + /* Display the message. */ + DRAW_DisplayString( 0, cY, xMessage.pcMessage, strlen( xMessage.pcMessage ) ); + } + } } /*-----------------------------------------------------------*/ -static void prvCheckTask( void *pvParameters ) +static void prvCheckTask( void * pvParameters ) { -TickType_t xLastExecutionTime; -xLCDMessage xMessage; -static signed char cPassMessage[ mainMAX_MSG_LEN ]; -extern unsigned short usMaxJitter; - - /* Initialise the xLastExecutionTime variable on task entry. */ - xLastExecutionTime = xTaskGetTickCount(); - - /* Setup the message we are going to send to the LCD task. */ - xMessage.xMessageType = mainWRITE_STRING_MESSAGE; - xMessage.pcMessage = cPassMessage; - - for( ;; ) - { - /* Perform this check every mainCHECK_DELAY milliseconds. */ - vTaskDelayUntil( &xLastExecutionTime, mainCHECK_DELAY ); - - /* Has an error been found in any task? If so then point the text - we are going to send to the LCD task to an error message instead of - the PASS message. */ - if( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN GEN Q"; - } + TickType_t xLastExecutionTime; + xLCDMessage xMessage; + static signed char cPassMessage[ mainMAX_MSG_LEN ]; + extern unsigned short usMaxJitter; + + /* Initialise the xLastExecutionTime variable on task entry. */ + xLastExecutionTime = xTaskGetTickCount(); + + /* Setup the message we are going to send to the LCD task. */ + xMessage.xMessageType = mainWRITE_STRING_MESSAGE; + xMessage.pcMessage = cPassMessage; + + for( ; ; ) + { + /* Perform this check every mainCHECK_DELAY milliseconds. */ + vTaskDelayUntil( &xLastExecutionTime, mainCHECK_DELAY ); + + /* Has an error been found in any task? If so then point the text + * we are going to send to the LCD task to an error message instead of + * the PASS message. */ + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "ERROR IN GEN Q"; + } + if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN BLOCK Q"; - } - else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN BLOCK TIME"; - } + { + xMessage.pcMessage = "ERROR IN BLOCK Q"; + } + else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "ERROR IN BLOCK TIME"; + } else if( xArePollingQueuesStillRunning() != pdTRUE ) { xMessage.pcMessage = "ERROR IN POLL Q"; } - else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "ERROR IN PEEK Q"; - } - else - { - /* No errors were found in any task, so send a pass message - with the max measured jitter time also included (as per the - fast interrupt test described at the top of this file and on - the online documentation page for this demo application). */ - sprintf( ( char * ) cPassMessage, "PASS [%uns]", ( ( unsigned long ) usMaxJitter ) * mainNS_PER_CLOCK ); - } - - /* Send the message to the LCD gatekeeper for display. */ - xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); - } + else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "ERROR IN PEEK Q"; + } + else + { + /* No errors were found in any task, so send a pass message + * with the max measured jitter time also included (as per the + * fast interrupt test described at the top of this file and on + * the online documentation page for this demo application). */ + sprintf( ( char * ) cPassMessage, "PASS [%uns]", ( ( unsigned long ) usMaxJitter ) * mainNS_PER_CLOCK ); + } + + /* Send the message to the LCD gatekeeper for display. */ + xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { -static unsigned long ulCallCount; -static const xLCDMessage xMemsMessage = { mainUPDATE_BALL_MESSAGE, NULL }; -static portBASE_TYPE xHigherPriorityTaskWoken; - - /* Periodically send a message to the LCD task telling it to update - the MEMS input, and then if necessary the LCD. */ - ulCallCount++; - if( ulCallCount >= mainMEMS_DELAY ) - { - ulCallCount = 0; - xHigherPriorityTaskWoken = pdFALSE; - xQueueSendFromISR( xLCDQueue, &xMemsMessage, &xHigherPriorityTaskWoken ); - } + static unsigned long ulCallCount; + static const xLCDMessage xMemsMessage = { mainUPDATE_BALL_MESSAGE, NULL }; + static portBASE_TYPE xHigherPriorityTaskWoken; + + /* Periodically send a message to the LCD task telling it to update + * the MEMS input, and then if necessary the LCD. */ + ulCallCount++; + + if( ulCallCount >= mainMEMS_DELAY ) + { + ulCallCount = 0; + xHigherPriorityTaskWoken = pdFALSE; + xQueueSendFromISR( xLCDQueue, &xMemsMessage, &xHigherPriorityTaskWoken ); + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Start with the clocks in their expected state. */ - RCC_DeInit(); + /* Start with the clocks in their expected state. */ + RCC_DeInit(); - /* Enable HSE (high speed external clock). */ - RCC_HSEConfig( RCC_HSE_ON ); + /* Enable HSE (high speed external clock). */ + RCC_HSEConfig( RCC_HSE_ON ); - /* Wait till HSE is ready. */ - while( RCC_GetFlagStatus( RCC_FLAG_HSERDY ) == RESET ) - { - } + /* Wait till HSE is ready. */ + while( RCC_GetFlagStatus( RCC_FLAG_HSERDY ) == RESET ) + { + } - /* 2 wait states required on the flash. */ - *( ( unsigned long * ) 0x40022000 ) = 0x02; + /* 2 wait states required on the flash. */ + *( ( unsigned long * ) 0x40022000 ) = 0x02; - /* HCLK = SYSCLK */ - RCC_HCLKConfig( RCC_SYSCLK_Div1 ); + /* HCLK = SYSCLK */ + RCC_HCLKConfig( RCC_SYSCLK_Div1 ); - /* PCLK2 = HCLK */ - RCC_PCLK2Config( RCC_HCLK_Div1 ); + /* PCLK2 = HCLK */ + RCC_PCLK2Config( RCC_HCLK_Div1 ); - /* PCLK1 = HCLK/2 */ - RCC_PCLK1Config( RCC_HCLK_Div2 ); + /* PCLK1 = HCLK/2 */ + RCC_PCLK1Config( RCC_HCLK_Div2 ); - /* PLLCLK = 12MHz * 6 = 72 MHz. */ - RCC_PLLConfig( RCC_PLLSource_HSE_Div1, RCC_PLLMul_6 ); + /* PLLCLK = 12MHz * 6 = 72 MHz. */ + RCC_PLLConfig( RCC_PLLSource_HSE_Div1, RCC_PLLMul_6 ); - /* Enable PLL. */ - RCC_PLLCmd( ENABLE ); + /* Enable PLL. */ + RCC_PLLCmd( ENABLE ); - /* Wait till PLL is ready. */ - while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET) - { - } + /* Wait till PLL is ready. */ + while( RCC_GetFlagStatus( RCC_FLAG_PLLRDY ) == RESET ) + { + } - /* Select PLL as system clock source. */ - RCC_SYSCLKConfig( RCC_SYSCLKSource_PLLCLK ); + /* Select PLL as system clock source. */ + RCC_SYSCLKConfig( RCC_SYSCLKSource_PLLCLK ); - /* Wait till PLL is used as system clock source. */ - while( RCC_GetSYSCLKSource() != 0x08 ) - { - } + /* Wait till PLL is used as system clock source. */ + while( RCC_GetSYSCLKSource() != 0x08 ) + { + } - /* Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE and AFIO clocks */ - RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |RCC_APB2Periph_GPIOC - | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE ); + /* Enable GPIOA, GPIOB, GPIOC, GPIOD, GPIOE and AFIO clocks */ + RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC + | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE ); - /* SPI2 Periph clock enable */ - RCC_APB1PeriphClockCmd( RCC_APB1Periph_SPI2, ENABLE ); + /* SPI2 Periph clock enable */ + RCC_APB1PeriphClockCmd( RCC_APB1Periph_SPI2, ENABLE ); - /* Set the Vector Table base address at 0x08000000 */ - NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 ); + /* Set the Vector Table base address at 0x08000000 */ + NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 ); - NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); + NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); - /* Configure HCLK clock as SysTick clock source. */ - SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK ); + /* Configure HCLK clock as SysTick clock source. */ + SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK ); - /* Misc initialisation, including some of the CircleOS features. Note - that CircleOS itself is not used. */ - vParTestInitialise(); - MEMS_Init(); - POINTER_Init(); - POINTER_SetMode( POINTER_RESTORE_LESS ); + /* Misc initialisation, including some of the CircleOS features. Note + * that CircleOS itself is not used. */ + vParTestInitialise(); + MEMS_Init(); + POINTER_Init(); + POINTER_SetMode( POINTER_RESTORE_LESS ); } /*-----------------------------------------------------------*/ -static void prvFlashTask( void *pvParameters ) +static void prvFlashTask( void * pvParameters ) { -TickType_t xLastExecutionTime; - - /* Initialise the xLastExecutionTime variable on task entry. */ - xLastExecutionTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Simple toggle the LED periodically. This just provides some timing - verification. */ - vTaskDelayUntil( &xLastExecutionTime, mainFLASH_DELAY ); - vParTestToggleLED( 0 ); - } + TickType_t xLastExecutionTime; + + /* Initialise the xLastExecutionTime variable on task entry. */ + xLastExecutionTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Simple toggle the LED periodically. This just provides some timing + * verification. */ + vTaskDelayUntil( &xLastExecutionTime, mainFLASH_DELAY ); + vParTestToggleLED( 0 ); + } } /*-----------------------------------------------------------*/ void starting_delay( unsigned long ul ) { - vTaskDelay( ( TickType_t ) ul ); + vTaskDelay( ( TickType_t ) ul ); } - - - diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/timertest.c b/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/timertest.c index b2286980f56..9e15d651ea1 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/timertest.c +++ b/FreeRTOS/Demo/CORTEX_STM32F103_Primer_GCC/timertest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/STM32L_low_power_tick_management.c b/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/STM32L_low_power_tick_management.c index 24b9801cf8a..c16978c8e2f 100644 --- a/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/STM32L_low_power_tick_management.c +++ b/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/STM32L_low_power_tick_management.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/include/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/include/FreeRTOSConfig.h index cae24499fdb..b1bfec13dc1 100644 --- a/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/include/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/include/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/main.c b/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/main.c index c0c6fab921e..f9400ec7dc1 100644 --- a/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/main.c +++ b/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ @@ -61,182 +61,193 @@ extern void main_low_power( void ); extern void main_full( void ); /* Prototypes for the standard FreeRTOS callback/hook functions implemented -within this file. */ + * within this file. */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /*-----------------------------------------------------------*/ int main( void ) { - /* Prepare the hardware to run this demo. */ - prvSetupHardware(); - - /* The configCREATE_LOW_POWER_DEMO setting is described at the top of - this file. */ - #if configCREATE_LOW_POWER_DEMO == 1 - { - main_low_power(); - } - #else - { - main_full(); - } - #endif - - /* This line will never be reached. */ - return 0; + /* Prepare the hardware to run this demo. */ + prvSetupHardware(); + + /* The configCREATE_LOW_POWER_DEMO setting is described at the top of + * this file. */ + #if configCREATE_LOW_POWER_DEMO == 1 + { + main_low_power(); + } + #else + { + main_full(); + } + #endif + + /* This line will never be reached. */ + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { /* GPIO, EXTI and NVIC Init structure declaration */ -GPIO_InitTypeDef GPIO_InitStructure; -EXTI_InitTypeDef EXTI_InitStructure; -NVIC_InitTypeDef NVIC_InitStructure; -void SystemCoreClockUpdate( void ); - - /* System function that updates the SystemCoreClock variable. */ - SystemCoreClockUpdate(); - - /* Essential on STM32 Cortex-M devices. */ - NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); - - /* Systick is fed from HCLK/8. */ - SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK_Div8 ); - - /* Set MSI clock range to ~4.194MHz. */ - RCC_MSIRangeConfig( RCC_MSIRange_6 ); - - /* Enable the GPIOs clocks. */ - RCC_AHBPeriphClockCmd( RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC| RCC_AHBPeriph_GPIOD| RCC_AHBPeriph_GPIOE| RCC_AHBPeriph_GPIOH, ENABLE ); - - /* Enable comparator clocks. */ - RCC_APB1PeriphClockCmd( RCC_APB1Periph_COMP, ENABLE ); - - /* Enable SYSCFG clocks. */ - RCC_APB2PeriphClockCmd( RCC_APB2Periph_SYSCFG , ENABLE ); - - /* Set internal voltage regulator to 1.5V. */ - PWR_VoltageScalingConfig( PWR_VoltageScaling_Range2 ); - - /* Wait Until the Voltage Regulator is ready. */ - while( PWR_GetFlagStatus( PWR_FLAG_VOS ) != RESET ); - - /* Configure User Button pin as input */ - GPIO_InitStructure.GPIO_Pin = USERBUTTON_GPIO_PIN; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz; - GPIO_Init( USERBUTTON_GPIO_PORT, &GPIO_InitStructure ); - - /* Select User Button pin as input source for EXTI Line */ - SYSCFG_EXTILineConfig( EXTI_PortSourceGPIOA, EXTI_PinSource0 ); - - /* Configure EXT1 Line 0 in interrupt mode triggered on Rising edge */ - EXTI_InitStructure.EXTI_Line = EXTI_Line0 ; /* PA0 for User button AND IDD_WakeUP */ - EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; - EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; - EXTI_InitStructure.EXTI_LineCmd = ENABLE; - EXTI_Init( &EXTI_InitStructure ); - - /* Enable and set EXTI0 Interrupt to the lowest priority */ - NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configLIBRARY_LOWEST_INTERRUPT_PRIORITY; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; - NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - NVIC_Init( &NVIC_InitStructure ); - - /* Configure the LED_pin as output push-pull for LD3 & LD4 usage */ - GPIO_InitStructure.GPIO_Pin = LD_GREEN_GPIO_PIN | LD_BLUE_GPIO_PIN; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; - GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; - GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; - GPIO_Init( LD_GPIO_PORT, &GPIO_InitStructure ); - - /* Force a low level on LEDs */ - GPIO_LOW( LD_GPIO_PORT, LD_GREEN_GPIO_PIN ); - GPIO_LOW( LD_GPIO_PORT, LD_BLUE_GPIO_PIN ); + GPIO_InitTypeDef GPIO_InitStructure; + EXTI_InitTypeDef EXTI_InitStructure; + NVIC_InitTypeDef NVIC_InitStructure; + + void SystemCoreClockUpdate( void ); + + /* System function that updates the SystemCoreClock variable. */ + SystemCoreClockUpdate(); + + /* Essential on STM32 Cortex-M devices. */ + NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); + + /* Systick is fed from HCLK/8. */ + SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK_Div8 ); + + /* Set MSI clock range to ~4.194MHz. */ + RCC_MSIRangeConfig( RCC_MSIRange_6 ); + + /* Enable the GPIOs clocks. */ + RCC_AHBPeriphClockCmd( RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC | RCC_AHBPeriph_GPIOD | RCC_AHBPeriph_GPIOE | RCC_AHBPeriph_GPIOH, ENABLE ); + + /* Enable comparator clocks. */ + RCC_APB1PeriphClockCmd( RCC_APB1Periph_COMP, ENABLE ); + + /* Enable SYSCFG clocks. */ + RCC_APB2PeriphClockCmd( RCC_APB2Periph_SYSCFG, ENABLE ); + + /* Set internal voltage regulator to 1.5V. */ + PWR_VoltageScalingConfig( PWR_VoltageScaling_Range2 ); + + /* Wait Until the Voltage Regulator is ready. */ + while( PWR_GetFlagStatus( PWR_FLAG_VOS ) != RESET ) + { + } + + /* Configure User Button pin as input */ + GPIO_InitStructure.GPIO_Pin = USERBUTTON_GPIO_PIN; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; + GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz; + GPIO_Init( USERBUTTON_GPIO_PORT, &GPIO_InitStructure ); + + /* Select User Button pin as input source for EXTI Line */ + SYSCFG_EXTILineConfig( EXTI_PortSourceGPIOA, EXTI_PinSource0 ); + + /* Configure EXT1 Line 0 in interrupt mode triggered on Rising edge */ + EXTI_InitStructure.EXTI_Line = EXTI_Line0; /* PA0 for User button AND IDD_WakeUP */ + EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; + EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; + EXTI_InitStructure.EXTI_LineCmd = ENABLE; + EXTI_Init( &EXTI_InitStructure ); + + /* Enable and set EXTI0 Interrupt to the lowest priority */ + NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn; + NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configLIBRARY_LOWEST_INTERRUPT_PRIORITY; + NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; + NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; + NVIC_Init( &NVIC_InitStructure ); + + /* Configure the LED_pin as output push-pull for LD3 & LD4 usage */ + GPIO_InitStructure.GPIO_Pin = LD_GREEN_GPIO_PIN | LD_BLUE_GPIO_PIN; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; + GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; + GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; + GPIO_Init( LD_GPIO_PORT, &GPIO_InitStructure ); + + /* Force a low level on LEDs */ + GPIO_LOW( LD_GPIO_PORT, LD_GREEN_GPIO_PIN ); + GPIO_LOW( LD_GPIO_PORT, LD_BLUE_GPIO_PIN ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* This function will be called by each tick interrupt if - configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - added here, but the tick hook is called from an interrupt context, so - code must not attempt to block, and only the interrupt safe FreeRTOS API - functions can be used (those that end in FromISR()). */ + /* This function will be called by each tick interrupt if + * configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + * added here, but the tick hook is called from an interrupt context, so + * code must not attempt to block, and only the interrupt safe FreeRTOS API + * functions can be used (those that end in FromISR()). */ } /*-----------------------------------------------------------*/ -void vAssertCalled( unsigned long ulLine, const char * const pcFileName ) +void vAssertCalled( unsigned long ulLine, + const char * const pcFileName ) { -volatile unsigned long ulSetToNonZeroInDebuggerToContinue = 0; - - /* Parameters are not used. */ - ( void ) ulLine; - ( void ) pcFileName; - - taskENTER_CRITICAL(); - { - while( ulSetToNonZeroInDebuggerToContinue == 0 ) - { - /* Use the debugger to set ulSetToNonZeroInDebuggerToContinue to a - non zero value to step out of this function to the point that raised - this assert(). */ - __asm volatile( "NOP" ); - __asm volatile( "NOP" ); - } - } - taskEXIT_CRITICAL(); + volatile unsigned long ulSetToNonZeroInDebuggerToContinue = 0; + + /* Parameters are not used. */ + ( void ) ulLine; + ( void ) pcFileName; + + taskENTER_CRITICAL(); + { + while( ulSetToNonZeroInDebuggerToContinue == 0 ) + { + /* Use the debugger to set ulSetToNonZeroInDebuggerToContinue to a + * non zero value to step out of this function to the point that raised + * this assert(). */ + __asm volatile ( "NOP" ); + __asm volatile ( "NOP" ); + } + } + taskEXIT_CRITICAL(); } - diff --git a/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/main_full.c b/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/main_full.c index d55b938f00b..dec7e21410d 100644 --- a/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/main_full.c +++ b/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -86,22 +86,22 @@ #include "stm32l_discovery_lcd.h" /* Priorities for the demo application tasks. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2UL ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2UL ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2UL ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2UL ) /* A block time of zero simply means "don't block". */ -#define mainDONT_BLOCK ( 0UL ) +#define mainDONT_BLOCK ( 0UL ) /* The period after which the check timer will expire providing 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 mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS ) + * 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 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_PERIOD_MS constant. */ -#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) + * 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_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) /*-----------------------------------------------------------*/ @@ -119,178 +119,179 @@ static void prvConfigureLCD( void ); void main_full( void ) { -TimerHandle_t xCheckTimer = NULL; - - /* The LCD is only used in the Full demo. */ - prvConfigureLCD(); - - /* Start all the other standard demo/test tasks. They have no particular - functionality, but do demonstrate how to use the FreeRTOS API and test the - kernel port. */ - vStartDynamicPriorityTasks(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vCreateBlockTimeTasks(); - vStartCountingSemaphoreTasks(); - vStartGenericQueueTasks( tskIDLE_PRIORITY ); - vStartRecursiveMutexTasks(); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - - /* Create the software timer that performs the 'check' functionality, - as described at the top of this file. */ - xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ - ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - if( xCheckTimer != NULL ) - { - xTimerStart( xCheckTimer, mainDONT_BLOCK ); - } - - /* 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 - insufficient FreeRTOS heap memory available for the idle and/or timer tasks - to be created. See the memory management section on the FreeRTOS web site - for more details. */ - for( ;; ); + TimerHandle_t xCheckTimer = NULL; + + /* The LCD is only used in the Full demo. */ + prvConfigureLCD(); + + /* Start all the other standard demo/test tasks. They have no particular + * functionality, but do demonstrate how to use the FreeRTOS API and test the + * kernel port. */ + vStartDynamicPriorityTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vCreateBlockTimeTasks(); + vStartCountingSemaphoreTasks(); + vStartGenericQueueTasks( tskIDLE_PRIORITY ); + vStartRecursiveMutexTasks(); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + + /* Create the software timer that performs the 'check' functionality, + * as described at the top of this file. */ + xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ + ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + if( xCheckTimer != NULL ) + { + xTimerStart( xCheckTimer, mainDONT_BLOCK ); + } + + /* 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 + * insufficient FreeRTOS heap memory available for the idle and/or timer tasks + * to be created. See the memory management section on the FreeRTOS web site + * for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ static void prvCheckTimerCallback( TimerHandle_t xTimer ) { -static long lChangedTimerPeriodAlready = pdFALSE; -unsigned long ulErrorFound = pdFALSE; - - /* Check all the demo tasks to ensure they are all still running, and that - none have detected an error. */ - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - ulErrorFound = pdTRUE; - } - - /* Toggle the check LED to give an indication of the system status. If - the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then - everything is ok. A faster toggle indicates an error. */ - GPIO_TOGGLE( LD_GPIO_PORT, LD_GREEN_GPIO_PIN ); - - /* Have any errors been latch in ulErrorFound? If so, shorten the - period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. - This will result in an increase in the rate at which mainCHECK_LED - toggles. */ - if( ulErrorFound != pdFALSE ) - { - if( lChangedTimerPeriodAlready == pdFALSE ) - { - lChangedTimerPeriodAlready = pdTRUE; - - /* This call to xTimerChangePeriod() uses a zero block time. - Functions called from inside of a timer callback function must - *never* attempt to block. */ - xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); - } - } + static long lChangedTimerPeriodAlready = pdFALSE; + unsigned long ulErrorFound = pdFALSE; + + /* Check all the demo tasks to ensure they are all still running, and that + * none have detected an error. */ + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + ulErrorFound = pdTRUE; + } + + /* Toggle the check LED to give an indication of the system status. If + * the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then + * everything is ok. A faster toggle indicates an error. */ + GPIO_TOGGLE( LD_GPIO_PORT, LD_GREEN_GPIO_PIN ); + + /* Have any errors been latch in ulErrorFound? If so, shorten the + * period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. + * This will result in an increase in the rate at which mainCHECK_LED + * toggles. */ + if( ulErrorFound != pdFALSE ) + { + if( lChangedTimerPeriodAlready == pdFALSE ) + { + lChangedTimerPeriodAlready = pdTRUE; + + /* This call to xTimerChangePeriod() uses a zero block time. + * Functions called from inside of a timer callback function must + * never* attempt to block. */ + xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); + } + } } /*-----------------------------------------------------------*/ static void prvConfigureLCD( void ) { -GPIO_InitTypeDef GPIO_InitStructure; - - /* Enable necessary clocks. */ - RCC_AHBPeriphClockCmd( RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC, ENABLE ); - RCC_APB1PeriphClockCmd( RCC_APB1Periph_LCD, ENABLE ); - PWR_RTCAccessCmd( ENABLE ); - RCC_LSEConfig( ENABLE ); - RCC_RTCCLKConfig( RCC_RTCCLKSource_LSE ); - RCC_RTCCLKCmd( ENABLE ); - - /* Configure Port A LCD Output pins as alternate function. */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_8 | GPIO_Pin_9 |GPIO_Pin_10 |GPIO_Pin_15; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; - GPIO_Init( GPIOA, &GPIO_InitStructure ); - - /* Select LCD alternate function for Port A LCD Output pins. */ - GPIO_PinAFConfig( GPIOA, GPIO_PinSource1, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOA, GPIO_PinSource2, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOA, GPIO_PinSource3, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOA, GPIO_PinSource8, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOA, GPIO_PinSource9, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOA, GPIO_PinSource10, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOA, GPIO_PinSource15, GPIO_AF_LCD ); - - /* Configure Port B LCD Output pins as alternate function */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; - GPIO_Init( GPIOB, &GPIO_InitStructure ); - - /* Select LCD alternate function for Port B LCD Output pins */ - GPIO_PinAFConfig( GPIOB, GPIO_PinSource3, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOB, GPIO_PinSource4, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOB, GPIO_PinSource5, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOB, GPIO_PinSource8, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOB, GPIO_PinSource9, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOB, GPIO_PinSource10, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOB, GPIO_PinSource11, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOB, GPIO_PinSource12, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOB, GPIO_PinSource13, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOB, GPIO_PinSource14, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOB, GPIO_PinSource15, GPIO_AF_LCD ); - - /* Configure Port C LCD Output pins as alternate function */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 |GPIO_Pin_11 ; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; - GPIO_Init( GPIOC, &GPIO_InitStructure ); - - /* Select LCD alternate function for Port B LCD Output pins */ - GPIO_PinAFConfig( GPIOC, GPIO_PinSource0, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOC, GPIO_PinSource1, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOC, GPIO_PinSource2, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOC, GPIO_PinSource3, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOC, GPIO_PinSource6, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOC, GPIO_PinSource7, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOC, GPIO_PinSource8, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOC, GPIO_PinSource9, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOC, GPIO_PinSource10, GPIO_AF_LCD ); - GPIO_PinAFConfig( GPIOC, GPIO_PinSource11, GPIO_AF_LCD ); - - LCD_GLASS_Init(); - LCD_GLASS_DisplayString( "F'RTOS" ); + GPIO_InitTypeDef GPIO_InitStructure; + + /* Enable necessary clocks. */ + RCC_AHBPeriphClockCmd( RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC, ENABLE ); + RCC_APB1PeriphClockCmd( RCC_APB1Periph_LCD, ENABLE ); + PWR_RTCAccessCmd( ENABLE ); + RCC_LSEConfig( ENABLE ); + RCC_RTCCLKConfig( RCC_RTCCLKSource_LSE ); + RCC_RTCCLKCmd( ENABLE ); + + /* Configure Port A LCD Output pins as alternate function. */ + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_15; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; + GPIO_Init( GPIOA, &GPIO_InitStructure ); + + /* Select LCD alternate function for Port A LCD Output pins. */ + GPIO_PinAFConfig( GPIOA, GPIO_PinSource1, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOA, GPIO_PinSource2, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOA, GPIO_PinSource3, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOA, GPIO_PinSource8, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOA, GPIO_PinSource9, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOA, GPIO_PinSource10, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOA, GPIO_PinSource15, GPIO_AF_LCD ); + + /* Configure Port B LCD Output pins as alternate function */ + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; + GPIO_Init( GPIOB, &GPIO_InitStructure ); + + /* Select LCD alternate function for Port B LCD Output pins */ + GPIO_PinAFConfig( GPIOB, GPIO_PinSource3, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOB, GPIO_PinSource4, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOB, GPIO_PinSource5, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOB, GPIO_PinSource8, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOB, GPIO_PinSource9, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOB, GPIO_PinSource10, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOB, GPIO_PinSource11, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOB, GPIO_PinSource12, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOB, GPIO_PinSource13, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOB, GPIO_PinSource14, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOB, GPIO_PinSource15, GPIO_AF_LCD ); + + /* Configure Port C LCD Output pins as alternate function */ + GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; + GPIO_Init( GPIOC, &GPIO_InitStructure ); + + /* Select LCD alternate function for Port B LCD Output pins */ + GPIO_PinAFConfig( GPIOC, GPIO_PinSource0, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOC, GPIO_PinSource1, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOC, GPIO_PinSource2, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOC, GPIO_PinSource3, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOC, GPIO_PinSource6, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOC, GPIO_PinSource7, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOC, GPIO_PinSource8, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOC, GPIO_PinSource9, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOC, GPIO_PinSource10, GPIO_AF_LCD ); + GPIO_PinAFConfig( GPIOC, GPIO_PinSource11, GPIO_AF_LCD ); + + LCD_GLASS_Init(); + LCD_GLASS_DisplayString( "F'RTOS" ); } - diff --git a/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/main_low_power.c b/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/main_low_power.c index 03460f6bd71..42ddfbdecfb 100644 --- a/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/main_low_power.c +++ b/FreeRTOS/Demo/CORTEX_STM32L152_Discovery_IAR/main_low_power.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -120,30 +120,30 @@ #include "stm32l_discovery_lcd.h" /* Priorities at which the Rx and Tx tasks are created. */ -#define configQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define configQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define configQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define configQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* The number of items the queue can hold. This is 1 as the Rx task will -remove items as they are added so the Tx task should always find the queue -empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * remove items as they are added so the Tx task should always find the queue + * empty. */ +#define mainQUEUE_LENGTH ( 1 ) /* A block time of zero simply means "don't block". */ -#define mainDONT_BLOCK ( 0 ) +#define mainDONT_BLOCK ( 0 ) /* The value that is sent from the Tx task to the Rx task on the queue. */ -#define mainQUEUED_VALUE ( 100UL ) +#define mainQUEUED_VALUE ( 100UL ) /* The length of time the LED will remain on for. */ -#define mainLED_TOGGLE_DELAY ( 10 / portTICK_PERIOD_MS ) +#define mainLED_TOGGLE_DELAY ( 10 / portTICK_PERIOD_MS ) /*-----------------------------------------------------------*/ /* * The Rx and Tx tasks as described at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /*-----------------------------------------------------------*/ @@ -156,7 +156,7 @@ static QueueHandle_t xQueue = NULL; TickType_t xSendBlockTime = ( 100UL / portTICK_PERIOD_MS ); /* The lower an upper limits of the block time. An infinite block time is used -if xSendBlockTime is incremented past xMaxBlockTime. */ + * if xSendBlockTime is incremented past xMaxBlockTime. */ static const TickType_t xMaxBlockTime = ( 500L / portTICK_PERIOD_MS ), xMinBlockTime = ( 100L / portTICK_PERIOD_MS ); /* The semaphore on which the Tx task blocks. */ @@ -167,131 +167,133 @@ static SemaphoreHandle_t xTxSemaphore = NULL; /* See the comments at the top of the file. */ void main_low_power( void ) { - /* Create the semaphore as described at the top of this file. */ - xTxSemaphore = xSemaphoreCreateBinary(); - configASSERT( xTxSemaphore ); - - /* Create the queue as described at the top of this file. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); - configASSERT( xQueue ); - - /* Start the two tasks as described at the top of this file. */ - xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, configQUEUE_RECEIVE_TASK_PRIORITY, NULL ); - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, configQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Start the scheduler running running. */ - vTaskStartScheduler(); - - /* If all is well the next line of code will not be reached as the - scheduler will be running. If the next line is reached then it is likely - there was insufficient FreeRTOS heap available for the idle task and/or - timer task to be created. See http://www.freertos.org/a00111.html. */ - for( ;; ); + /* Create the semaphore as described at the top of this file. */ + xTxSemaphore = xSemaphoreCreateBinary(); + configASSERT( xTxSemaphore ); + + /* Create the queue as described at the top of this file. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); + configASSERT( xQueue ); + + /* Start the two tasks as described at the top of this file. */ + xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, configQUEUE_RECEIVE_TASK_PRIORITY, NULL ); + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, configQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Start the scheduler running running. */ + vTaskStartScheduler(); + + /* If all is well the next line of code will not be reached as the + * scheduler will be running. If the next line is reached then it is likely + * there was insufficient FreeRTOS heap available for the idle task and/or + * timer task to be created. See http://www.freertos.org/a00111.html. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -const unsigned long ulValueToSend = mainQUEUED_VALUE; + const unsigned long ulValueToSend = mainQUEUED_VALUE; - /* Remove compiler warning about unused parameter. */ - ( void ) pvParameters; + /* Remove compiler warning about unused parameter. */ + ( void ) pvParameters; - for( ;; ) - { - /* Enter the Blocked state to wait for the semaphore. The task will - leave the Blocked state if either the semaphore is received or - xSendBlockTime ticks pass without the semaphore being received. */ - xSemaphoreTake( xTxSemaphore, xSendBlockTime ); + for( ; ; ) + { + /* Enter the Blocked state to wait for the semaphore. The task will + * leave the Blocked state if either the semaphore is received or + * xSendBlockTime ticks pass without the semaphore being received. */ + xSemaphoreTake( xTxSemaphore, xSendBlockTime ); - /* Send to the queue - causing the Tx task to flash its LED. */ - xQueueSend( xQueue, &ulValueToSend, mainDONT_BLOCK ); - } + /* Send to the queue - causing the Tx task to flash its LED. */ + xQueueSend( xQueue, &ulValueToSend, mainDONT_BLOCK ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; - - /* Remove compiler warning about unused parameter. */ - ( void ) pvParameters; - - for( ;; ) - { - /* Wait until something arrives in the queue. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have arrived, but is it the expected - value? If it is, turn the LED on for a short while. */ - if( ulReceivedValue == mainQUEUED_VALUE ) - { - /* LED on... */ - GPIO_HIGH( LD_GPIO_PORT, LD_GREEN_GPIO_PIN ); - - /* ... short delay ... */ - vTaskDelay( mainLED_TOGGLE_DELAY ); - - /* ... LED off again. */ - GPIO_LOW( LD_GPIO_PORT, LD_GREEN_GPIO_PIN ); - } - } + unsigned long ulReceivedValue; + + /* Remove compiler warning about unused parameter. */ + ( void ) pvParameters; + + for( ; ; ) + { + /* Wait until something arrives in the queue. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have arrived, but is it the expected + * value? If it is, turn the LED on for a short while. */ + if( ulReceivedValue == mainQUEUED_VALUE ) + { + /* LED on... */ + GPIO_HIGH( LD_GPIO_PORT, LD_GREEN_GPIO_PIN ); + + /* ... short delay ... */ + vTaskDelay( mainLED_TOGGLE_DELAY ); + + /* ... LED off again. */ + GPIO_LOW( LD_GPIO_PORT, LD_GREEN_GPIO_PIN ); + } + } } /*-----------------------------------------------------------*/ /* Handles interrupts generated by pressing the USER button. */ -void EXTI0_IRQHandler(void) +void EXTI0_IRQHandler( void ) { -static const TickType_t xIncrement = 200UL / portTICK_PERIOD_MS; - - /* If xSendBlockTime is already portMAX_DELAY then the Tx task was blocked - indefinitely, and this interrupt is bringing the MCU out of STOP low power - mode. */ - if( xSendBlockTime == portMAX_DELAY ) - { - portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; - - /* Unblock the Tx task. */ - xSemaphoreGiveFromISR( xTxSemaphore, &xHigherPriorityTaskWoken ); - - /* Start over with the 'short' block time as described at the top of - this file. */ - xSendBlockTime = xMinBlockTime; - - /* Request a yield if calling xSemaphoreGiveFromISR() caused a task to - leave the Blocked state (which it will have done) and the task that left - the Blocked state has a priority higher than the currently running task - (which it will have). */ - portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); - } - else - { - /* Increase the block time used by the Tx task, as described at the top - of this file. */ - xSendBlockTime += xIncrement; - - /* If the block time has gone over the configured maximum then set it to - an infinite block time to allow the MCU to go into its STOP low power - mode. */ - if( xSendBlockTime > xMaxBlockTime ) - { - xSendBlockTime = portMAX_DELAY; - } - } - - EXTI_ClearITPendingBit( EXTI_Line0 ); + static const TickType_t xIncrement = 200UL / portTICK_PERIOD_MS; + + /* If xSendBlockTime is already portMAX_DELAY then the Tx task was blocked + * indefinitely, and this interrupt is bringing the MCU out of STOP low power + * mode. */ + if( xSendBlockTime == portMAX_DELAY ) + { + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + + /* Unblock the Tx task. */ + xSemaphoreGiveFromISR( xTxSemaphore, &xHigherPriorityTaskWoken ); + + /* Start over with the 'short' block time as described at the top of + * this file. */ + xSendBlockTime = xMinBlockTime; + + /* Request a yield if calling xSemaphoreGiveFromISR() caused a task to + * leave the Blocked state (which it will have done) and the task that left + * the Blocked state has a priority higher than the currently running task + * (which it will have). */ + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); + } + else + { + /* Increase the block time used by the Tx task, as described at the top + * of this file. */ + xSendBlockTime += xIncrement; + + /* If the block time has gone over the configured maximum then set it to + * an infinite block time to allow the MCU to go into its STOP low power + * mode. */ + if( xSendBlockTime > xMaxBlockTime ) + { + xSendBlockTime = portMAX_DELAY; + } + } + + EXTI_ClearITPendingBit( EXTI_Line0 ); } /*-----------------------------------------------------------*/ /* The configPOST_STOP_PROCESSING() macro is called when the MCU leaves its -STOP low power mode. The macro is set in FreeRTOSConfig.h to call -vMainPostStopProcessing(). */ + * STOP low power mode. The macro is set in FreeRTOSConfig.h to call + * vMainPostStopProcessing(). */ void vMainPostStopProcessing( void ) { -extern void SetSysClock( void ); + extern void SetSysClock( void ); - /* The STOP low power mode has been exited. Reconfigure the system clocks - ready for normally running again. */ - SetSysClock(); + /* The STOP low power mode has been exited. Reconfigure the system clocks + * ready for normally running again. */ + SetSysClock(); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/CORTEX_STM32L152_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_STM32L152_IAR/FreeRTOSConfig.h index a8d8b05570b..a2df34745d5 100644 --- a/FreeRTOS/Demo/CORTEX_STM32L152_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_STM32L152_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32L152_IAR/ParTest.c b/FreeRTOS/Demo/CORTEX_STM32L152_IAR/ParTest.c index 05b3f1b68e9..652cbb4fa54 100644 --- a/FreeRTOS/Demo/CORTEX_STM32L152_IAR/ParTest.c +++ b/FreeRTOS/Demo/CORTEX_STM32L152_IAR/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTEX_STM32L152_IAR/main.c b/FreeRTOS/Demo/CORTEX_STM32L152_IAR/main.c index cebb3d5dfd4..de05c223cc2 100644 --- a/FreeRTOS/Demo/CORTEX_STM32L152_IAR/main.c +++ b/FreeRTOS/Demo/CORTEX_STM32L152_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -87,7 +87,7 @@ * code and displays an appropriate message - which will be PASS if no tasks * have reported any errors, or a message stating which task has reported an * error. -*/ + */ /* Standard includes. */ #include @@ -109,39 +109,39 @@ #include "stm32l152_eval_lcd.h" /* The priorities assigned to the tasks. */ -#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainGENERIC_QUEUE_TEST_PRIORITY ( tskIDLE_PRIORITY ) +#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainGENERIC_QUEUE_TEST_PRIORITY ( tskIDLE_PRIORITY ) /* The length of the queue (the number of items the queue can hold) that is used -to send messages from tasks and interrupts the the LCD task. */ -#define mainQUEUE_LENGTH ( 5 ) + * to send messages from tasks and interrupts the the LCD task. */ +#define mainQUEUE_LENGTH ( 5 ) /* Codes sent within messages to the LCD task so the LCD task can interpret -exactly what the message it just received was. These are sent in the -cMessageID member of the message structure (defined below). */ -#define mainMESSAGE_BUTTON_UP ( 1 ) -#define mainMESSAGE_BUTTON_SEL ( 2 ) -#define mainMESSAGE_STATUS ( 3 ) + * exactly what the message it just received was. These are sent in the + * cMessageID member of the message structure (defined below). */ +#define mainMESSAGE_BUTTON_UP ( 1 ) +#define mainMESSAGE_BUTTON_SEL ( 2 ) +#define mainMESSAGE_STATUS ( 3 ) /* When the cMessageID member of the message sent to the LCD task is -mainMESSAGE_STATUS then these definitions are sent in the lMessageValue member -of the same message and indicate what the status actually is. */ -#define mainERROR_DYNAMIC_TASKS ( pdPASS + 1 ) -#define mainERROR_COM_TEST ( pdPASS + 2 ) -#define mainERROR_GEN_QUEUE_TEST ( pdPASS + 3 ) + * mainMESSAGE_STATUS then these definitions are sent in the lMessageValue member + * of the same message and indicate what the status actually is. */ +#define mainERROR_DYNAMIC_TASKS ( pdPASS + 1 ) +#define mainERROR_COM_TEST ( pdPASS + 2 ) +#define mainERROR_GEN_QUEUE_TEST ( pdPASS + 3 ) /* Baud rate used by the comtest tasks. */ -#define mainCOM_TEST_BAUD_RATE ( 115200 ) +#define mainCOM_TEST_BAUD_RATE ( 115200 ) /* The LED used by the comtest tasks. See the comtest.c file for more -information. */ -#define mainCOM_TEST_LED ( 3 ) + * information. */ +#define mainCOM_TEST_LED ( 3 ) /* The LCD task uses printf() so requires more stack than most of the other -tasks. */ -#define mainLCD_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 ) + * tasks. */ +#define mainLCD_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 ) /*-----------------------------------------------------------*/ @@ -155,418 +155,436 @@ static void prvSetupHardware( void ); * Definition of the LCD/controller task described in the comments at the top * of this file. */ -static void prvLCDTask( void *pvParameters ); +static void prvLCDTask( void * pvParameters ); /* * Definition of the button poll task described in the comments at the top of * this file. */ -static void prvButtonPollTask( void *pvParameters ); +static void prvButtonPollTask( void * pvParameters ); /* * Converts a status message value into an appropriate string for display on * the LCD. The string is written to pcBuffer. */ -static void prvGenerateStatusMessage( char *pcBuffer, long lStatusValue ); +static void prvGenerateStatusMessage( char * pcBuffer, + long lStatusValue ); /*-----------------------------------------------------------*/ /* The time base for the run time stats is generated by the 16 bit timer 6. -Each time the timer overflows ulTIM6_OverflowCount is incremented. Therefore, -when converting the total run time to a 32 bit number, the most significant two -bytes are given by ulTIM6_OverflowCount and the least significant two bytes are -given by the current TIM6 counter value. Care must be taken with data -consistency when combining the two in case a timer overflow occurs as the -value is being read. */ + * Each time the timer overflows ulTIM6_OverflowCount is incremented. Therefore, + * when converting the total run time to a 32 bit number, the most significant two + * bytes are given by ulTIM6_OverflowCount and the least significant two bytes are + * given by the current TIM6 counter value. Care must be taken with data + * consistency when combining the two in case a timer overflow occurs as the + * value is being read. */ unsigned long ulTIM6_OverflowCount = 0UL; /* The handle of the queue used to send messages from tasks and interrupts to -the LCD task. */ + * the LCD task. */ static QueueHandle_t xLCDQueue = NULL; /* The definition of each message sent from tasks and interrupts to the LCD -task. */ + * task. */ typedef struct { - char cMessageID; /* << States what the message is. */ - long lMessageValue; /* << States the message value (can be an integer, string pointer, etc. depending on the value of cMessageID). */ + char cMessageID; /* << States what the message is. */ + long lMessageValue; /* << States the message value (can be an integer, string pointer, etc. depending on the value of cMessageID). */ } xQueueMessage; /*-----------------------------------------------------------*/ void main( void ) { - /* Configure the peripherals used by this demo application. This includes - configuring the joystick input select button to generate interrupts. */ - prvSetupHardware(); - - /* Create the queue used by tasks and interrupts to send strings to the LCD - task. */ - xLCDQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( xQueueMessage ) ); - - /* If the queue could not be created then don't create any tasks that might - attempt to use the queue. */ - if( xLCDQueue != NULL ) - { - /* Add the created queue to the queue registry so it can be viewed in - the IAR FreeRTOS state viewer plug-in. */ - vQueueAddToRegistry( xLCDQueue, "LCDQueue" ); - - /* Create the LCD and button poll tasks, as described at the top of this - file. */ - xTaskCreate( prvLCDTask, "LCD", mainLCD_TASK_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL ); - xTaskCreate( prvButtonPollTask, "ButPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - - /* Create a subset of the standard demo tasks. */ - vStartDynamicPriorityTasks(); - vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vStartGenericQueueTasks( mainGENERIC_QUEUE_TEST_PRIORITY ); - - /* Start the scheduler. */ - vTaskStartScheduler(); - } - - /* If all is well then this line will never be reached. If it is reached - then it is likely that there was insufficient (FreeRTOS) heap memory space - to create the idle task. This may have been trapped by the malloc() failed - hook function, if one is configured. */ - for( ;; ); + /* Configure the peripherals used by this demo application. This includes + * configuring the joystick input select button to generate interrupts. */ + prvSetupHardware(); + + /* Create the queue used by tasks and interrupts to send strings to the LCD + * task. */ + xLCDQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( xQueueMessage ) ); + + /* If the queue could not be created then don't create any tasks that might + * attempt to use the queue. */ + if( xLCDQueue != NULL ) + { + /* Add the created queue to the queue registry so it can be viewed in + * the IAR FreeRTOS state viewer plug-in. */ + vQueueAddToRegistry( xLCDQueue, "LCDQueue" ); + + /* Create the LCD and button poll tasks, as described at the top of this + * file. */ + xTaskCreate( prvLCDTask, "LCD", mainLCD_TASK_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL ); + xTaskCreate( prvButtonPollTask, "ButPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + + /* Create a subset of the standard demo tasks. */ + vStartDynamicPriorityTasks(); + vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartGenericQueueTasks( mainGENERIC_QUEUE_TEST_PRIORITY ); + + /* Start the scheduler. */ + vTaskStartScheduler(); + } + + /* If all is well then this line will never be reached. If it is reached + * then it is likely that there was insufficient (FreeRTOS) heap memory space + * to create the idle task. This may have been trapped by the malloc() failed + * hook function, if one is configured. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvLCDTask( void *pvParameters ) +static void prvLCDTask( void * pvParameters ) { -xQueueMessage xReceivedMessage; -long lLine = Line1; -const long lFontHeight = (((sFONT *)LCD_GetFont())->Height); + xQueueMessage xReceivedMessage; + long lLine = Line1; + const long lFontHeight = ( ( ( sFONT * ) LCD_GetFont() )->Height ); /* Buffer into which strings are formatted and placed ready for display on the -LCD. Note this is a static variable to prevent it being allocated on the task -stack, which is too small to hold such a variable. The stack size is configured -when the task is created. */ -static char cBuffer[ 512 ]; - - /* This function is the only function that uses printf(). If printf() is - used from any other function then some sort of mutual exclusion on stdout - will be necessary. - - This is also the only function that is permitted to access the LCD. - - First print out the number of bytes that remain in the FreeRTOS heap. This - can be viewed in the terminal IO window within the IAR Embedded Workbench. */ - printf( "%d bytes of heap space remain unallocated\n", xPortGetFreeHeapSize() ); - - for( ;; ) - { - /* Wait for a message to be received. Using portMAX_DELAY as the block - time will result in an indefinite wait provided INCLUDE_vTaskSuspend is - set to 1 in FreeRTOSConfig.h, therefore there is no need to check the - function return value and the function will only return when a value - has been received. */ - xQueueReceive( xLCDQueue, &xReceivedMessage, portMAX_DELAY ); - - /* Clear the LCD if no room remains for any more text output. */ - if( lLine > Line9 ) - { - LCD_Clear( Blue ); - lLine = 0; - } - - /* What is this message? What does it contain? */ - switch( xReceivedMessage.cMessageID ) - { - case mainMESSAGE_BUTTON_UP : /* The button poll task has just - informed this task that the up - button on the joystick input has - been pressed or released. */ - sprintf( cBuffer, "Button up = %d", xReceivedMessage.lMessageValue ); - break; - - case mainMESSAGE_BUTTON_SEL : /* The select button interrupt - just informed this task that the - select button was pressed. - Generate a table of task run time - statistics and output this to - the terminal IO window in the IAR - embedded workbench. */ - printf( "\nTask\t Abs Time\t %%Time\n*****************************************" ); - vTaskGetRunTimeStats( cBuffer ); - printf( cBuffer ); - - /* Also print out a message to - the LCD - in this case the - pointer to the string to print - is sent directly in the - lMessageValue member of the - message. This just demonstrates - a different communication - technique. */ - sprintf( cBuffer, "%s", ( char * ) xReceivedMessage.lMessageValue ); - break; - - case mainMESSAGE_STATUS : /* The tick interrupt hook - function has just informed this - task of the system status. - Generate a string in accordance - with the status value. */ - prvGenerateStatusMessage( cBuffer, xReceivedMessage.lMessageValue ); - break; - - default : sprintf( cBuffer, "Unknown message" ); - break; - } - - /* Output the message that was placed into the cBuffer array within the - switch statement above. */ - LCD_DisplayStringLine( lLine, ( uint8_t * ) cBuffer ); - - /* Move onto the next LCD line, ready for the next iteration of this - loop. */ - lLine += lFontHeight; - } + * LCD. Note this is a static variable to prevent it being allocated on the task + * stack, which is too small to hold such a variable. The stack size is configured + * when the task is created. */ + static char cBuffer[ 512 ]; + + /* This function is the only function that uses printf(). If printf() is + * used from any other function then some sort of mutual exclusion on stdout + * will be necessary. + * + * This is also the only function that is permitted to access the LCD. + * + * First print out the number of bytes that remain in the FreeRTOS heap. This + * can be viewed in the terminal IO window within the IAR Embedded Workbench. */ + printf( "%d bytes of heap space remain unallocated\n", xPortGetFreeHeapSize() ); + + for( ; ; ) + { + /* Wait for a message to be received. Using portMAX_DELAY as the block + * time will result in an indefinite wait provided INCLUDE_vTaskSuspend is + * set to 1 in FreeRTOSConfig.h, therefore there is no need to check the + * function return value and the function will only return when a value + * has been received. */ + xQueueReceive( xLCDQueue, &xReceivedMessage, portMAX_DELAY ); + + /* Clear the LCD if no room remains for any more text output. */ + if( lLine > Line9 ) + { + LCD_Clear( Blue ); + lLine = 0; + } + + /* What is this message? What does it contain? */ + switch( xReceivedMessage.cMessageID ) + { + case mainMESSAGE_BUTTON_UP: /* The button poll task has just + * informed this task that the up + * button on the joystick input has + * been pressed or released. */ + sprintf( cBuffer, "Button up = %d", xReceivedMessage.lMessageValue ); + break; + + case mainMESSAGE_BUTTON_SEL: /* The select button interrupt + * just informed this task that the + * select button was pressed. + * Generate a table of task run time + * statistics and output this to + * the terminal IO window in the IAR + * embedded workbench. */ + printf( "\nTask\t Abs Time\t %%Time\n*****************************************" ); + vTaskGetRunTimeStats( cBuffer ); + printf( cBuffer ); + + /* Also print out a message to + * the LCD - in this case the + * pointer to the string to print + * is sent directly in the + * lMessageValue member of the + * message. This just demonstrates + * a different communication + * technique. */ + sprintf( cBuffer, "%s", ( char * ) xReceivedMessage.lMessageValue ); + break; + + case mainMESSAGE_STATUS: /* The tick interrupt hook + * function has just informed this + * task of the system status. + * Generate a string in accordance + * with the status value. */ + prvGenerateStatusMessage( cBuffer, xReceivedMessage.lMessageValue ); + break; + + default: + sprintf( cBuffer, "Unknown message" ); + break; + } + + /* Output the message that was placed into the cBuffer array within the + * switch statement above. */ + LCD_DisplayStringLine( lLine, ( uint8_t * ) cBuffer ); + + /* Move onto the next LCD line, ready for the next iteration of this + * loop. */ + lLine += lFontHeight; + } } /*-----------------------------------------------------------*/ -static void prvGenerateStatusMessage( char *pcBuffer, long lStatusValue ) +static void prvGenerateStatusMessage( char * pcBuffer, + long lStatusValue ) { - /* Just a utility function to convert a status value into a meaningful - string for output onto the LCD. */ - switch( lStatusValue ) - { - case pdPASS : sprintf( pcBuffer, "Task status = PASS" ); - break; - case mainERROR_DYNAMIC_TASKS : sprintf( pcBuffer, "Error: Dynamic tasks" ); - break; - case mainERROR_COM_TEST : sprintf( pcBuffer, "Err: loop connected?" ); /* Error in COM test - is the Loopback connector connected? */ - break; - case mainERROR_GEN_QUEUE_TEST : sprintf( pcBuffer, "Error: Gen Q test" ); - break; - default : sprintf( pcBuffer, "Unknown status" ); - break; - } + /* Just a utility function to convert a status value into a meaningful + * string for output onto the LCD. */ + switch( lStatusValue ) + { + case pdPASS: + sprintf( pcBuffer, "Task status = PASS" ); + break; + + case mainERROR_DYNAMIC_TASKS: + sprintf( pcBuffer, "Error: Dynamic tasks" ); + break; + + case mainERROR_COM_TEST: + sprintf( pcBuffer, "Err: loop connected?" ); /* Error in COM test - is the Loopback connector connected? */ + break; + + case mainERROR_GEN_QUEUE_TEST: + sprintf( pcBuffer, "Error: Gen Q test" ); + break; + + default: + sprintf( pcBuffer, "Unknown status" ); + break; + } } /*-----------------------------------------------------------*/ void EXTI9_5_IRQHandler( void ) { /* Define the message sent to the LCD task from this interrupt. */ -const xQueueMessage xMessage = { mainMESSAGE_BUTTON_SEL, ( unsigned long ) "Select Interrupt!" }; -long lHigherPriorityTaskWoken = pdFALSE; + const xQueueMessage xMessage = { mainMESSAGE_BUTTON_SEL, ( unsigned long ) "Select Interrupt!" }; + long lHigherPriorityTaskWoken = pdFALSE; - /* This is the interrupt handler for the joystick select button input. - The button has been pushed, write a message to the LCD via the LCD task. */ - xQueueSendFromISR( xLCDQueue, &xMessage, &lHigherPriorityTaskWoken ); + /* This is the interrupt handler for the joystick select button input. + * The button has been pushed, write a message to the LCD via the LCD task. */ + xQueueSendFromISR( xLCDQueue, &xMessage, &lHigherPriorityTaskWoken ); - EXTI_ClearITPendingBit( SEL_BUTTON_EXTI_LINE ); + EXTI_ClearITPendingBit( SEL_BUTTON_EXTI_LINE ); - /* If writing to xLCDQueue caused a task to unblock, and the unblocked task - has a priority equal to or above the task that this interrupt interrupted, - then lHigherPriorityTaskWoken will have been set to pdTRUE internally within - xQueuesendFromISR(), and portEND_SWITCHING_ISR() will ensure that this - interrupt returns directly to the higher priority unblocked task. */ - portEND_SWITCHING_ISR( lHigherPriorityTaskWoken ); + /* If writing to xLCDQueue caused a task to unblock, and the unblocked task + * has a priority equal to or above the task that this interrupt interrupted, + * then lHigherPriorityTaskWoken will have been set to pdTRUE internally within + * xQueuesendFromISR(), and portEND_SWITCHING_ISR() will ensure that this + * interrupt returns directly to the higher priority unblocked task. */ + portEND_SWITCHING_ISR( lHigherPriorityTaskWoken ); } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { -static unsigned long ulCounter = 0; -static const unsigned long ulCheckFrequency = 5000UL / portTICK_PERIOD_MS; -long lHigherPriorityTaskWoken = pdFALSE; + static unsigned long ulCounter = 0; + static const unsigned long ulCheckFrequency = 5000UL / portTICK_PERIOD_MS; + long lHigherPriorityTaskWoken = pdFALSE; /* Define the status message that is sent to the LCD task. By default the -status is PASS. */ -static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS }; - - /* This is called from within the tick interrupt and performs the 'check' - functionality as described in the comments at the top of this file. - - Is it time to perform the 'check' functionality again? */ - ulCounter++; - if( ulCounter >= ulCheckFrequency ) - { - /* See if the standard demo tasks are executing as expected, changing - the message that is sent to the LCD task from PASS to an error code if - any tasks set reports an error. */ - if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) - { - xStatusMessage.lMessageValue = mainERROR_DYNAMIC_TASKS; - } - - if( xAreComTestTasksStillRunning() != pdPASS ) - { - xStatusMessage.lMessageValue = mainERROR_COM_TEST; - } - - if( xAreGenericQueueTasksStillRunning() != pdPASS ) - { - xStatusMessage.lMessageValue = mainERROR_GEN_QUEUE_TEST; - } - - /* As this is the tick hook the lHigherPriorityTaskWoken parameter is not - needed (a context switch is going to be performed anyway), but it must - still be provided. */ - xQueueSendFromISR( xLCDQueue, &xStatusMessage, &lHigherPriorityTaskWoken ); - ulCounter = 0; - } + * status is PASS. */ + static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS }; + + /* This is called from within the tick interrupt and performs the 'check' + * functionality as described in the comments at the top of this file. + * + * Is it time to perform the 'check' functionality again? */ + ulCounter++; + + if( ulCounter >= ulCheckFrequency ) + { + /* See if the standard demo tasks are executing as expected, changing + * the message that is sent to the LCD task from PASS to an error code if + * any tasks set reports an error. */ + if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) + { + xStatusMessage.lMessageValue = mainERROR_DYNAMIC_TASKS; + } + + if( xAreComTestTasksStillRunning() != pdPASS ) + { + xStatusMessage.lMessageValue = mainERROR_COM_TEST; + } + + if( xAreGenericQueueTasksStillRunning() != pdPASS ) + { + xStatusMessage.lMessageValue = mainERROR_GEN_QUEUE_TEST; + } + + /* As this is the tick hook the lHigherPriorityTaskWoken parameter is not + * needed (a context switch is going to be performed anyway), but it must + * still be provided. */ + xQueueSendFromISR( xLCDQueue, &xStatusMessage, &lHigherPriorityTaskWoken ); + ulCounter = 0; + } } /*-----------------------------------------------------------*/ -static void prvButtonPollTask( void *pvParameters ) +static void prvButtonPollTask( void * pvParameters ) { -long lLastState = pdTRUE; -long lState; -xQueueMessage xMessage; - - /* This tasks performs the button polling functionality as described at the - top of this file. */ - for( ;; ) - { - /* Check the button state. */ - lState = STM_EVAL_PBGetState( BUTTON_UP ); - if( lState != lLastState ) - { - /* The state has changed, send a message to the LCD task. */ - xMessage.cMessageID = mainMESSAGE_BUTTON_UP; - xMessage.lMessageValue = lState; - lLastState = lState; - xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); - } - - /* Block for 10 milliseconds so this task does not utilise all the CPU - time and debouncing of the button is not necessary. */ - vTaskDelay( 10 / portTICK_PERIOD_MS ); - } + long lLastState = pdTRUE; + long lState; + xQueueMessage xMessage; + + /* This tasks performs the button polling functionality as described at the + * top of this file. */ + for( ; ; ) + { + /* Check the button state. */ + lState = STM_EVAL_PBGetState( BUTTON_UP ); + + if( lState != lLastState ) + { + /* The state has changed, send a message to the LCD task. */ + xMessage.cMessageID = mainMESSAGE_BUTTON_UP; + xMessage.lMessageValue = lState; + lLastState = lState; + xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); + } + + /* Block for 10 milliseconds so this task does not utilise all the CPU + * time and debouncing of the button is not necessary. */ + vTaskDelay( 10 / portTICK_PERIOD_MS ); + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Ensure that all 4 interrupt priority bits are used as the pre-emption - priority. */ - NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); - - /* Initialise the LEDs. */ - vParTestInitialise(); - - /* Initialise the joystick inputs. */ - STM_EVAL_PBInit( BUTTON_UP, BUTTON_MODE_GPIO ); - STM_EVAL_PBInit( BUTTON_DOWN, BUTTON_MODE_GPIO ); - STM_EVAL_PBInit( BUTTON_LEFT, BUTTON_MODE_GPIO ); - STM_EVAL_PBInit( BUTTON_RIGHT, BUTTON_MODE_GPIO ); - - /* The select button in the middle of the joystick is configured to generate - an interrupt. The Eval board library will configure the interrupt - priority to be the lowest priority available so the priority need not be - set here explicitly. It is important that the priority is equal to or - below that set by the configMAX_SYSCALL_INTERRUPT_PRIORITY value set in - FreeRTOSConfig.h. */ - STM_EVAL_PBInit( BUTTON_SEL, BUTTON_MODE_EXTI ); - - /* Initialize the LCD */ - STM32L152_LCD_Init(); - LCD_Clear( Blue ); - LCD_SetBackColor( Blue ); - LCD_SetTextColor( White ); - LCD_DisplayStringLine( Line0, " www.FreeRTOS.org" ); + /* Ensure that all 4 interrupt priority bits are used as the pre-emption + * priority. */ + NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); + + /* Initialise the LEDs. */ + vParTestInitialise(); + + /* Initialise the joystick inputs. */ + STM_EVAL_PBInit( BUTTON_UP, BUTTON_MODE_GPIO ); + STM_EVAL_PBInit( BUTTON_DOWN, BUTTON_MODE_GPIO ); + STM_EVAL_PBInit( BUTTON_LEFT, BUTTON_MODE_GPIO ); + STM_EVAL_PBInit( BUTTON_RIGHT, BUTTON_MODE_GPIO ); + + /* The select button in the middle of the joystick is configured to generate + * an interrupt. The Eval board library will configure the interrupt + * priority to be the lowest priority available so the priority need not be + * set here explicitly. It is important that the priority is equal to or + * below that set by the configMAX_SYSCALL_INTERRUPT_PRIORITY value set in + * FreeRTOSConfig.h. */ + STM_EVAL_PBInit( BUTTON_SEL, BUTTON_MODE_EXTI ); + + /* Initialize the LCD */ + STM32L152_LCD_Init(); + LCD_Clear( Blue ); + LCD_SetBackColor( Blue ); + LCD_SetTextColor( White ); + LCD_DisplayStringLine( Line0, " www.FreeRTOS.org" ); } /*-----------------------------------------------------------*/ void vConfigureTimerForRunTimeStats( void ) { -TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; -NVIC_InitTypeDef NVIC_InitStructure; - - /* The time base for the run time stats is generated by the 16 bit timer 6. - Each time the timer overflows ulTIM6_OverflowCount is incremented. - Therefore, when converting the total run time to a 32 bit number, the most - significant two bytes are given by ulTIM6_OverflowCount and the least - significant two bytes are given by the current TIM6 counter value. Care - must be taken with data consistency when combining the two in case a timer - overflow occurs as the value is being read. - - The portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() macro (in FreeRTOSConfig.h) is - defined to call this function, so the kernel will call this function - automatically at the appropriate time. */ - - /* TIM6 clock enable */ - RCC_APB1PeriphClockCmd( RCC_APB1Periph_TIM6, ENABLE ); - - /* The 32MHz clock divided by 5000 should tick (very) approximately every - 150uS and overflow a 16bit timer (very) approximately every 10 seconds. */ - TIM_TimeBaseStructure.TIM_Period = 65535; - TIM_TimeBaseStructure.TIM_Prescaler = 5000; - TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; - TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; - - TIM_TimeBaseInit( TIM6, &TIM_TimeBaseStructure ); - - /* Only interrupt on overflow events. */ - TIM6->CR1 |= TIM_CR1_URS; - - /* Enable the interrupt. */ - TIM_ITConfig( TIM6, TIM_IT_Update, ENABLE ); - - /* Enable the TIM6 global Interrupt */ - NVIC_InitStructure.NVIC_IRQChannel = TIM6_IRQn; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configLIBRARY_LOWEST_INTERRUPT_PRIORITY; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00; /* Not used as 4 bits are used for the pre-emption priority. */ - NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - NVIC_Init(&NVIC_InitStructure); - - TIM_ClearITPendingBit( TIM6, TIM_IT_Update ); - TIM_Cmd( TIM6, ENABLE ); + TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; + NVIC_InitTypeDef NVIC_InitStructure; + + /* The time base for the run time stats is generated by the 16 bit timer 6. + * Each time the timer overflows ulTIM6_OverflowCount is incremented. + * Therefore, when converting the total run time to a 32 bit number, the most + * significant two bytes are given by ulTIM6_OverflowCount and the least + * significant two bytes are given by the current TIM6 counter value. Care + * must be taken with data consistency when combining the two in case a timer + * overflow occurs as the value is being read. + * + * The portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() macro (in FreeRTOSConfig.h) is + * defined to call this function, so the kernel will call this function + * automatically at the appropriate time. */ + + /* TIM6 clock enable */ + RCC_APB1PeriphClockCmd( RCC_APB1Periph_TIM6, ENABLE ); + + /* The 32MHz clock divided by 5000 should tick (very) approximately every + * 150uS and overflow a 16bit timer (very) approximately every 10 seconds. */ + TIM_TimeBaseStructure.TIM_Period = 65535; + TIM_TimeBaseStructure.TIM_Prescaler = 5000; + TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; + TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; + + TIM_TimeBaseInit( TIM6, &TIM_TimeBaseStructure ); + + /* Only interrupt on overflow events. */ + TIM6->CR1 |= TIM_CR1_URS; + + /* Enable the interrupt. */ + TIM_ITConfig( TIM6, TIM_IT_Update, ENABLE ); + + /* Enable the TIM6 global Interrupt */ + NVIC_InitStructure.NVIC_IRQChannel = TIM6_IRQn; + NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configLIBRARY_LOWEST_INTERRUPT_PRIORITY; + NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00; /* Not used as 4 bits are used for the pre-emption priority. */ + NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; + NVIC_Init( &NVIC_InitStructure ); + + TIM_ClearITPendingBit( TIM6, TIM_IT_Update ); + TIM_Cmd( TIM6, ENABLE ); } /*-----------------------------------------------------------*/ void TIM6_IRQHandler( void ) { - /* Interrupt handler for TIM 6 - - The time base for the run time stats is generated by the 16 bit timer 6. - Each time the timer overflows ulTIM6_OverflowCount is incremented. - Therefore, when converting the total run time to a 32 bit number, the most - significant two bytes are given by ulTIM6_OverflowCount and the least - significant two bytes are given by the current TIM6 counter value. Care - must be taken with data consistency when combining the two in case a timer - overflow occurs as the value is being read. */ - if( TIM_GetITStatus( TIM6, TIM_IT_Update) != RESET) - { - ulTIM6_OverflowCount++; - TIM_ClearITPendingBit( TIM6, TIM_IT_Update ); - } + /* Interrupt handler for TIM 6 + * + * The time base for the run time stats is generated by the 16 bit timer 6. + * Each time the timer overflows ulTIM6_OverflowCount is incremented. + * Therefore, when converting the total run time to a 32 bit number, the most + * significant two bytes are given by ulTIM6_OverflowCount and the least + * significant two bytes are given by the current TIM6 counter value. Care + * must be taken with data consistency when combining the two in case a timer + * overflow occurs as the value is being read. */ + if( TIM_GetITStatus( TIM6, TIM_IT_Update ) != RESET ) + { + ulTIM6_OverflowCount++; + TIM_ClearITPendingBit( TIM6, TIM_IT_Update ); + } } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* Run time stack overflow checking is performed if - configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook - function is called if a stack overflow is detected. */ - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* Run time stack overflow checking is performed if + * configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook + * function is called if a stack overflow is detected. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues or - semaphores. */ - for( ;; ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues or + * semaphores. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* Called on each iteration of the idle task. In this case the idle task - just enters a low(ish) power mode. */ - PWR_EnterSleepMode( PWR_Regulator_ON, PWR_SLEEPEntry_WFI ); + /* Called on each iteration of the idle task. In this case the idle task + * just enters a low(ish) power mode. */ + PWR_EnterSleepMode( PWR_Regulator_ON, PWR_SLEEPEntry_WFI ); } - - - diff --git a/FreeRTOS/Demo/CORTEX_STM32L152_IAR/serial.c b/FreeRTOS/Demo/CORTEX_STM32L152_IAR/serial.c index 674737adc10..643b4055056 100644 --- a/FreeRTOS/Demo/CORTEX_STM32L152_IAR/serial.c +++ b/FreeRTOS/Demo/CORTEX_STM32L152_IAR/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/7seg.c b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/7seg.c index ce33f1fbbb2..a8bdd2a7064 100644 --- a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/7seg.c +++ b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/7seg.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/7seg.h b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/7seg.h index 223a1629b8f..76d11ca4e8b 100644 --- a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/7seg.h +++ b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/7seg.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/FreeRTOSConfig.h index 9fb0b23c863..6994156b151 100644 --- a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/ParTest.c b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/ParTest.c index d8003a76ab6..49162c6842b 100644 --- a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/ParTest.c +++ b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/RegTest.c b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/RegTest.c index 76953814d3f..e08c4ae9e8f 100644 --- a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/RegTest.c +++ b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/RegTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/RegTest.h b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/RegTest.h index b9a15760ff1..ee2817bc752 100644 --- a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/RegTest.h +++ b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/RegTest.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/demoGpio.h b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/demoGpio.h index 95d1f70219f..7a9c8886751 100644 --- a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/demoGpio.h +++ b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/demoGpio.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/main.c b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/main.c index b7e18354cd6..8d2e7e7edaf 100644 --- a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/main.c +++ b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/serial.c b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/serial.c index 624be69eda1..fddd43c6628 100644 --- a/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/serial.c +++ b/FreeRTOS/Demo/CORTUS_APS3_GCC/Demo/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/FreeRTOSConfig.h b/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/FreeRTOSConfig.h index 73959342206..30bb219d977 100644 --- a/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/FreeRTOS_Tick_Setup.c b/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/FreeRTOS_Tick_Setup.c index 4f193f989b3..fcf9c00a8b8 100644 --- a/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/FreeRTOS_Tick_Setup.c +++ b/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/FreeRTOS_Tick_Setup.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/ParTest/ParTest.c b/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/ParTest/ParTest.c index 4e9195eacec..ee425ac79f9 100644 --- a/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/ParTest/ParTest.c +++ b/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/main.c b/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/main.c index 985e5852c24..b9dd8156050 100644 --- a/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/main.c +++ b/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/serial/serial.c b/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/serial/serial.c index e9bb388f618..fbd1d8b68dc 100644 --- a/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/serial/serial.c +++ b/FreeRTOS/Demo/ColdFire_MCF52221_CodeWarrior/sources/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/FreeRTOSConfig.h b/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/FreeRTOSConfig.h index 72fca08a166..4f67692ce18 100644 --- a/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/FreeRTOS_Tick_Setup.c b/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/FreeRTOS_Tick_Setup.c index 030b4bceccc..12b165ecb4f 100644 --- a/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/FreeRTOS_Tick_Setup.c +++ b/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/FreeRTOS_Tick_Setup.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/HTTPDemo.c b/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/HTTPDemo.c index f57442c0680..560eaab4dfd 100644 --- a/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/HTTPDemo.c +++ b/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/HTTPDemo.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/HTTPDemo.h b/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/HTTPDemo.h index d00d5912c52..0aed4ad001f 100644 --- a/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/HTTPDemo.h +++ b/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/HTTPDemo.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/ParTest/ParTest.c b/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/ParTest/ParTest.c index 4e9195eacec..ee425ac79f9 100644 --- a/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/ParTest/ParTest.c +++ b/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/main.c b/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/main.c index 90ed2219391..0dcba78ced4 100644 --- a/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/main.c +++ b/FreeRTOS/Demo/ColdFire_MCF52259_CodeWarrior/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -76,30 +76,30 @@ /*-----------------------------------------------------------*/ /* The time between cycles of the 'check' functionality - as described at the -top of this file. */ -#define mainNO_ERROR_PERIOD ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) + * top of this file. */ +#define mainNO_ERROR_PERIOD ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) /* The rate at which the LED controlled by the 'check' task will flash should an -error have been detected. */ -#define mainERROR_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) + * error have been detected. */ +#define mainERROR_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) /* The LED controlled by the 'check' task. */ -#define mainCHECK_LED ( 3 ) +#define mainCHECK_LED ( 3 ) /* ComTest constants - there is no free LED for the comtest tasks. */ -#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 19200 ) -#define mainCOM_TEST_LED ( 5 ) +#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 19200 ) +#define mainCOM_TEST_LED ( 5 ) /* Task priorities. */ -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainWEB_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainWEB_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* * Configure the hardware for the demo. @@ -110,13 +110,13 @@ static void prvSetupHardware( void ); * Implements the 'check' task functionality as described at the top of this * file. */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); /* * Implement the 'Reg test' functionality as described at the top of this file. */ -static void vRegTest1Task( void *pvParameters ); -static void vRegTest2Task( void *pvParameters ); +static void vRegTest1Task( void * pvParameters ); +static void vRegTest2Task( void * pvParameters ); /*-----------------------------------------------------------*/ @@ -127,304 +127,302 @@ static volatile unsigned long ulRegTest1Counter = 0x11111111, ulRegTest2Counter int main( void ) { -extern void vBasicWEBServer( void *pv ); - - /* Setup the hardware ready for this demo. */ - prvSetupHardware(); - ( void )sys_thread_new("HTTPD", vBasicWEBServer, NULL, 320, mainWEB_TASK_PRIORITY ); - - /* Start the standard demo tasks. */ - vStartLEDFlashTasks( tskIDLE_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); - vStartQueuePeekTasks(); - vStartRecursiveMutexTasks(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - - /* Start the reg test tasks - defined in this file. */ - xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) &ulRegTest1Counter, tskIDLE_PRIORITY, NULL ); - xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) &ulRegTest2Counter, tskIDLE_PRIORITY, NULL ); - - /* Create the check task. */ - xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - - /* The suicide tasks must be created last as they need to know how many - tasks were running prior to their creation in order to ascertain whether - or not the correct/expected number of tasks are running at any given time. */ + extern void vBasicWEBServer( void * pv ); + + /* Setup the hardware ready for this demo. */ + prvSetupHardware(); + ( void ) sys_thread_new( "HTTPD", vBasicWEBServer, NULL, 320, mainWEB_TASK_PRIORITY ); + + /* Start the standard demo tasks. */ + vStartLEDFlashTasks( tskIDLE_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); + vStartQueuePeekTasks(); + vStartRecursiveMutexTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + + /* Start the reg test tasks - defined in this file. */ + xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) &ulRegTest1Counter, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) &ulRegTest2Counter, tskIDLE_PRIORITY, NULL ); + + /* Create the check task. */ + xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + + /* The suicide tasks must be created last as they need to know how many + * tasks were running prior to their creation in order to ascertain whether + * or not the correct/expected number of tasks are running at any given time. */ vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - /* Start the scheduler. */ - vTaskStartScheduler(); + /* Start the scheduler. */ + vTaskStartScheduler(); /* Will only get here if there was insufficient memory to create the idle - task. */ - for( ;; ) - { - } + * task. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvCheckTask( void *pvParameters ) +static void prvCheckTask( void * pvParameters ) { -unsigned ulTicksToWait = mainNO_ERROR_PERIOD, ulError = 0, ulLastRegTest1Count = 0, ulLastRegTest2Count = 0; -TickType_t xLastExecutionTime; - - ( void ) pvParameters; - - /* Initialise the variable used to control our iteration rate prior to - its first use. */ - xLastExecutionTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Wait until it is time to run the tests again. */ - vTaskDelayUntil( &xLastExecutionTime, ulTicksToWait ); - - /* Has an error been found in any task? */ - if( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - ulError |= 0x01UL; - } - - if( xAreQueuePeekTasksStillRunning() != pdTRUE ) - { - ulError |= 0x02UL; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - ulError |= 0x04UL; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - ulError |= 0x20UL; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - ulError |= 0x40UL; - } - - if( xIsCreateTaskStillRunning() != pdTRUE ) - { - ulError |= 0x80UL; - } - - if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - ulError |= 0x200UL; - } - - if( ulLastRegTest1Count == ulRegTest1Counter ) - { - ulError |= 0x1000UL; - } - - if( ulLastRegTest2Count == ulRegTest2Counter ) - { - ulError |= 0x1000UL; - } - - ulLastRegTest1Count = ulRegTest1Counter; - ulLastRegTest2Count = ulRegTest2Counter; - - /* If an error has been found then increase our cycle rate, and in so - going increase the rate at which the check task LED toggles. */ - if( ulError != 0 ) - { - ulTicksToWait = mainERROR_PERIOD; - } - - /* Toggle the LED each iteration. */ - vParTestToggleLED( mainCHECK_LED ); - } + unsigned ulTicksToWait = mainNO_ERROR_PERIOD, ulError = 0, ulLastRegTest1Count = 0, ulLastRegTest2Count = 0; + TickType_t xLastExecutionTime; + + ( void ) pvParameters; + + /* Initialise the variable used to control our iteration rate prior to + * its first use. */ + xLastExecutionTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Wait until it is time to run the tests again. */ + vTaskDelayUntil( &xLastExecutionTime, ulTicksToWait ); + + /* Has an error been found in any task? */ + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + ulError |= 0x01UL; + } + + if( xAreQueuePeekTasksStillRunning() != pdTRUE ) + { + ulError |= 0x02UL; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + ulError |= 0x04UL; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + ulError |= 0x20UL; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + ulError |= 0x40UL; + } + + if( xIsCreateTaskStillRunning() != pdTRUE ) + { + ulError |= 0x80UL; + } + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + ulError |= 0x200UL; + } + + if( ulLastRegTest1Count == ulRegTest1Counter ) + { + ulError |= 0x1000UL; + } + + if( ulLastRegTest2Count == ulRegTest2Counter ) + { + ulError |= 0x1000UL; + } + + ulLastRegTest1Count = ulRegTest1Counter; + ulLastRegTest2Count = ulRegTest2Counter; + + /* If an error has been found then increase our cycle rate, and in so + * going increase the rate at which the check task LED toggles. */ + if( ulError != 0 ) + { + ulTicksToWait = mainERROR_PERIOD; + } + + /* Toggle the LED each iteration. */ + vParTestToggleLED( mainCHECK_LED ); + } } /*-----------------------------------------------------------*/ void prvSetupHardware( void ) { - portDISABLE_INTERRUPTS(); + portDISABLE_INTERRUPTS(); - /* Setup the port used to toggle LEDs. */ - vParTestInitialise(); + /* Setup the port used to toggle LEDs. */ + vParTestInitialise(); } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - /* This will get called if a stack overflow is detected during the context - switch. Set configCHECK_FOR_STACK_OVERFLOWS to 2 to also check for stack - problems within nested interrupts, but only do this for debug purposes as - it will increase the context switch time. */ + /* This will get called if a stack overflow is detected during the context + * switch. Set configCHECK_FOR_STACK_OVERFLOWS to 2 to also check for stack + * problems within nested interrupts, but only do this for debug purposes as + * it will increase the context switch time. */ - ( void ) pxTask; - ( void ) pcTaskName; + ( void ) pxTask; + ( void ) pcTaskName; - for( ;; ) - { - } + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void vRegTest1Task( void *pvParameters ) +static void vRegTest1Task( void * pvParameters ) { - /* Sanity check - did we receive the parameter expected? */ - if( pvParameters != &ulRegTest1Counter ) - { - /* Change here so the check task can detect that an error occurred. */ - for( ;; ) - { - } - } - - /* Set all the registers to known values, then check that each retains its - expected value - as described at the top of this file. If an error is - found then the loop counter will no longer be incremented allowing the check - task to recognise the error. */ - asm volatile ( "reg_test_1_start: \n\t" - " moveq #1, d0 \n\t" - " moveq #2, d1 \n\t" - " moveq #3, d2 \n\t" - " moveq #4, d3 \n\t" - " moveq #5, d4 \n\t" - " moveq #6, d5 \n\t" - " moveq #7, d6 \n\t" - " moveq #8, d7 \n\t" - " move #9, a0 \n\t" - " move #10, a1 \n\t" - " move #11, a2 \n\t" - " move #12, a3 \n\t" - " move #13, a4 \n\t" - " move #14, a5 \n\t" - " move #15, a6 \n\t" - " \n\t" - " cmpi.l #1, d0 \n\t" - " bne reg_test_1_error \n\t" - " cmpi.l #2, d1 \n\t" - " bne reg_test_1_error \n\t" - " cmpi.l #3, d2 \n\t" - " bne reg_test_1_error \n\t" - " cmpi.l #4, d3 \n\t" - " bne reg_test_1_error \n\t" - " cmpi.l #5, d4 \n\t" - " bne reg_test_1_error \n\t" - " cmpi.l #6, d5 \n\t" - " bne reg_test_1_error \n\t" - " cmpi.l #7, d6 \n\t" - " bne reg_test_1_error \n\t" - " cmpi.l #8, d7 \n\t" - " bne reg_test_1_error \n\t" - " move a0, d0 \n\t" - " cmpi.l #9, d0 \n\t" - " bne reg_test_1_error \n\t" - " move a1, d0 \n\t" - " cmpi.l #10, d0 \n\t" - " bne reg_test_1_error \n\t" - " move a2, d0 \n\t" - " cmpi.l #11, d0 \n\t" - " bne reg_test_1_error \n\t" - " move a3, d0 \n\t" - " cmpi.l #12, d0 \n\t" - " bne reg_test_1_error \n\t" - " move a4, d0 \n\t" - " cmpi.l #13, d0 \n\t" - " bne reg_test_1_error \n\t" - " move a5, d0 \n\t" - " cmpi.l #14, d0 \n\t" - " bne reg_test_1_error \n\t" - " move a6, d0 \n\t" - " cmpi.l #15, d0 \n\t" - " bne reg_test_1_error \n\t" - " move ulRegTest1Counter, d0 \n\t" - " addq #1, d0 \n\t" - " move d0, ulRegTest1Counter \n\t" - " bra reg_test_1_start \n\t" - "reg_test_1_error: \n\t" - " bra reg_test_1_error \n\t" - ); + /* Sanity check - did we receive the parameter expected? */ + if( pvParameters != &ulRegTest1Counter ) + { + /* Change here so the check task can detect that an error occurred. */ + for( ; ; ) + { + } + } + + /* Set all the registers to known values, then check that each retains its + * expected value - as described at the top of this file. If an error is + * found then the loop counter will no longer be incremented allowing the check + * task to recognise the error. */ + asm volatile ( "reg_test_1_start: \n\t" + " moveq #1, d0 \n\t" + " moveq #2, d1 \n\t" + " moveq #3, d2 \n\t" + " moveq #4, d3 \n\t" + " moveq #5, d4 \n\t" + " moveq #6, d5 \n\t" + " moveq #7, d6 \n\t" + " moveq #8, d7 \n\t" + " move #9, a0 \n\t" + " move #10, a1 \n\t" + " move #11, a2 \n\t" + " move #12, a3 \n\t" + " move #13, a4 \n\t" + " move #14, a5 \n\t" + " move #15, a6 \n\t" + " \n\t" + " cmpi.l #1, d0 \n\t" + " bne reg_test_1_error \n\t" + " cmpi.l #2, d1 \n\t" + " bne reg_test_1_error \n\t" + " cmpi.l #3, d2 \n\t" + " bne reg_test_1_error \n\t" + " cmpi.l #4, d3 \n\t" + " bne reg_test_1_error \n\t" + " cmpi.l #5, d4 \n\t" + " bne reg_test_1_error \n\t" + " cmpi.l #6, d5 \n\t" + " bne reg_test_1_error \n\t" + " cmpi.l #7, d6 \n\t" + " bne reg_test_1_error \n\t" + " cmpi.l #8, d7 \n\t" + " bne reg_test_1_error \n\t" + " move a0, d0 \n\t" + " cmpi.l #9, d0 \n\t" + " bne reg_test_1_error \n\t" + " move a1, d0 \n\t" + " cmpi.l #10, d0 \n\t" + " bne reg_test_1_error \n\t" + " move a2, d0 \n\t" + " cmpi.l #11, d0 \n\t" + " bne reg_test_1_error \n\t" + " move a3, d0 \n\t" + " cmpi.l #12, d0 \n\t" + " bne reg_test_1_error \n\t" + " move a4, d0 \n\t" + " cmpi.l #13, d0 \n\t" + " bne reg_test_1_error \n\t" + " move a5, d0 \n\t" + " cmpi.l #14, d0 \n\t" + " bne reg_test_1_error \n\t" + " move a6, d0 \n\t" + " cmpi.l #15, d0 \n\t" + " bne reg_test_1_error \n\t" + " move ulRegTest1Counter, d0 \n\t" + " addq #1, d0 \n\t" + " move d0, ulRegTest1Counter \n\t" + " bra reg_test_1_start \n\t" + "reg_test_1_error: \n\t" + " bra reg_test_1_error \n\t" + ); } /*-----------------------------------------------------------*/ -static void vRegTest2Task( void *pvParameters ) +static void vRegTest2Task( void * pvParameters ) { - /* Sanity check - did we receive the parameter expected? */ - if( pvParameters != &ulRegTest2Counter ) - { - /* Change here so the check task can detect that an error occurred. */ - for( ;; ) - { - } - } - - /* Set all the registers to known values, then check that each retains its - expected value - as described at the top of this file. If an error is - found then the loop counter will no longer be incremented allowing the check - task to recognise the error. */ - asm volatile ( "reg_test_2_start: \n\t" - " moveq #10, d0 \n\t" - " moveq #20, d1 \n\t" - " moveq #30, d2 \n\t" - " moveq #40, d3 \n\t" - " moveq #50, d4 \n\t" - " moveq #60, d5 \n\t" - " moveq #70, d6 \n\t" - " moveq #80, d7 \n\t" - " move #90, a0 \n\t" - " move #100, a1 \n\t" - " move #110, a2 \n\t" - " move #120, a3 \n\t" - " move #130, a4 \n\t" - " move #140, a5 \n\t" - " move #150, a6 \n\t" - " \n\t" - " cmpi.l #10, d0 \n\t" - " bne reg_test_2_error \n\t" - " cmpi.l #20, d1 \n\t" - " bne reg_test_2_error \n\t" - " cmpi.l #30, d2 \n\t" - " bne reg_test_2_error \n\t" - " cmpi.l #40, d3 \n\t" - " bne reg_test_2_error \n\t" - " cmpi.l #50, d4 \n\t" - " bne reg_test_2_error \n\t" - " cmpi.l #60, d5 \n\t" - " bne reg_test_2_error \n\t" - " cmpi.l #70, d6 \n\t" - " bne reg_test_2_error \n\t" - " cmpi.l #80, d7 \n\t" - " bne reg_test_2_error \n\t" - " move a0, d0 \n\t" - " cmpi.l #90, d0 \n\t" - " bne reg_test_2_error \n\t" - " move a1, d0 \n\t" - " cmpi.l #100, d0 \n\t" - " bne reg_test_2_error \n\t" - " move a2, d0 \n\t" - " cmpi.l #110, d0 \n\t" - " bne reg_test_2_error \n\t" - " move a3, d0 \n\t" - " cmpi.l #120, d0 \n\t" - " bne reg_test_2_error \n\t" - " move a4, d0 \n\t" - " cmpi.l #130, d0 \n\t" - " bne reg_test_2_error \n\t" - " move a5, d0 \n\t" - " cmpi.l #140, d0 \n\t" - " bne reg_test_2_error \n\t" - " move a6, d0 \n\t" - " cmpi.l #150, d0 \n\t" - " bne reg_test_2_error \n\t" - " move ulRegTest1Counter, d0 \n\t" - " addq #1, d0 \n\t" - " move d0, ulRegTest2Counter \n\t" - " bra reg_test_2_start \n\t" - "reg_test_2_error: \n\t" - " bra reg_test_2_error \n\t" - ); + /* Sanity check - did we receive the parameter expected? */ + if( pvParameters != &ulRegTest2Counter ) + { + /* Change here so the check task can detect that an error occurred. */ + for( ; ; ) + { + } + } + + /* Set all the registers to known values, then check that each retains its + * expected value - as described at the top of this file. If an error is + * found then the loop counter will no longer be incremented allowing the check + * task to recognise the error. */ + asm volatile ( "reg_test_2_start: \n\t" + " moveq #10, d0 \n\t" + " moveq #20, d1 \n\t" + " moveq #30, d2 \n\t" + " moveq #40, d3 \n\t" + " moveq #50, d4 \n\t" + " moveq #60, d5 \n\t" + " moveq #70, d6 \n\t" + " moveq #80, d7 \n\t" + " move #90, a0 \n\t" + " move #100, a1 \n\t" + " move #110, a2 \n\t" + " move #120, a3 \n\t" + " move #130, a4 \n\t" + " move #140, a5 \n\t" + " move #150, a6 \n\t" + " \n\t" + " cmpi.l #10, d0 \n\t" + " bne reg_test_2_error \n\t" + " cmpi.l #20, d1 \n\t" + " bne reg_test_2_error \n\t" + " cmpi.l #30, d2 \n\t" + " bne reg_test_2_error \n\t" + " cmpi.l #40, d3 \n\t" + " bne reg_test_2_error \n\t" + " cmpi.l #50, d4 \n\t" + " bne reg_test_2_error \n\t" + " cmpi.l #60, d5 \n\t" + " bne reg_test_2_error \n\t" + " cmpi.l #70, d6 \n\t" + " bne reg_test_2_error \n\t" + " cmpi.l #80, d7 \n\t" + " bne reg_test_2_error \n\t" + " move a0, d0 \n\t" + " cmpi.l #90, d0 \n\t" + " bne reg_test_2_error \n\t" + " move a1, d0 \n\t" + " cmpi.l #100, d0 \n\t" + " bne reg_test_2_error \n\t" + " move a2, d0 \n\t" + " cmpi.l #110, d0 \n\t" + " bne reg_test_2_error \n\t" + " move a3, d0 \n\t" + " cmpi.l #120, d0 \n\t" + " bne reg_test_2_error \n\t" + " move a4, d0 \n\t" + " cmpi.l #130, d0 \n\t" + " bne reg_test_2_error \n\t" + " move a5, d0 \n\t" + " cmpi.l #140, d0 \n\t" + " bne reg_test_2_error \n\t" + " move a6, d0 \n\t" + " cmpi.l #150, d0 \n\t" + " bne reg_test_2_error \n\t" + " move ulRegTest1Counter, d0 \n\t" + " addq #1, d0 \n\t" + " move d0, ulRegTest2Counter \n\t" + " bra reg_test_2_start \n\t" + "reg_test_2_error: \n\t" + " bra reg_test_2_error \n\t" + ); } /*-----------------------------------------------------------*/ - - - diff --git a/FreeRTOS/Demo/Common/ethernet/lwip-1.4.0/ports/MicroBlaze-Ethernet-Lite/ethernetif.c b/FreeRTOS/Demo/Common/ethernet/lwip-1.4.0/ports/MicroBlaze-Ethernet-Lite/ethernetif.c index 4ee1912f75b..6215a2b6625 100644 --- a/FreeRTOS/Demo/Common/ethernet/lwip-1.4.0/ports/MicroBlaze-Ethernet-Lite/ethernetif.c +++ b/FreeRTOS/Demo/Common/ethernet/lwip-1.4.0/ports/MicroBlaze-Ethernet-Lite/ethernetif.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/Common/ethernet/lwip-1.4.0/ports/win32/WinPCap/arch.c b/FreeRTOS/Demo/Common/ethernet/lwip-1.4.0/ports/win32/WinPCap/arch.c index b28b01c9c07..a56116fcd48 100644 --- a/FreeRTOS/Demo/Common/ethernet/lwip-1.4.0/ports/win32/WinPCap/arch.c +++ b/FreeRTOS/Demo/Common/ethernet/lwip-1.4.0/ports/win32/WinPCap/arch.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Common/ethernet/lwip-1.4.0/ports/win32/WinPCap/netif.h b/FreeRTOS/Demo/Common/ethernet/lwip-1.4.0/ports/win32/WinPCap/netif.h index 03982d4fa98..cc4c1eba918 100644 --- a/FreeRTOS/Demo/Common/ethernet/lwip-1.4.0/ports/win32/WinPCap/netif.h +++ b/FreeRTOS/Demo/Common/ethernet/lwip-1.4.0/ports/win32/WinPCap/netif.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Common/ethernet/lwip-1.4.0/ports/win32/ethernetif.c b/FreeRTOS/Demo/Common/ethernet/lwip-1.4.0/ports/win32/ethernetif.c index 504791501f3..f2d05e19b15 100644 --- a/FreeRTOS/Demo/Common/ethernet/lwip-1.4.0/ports/win32/ethernetif.c +++ b/FreeRTOS/Demo/Common/ethernet/lwip-1.4.0/ports/win32/ethernetif.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/Cygnal/FreeRTOSConfig.h b/FreeRTOS/Demo/Cygnal/FreeRTOSConfig.h index 41676c9677e..00a9210daa2 100644 --- a/FreeRTOS/Demo/Cygnal/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/Cygnal/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Cygnal/ParTest/ParTest.c b/FreeRTOS/Demo/Cygnal/ParTest/ParTest.c index 01636de8f2d..740de428190 100644 --- a/FreeRTOS/Demo/Cygnal/ParTest/ParTest.c +++ b/FreeRTOS/Demo/Cygnal/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Cygnal/main.c b/FreeRTOS/Demo/Cygnal/main.c index 041dc8ee44c..c9723c1f780 100644 --- a/FreeRTOS/Demo/Cygnal/main.c +++ b/FreeRTOS/Demo/Cygnal/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -27,17 +27,17 @@ /* * Creates the demo application tasks, then starts the scheduler. The WEB * documentation provides more details of the demo application tasks. - * + * * Main. c also creates four other tasks: - * + * * 1) vErrorChecks() - * This only executes every few seconds but has the highest priority so is - * guaranteed to get processor time. Its main function is to check that all + * This only executes every few seconds but has the highest priority so is + * guaranteed to get processor time. Its main function is to check that all * the standard demo application tasks are still operational and have not * experienced any errors. vErrorChecks() will toggle the on board LED * every mainNO_ERROR_FLASH_PERIOD milliseconds if none of the demo application * tasks have reported an error. Should any task report an error at any time - * the rate at which the on board LED is toggled is increased to + * the rate at which the on board LED is toggled is increased to * mainERROR_FLASH_PERIOD - providing visual feedback that something has gone * wrong. * @@ -74,147 +74,147 @@ #include "semtest.h" /* Demo task priorities. */ -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainINTEGER_PRIORITY tskIDLE_PRIORITY +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainINTEGER_PRIORITY tskIDLE_PRIORITY /* Constants required to disable the watchdog. */ -#define mainDISABLE_BYTE_1 ( ( unsigned char ) 0xde ) -#define mainDISABLE_BYTE_2 ( ( unsigned char ) 0xad ) +#define mainDISABLE_BYTE_1 ( ( unsigned char ) 0xde ) +#define mainDISABLE_BYTE_2 ( ( unsigned char ) 0xad ) /* Constants to setup and use the on board LED. */ -#define ucLED_BIT ( ( unsigned char ) 0x40 ) -#define mainPORT_1_BIT_6 ( ( unsigned char ) 0x40 ) -#define mainENABLE_CROSS_BAR ( ( unsigned char ) 0x40 ) +#define ucLED_BIT ( ( unsigned char ) 0x40 ) +#define mainPORT_1_BIT_6 ( ( unsigned char ) 0x40 ) +#define mainENABLE_CROSS_BAR ( ( unsigned char ) 0x40 ) /* Constants to set the clock frequency. */ -#define mainSELECT_INTERNAL_OSC ( ( unsigned char ) 0x80 ) -#define mainDIVIDE_CLOCK_BY_1 ( ( unsigned char ) 0x03 ) -#define mainPLL_USES_INTERNAL_OSC ( ( unsigned char ) 0x04 ) -#define mainFLASH_READ_TIMING ( ( unsigned char ) 0x30 ) -#define mainPLL_POWER_ON ( ( unsigned char ) 0x01 ) -#define mainPLL_NO_PREDIVIDE ( ( unsigned char ) 0x01 ) -#define mainPLL_FILTER ( ( unsigned char ) 0x01 ) -#define mainPLL_MULTIPLICATION ( ( unsigned char ) 0x04 ) -#define mainENABLE_PLL ( ( unsigned char ) 0x02 ) -#define mainPLL_LOCKED ( ( unsigned char ) 0x10 ) -#define mainSELECT_PLL_AS_SOURCE ( ( unsigned char ) 0x02 ) +#define mainSELECT_INTERNAL_OSC ( ( unsigned char ) 0x80 ) +#define mainDIVIDE_CLOCK_BY_1 ( ( unsigned char ) 0x03 ) +#define mainPLL_USES_INTERNAL_OSC ( ( unsigned char ) 0x04 ) +#define mainFLASH_READ_TIMING ( ( unsigned char ) 0x30 ) +#define mainPLL_POWER_ON ( ( unsigned char ) 0x01 ) +#define mainPLL_NO_PREDIVIDE ( ( unsigned char ) 0x01 ) +#define mainPLL_FILTER ( ( unsigned char ) 0x01 ) +#define mainPLL_MULTIPLICATION ( ( unsigned char ) 0x04 ) +#define mainENABLE_PLL ( ( unsigned char ) 0x02 ) +#define mainPLL_LOCKED ( ( unsigned char ) 0x10 ) +#define mainSELECT_PLL_AS_SOURCE ( ( unsigned char ) 0x02 ) /* Toggle rate for the on board LED - which is dependent on whether or not -an error has been detected. */ -#define mainNO_ERROR_FLASH_PERIOD ( ( TickType_t ) 5000 ) -#define mainERROR_FLASH_PERIOD ( ( TickType_t ) 250 ) + * an error has been detected. */ +#define mainNO_ERROR_FLASH_PERIOD ( ( TickType_t ) 5000 ) +#define mainERROR_FLASH_PERIOD ( ( TickType_t ) 250 ) /* Baud rate used by the serial port tasks. */ -#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 ) +#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 115200 ) /* Pass an invalid LED number to the COM test task as we don't want it to flash -an LED. There are only 8 LEDs (excluding the on board LED) wired in and these -are all used by the flash tasks. */ -#define mainCOM_TEST_LED ( 200 ) + * an LED. There are only 8 LEDs (excluding the on board LED) wired in and these + * are all used by the flash tasks. */ +#define mainCOM_TEST_LED ( 200 ) /* We want the Cygnal to act as much as possible as a standard 8052. */ -#define mainAUTO_SFR_OFF ( ( unsigned char ) 0 ) +#define mainAUTO_SFR_OFF ( ( unsigned char ) 0 ) /* Constants required to setup the IO pins for serial comms. */ -#define mainENABLE_COMS ( ( unsigned char ) 0x04 ) -#define mainCOMS_LINES_TO_PUSH_PULL ( ( unsigned char ) 0x03 ) +#define mainENABLE_COMS ( ( unsigned char ) 0x04 ) +#define mainCOMS_LINES_TO_PUSH_PULL ( ( unsigned char ) 0x03 ) /* Pointer passed as a parameter to vRegisterCheck() just so it has some know -values to check for in the DPH, DPL and B registers. */ -#define mainDUMMY_POINTER ( ( xdata void * ) 0xabcd ) + * values to check for in the DPH, DPL and B registers. */ +#define mainDUMMY_POINTER ( ( xdata void * ) 0xabcd ) /* Macro that lets vErrorChecks() know that one of the tasks defined in -main. c has detected an error. A critical region is used around xLatchError -as it is accessed from vErrorChecks(), which has a higher priority. */ -#define mainLATCH_ERROR() \ -{ \ - portENTER_CRITICAL(); \ - xLatchedError = pdTRUE; \ - portEXIT_CRITICAL(); \ -} + * main. c has detected an error. A critical region is used around xLatchError + * as it is accessed from vErrorChecks(), which has a higher priority. */ +#define mainLATCH_ERROR() \ + { \ + portENTER_CRITICAL(); \ + xLatchedError = pdTRUE; \ + portEXIT_CRITICAL(); \ + } /* - * Setup the Cygnal microcontroller for its fastest operation. + * Setup the Cygnal microcontroller for its fastest operation. */ static void prvSetupSystemClock( void ); /* - * Setup the peripherals, including the on board LED. + * Setup the peripherals, including the on board LED. */ static void prvSetupHardware( void ); /* - * Toggle the state of the on board LED. + * Toggle the state of the on board LED. */ static void prvToggleOnBoardLED( void ); /* - * See comments at the top of the file for details. + * See comments at the top of the file for details. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* - * See comments at the top of the file for details. + * See comments at the top of the file for details. */ -static void vRegisterCheck( void *pvParameters ); +static void vRegisterCheck( void * pvParameters ); /* - * See comments at the top of the file for details. + * See comments at the top of the file for details. */ -static void vFLOPCheck1( void *pvParameters ); +static void vFLOPCheck1( void * pvParameters ); /* - * See comments at the top of the file for details. + * See comments at the top of the file for details. */ -static void vFLOPCheck2( void *pvParameters ); +static void vFLOPCheck2( void * pvParameters ); /* File scope variable used to communicate the occurrence of an error between -tasks. */ + * tasks. */ static portBASE_TYPE xLatchedError = pdFALSE; /*-----------------------------------------------------------*/ /* - * Starts all the other tasks, then starts the scheduler. + * Starts all the other tasks, then starts the scheduler. */ void main( void ) { - /* Initialise the hardware including the system clock and on board - LED. */ - prvSetupHardware(); - - /* Initialise the port that controls the external LED's utilized by the - flash tasks. */ - vParTestInitialise(); - - /* Start the used standard demo tasks. */ - vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartIntegerMathTasks( mainINTEGER_PRIORITY ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - - /* Start the tasks defined in this file. The first three never block so - must not be used with the co-operative scheduler. */ - #if configUSE_PREEMPTION == 1 - { - xTaskCreate( vRegisterCheck, "RegChck", configMINIMAL_STACK_SIZE, mainDUMMY_POINTER, tskIDLE_PRIORITY, ( TaskHandle_t * ) NULL ); - xTaskCreate( vFLOPCheck1, "FLOP", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, ( TaskHandle_t * ) NULL ); - xTaskCreate( vFLOPCheck2, "FLOP", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, ( TaskHandle_t * ) NULL ); - } - #endif - - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, ( TaskHandle_t * ) NULL ); - - /* Finally kick off the scheduler. This function should never return. */ - vTaskStartScheduler(); - - /* Should never reach here as the tasks will now be executing under control - of the scheduler. */ + /* Initialise the hardware including the system clock and on board + * LED. */ + prvSetupHardware(); + + /* Initialise the port that controls the external LED's utilized by the + * flash tasks. */ + vParTestInitialise(); + + /* Start the used standard demo tasks. */ + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartIntegerMathTasks( mainINTEGER_PRIORITY ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + + /* Start the tasks defined in this file. The first three never block so + * must not be used with the co-operative scheduler. */ + #if configUSE_PREEMPTION == 1 + { + xTaskCreate( vRegisterCheck, "RegChck", configMINIMAL_STACK_SIZE, mainDUMMY_POINTER, tskIDLE_PRIORITY, ( TaskHandle_t * ) NULL ); + xTaskCreate( vFLOPCheck1, "FLOP", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, ( TaskHandle_t * ) NULL ); + xTaskCreate( vFLOPCheck2, "FLOP", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, ( TaskHandle_t * ) NULL ); + } + #endif + + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, ( TaskHandle_t * ) NULL ); + + /* Finally kick off the scheduler. This function should never return. */ + vTaskStartScheduler(); + + /* Should never reach here as the tasks will now be executing under control + * of the scheduler. */ } /*-----------------------------------------------------------*/ @@ -225,176 +225,179 @@ void main( void ) */ static void prvSetupHardware( void ) { -unsigned char ucOriginalSFRPage; + unsigned char ucOriginalSFRPage; - /* Remember the SFR page before it is changed so it can get set back - before the function exits. */ - ucOriginalSFRPage = SFRPAGE; + /* Remember the SFR page before it is changed so it can get set back + * before the function exits. */ + ucOriginalSFRPage = SFRPAGE; - /* Setup the SFR page to access the config SFR's. */ - SFRPAGE = CONFIG_PAGE; + /* Setup the SFR page to access the config SFR's. */ + SFRPAGE = CONFIG_PAGE; - /* Don't allow the microcontroller to automatically switch SFR page, as the - SFR page is not stored as part of the task context. */ - SFRPGCN = mainAUTO_SFR_OFF; + /* Don't allow the microcontroller to automatically switch SFR page, as the + * SFR page is not stored as part of the task context. */ + SFRPGCN = mainAUTO_SFR_OFF; - /* Disable the watchdog. */ - WDTCN = mainDISABLE_BYTE_1; - WDTCN = mainDISABLE_BYTE_2; + /* Disable the watchdog. */ + WDTCN = mainDISABLE_BYTE_1; + WDTCN = mainDISABLE_BYTE_2; - /* Set the on board LED to push pull. */ - P1MDOUT |= mainPORT_1_BIT_6; + /* Set the on board LED to push pull. */ + P1MDOUT |= mainPORT_1_BIT_6; - /* Setup the cross bar to enable serial comms here as it is not part of the - standard 8051 setup and therefore is not in the driver code. */ - XBR0 |= mainENABLE_COMS; - P0MDOUT |= mainCOMS_LINES_TO_PUSH_PULL; + /* Setup the cross bar to enable serial comms here as it is not part of the + * standard 8051 setup and therefore is not in the driver code. */ + XBR0 |= mainENABLE_COMS; + P0MDOUT |= mainCOMS_LINES_TO_PUSH_PULL; - /* Enable the cross bar so our hardware setup takes effect. */ - XBR2 = mainENABLE_CROSS_BAR; + /* Enable the cross bar so our hardware setup takes effect. */ + XBR2 = mainENABLE_CROSS_BAR; - /* Setup a fast system clock. */ - prvSetupSystemClock(); + /* Setup a fast system clock. */ + prvSetupSystemClock(); - /* Return the SFR page. */ - SFRPAGE = ucOriginalSFRPage; + /* Return the SFR page. */ + SFRPAGE = ucOriginalSFRPage; } /*-----------------------------------------------------------*/ static void prvSetupSystemClock( void ) { -volatile unsigned short usWait; -const unsigned short usWaitTime = ( unsigned short ) 0x2ff; -unsigned char ucOriginalSFRPage; + volatile unsigned short usWait; + const unsigned short usWaitTime = ( unsigned short ) 0x2ff; + unsigned char ucOriginalSFRPage; - /* Remember the SFR page so we can set it back at the end. */ - ucOriginalSFRPage = SFRPAGE; - SFRPAGE = CONFIG_PAGE; + /* Remember the SFR page so we can set it back at the end. */ + ucOriginalSFRPage = SFRPAGE; + SFRPAGE = CONFIG_PAGE; - /* Use the internal oscillator set to its fasted frequency. */ - OSCICN = mainSELECT_INTERNAL_OSC | mainDIVIDE_CLOCK_BY_1; + /* Use the internal oscillator set to its fasted frequency. */ + OSCICN = mainSELECT_INTERNAL_OSC | mainDIVIDE_CLOCK_BY_1; - /* Ensure the clock is stable. */ - for( usWait = 0; usWait < usWaitTime; usWait++ ); + /* Ensure the clock is stable. */ + for( usWait = 0; usWait < usWaitTime; usWait++ ) + { + } - /* Setup the clock source for the PLL. */ - PLL0CN &= ~mainPLL_USES_INTERNAL_OSC; + /* Setup the clock source for the PLL. */ + PLL0CN &= ~mainPLL_USES_INTERNAL_OSC; - /* Change the read timing for the flash ready for the fast clock. */ - SFRPAGE = LEGACY_PAGE; - FLSCL |= mainFLASH_READ_TIMING; + /* Change the read timing for the flash ready for the fast clock. */ + SFRPAGE = LEGACY_PAGE; + FLSCL |= mainFLASH_READ_TIMING; - /* Turn on the PLL power. */ - SFRPAGE = CONFIG_PAGE; - PLL0CN |= mainPLL_POWER_ON; + /* Turn on the PLL power. */ + SFRPAGE = CONFIG_PAGE; + PLL0CN |= mainPLL_POWER_ON; - /* Don't predivide the clock. */ - PLL0DIV = mainPLL_NO_PREDIVIDE; + /* Don't predivide the clock. */ + PLL0DIV = mainPLL_NO_PREDIVIDE; - /* Set filter for fastest clock. */ - PLL0FLT = mainPLL_FILTER; - PLL0MUL = mainPLL_MULTIPLICATION; + /* Set filter for fastest clock. */ + PLL0FLT = mainPLL_FILTER; + PLL0MUL = mainPLL_MULTIPLICATION; - /* Ensure the clock is stable. */ - for( usWait = 0; usWait < usWaitTime; usWait++ ); + /* Ensure the clock is stable. */ + for( usWait = 0; usWait < usWaitTime; usWait++ ) + { + } - /* Enable the PLL and wait for it to lock. */ - PLL0CN |= mainENABLE_PLL; - for( usWait = 0; usWait < usWaitTime; usWait++ ) - { - if( PLL0CN & mainPLL_LOCKED ) - { - break; - } - } + /* Enable the PLL and wait for it to lock. */ + PLL0CN |= mainENABLE_PLL; - /* Select the PLL as the clock source. */ - CLKSEL |= mainSELECT_PLL_AS_SOURCE; + for( usWait = 0; usWait < usWaitTime; usWait++ ) + { + if( PLL0CN & mainPLL_LOCKED ) + { + break; + } + } - /* Return the SFR back to its original value. */ - SFRPAGE = ucOriginalSFRPage; + /* Select the PLL as the clock source. */ + CLKSEL |= mainSELECT_PLL_AS_SOURCE; + + /* Return the SFR back to its original value. */ + SFRPAGE = ucOriginalSFRPage; } /*-----------------------------------------------------------*/ static void prvToggleOnBoardLED( void ) { - /* If the on board LED is on, turn it off and vice versa. */ - if( P1 & ucLED_BIT ) - { - P1 &= ~ucLED_BIT; - } - else - { - P1 |= ucLED_BIT; - } + /* If the on board LED is on, turn it off and vice versa. */ + if( P1 & ucLED_BIT ) + { + P1 &= ~ucLED_BIT; + } + else + { + P1 |= ucLED_BIT; + } } /*-----------------------------------------------------------*/ /* - * See the documentation at the top of this file. + * See the documentation at the top of this file. */ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -portBASE_TYPE xErrorHasOccurred = pdFALSE; - - /* Just to prevent compiler warnings. */ - ( void ) pvParameters; - - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. The delay period depends on whether an error - has ever been detected. */ - for( ;; ) - { - if( xLatchedError == pdFALSE ) - { - /* No errors have been detected so delay for a longer period. The - on board LED will get toggled every mainNO_ERROR_FLASH_PERIOD ms. */ - vTaskDelay( mainNO_ERROR_FLASH_PERIOD ); - } - else - { - /* We have at some time recognised an error in one of the demo - application tasks, delay for a shorter period. The on board LED - will get toggled every mainERROR_FLASH_PERIOD ms. */ - vTaskDelay( mainERROR_FLASH_PERIOD ); - } - - - - /* Check the demo application tasks for errors. */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } - - /* If an error has occurred, latch it to cause the LED flash rate to - increase. */ - if( xErrorHasOccurred == pdTRUE ) - { - xLatchedError = pdTRUE; - } - - /* Toggle the LED to indicate the completion of a check cycle. The - frequency of check cycles is dependent on whether or not we have - latched an error. */ - prvToggleOnBoardLED(); - } + portBASE_TYPE xErrorHasOccurred = pdFALSE; + + /* Just to prevent compiler warnings. */ + ( void ) pvParameters; + + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. The delay period depends on whether an error + * has ever been detected. */ + for( ; ; ) + { + if( xLatchedError == pdFALSE ) + { + /* No errors have been detected so delay for a longer period. The + * on board LED will get toggled every mainNO_ERROR_FLASH_PERIOD ms. */ + vTaskDelay( mainNO_ERROR_FLASH_PERIOD ); + } + else + { + /* We have at some time recognised an error in one of the demo + * application tasks, delay for a shorter period. The on board LED + * will get toggled every mainERROR_FLASH_PERIOD ms. */ + vTaskDelay( mainERROR_FLASH_PERIOD ); + } + + /* Check the demo application tasks for errors. */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } + + /* If an error has occurred, latch it to cause the LED flash rate to + * increase. */ + if( xErrorHasOccurred == pdTRUE ) + { + xLatchedError = pdTRUE; + } + + /* Toggle the LED to indicate the completion of a check cycle. The + * frequency of check cycles is dependent on whether or not we have + * latched an error. */ + prvToggleOnBoardLED(); + } } /*-----------------------------------------------------------*/ @@ -402,156 +405,164 @@ portBASE_TYPE xErrorHasOccurred = pdFALSE; * See the documentation at the top of this file. Also see the standard FLOP * demo task documentation for the rationale of these tasks. */ -static void vFLOPCheck1( void *pvParameters ) +static void vFLOPCheck1( void * pvParameters ) { -volatile portFLOAT fVal1, fVal2, fResult; - - ( void ) pvParameters; - - for( ;; ) - { - fVal1 = ( portFLOAT ) -1234.5678; - fVal2 = ( portFLOAT ) 2345.6789; - - fResult = fVal1 + fVal2; - if( ( fResult > ( portFLOAT ) 1111.15 ) || ( fResult < ( portFLOAT ) 1111.05 ) ) - { - mainLATCH_ERROR(); - } - - fResult = fVal1 / fVal2; - if( ( fResult > ( portFLOAT ) -0.51 ) || ( fResult < ( portFLOAT ) -0.53 ) ) - { - mainLATCH_ERROR(); - } - } + volatile portFLOAT fVal1, fVal2, fResult; + + ( void ) pvParameters; + + for( ; ; ) + { + fVal1 = ( portFLOAT ) - 1234.5678; + fVal2 = ( portFLOAT ) 2345.6789; + + fResult = fVal1 + fVal2; + + if( ( fResult > ( portFLOAT ) 1111.15 ) || ( fResult < ( portFLOAT ) 1111.05 ) ) + { + mainLATCH_ERROR(); + } + + fResult = fVal1 / fVal2; + + if( ( fResult > ( portFLOAT ) - 0.51 ) || ( fResult < ( portFLOAT ) - 0.53 ) ) + { + mainLATCH_ERROR(); + } + } } /*-----------------------------------------------------------*/ /* * See the documentation at the top of this file. */ -static void vFLOPCheck2( void *pvParameters ) +static void vFLOPCheck2( void * pvParameters ) { -volatile portFLOAT fVal1, fVal2, fResult; - - ( void ) pvParameters; - - for( ;; ) - { - fVal1 = ( portFLOAT ) -12340.5678; - fVal2 = ( portFLOAT ) 23450.6789; - - fResult = fVal1 + fVal2; - if( ( fResult > ( portFLOAT ) 11110.15 ) || ( fResult < ( portFLOAT ) 11110.05 ) ) - { - mainLATCH_ERROR(); - } - - fResult = fVal1 / -fVal2; - if( ( fResult > ( portFLOAT ) 0.53 ) || ( fResult < ( portFLOAT ) 0.51 ) ) - { - mainLATCH_ERROR(); - } - } + volatile portFLOAT fVal1, fVal2, fResult; + + ( void ) pvParameters; + + for( ; ; ) + { + fVal1 = ( portFLOAT ) - 12340.5678; + fVal2 = ( portFLOAT ) 23450.6789; + + fResult = fVal1 + fVal2; + + if( ( fResult > ( portFLOAT ) 11110.15 ) || ( fResult < ( portFLOAT ) 11110.05 ) ) + { + mainLATCH_ERROR(); + } + + fResult = fVal1 / -fVal2; + + if( ( fResult > ( portFLOAT ) 0.53 ) || ( fResult < ( portFLOAT ) 0.51 ) ) + { + mainLATCH_ERROR(); + } + } } /*-----------------------------------------------------------*/ /* - * See the documentation at the top of this file. + * See the documentation at the top of this file. */ -static void vRegisterCheck( void *pvParameters ) +static void vRegisterCheck( void * pvParameters ) { - ( void ) pvParameters; - - for( ;; ) - { - if( SP != configSTACK_START ) - { - mainLATCH_ERROR(); - } - - _asm - MOV ACC, ar0 - _endasm; - - if( ACC != 0 ) - { - mainLATCH_ERROR(); - } - - _asm - MOV ACC, ar1 - _endasm; - - if( ACC != 1 ) - { - mainLATCH_ERROR(); - } - _asm - MOV ACC, ar2 - _endasm; - - if( ACC != 2 ) - { - mainLATCH_ERROR(); - } - _asm - MOV ACC, ar3 - _endasm; - - if( ACC != 3 ) - { - mainLATCH_ERROR(); - } - _asm - MOV ACC, ar4 - _endasm; - - if( ACC != 4 ) - { - mainLATCH_ERROR(); - } - _asm - MOV ACC, ar5 - _endasm; - - if( ACC != 5 ) - { - mainLATCH_ERROR(); - } - _asm - MOV ACC, ar6 - _endasm; - - if( ACC != 6 ) - { - mainLATCH_ERROR(); - } - _asm - MOV ACC, ar7 - _endasm; - - if( ACC != 7 ) - { - mainLATCH_ERROR(); - } - - if( DPL != 0xcd ) - { - mainLATCH_ERROR(); - } - - if( DPH != 0xab ) - { - mainLATCH_ERROR(); - } - - if( B != 0x01 ) - { - mainLATCH_ERROR(); - } - } + ( void ) pvParameters; + + for( ; ; ) + { + if( SP != configSTACK_START ) + { + mainLATCH_ERROR(); + } + + _asm + MOV ACC, ar0 + _endasm; + + if( ACC != 0 ) + { + mainLATCH_ERROR(); + } + + _asm + MOV ACC, ar1 + _endasm; + + if( ACC != 1 ) + { + mainLATCH_ERROR(); + } + + _asm + MOV ACC, ar2 + _endasm; + + if( ACC != 2 ) + { + mainLATCH_ERROR(); + } + + _asm + MOV ACC, ar3 + _endasm; + + if( ACC != 3 ) + { + mainLATCH_ERROR(); + } + + _asm + MOV ACC, ar4 + _endasm; + + if( ACC != 4 ) + { + mainLATCH_ERROR(); + } + + _asm + MOV ACC, ar5 + _endasm; + + if( ACC != 5 ) + { + mainLATCH_ERROR(); + } + + _asm + MOV ACC, ar6 + _endasm; + + if( ACC != 6 ) + { + mainLATCH_ERROR(); + } + + _asm + MOV ACC, ar7 + _endasm; + + if( ACC != 7 ) + { + mainLATCH_ERROR(); + } + + if( DPL != 0xcd ) + { + mainLATCH_ERROR(); + } + + if( DPH != 0xab ) + { + mainLATCH_ERROR(); + } + + if( B != 0x01 ) + { + mainLATCH_ERROR(); + } + } } - - diff --git a/FreeRTOS/Demo/Cygnal/serial/serial.c b/FreeRTOS/Demo/Cygnal/serial/serial.c index f9afb12c6c5..fb7e6a64ca8 100644 --- a/FreeRTOS/Demo/Cygnal/serial/serial.c +++ b/FreeRTOS/Demo/Cygnal/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Flshlite/FRConfig.h b/FreeRTOS/Demo/Flshlite/FRConfig.h index a62f1f5eb5b..2496b827e2b 100644 --- a/FreeRTOS/Demo/Flshlite/FRConfig.h +++ b/FreeRTOS/Demo/Flshlite/FRConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Flshlite/FileIO/fileIO.c b/FreeRTOS/Demo/Flshlite/FileIO/fileIO.c index 75a70412b50..9e8201cf03f 100644 --- a/FreeRTOS/Demo/Flshlite/FileIO/fileIO.c +++ b/FreeRTOS/Demo/Flshlite/FileIO/fileIO.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Flshlite/FreeRTOSConfig.h b/FreeRTOS/Demo/Flshlite/FreeRTOSConfig.h index 002399c9350..f89649bef19 100644 --- a/FreeRTOS/Demo/Flshlite/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/Flshlite/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Flshlite/ParTest/ParTest.c b/FreeRTOS/Demo/Flshlite/ParTest/ParTest.c index cff52dd1e76..740d1c0b92d 100644 --- a/FreeRTOS/Demo/Flshlite/ParTest/ParTest.c +++ b/FreeRTOS/Demo/Flshlite/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Flshlite/main.c b/FreeRTOS/Demo/Flshlite/main.c index aa723c434b0..67039082d81 100644 --- a/FreeRTOS/Demo/Flshlite/main.c +++ b/FreeRTOS/Demo/Flshlite/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -27,13 +27,13 @@ /* * Creates all the demo application tasks, then starts the scheduler. * - * Main. c also creates a task called "Print". This only executes every five - * seconds but has the highest priority so is guaranteed to get processor time. - * Its main function is to check that all the other tasks are still operational. - * Nearly all the tasks in the demo application maintain a unique count that is - * incremented each time the task successfully completes its function. Should any - * error occur within the task the count is permanently halted. The print task - * checks the count of each task to ensure it has changed since the last time the + * Main. c also creates a task called "Print". This only executes every five + * seconds but has the highest priority so is guaranteed to get processor time. + * Its main function is to check that all the other tasks are still operational. + * Nearly all the tasks in the demo application maintain a unique count that is + * incremented each time the task successfully completes its function. Should any + * error occur within the task the count is permanently halted. The print task + * checks the count of each task to ensure it has changed since the last time the * print task executed. If any count is found not to have changed the print task * displays an appropriate message, halts, and flashes the on board LED rapidly. * If all the tasks are still incrementing their unique counts the print task @@ -56,27 +56,27 @@ */ /* -Changes from V1.01: - - + Previously, if an error occurred in a task the on board LED was stopped from - toggling. Now if an error occurs the check task enters an infinite loop, - toggling the LED rapidly. - -Changes from V1.2.3 - - + The integer and comtest tasks are now used when the cooperative scheduler - is being used. Previously they were only used with the preemptive - scheduler. - -Changes from V1.2.5 - - + Made the communications RX task a higher priority. - -Changes from V2.0.0 - - + Delay periods are now specified using variables and constants of - TickType_t rather than unsigned long. -*/ + * Changes from V1.01: + * + + Previously, if an error occurred in a task the on board LED was stopped from + + toggling. Now if an error occurs the check task enters an infinite loop, + + toggling the LED rapidly. + + + + Changes from V1.2.3 + + + + The integer and comtest tasks are now used when the cooperative scheduler + + is being used. Previously they were only used with the preemptive + + scheduler. + + + + Changes from V1.2.5 + + + + Made the communications RX task a higher priority. + + + + Changes from V2.0.0 + + + + Delay periods are now specified using variables and constants of + + TickType_t rather than unsigned long. + */ #include #include @@ -97,30 +97,30 @@ Changes from V2.0.0 #include "semtest.h" /* Priority definitions for all the tasks in the demo application. */ -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainPRINT_TASK_PRIORITY ( tskIDLE_PRIORITY + 5 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_BLOCK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainSEMAPHORE_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainPRINT_TASK_PRIORITY ( tskIDLE_PRIORITY + 5 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_BLOCK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainSEMAPHORE_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainPRINT_STACK_SIZE ( ( unsigned short ) 256 ) -#define mainDEBUG_LOG_BUFFER_SIZE ( ( unsigned short ) 20480 ) +#define mainPRINT_STACK_SIZE ( ( unsigned short ) 256 ) +#define mainDEBUG_LOG_BUFFER_SIZE ( ( unsigned short ) 20480 ) /* Constant definitions for accessing the build in LED on the Flashlite 186. */ -#define mainLED_REG_DIR ( ( unsigned short ) 0xff78 ) -#define mainLED_REG ( ( unsigned short ) 0xff7a ) +#define mainLED_REG_DIR ( ( unsigned short ) 0xff78 ) +#define mainLED_REG ( ( unsigned short ) 0xff7a ) /* If an error is detected in a task then the vErrorChecks() task will enter -an infinite loop flashing the LED at this rate. */ -#define mainERROR_FLASH_RATE ( ( TickType_t ) 100 / portTICK_PERIOD_MS ) + * an infinite loop flashing the LED at this rate. */ +#define mainERROR_FLASH_RATE ( ( TickType_t ) 100 / portTICK_PERIOD_MS ) /* Task function for the "Print" task as described at the top of the file. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* Function that checks the unique count of all the other tasks as described at -the top of the file. */ + * the top of the file. */ static void prvCheckOtherTasksAreStillRunning( void ); /* Functions to setup and use the built in LED on the Flashlite 186 board. */ @@ -128,8 +128,8 @@ static void prvToggleLED( void ); static void prvInitLED( void ); /* Key presses can be used to start/stop the trace visualisation utility or stop -the scheduler. */ -static void prvCheckForKeyPresses( void ); + * the scheduler. */ +static void prvCheckForKeyPresses( void ); /* Buffer used by the trace visualisation utility. */ static char pcWriteBuffer[ mainDEBUG_LOG_BUFFER_SIZE ]; @@ -137,244 +137,246 @@ static char pcWriteBuffer[ mainDEBUG_LOG_BUFFER_SIZE ]; /*-----------------------------------------------------------*/ short main( void ) { - /* Initialise hardware and utilities. */ - vParTestInitialise(); - vPrintInitialise(); - prvInitLED(); + /* Initialise hardware and utilities. */ + vParTestInitialise(); + vPrintInitialise(); + prvInitLED(); - /* CREATE ALL THE DEMO APPLICATION TASKS. */ + /* CREATE ALL THE DEMO APPLICATION TASKS. */ - vStartComTestTasks( mainCOM_TEST_PRIORITY, serCOM2, ser38400 ); - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartBlockingQueueTasks( mainQUEUE_BLOCK_PRIORITY ); - vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - vStartSemaphoreTasks( mainSEMAPHORE_TASK_PRIORITY ); + vStartComTestTasks( mainCOM_TEST_PRIORITY, serCOM2, ser38400 ); + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartBlockingQueueTasks( mainQUEUE_BLOCK_PRIORITY ); + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + vStartSemaphoreTasks( mainSEMAPHORE_TASK_PRIORITY ); - /* Create the "Print" task as described at the top of the file. */ - xTaskCreate( vErrorChecks, "Print", mainPRINT_STACK_SIZE, NULL, mainPRINT_TASK_PRIORITY, NULL ); + /* Create the "Print" task as described at the top of the file. */ + xTaskCreate( vErrorChecks, "Print", mainPRINT_STACK_SIZE, NULL, mainPRINT_TASK_PRIORITY, NULL ); - /* This task has to be created last as it keeps account of the number of tasks - it expects to see running. */ - vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + /* This task has to be created last as it keeps account of the number of tasks + * it expects to see running. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - /* Set the scheduler running. This function will not return unless a task - calls vTaskEndScheduler(). */ - vTaskStartScheduler(); + /* Set the scheduler running. This function will not return unless a task + * calls vTaskEndScheduler(). */ + vTaskStartScheduler(); - return 1; + return 1; } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -TickType_t xExpectedWakeTime; -const TickType_t xPrintRate = ( TickType_t ) 5000 / portTICK_PERIOD_MS; -const long lMaxAllowableTimeDifference = ( long ) 0; -TickType_t xWakeTime; -long lTimeDifference; -const char *pcReceivedMessage; -const char * const pcTaskBlockedTooLongMsg = "Print task blocked too long!\r\n"; - - /* Stop warnings. */ + TickType_t xExpectedWakeTime; + const TickType_t xPrintRate = ( TickType_t ) 5000 / portTICK_PERIOD_MS; + const long lMaxAllowableTimeDifference = ( long ) 0; + TickType_t xWakeTime; + long lTimeDifference; + const char * pcReceivedMessage; + const char * const pcTaskBlockedTooLongMsg = "Print task blocked too long!\r\n"; + + /* Stop warnings. */ ( void ) pvParameters; - /* Loop continuously, blocking, then checking all the other tasks are still - running, before blocking once again. This task blocks on the queue of messages - that require displaying so will wake either by its time out expiring, or a - message becoming available. */ - for( ;; ) - { - /* Calculate the time we will unblock if no messages are received - on the queue. This is used to check that we have not blocked for too long. */ - xExpectedWakeTime = xTaskGetTickCount(); - xExpectedWakeTime += xPrintRate; - - /* Block waiting for either a time out or a message to be posted that - required displaying. */ - pcReceivedMessage = pcPrintGetNextMessage( xPrintRate ); - - /* Was a message received? */ - if( pcReceivedMessage == NULL ) - { - /* A message was not received so we timed out, did we unblock at the - expected time? */ - xWakeTime = xTaskGetTickCount(); - - /* Calculate the difference between the time we unblocked and the - time we should have unblocked. */ - if( xWakeTime > xExpectedWakeTime ) - { - lTimeDifference = ( long ) ( xWakeTime - xExpectedWakeTime ); - } - else - { - lTimeDifference = ( long ) ( xExpectedWakeTime - xWakeTime ); - } - - if( lTimeDifference > lMaxAllowableTimeDifference ) - { - /* We blocked too long - create a message that will get - printed out the next time around. */ - vPrintDisplayMessage( &pcTaskBlockedTooLongMsg ); - } - - /* Check the other tasks are still running, just in case. */ - prvCheckOtherTasksAreStillRunning(); - } - else - { - /* We unblocked due to a message becoming available. Send the message - for printing. */ - vDisplayMessage( pcReceivedMessage ); - } - - /* Key presses are used to invoke the trace visualisation utility, or - end the program. */ - prvCheckForKeyPresses(); - } + /* Loop continuously, blocking, then checking all the other tasks are still + * running, before blocking once again. This task blocks on the queue of messages + * that require displaying so will wake either by its time out expiring, or a + * message becoming available. */ + for( ; ; ) + { + /* Calculate the time we will unblock if no messages are received + * on the queue. This is used to check that we have not blocked for too long. */ + xExpectedWakeTime = xTaskGetTickCount(); + xExpectedWakeTime += xPrintRate; + + /* Block waiting for either a time out or a message to be posted that + * required displaying. */ + pcReceivedMessage = pcPrintGetNextMessage( xPrintRate ); + + /* Was a message received? */ + if( pcReceivedMessage == NULL ) + { + /* A message was not received so we timed out, did we unblock at the + * expected time? */ + xWakeTime = xTaskGetTickCount(); + + /* Calculate the difference between the time we unblocked and the + * time we should have unblocked. */ + if( xWakeTime > xExpectedWakeTime ) + { + lTimeDifference = ( long ) ( xWakeTime - xExpectedWakeTime ); + } + else + { + lTimeDifference = ( long ) ( xExpectedWakeTime - xWakeTime ); + } + + if( lTimeDifference > lMaxAllowableTimeDifference ) + { + /* We blocked too long - create a message that will get + * printed out the next time around. */ + vPrintDisplayMessage( &pcTaskBlockedTooLongMsg ); + } + + /* Check the other tasks are still running, just in case. */ + prvCheckOtherTasksAreStillRunning(); + } + else + { + /* We unblocked due to a message becoming available. Send the message + * for printing. */ + vDisplayMessage( pcReceivedMessage ); + } + + /* Key presses are used to invoke the trace visualisation utility, or + * end the program. */ + prvCheckForKeyPresses(); + } } /*lint !e715 !e818 pvParameters is not used but all task functions must take this form. */ /*-----------------------------------------------------------*/ -static void prvCheckForKeyPresses( void ) +static void prvCheckForKeyPresses( void ) { - #ifdef USE_STDIO - - short sIn; - - - taskENTER_CRITICAL(); - sIn = kbhit(); - taskEXIT_CRITICAL(); - - if( sIn ) - { - unsigned long ulBufferLength; - - /* Key presses can be used to start/stop the trace utility, or end the - program. */ - sIn = getch(); - switch( sIn ) - { - /* Only define keys for turning on and off the trace if the trace - is being used. */ - #if configUSE_TRACE_FACILITY == 1 - case 't' : vTaskList( pcWriteBuffer ); - vWriteMessageToDisk( pcWriteBuffer ); - break; - - /* The legacy trace is no longer supported. Use FreeRTOS+Trace instead. - case 's' : vTaskStartTrace( pcWriteBuffer, mainDEBUG_LOG_BUFFER_SIZE ); - break; - - case 'e' : ulBufferLength = ulTaskEndTrace(); - vWriteBufferToDisk( pcWriteBuffer, ulBufferLength ); - break;*/ - #endif - - default : vTaskEndScheduler(); - break; - } - } - - #else - ( void ) pcWriteBuffer; - #endif + #ifdef USE_STDIO + short sIn; + + + taskENTER_CRITICAL(); + sIn = kbhit(); + taskEXIT_CRITICAL(); + + if( sIn ) + { + unsigned long ulBufferLength; + + /* Key presses can be used to start/stop the trace utility, or end the + * program. */ + sIn = getch(); + + switch( sIn ) + { + /* Only define keys for turning on and off the trace if the trace + * is being used. */ + #if configUSE_TRACE_FACILITY == 1 + case 't': + vTaskList( pcWriteBuffer ); + vWriteMessageToDisk( pcWriteBuffer ); + break; + + /* The legacy trace is no longer supported. Use FreeRTOS+Trace instead. + * case 's' : vTaskStartTrace( pcWriteBuffer, mainDEBUG_LOG_BUFFER_SIZE ); + * break; + * + * case 'e' : ulBufferLength = ulTaskEndTrace(); + * vWriteBufferToDisk( pcWriteBuffer, ulBufferLength ); + * break;*/ + #endif + + default: + vTaskEndScheduler(); + break; + } + } + #else /* ifdef USE_STDIO */ + ( void ) pcWriteBuffer; + #endif /* ifdef USE_STDIO */ } /*-----------------------------------------------------------*/ static void prvCheckOtherTasksAreStillRunning( void ) { -short sErrorHasOccurred = pdFALSE; - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - vDisplayMessage( "Com test count unchanged!\r\n" ); - sErrorHasOccurred = pdTRUE; - } - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - vDisplayMessage( "Integer maths task count unchanged!\r\n" ); - sErrorHasOccurred = pdTRUE; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - vDisplayMessage( "Blocking queues count unchanged!\r\n" ); - sErrorHasOccurred = pdTRUE; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - vDisplayMessage( "Polling queue count unchanged!\r\n" ); - sErrorHasOccurred = pdTRUE; - } - - if( xIsCreateTaskStillRunning() != pdTRUE ) - { - vDisplayMessage( "Incorrect number of tasks running!\r\n" ); - sErrorHasOccurred = pdTRUE; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - vDisplayMessage( "Semaphore take count unchanged!\r\n" ); - sErrorHasOccurred = pdTRUE; - } - - if( sErrorHasOccurred == pdFALSE ) - { - vDisplayMessage( "OK " ); - /* Toggle the LED if everything is okay so we know if an error occurs even if not - using console IO. */ - prvToggleLED(); - } - else - { - for( ;; ) - { - /* An error has occurred in one of the tasks. Don't go any further and - flash the LED rapidly in case console IO is not being used. */ - prvToggleLED(); - vTaskDelay( mainERROR_FLASH_RATE ); - } - } + short sErrorHasOccurred = pdFALSE; + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + vDisplayMessage( "Com test count unchanged!\r\n" ); + sErrorHasOccurred = pdTRUE; + } + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + vDisplayMessage( "Integer maths task count unchanged!\r\n" ); + sErrorHasOccurred = pdTRUE; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + vDisplayMessage( "Blocking queues count unchanged!\r\n" ); + sErrorHasOccurred = pdTRUE; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + vDisplayMessage( "Polling queue count unchanged!\r\n" ); + sErrorHasOccurred = pdTRUE; + } + + if( xIsCreateTaskStillRunning() != pdTRUE ) + { + vDisplayMessage( "Incorrect number of tasks running!\r\n" ); + sErrorHasOccurred = pdTRUE; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + vDisplayMessage( "Semaphore take count unchanged!\r\n" ); + sErrorHasOccurred = pdTRUE; + } + + if( sErrorHasOccurred == pdFALSE ) + { + vDisplayMessage( "OK " ); + + /* Toggle the LED if everything is okay so we know if an error occurs even if not + * using console IO. */ + prvToggleLED(); + } + else + { + for( ; ; ) + { + /* An error has occurred in one of the tasks. Don't go any further and + * flash the LED rapidly in case console IO is not being used. */ + prvToggleLED(); + vTaskDelay( mainERROR_FLASH_RATE ); + } + } } /*-----------------------------------------------------------*/ static void prvInitLED( void ) { -unsigned short usPortDirection; -const unsigned short usLEDOut = 0x400; + unsigned short usPortDirection; + const unsigned short usLEDOut = 0x400; - /* Set the LED bit to an output. */ + /* Set the LED bit to an output. */ - usPortDirection = inpw( mainLED_REG_DIR ); - usPortDirection &= ~usLEDOut; - outpw( mainLED_REG_DIR, usPortDirection ); + usPortDirection = inpw( mainLED_REG_DIR ); + usPortDirection &= ~usLEDOut; + outpw( mainLED_REG_DIR, usPortDirection ); } /*-----------------------------------------------------------*/ static void prvToggleLED( void ) { -static short sLED = pdTRUE; -unsigned short usLEDState; -const unsigned short usLEDBit = 0x400; - - /* Flip the state of the LED. */ - usLEDState = inpw( mainLED_REG ); - if( sLED ) - { - usLEDState &= ~usLEDBit; - } - else - { - usLEDState |= usLEDBit; - } - outpw( mainLED_REG, usLEDState ); - - sLED = !sLED; -} + static short sLED = pdTRUE; + unsigned short usLEDState; + const unsigned short usLEDBit = 0x400; + /* Flip the state of the LED. */ + usLEDState = inpw( mainLED_REG ); + if( sLED ) + { + usLEDState &= ~usLEDBit; + } + else + { + usLEDState |= usLEDBit; + } + + outpw( mainLED_REG, usLEDState ); + + sLED = !sLED; +} diff --git a/FreeRTOS/Demo/Flshlite/serial/serial.c b/FreeRTOS/Demo/Flshlite/serial/serial.c index b64117d96ce..0af37f61a4e 100644 --- a/FreeRTOS/Demo/Flshlite/serial/serial.c +++ b/FreeRTOS/Demo/Flshlite/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/H8S/RTOSDemo/FreeRTOSConfig.h b/FreeRTOS/Demo/H8S/RTOSDemo/FreeRTOSConfig.h index 13313dbee92..494647dab5c 100644 --- a/FreeRTOS/Demo/H8S/RTOSDemo/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/H8S/RTOSDemo/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/H8S/RTOSDemo/ParTest/ParTest.c b/FreeRTOS/Demo/H8S/RTOSDemo/ParTest/ParTest.c index bf9ab7ae06f..9af9d3dbbe4 100644 --- a/FreeRTOS/Demo/H8S/RTOSDemo/ParTest/ParTest.c +++ b/FreeRTOS/Demo/H8S/RTOSDemo/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/H8S/RTOSDemo/main.c b/FreeRTOS/Demo/H8S/RTOSDemo/main.c index 061dd1ed497..91d5983097c 100644 --- a/FreeRTOS/Demo/H8S/RTOSDemo/main.c +++ b/FreeRTOS/Demo/H8S/RTOSDemo/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/H8S/RTOSDemo/serial/serial.c b/FreeRTOS/Demo/H8S/RTOSDemo/serial/serial.c index aa7bdbb34fe..3d4d03a0b2f 100644 --- a/FreeRTOS/Demo/H8S/RTOSDemo/serial/serial.c +++ b/FreeRTOS/Demo/H8S/RTOSDemo/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/HCS12_CodeWarrior_banked/FreeRTOSConfig.h b/FreeRTOS/Demo/HCS12_CodeWarrior_banked/FreeRTOSConfig.h index ed874fa7171..e3bf33142f3 100644 --- a/FreeRTOS/Demo/HCS12_CodeWarrior_banked/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/HCS12_CodeWarrior_banked/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/HCS12_CodeWarrior_banked/ParTest/ParTest.c b/FreeRTOS/Demo/HCS12_CodeWarrior_banked/ParTest/ParTest.c index f0425f579f3..9603c632ce9 100644 --- a/FreeRTOS/Demo/HCS12_CodeWarrior_banked/ParTest/ParTest.c +++ b/FreeRTOS/Demo/HCS12_CodeWarrior_banked/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/HCS12_CodeWarrior_banked/main.c b/FreeRTOS/Demo/HCS12_CodeWarrior_banked/main.c index a6d663e805c..c2d771d296c 100644 --- a/FreeRTOS/Demo/HCS12_CodeWarrior_banked/main.c +++ b/FreeRTOS/Demo/HCS12_CodeWarrior_banked/main.c @@ -1,7 +1,6 @@ - /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -29,26 +28,26 @@ /* * * vMain() is effectively the demo application entry point. It is called by - * the main() function generated by the Processor Expert application. + * the main() function generated by the Processor Expert application. * * vMain() creates all the demo application tasks, then starts the scheduler. * The WEB documentation provides more details of the demo application tasks. * - * Main.c also creates a task called "Check". This only executes every three - * seconds but has the highest priority so is guaranteed to get processor time. + * Main.c also creates a task called "Check". This only executes every three + * seconds but has the highest priority so is guaranteed to get processor time. * Its main function is to check that all the other tasks are still operational. - * Each task (other than the "flash" tasks) maintains a unique count that is - * incremented each time the task successfully completes its function. Should - * any error occur within such a task the count is permanently halted. The + * Each task (other than the "flash" tasks) maintains a unique count that is + * incremented each time the task successfully completes its function. Should + * any error occur within such a task the count is permanently halted. The * check task inspects the count of each task to ensure it has changed since - * the last time the check task executed. If all the count variables have + * the last time the check task executed. If all the count variables have * changed all the tasks are still executing error free, and the check task - * toggles the onboard LED. Should any task contain an error at any time + * toggles the onboard LED. Should any task contain an error at any time * the LED toggle rate will change from 3 seconds to 500ms. * - * This file also includes the functionality implemented within the + * This file also includes the functionality implemented within the * standard demo application file integer.c. This is done to demonstrate the - * use of an idle hook. See the documentation within integer.c for the + * use of an idle hook. See the documentation within integer.c for the * rationale of the integer task functionality. * */ @@ -69,56 +68,56 @@ /*----------------------------------------------------------- - Definitions. ------------------------------------------------------------*/ + * Definitions. + * -----------------------------------------------------------*/ /* Priorities assigned to demo application tasks. */ -#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainDEATH_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainDEATH_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* LED that is toggled by the check task. The check task periodically checks -that all the other tasks are operating without error. If no errors are found -the LED is toggled with mainCHECK_PERIOD frequency. If an error is found -then the toggle rate increases to mainERROR_CHECK_PERIOD. */ -#define mainCHECK_TASK_LED ( 7 ) -#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) -#define mainERROR_CHECK_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) + * that all the other tasks are operating without error. If no errors are found + * the LED is toggled with mainCHECK_PERIOD frequency. If an error is found + * then the toggle rate increases to mainERROR_CHECK_PERIOD. */ +#define mainCHECK_TASK_LED ( 7 ) +#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainERROR_CHECK_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) /* The constants used in the idle task calculation. */ -#define intgCONST1 ( ( long ) 123 ) -#define intgCONST2 ( ( long ) 234567 ) -#define intgCONST3 ( ( long ) -3 ) -#define intgCONST4 ( ( long ) 7 ) -#define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 ) +#define intgCONST1 ( ( long ) 123 ) +#define intgCONST2 ( ( long ) 234567 ) +#define intgCONST3 ( ( long ) -3 ) +#define intgCONST4 ( ( long ) 7 ) +#define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 ) /* Baud rate used by the serial port tasks (ComTest tasks). -IMPORTANT: The function COM0_SetBaudRateValue() which is generated by the -Processor Expert is used to set the baud rate. As configured in the FreeRTOS -download this value must be one of the following: - -0 to configure for 38400 baud. -1 to configure for 19200 baud. -2 to configure for 9600 baud. -3 to configure for 4800 baud. */ -#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 2 ) + * IMPORTANT: The function COM0_SetBaudRateValue() which is generated by the + * Processor Expert is used to set the baud rate. As configured in the FreeRTOS + * download this value must be one of the following: + * + * 0 to configure for 38400 baud. + * 1 to configure for 19200 baud. + * 2 to configure for 9600 baud. + * 3 to configure for 4800 baud. */ +#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 2 ) /* LED used by the serial port tasks. This is toggled on each character Tx, -and mainCOM_TEST_LED + 1 is toggles on each character Rx. */ -#define mainCOM_TEST_LED ( 3 ) + * and mainCOM_TEST_LED + 1 is toggles on each character Rx. */ +#define mainCOM_TEST_LED ( 3 ) /*----------------------------------------------------------- - Local functions prototypes. ------------------------------------------------------------*/ + * Local functions prototypes. + * -----------------------------------------------------------*/ /* * The 'Check' task function. See the explanation at the top of the file. */ -static void vErrorChecks( void* pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * The idle task hook - in which the integer task is implemented. See the @@ -134,152 +133,151 @@ static long prvCheckOtherTasksAreStillRunning( void ); /*----------------------------------------------------------- - Local variables. ------------------------------------------------------------*/ + * Local variables. + * -----------------------------------------------------------*/ /* A few tasks are defined within this file. This flag is used to indicate -their status. If an error is detected in one of the locally defined tasks then -this flag is set to pdTRUE. */ + * their status. If an error is detected in one of the locally defined tasks then + * this flag is set to pdTRUE. */ portBASE_TYPE xLocalError = pdFALSE; /*-----------------------------------------------------------*/ -/* +/* * This is called from the main() function generated by the Processor Expert. */ void vMain( void ) { - /* Start some of the standard demo tasks. */ - vStartLEDFlashTasks( mainFLASH_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartDynamicPriorityTasks(); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - - /* Start the locally defined tasks. There is also a task implemented as - the idle hook. */ - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - - /* Must be the last demo created. */ - vCreateSuicidalTasks( mainDEATH_PRIORITY ); - - /* All the tasks have been created - start the scheduler. */ - vTaskStartScheduler(); - - /* Should not reach here! */ - for( ;; ); + /* Start some of the standard demo tasks. */ + vStartLEDFlashTasks( mainFLASH_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartDynamicPriorityTasks(); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + + /* Start the locally defined tasks. There is also a task implemented as + * the idle hook. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + + /* Must be the last demo created. */ + vCreateSuicidalTasks( mainDEATH_PRIORITY ); + + /* All the tasks have been created - start the scheduler. */ + vTaskStartScheduler(); + + /* Should not reach here! */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -TickType_t xDelayPeriod = mainCHECK_PERIOD; -TickType_t xLastWakeTime; - - /* Initialise xLastWakeTime to ensure the first call to vTaskDelayUntil() - functions correctly. */ - xLastWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Delay until it is time to execute again. The delay period is - shorter following an error. */ - vTaskDelayUntil( &xLastWakeTime, xDelayPeriod ); - - /* Check all the demo application tasks are executing without - error. If an error is found the delay period is shortened - this - has the effect of increasing the flash rate of the 'check' task - LED. */ - if( prvCheckOtherTasksAreStillRunning() == pdFAIL ) - { - /* An error has been detected in one of the tasks - flash faster. */ - xDelayPeriod = mainERROR_CHECK_PERIOD; - } - - /* Toggle the LED each cycle round. */ - vParTestToggleLED( mainCHECK_TASK_LED ); - } + TickType_t xDelayPeriod = mainCHECK_PERIOD; + TickType_t xLastWakeTime; + + /* Initialise xLastWakeTime to ensure the first call to vTaskDelayUntil() + * functions correctly. */ + xLastWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Delay until it is time to execute again. The delay period is + * shorter following an error. */ + vTaskDelayUntil( &xLastWakeTime, xDelayPeriod ); + + /* Check all the demo application tasks are executing without + * error. If an error is found the delay period is shortened - this + * has the effect of increasing the flash rate of the 'check' task + * LED. */ + if( prvCheckOtherTasksAreStillRunning() == pdFAIL ) + { + /* An error has been detected in one of the tasks - flash faster. */ + xDelayPeriod = mainERROR_CHECK_PERIOD; + } + + /* Toggle the LED each cycle round. */ + vParTestToggleLED( mainCHECK_TASK_LED ); + } } /*-----------------------------------------------------------*/ static long prvCheckOtherTasksAreStillRunning( void ) { -portBASE_TYPE xAllTasksPassed = pdPASS; - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - xAllTasksPassed = pdFAIL; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - xAllTasksPassed = pdFAIL; - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - xAllTasksPassed = pdFALSE; - } - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - xAllTasksPassed = pdFALSE; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - xAllTasksPassed = pdFALSE; - } + portBASE_TYPE xAllTasksPassed = pdPASS; + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + xAllTasksPassed = pdFAIL; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + xAllTasksPassed = pdFAIL; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + xAllTasksPassed = pdFALSE; + } + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + xAllTasksPassed = pdFALSE; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + xAllTasksPassed = pdFALSE; + } if( xIsCreateTaskStillRunning() != pdTRUE ) { - xAllTasksPassed = pdFALSE; + xAllTasksPassed = pdFALSE; + } + + /* Also check the status flag for the tasks defined within this function. */ + if( xLocalError != pdFALSE ) + { + xAllTasksPassed = pdFAIL; } - /* Also check the status flag for the tasks defined within this function. */ - if( xLocalError != pdFALSE ) - { - xAllTasksPassed = pdFAIL; - } - - return xAllTasksPassed; + return xAllTasksPassed; } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { /* This variable is effectively set to a constant so it is made volatile to -ensure the compiler does not just get rid of it. */ -volatile long lValue; - - /* Keep performing a calculation and checking the result against a constant. */ - - /* Perform the calculation. This will store partial value in - registers, resulting in a good test of the context switch mechanism. */ - lValue = intgCONST1; - lValue += intgCONST2; - lValue *= intgCONST3; - lValue /= intgCONST4; - - /* Did we perform the calculation correctly with no corruption? */ - if( lValue != intgEXPECTED_ANSWER ) - { - /* Error! */ - portENTER_CRITICAL(); - xLocalError = pdTRUE; - portEXIT_CRITICAL(); - } - - /* Yield in case cooperative scheduling is being used. */ - #if configUSE_PREEMPTION == 0 - { - taskYIELD(); - } - #endif -} -/*-----------------------------------------------------------*/ + * ensure the compiler does not just get rid of it. */ + volatile long lValue; + + /* Keep performing a calculation and checking the result against a constant. */ + /* Perform the calculation. This will store partial value in + * registers, resulting in a good test of the context switch mechanism. */ + lValue = intgCONST1; + lValue += intgCONST2; + lValue *= intgCONST3; + lValue /= intgCONST4; + /* Did we perform the calculation correctly with no corruption? */ + if( lValue != intgEXPECTED_ANSWER ) + { + /* Error! */ + portENTER_CRITICAL(); + xLocalError = pdTRUE; + portEXIT_CRITICAL(); + } + /* Yield in case cooperative scheduling is being used. */ + #if configUSE_PREEMPTION == 0 + { + taskYIELD(); + } + #endif +} +/*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/HCS12_CodeWarrior_banked/serial/serial.c b/FreeRTOS/Demo/HCS12_CodeWarrior_banked/serial/serial.c index 2cea3b358fe..9e9848e7e38 100644 --- a/FreeRTOS/Demo/HCS12_CodeWarrior_banked/serial/serial.c +++ b/FreeRTOS/Demo/HCS12_CodeWarrior_banked/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/HCS12_CodeWarrior_small/FreeRTOSConfig.h b/FreeRTOS/Demo/HCS12_CodeWarrior_small/FreeRTOSConfig.h index 0f2b071202f..3215d6052f4 100644 --- a/FreeRTOS/Demo/HCS12_CodeWarrior_small/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/HCS12_CodeWarrior_small/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/HCS12_CodeWarrior_small/ParTest/ParTest.c b/FreeRTOS/Demo/HCS12_CodeWarrior_small/ParTest/ParTest.c index f0425f579f3..9603c632ce9 100644 --- a/FreeRTOS/Demo/HCS12_CodeWarrior_small/ParTest/ParTest.c +++ b/FreeRTOS/Demo/HCS12_CodeWarrior_small/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/HCS12_CodeWarrior_small/main.c b/FreeRTOS/Demo/HCS12_CodeWarrior_small/main.c index 8ecf98ae829..e3eb7cc026d 100644 --- a/FreeRTOS/Demo/HCS12_CodeWarrior_small/main.c +++ b/FreeRTOS/Demo/HCS12_CodeWarrior_small/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -28,32 +28,32 @@ /* * * vMain() is effectively the demo application entry point. It is called by - * the main() function generated by the Processor Expert application. + * the main() function generated by the Processor Expert application. * * vMain() creates all the demo application tasks, then starts the scheduler. * The WEB documentation provides more details of the demo application tasks. * - * Main.c also creates a task called "Check". This only executes every three - * seconds but has the highest priority so is guaranteed to get processor time. + * Main.c also creates a task called "Check". This only executes every three + * seconds but has the highest priority so is guaranteed to get processor time. * Its main function is to check that all the other tasks are still operational. - * Each task (other than the "flash" tasks) maintains a unique count that is - * incremented each time the task successfully completes its function. Should - * any error occur within such a task the count is permanently halted. The + * Each task (other than the "flash" tasks) maintains a unique count that is + * incremented each time the task successfully completes its function. Should + * any error occur within such a task the count is permanently halted. The * check task inspects the count of each task to ensure it has changed since - * the last time the check task executed. If all the count variables have + * the last time the check task executed. If all the count variables have * changed all the tasks are still executing error free, and the check task - * toggles the onboard LED. Should any task contain an error at any time + * toggles the onboard LED. Should any task contain an error at any time * the LED toggle rate will change from 3 seconds to 500ms. * - * This file also includes the functionality normally implemented within the - * standard demo application file integer.c. Due to the limited memory + * This file also includes the functionality normally implemented within the + * standard demo application file integer.c. Due to the limited memory * available on the microcontroller the functionality has been included within * the idle task hook [vApplicationIdleHook()] - instead of within the usual - * separate task. See the documentation within integer.c for the rationale + * separate task. See the documentation within integer.c for the rationale * of the integer task functionality. * * - * + * * The demo applications included with other FreeRTOS ports make use of the * standard ComTest tasks. These use a loopback connector to transmit and * receive RS232 characters between two tasks. The test is important for two @@ -66,21 +66,21 @@ * * The demo board used to develop this port does not include an RS232 interface * so the ComTest tasks could not easily be included. Instead these two tests - * are created using a 'Button Push' task. - * + * are created using a 'Button Push' task. + * * The 'Button Push' task blocks on a queue, waiting for data to arrive. A * simple interrupt routine connected to the PP0 input on the demo board places - * data in the queue each time the PP0 button is pushed (this button is built - * onto the demo board). As the 'Button Push' task is created with a + * data in the queue each time the PP0 button is pushed (this button is built + * onto the demo board). As the 'Button Push' task is created with a * relatively high priority it will unblock and want to execute as soon as data * arrives in the queue - resulting in a context switch within the PP0 input * ISR. If the data retrieved from the queue is that expected the 'Button Push' * task toggles LED 5. Therefore correct operation is indicated by the LED * toggling each time the PP0 button is pressed. * - * This test is not as satisfactory as the ComTest method - but the simple + * This test is not as satisfactory as the ComTest method - but the simple * nature of the port makes is just about adequate. - * + * */ /* Kernel includes. */ @@ -98,50 +98,50 @@ #include "ButtonInterrupt.h" /*----------------------------------------------------------- - Definitions. ------------------------------------------------------------*/ + * Definitions. + * -----------------------------------------------------------*/ /* Priorities assigned to demo application tasks. */ -#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainBUTTON_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainBUTTON_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* LED that is toggled by the check task. The check task periodically checks -that all the other tasks are operating without error. If no errors are found -the LED is toggled with mainCHECK_PERIOD frequency. If an error is found -then the toggle rate increases to mainERROR_CHECK_PERIOD. */ -#define mainCHECK_TASK_LED ( 7 ) -#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) -#define mainERROR_CHECK_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) + * that all the other tasks are operating without error. If no errors are found + * the LED is toggled with mainCHECK_PERIOD frequency. If an error is found + * then the toggle rate increases to mainERROR_CHECK_PERIOD. */ +#define mainCHECK_TASK_LED ( 7 ) +#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainERROR_CHECK_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) /* LED that is toggled by the button push interrupt. */ -#define mainBUTTON_PUSH_LED ( 5 ) +#define mainBUTTON_PUSH_LED ( 5 ) /* The constants used in the idle task calculation. */ -#define intgCONST1 ( ( long ) 123 ) -#define intgCONST2 ( ( long ) 234567 ) -#define intgCONST3 ( ( long ) -3 ) -#define intgCONST4 ( ( long ) 7 ) -#define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 ) +#define intgCONST1 ( ( long ) 123 ) +#define intgCONST2 ( ( long ) 234567 ) +#define intgCONST3 ( ( long ) -3 ) +#define intgCONST4 ( ( long ) 7 ) +#define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 ) /* The length of the queue between is button push ISR and the Button Push task -is greater than 1 to account for switch bounces generating multiple inputs. */ -#define mainBUTTON_QUEUE_SIZE 6 + * is greater than 1 to account for switch bounces generating multiple inputs. */ +#define mainBUTTON_QUEUE_SIZE 6 /*----------------------------------------------------------- - Local functions prototypes. ------------------------------------------------------------*/ + * Local functions prototypes. + * -----------------------------------------------------------*/ /* * The 'Check' task function. See the explanation at the top of the file. */ -static void vErrorChecks( void* pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * The 'Button Push' task. See the explanation at the top of the file. */ -static void vButtonTask( void *pvParameters ); +static void vButtonTask( void * pvParameters ); /* * The idle task hook - in which the integer task is implemented. See the @@ -157,207 +157,209 @@ static long prvCheckOtherTasksAreStillRunning( void ); /*----------------------------------------------------------- - Local variables. ------------------------------------------------------------*/ + * Local variables. + * -----------------------------------------------------------*/ /* A few tasks are defined within this file. This flag is used to indicate -their status. If an error is detected in one of the locally defined tasks then -this flag is set to pdTRUE. */ + * their status. If an error is detected in one of the locally defined tasks then + * this flag is set to pdTRUE. */ portBASE_TYPE xLocalError = pdFALSE; -/* The queue used to send data from the button push ISR to the Button Push -task. */ +/* The queue used to send data from the button push ISR to the Button Push + * task. */ static QueueHandle_t xButtonQueue; /*-----------------------------------------------------------*/ -/* +/* * This is called from the main() function generated by the Processor Expert. */ void vMain( void ) { - /* Start some of the standard demo tasks. */ - vStartLEDFlashTasks( mainFLASH_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartDynamicPriorityTasks(); - - /* Start the locally defined tasks. There is also a task implemented as - the idle hook. */ - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - xTaskCreate( vButtonTask, "Button", configMINIMAL_STACK_SIZE, NULL, mainBUTTON_TASK_PRIORITY, NULL ); - - /* All the tasks have been created - start the scheduler. */ - vTaskStartScheduler(); - - /* Should not reach here! */ - for( ;; ); + /* Start some of the standard demo tasks. */ + vStartLEDFlashTasks( mainFLASH_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartDynamicPriorityTasks(); + + /* Start the locally defined tasks. There is also a task implemented as + * the idle hook. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + xTaskCreate( vButtonTask, "Button", configMINIMAL_STACK_SIZE, NULL, mainBUTTON_TASK_PRIORITY, NULL ); + + /* All the tasks have been created - start the scheduler. */ + vTaskStartScheduler(); + + /* Should not reach here! */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -TickType_t xDelayPeriod = mainCHECK_PERIOD; -TickType_t xLastWakeTime; - - /* Initialise xLastWakeTime to ensure the first call to vTaskDelayUntil() - functions correctly. */ - xLastWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Delay until it is time to execute again. The delay period is - shorter following an error. */ - vTaskDelayUntil( &xLastWakeTime, xDelayPeriod ); - - /* Check all the demo application tasks are executing without - error. If an error is found the delay period is shortened - this - has the effect of increasing the flash rate of the 'check' task - LED. */ - if( prvCheckOtherTasksAreStillRunning() == pdFAIL ) - { - /* An error has been detected in one of the tasks - flash faster. */ - xDelayPeriod = mainERROR_CHECK_PERIOD; - } - - /* Toggle the LED each cycle round. */ - vParTestToggleLED( mainCHECK_TASK_LED ); - } + TickType_t xDelayPeriod = mainCHECK_PERIOD; + TickType_t xLastWakeTime; + + /* Initialise xLastWakeTime to ensure the first call to vTaskDelayUntil() + * functions correctly. */ + xLastWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Delay until it is time to execute again. The delay period is + * shorter following an error. */ + vTaskDelayUntil( &xLastWakeTime, xDelayPeriod ); + + /* Check all the demo application tasks are executing without + * error. If an error is found the delay period is shortened - this + * has the effect of increasing the flash rate of the 'check' task + * LED. */ + if( prvCheckOtherTasksAreStillRunning() == pdFAIL ) + { + /* An error has been detected in one of the tasks - flash faster. */ + xDelayPeriod = mainERROR_CHECK_PERIOD; + } + + /* Toggle the LED each cycle round. */ + vParTestToggleLED( mainCHECK_TASK_LED ); + } } /*-----------------------------------------------------------*/ static long prvCheckOtherTasksAreStillRunning( void ) { -portBASE_TYPE xAllTasksPassed = pdPASS; + portBASE_TYPE xAllTasksPassed = pdPASS; - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - xAllTasksPassed = pdFAIL; - } + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + xAllTasksPassed = pdFAIL; + } - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - xAllTasksPassed = pdFAIL; - } + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + xAllTasksPassed = pdFAIL; + } - /* Also check the status flag for the tasks defined within this function. */ - if( xLocalError != pdFALSE ) - { - xAllTasksPassed = pdFAIL; - } + /* Also check the status flag for the tasks defined within this function. */ + if( xLocalError != pdFALSE ) + { + xAllTasksPassed = pdFAIL; + } - return xAllTasksPassed; + return xAllTasksPassed; } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { /* This variable is effectively set to a constant so it is made volatile to -ensure the compiler does not just get rid of it. */ -volatile long lValue; - - /* Keep performing a calculation and checking the result against a constant. */ - for( ;; ) - { - /* Perform the calculation. This will store partial value in - registers, resulting in a good test of the context switch mechanism. */ - lValue = intgCONST1; - lValue += intgCONST2; - lValue *= intgCONST3; - lValue /= intgCONST4; - - /* Did we perform the calculation correctly with no corruption? */ - if( lValue != intgEXPECTED_ANSWER ) - { - /* Error! */ - portENTER_CRITICAL(); - xLocalError = pdTRUE; - portEXIT_CRITICAL(); - } - - /* Yield in case cooperative scheduling is being used. */ - #if configUSE_PREEMPTION == 0 - { - taskYIELD(); - } - #endif - } + * ensure the compiler does not just get rid of it. */ + volatile long lValue; + + /* Keep performing a calculation and checking the result against a constant. */ + for( ; ; ) + { + /* Perform the calculation. This will store partial value in + * registers, resulting in a good test of the context switch mechanism. */ + lValue = intgCONST1; + lValue += intgCONST2; + lValue *= intgCONST3; + lValue /= intgCONST4; + + /* Did we perform the calculation correctly with no corruption? */ + if( lValue != intgEXPECTED_ANSWER ) + { + /* Error! */ + portENTER_CRITICAL(); + xLocalError = pdTRUE; + portEXIT_CRITICAL(); + } + + /* Yield in case cooperative scheduling is being used. */ + #if configUSE_PREEMPTION == 0 + { + taskYIELD(); + } + #endif + } } /*-----------------------------------------------------------*/ -static void vButtonTask( void *pvParameters ) +static void vButtonTask( void * pvParameters ) { -unsigned portBASE_TYPE uxExpected = 1, uxReceived; - - /* Create the queue used by the producer and consumer. */ - xButtonQueue = xQueueCreate( mainBUTTON_QUEUE_SIZE, ( unsigned portBASE_TYPE ) sizeof( unsigned portBASE_TYPE ) ); - - if( xButtonQueue ) - { - /* Now the queue is created it is safe to enable the button interrupt. */ - ButtonInterrupt_Enable(); - - for( ;; ) - { - /* Simply wait for data to arrive from the button push interrupt. */ - if( xQueueReceive( xButtonQueue, &uxReceived, portMAX_DELAY ) == pdPASS ) - { - /* Was the data we received that expected? */ - if( uxReceived != uxExpected ) - { - /* Error! */ - portENTER_CRITICAL(); - xLocalError = pdTRUE; - portEXIT_CRITICAL(); - } - else - { - /* Toggle the LED for every successful push. */ - vParTestToggleLED( mainBUTTON_PUSH_LED ); - } - - uxExpected++; - } - } - } - - /* Will only get here if the queue could not be created. */ - for( ;; ); + unsigned portBASE_TYPE uxExpected = 1, uxReceived; + + /* Create the queue used by the producer and consumer. */ + xButtonQueue = xQueueCreate( mainBUTTON_QUEUE_SIZE, ( unsigned portBASE_TYPE ) sizeof( unsigned portBASE_TYPE ) ); + + if( xButtonQueue ) + { + /* Now the queue is created it is safe to enable the button interrupt. */ + ButtonInterrupt_Enable(); + + for( ; ; ) + { + /* Simply wait for data to arrive from the button push interrupt. */ + if( xQueueReceive( xButtonQueue, &uxReceived, portMAX_DELAY ) == pdPASS ) + { + /* Was the data we received that expected? */ + if( uxReceived != uxExpected ) + { + /* Error! */ + portENTER_CRITICAL(); + xLocalError = pdTRUE; + portEXIT_CRITICAL(); + } + else + { + /* Toggle the LED for every successful push. */ + vParTestToggleLED( mainBUTTON_PUSH_LED ); + } + + uxExpected++; + } + } + } + + /* Will only get here if the queue could not be created. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ #pragma CODE_SEG __NEAR_SEG NON_BANKED - /* Button push ISR. */ - void interrupt vButtonPush( void ) - { - static unsigned portBASE_TYPE uxValToSend = 0; - static unsigned long xHigherPriorityTaskWoken; - - xHigherPriorityTaskWoken = pdFALSE; - - /* Send an incrementing value to the button push task each run. */ - uxValToSend++; - - /* Clear the interrupt flag. */ - PIFP = 1; - - /* Send the incremented value down the queue. The button push task is - blocked waiting for the data. As the button push task is high priority - it will wake and a context switch should be performed before leaving - the ISR. */ - xQueueSendFromISR( xButtonQueue, &uxValToSend, &xHigherPriorityTaskWoken ); - - if( xHigherPriorityTaskWoken ) - { - /* NOTE: This macro can only be used if there are no local - variables defined. This function uses a static variable so it's - use is permitted. If the variable were not static portYIELD() - would have to be used in it's place. */ - portTASK_SWITCH_FROM_ISR(); - } - } +/* Button push ISR. */ +void interrupt vButtonPush( void ) +{ + static unsigned portBASE_TYPE uxValToSend = 0; + static unsigned long xHigherPriorityTaskWoken; + + xHigherPriorityTaskWoken = pdFALSE; + + /* Send an incrementing value to the button push task each run. */ + uxValToSend++; + + /* Clear the interrupt flag. */ + PIFP = 1; + + /* Send the incremented value down the queue. The button push task is + * blocked waiting for the data. As the button push task is high priority + * it will wake and a context switch should be performed before leaving + * the ISR. */ + xQueueSendFromISR( xButtonQueue, &uxValToSend, &xHigherPriorityTaskWoken ); + + if( xHigherPriorityTaskWoken ) + { + /* NOTE: This macro can only be used if there are no local + * variables defined. This function uses a static variable so it's + * use is permitted. If the variable were not static portYIELD() + * would have to be used in it's place. */ + portTASK_SWITCH_FROM_ISR(); + } +} #pragma CODE_SEG DEFAULT - - diff --git a/FreeRTOS/Demo/HCS12_CodeWarrior_small/serial/serial.c b/FreeRTOS/Demo/HCS12_CodeWarrior_small/serial/serial.c index 1c7aed7a505..67ddf56c02e 100644 --- a/FreeRTOS/Demo/HCS12_CodeWarrior_small/serial/serial.c +++ b/FreeRTOS/Demo/HCS12_CodeWarrior_small/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/HCS12_GCC_banked/FreeRTOSConfig.h b/FreeRTOS/Demo/HCS12_GCC_banked/FreeRTOSConfig.h index f50452026d9..061bb600f85 100644 --- a/FreeRTOS/Demo/HCS12_GCC_banked/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/HCS12_GCC_banked/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/HCS12_GCC_banked/ParTest.c b/FreeRTOS/Demo/HCS12_GCC_banked/ParTest.c index 72ef82ca437..02e2c737099 100644 --- a/FreeRTOS/Demo/HCS12_GCC_banked/ParTest.c +++ b/FreeRTOS/Demo/HCS12_GCC_banked/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/HCS12_GCC_banked/main.c b/FreeRTOS/Demo/HCS12_GCC_banked/main.c index 382cbd5f43c..3f14c12570f 100644 --- a/FreeRTOS/Demo/HCS12_GCC_banked/main.c +++ b/FreeRTOS/Demo/HCS12_GCC_banked/main.c @@ -1,7 +1,6 @@ - /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -31,21 +30,21 @@ * main() creates all the demo application tasks, then starts the scheduler. * The WEB documentation provides more details of the demo application tasks. * - * main.c also creates a task called "Check". This only executes every three - * seconds but has the highest priority so is guaranteed to get processor time. + * main.c also creates a task called "Check". This only executes every three + * seconds but has the highest priority so is guaranteed to get processor time. * Its main function is to check that all the other tasks are still operational. - * Each task (other than the "flash" tasks) maintains a unique count that is - * incremented each time the task successfully completes its function. Should - * any error occur within such a task the count is permanently halted. The + * Each task (other than the "flash" tasks) maintains a unique count that is + * incremented each time the task successfully completes its function. Should + * any error occur within such a task the count is permanently halted. The * check task inspects the count of each task to ensure it has changed since - * the last time the check task executed. If all the count variables have + * the last time the check task executed. If all the count variables have * changed all the tasks are still executing error free, and the check task - * toggles the onboard LED. Should any task contain an error at any time + * toggles the onboard LED. Should any task contain an error at any time * the LED toggle rate will change from 3 seconds to 500ms. * - * This file also includes the functionality implemented within the + * This file also includes the functionality implemented within the * standard demo application file integer.c. This is done to demonstrate the - * use of an idle hook. See the documentation within integer.c for the + * use of an idle hook. See the documentation within integer.c for the * rationale of the integer task functionality. * */ @@ -72,56 +71,56 @@ portBASE_TYPE xArePollingQueuesStillRunning( void ); /*----------------------------------------------------------- - Definitions. ------------------------------------------------------------*/ + * Definitions. + * -----------------------------------------------------------*/ /* Priorities assigned to demo application tasks. */ -#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainDEATH_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainDEATH_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* LED that is toggled by the check task. The check task periodically checks -that all the other tasks are operating without error. If no errors are found -the LED is toggled with mainCHECK_PERIOD frequency. If an error is found -then the toggle rate increases to mainERROR_CHECK_PERIOD. */ -#define mainCHECK_TASK_LED ( 7 ) -#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) -#define mainERROR_CHECK_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) + * that all the other tasks are operating without error. If no errors are found + * the LED is toggled with mainCHECK_PERIOD frequency. If an error is found + * then the toggle rate increases to mainERROR_CHECK_PERIOD. */ +#define mainCHECK_TASK_LED ( 7 ) +#define mainCHECK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainERROR_CHECK_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) /* The constants used in the idle task calculation. */ -#define intgCONST1 ( ( long ) 123 ) -#define intgCONST2 ( ( long ) 234567 ) -#define intgCONST3 ( ( long ) -3 ) -#define intgCONST4 ( ( long ) 7 ) -#define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 ) +#define intgCONST1 ( ( long ) 123 ) +#define intgCONST2 ( ( long ) 234567 ) +#define intgCONST3 ( ( long ) -3 ) +#define intgCONST4 ( ( long ) 7 ) +#define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 ) /* Baud rate used by the serial port tasks (ComTest tasks). -IMPORTANT: The function COM0_SetBaudRateValue() which is generated by the -Processor Expert is used to set the baud rate. As configured in the FreeRTOS -download this value must be one of the following: - -0 to configure for 38400 baud. -1 to configure for 19200 baud. -2 to configure for 9600 baud. -3 to configure for 4800 baud. */ -#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 2 ) + * IMPORTANT: The function COM0_SetBaudRateValue() which is generated by the + * Processor Expert is used to set the baud rate. As configured in the FreeRTOS + * download this value must be one of the following: + * + * 0 to configure for 38400 baud. + * 1 to configure for 19200 baud. + * 2 to configure for 9600 baud. + * 3 to configure for 4800 baud. */ +#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 2 ) /* LED used by the serial port tasks. This is toggled on each character Tx, -and mainCOM_TEST_LED + 1 is toggles on each character Rx. */ -#define mainCOM_TEST_LED ( 3 ) + * and mainCOM_TEST_LED + 1 is toggles on each character Rx. */ +#define mainCOM_TEST_LED ( 3 ) /*----------------------------------------------------------- - Local functions prototypes. ------------------------------------------------------------*/ + * Local functions prototypes. + * -----------------------------------------------------------*/ /* * The 'Check' task function. See the explanation at the top of the file. */ -static void ATTR_BANK1 vErrorChecks( void* pvParameters ); +static void ATTR_BANK1 vErrorChecks( void * pvParameters ); /* * The idle task hook - in which the integer task is implemented. See the @@ -137,149 +136,151 @@ static long ATTR_BANK0 prvCheckOtherTasksAreStillRunning( void ); /*----------------------------------------------------------- - Local variables. ------------------------------------------------------------*/ + * Local variables. + * -----------------------------------------------------------*/ /* A few tasks are defined within this file. This flag is used to indicate -their status. If an error is detected in one of the locally defined tasks then -this flag is set to pdTRUE. */ + * their status. If an error is detected in one of the locally defined tasks then + * this flag is set to pdTRUE. */ portBASE_TYPE xLocalError = pdFALSE; /*-----------------------------------------------------------*/ /* This is called from startup. */ -int ATTR_BANK0 main ( void ) +int ATTR_BANK0 main( void ) { - /* Start some of the standard demo tasks. */ - vStartLEDFlashTasks( mainFLASH_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartDynamicPriorityTasks(); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - - /* Start the locally defined tasks. There is also a task implemented as - the idle hook. */ - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - - /* Must be the last demo created. */ - vCreateSuicidalTasks( mainDEATH_PRIORITY ); - - /* All the tasks have been created - start the scheduler. */ - vTaskStartScheduler(); - - /* Should not reach here! */ - for( ;; ); - return 0; + /* Start some of the standard demo tasks. */ + vStartLEDFlashTasks( mainFLASH_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartDynamicPriorityTasks(); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + + /* Start the locally defined tasks. There is also a task implemented as + * the idle hook. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + + /* Must be the last demo created. */ + vCreateSuicidalTasks( mainDEATH_PRIORITY ); + + /* All the tasks have been created - start the scheduler. */ + vTaskStartScheduler(); + + /* Should not reach here! */ + for( ; ; ) + { + } + + return 0; } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -TickType_t xDelayPeriod = mainCHECK_PERIOD; -TickType_t xLastWakeTime; - - /* Initialise xLastWakeTime to ensure the first call to vTaskDelayUntil() - functions correctly. */ - xLastWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Delay until it is time to execute again. The delay period is - shorter following an error. */ - vTaskDelayUntil( &xLastWakeTime, xDelayPeriod ); - - /* Check all the demo application tasks are executing without - error. If an error is found the delay period is shortened - this - has the effect of increasing the flash rate of the 'check' task - LED. */ - if( prvCheckOtherTasksAreStillRunning() == pdFAIL ) - { - /* An error has been detected in one of the tasks - flash faster. */ - xDelayPeriod = mainERROR_CHECK_PERIOD; - } - - /* Toggle the LED each cycle round. */ - vParTestToggleLED( mainCHECK_TASK_LED ); - } + TickType_t xDelayPeriod = mainCHECK_PERIOD; + TickType_t xLastWakeTime; + + /* Initialise xLastWakeTime to ensure the first call to vTaskDelayUntil() + * functions correctly. */ + xLastWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Delay until it is time to execute again. The delay period is + * shorter following an error. */ + vTaskDelayUntil( &xLastWakeTime, xDelayPeriod ); + + /* Check all the demo application tasks are executing without + * error. If an error is found the delay period is shortened - this + * has the effect of increasing the flash rate of the 'check' task + * LED. */ + if( prvCheckOtherTasksAreStillRunning() == pdFAIL ) + { + /* An error has been detected in one of the tasks - flash faster. */ + xDelayPeriod = mainERROR_CHECK_PERIOD; + } + + /* Toggle the LED each cycle round. */ + vParTestToggleLED( mainCHECK_TASK_LED ); + } } /*-----------------------------------------------------------*/ static long prvCheckOtherTasksAreStillRunning( void ) { -portBASE_TYPE xAllTasksPassed = pdPASS; - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - xAllTasksPassed = pdFAIL; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - xAllTasksPassed = pdFAIL; - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - xAllTasksPassed = pdFALSE; - } - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - xAllTasksPassed = pdFALSE; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - xAllTasksPassed = pdFALSE; - } + portBASE_TYPE xAllTasksPassed = pdPASS; + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + xAllTasksPassed = pdFAIL; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + xAllTasksPassed = pdFAIL; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + xAllTasksPassed = pdFALSE; + } + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + xAllTasksPassed = pdFALSE; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + xAllTasksPassed = pdFALSE; + } if( xIsCreateTaskStillRunning() != pdTRUE ) { - xAllTasksPassed = pdFALSE; + xAllTasksPassed = pdFALSE; + } + + /* Also check the status flag for the tasks defined within this function. */ + if( xLocalError != pdFALSE ) + { + xAllTasksPassed = pdFAIL; } - /* Also check the status flag for the tasks defined within this function. */ - if( xLocalError != pdFALSE ) - { - xAllTasksPassed = pdFAIL; - } - - return xAllTasksPassed; + return xAllTasksPassed; } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { /* This variable is effectively set to a constant so it is made volatile to -ensure the compiler does not just get rid of it. */ -volatile long lValue; - - /* Keep performing a calculation and checking the result against a constant. */ - - /* Perform the calculation. This will store partial value in - registers, resulting in a good test of the context switch mechanism. */ - lValue = intgCONST1; - lValue += intgCONST2; - lValue *= intgCONST3; - lValue /= intgCONST4; - - /* Did we perform the calculation correctly with no corruption? */ - if( lValue != intgEXPECTED_ANSWER ) - { - /* Error! */ - portENTER_CRITICAL(); - xLocalError = pdTRUE; - portEXIT_CRITICAL(); - } - - /* Yield in case cooperative scheduling is being used. */ - #if configUSE_PREEMPTION == 0 - { - taskYIELD(); - } - #endif + * ensure the compiler does not just get rid of it. */ + volatile long lValue; + + /* Keep performing a calculation and checking the result against a constant. */ + + /* Perform the calculation. This will store partial value in + * registers, resulting in a good test of the context switch mechanism. */ + lValue = intgCONST1; + lValue += intgCONST2; + lValue *= intgCONST3; + lValue /= intgCONST4; + + /* Did we perform the calculation correctly with no corruption? */ + if( lValue != intgEXPECTED_ANSWER ) + { + /* Error! */ + portENTER_CRITICAL(); + xLocalError = pdTRUE; + portEXIT_CRITICAL(); + } + + /* Yield in case cooperative scheduling is being used. */ + #if configUSE_PREEMPTION == 0 + { + taskYIELD(); + } + #endif } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/HCS12_GCC_banked/startup.c b/FreeRTOS/Demo/HCS12_GCC_banked/startup.c index d96b58d440d..909fc2eb169 100644 --- a/FreeRTOS/Demo/HCS12_GCC_banked/startup.c +++ b/FreeRTOS/Demo/HCS12_GCC_banked/startup.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Blinky_Demo/main_blinky.c index 4c3842b79f5..958b4dade42 100644 --- a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/FreeRTOSConfig.h b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/FreeRTOSConfig.h index 56e60d4abff..4e620e2a520 100644 --- a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Full_Demo/IntQueueTimer.c index a4f5b55d1b8..91247b30cd8 100644 --- a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Full_Demo/IntQueueTimer.h index 4fb214c4093..dc540323649 100644 --- a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Full_Demo/main_full.c b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Full_Demo/main_full.c index 5b23a44a2c5..100569b1408 100644 --- a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Support_Files/freestanding_functions.c b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Support_Files/freestanding_functions.c index bfbe714316d..14de83f181f 100644 --- a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Support_Files/freestanding_functions.c +++ b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Support_Files/freestanding_functions.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Support_Files/math.h b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Support_Files/math.h index ecbf52c5ad7..532b5b56769 100644 --- a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Support_Files/math.h +++ b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Support_Files/math.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Support_Files/stdint.h b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Support_Files/stdint.h index c5b51b3931e..95547d93e98 100644 --- a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Support_Files/stdint.h +++ b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Support_Files/stdint.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/main.c b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/main.c index 28bcd55833f..cff3892be7f 100644 --- a/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/main.c +++ b/FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -62,12 +62,12 @@ #include "galileo_support.h" /* Set to 1 to sit in a loop on start up, allowing a debugger to connect to the -application before main() executes. */ -#define mainWAIT_FOR_DEBUG_CONNECTION 0 + * application before main() executes. */ +#define mainWAIT_FOR_DEBUG_CONNECTION 0 /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 /*-----------------------------------------------------------*/ @@ -75,10 +75,10 @@ or 0 to run the more comprehensive test and demo application. */ * 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. */ -#if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - extern void main_blinky( void ); +#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + extern void main_blinky( void ); #else - extern void main_full( void ); + extern void main_full( void ); #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */ /* Prototypes for functions called from asm start up code. */ @@ -91,7 +91,8 @@ void CRT_Init( void ); */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /* @@ -114,290 +115,299 @@ static void prvLoopToWaitForDebugConnection( void ); * displays an assert message, and the second clears the assert message when the * function called by the configASSERT() macro is exited. */ -static void prvDisplayAssertion( const char * pcFile, unsigned long ulLine ); +static void prvDisplayAssertion( const char * pcFile, + unsigned long ulLine ); static void prvClearAssertionLine( void ); /*-----------------------------------------------------------*/ /* See http://www.FreeRTOS.org/RTOS_Intel_Quark_Galileo_GCC.html for usage -instructions. */ + * instructions. */ int main( void ) { - /* Optionally wait for a debugger to connect. */ - prvLoopToWaitForDebugConnection(); - - /* Init the UART, GPIO, etc. */ - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - { - g_printf_rcc( 3, 2, DEFAULT_SCREEN_COLOR, "Running main_blinky()." ); - main_blinky(); - } - #else - { - g_printf_rcc( 3, 2, DEFAULT_SCREEN_COLOR, "Running main_full()." ); - main_full(); - } - #endif - - return 0; + /* Optionally wait for a debugger to connect. */ + prvLoopToWaitForDebugConnection(); + + /* Init the UART, GPIO, etc. */ + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + { + g_printf_rcc( 3, 2, DEFAULT_SCREEN_COLOR, "Running main_blinky()." ); + main_blinky(); + } + #else + { + g_printf_rcc( 3, 2, DEFAULT_SCREEN_COLOR, "Running main_full()." ); + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. - - Force an assert. */ - configASSERT( xTaskGetTickCount() == 0 ); - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. + * + * Force an assert. */ + configASSERT( xTaskGetTickCount() == 0 ); + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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. - - Increase the size of the stack allocated to the offending task. - - Force an assert. */ - configASSERT( pxTask == NULL ); - taskDISABLE_INTERRUPTS(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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. + * + * Increase the size of the stack allocated to the offending task. + * + * Force an assert. */ + configASSERT( pxTask == NULL ); + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - volatile unsigned long xFreeHeapSpace; - - /* This is just a trivial example of an idle hook. It is called on each - cycle of the idle task. It must *NOT* attempt to block. In this case the - idle task just queries the amount of FreeRTOS heap that remains. See the - memory management section on the http://www.FreeRTOS.org web site for memory - management options. If there is a lot of heap memory free then the - configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up - RAM. */ - xFreeHeapSpace = xPortGetFreeHeapSize(); - - /* Remove compiler warning about xFreeHeapSpace being set but never used. */ - ( void ) xFreeHeapSpace; + volatile unsigned long xFreeHeapSpace; + + /* This is just a trivial example of an idle hook. It is called on each + * cycle of the idle task. It must *NOT* attempt to block. In this case the + * idle task just queries the amount of FreeRTOS heap that remains. See the + * memory management section on the http://www.FreeRTOS.org web site for memory + * management options. If there is a lot of heap memory free then the + * configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up + * RAM. */ + xFreeHeapSpace = xPortGetFreeHeapSize(); + + /* Remove compiler warning about xFreeHeapSpace being set but never used. */ + ( void ) xFreeHeapSpace; } /*-----------------------------------------------------------*/ -static void prvDisplayAssertion( const char * pcFile, unsigned long ulLine ) +static void prvDisplayAssertion( const char * pcFile, + unsigned long ulLine ) { -extern void vMilliSecondDelay( uint32_t DelayTime ); -const uint32_t ul500ms = 500UL; - - /* Display assertion file and line. Don't use the gated g_printf just in - the assert was triggered while the gating semaphore was taken. Always print - on line 23. */ - UngatedMoveToScreenPosition( 23, 2 ); - printf( ANSI_COLOR_RED ); - printf( "ASSERT: File = %s, Line = %u\n\r", pcFile, ulLine ); - printf( ANSI_COLOR_RESET ); - printf( ANSI_SHOW_CURSOR ); - vMilliSecondDelay( ul500ms ); + extern void vMilliSecondDelay( uint32_t DelayTime ); + const uint32_t ul500ms = 500UL; + + /* Display assertion file and line. Don't use the gated g_printf just in + * the assert was triggered while the gating semaphore was taken. Always print + * on line 23. */ + UngatedMoveToScreenPosition( 23, 2 ); + printf( ANSI_COLOR_RED ); + printf( "ASSERT: File = %s, Line = %u\n\r", pcFile, ulLine ); + printf( ANSI_COLOR_RESET ); + printf( ANSI_SHOW_CURSOR ); + vMilliSecondDelay( ul500ms ); } /*-----------------------------------------------------------*/ static void prvClearAssertionLine( void ) { - UngatedMoveToScreenPosition( 23, 1 ); - printf( ANSI_COLOR_RESET ); - printf( ANSI_CLEAR_LINE ); - printf( ANSI_HIDE_CURSOR ); + UngatedMoveToScreenPosition( 23, 1 ); + printf( ANSI_COLOR_RESET ); + printf( ANSI_CLEAR_LINE ); + printf( ANSI_HIDE_CURSOR ); } /*-----------------------------------------------------------*/ -void vAssertCalled( const char * pcFile, unsigned long ulLine ) +void vAssertCalled( const char * pcFile, + unsigned long ulLine ) { -volatile uint32_t ul = 0; - - ( void ) pcFile; - ( void ) ulLine; - - taskENTER_CRITICAL(); - { - /* Set ul to a non-zero value or press a key to step out of this - function in order to inspect the location of the assert(). */ - - /* Clear any pending key presses. */ - while( ucGalileoGetchar() != 0 ) - { - /* Nothing to do here - the key press is just discarded. */ - } - - do - { - prvDisplayAssertion(pcFile, ulLine); - } while ( ( ul == pdFALSE ) && ( ucGalileoGetchar() == 0 ) ); - - prvClearAssertionLine(); - } - taskEXIT_CRITICAL(); + volatile uint32_t ul = 0; + + ( void ) pcFile; + ( void ) ulLine; + + taskENTER_CRITICAL(); + { + /* Set ul to a non-zero value or press a key to step out of this + * function in order to inspect the location of the assert(). */ + + /* Clear any pending key presses. */ + while( ucGalileoGetchar() != 0 ) + { + /* Nothing to do here - the key press is just discarded. */ + } + + do + { + prvDisplayAssertion( pcFile, ulLine ); + } while( ( ul == pdFALSE ) && ( ucGalileoGetchar() == 0 ) ); + + prvClearAssertionLine(); + } + taskEXIT_CRITICAL(); } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 ) - { - extern void vTimerPeriodicISRTests( void ); + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 ) + { + extern void vTimerPeriodicISRTests( void ); - /* The full demo includes a software timer demo/test that requires - prodding periodically from the tick interrupt. */ - vTimerPeriodicISRTests(); + /* The full demo includes a software timer demo/test that requires + * prodding periodically from the tick interrupt. */ + vTimerPeriodicISRTests(); - /* Call the periodic queue overwrite from ISR demo. */ - vQueueOverwritePeriodicISRDemo(); + /* Call the periodic queue overwrite from ISR demo. */ + vQueueOverwritePeriodicISRDemo(); - /* Call the periodic event group from ISR demo. */ - vPeriodicEventGroupsProcessing(); + /* Call the periodic event group from ISR demo. */ + vPeriodicEventGroupsProcessing(); - /* Call the periodic queue set from ISR demo. */ - vQueueSetAccessQueueSetFromISR(); + /* Call the periodic queue set from ISR demo. */ + vQueueSetAccessQueueSetFromISR(); - /* Use task notifications from an interrupt. */ - xNotifyTaskFromISR(); - } - #endif + /* Use task notifications from an interrupt. */ + xNotifyTaskFromISR(); + } + #endif /* if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 ) */ } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Initialise the serial port and GPIO. */ - vInitializeGalileoSerialPort( DEBUG_SERIAL_PORT ); - vGalileoInitializeGpioController(); - vGalileoInitializeLegacyGPIO(); - - /* Initialise HPET interrupt(s) */ - #if( ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) && ( hpetHPET_TIMER_IN_USE != 0 ) ) - { - portDISABLE_INTERRUPTS(); - vInitializeAllHPETInterrupts(); - } - #endif - - /* Setup the LED. */ - vGalileoLegacyGPIOInitializationForLED(); - - /* Demonstrates how to calibrate LAPIC Timer. The calibration value - calculated here may get overwritten when the scheduler starts. */ - prvCalibrateLVTimer(); - - /* Print RTOS loaded message. */ - vPrintBanner(); + /* Initialise the serial port and GPIO. */ + vInitializeGalileoSerialPort( DEBUG_SERIAL_PORT ); + vGalileoInitializeGpioController(); + vGalileoInitializeLegacyGPIO(); + + /* Initialise HPET interrupt(s) */ + #if ( ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) && ( hpetHPET_TIMER_IN_USE != 0 ) ) + { + portDISABLE_INTERRUPTS(); + vInitializeAllHPETInterrupts(); + } + #endif + + /* Setup the LED. */ + vGalileoLegacyGPIOInitializationForLED(); + + /* Demonstrates how to calibrate LAPIC Timer. The calibration value + * calculated here may get overwritten when the scheduler starts. */ + prvCalibrateLVTimer(); + + /* Print RTOS loaded message. */ + vPrintBanner(); } /*-----------------------------------------------------------*/ static void prvLoopToWaitForDebugConnection( void ) { - /* Debug if define = 1. */ - #if( mainWAIT_FOR_DEBUG_CONNECTION == 1 ) - { - /* When using the debugger, set this value to pdFALSE, and the application - will sit in a loop at the top of main() to allow the debugger to attached - before the application starts running. Once attached, set - ulExitResetSpinLoop to a non-zero value to leave the loop. */ - volatile uint32_t ulExitResetSpinLoop = pdFALSE; - - /* Must initialize UART before anything will print. */ - vInitializeGalileoSerialPort( DEBUG_SERIAL_PORT ); - - /* RTOS loaded message. */ - vPrintBanner(); - - /* Output instruction message. */ - MoveToScreenPosition( 3, 1 ); - g_printf( DEFAULT_SCREEN_COLOR ); - g_printf( " Waiting for JTAG connection.\n\n\r" ); - g_printf( ANSI_COLOR_RESET ); - g_printf( " Once connected, either set ulExitResetSpinLoop to a non-zero value,\n\r" ); - g_printf( " or you can [PRESS ANY KEY] to start the debug session.\n\n\r" ); - printf( ANSI_SHOW_CURSOR ); - - /* Use the debugger to set the ulExitResetSpinLoop to a non-zero value - or press a key to exit this loop, and step through the application. In - Eclipse, simple hover over the variable to see its value in a pop-over - box, then edit the value in the pop-over box. */ - do - { - portNOP(); - - } while( ( ulExitResetSpinLoop == pdFALSE ) && ( ucGalileoGetchar() == 0 ) ); - } - #endif + /* Debug if define = 1. */ + #if ( mainWAIT_FOR_DEBUG_CONNECTION == 1 ) + { + /* When using the debugger, set this value to pdFALSE, and the application + * will sit in a loop at the top of main() to allow the debugger to attached + * before the application starts running. Once attached, set + * ulExitResetSpinLoop to a non-zero value to leave the loop. */ + volatile uint32_t ulExitResetSpinLoop = pdFALSE; + + /* Must initialize UART before anything will print. */ + vInitializeGalileoSerialPort( DEBUG_SERIAL_PORT ); + + /* RTOS loaded message. */ + vPrintBanner(); + + /* Output instruction message. */ + MoveToScreenPosition( 3, 1 ); + g_printf( DEFAULT_SCREEN_COLOR ); + g_printf( " Waiting for JTAG connection.\n\n\r" ); + g_printf( ANSI_COLOR_RESET ); + g_printf( " Once connected, either set ulExitResetSpinLoop to a non-zero value,\n\r" ); + g_printf( " or you can [PRESS ANY KEY] to start the debug session.\n\n\r" ); + printf( ANSI_SHOW_CURSOR ); + + /* Use the debugger to set the ulExitResetSpinLoop to a non-zero value + * or press a key to exit this loop, and step through the application. In + * Eclipse, simple hover over the variable to see its value in a pop-over + * box, then edit the value in the pop-over box. */ + do + { + portNOP(); + } while( ( ulExitResetSpinLoop == pdFALSE ) && ( ucGalileoGetchar() == 0 ) ); + } + #endif /* if ( mainWAIT_FOR_DEBUG_CONNECTION == 1 ) */ } /*-----------------------------------------------------------*/ void CRT_Init( void ) { -extern uint32_t __bss_start[]; -extern uint32_t __bss_end[]; -extern uint32_t __data_vma[]; -extern uint32_t __data_lma[]; -extern uint32_t __data_start[]; -extern uint32_t __data_end[]; -uint32_t x = 255; -size_t xSize; - - /* Zero out bss. */ - xSize = ( ( size_t ) __bss_end ) - ( ( size_t ) __bss_start ); - memset( ( void * ) __bss_start, 0x00, xSize ); - - /* Copy initialised variables. */ - xSize = ( ( size_t ) __data_end ) - ( ( size_t ) __data_start ); - memcpy( ( void * ) __data_vma, __data_lma, xSize ); - - /* Ensure no interrupts are pending. */ - do - { - portAPIC_EOI = 0; - x--; - } while( x > 0 ); + extern uint32_t __bss_start[]; + extern uint32_t __bss_end[]; + extern uint32_t __data_vma[]; + extern uint32_t __data_lma[]; + extern uint32_t __data_start[]; + extern uint32_t __data_end[]; + uint32_t x = 255; + size_t xSize; + + /* Zero out bss. */ + xSize = ( ( size_t ) __bss_end ) - ( ( size_t ) __bss_start ); + memset( ( void * ) __bss_start, 0x00, xSize ); + + /* Copy initialised variables. */ + xSize = ( ( size_t ) __data_end ) - ( ( size_t ) __data_start ); + memcpy( ( void * ) __data_vma, __data_lma, xSize ); + + /* Ensure no interrupts are pending. */ + do + { + portAPIC_EOI = 0; + x--; + } while( x > 0 ); } /*-----------------------------------------------------------*/ static void prvCalibrateLVTimer( void ) { -uint32_t uiInitialTimerCounts, uiCalibratedTimerCounts; + uint32_t uiInitialTimerCounts, uiCalibratedTimerCounts; - /* Disable LAPIC Counter. */ - portAPIC_LVT_TIMER = portAPIC_DISABLE; + /* Disable LAPIC Counter. */ + portAPIC_LVT_TIMER = portAPIC_DISABLE; - /* Calibrate the LV Timer counts to ensure it matches the HPET timer over - extended periods. */ - uiInitialTimerCounts = ( ( configCPU_CLOCK_HZ >> 4UL ) / configTICK_RATE_HZ ); - uiCalibratedTimerCounts = uiCalibrateTimer( 0, hpetLVTIMER ); + /* Calibrate the LV Timer counts to ensure it matches the HPET timer over + * extended periods. */ + uiInitialTimerCounts = ( ( configCPU_CLOCK_HZ >> 4UL ) / configTICK_RATE_HZ ); + uiCalibratedTimerCounts = uiCalibrateTimer( 0, hpetLVTIMER ); - if( uiCalibratedTimerCounts != 0 ) - { - uiInitialTimerCounts = uiCalibratedTimerCounts; - } + if( uiCalibratedTimerCounts != 0 ) + { + uiInitialTimerCounts = uiCalibratedTimerCounts; + } - /* Set the interrupt frequency. */ - portAPIC_TMRDIV = portAPIC_DIV_16; - portAPIC_TIMER_INITIAL_COUNT = uiInitialTimerCounts; + /* Set the interrupt frequency. */ + portAPIC_TMRDIV = portAPIC_DIV_16; + portAPIC_TIMER_INITIAL_COUNT = uiInitialTimerCounts; - /* Enable LAPIC Counter. */ - portAPIC_LVT_TIMER = portAPIC_TIMER_PERIODIC | portAPIC_TIMER_INT_VECTOR; + /* Enable LAPIC Counter. */ + portAPIC_LVT_TIMER = portAPIC_TIMER_PERIODIC | portAPIC_TIMER_INT_VECTOR; - /* Sometimes needed. */ - portAPIC_TMRDIV = portAPIC_DIV_16; + /* Sometimes needed. */ + portAPIC_TMRDIV = portAPIC_DIV_16; } diff --git a/FreeRTOS/Demo/MB91460_Softune/SRC/FreeRTOSConfig.h b/FreeRTOS/Demo/MB91460_Softune/SRC/FreeRTOSConfig.h index 9d23ec48a0a..9710ad88735 100644 --- a/FreeRTOS/Demo/MB91460_Softune/SRC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/MB91460_Softune/SRC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MB91460_Softune/SRC/crflash_modified.c b/FreeRTOS/Demo/MB91460_Softune/SRC/crflash_modified.c index c600ac40b61..7ee2cc9261a 100644 --- a/FreeRTOS/Demo/MB91460_Softune/SRC/crflash_modified.c +++ b/FreeRTOS/Demo/MB91460_Softune/SRC/crflash_modified.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MB91460_Softune/SRC/main.c b/FreeRTOS/Demo/MB91460_Softune/SRC/main.c index 9bf61f21392..b2384edd979 100644 --- a/FreeRTOS/Demo/MB91460_Softune/SRC/main.c +++ b/FreeRTOS/Demo/MB91460_Softune/SRC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MB91460_Softune/SRC/partest/partest.c b/FreeRTOS/Demo/MB91460_Softune/SRC/partest/partest.c index 739eabfc41e..50d9672b62f 100644 --- a/FreeRTOS/Demo/MB91460_Softune/SRC/partest/partest.c +++ b/FreeRTOS/Demo/MB91460_Softune/SRC/partest/partest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MB91460_Softune/SRC/serial/serial.c b/FreeRTOS/Demo/MB91460_Softune/SRC/serial/serial.c index a5b10685343..33272f20022 100644 --- a/FreeRTOS/Demo/MB91460_Softune/SRC/serial/serial.c +++ b/FreeRTOS/Demo/MB91460_Softune/SRC/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/FreeRTOSConfig.h b/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/FreeRTOSConfig.h index 30c06adbc52..f77efe526b4 100644 --- a/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/crflash_sk16fx100mpc.c b/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/crflash_sk16fx100mpc.c index c600ac40b61..7ee2cc9261a 100644 --- a/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/crflash_sk16fx100mpc.c +++ b/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/crflash_sk16fx100mpc.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/main.c b/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/main.c index e4a2a3976e2..b0a724129ee 100644 --- a/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/main.c +++ b/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/partest/partest.c b/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/partest/partest.c index ed361c93198..8e7eca91942 100644 --- a/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/partest/partest.c +++ b/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/partest/partest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/serial/serial.c b/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/serial/serial.c index 15d42a91ec4..635748ca5f7 100644 --- a/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/serial/serial.c +++ b/FreeRTOS/Demo/MB96340_Softune/FreeRTOS_96348hs_SK16FX100PMC/Src/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/DiceTask.c b/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/DiceTask.c index 20b5097c246..9463444abd9 100644 --- a/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/DiceTask.c +++ b/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/DiceTask.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/DiceTask.h b/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/DiceTask.h index f1a8b70924f..ef450d86031 100644 --- a/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/DiceTask.h +++ b/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/DiceTask.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/FreeRTOSConfig.h b/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/FreeRTOSConfig.h index 931d6b2ca29..380d438cb1b 100644 --- a/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/ParTest/ParTest.c b/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/ParTest/ParTest.c index 0362300d1c1..6f4b8de7158 100644 --- a/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/ParTest/ParTest.c +++ b/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/SegmentToggleTasks.c b/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/SegmentToggleTasks.c index 4eae3995825..081506fcc37 100644 --- a/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/SegmentToggleTasks.c +++ b/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/SegmentToggleTasks.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/main.c b/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/main.c index ec6bc2002e4..2d3f82adfae 100644 --- a/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/main.c +++ b/FreeRTOS/Demo/MB96350_Softune_Dice_Kit/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -26,66 +26,66 @@ /***** - * - * See http://www.freertos.org/Documentation/FreeRTOS-documentation-and-book.html - * for an introductory guide to using real time kernels, and FreeRTOS in - * particular. - * - ***** - * - * The DICE-KIT-16FX has two 7 segment displays and two buttons that can - * generate interrupts. This example uses this IO as follows: - * - * - * - Left 7 segment display - - * - * 7 'flash' tasks are created, each of which toggles a single segment of the - * left display. Each task executes at a fixed frequency, with a different - * frequency being used by each task. - * - * When button SW2 is pressed an interrupt is generated that wakes up a 'dice' - * task. The dice task suspends the 7 tasks that are accessing the left display - * before simulating a dice being thrown by generating a random number between - * 1 and 6. After the number has been generated the task sleeps for 5 seconds, - * if SW2 is pressed again within the 5 seconds another random number is - * generated, if SW2 is not pressed within the 5 seconds then the 7 tasks are - * un-suspended and will once again toggle the segments of the left hand display. - * - * - * - Right 7 segment display - - * - * Control of the right side 7 segment display is very similar to that of the - * left, except co-routines are used to toggle the segments instead of tasks, - * and button SW3 is used instead of SW2. - * - * - * - Notes - - * - * Only one dice task is actually defined. Two instances of this single - * definition are created, the first to simulate a dice being thrown on the left - * display, and the other to simulate a dice being thrown on the right display. - * The task parameter is used to let the dice tasks know which display to - * control. - * - * Both dice tasks and the flash tasks operate completely independently under - * the control of FreeRTOS. 11 tasks and 7 co-routines are created in total, - * including the idle task. - * - * The co-routines all execute within a single low priority task. - * - * - * - * When this demo is executing as expected: - * - * + Every segment of both displays will toggle at a fixed frequency - with each - * segment using a different frequency. - * + When a button is pushed the segment toggling will temporarily stop and the - * dice 'throw' will start whereby the display will show a fast changing random - * number for a few seconds before the dice value is chosen and displayed. - * + If the button is not pushed again within five seconds of the dice value being - * displayed the segment toggling will commence again. - * - *****/ +* +* See http://www.freertos.org/Documentation/FreeRTOS-documentation-and-book.html +* for an introductory guide to using real time kernels, and FreeRTOS in +* particular. +* +***** +* +* The DICE-KIT-16FX has two 7 segment displays and two buttons that can +* generate interrupts. This example uses this IO as follows: +* +* +* - Left 7 segment display - +* +* 7 'flash' tasks are created, each of which toggles a single segment of the +* left display. Each task executes at a fixed frequency, with a different +* frequency being used by each task. +* +* When button SW2 is pressed an interrupt is generated that wakes up a 'dice' +* task. The dice task suspends the 7 tasks that are accessing the left display +* before simulating a dice being thrown by generating a random number between +* 1 and 6. After the number has been generated the task sleeps for 5 seconds, +* if SW2 is pressed again within the 5 seconds another random number is +* generated, if SW2 is not pressed within the 5 seconds then the 7 tasks are +* un-suspended and will once again toggle the segments of the left hand display. +* +* +* - Right 7 segment display - +* +* Control of the right side 7 segment display is very similar to that of the +* left, except co-routines are used to toggle the segments instead of tasks, +* and button SW3 is used instead of SW2. +* +* +* - Notes - +* +* Only one dice task is actually defined. Two instances of this single +* definition are created, the first to simulate a dice being thrown on the left +* display, and the other to simulate a dice being thrown on the right display. +* The task parameter is used to let the dice tasks know which display to +* control. +* +* Both dice tasks and the flash tasks operate completely independently under +* the control of FreeRTOS. 11 tasks and 7 co-routines are created in total, +* including the idle task. +* +* The co-routines all execute within a single low priority task. +* +* +* +* When this demo is executing as expected: +* +* + Every segment of both displays will toggle at a fixed frequency - with each +* segment using a different frequency. +* + When a button is pushed the segment toggling will temporarily stop and the +* dice 'throw' will start whereby the display will show a fast changing random +* number for a few seconds before the dice value is chosen and displayed. +* + If the button is not pushed again within five seconds of the dice value being +* displayed the segment toggling will commence again. +* +*****/ /* Kernel includes. */ #include "FreeRTOS.h" @@ -97,7 +97,7 @@ #include "Flash.h" /* The priority at which the dice task execute. */ -#define mainDICE_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainDICE_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* * Sets up the MCU IO for the 7 segment displays and the button inputs. @@ -114,81 +114,82 @@ extern vCreateFlashTasksAndCoRoutines( void ); void main( void ) { - /* Setup the MCU IO. */ - prvSetupHardware(); + /* Setup the MCU IO. */ + prvSetupHardware(); - /* Create the tasks and co-routines that toggle the display segments. */ - vCreateFlashTasksAndCoRoutines(); + /* Create the tasks and co-routines that toggle the display segments. */ + vCreateFlashTasksAndCoRoutines(); - /* Create a 'dice' task to control the left hand display. */ - xTaskCreate( vDiceTask, "Dice1", configMINIMAL_STACK_SIZE, ( void * ) configLEFT_DISPLAY, mainDICE_PRIORITY, NULL ); + /* Create a 'dice' task to control the left hand display. */ + xTaskCreate( vDiceTask, "Dice1", configMINIMAL_STACK_SIZE, ( void * ) configLEFT_DISPLAY, mainDICE_PRIORITY, NULL ); - /* Create a 'dice' task to control the right hand display. */ - xTaskCreate( vDiceTask, "Dice2", configMINIMAL_STACK_SIZE, ( void * ) configRIGHT_DISPLAY, mainDICE_PRIORITY, NULL ); + /* Create a 'dice' task to control the right hand display. */ + xTaskCreate( vDiceTask, "Dice2", configMINIMAL_STACK_SIZE, ( void * ) configRIGHT_DISPLAY, mainDICE_PRIORITY, NULL ); - /* Start the scheduler running. */ - vTaskStartScheduler(); + /* Start the scheduler running. */ + vTaskStartScheduler(); - /* If this loop is executed then there was insufficient heap memory for the - idle task to be created - causing vTaskStartScheduler() to return. */ - while( 1 ); + /* If this loop is executed then there was insufficient heap memory for the + * idle task to be created - causing vTaskStartScheduler() to return. */ + while( 1 ) + { + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Setup interrupt hardware - interrupts are kept disabled for now to - prevent any interrupts attempting to cause a context switch before the - scheduler has been started. */ - InitIrqLevels(); - portDISABLE_INTERRUPTS(); - __set_il( 7 ); - - /* Set Port3 as output (7Segment Display). */ - DDR03 = 0xff; - - /* Use Port 5 as I/O-Port. */ - ADER1 = 0; - PDR05 = 0x7f; - - /* Set Port5 as output (7Segment Display). */ - DDR05 = 0xff; - - /* Disable inputs on the following ports. */ - PIER02 = 0x00; - PDR02 = 0x00; - DDR02 = 0xff; - PIER03 = 0x00; - PDR03 = 0xff; - PIER05 = 0x00; - PDR05 = 0x00; - PIER06 = 0x00; - PDR06 = 0x00; - DDR06 = 0xff; - - /* Enable P00_0/INT8 and P00_1/INT9 as input. */ - PIER00 = 0x03; - - /* Enable external interrupt 8. */ - PIER00_IE0 = 1; - - /* LB0, LA0 = 11 -> falling edge. */ - ELVRL1_LB8 = 1; - ELVRL1_LA8 = 1; - - /* Reset and enable the interrupt request. */ - EIRR1_ER8 = 0; - ENIR1_EN8 = 1; - - /* Enable external interrupt 9. */ - PIER00_IE1 = 1; - - /* LB1, LA1 = 11 -> falling edge. */ - ELVRL1_LB9 = 1; - ELVRL1_LA9 = 1; - - /* Reset and enable the interrupt request. */ - EIRR1_ER9 = 0; - ENIR1_EN9 = 1; + /* Setup interrupt hardware - interrupts are kept disabled for now to + * prevent any interrupts attempting to cause a context switch before the + * scheduler has been started. */ + InitIrqLevels(); + portDISABLE_INTERRUPTS(); + __set_il( 7 ); + + /* Set Port3 as output (7Segment Display). */ + DDR03 = 0xff; + + /* Use Port 5 as I/O-Port. */ + ADER1 = 0; + PDR05 = 0x7f; + + /* Set Port5 as output (7Segment Display). */ + DDR05 = 0xff; + + /* Disable inputs on the following ports. */ + PIER02 = 0x00; + PDR02 = 0x00; + DDR02 = 0xff; + PIER03 = 0x00; + PDR03 = 0xff; + PIER05 = 0x00; + PDR05 = 0x00; + PIER06 = 0x00; + PDR06 = 0x00; + DDR06 = 0xff; + + /* Enable P00_0/INT8 and P00_1/INT9 as input. */ + PIER00 = 0x03; + + /* Enable external interrupt 8. */ + PIER00_IE0 = 1; + + /* LB0, LA0 = 11 -> falling edge. */ + ELVRL1_LB8 = 1; + ELVRL1_LA8 = 1; + + /* Reset and enable the interrupt request. */ + EIRR1_ER8 = 0; + ENIR1_EN8 = 1; + + /* Enable external interrupt 9. */ + PIER00_IE1 = 1; + + /* LB1, LA1 = 11 -> falling edge. */ + ELVRL1_LB9 = 1; + ELVRL1_LA9 = 1; + + /* Reset and enable the interrupt request. */ + EIRR1_ER9 = 0; + ENIR1_EN9 = 1; } - diff --git a/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/FreeRTOSConfig.h b/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/FreeRTOSConfig.h index c4563df3935..fa048c0eb96 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/ParTest.c b/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/ParTest.c index e6f5f6b0a28..7910e365aec 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/ParTest.c +++ b/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/RunTimeStatsConfig.c b/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/RunTimeStatsConfig.c index cb76316a9be..057a668d252 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/RunTimeStatsConfig.c +++ b/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/RunTimeStatsConfig.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/main.c b/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/main.c index f4a12058575..62c7f43ae1a 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/main.c +++ b/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/serial.c b/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/serial.c index 6571c087c52..8123de2fd5d 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/serial.c +++ b/FreeRTOS/Demo/MSP430X_MSP430F5438_CCS/Demo_Source/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/FreeRTOSConfig.h index 1e578ff0c81..0293e96f97c 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/ParTest.c b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/ParTest.c index e6f5f6b0a28..7910e365aec 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/ParTest.c +++ b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/RunTimeStatsConfig.c b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/RunTimeStatsConfig.c index 44f24bb30d8..338a338af0a 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/RunTimeStatsConfig.c +++ b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/RunTimeStatsConfig.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/main.c b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/main.c index a9e15e5addc..3cf9ea9444d 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/main.c +++ b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -103,7 +103,7 @@ * the application set up a timer to generate the tick interrupt. In this * example a timer A0 is used for this purpose. * -*/ + */ /* Standard includes. */ #include @@ -124,48 +124,48 @@ #include "GenQTest.h" /* Codes sent within messages to the LCD task so the LCD task can interpret -exactly what the message it just received was. These are sent in the -cMessageID member of the message structure (defined below). */ -#define mainMESSAGE_BUTTON_UP ( 1 ) -#define mainMESSAGE_BUTTON_SEL ( 2 ) -#define mainMESSAGE_STATUS ( 3 ) + * exactly what the message it just received was. These are sent in the + * cMessageID member of the message structure (defined below). */ +#define mainMESSAGE_BUTTON_UP ( 1 ) +#define mainMESSAGE_BUTTON_SEL ( 2 ) +#define mainMESSAGE_STATUS ( 3 ) /* When the cMessageID member of the message sent to the LCD task is -mainMESSAGE_STATUS then these definitions are sent in the ulMessageValue member -of the same message and indicate what the status actually is. */ -#define mainERROR_DYNAMIC_TASKS ( pdPASS + 1 ) -#define mainERROR_COM_TEST ( pdPASS + 2 ) -#define mainERROR_GEN_QUEUE_TEST ( pdPASS + 3 ) -#define mainERROR_REG_TEST ( pdPASS + 4 ) + * mainMESSAGE_STATUS then these definitions are sent in the ulMessageValue member + * of the same message and indicate what the status actually is. */ +#define mainERROR_DYNAMIC_TASKS ( pdPASS + 1 ) +#define mainERROR_COM_TEST ( pdPASS + 2 ) +#define mainERROR_GEN_QUEUE_TEST ( pdPASS + 3 ) +#define mainERROR_REG_TEST ( pdPASS + 4 ) /* The length of the queue (the number of items the queue can hold) that is used -to send messages from tasks and interrupts the the LCD task. */ -#define mainQUEUE_LENGTH ( 5 ) + * to send messages from tasks and interrupts the the LCD task. */ +#define mainQUEUE_LENGTH ( 5 ) /* Priorities used by the test and demo tasks. */ -#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainGENERIC_QUEUE_TEST_PRIORITY ( tskIDLE_PRIORITY ) +#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainGENERIC_QUEUE_TEST_PRIORITY ( tskIDLE_PRIORITY ) /* The LED used by the comtest tasks. See the comtest.c file for more -information. */ -#define mainCOM_TEST_LED ( 1 ) + * information. */ +#define mainCOM_TEST_LED ( 1 ) /* The baud rate used by the comtest tasks described at the top of this file. */ -#define mainCOM_TEST_BAUD_RATE ( 38400 ) +#define mainCOM_TEST_BAUD_RATE ( 38400 ) /* The maximum number of lines of text that can be displayed on the LCD. */ -#define mainMAX_LCD_LINES ( 8 ) +#define mainMAX_LCD_LINES ( 8 ) /* Just used to ensure parameters are passed into tasks correctly. */ -#define mainTASK_PARAMETER_CHECK_VALUE ( ( void * ) 0xDEAD ) +#define mainTASK_PARAMETER_CHECK_VALUE ( ( void * ) 0xDEAD ) /*-----------------------------------------------------------*/ /* * The reg test tasks as described at the top of this file. */ -extern void vRegTest1Task( void *pvParameters ); -extern void vRegTest2Task( void *pvParameters ); +extern void vRegTest1Task( void * pvParameters ); +extern void vRegTest2Task( void * pvParameters ); /* * Configures clocks, LCD, port pints, etc. necessary to execute this demo. @@ -176,427 +176,450 @@ static void prvSetupHardware( void ); * Definition of the LCD/controller task described in the comments at the top * of this file. */ -static void prvLCDTask( void *pvParameters ); +static void prvLCDTask( void * pvParameters ); /* * Definition of the button poll task described in the comments at the top of * this file. */ -static void prvButtonPollTask( void *pvParameters ); +static void prvButtonPollTask( void * pvParameters ); /* * Converts a status message value into an appropriate string for display on * the LCD. The string is written to pcBuffer. */ -static void prvGenerateStatusMessage( char *pcBuffer, long lStatusValue ); +static void prvGenerateStatusMessage( char * pcBuffer, + long lStatusValue ); /*-----------------------------------------------------------*/ /* Variables that are incremented on each iteration of the reg test tasks - -provided the tasks have not reported any errors. The check task 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. */ + * provided the tasks have not reported any errors. The check task 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. */ volatile unsigned short usRegTest1Counter = 0, usRegTest2Counter = 0; /* The handle of the queue used to send messages from tasks and interrupts to -the LCD task. */ + * the LCD task. */ static QueueHandle_t xLCDQueue = NULL; /* The definition of each message sent from tasks and interrupts to the LCD -task. */ + * task. */ typedef struct { - char cMessageID; /* << States what the message is. */ - unsigned long ulMessageValue; /* << States the message value (can be an integer, string pointer, etc. depending on the value of cMessageID). */ + char cMessageID; /* << States what the message is. */ + unsigned long ulMessageValue; /* << States the message value (can be an integer, string pointer, etc. depending on the value of cMessageID). */ } xQueueMessage; /*-----------------------------------------------------------*/ /* The linker script can be used to test the FreeRTOS ports use of 20bit -addresses by locating all code in high memory. The following pragma ensures -that main remains in low memory when that is done. The ISR_CODE segment is used -for convenience as ISR functions are always placed in low memory. */ + * addresses by locating all code in high memory. The following pragma ensures + * that main remains in low memory when that is done. The ISR_CODE segment is used + * for convenience as ISR functions are always placed in low memory. */ #pragma location="ISR_CODE" void main( void ) { - /* Configure the peripherals used by this demo application. This includes - configuring the joystick input select button to generate interrupts. */ - prvSetupHardware(); - - /* Create the queue used by tasks and interrupts to send strings to the LCD - task. */ - xLCDQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( xQueueMessage ) ); - - /* If the queue could not be created then don't create any tasks that might - attempt to use the queue. */ - if( xLCDQueue != NULL ) - { - /* Add the created queue to the queue registry so it can be viewed in - the IAR FreeRTOS state viewer plug-in. */ - vQueueAddToRegistry( xLCDQueue, "LCDQueue" ); - - /* Create the standard demo tasks. */ - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vStartDynamicPriorityTasks(); - vStartGenericQueueTasks( mainGENERIC_QUEUE_TEST_PRIORITY ); - - /* Create the LCD, button poll and register test tasks, as described at - the top of this file. */ - xTaskCreate( prvLCDTask, "LCD", configMINIMAL_STACK_SIZE * 2, mainTASK_PARAMETER_CHECK_VALUE, mainLCD_TASK_PRIORITY, NULL ); - xTaskCreate( prvButtonPollTask, "BPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, NULL, 0, NULL ); - xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, NULL, 0, NULL ); - - /* Start the scheduler. */ - vTaskStartScheduler(); - } - - /* If all is well then this line will never be reached. If it is reached - then it is likely that there was insufficient (FreeRTOS) heap memory space - to create the idle task. This may have been trapped by the malloc() failed - hook function, if one is configured. */ - for( ;; ); + /* Configure the peripherals used by this demo application. This includes + * configuring the joystick input select button to generate interrupts. */ + prvSetupHardware(); + + /* Create the queue used by tasks and interrupts to send strings to the LCD + * task. */ + xLCDQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( xQueueMessage ) ); + + /* If the queue could not be created then don't create any tasks that might + * attempt to use the queue. */ + if( xLCDQueue != NULL ) + { + /* Add the created queue to the queue registry so it can be viewed in + * the IAR FreeRTOS state viewer plug-in. */ + vQueueAddToRegistry( xLCDQueue, "LCDQueue" ); + + /* Create the standard demo tasks. */ + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vStartDynamicPriorityTasks(); + vStartGenericQueueTasks( mainGENERIC_QUEUE_TEST_PRIORITY ); + + /* Create the LCD, button poll and register test tasks, as described at + * the top of this file. */ + xTaskCreate( prvLCDTask, "LCD", configMINIMAL_STACK_SIZE * 2, mainTASK_PARAMETER_CHECK_VALUE, mainLCD_TASK_PRIORITY, NULL ); + xTaskCreate( prvButtonPollTask, "BPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, NULL, 0, NULL ); + xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, NULL, 0, NULL ); + + /* Start the scheduler. */ + vTaskStartScheduler(); + } + + /* If all is well then this line will never be reached. If it is reached + * then it is likely that there was insufficient (FreeRTOS) heap memory space + * to create the idle task. This may have been trapped by the malloc() failed + * hook function, if one is configured. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvLCDTask( void *pvParameters ) +static void prvLCDTask( void * pvParameters ) { -xQueueMessage xReceivedMessage; + xQueueMessage xReceivedMessage; /* Buffer into which strings are formatted and placed ready for display on the -LCD. Note this is a static variable to prevent it being allocated on the task -stack, which is too small to hold such a variable. The stack size is configured -when the task is created. */ -static char cBuffer[ 512 ]; -unsigned char ucLine = 1; - - - /* This function is the only function that uses printf(). If printf() is - used from any other function then some sort of mutual exclusion on stdout - will be necessary. - - This is also the only function that is permitted to access the LCD. - - First print out the number of bytes that remain in the FreeRTOS heap. This - can be viewed in the terminal IO window within the IAR Embedded Workbench. */ - printf( "%d bytes of heap space remain unallocated\n", ( int ) xPortGetFreeHeapSize() ); - - /* Just as a test of the port, and for no functional reason, check the task - parameter contains its expected value. */ - if( pvParameters != mainTASK_PARAMETER_CHECK_VALUE ) - { - halLcdPrintLine( "Invalid parameter", ucLine, OVERWRITE_TEXT ); - ucLine++; - } - - for( ;; ) - { - /* Wait for a message to be received. Using portMAX_DELAY as the block - time will result in an indefinite wait provided INCLUDE_vTaskSuspend is - set to 1 in FreeRTOSConfig.h, therefore there is no need to check the - function return value and the function will only return when a value - has been received. */ - xQueueReceive( xLCDQueue, &xReceivedMessage, portMAX_DELAY ); - - /* Clear the LCD if no room remains for any more text output. */ - if( ucLine > mainMAX_LCD_LINES ) - { - halLcdClearScreen(); - ucLine = 0; - } - - /* What is this message? What does it contain? */ - switch( xReceivedMessage.cMessageID ) - { - case mainMESSAGE_BUTTON_UP : /* The button poll task has just - informed this task that the up - button on the joystick input has - been pressed or released. */ - sprintf( cBuffer, "Button up = %d", ( int ) xReceivedMessage.ulMessageValue ); - break; - - case mainMESSAGE_BUTTON_SEL : /* The select button interrupt - just informed this task that the - select button was pressed. - Generate a table of task run time - statistics and output this to - the terminal IO window in the IAR - embedded workbench. */ - printf( "\nTask\t Abs Time\t %%Time\n*****************************************" ); - vTaskGetRunTimeStats( cBuffer ); - printf( cBuffer ); - - /* Also print out a message to - the LCD - in this case the - pointer to the string to print - is sent directly in the - ulMessageValue member of the - message. This just demonstrates - a different communication - technique. */ - sprintf( cBuffer, "%s", ( char * ) xReceivedMessage.ulMessageValue ); - break; - - case mainMESSAGE_STATUS : /* The tick interrupt hook - function has just informed this - task of the system status. - Generate a string in accordance - with the status value. */ - prvGenerateStatusMessage( cBuffer, xReceivedMessage.ulMessageValue ); - break; - - default : sprintf( cBuffer, "Unknown message" ); - break; - } - - /* Output the message that was placed into the cBuffer array within the - switch statement above, then move onto the next line ready for the next - message to arrive on the queue. */ - halLcdPrintLine( cBuffer, ucLine, OVERWRITE_TEXT ); - ucLine++; - } + * LCD. Note this is a static variable to prevent it being allocated on the task + * stack, which is too small to hold such a variable. The stack size is configured + * when the task is created. */ + static char cBuffer[ 512 ]; + unsigned char ucLine = 1; + + + /* This function is the only function that uses printf(). If printf() is + * used from any other function then some sort of mutual exclusion on stdout + * will be necessary. + * + * This is also the only function that is permitted to access the LCD. + * + * First print out the number of bytes that remain in the FreeRTOS heap. This + * can be viewed in the terminal IO window within the IAR Embedded Workbench. */ + printf( "%d bytes of heap space remain unallocated\n", ( int ) xPortGetFreeHeapSize() ); + + /* Just as a test of the port, and for no functional reason, check the task + * parameter contains its expected value. */ + if( pvParameters != mainTASK_PARAMETER_CHECK_VALUE ) + { + halLcdPrintLine( "Invalid parameter", ucLine, OVERWRITE_TEXT ); + ucLine++; + } + + for( ; ; ) + { + /* Wait for a message to be received. Using portMAX_DELAY as the block + * time will result in an indefinite wait provided INCLUDE_vTaskSuspend is + * set to 1 in FreeRTOSConfig.h, therefore there is no need to check the + * function return value and the function will only return when a value + * has been received. */ + xQueueReceive( xLCDQueue, &xReceivedMessage, portMAX_DELAY ); + + /* Clear the LCD if no room remains for any more text output. */ + if( ucLine > mainMAX_LCD_LINES ) + { + halLcdClearScreen(); + ucLine = 0; + } + + /* What is this message? What does it contain? */ + switch( xReceivedMessage.cMessageID ) + { + case mainMESSAGE_BUTTON_UP: /* The button poll task has just + * informed this task that the up + * button on the joystick input has + * been pressed or released. */ + sprintf( cBuffer, "Button up = %d", ( int ) xReceivedMessage.ulMessageValue ); + break; + + case mainMESSAGE_BUTTON_SEL: /* The select button interrupt + * just informed this task that the + * select button was pressed. + * Generate a table of task run time + * statistics and output this to + * the terminal IO window in the IAR + * embedded workbench. */ + printf( "\nTask\t Abs Time\t %%Time\n*****************************************" ); + vTaskGetRunTimeStats( cBuffer ); + printf( cBuffer ); + + /* Also print out a message to + * the LCD - in this case the + * pointer to the string to print + * is sent directly in the + * ulMessageValue member of the + * message. This just demonstrates + * a different communication + * technique. */ + sprintf( cBuffer, "%s", ( char * ) xReceivedMessage.ulMessageValue ); + break; + + case mainMESSAGE_STATUS: /* The tick interrupt hook + * function has just informed this + * task of the system status. + * Generate a string in accordance + * with the status value. */ + prvGenerateStatusMessage( cBuffer, xReceivedMessage.ulMessageValue ); + break; + + default: + sprintf( cBuffer, "Unknown message" ); + break; + } + + /* Output the message that was placed into the cBuffer array within the + * switch statement above, then move onto the next line ready for the next + * message to arrive on the queue. */ + halLcdPrintLine( cBuffer, ucLine, OVERWRITE_TEXT ); + ucLine++; + } } /*-----------------------------------------------------------*/ -static void prvGenerateStatusMessage( char *pcBuffer, long lStatusValue ) +static void prvGenerateStatusMessage( char * pcBuffer, + long lStatusValue ) { - /* Just a utility function to convert a status value into a meaningful - string for output onto the LCD. */ - switch( lStatusValue ) - { - case pdPASS : sprintf( pcBuffer, "Status = PASS" ); - break; - case mainERROR_DYNAMIC_TASKS : sprintf( pcBuffer, "Err: Dynamic tsks" ); - break; - case mainERROR_COM_TEST : sprintf( pcBuffer, "Err: COM test" ); - break; - case mainERROR_GEN_QUEUE_TEST : sprintf( pcBuffer, "Error: Gen Q test" ); - break; - case mainERROR_REG_TEST : sprintf( pcBuffer, "Error: Reg test" ); - break; - default : sprintf( pcBuffer, "Unknown status" ); - break; - } + /* Just a utility function to convert a status value into a meaningful + * string for output onto the LCD. */ + switch( lStatusValue ) + { + case pdPASS: + sprintf( pcBuffer, "Status = PASS" ); + break; + + case mainERROR_DYNAMIC_TASKS: + sprintf( pcBuffer, "Err: Dynamic tsks" ); + break; + + case mainERROR_COM_TEST: + sprintf( pcBuffer, "Err: COM test" ); + break; + + case mainERROR_GEN_QUEUE_TEST: + sprintf( pcBuffer, "Error: Gen Q test" ); + break; + + case mainERROR_REG_TEST: + sprintf( pcBuffer, "Error: Reg test" ); + break; + + default: + sprintf( pcBuffer, "Unknown status" ); + break; + } } /*-----------------------------------------------------------*/ -static void prvButtonPollTask( void *pvParameters ) +static void prvButtonPollTask( void * pvParameters ) { -unsigned char ucLastState = pdFALSE, ucState; -xQueueMessage xMessage; - - /* This tasks performs the button polling functionality as described at the - top of this file. */ - for( ;; ) - { - /* Check the button state. */ - ucState = ( halButtonsPressed() & BUTTON_UP ); - - if( ucState != 0 ) - { - /* The button was pressed. */ - ucState = pdTRUE; - } - - if( ucState != ucLastState ) - { - /* The state has changed, send a message to the LCD task. */ - xMessage.cMessageID = mainMESSAGE_BUTTON_UP; - xMessage.ulMessageValue = ( unsigned long ) ucState; - ucLastState = ucState; - xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); - } - - /* Block for 10 milliseconds so this task does not utilise all the CPU - time and debouncing of the button is not necessary. */ - vTaskDelay( 10 / portTICK_PERIOD_MS ); - } + unsigned char ucLastState = pdFALSE, ucState; + xQueueMessage xMessage; + + /* This tasks performs the button polling functionality as described at the + * top of this file. */ + for( ; ; ) + { + /* Check the button state. */ + ucState = ( halButtonsPressed() & BUTTON_UP ); + + if( ucState != 0 ) + { + /* The button was pressed. */ + ucState = pdTRUE; + } + + if( ucState != ucLastState ) + { + /* The state has changed, send a message to the LCD task. */ + xMessage.cMessageID = mainMESSAGE_BUTTON_UP; + xMessage.ulMessageValue = ( unsigned long ) ucState; + ucLastState = ucState; + xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); + } + + /* Block for 10 milliseconds so this task does not utilise all the CPU + * time and debouncing of the button is not necessary. */ + vTaskDelay( 10 / portTICK_PERIOD_MS ); + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - halBoardInit(); + halBoardInit(); - LFXT_Start( XT1DRIVE_0 ); - hal430SetSystemClock( configCPU_CLOCK_HZ, configLFXT_CLOCK_HZ ); + LFXT_Start( XT1DRIVE_0 ); + hal430SetSystemClock( configCPU_CLOCK_HZ, configLFXT_CLOCK_HZ ); - halButtonsInit( BUTTON_ALL ); - halButtonsInterruptEnable( BUTTON_SELECT ); + halButtonsInit( BUTTON_ALL ); + halButtonsInterruptEnable( BUTTON_SELECT ); - /* Initialise the LCD, but note that the backlight is not used as the - library function uses timer A0 to modulate the backlight, and this file - defines vApplicationSetupTimerInterrupt() to also use timer A0 to generate - the tick interrupt. If the backlight is required, then change either the - halLCD library or vApplicationSetupTimerInterrupt() to use a different - timer. Timer A1 is used for the run time stats time base6. */ - halLcdInit(); - halLcdSetContrast( 100 ); - halLcdClearScreen(); + /* Initialise the LCD, but note that the backlight is not used as the + * library function uses timer A0 to modulate the backlight, and this file + * defines vApplicationSetupTimerInterrupt() to also use timer A0 to generate + * the tick interrupt. If the backlight is required, then change either the + * halLCD library or vApplicationSetupTimerInterrupt() to use a different + * timer. Timer A1 is used for the run time stats time base6. */ + halLcdInit(); + halLcdSetContrast( 100 ); + halLcdClearScreen(); - halLcdPrintLine( " www.FreeRTOS.org", 0, OVERWRITE_TEXT ); + halLcdPrintLine( " www.FreeRTOS.org", 0, OVERWRITE_TEXT ); } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { -static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0; -static unsigned long ulCounter = 0; -static const unsigned long ulCheckFrequency = 5000UL / portTICK_PERIOD_MS; -portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0; + static unsigned long ulCounter = 0; + static const unsigned long ulCheckFrequency = 5000UL / portTICK_PERIOD_MS; + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; /* Define the status message that is sent to the LCD task. By default the -status is PASS. */ -static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS }; - - /* This is called from within the tick interrupt and performs the 'check' - functionality as described in the comments at the top of this file. - - Is it time to perform the 'check' functionality again? */ - ulCounter++; - if( ulCounter >= ulCheckFrequency ) - { - /* See if the standard demo tasks are executing as expected, changing - the message that is sent to the LCD task from PASS to an error code if - any tasks set reports an error. */ - if( xAreComTestTasksStillRunning() != pdPASS ) - { - xStatusMessage.ulMessageValue = mainERROR_COM_TEST; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) - { - xStatusMessage.ulMessageValue = mainERROR_DYNAMIC_TASKS; - } - - if( xAreGenericQueueTasksStillRunning() != pdPASS ) - { - xStatusMessage.ulMessageValue = mainERROR_GEN_QUEUE_TEST; - } - - /* Check the reg test tasks are still cycling. They will stop - incrementing their loop counters if they encounter an error. */ - if( usRegTest1Counter == usLastRegTest1Counter ) - { - xStatusMessage.ulMessageValue = mainERROR_REG_TEST; - } - - if( usRegTest2Counter == usLastRegTest2Counter ) - { - xStatusMessage.ulMessageValue = mainERROR_REG_TEST; - } - - usLastRegTest1Counter = usRegTest1Counter; - usLastRegTest2Counter = usRegTest2Counter; - - /* As this is the tick hook the lHigherPriorityTaskWoken parameter is not - needed (a context switch is going to be performed anyway), but it must - still be provided. */ - xQueueSendFromISR( xLCDQueue, &xStatusMessage, &xHigherPriorityTaskWoken ); - ulCounter = 0; - } - - /* Just periodically toggle an LED to show that the tick interrupt is - running. Note that this access LED_PORT_OUT in a non-atomic way, so tasks - that access the same port must do so from a critical section. */ - if( ( ulCounter & 0xff ) == 0 ) - { - if( ( LED_PORT_OUT & LED_1 ) == 0 ) - { - LED_PORT_OUT |= LED_1; - } - else - { - LED_PORT_OUT &= ~LED_1; - } - } + * status is PASS. */ + static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS }; + + /* This is called from within the tick interrupt and performs the 'check' + * functionality as described in the comments at the top of this file. + * + * Is it time to perform the 'check' functionality again? */ + ulCounter++; + + if( ulCounter >= ulCheckFrequency ) + { + /* See if the standard demo tasks are executing as expected, changing + * the message that is sent to the LCD task from PASS to an error code if + * any tasks set reports an error. */ + if( xAreComTestTasksStillRunning() != pdPASS ) + { + xStatusMessage.ulMessageValue = mainERROR_COM_TEST; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) + { + xStatusMessage.ulMessageValue = mainERROR_DYNAMIC_TASKS; + } + + if( xAreGenericQueueTasksStillRunning() != pdPASS ) + { + xStatusMessage.ulMessageValue = mainERROR_GEN_QUEUE_TEST; + } + + /* Check the reg test tasks are still cycling. They will stop + * incrementing their loop counters if they encounter an error. */ + if( usRegTest1Counter == usLastRegTest1Counter ) + { + xStatusMessage.ulMessageValue = mainERROR_REG_TEST; + } + + if( usRegTest2Counter == usLastRegTest2Counter ) + { + xStatusMessage.ulMessageValue = mainERROR_REG_TEST; + } + + usLastRegTest1Counter = usRegTest1Counter; + usLastRegTest2Counter = usRegTest2Counter; + + /* As this is the tick hook the lHigherPriorityTaskWoken parameter is not + * needed (a context switch is going to be performed anyway), but it must + * still be provided. */ + xQueueSendFromISR( xLCDQueue, &xStatusMessage, &xHigherPriorityTaskWoken ); + ulCounter = 0; + } + + /* Just periodically toggle an LED to show that the tick interrupt is + * running. Note that this access LED_PORT_OUT in a non-atomic way, so tasks + * that access the same port must do so from a critical section. */ + if( ( ulCounter & 0xff ) == 0 ) + { + if( ( LED_PORT_OUT & LED_1 ) == 0 ) + { + LED_PORT_OUT |= LED_1; + } + else + { + LED_PORT_OUT &= ~LED_1; + } + } } /*-----------------------------------------------------------*/ #pragma vector=PORT2_VECTOR -__interrupt static void prvSelectButtonInterrupt(void) +__interrupt static void prvSelectButtonInterrupt( void ) { /* Define the message sent to the LCD task from this interrupt. */ -static const xQueueMessage xMessage = { mainMESSAGE_BUTTON_SEL, ( unsigned long ) "Select Interrupt" }; -portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; + static const xQueueMessage xMessage = { mainMESSAGE_BUTTON_SEL, ( unsigned long ) "Select Interrupt" }; + portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; - /* This is the interrupt handler for the joystick select button input. - The button has been pushed, write a message to the LCD via the LCD task. */ - xQueueSendFromISR( xLCDQueue, &xMessage, &xHigherPriorityTaskWoken ); + /* This is the interrupt handler for the joystick select button input. + * The button has been pushed, write a message to the LCD via the LCD task. */ + xQueueSendFromISR( xLCDQueue, &xMessage, &xHigherPriorityTaskWoken ); - P2IFG = 0; + P2IFG = 0; - /* If writing to xLCDQueue caused a task to unblock, and the unblocked task - has a priority equal to or above the task that this interrupt interrupted, - then lHigherPriorityTaskWoken will have been set to pdTRUE internally within - xQueuesendFromISR(), and portEND_SWITCHING_ISR() will ensure that this - interrupt returns directly to the higher priority unblocked task. */ - portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); + /* If writing to xLCDQueue caused a task to unblock, and the unblocked task + * has a priority equal to or above the task that this interrupt interrupted, + * then lHigherPriorityTaskWoken will have been set to pdTRUE internally within + * xQueuesendFromISR(), and portEND_SWITCHING_ISR() will ensure that this + * interrupt returns directly to the higher priority unblocked task. */ + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); } /*-----------------------------------------------------------*/ /* The MSP430X port uses this callback function to configure its tick interrupt. -This allows the application to choose the tick interrupt source. -configTICK_VECTOR must also be set in FreeRTOSConfig.h to the correct -interrupt vector for the chosen tick interrupt source. This implementation of -vApplicationSetupTimerInterrupt() generates the tick from timer A0, so in this -case configTICK_VECTOR is set to TIMER0_A0_VECTOR. */ + * This allows the application to choose the tick interrupt source. + * configTICK_VECTOR must also be set in FreeRTOSConfig.h to the correct + * interrupt vector for the chosen tick interrupt source. This implementation of + * vApplicationSetupTimerInterrupt() generates the tick from timer A0, so in this + * case configTICK_VECTOR is set to TIMER0_A0_VECTOR. */ void vApplicationSetupTimerInterrupt( void ) { -const unsigned short usACLK_Frequency_Hz = 32768; + const unsigned short usACLK_Frequency_Hz = 32768; - /* Ensure the timer is stopped. */ - TA0CTL = 0; + /* Ensure the timer is stopped. */ + TA0CTL = 0; - /* Run the timer from the ACLK. */ - TA0CTL = TASSEL_1; + /* Run the timer from the ACLK. */ + TA0CTL = TASSEL_1; - /* Clear everything to start with. */ - TA0CTL |= TACLR; + /* Clear everything to start with. */ + TA0CTL |= TACLR; - /* Set the compare match value according to the tick rate we want. */ - TA0CCR0 = usACLK_Frequency_Hz / configTICK_RATE_HZ; + /* Set the compare match value according to the tick rate we want. */ + TA0CCR0 = usACLK_Frequency_Hz / configTICK_RATE_HZ; - /* Enable the interrupts. */ - TA0CCTL0 = CCIE; + /* Enable the interrupts. */ + TA0CCTL0 = CCIE; - /* Start up clean. */ - TA0CTL |= TACLR; + /* Start up clean. */ + TA0CTL |= TACLR; - /* Up mode. */ - TA0CTL |= MC_1; + /* Up mode. */ + TA0CTL |= MC_1; } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* Called on each iteration of the idle task. In this case the idle task - just enters a low power mode. */ - __bis_SR_register( LPM3_bits + GIE ); + /* Called on each iteration of the idle task. In this case the idle task + * just enters a low power mode. */ + __bis_SR_register( LPM3_bits + GIE ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues or - semaphores. */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues or + * semaphores. */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pxTask; - ( void ) pcTaskName; - - /* Run time stack overflow checking is performed if - configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook - function is called if a stack overflow is detected. */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + ( void ) pxTask; + ( void ) pcTaskName; + + /* Run time stack overflow checking is performed if + * configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook + * function is called if a stack overflow is detected. */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/serial.c b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/serial.c index b17fc219c14..92639362262 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/serial.c +++ b/FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/Blinky_Demo/main_blinky.c index f16d5d19283..87c0ed900ac 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/FreeRTOSConfig.h b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/FreeRTOSConfig.h index d45e2070d6a..710c99fe620 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/Full_Demo/main_full.c b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/Full_Demo/main_full.c index 148f04a685b..c5a77bd9868 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/Full_Demo/serial.c b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/Full_Demo/serial.c index 98548dba1df..a2cfe135510 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/Full_Demo/serial.c +++ b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/Full_Demo/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/LEDs.c b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/LEDs.c index 7eae5874bc1..98a3a5ca6d1 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/LEDs.c +++ b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/LEDs.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/main.c b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/main.c index 572b8660254..06aca95ba00 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/main.c +++ b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -47,7 +47,7 @@ #include "semphr.h" /* Standard demo includes, used so the tick hook can exercise some FreeRTOS -functionality in an interrupt. */ + * functionality in an interrupt. */ #include "EventGroupsDemo.h" #include "TaskNotify.h" #include "ParTest.h" /* LEDs - a historic name for "Parallel Port". */ @@ -56,8 +56,8 @@ functionality in an interrupt. */ #include "driverlib.h" /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 /*-----------------------------------------------------------*/ @@ -70,26 +70,27 @@ static void prvSetupHardware( void ); * 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. */ -#if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - extern void main_blinky( void ); +#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + extern void main_blinky( void ); #else - extern void main_full( void ); + extern void main_full( void ); #endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */ /* Prototypes for the standard FreeRTOS callback/hook functions implemented -within this file. */ + * within this file. */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /* The heap is allocated here so the "persistent" qualifier can be used. This -requires configAPPLICATION_ALLOCATED_HEAP to be set to 1 in FreeRTOSConfig.h. -See http://www.freertos.org/a00111.html for more information. */ + * requires configAPPLICATION_ALLOCATED_HEAP to be set to 1 in FreeRTOSConfig.h. + * See http://www.freertos.org/a00111.html for more information. */ #ifdef __ICC430__ - __persistent /* IAR version. */ + __persistent /* IAR version. */ #else - #pragma PERSISTENT( ucHeap ) /* CCS version. */ + #pragma PERSISTENT( ucHeap ) /* CCS version. */ #endif uint8_t ucHeap[ configTOTAL_HEAP_SIZE ] = { 0 }; @@ -97,52 +98,53 @@ uint8_t ucHeap[ configTOTAL_HEAP_SIZE ] = { 0 }; int main( void ) { - /* See http://www.FreeRTOS.org/MSP430FR5969_Free_RTOS_Demo.html */ - - /* Configure the hardware ready to run the demo. */ - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* See http://www.FreeRTOS.org/MSP430FR5969_Free_RTOS_Demo.html */ + + /* Configure the hardware ready to run the demo. */ + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ - - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Called if a call to pvPortMalloc() fails because there is insufficient + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ + + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; + ( void ) pcTaskName; + ( void ) pxTask; - /* 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. - See http://www.freertos.org/Stacks-and-stack-overflow-checking.html */ + /* 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. + * See http://www.freertos.org/Stacks-and-stack-overflow-checking.html */ - /* Force an assert. */ - configASSERT( ( volatile void * ) NULL ); + /* Force an assert. */ + configASSERT( ( volatile void * ) NULL ); } /*-----------------------------------------------------------*/ @@ -155,48 +157,48 @@ void vApplicationIdleHook( void ) void vApplicationTickHook( void ) { - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 ) - { - /* Call the periodic event group from ISR demo. */ - vPeriodicEventGroupsProcessing(); - - /* Call the code that 'gives' a task notification from an ISR. */ - xNotifyTaskFromISR(); - } - #endif + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 ) + { + /* Call the periodic event group from ISR demo. */ + vPeriodicEventGroupsProcessing(); + + /* Call the code that 'gives' a task notification from an ISR. */ + xNotifyTaskFromISR(); + } + #endif } /*-----------------------------------------------------------*/ /* The MSP430X port uses this callback function to configure its tick interrupt. -This allows the application to choose the tick interrupt source. -configTICK_VECTOR must also be set in FreeRTOSConfig.h to the correct -interrupt vector for the chosen tick interrupt source. This implementation of -vApplicationSetupTimerInterrupt() generates the tick from timer A0, so in this -case configTICK_VECTOR is set to TIMER0_A0_VECTOR. */ + * This allows the application to choose the tick interrupt source. + * configTICK_VECTOR must also be set in FreeRTOSConfig.h to the correct + * interrupt vector for the chosen tick interrupt source. This implementation of + * vApplicationSetupTimerInterrupt() generates the tick from timer A0, so in this + * case configTICK_VECTOR is set to TIMER0_A0_VECTOR. */ void vApplicationSetupTimerInterrupt( void ) { -const unsigned short usACLK_Frequency_Hz = 32768; + const unsigned short usACLK_Frequency_Hz = 32768; - /* Ensure the timer is stopped. */ - TA0CTL = 0; + /* Ensure the timer is stopped. */ + TA0CTL = 0; - /* Run the timer from the ACLK. */ - TA0CTL = TASSEL_1; + /* Run the timer from the ACLK. */ + TA0CTL = TASSEL_1; - /* Clear everything to start with. */ - TA0CTL |= TACLR; + /* Clear everything to start with. */ + TA0CTL |= TACLR; - /* Set the compare match value according to the tick rate we want. */ - TA0CCR0 = usACLK_Frequency_Hz / configTICK_RATE_HZ; + /* Set the compare match value according to the tick rate we want. */ + TA0CCR0 = usACLK_Frequency_Hz / configTICK_RATE_HZ; - /* Enable the interrupts. */ - TA0CCTL0 = CCIE; + /* Enable the interrupts. */ + TA0CCTL0 = CCIE; - /* Start up clean. */ - TA0CTL |= TACLR; + /* Start up clean. */ + TA0CTL |= TACLR; - /* Up mode. */ - TA0CTL |= MC_1; + /* Up mode. */ + TA0CTL |= MC_1; } /*-----------------------------------------------------------*/ @@ -205,47 +207,47 @@ static void prvSetupHardware( void ) /* Stop Watchdog timer. */ WDT_A_hold( __MSP430_BASEADDRESS_WDT_A__ ); - /* Set all GPIO pins to output and low. */ - GPIO_setOutputLowOnPin( GPIO_PORT_P1, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 ); - GPIO_setOutputLowOnPin( GPIO_PORT_P2, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 ); - GPIO_setOutputLowOnPin( GPIO_PORT_P3, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 ); - GPIO_setOutputLowOnPin( GPIO_PORT_P4, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 ); - GPIO_setOutputLowOnPin( GPIO_PORT_PJ, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 | GPIO_PIN8 | GPIO_PIN9 | GPIO_PIN10 | GPIO_PIN11 | GPIO_PIN12 | GPIO_PIN13 | GPIO_PIN14 | GPIO_PIN15 ); - GPIO_setAsOutputPin( GPIO_PORT_P1, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 ); - GPIO_setAsOutputPin( GPIO_PORT_P2, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 ); - GPIO_setAsOutputPin( GPIO_PORT_P3, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 ); - GPIO_setAsOutputPin( GPIO_PORT_P4, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 ); - GPIO_setAsOutputPin( GPIO_PORT_PJ, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 | GPIO_PIN8 | GPIO_PIN9 | GPIO_PIN10 | GPIO_PIN11 | GPIO_PIN12 | GPIO_PIN13 | GPIO_PIN14 | GPIO_PIN15 ); + /* Set all GPIO pins to output and low. */ + GPIO_setOutputLowOnPin( GPIO_PORT_P1, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 ); + GPIO_setOutputLowOnPin( GPIO_PORT_P2, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 ); + GPIO_setOutputLowOnPin( GPIO_PORT_P3, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 ); + GPIO_setOutputLowOnPin( GPIO_PORT_P4, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 ); + GPIO_setOutputLowOnPin( GPIO_PORT_PJ, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 | GPIO_PIN8 | GPIO_PIN9 | GPIO_PIN10 | GPIO_PIN11 | GPIO_PIN12 | GPIO_PIN13 | GPIO_PIN14 | GPIO_PIN15 ); + GPIO_setAsOutputPin( GPIO_PORT_P1, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 ); + GPIO_setAsOutputPin( GPIO_PORT_P2, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 ); + GPIO_setAsOutputPin( GPIO_PORT_P3, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 ); + GPIO_setAsOutputPin( GPIO_PORT_P4, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 ); + GPIO_setAsOutputPin( GPIO_PORT_PJ, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 | GPIO_PIN8 | GPIO_PIN9 | GPIO_PIN10 | GPIO_PIN11 | GPIO_PIN12 | GPIO_PIN13 | GPIO_PIN14 | GPIO_PIN15 ); - /* Configure P2.0 - UCA0TXD and P2.1 - UCA0RXD. */ - GPIO_setOutputLowOnPin( GPIO_PORT_P2, GPIO_PIN0 ); - GPIO_setAsOutputPin( GPIO_PORT_P2, GPIO_PIN0 ); - GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_P2, GPIO_PIN1, GPIO_SECONDARY_MODULE_FUNCTION ); - GPIO_setAsPeripheralModuleFunctionOutputPin( GPIO_PORT_P2, GPIO_PIN0, GPIO_SECONDARY_MODULE_FUNCTION ); + /* Configure P2.0 - UCA0TXD and P2.1 - UCA0RXD. */ + GPIO_setOutputLowOnPin( GPIO_PORT_P2, GPIO_PIN0 ); + GPIO_setAsOutputPin( GPIO_PORT_P2, GPIO_PIN0 ); + GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_P2, GPIO_PIN1, GPIO_SECONDARY_MODULE_FUNCTION ); + GPIO_setAsPeripheralModuleFunctionOutputPin( GPIO_PORT_P2, GPIO_PIN0, GPIO_SECONDARY_MODULE_FUNCTION ); - /* Set PJ.4 and PJ.5 for LFXT. */ - GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_PJ, GPIO_PIN4 + GPIO_PIN5, GPIO_PRIMARY_MODULE_FUNCTION ); + /* Set PJ.4 and PJ.5 for LFXT. */ + GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_PJ, GPIO_PIN4 + GPIO_PIN5, GPIO_PRIMARY_MODULE_FUNCTION ); - /* Set DCO frequency to 8 MHz. */ - CS_setDCOFreq( CS_DCORSEL_0, CS_DCOFSEL_6 ); + /* Set DCO frequency to 8 MHz. */ + CS_setDCOFreq( CS_DCORSEL_0, CS_DCOFSEL_6 ); - /* Set external clock frequency to 32.768 KHz. */ - CS_setExternalClockSource( 32768, 0 ); + /* Set external clock frequency to 32.768 KHz. */ + CS_setExternalClockSource( 32768, 0 ); - /* Set ACLK = LFXT. */ - CS_initClockSignal( CS_ACLK, CS_LFXTCLK_SELECT, CS_CLOCK_DIVIDER_1 ); + /* Set ACLK = LFXT. */ + CS_initClockSignal( CS_ACLK, CS_LFXTCLK_SELECT, CS_CLOCK_DIVIDER_1 ); - /* Set SMCLK = DCO with frequency divider of 1. */ - CS_initClockSignal( CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 ); + /* Set SMCLK = DCO with frequency divider of 1. */ + CS_initClockSignal( CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 ); - /* Set MCLK = DCO with frequency divider of 1. */ - CS_initClockSignal( CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 ); + /* Set MCLK = DCO with frequency divider of 1. */ + CS_initClockSignal( CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 ); - /* Start XT1 with no time out. */ - CS_turnOnLFXT( CS_LFXT_DRIVE_0 ); + /* Start XT1 with no time out. */ + CS_turnOnLFXT( CS_LFXT_DRIVE_0 ); - /* Disable the GPIO power-on default high-impedance mode. */ - PMM_unlockLPM5(); + /* Disable the GPIO power-on default high-impedance mode. */ + PMM_unlockLPM5(); } /*-----------------------------------------------------------*/ @@ -257,5 +259,3 @@ int _system_pre_init( void ) /* Return 1 for segments to be initialised. */ return 1; } - - diff --git a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/main.h b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/main.h index 9b4a38c443f..844ecb61084 100644 --- a/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/main.h +++ b/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/main.h @@ -29,6 +29,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * --/COPYRIGHT--*/ + /******************************************************************************* * * main.h @@ -44,21 +45,21 @@ #ifndef OUTOFBOX_FR5969_NEWD_MAIN_H_ #define OUTOFBOX_FR5969_NEWD_MAIN_H_ -#define CAL_ADC_12T30_L *(int8_t *)(0x1A1E) // Temperature Sensor Calibration-30 C 2.0V ref -#define CAL_ADC_12T30_H *(int8_t *)(0x1A1F) -#define CAL_ADC_12T85_L *(int8_t *)(0x1A20) // Temperature Sensor Calibration-85 C 2.0V ref -#define CAL_ADC_12T85_H *(int8_t *)(0x1A21) +#define CAL_ADC_12T30_L *( int8_t * ) ( 0x1A1E ) /* Temperature Sensor Calibration-30 C 2.0V ref */ +#define CAL_ADC_12T30_H *( int8_t * ) ( 0x1A1F ) +#define CAL_ADC_12T85_L *( int8_t * ) ( 0x1A20 ) /* Temperature Sensor Calibration-85 C 2.0V ref */ +#define CAL_ADC_12T85_H *( int8_t * ) ( 0x1A21 ) extern int mode; extern int pingHost; -void Init_GPIO(void); -void Init_Clock(void); -void Init_UART(void); -void Init_RTC(void); -void sendCalibrationConstants(void); -void sendTimeStamp(void); -void sendAckToPC(void); -void enterLPM35(void); +void Init_GPIO( void ); +void Init_Clock( void ); +void Init_UART( void ); +void Init_RTC( void ); +void sendCalibrationConstants( void ); +void sendTimeStamp( void ); +void sendAckToPC( void ); +void enterLPM35( void ); #endif /* OUTOFBOX_FR5969_NEWD_MAIN_H_ */ diff --git a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/Blinky_Demo/main_blinky.c index caf1e0d105f..d04883aa885 100644 --- a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/FreeRTOSConfig.h b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/FreeRTOSConfig.h index 9e358d88a49..1a324d32695 100644 --- a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/Full_Demo/main_full.c b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/Full_Demo/main_full.c index 6f59523b8e5..e2b0441affb 100644 --- a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/LEDs.c b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/LEDs.c index c0895d545a8..f8e6269a91c 100644 --- a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/LEDs.c +++ b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/LEDs.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/lwIP_Demo/lwIP_Apps/apps/BasicSocketCommandServer/BasicSocketCommandServer.c b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/lwIP_Demo/lwIP_Apps/apps/BasicSocketCommandServer/BasicSocketCommandServer.c index 4f2e18ff6ae..04a9ce8b090 100644 --- a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/lwIP_Demo/lwIP_Apps/apps/BasicSocketCommandServer/BasicSocketCommandServer.c +++ b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/lwIP_Demo/lwIP_Apps/apps/BasicSocketCommandServer/BasicSocketCommandServer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/lwIP_Demo/lwIP_Apps/lwIP_Apps.c b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/lwIP_Demo/lwIP_Apps/lwIP_Apps.c index 456563d9efb..91889659bf5 100644 --- a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/lwIP_Demo/lwIP_Apps/lwIP_Apps.c +++ b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/lwIP_Demo/lwIP_Apps/lwIP_Apps.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/lwIP_Demo/lwIP_Apps/lwIP_Apps.h b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/lwIP_Demo/lwIP_Apps/lwIP_Apps.h index 0c7e833879d..678e49232ac 100644 --- a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/lwIP_Demo/lwIP_Apps/lwIP_Apps.h +++ b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/lwIP_Demo/lwIP_Apps/lwIP_Apps.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/lwIP_Demo/main_lwIP.c b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/lwIP_Demo/main_lwIP.c index 12aeeb25085..ffae78308c9 100644 --- a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/lwIP_Demo/main_lwIP.c +++ b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/lwIP_Demo/main_lwIP.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/main.c b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/main.c index 2f03b1817e2..685fb3079b4 100644 --- a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/main.c +++ b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/serial.c b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/serial.c index 9806b3db3c2..4301cdfe837 100644 --- a/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/serial.c +++ b/FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/NEC_78K0R_IAR/ButtonTask.c b/FreeRTOS/Demo/NEC_78K0R_IAR/ButtonTask.c index 8f134bdcbee..638623f1833 100644 --- a/FreeRTOS/Demo/NEC_78K0R_IAR/ButtonTask.c +++ b/FreeRTOS/Demo/NEC_78K0R_IAR/ButtonTask.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/NEC_78K0R_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/NEC_78K0R_IAR/FreeRTOSConfig.h index 408f01d3138..a0f3f575fa8 100644 --- a/FreeRTOS/Demo/NEC_78K0R_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/NEC_78K0R_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/NEC_78K0R_IAR/main.c b/FreeRTOS/Demo/NEC_78K0R_IAR/main.c index b76c1f58beb..0d1ea334d71 100644 --- a/FreeRTOS/Demo/NEC_78K0R_IAR/main.c +++ b/FreeRTOS/Demo/NEC_78K0R_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -71,22 +71,22 @@ * Priority definitions for most of the tasks in the demo application. Some * tasks just use the idle priority. */ -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainSEMTEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBUTTON_PRIORITY ( configMAX_PRIORITIES - 1 ) -#define mainGEN_QUEUE_PRIORITY ( tskIDLE_PRIORITY ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainSEMTEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBUTTON_PRIORITY ( configMAX_PRIORITIES - 1 ) +#define mainGEN_QUEUE_PRIORITY ( tskIDLE_PRIORITY ) /* The period between executions of the check task. */ -#define mainNO_ERROR_TOGGLE_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) -#define mainERROR_TOGGLE_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) +#define mainNO_ERROR_TOGGLE_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainERROR_TOGGLE_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) /* The LED toggled by the check task. */ -#define mainLED_0 P7_bit.no6 +#define mainLED_0 P7_bit.no6 /* A value that is passed in as the parameter to the 'check' task. This is done -purely to check that the parameter passing mechanism is functioning correctly. */ -#define mainCHECK_PARAMETER_VALUE ( 0x5678 ) + * purely to check that the parameter passing mechanism is functioning correctly. */ +#define mainCHECK_PARAMETER_VALUE ( 0x5678 ) /*-----------------------------------------------------------*/ @@ -94,45 +94,45 @@ purely to check that the parameter passing mechanism is functioning correctly. * * The function that defines the 'check' task as described at the top of this * file. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * This function is called from the C startup routine to setup the processor - * in particular the clock source. */ -int __low_level_init(void); +int __low_level_init( void ); /* * Functions that define the RegTest tasks as described at the top of this file. */ -extern void vRegTest1( void *pvParameters ); -extern void vRegTest2( void *pvParameters ); +extern void vRegTest1( void * pvParameters ); +extern void vRegTest2( void * pvParameters ); /* * Function that defines the button push task as described at the top of this * file. */ -extern void vButtonTask( void *pvParameters ); +extern void vButtonTask( void * pvParameters ); /*-----------------------------------------------------------*/ /* If an error is discovered by one of the RegTest tasks then this flag is set -to pdFAIL. The 'check' task then inspects this flag to detect errors within -the RegTest tasks. */ + * to pdFAIL. The 'check' task then inspects this flag to detect errors within + * the RegTest tasks. */ static short sRegTestStatus = pdPASS; /* 78K0R Option Byte Definition. Watchdog disabled, LVI enabled, OCD interface -enabled. */ -__root __far const unsigned char OptionByte[] @ 0x00C0 = + * enabled. */ +__root __far const unsigned char OptionByte[] @0x00C0 = { - WATCHDOG_DISABLED, LVI_ENABLED, RESERVED_FF, OCD_ENABLED + WATCHDOG_DISABLED, LVI_ENABLED, RESERVED_FF, OCD_ENABLED }; /* Security byte definition */ -__root __far const unsigned char SecuIDCode[] @ 0x00C4 = +__root __far const unsigned char SecuIDCode[] @0x00C4 = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; @@ -140,234 +140,241 @@ __root __far const unsigned char SecuIDCode[] @ 0x00C4 = short main( void ) { - /* Creates all the tasks, then starts the scheduler. */ - - /* First create the 'standard demo' tasks. These are used to demonstrate - API functions being used and also to test the kernel port. More information - is provided on the FreeRTOS.org WEB site. */ - vStartDynamicPriorityTasks(); - - /* Create the RegTest tasks as described at the top of this file. */ - xTaskCreate( vRegTest1, "Reg1", configMINIMAL_STACK_SIZE, NULL, 0, NULL ); - xTaskCreate( vRegTest2, "Reg2", configMINIMAL_STACK_SIZE, NULL, 0, NULL ); - - /* Create the button push task as described at the top of this file. */ - xTaskCreate( vButtonTask, "Button", configMINIMAL_STACK_SIZE, NULL, mainBUTTON_PRIORITY, NULL ); - - /* Create the 'check' task as described at the top of this file. */ - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, ( void* )mainCHECK_PARAMETER_VALUE, mainCHECK_TASK_PRIORITY, NULL ); - - #ifdef __IAR_78K0R_Kx3__ - { - /* The Kx3 has enough RAM to create more of the standard demo tasks. */ - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartSemaphoreTasks(mainSEMTEST_PRIORITY); - vStartGenericQueueTasks( mainGEN_QUEUE_PRIORITY ); - vCreateBlockTimeTasks(); - } - #endif - - /* Finally start the scheduler running. */ - vTaskStartScheduler(); - - /* If this line is reached then vTaskStartScheduler() returned because there - was insufficient heap memory remaining for the idle task to be created. */ - for( ;; ); + /* Creates all the tasks, then starts the scheduler. */ + + /* First create the 'standard demo' tasks. These are used to demonstrate + * API functions being used and also to test the kernel port. More information + * is provided on the FreeRTOS.org WEB site. */ + vStartDynamicPriorityTasks(); + + /* Create the RegTest tasks as described at the top of this file. */ + xTaskCreate( vRegTest1, "Reg1", configMINIMAL_STACK_SIZE, NULL, 0, NULL ); + xTaskCreate( vRegTest2, "Reg2", configMINIMAL_STACK_SIZE, NULL, 0, NULL ); + + /* Create the button push task as described at the top of this file. */ + xTaskCreate( vButtonTask, "Button", configMINIMAL_STACK_SIZE, NULL, mainBUTTON_PRIORITY, NULL ); + + /* Create the 'check' task as described at the top of this file. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, ( void * ) mainCHECK_PARAMETER_VALUE, mainCHECK_TASK_PRIORITY, NULL ); + + #ifdef __IAR_78K0R_Kx3__ + { + /* The Kx3 has enough RAM to create more of the standard demo tasks. */ + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartSemaphoreTasks( mainSEMTEST_PRIORITY ); + vStartGenericQueueTasks( mainGEN_QUEUE_PRIORITY ); + vCreateBlockTimeTasks(); + } + #endif + + /* Finally start the scheduler running. */ + vTaskStartScheduler(); + + /* If this line is reached then vTaskStartScheduler() returned because there + * was insufficient heap memory remaining for the idle task to be created. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -TickType_t xToggleRate = mainNO_ERROR_TOGGLE_PERIOD, xLastWakeTime; - - /* Ensure the parameter was passed in as expected. This is just a test of - the kernel port, the parameter is not actually used for anything. The - pointer will only actually be either 3 or 2 bytes, depending on the memory - model. */ - if( pvParameters != ( void * ) mainCHECK_PARAMETER_VALUE ) - { - xToggleRate = mainERROR_TOGGLE_PERIOD; - } - - /* Initialise xLastWakeTime before it is used. After this point it is not - written to directly. */ - xLastWakeTime = xTaskGetTickCount(); - - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. */ - for( ;; ) - { - /* Wait until it is time to check all the other tasks again. */ - vTaskDelayUntil( &xLastWakeTime, xToggleRate ); - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - xToggleRate = mainERROR_TOGGLE_PERIOD; - } - - if( sRegTestStatus != pdPASS ) - { - xToggleRate = mainERROR_TOGGLE_PERIOD; - } - - #ifdef __IAR_78K0R_Kx3__ - { - /* Only the Kx3 runs all the tasks. */ - if( xArePollingQueuesStillRunning() != pdTRUE) - { - xToggleRate = mainERROR_TOGGLE_PERIOD; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE) - { - xToggleRate = mainERROR_TOGGLE_PERIOD; - } - - if( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - xToggleRate = mainERROR_TOGGLE_PERIOD; - } - - if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - xToggleRate = mainERROR_TOGGLE_PERIOD; - } - } - #endif - - /* Toggle the LED. The toggle rate will depend on whether or not an - error has been found in any tasks. */ - mainLED_0 = !mainLED_0; - } + TickType_t xToggleRate = mainNO_ERROR_TOGGLE_PERIOD, xLastWakeTime; + + /* Ensure the parameter was passed in as expected. This is just a test of + * the kernel port, the parameter is not actually used for anything. The + * pointer will only actually be either 3 or 2 bytes, depending on the memory + * model. */ + if( pvParameters != ( void * ) mainCHECK_PARAMETER_VALUE ) + { + xToggleRate = mainERROR_TOGGLE_PERIOD; + } + + /* Initialise xLastWakeTime before it is used. After this point it is not + * written to directly. */ + xLastWakeTime = xTaskGetTickCount(); + + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. */ + for( ; ; ) + { + /* Wait until it is time to check all the other tasks again. */ + vTaskDelayUntil( &xLastWakeTime, xToggleRate ); + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + xToggleRate = mainERROR_TOGGLE_PERIOD; + } + + if( sRegTestStatus != pdPASS ) + { + xToggleRate = mainERROR_TOGGLE_PERIOD; + } + + #ifdef __IAR_78K0R_Kx3__ + { + /* Only the Kx3 runs all the tasks. */ + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + xToggleRate = mainERROR_TOGGLE_PERIOD; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + xToggleRate = mainERROR_TOGGLE_PERIOD; + } + + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + xToggleRate = mainERROR_TOGGLE_PERIOD; + } + + if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + xToggleRate = mainERROR_TOGGLE_PERIOD; + } + } + #endif /* ifdef __IAR_78K0R_Kx3__ */ + + /* Toggle the LED. The toggle rate will depend on whether or not an + * error has been found in any tasks. */ + mainLED_0 = !mainLED_0; + } } /*-----------------------------------------------------------*/ -int __low_level_init(void) +int __low_level_init( void ) { -unsigned char ucResetFlag = RESF; - - portDISABLE_INTERRUPTS(); - - /* Clock Configuration: - In this port, to use the internal high speed clock source of the microcontroller - define the configCLOCK_SOURCE as 1 in FreeRTOSConfig.h. To use an external - clock define configCLOCK_SOURCE as 0. */ - #if configCLOCK_SOURCE == 1 - { - /* Set XT1 and XT2 in Input Port Mode - Set X1 and X2 in Input Port Mode - High speed oscillator frequency 2MHz <= fMX <= 10MHz */ - CMC = 0x00; - - /* X1 external oszillation stopped. */ - MSTOP = 1; - - /* Enable internal high speed oszillation. */ - HIOSTOP = 0; - MCM0 = 0; - - /* Stop internal subsystem clock. */ - XTSTOP = 1; - - /* Set clock speed. */ - CSS = 0; - CKC &= (unsigned char)~0x07; - CKC |= 0x00; - } - #else - { - /* XT1 and XT2 pin in input port mode - X1 and X2 pin in crystal resonator mode - High speed oszillation frequency 10MHz < fMX <= 20MHz */ - CMC = 0x41; - - /* Set oscillation stabilization time. */ - OSTS = 0x07; - - /* Set speed mode: fMX > 10MHz for Flash memory high speed operation. */ - OSMC = 0x01; - - /* Start up X1 oscillator operation - Internal high-speed oscillator operating. */ - MSTOP = 0; - - /* Check oscillation stabilization time status. */ - while(OSTC < 0x07) - { - /* Wait until X1 clock stabilization time. */ - portNOP(); - } - - /* Switch CPU clock to X1 oscillator. */ - MCM0 = 1; - while(MCS != 1) - { - /* Wait until CPU and peripherals operate with fX1 clock. */ - portNOP(); - } - - /* Stop the internal high-speed oscillator operation. */ - HIOSTOP = 1; - - /* Stop the XT1 oscillator operation. */ - XTSTOP = 1; - - /* Operating frequency f = fx - Change clock generator setting, if necessary. */ - CKC &= 0xF8; - - /* From here onwards the X1 oscillator is supplied to the CPU. */ - } - #endif - - /* LED port initialization - set port register. */ - P7 = 0x80; - - /* Set port mode register. */ - PM7 = 0x3F; - - /* Switch pin initialization - enable pull-up resistor. */ - PU12_bit.no0 = 1; - - /* INTP0 is used by the button on the target board. */ - - /* INTP0 disable. */ - PMK0 = 1; - - /* INTP0 IF clear. */ - PIF0 = 0; - EGN0_bit.no0 = 1; - - /* INTP0 priority low. */ - PPR10 = 0; - PPR00 = 1; - - /* Enable ext. INTP0 interrupt */ - PMK0 = 0; - - return pdTRUE; + unsigned char ucResetFlag = RESF; + + portDISABLE_INTERRUPTS(); + + /* Clock Configuration: + * In this port, to use the internal high speed clock source of the microcontroller + * define the configCLOCK_SOURCE as 1 in FreeRTOSConfig.h. To use an external + * clock define configCLOCK_SOURCE as 0. */ + #if configCLOCK_SOURCE == 1 + { + /* Set XT1 and XT2 in Input Port Mode + * Set X1 and X2 in Input Port Mode + * High speed oscillator frequency 2MHz <= fMX <= 10MHz */ + CMC = 0x00; + + /* X1 external oszillation stopped. */ + MSTOP = 1; + + /* Enable internal high speed oszillation. */ + HIOSTOP = 0; + MCM0 = 0; + + /* Stop internal subsystem clock. */ + XTSTOP = 1; + + /* Set clock speed. */ + CSS = 0; + CKC &= ( unsigned char ) ~0x07; + CKC |= 0x00; + } + #else /* if configCLOCK_SOURCE == 1 */ + { + /* XT1 and XT2 pin in input port mode + * X1 and X2 pin in crystal resonator mode + * High speed oszillation frequency 10MHz < fMX <= 20MHz */ + CMC = 0x41; + + /* Set oscillation stabilization time. */ + OSTS = 0x07; + + /* Set speed mode: fMX > 10MHz for Flash memory high speed operation. */ + OSMC = 0x01; + + /* Start up X1 oscillator operation + * Internal high-speed oscillator operating. */ + MSTOP = 0; + + /* Check oscillation stabilization time status. */ + while( OSTC < 0x07 ) + { + /* Wait until X1 clock stabilization time. */ + portNOP(); + } + + /* Switch CPU clock to X1 oscillator. */ + MCM0 = 1; + + while( MCS != 1 ) + { + /* Wait until CPU and peripherals operate with fX1 clock. */ + portNOP(); + } + + /* Stop the internal high-speed oscillator operation. */ + HIOSTOP = 1; + + /* Stop the XT1 oscillator operation. */ + XTSTOP = 1; + + /* Operating frequency f = fx + * Change clock generator setting, if necessary. */ + CKC &= 0xF8; + + /* From here onwards the X1 oscillator is supplied to the CPU. */ + } + #endif /* if configCLOCK_SOURCE == 1 */ + + /* LED port initialization - set port register. */ + P7 = 0x80; + + /* Set port mode register. */ + PM7 = 0x3F; + + /* Switch pin initialization - enable pull-up resistor. */ + PU12_bit.no0 = 1; + + /* INTP0 is used by the button on the target board. */ + + /* INTP0 disable. */ + PMK0 = 1; + + /* INTP0 IF clear. */ + PIF0 = 0; + EGN0_bit.no0 = 1; + + /* INTP0 priority low. */ + PPR10 = 0; + PPR00 = 1; + + /* Enable ext. INTP0 interrupt */ + PMK0 = 0; + + return pdTRUE; } /*-----------------------------------------------------------*/ void vRegTestError( void ) { - /* Called by the RegTest tasks if an error is found. lRegTestStatus is - inspected by the check task. */ - sRegTestStatus = pdFAIL; - - /* Do not return from here as the reg test tasks clobber all registers so - function calls may not function correctly. */ - for( ;; ); + /* Called by the RegTest tasks if an error is found. lRegTestStatus is + * inspected by the check task. */ + sRegTestStatus = pdFAIL; + + /* Do not return from here as the reg test tasks clobber all registers so + * function calls may not function correctly. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t xTask, + char * pcTaskName ) { - ( void ) xTask; - ( void ) pcTaskName; - - /* This will get called if an overflow is detected in the stack of a task. - Inspect pxCurrentTCB to see which was the offending task. */ - for( ;; ); + ( void ) xTask; + ( void ) pcTaskName; + + /* This will get called if an overflow is detected in the stack of a task. + * Inspect pxCurrentTCB to see which was the offending task. */ + for( ; ; ) + { + } } - diff --git a/FreeRTOS/Demo/NEC_V850ES_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/NEC_V850ES_IAR/FreeRTOSConfig.h index 01c8dd0ef68..7a0366c8c5c 100644 --- a/FreeRTOS/Demo/NEC_V850ES_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/NEC_V850ES_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit.c b/FreeRTOS/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit.c index d4b0040f1f4..0d3435f503f 100644 --- a/FreeRTOS/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit.c +++ b/FreeRTOS/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit_Fx3.c b/FreeRTOS/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit_Fx3.c index 4aacf6e2284..12582043350 100644 --- a/FreeRTOS/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit_Fx3.c +++ b/FreeRTOS/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit_Fx3.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit_Hx2.c b/FreeRTOS/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit_Hx2.c index b6059874e8a..78d462a8b70 100644 --- a/FreeRTOS/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit_Hx2.c +++ b/FreeRTOS/Demo/NEC_V850ES_IAR/LowLevelInit/LowLevelInit_Hx2.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/NEC_V850ES_IAR/ParTest/ParTest_Fx3_App_Board.c b/FreeRTOS/Demo/NEC_V850ES_IAR/ParTest/ParTest_Fx3_App_Board.c index 9aa0013de78..a3128d63dab 100644 --- a/FreeRTOS/Demo/NEC_V850ES_IAR/ParTest/ParTest_Fx3_App_Board.c +++ b/FreeRTOS/Demo/NEC_V850ES_IAR/ParTest/ParTest_Fx3_App_Board.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/NEC_V850ES_IAR/ParTest/ParTest_Generic_Target_Board.c b/FreeRTOS/Demo/NEC_V850ES_IAR/ParTest/ParTest_Generic_Target_Board.c index e8208a0f392..6ceb2bbd3b9 100644 --- a/FreeRTOS/Demo/NEC_V850ES_IAR/ParTest/ParTest_Generic_Target_Board.c +++ b/FreeRTOS/Demo/NEC_V850ES_IAR/ParTest/ParTest_Generic_Target_Board.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/NEC_V850ES_IAR/main.c b/FreeRTOS/Demo/NEC_V850ES_IAR/main.c index e8fd0297945..02ef558678a 100644 --- a/FreeRTOS/Demo/NEC_V850ES_IAR/main.c +++ b/FreeRTOS/Demo/NEC_V850ES_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -69,46 +69,46 @@ * Priority definitions for most of the tasks in the demo application. Some * tasks just use the idle priority. */ -#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainCOMTEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainCOMTEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* Passed into the check task just as a test that the parameter passing -mechanism is working correctly. */ -#define mainCHECK_PARAMETER ( ( void * ) 0x12345678 ) + * mechanism is working correctly. */ +#define mainCHECK_PARAMETER ( ( void * ) 0x12345678 ) /* The period between executions of the check task. */ -#define mainNO_ERROR_DELAY ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) -#define mainERROR_DELAY ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) +#define mainNO_ERROR_DELAY ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainERROR_DELAY ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) /* There are no spare LEDs for the comtest tasks, so this is just set to an -invalid number. */ -#define mainCOMTEST_LED ( 4 ) + * invalid number. */ +#define mainCOMTEST_LED ( 4 ) /* The baud rate used by the comtest task. */ -#define mainBAUD_RATE ( 9600 ) +#define mainBAUD_RATE ( 9600 ) /*-----------------------------------------------------------*/ /* The implementation of the 'check' task as described at the top of this file. */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); /* Just sets up the LED outputs. Most generic setup is done in -__low_level_init(). */ + * __low_level_init(). */ static void prvSetupHardware( void ); /* The RegTest functions as described at the top of this file. */ -extern void vRegTest1( void *pvParameters ); -extern void vRegTest2( void *pvParameters ); +extern void vRegTest1( void * pvParameters ); +extern void vRegTest2( void * pvParameters ); /* A variable that will get set to fail if a RegTest task finds an error. The -variable is inspected by the 'Check' task. */ + * variable is inspected by the 'Check' task. */ static volatile long lRegTestStatus = pdPASS; /*-----------------------------------------------------------*/ @@ -116,159 +116,166 @@ static volatile long lRegTestStatus = pdPASS; /* Create all the demo tasks then start the scheduler. */ void main( void ) { - /* Just sets up the LED outputs. */ - prvSetupHardware(); - - /* Standard demo tasks. */ - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); - vStartQueuePeekTasks(); - - /* Create the check task as described at the top of this file. */ - xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, mainCHECK_PARAMETER, mainCHECK_TASK_PRIORITY, NULL ); - - /* Create the RegTest tasks as described at the top of this file. */ - xTaskCreate( vRegTest1, "Reg1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - xTaskCreate( vRegTest2, "Reg2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - - #ifdef __IAR_V850ES_Fx3__ - { - /* The extra IO required for the com test and led flashing tasks is only - available on the application board, not the target boards. */ - vAltStartComTestTasks( mainCOMTEST_PRIORITY, mainBAUD_RATE, mainCOMTEST_LED ); - vStartLEDFlashTasks( mainFLASH_PRIORITY ); - - /* The Fx3 also has enough RAM to run loads more tasks. */ - vStartRecursiveMutexTasks(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - } - #endif - - /* The suicide tasks must be created last as they need to know how many - tasks were running prior to their creation in order to ascertain whether - or not the correct/expected number of tasks are running at any given time. */ + /* Just sets up the LED outputs. */ + prvSetupHardware(); + + /* Standard demo tasks. */ + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); + vStartQueuePeekTasks(); + + /* Create the check task as described at the top of this file. */ + xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, mainCHECK_PARAMETER, mainCHECK_TASK_PRIORITY, NULL ); + + /* Create the RegTest tasks as described at the top of this file. */ + xTaskCreate( vRegTest1, "Reg1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vRegTest2, "Reg2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + + #ifdef __IAR_V850ES_Fx3__ + { + /* The extra IO required for the com test and led flashing tasks is only + * available on the application board, not the target boards. */ + vAltStartComTestTasks( mainCOMTEST_PRIORITY, mainBAUD_RATE, mainCOMTEST_LED ); + vStartLEDFlashTasks( mainFLASH_PRIORITY ); + + /* The Fx3 also has enough RAM to run loads more tasks. */ + vStartRecursiveMutexTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + } + #endif /* ifdef __IAR_V850ES_Fx3__ */ + + /* The suicide tasks must be created last as they need to know how many + * tasks were running prior to their creation in order to ascertain whether + * or not the correct/expected number of tasks are running at any given time. */ vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - /* Start the scheduler. */ - vTaskStartScheduler(); + /* Start the scheduler. */ + vTaskStartScheduler(); - /* If this line is reached then vTaskStartScheduler() returned because there - was insufficient heap memory remaining for the idle task to be created. */ - for( ;; ); + /* If this line is reached then vTaskStartScheduler() returned because there + * was insufficient heap memory remaining for the idle task to be created. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvCheckTask( void *pvParameters ) +static void prvCheckTask( void * pvParameters ) { -TickType_t xDelayPeriod = mainNO_ERROR_DELAY, xLastWakeTime; -unsigned portBASE_TYPE uxLEDToUse = 0; - - /* Ensure parameter is passed in correctly. */ - if( pvParameters != mainCHECK_PARAMETER ) - { - xDelayPeriod = mainERROR_DELAY; - } - - /* Initialise xLastWakeTime before it is used. After this point it is not - written to directly. */ - xLastWakeTime = xTaskGetTickCount(); - - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. */ - for( ;; ) - { - /* Wait until it is time to check all the other tasks again. */ - vTaskDelayUntil( &xLastWakeTime, xDelayPeriod ); - - if( lRegTestStatus != pdPASS ) - { - xDelayPeriod = mainERROR_DELAY; - } - - if( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - xDelayPeriod = mainERROR_DELAY; - } - - if( xAreQueuePeekTasksStillRunning() != pdTRUE ) - { - xDelayPeriod = mainERROR_DELAY; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - xDelayPeriod = mainERROR_DELAY; - } - - if( xIsCreateTaskStillRunning() != pdTRUE ) - { - xDelayPeriod = mainERROR_DELAY; - } - - /* The Fx3 runs more tasks, so more checks are performed. */ - #ifdef __IAR_V850ES_Fx3__ - { - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - xDelayPeriod = mainERROR_DELAY; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - xDelayPeriod = mainERROR_DELAY; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - xDelayPeriod = mainERROR_DELAY; - } - - if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - xDelayPeriod = mainERROR_DELAY; - } - - /* The application board has more LEDs and uses the flash tasks - so the check task instead uses LED3 as LED3 is still spare. */ - uxLEDToUse = 3; - } - #endif - - /* Toggle the LED. The toggle rate will depend on whether or not an - error has been found in any tasks. */ - vParTestToggleLED( uxLEDToUse ); - } + TickType_t xDelayPeriod = mainNO_ERROR_DELAY, xLastWakeTime; + unsigned portBASE_TYPE uxLEDToUse = 0; + + /* Ensure parameter is passed in correctly. */ + if( pvParameters != mainCHECK_PARAMETER ) + { + xDelayPeriod = mainERROR_DELAY; + } + + /* Initialise xLastWakeTime before it is used. After this point it is not + * written to directly. */ + xLastWakeTime = xTaskGetTickCount(); + + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. */ + for( ; ; ) + { + /* Wait until it is time to check all the other tasks again. */ + vTaskDelayUntil( &xLastWakeTime, xDelayPeriod ); + + if( lRegTestStatus != pdPASS ) + { + xDelayPeriod = mainERROR_DELAY; + } + + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } + + if( xAreQueuePeekTasksStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } + + if( xIsCreateTaskStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } + + /* The Fx3 runs more tasks, so more checks are performed. */ + #ifdef __IAR_V850ES_Fx3__ + { + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } + + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } + + /* The application board has more LEDs and uses the flash tasks + * so the check task instead uses LED3 as LED3 is still spare. */ + uxLEDToUse = 3; + } + #endif /* ifdef __IAR_V850ES_Fx3__ */ + + /* Toggle the LED. The toggle rate will depend on whether or not an + * error has been found in any tasks. */ + vParTestToggleLED( uxLEDToUse ); + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Setup the LED outputs. */ - vParTestInitialise(); + /* Setup the LED outputs. */ + vParTestInitialise(); - /* Any additional hardware configuration can be added here. */ + /* Any additional hardware configuration can be added here. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t xTask, + char * pcTaskName ) { - ( void ) xTask; - ( void ) pcTaskName; - - /* This will be called if a task overflows its stack. pxCurrentTCB - can be inspected to see which is the offending task. */ - for( ;; ); + ( void ) xTask; + ( void ) pcTaskName; + + /* This will be called if a task overflows its stack. pxCurrentTCB + * can be inspected to see which is the offending task. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vRegTestFailed( void ) { - /* Called by the RegTest tasks if an error is found. lRegTestStatus is - inspected by the check task. */ - lRegTestStatus = pdFAIL; - - /* Do not return from here as the reg test tasks clobber all registers so - function calls may not function correctly. */ - for( ;; ); + /* Called by the RegTest tasks if an error is found. lRegTestStatus is + * inspected by the check task. */ + lRegTestStatus = pdFAIL; + + /* Do not return from here as the reg test tasks clobber all registers so + * function calls may not function correctly. */ + for( ; ; ) + { + } } diff --git a/FreeRTOS/Demo/NEC_V850ES_IAR/serial/serial.c b/FreeRTOS/Demo/NEC_V850ES_IAR/serial/serial.c index 741ccf063a8..2e6dcf8f96a 100644 --- a/FreeRTOS/Demo/NEC_V850ES_IAR/serial/serial.c +++ b/FreeRTOS/Demo/NEC_V850ES_IAR/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/NiosII_CycloneIII_DBC3C40_GCC/RTOSDemo/FreeRTOSConfig.h b/FreeRTOS/Demo/NiosII_CycloneIII_DBC3C40_GCC/RTOSDemo/FreeRTOSConfig.h index 1236de7bbd0..bb81a99aaf7 100644 --- a/FreeRTOS/Demo/NiosII_CycloneIII_DBC3C40_GCC/RTOSDemo/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/NiosII_CycloneIII_DBC3C40_GCC/RTOSDemo/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/NiosII_CycloneIII_DBC3C40_GCC/RTOSDemo/ParTest/ParTest.c b/FreeRTOS/Demo/NiosII_CycloneIII_DBC3C40_GCC/RTOSDemo/ParTest/ParTest.c index 26d75463010..4a25b731972 100644 --- a/FreeRTOS/Demo/NiosII_CycloneIII_DBC3C40_GCC/RTOSDemo/ParTest/ParTest.c +++ b/FreeRTOS/Demo/NiosII_CycloneIII_DBC3C40_GCC/RTOSDemo/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/NiosII_CycloneIII_DBC3C40_GCC/RTOSDemo/main.c b/FreeRTOS/Demo/NiosII_CycloneIII_DBC3C40_GCC/RTOSDemo/main.c index aa61f60ff65..f7b194f866b 100644 --- a/FreeRTOS/Demo/NiosII_CycloneIII_DBC3C40_GCC/RTOSDemo/main.c +++ b/FreeRTOS/Demo/NiosII_CycloneIII_DBC3C40_GCC/RTOSDemo/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/NiosII_CycloneIII_DBC3C40_GCC/RTOSDemo/serial.c b/FreeRTOS/Demo/NiosII_CycloneIII_DBC3C40_GCC/RTOSDemo/serial.c index 5b5730c9160..3e2795803c8 100644 --- a/FreeRTOS/Demo/NiosII_CycloneIII_DBC3C40_GCC/RTOSDemo/serial.c +++ b/FreeRTOS/Demo/NiosII_CycloneIII_DBC3C40_GCC/RTOSDemo/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_MPLAB/FreeRTOSConfig.h b/FreeRTOS/Demo/PIC18_MPLAB/FreeRTOSConfig.h index 42d7ccc5997..4b9e34f4a41 100644 --- a/FreeRTOS/Demo/PIC18_MPLAB/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/PIC18_MPLAB/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_MPLAB/ParTest/ParTest.c b/FreeRTOS/Demo/PIC18_MPLAB/ParTest/ParTest.c index 19904789890..d7b162a6d1c 100644 --- a/FreeRTOS/Demo/PIC18_MPLAB/ParTest/ParTest.c +++ b/FreeRTOS/Demo/PIC18_MPLAB/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_MPLAB/main1.c b/FreeRTOS/Demo/PIC18_MPLAB/main1.c index 0c61748e1f2..5b0a214c343 100644 --- a/FreeRTOS/Demo/PIC18_MPLAB/main1.c +++ b/FreeRTOS/Demo/PIC18_MPLAB/main1.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -59,11 +59,11 @@ */ /* -Changes from V2.0.0 - - + Delay periods are now specified using variables and constants of - TickType_t rather than unsigned long. -*/ + * Changes from V2.0.0 + * + + Delay periods are now specified using variables and constants of + + TickType_t rather than unsigned long. + */ /* Scheduler include files. */ #include "FreeRTOS.h" @@ -76,29 +76,29 @@ Changes from V2.0.0 #include "serial.h" /* The period between executions of the check task before and after an error -has been discovered. If an error has been discovered the check task runs -more frequently - increasing the LED flash rate. */ -#define mainNO_ERROR_CHECK_PERIOD ( ( TickType_t ) 1000 / portTICK_PERIOD_MS ) -#define mainERROR_CHECK_PERIOD ( ( TickType_t ) 100 / portTICK_PERIOD_MS ) + * has been discovered. If an error has been discovered the check task runs + * more frequently - increasing the LED flash rate. */ +#define mainNO_ERROR_CHECK_PERIOD ( ( TickType_t ) 1000 / portTICK_PERIOD_MS ) +#define mainERROR_CHECK_PERIOD ( ( TickType_t ) 100 / portTICK_PERIOD_MS ) /* Priority definitions for some of the tasks. Other tasks just use the idle -priority. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) + * priority. */ +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) /* The LED that is flashed by the check task. */ -#define mainCHECK_TASK_LED ( 0 ) +#define mainCHECK_TASK_LED ( 0 ) /* Constants required for the communications. Only one character is ever -transmitted. */ -#define mainCOMMS_QUEUE_LENGTH ( 5 ) -#define mainNO_BLOCK ( ( TickType_t ) 0 ) -#define mainBAUD_RATE ( ( unsigned long ) 9600 ) + * transmitted. */ +#define mainCOMMS_QUEUE_LENGTH ( 5 ) +#define mainNO_BLOCK ( ( TickType_t ) 0 ) +#define mainBAUD_RATE ( ( unsigned long ) 9600 ) /* * The task function for the "Check" task. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * Checks the unique counts of other tasks to ensure they are still operational. @@ -111,70 +111,68 @@ static portBASE_TYPE prvCheckOtherTasksAreStillRunning( void ); /* Creates the tasks, then starts the scheduler. */ void main( void ) { - /* Initialise the required hardware. */ - vParTestInitialise(); - vPortInitialiseBlocks(); + /* Initialise the required hardware. */ + vParTestInitialise(); + vPortInitialiseBlocks(); - /* Send a character so we have some visible feedback of a reset. */ - xSerialPortInitMinimal( mainBAUD_RATE, mainCOMMS_QUEUE_LENGTH ); - xSerialPutChar( NULL, 'X', mainNO_BLOCK ); + /* Send a character so we have some visible feedback of a reset. */ + xSerialPortInitMinimal( mainBAUD_RATE, mainCOMMS_QUEUE_LENGTH ); + xSerialPutChar( NULL, 'X', mainNO_BLOCK ); - /* Start the standard demo tasks found in the demo\common directory. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + /* Start the standard demo tasks found in the demo\common directory. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - /* Start the check task defined in this file. */ - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + /* Start the check task defined in this file. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - /* Start the scheduler. Will never return here. */ - vTaskStartScheduler(); + /* Start the scheduler. Will never return here. */ + vTaskStartScheduler(); } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -TickType_t xDelayTime = mainNO_ERROR_CHECK_PERIOD; -portBASE_TYPE xErrorOccurred; - - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. */ - for( ;; ) - { - /* Wait until it is time to check the other tasks. */ - vTaskDelay( xDelayTime ); - - /* Check all the other tasks are running, and running without ever - having an error. */ - xErrorOccurred = prvCheckOtherTasksAreStillRunning(); - - /* If an error was detected increase the frequency of the LED flash. */ - if( xErrorOccurred == pdTRUE ) - { - xDelayTime = mainERROR_CHECK_PERIOD; - } - - /* Flash the LED for visual feedback. */ - vParTestToggleLED( mainCHECK_TASK_LED ); - } + TickType_t xDelayTime = mainNO_ERROR_CHECK_PERIOD; + portBASE_TYPE xErrorOccurred; + + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. */ + for( ; ; ) + { + /* Wait until it is time to check the other tasks. */ + vTaskDelay( xDelayTime ); + + /* Check all the other tasks are running, and running without ever + * having an error. */ + xErrorOccurred = prvCheckOtherTasksAreStillRunning(); + + /* If an error was detected increase the frequency of the LED flash. */ + if( xErrorOccurred == pdTRUE ) + { + xDelayTime = mainERROR_CHECK_PERIOD; + } + + /* Flash the LED for visual feedback. */ + vParTestToggleLED( mainCHECK_TASK_LED ); + } } /*-----------------------------------------------------------*/ static portBASE_TYPE prvCheckOtherTasksAreStillRunning( void ) { -portBASE_TYPE xErrorHasOccurred = pdFALSE; + portBASE_TYPE xErrorHasOccurred = pdFALSE; - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - xErrorHasOccurred = pdTRUE; - } + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + xErrorHasOccurred = pdTRUE; + } - return xErrorHasOccurred; + return xErrorHasOccurred; } /*-----------------------------------------------------------*/ - - diff --git a/FreeRTOS/Demo/PIC18_MPLAB/main2.c b/FreeRTOS/Demo/PIC18_MPLAB/main2.c index ac3bcac8925..95b3022ed29 100644 --- a/FreeRTOS/Demo/PIC18_MPLAB/main2.c +++ b/FreeRTOS/Demo/PIC18_MPLAB/main2.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -55,11 +55,11 @@ */ /* -Changes from V2.0.0 - - + Delay periods are now specified using variables and constants of - TickType_t rather than unsigned long. -*/ + * Changes from V2.0.0 + * + + Delay periods are now specified using variables and constants of + + TickType_t rather than unsigned long. + */ /* Scheduler include files. */ #include "FreeRTOS.h" @@ -71,85 +71,85 @@ Changes from V2.0.0 #include "serial.h" /* Priority definitions for the LED tasks. Other tasks just use the idle -priority. */ -#define mainLED_FLASH_PRIORITY ( tskIDLE_PRIORITY + ( unsigned portBASE_TYPE ) 1 ) + * priority. */ +#define mainLED_FLASH_PRIORITY ( tskIDLE_PRIORITY + ( unsigned portBASE_TYPE ) 1 ) /* The LED that is lit when should the calculation fail. */ -#define mainCHECK_TASK_LED ( ( unsigned portBASE_TYPE ) 3 ) +#define mainCHECK_TASK_LED ( ( unsigned portBASE_TYPE ) 3 ) /* Constants required for the communications. Only one character is ever -transmitted. */ -#define mainCOMMS_QUEUE_LENGTH ( ( unsigned portBASE_TYPE ) 5 ) -#define mainNO_BLOCK ( ( TickType_t ) 0 ) -#define mainBAUD_RATE ( ( unsigned long ) 9600 ) + * transmitted. */ +#define mainCOMMS_QUEUE_LENGTH ( ( unsigned portBASE_TYPE ) 5 ) +#define mainNO_BLOCK ( ( TickType_t ) 0 ) +#define mainBAUD_RATE ( ( unsigned long ) 9600 ) /* * The task that performs the 32 bit calculation at the idle priority. */ -static void vCalculationTask( void *pvParameters ); +static void vCalculationTask( void * pvParameters ); /*-----------------------------------------------------------*/ /* Creates the tasks, then starts the scheduler. */ void main( void ) { - /* Initialise the required hardware. */ - vParTestInitialise(); - vPortInitialiseBlocks(); + /* Initialise the required hardware. */ + vParTestInitialise(); + vPortInitialiseBlocks(); - /* Send a character so we have some visible feedback of a reset. */ - xSerialPortInitMinimal( mainBAUD_RATE, mainCOMMS_QUEUE_LENGTH ); - xSerialPutChar( NULL, 'X', mainNO_BLOCK ); + /* Send a character so we have some visible feedback of a reset. */ + xSerialPortInitMinimal( mainBAUD_RATE, mainCOMMS_QUEUE_LENGTH ); + xSerialPutChar( NULL, 'X', mainNO_BLOCK ); - /* Start the standard LED flash tasks as defined in demo/common/minimal. */ - vStartLEDFlashTasks( mainLED_FLASH_PRIORITY ); + /* Start the standard LED flash tasks as defined in demo/common/minimal. */ + vStartLEDFlashTasks( mainLED_FLASH_PRIORITY ); - /* Start the check task defined in this file. */ - xTaskCreate( vCalculationTask, "Check", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + /* Start the check task defined in this file. */ + xTaskCreate( vCalculationTask, "Check", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - /* Start the scheduler. */ - vTaskStartScheduler(); + /* Start the scheduler. */ + vTaskStartScheduler(); } /*-----------------------------------------------------------*/ -static void vCalculationTask( void *pvParameters ) +static void vCalculationTask( void * pvParameters ) { -volatile unsigned long ulCalculatedValue; /* Volatile to ensure optimisation is minimal. */ - - /* Continuously perform a calculation. If the calculation result is ever - incorrect turn the LED on. */ - for( ;; ) - { - /* A good optimising compiler would just remove all this! */ - ulCalculatedValue = 1234UL; - ulCalculatedValue *= 99UL; - - if( ulCalculatedValue != 122166UL ) - { - vParTestSetLED( mainCHECK_TASK_LED, pdTRUE ); - } - - ulCalculatedValue *= 9876UL; - - if( ulCalculatedValue != 1206511416UL ) - { - vParTestSetLED( mainCHECK_TASK_LED, pdTRUE ); - } - - ulCalculatedValue /= 15UL; - - if( ulCalculatedValue != 80434094UL ) - { - vParTestSetLED( mainCHECK_TASK_LED, pdTRUE ); - } - - ulCalculatedValue += 918273UL; - - if( ulCalculatedValue != 81352367UL ) - { - vParTestSetLED( mainCHECK_TASK_LED, pdTRUE ); - } - } + volatile unsigned long ulCalculatedValue; /* Volatile to ensure optimisation is minimal. */ + + /* Continuously perform a calculation. If the calculation result is ever + * incorrect turn the LED on. */ + + for( ; ; ) + { + /* A good optimising compiler would just remove all this! */ + ulCalculatedValue = 1234UL; + ulCalculatedValue *= 99UL; + + if( ulCalculatedValue != 122166UL ) + { + vParTestSetLED( mainCHECK_TASK_LED, pdTRUE ); + } + + ulCalculatedValue *= 9876UL; + + if( ulCalculatedValue != 1206511416UL ) + { + vParTestSetLED( mainCHECK_TASK_LED, pdTRUE ); + } + + ulCalculatedValue /= 15UL; + + if( ulCalculatedValue != 80434094UL ) + { + vParTestSetLED( mainCHECK_TASK_LED, pdTRUE ); + } + + ulCalculatedValue += 918273UL; + + if( ulCalculatedValue != 81352367UL ) + { + vParTestSetLED( mainCHECK_TASK_LED, pdTRUE ); + } + } } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/PIC18_MPLAB/main3.c b/FreeRTOS/Demo/PIC18_MPLAB/main3.c index 69a90c99c6b..8d170c24617 100644 --- a/FreeRTOS/Demo/PIC18_MPLAB/main3.c +++ b/FreeRTOS/Demo/PIC18_MPLAB/main3.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -63,11 +63,11 @@ */ /* -Changes from V2.0.0 - - + Delay periods are now specified using variables and constants of - TickType_t rather than unsigned long. -*/ + * Changes from V2.0.0 + * + + Delay periods are now specified using variables and constants of + + TickType_t rather than unsigned long. + */ /* Scheduler include files. */ #include "FreeRTOS.h" @@ -80,105 +80,104 @@ Changes from V2.0.0 #include "integer.h" /* Priority definitions for the LED tasks. Other tasks just use the idle -priority. */ -#define mainCOMM_TEST_PRIORITY ( tskIDLE_PRIORITY + ( unsigned portBASE_TYPE ) 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + ( unsigned portBASE_TYPE ) 3 ) + * priority. */ +#define mainCOMM_TEST_PRIORITY ( tskIDLE_PRIORITY + ( unsigned portBASE_TYPE ) 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + ( unsigned portBASE_TYPE ) 3 ) /* The period between executions of the check task before and after an error -has been discovered. If an error has been discovered the check task runs -more frequently - increasing the LED flash rate. */ -#define mainNO_ERROR_CHECK_PERIOD ( ( TickType_t ) 1000 / portTICK_PERIOD_MS ) -#define mainERROR_CHECK_PERIOD ( ( TickType_t ) 100 / portTICK_PERIOD_MS ) + * has been discovered. If an error has been discovered the check task runs + * more frequently - increasing the LED flash rate. */ +#define mainNO_ERROR_CHECK_PERIOD ( ( TickType_t ) 1000 / portTICK_PERIOD_MS ) +#define mainERROR_CHECK_PERIOD ( ( TickType_t ) 100 / portTICK_PERIOD_MS ) /* The period for which mainRESET_LED remain on every reset. */ -#define mainRESET_LED_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) +#define mainRESET_LED_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) /* The LED that is toggled whenever a character is transmitted. -mainCOMM_TX_RX_LED + 1 will be toggled every time a character is received. */ -#define mainCOMM_TX_RX_LED ( ( unsigned portBASE_TYPE ) 2 ) + * mainCOMM_TX_RX_LED + 1 will be toggled every time a character is received. */ +#define mainCOMM_TX_RX_LED ( ( unsigned portBASE_TYPE ) 2 ) /* The LED that is flashed by the check task at a rate that indicates the -error status. */ -#define mainCHECK_TASK_LED ( ( unsigned portBASE_TYPE ) 1 ) + * error status. */ +#define mainCHECK_TASK_LED ( ( unsigned portBASE_TYPE ) 1 ) /* The LED that is flashed once upon every reset. */ -#define mainRESET_LED ( ( unsigned portBASE_TYPE ) 0 ) +#define mainRESET_LED ( ( unsigned portBASE_TYPE ) 0 ) /* Constants required for the communications. */ -#define mainCOMMS_QUEUE_LENGTH ( ( unsigned portBASE_TYPE ) 5 ) -#define mainBAUD_RATE ( ( unsigned long ) 57600 ) +#define mainCOMMS_QUEUE_LENGTH ( ( unsigned portBASE_TYPE ) 5 ) +#define mainBAUD_RATE ( ( unsigned long ) 57600 ) /*-----------------------------------------------------------*/ /* * Task function which periodically checks the other tasks for errors. Flashes * an LED at a rate that indicates whether an error has ever been detected. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /*-----------------------------------------------------------*/ /* Creates the tasks, then starts the scheduler. */ void main( void ) { - /* Initialise the required hardware. */ - vParTestInitialise(); + /* Initialise the required hardware. */ + vParTestInitialise(); - /* Initialise the block memory allocator. */ - vPortInitialiseBlocks(); + /* Initialise the block memory allocator. */ + vPortInitialiseBlocks(); - /* Start the standard comtest tasks as defined in demo/common/minimal. */ - vAltStartComTestTasks( mainCOMM_TEST_PRIORITY, mainBAUD_RATE, mainCOMM_TX_RX_LED ); + /* Start the standard comtest tasks as defined in demo/common/minimal. */ + vAltStartComTestTasks( mainCOMM_TEST_PRIORITY, mainBAUD_RATE, mainCOMM_TX_RX_LED ); - /* Start the standard 32bit calculation task as defined in - demo/common/minimal. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); + /* Start the standard 32bit calculation task as defined in + * demo/common/minimal. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); - /* Start the check task defined in this file. */ - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + /* Start the check task defined in this file. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - /* Start the scheduler. This will never return. */ - vTaskStartScheduler(); + /* Start the scheduler. This will never return. */ + vTaskStartScheduler(); } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -TickType_t xDelayTime = mainNO_ERROR_CHECK_PERIOD; -volatile unsigned long ulDummy = 3UL; - - /* Toggle the LED so we can see when a reset occurs. */ - vParTestSetLED( mainRESET_LED, pdTRUE ); - vTaskDelay( mainRESET_LED_PERIOD ); - vParTestSetLED( mainRESET_LED, pdFALSE ); - - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. */ - for( ;; ) - { - /* Wait until it is time to check the other tasks. */ - vTaskDelay( xDelayTime ); - - /* Perform an integer calculation - just to ensure the registers - get used. The result is not important. */ - ulDummy *= 3UL; - - /* Check all the other tasks are running, and running without ever - having an error. The delay period is lowered if an error is reported, - causing the LED to flash at a higher rate. */ - if( xAreIntegerMathsTaskStillRunning() == pdFALSE ) - { - xDelayTime = mainERROR_CHECK_PERIOD; - } - - if( xAreComTestTasksStillRunning() == pdFALSE ) - { - xDelayTime = mainERROR_CHECK_PERIOD; - } - - /* Flash the LED for visual feedback. The rate of the flash will - indicate the health of the system. */ - vParTestToggleLED( mainCHECK_TASK_LED ); - } + TickType_t xDelayTime = mainNO_ERROR_CHECK_PERIOD; + volatile unsigned long ulDummy = 3UL; + + /* Toggle the LED so we can see when a reset occurs. */ + vParTestSetLED( mainRESET_LED, pdTRUE ); + vTaskDelay( mainRESET_LED_PERIOD ); + vParTestSetLED( mainRESET_LED, pdFALSE ); + + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. */ + for( ; ; ) + { + /* Wait until it is time to check the other tasks. */ + vTaskDelay( xDelayTime ); + + /* Perform an integer calculation - just to ensure the registers + * get used. The result is not important. */ + ulDummy *= 3UL; + + /* Check all the other tasks are running, and running without ever + * having an error. The delay period is lowered if an error is reported, + * causing the LED to flash at a higher rate. */ + if( xAreIntegerMathsTaskStillRunning() == pdFALSE ) + { + xDelayTime = mainERROR_CHECK_PERIOD; + } + + if( xAreComTestTasksStillRunning() == pdFALSE ) + { + xDelayTime = mainERROR_CHECK_PERIOD; + } + + /* Flash the LED for visual feedback. The rate of the flash will + * indicate the health of the system. */ + vParTestToggleLED( mainCHECK_TASK_LED ); + } } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/PIC18_MPLAB/serial/serial.c b/FreeRTOS/Demo/PIC18_MPLAB/serial/serial.c index 87f5273fecc..3e8b9d4ff54 100644 --- a/FreeRTOS/Demo/PIC18_MPLAB/serial/serial.c +++ b/FreeRTOS/Demo/PIC18_MPLAB/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo1/FreeRTOSConfig.h b/FreeRTOS/Demo/PIC18_WizC/Demo1/FreeRTOSConfig.h index 716960a7851..0ab9f8cdb66 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo1/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/PIC18_WizC/Demo1/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo1/WIZCmake.h b/FreeRTOS/Demo/PIC18_WizC/Demo1/WIZCmake.h index 3698a16a9f8..f10ad1b5530 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo1/WIZCmake.h +++ b/FreeRTOS/Demo/PIC18_WizC/Demo1/WIZCmake.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo1/fuses.c b/FreeRTOS/Demo/PIC18_WizC/Demo1/fuses.c index b418dfe0f50..6db934dc8da 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo1/fuses.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo1/fuses.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo1/interrupt.c b/FreeRTOS/Demo/PIC18_WizC/Demo1/interrupt.c index 9549dfeba81..89602fa0985 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo1/interrupt.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo1/interrupt.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo1/main.c b/FreeRTOS/Demo/PIC18_WizC/Demo1/main.c index f7d8392ebdb..0f68c4284b1 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo1/main.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo1/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo2/FreeRTOSConfig.h b/FreeRTOS/Demo/PIC18_WizC/Demo2/FreeRTOSConfig.h index 157c5c0e11c..7bb85cd3d38 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo2/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/PIC18_WizC/Demo2/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo2/WIZCmake.h b/FreeRTOS/Demo/PIC18_WizC/Demo2/WIZCmake.h index 93494cf536d..1c58f0ac01c 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo2/WIZCmake.h +++ b/FreeRTOS/Demo/PIC18_WizC/Demo2/WIZCmake.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo2/fuses.c b/FreeRTOS/Demo/PIC18_WizC/Demo2/fuses.c index b418dfe0f50..6db934dc8da 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo2/fuses.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo2/fuses.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo2/interrupt.c b/FreeRTOS/Demo/PIC18_WizC/Demo2/interrupt.c index 88794e6ee0d..c8d7c65aca3 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo2/interrupt.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo2/interrupt.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo2/main.c b/FreeRTOS/Demo/PIC18_WizC/Demo2/main.c index 32349328e8b..bf613e1640e 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo2/main.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo2/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo3/FreeRTOSConfig.h b/FreeRTOS/Demo/PIC18_WizC/Demo3/FreeRTOSConfig.h index 867c39546c5..50b116b2085 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo3/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/PIC18_WizC/Demo3/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo3/WIZCmake.h b/FreeRTOS/Demo/PIC18_WizC/Demo3/WIZCmake.h index 93494cf536d..1c58f0ac01c 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo3/WIZCmake.h +++ b/FreeRTOS/Demo/PIC18_WizC/Demo3/WIZCmake.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo3/fuses.c b/FreeRTOS/Demo/PIC18_WizC/Demo3/fuses.c index b418dfe0f50..6db934dc8da 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo3/fuses.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo3/fuses.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo3/interrupt.c b/FreeRTOS/Demo/PIC18_WizC/Demo3/interrupt.c index 88794e6ee0d..c8d7c65aca3 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo3/interrupt.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo3/interrupt.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo3/main.c b/FreeRTOS/Demo/PIC18_WizC/Demo3/main.c index 48c6405f63d..ebbd8a86983 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo3/main.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo3/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo4/FreeRTOSConfig.h b/FreeRTOS/Demo/PIC18_WizC/Demo4/FreeRTOSConfig.h index 42273feacd1..263ecf639bb 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo4/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/PIC18_WizC/Demo4/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo4/WIZCmake.h b/FreeRTOS/Demo/PIC18_WizC/Demo4/WIZCmake.h index 93494cf536d..1c58f0ac01c 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo4/WIZCmake.h +++ b/FreeRTOS/Demo/PIC18_WizC/Demo4/WIZCmake.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo4/fuses.c b/FreeRTOS/Demo/PIC18_WizC/Demo4/fuses.c index b418dfe0f50..6db934dc8da 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo4/fuses.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo4/fuses.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo4/interrupt.c b/FreeRTOS/Demo/PIC18_WizC/Demo4/interrupt.c index 88794e6ee0d..c8d7c65aca3 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo4/interrupt.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo4/interrupt.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo4/main.c b/FreeRTOS/Demo/PIC18_WizC/Demo4/main.c index 0857579021d..9c421b7cbc4 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo4/main.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo4/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo5/FreeRTOSConfig.h b/FreeRTOS/Demo/PIC18_WizC/Demo5/FreeRTOSConfig.h index fb8d40dbbc8..cf78cfc7d48 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo5/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/PIC18_WizC/Demo5/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo5/WIZCmake.h b/FreeRTOS/Demo/PIC18_WizC/Demo5/WIZCmake.h index 93494cf536d..1c58f0ac01c 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo5/WIZCmake.h +++ b/FreeRTOS/Demo/PIC18_WizC/Demo5/WIZCmake.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo5/fuses.c b/FreeRTOS/Demo/PIC18_WizC/Demo5/fuses.c index b418dfe0f50..6db934dc8da 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo5/fuses.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo5/fuses.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo5/interrupt.c b/FreeRTOS/Demo/PIC18_WizC/Demo5/interrupt.c index 88794e6ee0d..c8d7c65aca3 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo5/interrupt.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo5/interrupt.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo5/main.c b/FreeRTOS/Demo/PIC18_WizC/Demo5/main.c index 246dae0d253..24df1e5d424 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo5/main.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo5/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo6/FreeRTOSConfig.h b/FreeRTOS/Demo/PIC18_WizC/Demo6/FreeRTOSConfig.h index 5b2e1ee06eb..e4e1124523e 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo6/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/PIC18_WizC/Demo6/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo6/WIZCmake.h b/FreeRTOS/Demo/PIC18_WizC/Demo6/WIZCmake.h index 93494cf536d..1c58f0ac01c 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo6/WIZCmake.h +++ b/FreeRTOS/Demo/PIC18_WizC/Demo6/WIZCmake.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo6/fuses.c b/FreeRTOS/Demo/PIC18_WizC/Demo6/fuses.c index b418dfe0f50..6db934dc8da 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo6/fuses.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo6/fuses.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo6/interrupt.c b/FreeRTOS/Demo/PIC18_WizC/Demo6/interrupt.c index 88794e6ee0d..c8d7c65aca3 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo6/interrupt.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo6/interrupt.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo6/main.c b/FreeRTOS/Demo/PIC18_WizC/Demo6/main.c index 00075f00a48..7d375cc315c 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo6/main.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo6/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo7/FreeRTOSConfig.h b/FreeRTOS/Demo/PIC18_WizC/Demo7/FreeRTOSConfig.h index dd951180156..9f36d5e93b4 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo7/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/PIC18_WizC/Demo7/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo7/WIZCmake.h b/FreeRTOS/Demo/PIC18_WizC/Demo7/WIZCmake.h index 93494cf536d..1c58f0ac01c 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo7/WIZCmake.h +++ b/FreeRTOS/Demo/PIC18_WizC/Demo7/WIZCmake.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo7/fuses.c b/FreeRTOS/Demo/PIC18_WizC/Demo7/fuses.c index b418dfe0f50..6db934dc8da 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo7/fuses.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo7/fuses.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo7/interrupt.c b/FreeRTOS/Demo/PIC18_WizC/Demo7/interrupt.c index 88794e6ee0d..c8d7c65aca3 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo7/interrupt.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo7/interrupt.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/Demo7/main.c b/FreeRTOS/Demo/PIC18_WizC/Demo7/main.c index ab0eb2d2968..eef48f61205 100644 --- a/FreeRTOS/Demo/PIC18_WizC/Demo7/main.c +++ b/FreeRTOS/Demo/PIC18_WizC/Demo7/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/ParTest/ParTest.c b/FreeRTOS/Demo/PIC18_WizC/ParTest/ParTest.c index 60dbb97a35f..2e915a4ec10 100644 --- a/FreeRTOS/Demo/PIC18_WizC/ParTest/ParTest.c +++ b/FreeRTOS/Demo/PIC18_WizC/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/serial/isrSerialRx.c b/FreeRTOS/Demo/PIC18_WizC/serial/isrSerialRx.c index 429abcd2408..b22f2a4e795 100644 --- a/FreeRTOS/Demo/PIC18_WizC/serial/isrSerialRx.c +++ b/FreeRTOS/Demo/PIC18_WizC/serial/isrSerialRx.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/serial/isrSerialTx.c b/FreeRTOS/Demo/PIC18_WizC/serial/isrSerialTx.c index d4da94c34d9..2124b3655e7 100644 --- a/FreeRTOS/Demo/PIC18_WizC/serial/isrSerialTx.c +++ b/FreeRTOS/Demo/PIC18_WizC/serial/isrSerialTx.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC18_WizC/serial/serial.c b/FreeRTOS/Demo/PIC18_WizC/serial/serial.c index 61bd64d5b39..2a30f344af6 100644 --- a/FreeRTOS/Demo/PIC18_WizC/serial/serial.c +++ b/FreeRTOS/Demo/PIC18_WizC/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC24_MPLAB/FreeRTOSConfig.h b/FreeRTOS/Demo/PIC24_MPLAB/FreeRTOSConfig.h index e7e957cb9be..700e3b00227 100644 --- a/FreeRTOS/Demo/PIC24_MPLAB/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/PIC24_MPLAB/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC24_MPLAB/ParTest/ParTest.c b/FreeRTOS/Demo/PIC24_MPLAB/ParTest/ParTest.c index c1a14cb67d7..e8759d089fc 100644 --- a/FreeRTOS/Demo/PIC24_MPLAB/ParTest/ParTest.c +++ b/FreeRTOS/Demo/PIC24_MPLAB/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC24_MPLAB/lcd.c b/FreeRTOS/Demo/PIC24_MPLAB/lcd.c index d42ee02f074..cc1dabf7553 100644 --- a/FreeRTOS/Demo/PIC24_MPLAB/lcd.c +++ b/FreeRTOS/Demo/PIC24_MPLAB/lcd.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/PIC24_MPLAB/lcd.h b/FreeRTOS/Demo/PIC24_MPLAB/lcd.h index 39acdbf6451..3e55ce19b26 100644 --- a/FreeRTOS/Demo/PIC24_MPLAB/lcd.h +++ b/FreeRTOS/Demo/PIC24_MPLAB/lcd.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC24_MPLAB/main.c b/FreeRTOS/Demo/PIC24_MPLAB/main.c index 3139864b158..e0e1f6f93c2 100644 --- a/FreeRTOS/Demo/PIC24_MPLAB/main.c +++ b/FreeRTOS/Demo/PIC24_MPLAB/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -31,27 +31,27 @@ * defined and/or created within this file: * * "Fast Interrupt Test" - A high frequency periodic interrupt is generated - * using a free running timer to demonstrate the use of the - * configKERNEL_INTERRUPT_PRIORITY configuration constant. The interrupt + * using a free running timer to demonstrate the use of the + * configKERNEL_INTERRUPT_PRIORITY configuration constant. The interrupt * service routine measures the number of processor clocks that occur between - * each interrupt - and in so doing measures the jitter in the interrupt - * timing. The maximum measured jitter time is latched in the usMaxJitter - * variable, and displayed on the LCD by the 'Check' as described below. - * The fast interrupt is configured and handled in the timer_test.c source + * each interrupt - and in so doing measures the jitter in the interrupt + * timing. The maximum measured jitter time is latched in the usMaxJitter + * variable, and displayed on the LCD by the 'Check' as described below. + * The fast interrupt is configured and handled in the timer_test.c source * file. * * "LCD" task - the LCD task is a 'gatekeeper' task. It is the only task that * is permitted to access the LCD directly. Other tasks wishing to write a - * message to the LCD send the message on a queue to the LCD task instead of - * accessing the LCD themselves. The LCD task just blocks on the queue waiting + * message to the LCD send the message on a queue to the LCD task instead of + * accessing the LCD themselves. The LCD task just blocks on the queue waiting * for messages - waking and displaying the messages as they arrive. The LCD - * task is defined in lcd.c. - * - * "Check" task - This only executes every three seconds but has the highest - * priority so is guaranteed to get processor time. Its main function is to + * task is defined in lcd.c. + * + * "Check" task - This only executes every three seconds but has the highest + * priority so is guaranteed to get processor time. Its main function is to * check that all the standard demo tasks are still operational. Should any * unexpected behaviour within a demo task be discovered the 'check' task will - * write "FAIL #n" to the LCD (via the LCD task). If all the demo tasks are + * write "FAIL #n" to the LCD (via the LCD task). If all the demo tasks are * executing with their expected behaviour then the check task writes the max * jitter time to the LCD (again via the LCD task), as described above. */ @@ -76,46 +76,46 @@ #include "timertest.h" /* Demo task priorities. */ -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainCOM_TEST_PRIORITY ( 2 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainCOM_TEST_PRIORITY ( 2 ) /* The check task may require a bit more stack as it calls sprintf(). */ -#define mainCHECK_TAKS_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 ) +#define mainCHECK_TAKS_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 ) /* The execution period of the check task. */ -#define mainCHECK_TASK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainCHECK_TASK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) /* The number of flash co-routines to create. */ -#define mainNUM_FLASH_COROUTINES ( 5 ) +#define mainNUM_FLASH_COROUTINES ( 5 ) /* Baud rate used by the comtest tasks. */ -#define mainCOM_TEST_BAUD_RATE ( 19200 ) +#define mainCOM_TEST_BAUD_RATE ( 19200 ) /* The LED used by the comtest tasks. mainCOM_TEST_LED + 1 is also used. -See the comtest.c file for more information. */ -#define mainCOM_TEST_LED ( 6 ) + * See the comtest.c file for more information. */ +#define mainCOM_TEST_LED ( 6 ) /* The frequency at which the "fast interrupt test" interrupt will occur. */ -#define mainTEST_INTERRUPT_FREQUENCY ( 20000 ) +#define mainTEST_INTERRUPT_FREQUENCY ( 20000 ) /* The number of processor clocks we expect to occur between each "fast -interrupt test" interrupt. */ -#define mainEXPECTED_CLOCKS_BETWEEN_INTERRUPTS ( configCPU_CLOCK_HZ / mainTEST_INTERRUPT_FREQUENCY ) + * interrupt test" interrupt. */ +#define mainEXPECTED_CLOCKS_BETWEEN_INTERRUPTS ( configCPU_CLOCK_HZ / mainTEST_INTERRUPT_FREQUENCY ) /* The number of nano seconds between each processor clock. */ -#define mainNS_PER_CLOCK ( ( unsigned short ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) ) +#define mainNS_PER_CLOCK ( ( unsigned short ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) ) /* Dimension the buffer used to hold the value of the maximum jitter time when -it is converted to a string. */ -#define mainMAX_STRING_LENGTH ( 20 ) + * it is converted to a string. */ +#define mainMAX_STRING_LENGTH ( 20 ) /*-----------------------------------------------------------*/ /* * The check task as described at the top of this file. */ -static void vCheckTask( void *pvParameters ); +static void vCheckTask( void * pvParameters ); /* * Setup the processor ready for the demo. @@ -123,8 +123,9 @@ static void vCheckTask( void *pvParameters ); static void prvSetupHardware( void ); /* Prototypes for the standard FreeRTOS callback/hook functions implemented -within this file. */ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); + * within this file. */ +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); /*-----------------------------------------------------------*/ @@ -138,128 +139,131 @@ static QueueHandle_t xLCDQueue; */ int main( void ) { - /* Configure any hardware required for this demo. */ - prvSetupHardware(); + /* Configure any hardware required for this demo. */ + prvSetupHardware(); - /* Create the standard demo tasks. */ - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vStartFlashCoRoutines( mainNUM_FLASH_COROUTINES ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vCreateBlockTimeTasks(); + /* Create the standard demo tasks. */ + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartFlashCoRoutines( mainNUM_FLASH_COROUTINES ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vCreateBlockTimeTasks(); - /* Create the test tasks defined within this file. */ - xTaskCreate( vCheckTask, "Check", mainCHECK_TAKS_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + /* Create the test tasks defined within this file. */ + xTaskCreate( vCheckTask, "Check", mainCHECK_TAKS_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - /* Start the task that will control the LCD. This returns the handle - to the queue used to write text out to the task. */ - xLCDQueue = xStartLCDTask(); + /* Start the task that will control the LCD. This returns the handle + * to the queue used to write text out to the task. */ + xLCDQueue = xStartLCDTask(); - /* Start the high frequency interrupt test. */ - vSetupTimerTest( mainTEST_INTERRUPT_FREQUENCY ); + /* Start the high frequency interrupt test. */ + vSetupTimerTest( mainTEST_INTERRUPT_FREQUENCY ); - /* Finally start the scheduler. */ - vTaskStartScheduler(); + /* Finally start the scheduler. */ + vTaskStartScheduler(); - /* Will only reach here if there is insufficient heap available to start - the scheduler. */ - return 0; + /* Will only reach here if there is insufficient heap available to start + * the scheduler. */ + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - vParTestInitialise(); + vParTestInitialise(); } /*-----------------------------------------------------------*/ -static void vCheckTask( void *pvParameters ) +static void vCheckTask( void * pvParameters ) { /* Used to wake the task at the correct frequency. */ -TickType_t xLastExecutionTime; + TickType_t xLastExecutionTime; /* The maximum jitter time measured by the fast interrupt test. */ -extern unsigned short usMaxJitter ; + extern unsigned short usMaxJitter; /* Buffer into which the maximum jitter time is written as a string. */ -static char cStringBuffer[ mainMAX_STRING_LENGTH ]; + static char cStringBuffer[ mainMAX_STRING_LENGTH ]; /* The message that is sent on the queue to the LCD task. The first -parameter is the minimum time (in ticks) that the message should be -left on the LCD without being overwritten. The second parameter is a pointer -to the message to display itself. */ -xLCDMessage xMessage = { 0, cStringBuffer }; + * parameter is the minimum time (in ticks) that the message should be + * left on the LCD without being overwritten. The second parameter is a pointer + * to the message to display itself. */ + xLCDMessage xMessage = { 0, cStringBuffer }; /* Set to pdTRUE should an error be detected in any of the standard demo tasks. */ -unsigned short usErrorDetected = pdFALSE; - - /* Remove compiler warnings. */ - ( void ) pvParameters; - - /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() - works correctly. */ - xLastExecutionTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Wait until it is time for the next cycle. */ - vTaskDelayUntil( &xLastExecutionTime, mainCHECK_TASK_PERIOD ); - - /* Has an error been found in any of the standard demo tasks? */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - usErrorDetected = pdTRUE; - sprintf( cStringBuffer, "FAIL #1" ); - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - usErrorDetected = pdTRUE; - sprintf( cStringBuffer, "FAIL #2" ); - } - - if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - usErrorDetected = pdTRUE; - sprintf( cStringBuffer, "FAIL #3" ); - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - usErrorDetected = pdTRUE; - sprintf( cStringBuffer, "FAIL #4" ); - } - - if( usErrorDetected == pdFALSE ) - { - /* No errors have been discovered, so display the maximum jitter - timer discovered by the "fast interrupt test". */ - sprintf( cStringBuffer, "%dns max jitter", ( short ) ( usMaxJitter - mainEXPECTED_CLOCKS_BETWEEN_INTERRUPTS ) * mainNS_PER_CLOCK ); - } - - /* Send the message to the LCD gatekeeper for display. */ - xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); - } + unsigned short usErrorDetected = pdFALSE; + + /* Remove compiler warnings. */ + ( void ) pvParameters; + + /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() + * works correctly. */ + xLastExecutionTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Wait until it is time for the next cycle. */ + vTaskDelayUntil( &xLastExecutionTime, mainCHECK_TASK_PERIOD ); + + /* Has an error been found in any of the standard demo tasks? */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + usErrorDetected = pdTRUE; + sprintf( cStringBuffer, "FAIL #1" ); + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + usErrorDetected = pdTRUE; + sprintf( cStringBuffer, "FAIL #2" ); + } + + if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + usErrorDetected = pdTRUE; + sprintf( cStringBuffer, "FAIL #3" ); + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + usErrorDetected = pdTRUE; + sprintf( cStringBuffer, "FAIL #4" ); + } + + if( usErrorDetected == pdFALSE ) + { + /* No errors have been discovered, so display the maximum jitter + * timer discovered by the "fast interrupt test". */ + sprintf( cStringBuffer, "%dns max jitter", ( short ) ( usMaxJitter - mainEXPECTED_CLOCKS_BETWEEN_INTERRUPTS ) * mainNS_PER_CLOCK ); + } + + /* Send the message to the LCD gatekeeper for display. */ + xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* Schedule the co-routines from within the idle task hook. */ - vCoRoutineSchedule(); + /* Schedule the co-routines from within the idle task hook. */ + vCoRoutineSchedule(); } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); -} + ( void ) pcTaskName; + ( void ) pxTask; + /* 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(); + + for( ; ; ) + { + } +} diff --git a/FreeRTOS/Demo/PIC24_MPLAB/serial/serial.c b/FreeRTOS/Demo/PIC24_MPLAB/serial/serial.c index 8be3a07010a..2aa8715581f 100644 --- a/FreeRTOS/Demo/PIC24_MPLAB/serial/serial.c +++ b/FreeRTOS/Demo/PIC24_MPLAB/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC24_MPLAB/timertest.c b/FreeRTOS/Demo/PIC24_MPLAB/timertest.c index 06ca0a57288..5ebf38a9290 100644 --- a/FreeRTOS/Demo/PIC24_MPLAB/timertest.c +++ b/FreeRTOS/Demo/PIC24_MPLAB/timertest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC24_MPLAB/timertest.h b/FreeRTOS/Demo/PIC24_MPLAB/timertest.h index 0be42c8677c..8a8e11740fc 100644 --- a/FreeRTOS/Demo/PIC24_MPLAB/timertest.h +++ b/FreeRTOS/Demo/PIC24_MPLAB/timertest.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Blinky_Demo/main_blinky.c index 8c0640b9f39..d4b7a8445d8 100644 --- a/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/FreeRTOSConfig.h b/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/FreeRTOSConfig.h index 3c52ecc42a5..74c5eb00e4a 100644 --- a/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/IntQueueTimer.c index e1f5f4ea495..721557b69fe 100644 --- a/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/IntQueueTimer.h index 4fb214c4093..dc540323649 100644 --- a/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/main_full.c b/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/main_full.c index cfdcb385dc0..a97a71789b8 100644 --- a/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/timertest.c b/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/timertest.c index 51b86a1ea2f..4b6cabb5d19 100644 --- a/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/timertest.c +++ b/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/timertest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/timertest.h b/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/timertest.h index 0be42c8677c..8a8e11740fc 100644 --- a/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/timertest.h +++ b/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/timertest.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/main.c b/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/main.c index ca1dc90793b..9b54ac66d48 100644 --- a/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/main.c +++ b/FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MX_MPLAB/ConfigPerformance.c b/FreeRTOS/Demo/PIC32MX_MPLAB/ConfigPerformance.c index 09aea6f7312..75797aa6612 100644 --- a/FreeRTOS/Demo/PIC32MX_MPLAB/ConfigPerformance.c +++ b/FreeRTOS/Demo/PIC32MX_MPLAB/ConfigPerformance.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MX_MPLAB/ConfigPerformance.h b/FreeRTOS/Demo/PIC32MX_MPLAB/ConfigPerformance.h index d4dce6ce8c0..ce11176976a 100644 --- a/FreeRTOS/Demo/PIC32MX_MPLAB/ConfigPerformance.h +++ b/FreeRTOS/Demo/PIC32MX_MPLAB/ConfigPerformance.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MX_MPLAB/FreeRTOSConfig.h b/FreeRTOS/Demo/PIC32MX_MPLAB/FreeRTOSConfig.h index ec8b272cfd3..889c20be47e 100644 --- a/FreeRTOS/Demo/PIC32MX_MPLAB/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/PIC32MX_MPLAB/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MX_MPLAB/IntQueueTimer.c b/FreeRTOS/Demo/PIC32MX_MPLAB/IntQueueTimer.c index 883099e31cd..c7faea1670f 100644 --- a/FreeRTOS/Demo/PIC32MX_MPLAB/IntQueueTimer.c +++ b/FreeRTOS/Demo/PIC32MX_MPLAB/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MX_MPLAB/IntQueueTimer.h b/FreeRTOS/Demo/PIC32MX_MPLAB/IntQueueTimer.h index 4fb214c4093..dc540323649 100644 --- a/FreeRTOS/Demo/PIC32MX_MPLAB/IntQueueTimer.h +++ b/FreeRTOS/Demo/PIC32MX_MPLAB/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MX_MPLAB/ParTest/ParTest_Explorer16.c b/FreeRTOS/Demo/PIC32MX_MPLAB/ParTest/ParTest_Explorer16.c index 7aa1e2a436c..d18569a22c8 100644 --- a/FreeRTOS/Demo/PIC32MX_MPLAB/ParTest/ParTest_Explorer16.c +++ b/FreeRTOS/Demo/PIC32MX_MPLAB/ParTest/ParTest_Explorer16.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MX_MPLAB/ParTest/ParTest_USBII_Starter_Kit.c b/FreeRTOS/Demo/PIC32MX_MPLAB/ParTest/ParTest_USBII_Starter_Kit.c index ae5b5da2b80..cb19822daac 100644 --- a/FreeRTOS/Demo/PIC32MX_MPLAB/ParTest/ParTest_USBII_Starter_Kit.c +++ b/FreeRTOS/Demo/PIC32MX_MPLAB/ParTest/ParTest_USBII_Starter_Kit.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MX_MPLAB/lcd.c b/FreeRTOS/Demo/PIC32MX_MPLAB/lcd.c index 621b9ba3025..dd2e8e60b18 100644 --- a/FreeRTOS/Demo/PIC32MX_MPLAB/lcd.c +++ b/FreeRTOS/Demo/PIC32MX_MPLAB/lcd.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MX_MPLAB/lcd.h b/FreeRTOS/Demo/PIC32MX_MPLAB/lcd.h index 39acdbf6451..3e55ce19b26 100644 --- a/FreeRTOS/Demo/PIC32MX_MPLAB/lcd.h +++ b/FreeRTOS/Demo/PIC32MX_MPLAB/lcd.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MX_MPLAB/main.c b/FreeRTOS/Demo/PIC32MX_MPLAB/main.c index 5abc43d5440..5f9fc975dd1 100644 --- a/FreeRTOS/Demo/PIC32MX_MPLAB/main.c +++ b/FreeRTOS/Demo/PIC32MX_MPLAB/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -52,18 +52,18 @@ #pragma config CP = OFF, BWP = OFF, PWP = OFF /* Additional config fuse settings for other supported processors */ -#if defined(__32MX460F512L__) - #pragma config UPLLEN = OFF -#elif defined(__32MX795F512L__) - #pragma config UPLLEN = OFF - #pragma config FSRSSEL = PRIORITY_7 +#if defined( __32MX460F512L__ ) + #pragma config UPLLEN = OFF +#elif defined( __32MX795F512L__ ) + #pragma config UPLLEN = OFF + #pragma config FSRSSEL = PRIORITY_7 #endif /*-----------------------------------------------------------*/ /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 /*-----------------------------------------------------------*/ @@ -86,118 +86,129 @@ extern void main_full( void ); */ int main( void ) { - /* Prepare the hardware to run this demo. */ - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* Prepare the hardware to run this demo. */ + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Configure the hardware for maximum performance. */ - vHardwareConfigurePerformance(); + /* Configure the hardware for maximum performance. */ + vHardwareConfigurePerformance(); - /* Setup to use the external interrupt controller. */ - vHardwareUseMultiVectoredInterrupts(); + /* Setup to use the external interrupt controller. */ + vHardwareUseMultiVectoredInterrupts(); - portDISABLE_INTERRUPTS(); + portDISABLE_INTERRUPTS(); - /* Setup the digital IO for the LED's. */ - vParTestInitialise(); + /* Setup the digital IO for the LED's. */ + vParTestInitialise(); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* Run time task stack overflow checking is performed if - configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is - called if a task stack overflow is detected. Note the system/interrupt - stack is not checked. */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* Run time task stack overflow checking is performed if + * configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is + * called if a task stack overflow is detected. Note the system/interrupt + * stack is not checked. */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* This function will be called by each tick interrupt if - configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - added here, but the tick hook is called from an interrupt context, so - code must not attempt to block, and only the interrupt safe FreeRTOS API - functions can be used (those that end in FromISR()). */ + /* This function will be called by each tick interrupt if + * configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + * added here, but the tick hook is called from an interrupt context, so + * code must not attempt to block, and only the interrupt safe FreeRTOS API + * functions can be used (those that end in FromISR()). */ } /*-----------------------------------------------------------*/ -void _general_exception_handler( unsigned long ulCause, unsigned long ulStatus ) +void _general_exception_handler( unsigned long ulCause, + unsigned long ulStatus ) { - /* This overrides the definition provided by the kernel. Other exceptions - should be handled here. */ - for( ;; ); + /* This overrides the definition provided by the kernel. Other exceptions + * should be handled here. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -void vAssertCalled( const char * pcFile, unsigned long ulLine ) +void vAssertCalled( const char * pcFile, + unsigned long ulLine ) { -volatile unsigned long ul = 0; - - ( void ) pcFile; - ( void ) ulLine; - - __asm volatile( "di" ); - { - /* Set ul to a non-zero value using the debugger to step out of this - function. */ - while( ul == 0 ) - { - portNOP(); - } - } - __asm volatile( "ei" ); + volatile unsigned long ul = 0; + + ( void ) pcFile; + ( void ) ulLine; + + __asm volatile ( "di" ); + { + /* Set ul to a non-zero value using the debugger to step out of this + * function. */ + while( ul == 0 ) + { + portNOP(); + } + } + __asm volatile ( "ei" ); } diff --git a/FreeRTOS/Demo/PIC32MX_MPLAB/main_blinky.c b/FreeRTOS/Demo/PIC32MX_MPLAB/main_blinky.c index 64974f475f4..acdb8cb79b7 100644 --- a/FreeRTOS/Demo/PIC32MX_MPLAB/main_blinky.c +++ b/FreeRTOS/Demo/PIC32MX_MPLAB/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -78,41 +78,41 @@ #include "partest.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /* Values passed to the two tasks just to check the task parameter -functionality. */ -#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) -#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) + * functionality. */ +#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) +#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) /* The period of the blinky software timer. The period is specified in ms and -converted to ticks using the portTICK_PERIOD_MS constant. */ -#define mainBLINKY_TIMER_PERIOD ( 50 / portTICK_PERIOD_MS ) + * converted to ticks using the portTICK_PERIOD_MS constant. */ +#define mainBLINKY_TIMER_PERIOD ( 50 / portTICK_PERIOD_MS ) /* The LED used by the communicating tasks and the blinky timer respectively. */ -#define mainTASKS_LED ( 0 ) -#define mainTIMER_LED ( 1 ) +#define mainTASKS_LED ( 0 ) +#define mainTIMER_LED ( 1 ) /* Misc. */ -#define mainDONT_BLOCK ( 0 ) +#define mainDONT_BLOCK ( 0 ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * The callback function for the blinky software timer, as described at the top @@ -135,109 +135,110 @@ static QueueHandle_t xQueue = NULL; void main_blinky( void ) { -TimerHandle_t xTimer; - - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); - - if( xQueue != NULL ) - { - /* Create the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ - mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ - - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Create the blinky software timer as described at the top of this - file. */ - xTimer = xTimerCreate( "Blinky", /* A text name, purely to help debugging. */ - ( mainBLINKY_TIMER_PERIOD ),/* The timer period. */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvBlinkyTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - if( xTimer != NULL ) - { - xTimerStart( xTimer, mainDONT_BLOCK ); - } - - /* Start the tasks and timer running. */ - 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 insufficient FreeRTOS heap memory available for the idle and/or - timer tasks to be created. See the memory management section on the - FreeRTOS web site for more details. */ - for( ;; ); + TimerHandle_t xTimer; + + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); + + if( xQueue != NULL ) + { + /* Create the two tasks as described in the comments at the top of this + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ + + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Create the blinky software timer as described at the top of this + * file. */ + xTimer = xTimerCreate( "Blinky", /* A text name, purely to help debugging. */ + ( mainBLINKY_TIMER_PERIOD ), /* The timer period. */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvBlinkyTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + if( xTimer != NULL ) + { + xTimerStart( xTimer, mainDONT_BLOCK ); + } + + /* Start the tasks and timer running. */ + 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 insufficient FreeRTOS heap memory available for the idle and/or + * timer tasks to be created. See the memory management section on the + * FreeRTOS web site for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, the constant used converts ticks - to ms. While in the Blocked state this task will not consume any CPU - time. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - - /* 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 - will not block - it shouldn't need to block as the queue should always - be empty at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, the constant used converts ticks + * to ms. While in the Blocked state this task will not consume any CPU + * time. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + + /* 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 + * will not block - it shouldn't need to block as the queue should always + * be empty at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it the expected value? If it is, toggle the LED. */ - if( ulReceivedValue == 100UL ) - { - vParTestToggleLED( mainTASKS_LED ); - ulReceivedValue = 0U; - } - } + unsigned long ulReceivedValue; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it the expected value? If it is, toggle the LED. */ + if( ulReceivedValue == 100UL ) + { + vParTestToggleLED( mainTASKS_LED ); + ulReceivedValue = 0U; + } + } } /*-----------------------------------------------------------*/ static void prvBlinkyTimerCallback( TimerHandle_t xTimer ) { - /* This function is called when the blinky software time expires. All the - function does is toggle the LED. LED mainTIMER_LED should therefore toggle - with the period set by mainBLINKY_TIMER_PERIOD. */ - vParTestToggleLED( mainTIMER_LED ); + /* This function is called when the blinky software time expires. All the + * function does is toggle the LED. LED mainTIMER_LED should therefore toggle + * with the period set by mainBLINKY_TIMER_PERIOD. */ + vParTestToggleLED( mainTIMER_LED ); } - diff --git a/FreeRTOS/Demo/PIC32MX_MPLAB/main_full.c b/FreeRTOS/Demo/PIC32MX_MPLAB/main_full.c index 217fa1cc3ee..7a914dc4a04 100644 --- a/FreeRTOS/Demo/PIC32MX_MPLAB/main_full.c +++ b/FreeRTOS/Demo/PIC32MX_MPLAB/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -117,49 +117,49 @@ /*-----------------------------------------------------------*/ /* 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 mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS ) + * 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 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_PERIOD_MS constant. */ -#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) + * 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_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 mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#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 mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) /* Misc. */ -#define mainDONT_BLOCK ( 0 ) +#define mainDONT_BLOCK ( 0 ) /* Dimension the buffer used to hold the value of the high frequency timer -count when it is converted to a string. */ -#define mainMAX_STRING_LENGTH ( 20 ) + * count when it is converted to a string. */ +#define mainMAX_STRING_LENGTH ( 20 ) /* The frequency at which the "fast interrupt test" interrupt will occur. */ -#define mainTEST_INTERRUPT_FREQUENCY ( 20000 ) +#define mainTEST_INTERRUPT_FREQUENCY ( 20000 ) /* The number of timer clocks expected to occur between each "fast interrupt -test" interrupt. */ -#define mainEXPECTED_CLOCKS_BETWEEN_INTERRUPTS ( ( configCPU_CLOCK_HZ >> 1 ) / mainTEST_INTERRUPT_FREQUENCY ) + * test" interrupt. */ +#define mainEXPECTED_CLOCKS_BETWEEN_INTERRUPTS ( ( configCPU_CLOCK_HZ >> 1 ) / mainTEST_INTERRUPT_FREQUENCY ) /* The number of nano seconds between each core clock. */ -#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) ( configCPU_CLOCK_HZ >> 1 ) ) * 1000000000.0 ) ) +#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) ( configCPU_CLOCK_HZ >> 1 ) ) * 1000000000.0 ) ) /* The number of LEDs that should be controlled by the flash software timer -standard demo and the LED to be toggle by the check task. The starter kit only -has three LEDs so when the demo is configured to run on the starter kit there -is one less flash timer so the check task can use the third LED. */ + * standard demo and the LED to be toggle by the check task. The starter kit only + * has three LEDs so when the demo is configured to run on the starter kit there + * is one less flash timer so the check task can use the third LED. */ #ifdef PIC32_STARTER_KIT - #define mainNUM_FLASH_TIMER_LEDS ( 2 ) - #define mainCHECK_LED ( 2 ) + #define mainNUM_FLASH_TIMER_LEDS ( 2 ) + #define mainCHECK_LED ( 2 ) #else - #define mainNUM_FLASH_TIMER_LEDS ( 3 ) - #define mainCHECK_LED ( 7 ) + #define mainNUM_FLASH_TIMER_LEDS ( 3 ) + #define mainCHECK_LED ( 7 ) #endif /*-----------------------------------------------------------*/ @@ -185,8 +185,8 @@ static void prvSetupHighFrequencyTimerTest( TimerHandle_t xTimer ); * in and out between setting the register values and checking the register * values. */ -static void prvRegTestTask1( void *pvParameters ); -static void prvRegTestTask2( void *pvParameters ); +static void prvRegTestTask1( void * pvParameters ); +static void prvRegTestTask2( void * pvParameters ); /*-----------------------------------------------------------*/ @@ -194,8 +194,8 @@ static void prvRegTestTask2( void *pvParameters ); static QueueHandle_t xLCDQueue; /* Variables incremented by prvRegTestTask1() and prvRegTestTask2() respectively on -each iteration of their function. This is used to detect either task stopping -their execution.. */ + * each iteration of their function. This is used to detect either task stopping + * their execution.. */ volatile unsigned long ulRegTest1Cycles = 0, ulRegTest2Cycles = 0; /*-----------------------------------------------------------*/ @@ -205,170 +205,172 @@ volatile unsigned long ulRegTest1Cycles = 0, ulRegTest2Cycles = 0; */ int main_full( void ) { -TimerHandle_t xTimer = NULL; + TimerHandle_t xTimer = NULL; - /* Create all the other standard demo tasks. */ - vStartLEDFlashTimers( mainNUM_FLASH_TIMER_LEDS ); + /* Create all the other standard demo tasks. */ + vStartLEDFlashTimers( mainNUM_FLASH_TIMER_LEDS ); vCreateBlockTimeTasks(); vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); vStartQueuePeekTasks(); - vStartInterruptQueueTasks(); - - /* Create the tasks defined within this file. */ - xTaskCreate( prvRegTestTask1, "Reg1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - xTaskCreate( prvRegTestTask2, "Reg2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - - /* Create the software timer that performs the 'check' functionality, as - described at the top of this file. */ - xTimer = xTimerCreate( "CheckTimer",/* A text name, purely to help debugging. */ - ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - if( xTimer != NULL ) - { - xTimerStart( xTimer, mainDONT_BLOCK ); - } - - /* 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. */ - xTimer = xTimerCreate( "HighHzTimerSetup", 1, pdFALSE, ( void * ) 0, prvSetupHighFrequencyTimerTest ); - if( xTimer != NULL ) - { - xTimerStart( xTimer, mainDONT_BLOCK ); - } - - /* Finally 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 - insufficient FreeRTOS heap memory available for the idle and/or timer tasks - to be created. See the memory management section on the FreeRTOS web site - for more details. */ - for( ;; ); + vStartInterruptQueueTasks(); + + /* Create the tasks defined within this file. */ + xTaskCreate( prvRegTestTask1, "Reg1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( prvRegTestTask2, "Reg2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + + /* Create the software timer that performs the 'check' functionality, as + * described at the top of this file. */ + xTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ + ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + if( xTimer != NULL ) + { + xTimerStart( xTimer, mainDONT_BLOCK ); + } + + /* 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. */ + xTimer = xTimerCreate( "HighHzTimerSetup", 1, pdFALSE, ( void * ) 0, prvSetupHighFrequencyTimerTest ); + + if( xTimer != NULL ) + { + xTimerStart( xTimer, mainDONT_BLOCK ); + } + + /* Finally 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 + * insufficient FreeRTOS heap memory available for the idle and/or timer tasks + * to be created. See the memory management section on the FreeRTOS web site + * for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvRegTestTask1( void *pvParameters ) +static void prvRegTestTask1( void * pvParameters ) { -extern void vRegTest1( volatile unsigned long * ); + extern void vRegTest1( volatile unsigned long * ); - /* Avoid compiler warnings. */ - ( void ) pvParameters; + /* Avoid compiler warnings. */ + ( void ) pvParameters; - /* Pass the address of the RegTest1 loop counter into the test function, - which is necessarily implemented in assembler. */ - vRegTest1( &ulRegTest1Cycles ); + /* Pass the address of the RegTest1 loop counter into the test function, + * which is necessarily implemented in assembler. */ + vRegTest1( &ulRegTest1Cycles ); - /* vRegTest1 should never exit! */ - vTaskDelete( NULL ); + /* vRegTest1 should never exit! */ + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ -static void prvRegTestTask2( void *pvParameters ) +static void prvRegTestTask2( void * pvParameters ) { -extern void vRegTest2( volatile unsigned long * ); + extern void vRegTest2( volatile unsigned long * ); - /* Avoid compiler warnings. */ - ( void ) pvParameters; + /* Avoid compiler warnings. */ + ( void ) pvParameters; - /* Pass the address of the RegTest2 loop counter into the test function, - which is necessarily implemented in assembler. */ - vRegTest2( &ulRegTest2Cycles ); + /* Pass the address of the RegTest2 loop counter into the test function, + * which is necessarily implemented in assembler. */ + vRegTest2( &ulRegTest2Cycles ); - /* vRegTest1 should never exit! */ - vTaskDelete( NULL ); + /* vRegTest1 should never exit! */ + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ static void prvCheckTimerCallback( TimerHandle_t xTimer ) { -static long lChangedTimerPeriodAlready = pdFALSE; -static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; + static long lChangedTimerPeriodAlready = pdFALSE; + static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; /* Buffer into which the high frequency timer count is written as a string. */ -static char cStringBuffer[ mainMAX_STRING_LENGTH ]; + static char cStringBuffer[ mainMAX_STRING_LENGTH ]; /* The count of the high frequency timer interrupts. */ -extern unsigned long ulHighFrequencyTimerInterrupts; -static xLCDMessage xMessage = { ( 200 / portTICK_PERIOD_MS ), cStringBuffer }; - - /* Check that the register test 1 task is still running. */ - if( ulLastRegTest1Value == ulRegTest1Cycles ) - { - xMessage.pcMessage = "Error: Reg test2"; - } - ulLastRegTest1Value = ulRegTest1Cycles; - - - /* Check that the register test 2 task is still running. */ - if( ulLastRegTest2Value == ulRegTest2Cycles ) - { - xMessage.pcMessage = "Error: Reg test3"; - } - ulLastRegTest2Value = ulRegTest2Cycles; - - - /* Have any of the standard demo tasks detected an error in their - operation? */ - if( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "Error: Gen Q"; - } - else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "Error: Q Peek"; - } - else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "Error: Blck time"; - } - else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "Error: Sem test"; - } - else if( xAreIntQueueTasksStillRunning() != pdTRUE ) - { - xMessage.pcMessage = "Error: Int queue"; - } - - if( xMessage.pcMessage != cStringBuffer ) - { - /* An error string has been logged. If the timer period has not yet - been changed it should be changed now. Increasing the frequency of the - LED gives visual feedback of the error status. */ - if( lChangedTimerPeriodAlready == pdFALSE ) - { - lChangedTimerPeriodAlready = pdTRUE; - - /* This call to xTimerChangePeriod() uses a zero block time. - Functions called from inside of a timer callback function must - *never* attempt to block as to do so could impact other software - timers. */ - xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); - } - } - else - { - /* Write the ulHighFrequencyTimerInterrupts value to the string - buffer. It will only be displayed if no errors have been detected. */ - sprintf( cStringBuffer, "Pass %u", ( unsigned int ) ulHighFrequencyTimerInterrupts ); - } - - vParTestToggleLED( mainCHECK_LED ); + extern unsigned long ulHighFrequencyTimerInterrupts; + static xLCDMessage xMessage = { ( 200 / portTICK_PERIOD_MS ), cStringBuffer }; + + /* Check that the register test 1 task is still running. */ + if( ulLastRegTest1Value == ulRegTest1Cycles ) + { + xMessage.pcMessage = "Error: Reg test2"; + } + + ulLastRegTest1Value = ulRegTest1Cycles; + + /* Check that the register test 2 task is still running. */ + if( ulLastRegTest2Value == ulRegTest2Cycles ) + { + xMessage.pcMessage = "Error: Reg test3"; + } + + ulLastRegTest2Value = ulRegTest2Cycles; + + /* Have any of the standard demo tasks detected an error in their + * operation? */ + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "Error: Gen Q"; + } + else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "Error: Q Peek"; + } + else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "Error: Blck time"; + } + else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "Error: Sem test"; + } + else if( xAreIntQueueTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "Error: Int queue"; + } + + if( xMessage.pcMessage != cStringBuffer ) + { + /* An error string has been logged. If the timer period has not yet + * been changed it should be changed now. Increasing the frequency of the + * LED gives visual feedback of the error status. */ + if( lChangedTimerPeriodAlready == pdFALSE ) + { + lChangedTimerPeriodAlready = pdTRUE; + + /* This call to xTimerChangePeriod() uses a zero block time. + * Functions called from inside of a timer callback function must + * never* attempt to block as to do so could impact other software + * timers. */ + xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); + } + } + else + { + /* Write the ulHighFrequencyTimerInterrupts value to the string + * buffer. It will only be displayed if no errors have been detected. */ + sprintf( cStringBuffer, "Pass %u", ( unsigned int ) ulHighFrequencyTimerInterrupts ); + } + + vParTestToggleLED( mainCHECK_LED ); } /*-----------------------------------------------------------*/ static void prvSetupHighFrequencyTimerTest( TimerHandle_t xTimer ) { - /* 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. */ - vSetupTimerTest( mainTEST_INTERRUPT_FREQUENCY ); + /* 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. */ + vSetupTimerTest( mainTEST_INTERRUPT_FREQUENCY ); } - diff --git a/FreeRTOS/Demo/PIC32MX_MPLAB/serial/serial.c b/FreeRTOS/Demo/PIC32MX_MPLAB/serial/serial.c index 120dd633e80..193e1280cdd 100644 --- a/FreeRTOS/Demo/PIC32MX_MPLAB/serial/serial.c +++ b/FreeRTOS/Demo/PIC32MX_MPLAB/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MX_MPLAB/timertest.c b/FreeRTOS/Demo/PIC32MX_MPLAB/timertest.c index 6e6767fac98..7630f3bbe7d 100644 --- a/FreeRTOS/Demo/PIC32MX_MPLAB/timertest.c +++ b/FreeRTOS/Demo/PIC32MX_MPLAB/timertest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MX_MPLAB/timertest.h b/FreeRTOS/Demo/PIC32MX_MPLAB/timertest.h index 0be42c8677c..8a8e11740fc 100644 --- a/FreeRTOS/Demo/PIC32MX_MPLAB/timertest.h +++ b/FreeRTOS/Demo/PIC32MX_MPLAB/timertest.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MZ_MPLAB/ConfigPerformance.c b/FreeRTOS/Demo/PIC32MZ_MPLAB/ConfigPerformance.c index e0aa2fe3f50..d626fdd276b 100644 --- a/FreeRTOS/Demo/PIC32MZ_MPLAB/ConfigPerformance.c +++ b/FreeRTOS/Demo/PIC32MZ_MPLAB/ConfigPerformance.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MZ_MPLAB/ConfigPerformance.h b/FreeRTOS/Demo/PIC32MZ_MPLAB/ConfigPerformance.h index d4dce6ce8c0..ce11176976a 100644 --- a/FreeRTOS/Demo/PIC32MZ_MPLAB/ConfigPerformance.h +++ b/FreeRTOS/Demo/PIC32MZ_MPLAB/ConfigPerformance.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MZ_MPLAB/FreeRTOSConfig.h b/FreeRTOS/Demo/PIC32MZ_MPLAB/FreeRTOSConfig.h index b449cf7ef5b..5f3bc02651b 100644 --- a/FreeRTOS/Demo/PIC32MZ_MPLAB/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/PIC32MZ_MPLAB/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MZ_MPLAB/ISRTriggeredTask.c b/FreeRTOS/Demo/PIC32MZ_MPLAB/ISRTriggeredTask.c index 684e24fbff9..fe7c43cf306 100644 --- a/FreeRTOS/Demo/PIC32MZ_MPLAB/ISRTriggeredTask.c +++ b/FreeRTOS/Demo/PIC32MZ_MPLAB/ISRTriggeredTask.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MZ_MPLAB/IntQueueTimer.c b/FreeRTOS/Demo/PIC32MZ_MPLAB/IntQueueTimer.c index 883099e31cd..c7faea1670f 100644 --- a/FreeRTOS/Demo/PIC32MZ_MPLAB/IntQueueTimer.c +++ b/FreeRTOS/Demo/PIC32MZ_MPLAB/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MZ_MPLAB/IntQueueTimer.h b/FreeRTOS/Demo/PIC32MZ_MPLAB/IntQueueTimer.h index 4fb214c4093..dc540323649 100644 --- a/FreeRTOS/Demo/PIC32MZ_MPLAB/IntQueueTimer.h +++ b/FreeRTOS/Demo/PIC32MZ_MPLAB/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MZ_MPLAB/ParTest/ParTest.c b/FreeRTOS/Demo/PIC32MZ_MPLAB/ParTest/ParTest.c index 1a5b6059596..2ca540679bc 100644 --- a/FreeRTOS/Demo/PIC32MZ_MPLAB/ParTest/ParTest.c +++ b/FreeRTOS/Demo/PIC32MZ_MPLAB/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MZ_MPLAB/flop_mz.c b/FreeRTOS/Demo/PIC32MZ_MPLAB/flop_mz.c index eff44d2e383..f65cef091f5 100644 --- a/FreeRTOS/Demo/PIC32MZ_MPLAB/flop_mz.c +++ b/FreeRTOS/Demo/PIC32MZ_MPLAB/flop_mz.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MZ_MPLAB/flop_mz.h b/FreeRTOS/Demo/PIC32MZ_MPLAB/flop_mz.h index f9eaefe1b7f..1e2d046dd2d 100644 --- a/FreeRTOS/Demo/PIC32MZ_MPLAB/flop_mz.h +++ b/FreeRTOS/Demo/PIC32MZ_MPLAB/flop_mz.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MZ_MPLAB/main.c b/FreeRTOS/Demo/PIC32MZ_MPLAB/main.c index 17bee2e3616..4bd16564fa3 100644 --- a/FreeRTOS/Demo/PIC32MZ_MPLAB/main.c +++ b/FreeRTOS/Demo/PIC32MZ_MPLAB/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ @@ -50,35 +50,35 @@ #include "ConfigPerformance.h" /* Core configuration fuse settings */ -#if defined(__32MZ2048ECM144) || defined(__32MZ2048ECH144) - #pragma config FMIIEN = OFF, FETHIO = OFF, PGL1WAY = OFF, PMDL1WAY = OFF, IOL1WAY = OFF, FUSBIDIO = OFF - #pragma config FNOSC = SPLL, FSOSCEN = OFF, IESO = OFF, POSCMOD = EC - #pragma config OSCIOFNC = OFF, FCKSM = CSECMD, FWDTEN = OFF, FDMTEN = OFF - #pragma config DMTINTV = WIN_127_128, WDTSPGM = STOP, WINDIS= NORMAL - #pragma config WDTPS = PS1048576, FWDTWINSZ = WINSZ_25, DMTCNT = DMT31 - #pragma config FPLLIDIV = DIV_3, FPLLRNG = RANGE_13_26_MHZ, FPLLICLK = PLL_POSC - #pragma config FPLLMULT = MUL_50, FPLLODIV = DIV_2, UPLLFSEL = FREQ_12MHZ, UPLLEN = OFF - #pragma config EJTAGBEN = NORMAL, DBGPER = PG_ALL, FSLEEP = OFF, FECCCON = OFF_UNLOCKED - #pragma config BOOTISA = MIPS32, TRCEN = ON, ICESEL = ICS_PGx2, JTAGEN = OFF, DEBUG = ON - #pragma config CP = OFF -#elif defined(__32MZ2048EFM144) || defined(__32MZ2048EFH144) - #pragma config FMIIEN = OFF, FETHIO = OFF, PGL1WAY = OFF, PMDL1WAY = OFF, IOL1WAY = OFF, FUSBIDIO = OFF - #pragma config FNOSC = SPLL, FSOSCEN = OFF, IESO = OFF, POSCMOD = EC - #pragma config OSCIOFNC = OFF, FCKSM = CSECMD, FWDTEN = OFF, FDMTEN = OFF - #pragma config DMTINTV = WIN_127_128, WDTSPGM = STOP, WINDIS= NORMAL - #pragma config WDTPS = PS1048576, FWDTWINSZ = WINSZ_25, DMTCNT = DMT31 - #pragma config FPLLIDIV = DIV_3, FPLLRNG = RANGE_13_26_MHZ, FPLLICLK = PLL_POSC - #pragma config FPLLMULT = MUL_50, FPLLODIV = DIV_2, UPLLFSEL = FREQ_12MHZ - #pragma config EJTAGBEN = NORMAL, DBGPER = PG_ALL, FSLEEP = OFF, FECCCON = OFF_UNLOCKED - #pragma config BOOTISA = MIPS32, TRCEN = ON, ICESEL = ICS_PGx2, JTAGEN = OFF, DEBUG = ON - #pragma config CP = OFF -#endif +#if defined( __32MZ2048ECM144 ) || defined( __32MZ2048ECH144 ) + #pragma config FMIIEN = OFF, FETHIO = OFF, PGL1WAY = OFF, PMDL1WAY = OFF, IOL1WAY = OFF, FUSBIDIO = OFF + #pragma config FNOSC = SPLL, FSOSCEN = OFF, IESO = OFF, POSCMOD = EC + #pragma config OSCIOFNC = OFF, FCKSM = CSECMD, FWDTEN = OFF, FDMTEN = OFF + #pragma config DMTINTV = WIN_127_128, WDTSPGM = STOP, WINDIS= NORMAL + #pragma config WDTPS = PS1048576, FWDTWINSZ = WINSZ_25, DMTCNT = DMT31 + #pragma config FPLLIDIV = DIV_3, FPLLRNG = RANGE_13_26_MHZ, FPLLICLK = PLL_POSC + #pragma config FPLLMULT = MUL_50, FPLLODIV = DIV_2, UPLLFSEL = FREQ_12MHZ, UPLLEN = OFF + #pragma config EJTAGBEN = NORMAL, DBGPER = PG_ALL, FSLEEP = OFF, FECCCON = OFF_UNLOCKED + #pragma config BOOTISA = MIPS32, TRCEN = ON, ICESEL = ICS_PGx2, JTAGEN = OFF, DEBUG = ON + #pragma config CP = OFF +#elif defined( __32MZ2048EFM144 ) || defined( __32MZ2048EFH144 ) + #pragma config FMIIEN = OFF, FETHIO = OFF, PGL1WAY = OFF, PMDL1WAY = OFF, IOL1WAY = OFF, FUSBIDIO = OFF + #pragma config FNOSC = SPLL, FSOSCEN = OFF, IESO = OFF, POSCMOD = EC + #pragma config OSCIOFNC = OFF, FCKSM = CSECMD, FWDTEN = OFF, FDMTEN = OFF + #pragma config DMTINTV = WIN_127_128, WDTSPGM = STOP, WINDIS= NORMAL + #pragma config WDTPS = PS1048576, FWDTWINSZ = WINSZ_25, DMTCNT = DMT31 + #pragma config FPLLIDIV = DIV_3, FPLLRNG = RANGE_13_26_MHZ, FPLLICLK = PLL_POSC + #pragma config FPLLMULT = MUL_50, FPLLODIV = DIV_2, UPLLFSEL = FREQ_12MHZ + #pragma config EJTAGBEN = NORMAL, DBGPER = PG_ALL, FSLEEP = OFF, FECCCON = OFF_UNLOCKED + #pragma config BOOTISA = MIPS32, TRCEN = ON, ICESEL = ICS_PGx2, JTAGEN = OFF, DEBUG = ON + #pragma config CP = OFF +#endif /* if defined( __32MZ2048ECM144 ) || defined( __32MZ2048ECH144 ) */ /*-----------------------------------------------------------*/ /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 /*-----------------------------------------------------------*/ @@ -101,174 +101,183 @@ extern void main_full( void ); */ int main( void ) { - /* Prepare the hardware to run this demo. */ - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* Prepare the hardware to run this demo. */ + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Configure the hardware for maximum performance. */ - vHardwareConfigurePerformance(); + /* Configure the hardware for maximum performance. */ + vHardwareConfigurePerformance(); - /* Setup to use the external interrupt controller. */ - vHardwareUseMultiVectoredInterrupts(); + /* Setup to use the external interrupt controller. */ + vHardwareUseMultiVectoredInterrupts(); - portDISABLE_INTERRUPTS(); + portDISABLE_INTERRUPTS(); - /* Setup the digital IO for the LED's. */ - vParTestInitialise(); + /* Setup the digital IO for the LED's. */ + vParTestInitialise(); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* Run time task stack overflow checking is performed if - configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is - called if a task stack overflow is detected. Note the system/interrupt - stack is not checked. */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* Run time task stack overflow checking is performed if + * configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is + * called if a task stack overflow is detected. Note the system/interrupt + * stack is not checked. */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* This function will be called by each tick interrupt if - configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - added here, but the tick hook is called from an interrupt context, so - code must not attempt to block, and only the interrupt safe FreeRTOS API - functions can be used (those that end in FromISR()). */ - - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 ) - { - /* Call the periodic queue overwrite from ISR demo. */ - vQueueOverwritePeriodicISRDemo(); - - /* Call the queue set ISR test function. */ - vQueueSetAccessQueueSetFromISR(); - - /* Exercise event groups from interrupts. */ - vPeriodicEventGroupsProcessing(); - } - #endif + /* This function will be called by each tick interrupt if + * configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + * added here, but the tick hook is called from an interrupt context, so + * code must not attempt to block, and only the interrupt safe FreeRTOS API + * functions can be used (those that end in FromISR()). */ + + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 ) + { + /* Call the periodic queue overwrite from ISR demo. */ + vQueueOverwritePeriodicISRDemo(); + + /* Call the queue set ISR test function. */ + vQueueSetAccessQueueSetFromISR(); + + /* Exercise event groups from interrupts. */ + vPeriodicEventGroupsProcessing(); + } + #endif /* if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 ) */ } /*-----------------------------------------------------------*/ -extern void vAssertCalled( const char * pcFile, unsigned long ulLine ) +extern void vAssertCalled( const char * pcFile, + unsigned long ulLine ) { -volatile char *pcFileName; -volatile unsigned long ulLineNumber; - - /* Prevent things that are useful to view in the debugger from being - optimised away. */ - pcFileName = ( char * ) pcFile; - ( void ) pcFileName; - ulLineNumber = ulLine; - - /* Set ulLineNumber to 0 in the debugger to break out of this loop and - return to the line that triggered the assert. */ - while( ulLineNumber != 0 ) - { - __asm volatile( "NOP" ); - __asm volatile( "NOP" ); - __asm volatile( "NOP" ); - __asm volatile( "NOP" ); - __asm volatile( "NOP" ); - } + volatile char * pcFileName; + volatile unsigned long ulLineNumber; + + /* Prevent things that are useful to view in the debugger from being + * optimised away. */ + pcFileName = ( char * ) pcFile; + ( void ) pcFileName; + ulLineNumber = ulLine; + + /* Set ulLineNumber to 0 in the debugger to break out of this loop and + * return to the line that triggered the assert. */ + while( ulLineNumber != 0 ) + { + __asm volatile ( "NOP" ); + __asm volatile ( "NOP" ); + __asm volatile ( "NOP" ); + __asm volatile ( "NOP" ); + __asm volatile ( "NOP" ); + } } /*-----------------------------------------------------------*/ /* This function overrides the normal _weak_ generic handler. */ -void _general_exception_handler(void) +void _general_exception_handler( void ) { -static enum { - EXCEP_IRQ = 0, /* interrupt */ - EXCEP_AdEL = 4, /* address error exception (load or ifetch) */ - EXCEP_AdES, /* address error exception (store) */ - EXCEP_IBE, /* bus error (ifetch) */ - EXCEP_DBE, /* bus error (load/store) */ - EXCEP_Sys, /* syscall */ - EXCEP_Bp, /* breakpoint */ - EXCEP_RI, /* reserved instruction */ - EXCEP_CpU, /* coprocessor unusable */ - EXCEP_Overflow, /* arithmetic overflow */ - EXCEP_Trap, /* trap (possible divide by zero) */ - EXCEP_FPE = 15, /* floating point exception */ - EXCEP_IS1 = 16, /* implementation specific 1 */ - EXCEP_CEU, /* CorExtend Unuseable */ - EXCEP_C2E, /* coprocessor 2 */ - EXCEP_DSPDis = 26 /* DSP module disabled */ -} _excep_code; - -static unsigned long _epc_code; -static unsigned long _excep_addr; - - asm volatile( "mfc0 %0,$13" : "=r" (_epc_code) ); - asm volatile( "mfc0 %0,$14" : "=r" (_excep_addr) ); - - _excep_code = ( _epc_code & 0x0000007C ) >> 2; - - for( ;; ) - { - /* prevent compiler warning */ - (void) _excep_code; - - /* Examine _excep_code to identify the type of exception. Examine - _excep_addr to find the address that caused the exception */ - LATHSET = 0x0007; - Nop(); - Nop(); - Nop(); - } + static enum + { + EXCEP_IRQ = 0, /* interrupt */ + EXCEP_AdEL = 4, /* address error exception (load or ifetch) */ + EXCEP_AdES, /* address error exception (store) */ + EXCEP_IBE, /* bus error (ifetch) */ + EXCEP_DBE, /* bus error (load/store) */ + EXCEP_Sys, /* syscall */ + EXCEP_Bp, /* breakpoint */ + EXCEP_RI, /* reserved instruction */ + EXCEP_CpU, /* coprocessor unusable */ + EXCEP_Overflow, /* arithmetic overflow */ + EXCEP_Trap, /* trap (possible divide by zero) */ + EXCEP_FPE = 15, /* floating point exception */ + EXCEP_IS1 = 16, /* implementation specific 1 */ + EXCEP_CEU, /* CorExtend Unuseable */ + EXCEP_C2E, /* coprocessor 2 */ + EXCEP_DSPDis = 26 /* DSP module disabled */ + } + _excep_code; + + static unsigned long _epc_code; + static unsigned long _excep_addr; + + asm volatile ( "mfc0 %0,$13" : "=r" ( _epc_code ) ); + asm volatile ( "mfc0 %0,$14" : "=r" ( _excep_addr ) ); + + _excep_code = ( _epc_code & 0x0000007C ) >> 2; + + for( ; ; ) + { + /* prevent compiler warning */ + ( void ) _excep_code; + + /* Examine _excep_code to identify the type of exception. Examine + * _excep_addr to find the address that caused the exception */ + LATHSET = 0x0007; + Nop(); + Nop(); + Nop(); + } } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/PIC32MZ_MPLAB/main_blinky.c b/FreeRTOS/Demo/PIC32MZ_MPLAB/main_blinky.c index 76de27e78d9..e9964853040 100644 --- a/FreeRTOS/Demo/PIC32MZ_MPLAB/main_blinky.c +++ b/FreeRTOS/Demo/PIC32MZ_MPLAB/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ @@ -70,41 +70,41 @@ #include "semphr.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /* Values passed to the two tasks just to check the task parameter -functionality. */ -#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) -#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) + * functionality. */ +#define mainQUEUE_SEND_PARAMETER ( 0x1111UL ) +#define mainQUEUE_RECEIVE_PARAMETER ( 0x22UL ) /* The period of the blinky software timer. The period is specified in ms and -converted to ticks using the portTICK_PERIOD_MS constant. */ -#define mainBLINKY_TIMER_PERIOD ( 50 / portTICK_PERIOD_MS ) + * converted to ticks using the portTICK_PERIOD_MS constant. */ +#define mainBLINKY_TIMER_PERIOD ( 50 / portTICK_PERIOD_MS ) /* The LED used by the communicating tasks and the blinky timer respectively. */ -#define mainTASKS_LED ( 0 ) -#define mainTIMER_LED ( 1 ) +#define mainTASKS_LED ( 0 ) +#define mainTIMER_LED ( 1 ) /* Misc. */ -#define mainDONT_BLOCK ( 0 ) +#define mainDONT_BLOCK ( 0 ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * The callback function for the blinky software timer, as described at the top @@ -127,120 +127,121 @@ static QueueHandle_t xQueue = NULL; void main_blinky( void ) { -TimerHandle_t xTimer; - - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); - configASSERT( xQueue ); - - if( xQueue != NULL ) - { - /* Create the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ - mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ - - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - - /* Create the blinky software timer as described at the top of this file. */ - xTimer = xTimerCreate( "Blinky", /* A text name, purely to help debugging. */ - ( mainBLINKY_TIMER_PERIOD ),/* The timer period. */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvBlinkyTimerCallback ); /* The callback function that inspects the status of all the other tasks. */ - configASSERT( xTimer ); - - if( xTimer != NULL ) - { - xTimerStart( xTimer, mainDONT_BLOCK ); - } - - /* Start the tasks and timer running. */ - 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 insufficient FreeRTOS heap memory available for the idle and/or - timer tasks to be created. See the memory management section on the - FreeRTOS web site for more details. http://www.freertos.org/a00111.html */ - for( ;; ); + TimerHandle_t xTimer; + + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); + configASSERT( xQueue ); + + if( xQueue != NULL ) + { + /* Create the two tasks as described in the comments at the top of this + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + ( void * ) mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ + + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + + /* Create the blinky software timer as described at the top of this file. */ + xTimer = xTimerCreate( "Blinky", /* A text name, purely to help debugging. */ + ( mainBLINKY_TIMER_PERIOD ), /* The timer period. */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvBlinkyTimerCallback ); /* The callback function that inspects the status of all the other tasks. */ + configASSERT( xTimer ); + + if( xTimer != NULL ) + { + xTimerStart( xTimer, mainDONT_BLOCK ); + } + + /* Start the tasks and timer running. */ + 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 insufficient FreeRTOS heap memory available for the idle and/or + * timer tasks to be created. See the memory management section on the + * FreeRTOS web site for more details. http://www.freertos.org/a00111.html */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; - - /* Remove compiler warnings in the case that configASSERT() is not dfined. */ - ( void ) pvParameters; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, the constant used converts ticks - to ms. While in the Blocked state this task will not consume any CPU - time. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - - /* 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 - will not block - it shouldn't need to block as the queue should always - be empty at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; + + /* Remove compiler warnings in the case that configASSERT() is not dfined. */ + ( void ) pvParameters; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER ); + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, the constant used converts ticks + * to ms. While in the Blocked state this task will not consume any CPU + * time. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + + /* 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 + * will not block - it shouldn't need to block as the queue should always + * be empty at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; - - /* Remove compiler warnings in the case where configASSERT() is not defined. */ - ( void ) pvParameters; - - /* Check the task parameter is as expected. */ - configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it the expected value? If it is, toggle the LED. */ - if( ulReceivedValue == 100UL ) - { - vParTestToggleLED( mainTASKS_LED ); - ulReceivedValue = 0U; - } - } + unsigned long ulReceivedValue; + + /* Remove compiler warnings in the case where configASSERT() is not defined. */ + ( void ) pvParameters; + + /* Check the task parameter is as expected. */ + configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER ); + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it the expected value? If it is, toggle the LED. */ + if( ulReceivedValue == 100UL ) + { + vParTestToggleLED( mainTASKS_LED ); + ulReceivedValue = 0U; + } + } } /*-----------------------------------------------------------*/ static void prvBlinkyTimerCallback( TimerHandle_t xTimer ) { - /* Avoid compiler warnings. */ - ( void ) xTimer; + /* Avoid compiler warnings. */ + ( void ) xTimer; - /* This function is called when the blinky software time expires. All the - function does is toggle the LED. LED mainTIMER_LED should therefore toggle - with the period set by mainBLINKY_TIMER_PERIOD. */ - vParTestToggleLED( mainTIMER_LED ); + /* This function is called when the blinky software time expires. All the + * function does is toggle the LED. LED mainTIMER_LED should therefore toggle + * with the period set by mainBLINKY_TIMER_PERIOD. */ + vParTestToggleLED( mainTIMER_LED ); } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/PIC32MZ_MPLAB/main_full.c b/FreeRTOS/Demo/PIC32MZ_MPLAB/main_full.c index fb0fc266969..67e88da481e 100644 --- a/FreeRTOS/Demo/PIC32MZ_MPLAB/main_full.c +++ b/FreeRTOS/Demo/PIC32MZ_MPLAB/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -58,7 +58,7 @@ * because they use interrupt safe FreeRTOS API functions. The high frequency * time is created with a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY, * so cannot us the same API functions. - + * * By way of demonstration, the demo application defines * configMAX_SYSCALL_INTERRUPT_PRIORITY to be 3, configKERNEL_INTERRUPT_PRIORITY * to be 1, and all other interrupts as follows: @@ -105,39 +105,39 @@ /*-----------------------------------------------------------*/ /* 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 mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS ) + * 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 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_PERIOD_MS constant. */ -#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) + * 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_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 mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainQUEUE_OVERWRITE_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#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 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 ) +#define mainCHECK_LED ( 2 ) /* The number of LEDs that should be controlled by the flash software timer -standard demo. In this case it is only 1 as the starter kit has three LEDs, one -of which is controlled by the check timer and one of which is controlled by the -ISR triggered task. */ -#define mainNUM_FLASH_TIMER_LEDS ( 1 ) + * standard demo. In this case it is only 1 as the starter kit has three LEDs, one + * of which is controlled by the check timer and one of which is controlled by the + * ISR triggered task. */ +#define mainNUM_FLASH_TIMER_LEDS ( 1 ) /* Misc. */ -#define mainDONT_BLOCK ( 0 ) +#define mainDONT_BLOCK ( 0 ) /* The frequency at which the "high frequency interrupt" interrupt will -occur. */ -#define mainTEST_INTERRUPT_FREQUENCY ( 20000 ) + * occur. */ +#define mainTEST_INTERRUPT_FREQUENCY ( 20000 ) /*-----------------------------------------------------------*/ @@ -162,8 +162,8 @@ static void prvSetupHighFrequencyTimerTest( TimerHandle_t xTimer ); * in and out between setting the register values and checking the register * values. */ -static void prvRegTestTask1( void *pvParameters ); -static void prvRegTestTask2( void *pvParameters ); +static void prvRegTestTask1( void * pvParameters ); +static void prvRegTestTask2( void * pvParameters ); /* * The task that is periodically triggered by an interrupt, as described at the @@ -174,8 +174,8 @@ extern void vStartISRTriggeredTask( void ); /*-----------------------------------------------------------*/ /* Variables incremented by prvRegTestTask1() and prvRegTestTask2() respectively -on each iteration of their function. These are used to detect errors in the -reg test tasks. */ + * on each iteration of their function. These are used to detect errors in the + * reg test tasks. */ volatile unsigned long ulRegTest1Cycles = 0, ulRegTest2Cycles = 0; /*-----------------------------------------------------------*/ @@ -185,231 +185,235 @@ volatile unsigned long ulRegTest1Cycles = 0, ulRegTest2Cycles = 0; */ int main_full( void ) { -TimerHandle_t xTimer = NULL; - - /* Create all the other standard demo tasks. */ - vStartLEDFlashTimers( mainNUM_FLASH_TIMER_LEDS ); - vCreateBlockTimeTasks(); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); - vStartQueuePeekTasks(); - vStartInterruptQueueTasks(); - vStartISRTriggeredTask(); - vStartCountingSemaphoreTasks(); - vStartDynamicPriorityTasks(); - 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. */ - "Reg1", /* Text name for the task to assist debugger - not used by FreeRTOS itself. */ - configMINIMAL_STACK_SIZE, /* The stack size to allocate for the task - specified in words not bytes. */ - NULL, /* The parameter to pass into the task - not used in this case so set to NULL. */ - tskIDLE_PRIORITY, /* The priority to assign to the task. */ - NULL ); /* Used to obtain a handle to the task being created - not used in this case so set to NULL. */ - - xTaskCreate( prvRegTestTask2, "Reg2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - - /* Create the software timer that performs the 'check' functionality, as - described at the top of this file. */ - xTimer = xTimerCreate( "CheckTimer",/* A text name, purely to help debugging. */ - ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvCheckTimerCallback ); /* The callback function that inspects the status of all the other tasks. */ - - if( xTimer != NULL ) - { - xTimerStart( xTimer, mainDONT_BLOCK ); - } - - /* 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. */ - xTimer = xTimerCreate( "HighHzTimerSetup", 1, pdFALSE, ( void * ) 0, prvSetupHighFrequencyTimerTest ); - if( xTimer != NULL ) - { - xTimerStart( xTimer, mainDONT_BLOCK ); - } - - /* Finally 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 - insufficient FreeRTOS heap memory available for the idle and/or timer tasks - to be created. See the memory management section on the FreeRTOS web site - for more details. http://www.freertos.org/a00111.html */ - for( ;; ); + TimerHandle_t xTimer = NULL; + + /* Create all the other standard demo tasks. */ + vStartLEDFlashTimers( mainNUM_FLASH_TIMER_LEDS ); + vCreateBlockTimeTasks(); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); + vStartQueuePeekTasks(); + vStartInterruptQueueTasks(); + vStartISRTriggeredTask(); + vStartCountingSemaphoreTasks(); + vStartDynamicPriorityTasks(); + 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. */ + "Reg1", /* Text name for the task to assist debugger - not used by FreeRTOS itself. */ + configMINIMAL_STACK_SIZE, /* The stack size to allocate for the task - specified in words not bytes. */ + NULL, /* The parameter to pass into the task - not used in this case so set to NULL. */ + tskIDLE_PRIORITY, /* The priority to assign to the task. */ + NULL ); /* Used to obtain a handle to the task being created - not used in this case so set to NULL. */ + + xTaskCreate( prvRegTestTask2, "Reg2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + + /* Create the software timer that performs the 'check' functionality, as + * described at the top of this file. */ + xTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ + ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvCheckTimerCallback ); /* The callback function that inspects the status of all the other tasks. */ + + if( xTimer != NULL ) + { + xTimerStart( xTimer, mainDONT_BLOCK ); + } + + /* 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. */ + xTimer = xTimerCreate( "HighHzTimerSetup", 1, pdFALSE, ( void * ) 0, prvSetupHighFrequencyTimerTest ); + + if( xTimer != NULL ) + { + xTimerStart( xTimer, mainDONT_BLOCK ); + } + + /* Finally 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 + * insufficient FreeRTOS heap memory available for the idle and/or timer tasks + * to be created. See the memory management section on the FreeRTOS web site + * for more details. http://www.freertos.org/a00111.html */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvRegTestTask1( void *pvParameters ) +static void prvRegTestTask1( void * pvParameters ) { -extern void vRegTest1( volatile unsigned long * ); + extern void vRegTest1( volatile unsigned long * ); - /* Avoid compiler warnings. */ - ( void ) pvParameters; + /* 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(); + /* 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 ); + /* Pass the address of the RegTest1 loop counter into the test function, + * which is necessarily implemented in assembler. */ + vRegTest1( &ulRegTest1Cycles ); - /* vRegTest1 should never exit! */ - vTaskDelete( NULL ); + /* vRegTest1 should never exit! */ + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ -static void prvRegTestTask2( void *pvParameters ) +static void prvRegTestTask2( void * pvParameters ) { -extern void vRegTest2( volatile unsigned long * ); + extern void vRegTest2( volatile unsigned long * ); - /* Avoid compiler warnings. */ - ( void ) pvParameters; + /* 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(); + /* 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 ); + /* Pass the address of the RegTest2 loop counter into the test function, + * which is necessarily implemented in assembler. */ + vRegTest2( &ulRegTest2Cycles ); - /* vRegTest1 should never exit! */ - vTaskDelete( NULL ); + /* vRegTest1 should never exit! */ + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ static void prvCheckTimerCallback( TimerHandle_t xTimer ) { -static long lChangedTimerPeriodAlready = pdFALSE; -static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0, ulLastHighFrequencyTimerInterrupts = 0; -static const unsigned long ulExpectedHighFrequencyInterrupts = ( ( mainTEST_INTERRUPT_FREQUENCY / 1000UL ) * mainCHECK_TIMER_PERIOD_MS ) - 10; /* 10 allows for a margin of error. */ -unsigned long ulErrorOccurred = pdFALSE; + static long lChangedTimerPeriodAlready = pdFALSE; + static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0, ulLastHighFrequencyTimerInterrupts = 0; + static const unsigned long ulExpectedHighFrequencyInterrupts = ( ( mainTEST_INTERRUPT_FREQUENCY / 1000UL ) * mainCHECK_TIMER_PERIOD_MS ) - 10; /* 10 allows for a margin of error. */ + unsigned long ulErrorOccurred = pdFALSE; /* The count of the high frequency timer interrupts. */ -extern unsigned long ulHighFrequencyTimerInterrupts; - - /* Avoid compiler warnings. */ - ( void ) xTimer; - - /* Check that the register test 1 task is still running. */ - if( ulLastRegTest1Value == ulRegTest1Cycles ) - { - ulErrorOccurred |= ( 0x01UL << 1UL ); - } - ulLastRegTest1Value = ulRegTest1Cycles; - - - /* Check that the register test 2 task is still running. */ - if( ulLastRegTest2Value == ulRegTest2Cycles ) - { - ulErrorOccurred |= ( 0x01UL << 2UL ); - } - ulLastRegTest2Value = ulRegTest2Cycles; - - /* Have any of the standard demo tasks detected an error in their - operation? */ - if( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - ulErrorOccurred |= ( 0x01UL << 3UL ); - } - else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) - { - ulErrorOccurred |= ( 0x01UL << 4UL ); - } - else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - ulErrorOccurred |= ( 0x01UL << 5UL ); - } - else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - ulErrorOccurred |= ( 0x01UL << 6UL ); - } - else if( xAreIntQueueTasksStillRunning() != pdTRUE ) - { - ulErrorOccurred |= ( 0x01UL << 7UL ); - } - else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) - { - ulErrorOccurred |= ( 0x01UL << 8UL ); - } - else if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - ulErrorOccurred |= ( 0x01UL << 9UL ); - } - else if( xIsQueueOverwriteTaskStillRunning() != pdTRUE ) - { - ulErrorOccurred |= ( 0x01UL << 10UL ); - } - else if( xAreQueueSetTasksStillRunning() != pdTRUE ) - { - ulErrorOccurred |= ( 0x01UL << 11UL ); - } - else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - 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 << 14UL ); - } - } - ulLastHighFrequencyTimerInterrupts = ulHighFrequencyTimerInterrupts; - - if( ulErrorOccurred != pdFALSE ) - { - /* An error occurred. Increase the frequency at which the check timer - toggles its LED to give visual feedback of the potential error - condition. */ - if( lChangedTimerPeriodAlready == pdFALSE ) - { - lChangedTimerPeriodAlready = pdTRUE; - - /* This call to xTimerChangePeriod() uses a zero block time. - Functions called from inside of a timer callback function must - *never* attempt to block as to do so could impact other software - timers. */ - xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); - } - } - - vParTestToggleLED( mainCHECK_LED ); + extern unsigned long ulHighFrequencyTimerInterrupts; + + /* Avoid compiler warnings. */ + ( void ) xTimer; + + /* Check that the register test 1 task is still running. */ + if( ulLastRegTest1Value == ulRegTest1Cycles ) + { + ulErrorOccurred |= ( 0x01UL << 1UL ); + } + + ulLastRegTest1Value = ulRegTest1Cycles; + + /* Check that the register test 2 task is still running. */ + if( ulLastRegTest2Value == ulRegTest2Cycles ) + { + ulErrorOccurred |= ( 0x01UL << 2UL ); + } + + ulLastRegTest2Value = ulRegTest2Cycles; + + /* Have any of the standard demo tasks detected an error in their + * operation? */ + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + ulErrorOccurred |= ( 0x01UL << 3UL ); + } + else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) + { + ulErrorOccurred |= ( 0x01UL << 4UL ); + } + else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + ulErrorOccurred |= ( 0x01UL << 5UL ); + } + else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + ulErrorOccurred |= ( 0x01UL << 6UL ); + } + else if( xAreIntQueueTasksStillRunning() != pdTRUE ) + { + ulErrorOccurred |= ( 0x01UL << 7UL ); + } + else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) + { + ulErrorOccurred |= ( 0x01UL << 8UL ); + } + else if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + ulErrorOccurred |= ( 0x01UL << 9UL ); + } + else if( xIsQueueOverwriteTaskStillRunning() != pdTRUE ) + { + ulErrorOccurred |= ( 0x01UL << 10UL ); + } + else if( xAreQueueSetTasksStillRunning() != pdTRUE ) + { + ulErrorOccurred |= ( 0x01UL << 11UL ); + } + else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + 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 << 14UL ); + } + } + + ulLastHighFrequencyTimerInterrupts = ulHighFrequencyTimerInterrupts; + + if( ulErrorOccurred != pdFALSE ) + { + /* An error occurred. Increase the frequency at which the check timer + * toggles its LED to give visual feedback of the potential error + * condition. */ + if( lChangedTimerPeriodAlready == pdFALSE ) + { + lChangedTimerPeriodAlready = pdTRUE; + + /* This call to xTimerChangePeriod() uses a zero block time. + * Functions called from inside of a timer callback function must + * never* attempt to block as to do so could impact other software + * timers. */ + xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); + } + } + + vParTestToggleLED( mainCHECK_LED ); } /*-----------------------------------------------------------*/ static void prvSetupHighFrequencyTimerTest( TimerHandle_t xTimer ) { -void vSetupTimerTest( unsigned short usFrequencyHz ); + void vSetupTimerTest( unsigned short usFrequencyHz ); - /* Avoid compiler warnings. */ - ( void ) xTimer; + /* Avoid compiler warnings. */ + ( void ) xTimer; - /* 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. */ - vSetupTimerTest( mainTEST_INTERRUPT_FREQUENCY ); + /* 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. */ + vSetupTimerTest( mainTEST_INTERRUPT_FREQUENCY ); } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/PIC32MZ_MPLAB/timertest.c b/FreeRTOS/Demo/PIC32MZ_MPLAB/timertest.c index 3f9f05ea3b7..065cc04ac97 100644 --- a/FreeRTOS/Demo/PIC32MZ_MPLAB/timertest.c +++ b/FreeRTOS/Demo/PIC32MZ_MPLAB/timertest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PIC32MZ_MPLAB/timertest.h b/FreeRTOS/Demo/PIC32MZ_MPLAB/timertest.h index 0be42c8677c..8a8e11740fc 100644 --- a/FreeRTOS/Demo/PIC32MZ_MPLAB/timertest.h +++ b/FreeRTOS/Demo/PIC32MZ_MPLAB/timertest.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/FreeRTOSConfig.h b/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/FreeRTOSConfig.h index d6b9efe07ed..a990fec8a35 100644 --- a/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.c b/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.c index c8b3f98088c..e5f29293f6d 100644 --- a/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.c +++ b/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.h b/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.h index 2ed931928d8..b90767cb4a8 100644 --- a/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.h +++ b/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop.c b/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop.c index 76de6d284ed..39fab109111 100644 --- a/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop.c +++ b/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/main.c b/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/main.c index fac75fee084..c0af8c1ccaf 100644 --- a/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/main.c +++ b/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/partest/partest.c b/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/partest/partest.c index 33c512cf225..abc2a201669 100644 --- a/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/partest/partest.c +++ b/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/partest/partest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/serial/serial.c b/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/serial/serial.c index 704a4060cf9..766f24a211c 100644 --- a/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/serial/serial.c +++ b/FreeRTOS/Demo/PPC440_DP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/FreeRTOSConfig.h b/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/FreeRTOSConfig.h index d6b9efe07ed..a990fec8a35 100644 --- a/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.c b/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.c index 68551a1ebc5..1ec8c301643 100644 --- a/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.c +++ b/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.h b/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.h index 2ed931928d8..b90767cb4a8 100644 --- a/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.h +++ b/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop.c b/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop.c index 4fd4215f479..a6cb6841aa8 100644 --- a/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop.c +++ b/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/main.c b/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/main.c index a655c2c5239..a20d3afa739 100644 --- a/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/main.c +++ b/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/partest/partest.c b/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/partest/partest.c index 33c512cf225..abc2a201669 100644 --- a/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/partest/partest.c +++ b/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/partest/partest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/serial/serial.c b/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/serial/serial.c index 704a4060cf9..766f24a211c 100644 --- a/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/serial/serial.c +++ b/FreeRTOS/Demo/PPC440_SP_FPU_Xilinx_Virtex5_GCC/RTOSDemo/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/FreeRTOSConfig.h b/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/FreeRTOSConfig.h index 47e231bc787..76a4b52ac94 100644 --- a/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.c b/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.c index 68551a1ebc5..1ec8c301643 100644 --- a/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.c +++ b/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.h b/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.h index 2ed931928d8..b90767cb4a8 100644 --- a/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.h +++ b/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop-reg-test.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop.c b/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop.c index 4fd4215f479..a6cb6841aa8 100644 --- a/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop.c +++ b/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/flop/flop.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/main.c b/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/main.c index 9bb172a0ab1..2d75b34f942 100644 --- a/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/main.c +++ b/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/partest/partest.c b/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/partest/partest.c index 63b50cad054..9d3e593d971 100644 --- a/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/partest/partest.c +++ b/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/partest/partest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/serial/serial.c b/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/serial/serial.c index 704a4060cf9..766f24a211c 100644 --- a/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/serial/serial.c +++ b/FreeRTOS/Demo/PPC440_Xilinx_Virtex5_GCC/RTOSDemo/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Posix_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/Posix_GCC/FreeRTOSConfig.h index 08efa3d87e6..346b9fe786f 100644 --- a/FreeRTOS/Demo/Posix_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/Posix_GCC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Posix_GCC/code_coverage_additions.c b/FreeRTOS/Demo/Posix_GCC/code_coverage_additions.c index 03b6cb042bb..f0336bc29d5 100644 --- a/FreeRTOS/Demo/Posix_GCC/code_coverage_additions.c +++ b/FreeRTOS/Demo/Posix_GCC/code_coverage_additions.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Posix_GCC/console.c b/FreeRTOS/Demo/Posix_GCC/console.c index 30b4e3f7d13..ba26b3fe86c 100644 --- a/FreeRTOS/Demo/Posix_GCC/console.c +++ b/FreeRTOS/Demo/Posix_GCC/console.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Posix_GCC/console.h b/FreeRTOS/Demo/Posix_GCC/console.h index 67542261ff9..b5922e7433f 100644 --- a/FreeRTOS/Demo/Posix_GCC/console.h +++ b/FreeRTOS/Demo/Posix_GCC/console.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Posix_GCC/main.c b/FreeRTOS/Demo/Posix_GCC/main.c index 1aad5d8b4ad..a4ea05d9512 100644 --- a/FreeRTOS/Demo/Posix_GCC/main.c +++ b/FreeRTOS/Demo/Posix_GCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -157,36 +157,36 @@ int main( void ) /* Do not include trace code when performing a code coverage analysis. */ #if ( projCOVERAGE_TEST != 1 ) - { - /* Initialise the trace recorder. Use of the trace recorder is optional. - * See http://www.FreeRTOS.org/trace for more information. */ - vTraceEnable( TRC_START ); + { + /* Initialise the trace recorder. Use of the trace recorder is optional. + * See http://www.FreeRTOS.org/trace for more information. */ + vTraceEnable( TRC_START ); - /* Start the trace recording - the recording is written to a file if - * configASSERT() is called. */ - printf( "\r\nTrace started.\r\nThe trace will be dumped to disk if a call to configASSERT() fails.\r\n" ); + /* Start the trace recording - the recording is written to a file if + * configASSERT() is called. */ + printf( "\r\nTrace started.\r\nThe trace will be dumped to disk if a call to configASSERT() fails.\r\n" ); - #if ( TRACE_ON_ENTER == 1 ) - printf( "\r\nThe trace will be dumped to disk if Enter is hit.\r\n" ); - #endif - } + #if ( TRACE_ON_ENTER == 1 ) + printf( "\r\nThe trace will be dumped to disk if Enter is hit.\r\n" ); + #endif + } #endif /* if ( projCOVERAGE_TEST != 1 ) */ console_init(); #if ( mainSELECTED_APPLICATION == BLINKY_DEMO ) - { - console_print( "Starting echo blinky demo\n" ); - main_blinky(); - } + { + console_print( "Starting echo blinky demo\n" ); + main_blinky(); + } #elif ( mainSELECTED_APPLICATION == FULL_DEMO ) - { - console_print( "Starting full demo\n" ); - main_full(); - } + { + console_print( "Starting full demo\n" ); + main_full(); + } #else - { - #error "The selected demo is not valid" - } + { + #error "The selected demo is not valid" + } #endif /* if ( mainSELECTED_APPLICATION ) */ return 0; @@ -228,11 +228,11 @@ void vApplicationIdleHook( void ) traceOnEnter(); #if ( mainSELECTED_APPLICATION == FULL_DEMO ) - { - /* Call the idle task processing used by the full demo. The simple - * blinky demo does not use the idle task hook. */ - vFullDemoIdleFunction(); - } + { + /* Call the idle task processing used by the full demo. The simple + * blinky demo does not use the idle task hook. */ + vFullDemoIdleFunction(); + } #endif } /*-----------------------------------------------------------*/ @@ -261,9 +261,9 @@ void vApplicationTickHook( void ) * functions can be used (those that end in FromISR()). */ #if ( mainSELECTED_APPLICATION == FULL_DEMO ) - { - vFullDemoTickHookFunction(); - } + { + vFullDemoTickHookFunction(); + } #endif /* mainSELECTED_APPLICATION */ } @@ -357,24 +357,24 @@ static void prvSaveTraceFile( void ) { /* Tracing is not used when code coverage analysis is being performed. */ #if ( projCOVERAGE_TEST != 1 ) - { - FILE * pxOutputFile; + { + FILE * pxOutputFile; - vTraceStop(); + vTraceStop(); - pxOutputFile = fopen( "Trace.dump", "wb" ); + pxOutputFile = fopen( "Trace.dump", "wb" ); - if( pxOutputFile != NULL ) - { - fwrite( RecorderDataPtr, sizeof( RecorderDataType ), 1, pxOutputFile ); - fclose( pxOutputFile ); - printf( "\r\nTrace output saved to Trace.dump\r\n" ); - } - else - { - printf( "\r\nFailed to create trace dump file\r\n" ); - } + if( pxOutputFile != NULL ) + { + fwrite( RecorderDataPtr, sizeof( RecorderDataType ), 1, pxOutputFile ); + fclose( pxOutputFile ); + printf( "\r\nTrace output saved to Trace.dump\r\n" ); + } + else + { + printf( "\r\nFailed to create trace dump file\r\n" ); } + } #endif /* if ( projCOVERAGE_TEST != 1 ) */ } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/Posix_GCC/main_blinky.c b/FreeRTOS/Demo/Posix_GCC/main_blinky.c index 74f33834188..c599c933a15 100644 --- a/FreeRTOS/Demo/Posix_GCC/main_blinky.c +++ b/FreeRTOS/Demo/Posix_GCC/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -195,9 +195,9 @@ static void prvQueueSendTask( void * pvParameters ) for( ; ; ) { /* Place this task in the blocked state until it is time to run again. - * The block time is specified in ticks, pdMS_TO_TICKS() was used to - * convert a time specified in milliseconds into a time specified in ticks. - * While in the Blocked state this task will not consume any CPU time. */ + * The block time is specified in ticks, pdMS_TO_TICKS() was used to + * convert a time specified in milliseconds into a time specified in ticks. + * While in the Blocked state this task will not consume any CPU time. */ vTaskDelayUntil( &xNextWakeTime, xBlockTime ); /* Send to the queue - causing the queue receive task to unblock and diff --git a/FreeRTOS/Demo/Posix_GCC/main_full.c b/FreeRTOS/Demo/Posix_GCC/main_full.c index 4302ac573db..0e966f6a2fa 100644 --- a/FreeRTOS/Demo/Posix_GCC/main_full.c +++ b/FreeRTOS/Demo/Posix_GCC/main_full.c @@ -227,23 +227,23 @@ int main_full( void ) vStartMessageBufferAMPTasks( configMINIMAL_STACK_SIZE ); #if ( configUSE_QUEUE_SETS == 1 ) - { - vStartQueueSetTasks(); - vStartQueueSetPollingTask(); - } + { + vStartQueueSetTasks(); + vStartQueueSetPollingTask(); + } #endif #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) - { - vStartStaticallyAllocatedTasks(); - } + { + vStartStaticallyAllocatedTasks(); + } #endif #if ( configUSE_PREEMPTION != 0 ) - { - /* Don't expect these tasks to pass when preemption is not used. */ - vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); - } + { + /* Don't expect these tasks to pass when preemption is not used. */ + vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); + } #endif /* The suicide tasks must be created last as they need to know how many @@ -284,14 +284,14 @@ static void prvCheckTask( void * pvParameters ) /* Check the standard demo tasks are running without error. */ #if ( configUSE_PREEMPTION != 0 ) + { + /* These tasks are only created when preemption is used. */ + if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE ) { - /* These tasks are only created when preemption is used. */ - if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE ) - { - pcStatusMessage = "Error: TimerDemo"; - xErrorCount++; - } + pcStatusMessage = "Error: TimerDemo"; + xErrorCount++; } + } #endif if( xAreStreamBufferTasksStillRunning() != pdTRUE ) @@ -517,21 +517,21 @@ void vFullDemoIdleFunction( void ) /* Exit after a fixed time so code coverage results are written to the * disk. */ #if ( projCOVERAGE_TEST == 1 ) - { - const TickType_t xMaxRunTime = pdMS_TO_TICKS( 30000UL ); + { + const TickType_t xMaxRunTime = pdMS_TO_TICKS( 30000UL ); - /* Exercise code not otherwise executed by standard demo/test tasks. */ - if( xRunCodeCoverageTestAdditions() != pdPASS ) - { - pcStatusMessage = "Code coverage additions failed.\r\n"; - xErrorCount++; - } + /* Exercise code not otherwise executed by standard demo/test tasks. */ + if( xRunCodeCoverageTestAdditions() != pdPASS ) + { + pcStatusMessage = "Code coverage additions failed.\r\n"; + xErrorCount++; + } - if( ( xTaskGetTickCount() - configINITIAL_TICK_COUNT ) >= xMaxRunTime ) - { - vTaskEndScheduler(); - } + if( ( xTaskGetTickCount() - configINITIAL_TICK_COUNT ) >= xMaxRunTime ) + { + vTaskEndScheduler(); } + } #endif /* if ( projCOVERAGE_TEST == 1 ) */ } /*-----------------------------------------------------------*/ @@ -544,22 +544,22 @@ void vFullDemoTickHookFunction( void ) /* Call the periodic timer test, which tests the timer API functions that * can be called from an ISR. */ #if ( configUSE_PREEMPTION != 0 ) - { - /* Only created when preemption is used. */ - vTimerPeriodicISRTests(); - } + { + /* Only created when preemption is used. */ + vTimerPeriodicISRTests(); + } #endif /* Call the periodic queue overwrite from ISR demo. */ vQueueOverwritePeriodicISRDemo(); #if ( configUSE_QUEUE_SETS == 1 ) /* Remove the tests if queue sets are not defined. */ - { - /* Write to a queue that is in use as part of the queue set demo to - * demonstrate using queue sets from an ISR. */ - vQueueSetAccessQueueSetFromISR(); - vQueueSetPollingInterruptAccess(); - } + { + /* Write to a queue that is in use as part of the queue set demo to + * demonstrate using queue sets from an ISR. */ + vQueueSetAccessQueueSetFromISR(); + vQueueSetPollingInterruptAccess(); + } #endif /* Exercise event groups from interrupts. */ @@ -923,7 +923,7 @@ static void prvDemonstrateChangingTimerReloadMode( void * pvParameters ) ( void ) pvParameters; /* The duration of 1 period is kept at 50ms to allow IDLE task to - * free up this task's resources before suicidal tests can run. */ + * free up this task's resources before suicidal tests can run. */ xTimer = xTimerCreate( pcTimerName, x50ms, pdFALSE, /* Created as a one-shot timer. */ diff --git a/FreeRTOS/Demo/Posix_GCC/run-time-stats-utils.c b/FreeRTOS/Demo/Posix_GCC/run-time-stats-utils.c index c5271d0b9ba..ce55007087f 100644 --- a/FreeRTOS/Demo/Posix_GCC/run-time-stats-utils.c +++ b/FreeRTOS/Demo/Posix_GCC/run-time-stats-utils.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/FreeRTOSConfig.h index 1d3d944ad33..3bc0f8e1dcb 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/blinky_demo/main_blinky.c b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/blinky_demo/main_blinky.c index bba1a59369e..f9a3a2edda6 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/blinky_demo/main_blinky.c +++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/blinky_demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/full_demo/main_full.c b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/full_demo/main_full.c index adb32539363..469c5f656ae 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/full_demo/main_full.c +++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/full_demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/main.c b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/main.c index 147533400c7..e1b09864caa 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/main.c +++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-Eclipse-GCC/main.c @@ -72,18 +72,18 @@ */ /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 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. */ #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 - extern void main_blinky( void ); + extern void main_blinky( void ); #else - #warning At the time of writing the QEMU MTIME behaviour is erratic, resulting in test failures. - extern void main_full( void ); + #warning At the time of writing the QEMU MTIME behaviour is erratic, resulting in test failures. + extern void main_full( void ); #endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */ /* @@ -92,7 +92,8 @@ or 0 to run the more comprehensive test and demo application. */ */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /* Trap handler implemented in the portASM.S file. */ @@ -109,102 +110,112 @@ void vSendString( const char * pcString ); int main( void ) { - /* Program mtvec with the FreeRTOS trap handler. */ - __asm__ volatile( "csrw mtvec, %0" :: "r"( freertos_risc_v_trap_handler ) ); - - vSendString( "Starting" ); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - { - main_blinky(); - } - #else - { - main_full(); - } - #endif + /* Program mtvec with the FreeRTOS trap handler. */ + __asm__ volatile ( "csrw mtvec, %0" : : "r" ( freertos_risc_v_trap_handler ) ); + + vSendString( "Starting" ); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + { + main_blinky(); + } + #else + { + main_full(); + } + #endif } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* The tests in the full demo expect some interaction with interrupts. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) - { - extern void vFullDemoTickHook( void ); - vFullDemoTickHook(); - } - #endif + /* The tests in the full demo expect some interaction with interrupts. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) + { + extern void vFullDemoTickHook( void ); + vFullDemoTickHook(); + } + #endif } /*-----------------------------------------------------------*/ void vAssertCalled( void ) { -volatile uint32_t ulSetTo1ToExitFunction = 0; + volatile uint32_t ulSetTo1ToExitFunction = 0; + + taskDISABLE_INTERRUPTS(); - taskDISABLE_INTERRUPTS(); - while( ulSetTo1ToExitFunction != 1 ) - { - __asm volatile( "NOP" ); - } + while( ulSetTo1ToExitFunction != 1 ) + { + __asm volatile ( "NOP" ); + } } /*-----------------------------------------------------------*/ void vSendString( const char * pcString ) { -const uint32_t ulTxFifoFullBit = 0x80000000UL; - - while( *pcString != 0x00 ) - { - while( ( UART0_REG( UART_REG_TXFIFO ) & ulTxFifoFullBit ) != 0UL ); - UART0_REG( UART_REG_TXFIFO ) = *pcString; - pcString++; - } -} + const uint32_t ulTxFifoFullBit = 0x80000000UL; + + while( *pcString != 0x00 ) + { + while( ( UART0_REG( UART_REG_TXFIFO ) & ulTxFifoFullBit ) != 0UL ) + { + } + UART0_REG( UART_REG_TXFIFO ) = *pcString; + pcString++; + } +} diff --git a/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/main.c b/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/main.c index 7bee44cbd55..b060c3d9303 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/main.c +++ b/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -29,15 +29,16 @@ #include /* Run a simple demo just prints 'Blink' */ -#define DEMO_BLINKY 1 -#define mainVECTOR_MODE_DIRECT 1 +#define DEMO_BLINKY 1 +#define mainVECTOR_MODE_DIRECT 1 extern void freertos_risc_v_trap_handler( void ); extern void freertos_vector_table( void ); void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); int main_blinky( void ); @@ -46,70 +47,78 @@ int main_blinky( void ); int main( void ) { - int ret; - // trap handler initialization - #if( mainVECTOR_MODE_DIRECT == 1 ) - { - __asm__ volatile( "csrw mtvec, %0" :: "r"( freertos_risc_v_trap_handler ) ); - } - #else - { - __asm__ volatile( "csrw mtvec, %0" :: "r"( ( uintptr_t )freertos_vector_table | 0x1 ) ); - } - #endif - -#if defined(DEMO_BLINKY) - ret = main_blinky(); -#else -#error "Please add or select demo." -#endif - - return ret; + int ret; + + /* trap handler initialization */ + #if ( mainVECTOR_MODE_DIRECT == 1 ) + { + __asm__ volatile ( "csrw mtvec, %0" : : "r" ( freertos_risc_v_trap_handler ) ); + } + #else + { + __asm__ volatile ( "csrw mtvec, %0" : : "r" ( ( uintptr_t ) freertos_vector_table | 0x1 ) ); + } + #endif + + #if defined( DEMO_BLINKY ) + ret = main_blinky(); + #else + #error "Please add or select demo." + #endif + + return ret; } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ @@ -120,11 +129,12 @@ void vApplicationTickHook( void ) void vAssertCalled( void ) { -volatile uint32_t ulSetTo1ToExitFunction = 0; + volatile uint32_t ulSetTo1ToExitFunction = 0; + + taskDISABLE_INTERRUPTS(); - taskDISABLE_INTERRUPTS(); - while( ulSetTo1ToExitFunction != 1 ) - { - __asm volatile( "NOP" ); - } + while( ulSetTo1ToExitFunction != 1 ) + { + __asm volatile ( "NOP" ); + } } diff --git a/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/main_blinky.c b/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/main_blinky.c index 6511567aedd..27f5e8ea915 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/main_blinky.c +++ b/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -20,7 +20,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * https://www.FreeRTOS.org - * https://www.github.com/FreeRTOS + * https://github.com/FreeRTOS * */ @@ -35,20 +35,20 @@ #include "ns16550.h" /* Priorities used by the tasks. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the pdMS_TO_TICKS() macro. */ -#define mainQUEUE_SEND_FREQUENCY_MS pdMS_TO_TICKS( 1000 ) + * to ticks using the pdMS_TO_TICKS() macro. */ +#define mainQUEUE_SEND_FREQUENCY_MS pdMS_TO_TICKS( 1000 ) /* 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 -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 -it at any time, and even with a queue length of 1, the sending task will never -find the queue full. */ -#define mainQUEUE_LENGTH ( 1 ) + * 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 + * 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 + * find the queue full. */ +#define mainQUEUE_LENGTH ( 1 ) /*-----------------------------------------------------------*/ @@ -57,103 +57,103 @@ static QueueHandle_t xQueue = NULL; /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; -const char * const pcMessage1 = "Transfer1"; -const char * const pcMessage2 = "Transfer2"; -int f = 1; - - /* Remove compiler warning about unused parameter. */ - ( void ) pvParameters; - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - char buf[40]; - - sprintf( buf, "%d: %s: %s", xGetCoreID(), - pcTaskGetName( xTaskGetCurrentTaskHandle() ), - ( f ) ? pcMessage1 : pcMessage2 ); - vSendString( buf ); - f = !f; - - /* Place this task in the blocked state until it is time to run again. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - - /* 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 - will not block - it shouldn't need to block as the queue should always - be empty at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; + const char * const pcMessage1 = "Transfer1"; + const char * const pcMessage2 = "Transfer2"; + int f = 1; + + /* Remove compiler warning about unused parameter. */ + ( void ) pvParameters; + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + char buf[ 40 ]; + + sprintf( buf, "%d: %s: %s", xGetCoreID(), + pcTaskGetName( xTaskGetCurrentTaskHandle() ), + ( f ) ? pcMessage1 : pcMessage2 ); + vSendString( buf ); + f = !f; + + /* Place this task in the blocked state until it is time to run again. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + + /* 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 + * will not block - it shouldn't need to block as the queue should always + * be empty at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; -const unsigned long ulExpectedValue = 100UL; -const char * const pcMessage1 = "Blink1"; -const char * const pcMessage2 = "Blink2"; -const char * const pcFailMessage = "Unexpected value received\r\n"; -int f = 1; - - /* Remove compiler warning about unused parameter. */ - ( void ) pvParameters; - - for( ;; ) - { - char buf[40]; - - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it the expected value? If it is, toggle the LED. */ - if( ulReceivedValue == ulExpectedValue ) - { - sprintf( buf, "%d: %s: %s", xGetCoreID(), - pcTaskGetName( xTaskGetCurrentTaskHandle() ), - ( f ) ? pcMessage1 : pcMessage2 ); - vSendString( buf ); - f = !f; - - ulReceivedValue = 0U; - } - else - { - vSendString( pcFailMessage ); - } - } + unsigned long ulReceivedValue; + const unsigned long ulExpectedValue = 100UL; + const char * const pcMessage1 = "Blink1"; + const char * const pcMessage2 = "Blink2"; + const char * const pcFailMessage = "Unexpected value received\r\n"; + int f = 1; + + /* Remove compiler warning about unused parameter. */ + ( void ) pvParameters; + + for( ; ; ) + { + char buf[ 40 ]; + + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it the expected value? If it is, toggle the LED. */ + if( ulReceivedValue == ulExpectedValue ) + { + sprintf( buf, "%d: %s: %s", xGetCoreID(), + pcTaskGetName( xTaskGetCurrentTaskHandle() ), + ( f ) ? pcMessage1 : pcMessage2 ); + vSendString( buf ); + f = !f; + + ulReceivedValue = 0U; + } + else + { + vSendString( pcFailMessage ); + } + } } /*-----------------------------------------------------------*/ int main_blinky( void ) { - vSendString( "Hello FreeRTOS!" ); + vSendString( "Hello FreeRTOS!" ); - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); - if( xQueue != NULL ) - { - /* Start the two tasks as described in the comments at the top of this - file. */ - xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE * 2U, NULL, - mainQUEUE_RECEIVE_TASK_PRIORITY, NULL ); - xTaskCreate( prvQueueSendTask, "Tx", configMINIMAL_STACK_SIZE * 2U, NULL, - mainQUEUE_SEND_TASK_PRIORITY, NULL ); - } + if( xQueue != NULL ) + { + /* Start the two tasks as described in the comments at the top of this + * file. */ + xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE * 2U, NULL, + mainQUEUE_RECEIVE_TASK_PRIORITY, NULL ); + xTaskCreate( prvQueueSendTask, "Tx", configMINIMAL_STACK_SIZE * 2U, NULL, + mainQUEUE_SEND_TASK_PRIORITY, NULL ); + } - vTaskStartScheduler(); + vTaskStartScheduler(); - return 0; + return 0; } diff --git a/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/ns16550.c b/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/ns16550.c index 39fc5304ac1..b508fe56db0 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/ns16550.c +++ b/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/ns16550.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/ns16550.h b/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/ns16550.h index 311355786e6..33ec8aa1a51 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/ns16550.h +++ b/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/ns16550.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/riscv-reg.h b/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/riscv-reg.h index 4cb852a3c47..78373ef8a6a 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/riscv-reg.h +++ b/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/riscv-reg.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/riscv-virt.c b/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/riscv-virt.c index d5d189a9ec3..5028e97b3b7 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/riscv-virt.c +++ b/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/riscv-virt.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/riscv-virt.h b/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/riscv-virt.h index ed72a68a259..c6c54d69160 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/riscv-virt.h +++ b/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/riscv-virt.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V-spike-htif_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/RISC-V-spike-htif_GCC/FreeRTOSConfig.h index 1754d5bc884..9f084186b3c 100644 --- a/FreeRTOS/Demo/RISC-V-spike-htif_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RISC-V-spike-htif_GCC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V-spike-htif_GCC/main.c b/FreeRTOS/Demo/RISC-V-spike-htif_GCC/main.c index b8b7fb1d5aa..b1e9484bb99 100644 --- a/FreeRTOS/Demo/RISC-V-spike-htif_GCC/main.c +++ b/FreeRTOS/Demo/RISC-V-spike-htif_GCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -29,13 +29,14 @@ #include /* Run a simple demo just prints 'Blink' */ -#define DEMO_BLINKY 1 +#define DEMO_BLINKY 1 extern void freertos_risc_v_trap_handler( void ); void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /* @@ -49,66 +50,74 @@ int main_blinky( void ); int main( void ) { - int ret; - prvSetupSpike(); + int ret; -#if defined(DEMO_BLINKY) - ret = main_blinky(); -#else -#error "Please add or select demo." -#endif + prvSetupSpike(); - return ret; + #if defined( DEMO_BLINKY ) + ret = main_blinky(); + #else + #error "Please add or select demo." + #endif + + return ret; } /*-----------------------------------------------------------*/ static void prvSetupSpike( void ) { - __asm__ volatile( "csrw mtvec, %0" :: "r"( freertos_risc_v_trap_handler ) ); + __asm__ volatile ( "csrw mtvec, %0" : : "r" ( freertos_risc_v_trap_handler ) ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ @@ -119,11 +128,12 @@ void vApplicationTickHook( void ) void vAssertCalled( void ) { -volatile uint32_t ulSetTo1ToExitFunction = 0; + volatile uint32_t ulSetTo1ToExitFunction = 0; + + taskDISABLE_INTERRUPTS(); - taskDISABLE_INTERRUPTS(); - while( ulSetTo1ToExitFunction != 1 ) - { - __asm volatile( "NOP" ); - } + while( ulSetTo1ToExitFunction != 1 ) + { + __asm volatile ( "NOP" ); + } } diff --git a/FreeRTOS/Demo/RISC-V-spike-htif_GCC/main_blinky.c b/FreeRTOS/Demo/RISC-V-spike-htif_GCC/main_blinky.c index 5691569f581..5530f3fa309 100644 --- a/FreeRTOS/Demo/RISC-V-spike-htif_GCC/main_blinky.c +++ b/FreeRTOS/Demo/RISC-V-spike-htif_GCC/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -34,20 +34,20 @@ #include "riscv-virt.h" /* Priorities used by the tasks. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the pdMS_TO_TICKS() macro. */ -#define mainQUEUE_SEND_FREQUENCY_MS pdMS_TO_TICKS( 1000 ) + * to ticks using the pdMS_TO_TICKS() macro. */ +#define mainQUEUE_SEND_FREQUENCY_MS pdMS_TO_TICKS( 1000 ) /* 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 -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 -it at any time, and even with a queue length of 1, the sending task will never -find the queue full. */ -#define mainQUEUE_LENGTH ( 1 ) + * 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 + * 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 + * find the queue full. */ +#define mainQUEUE_LENGTH ( 1 ) /*-----------------------------------------------------------*/ @@ -56,82 +56,82 @@ static QueueHandle_t xQueue = NULL; /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { - TickType_t xNextWakeTime; - unsigned long ulValueToSend = 0UL; + TickType_t xNextWakeTime; + unsigned long ulValueToSend = 0UL; - /* Remove compiler warning about unused parameter. */ - ( void ) pvParameters; + /* Remove compiler warning about unused parameter. */ + ( void ) pvParameters; - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. */ - vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. */ + vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); - ulValueToSend++; + ulValueToSend++; - char buf[40]; - sprintf( buf, "%d: %s: send %ld", xGetCoreID(), - pcTaskGetName( xTaskGetCurrentTaskHandle() ), - ulValueToSend ); - vSendString( buf ); + char buf[ 40 ]; + sprintf( buf, "%d: %s: send %ld", xGetCoreID(), + pcTaskGetName( xTaskGetCurrentTaskHandle() ), + ulValueToSend ); + vSendString( buf ); - /* 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 be empty at - * this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } + /* 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 be empty at + * this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { - /* Remove compiler warning about unused parameter. */ - ( void ) pvParameters; - - for( ;; ) - { - - unsigned long ulReceivedValue; - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue. */ - char buf[40]; - sprintf( buf, "%d: %s: received %ld", xGetCoreID(), - pcTaskGetName( xTaskGetCurrentTaskHandle() ), - ulReceivedValue ); - vSendString( buf ); - } + /* Remove compiler warning about unused parameter. */ + ( void ) pvParameters; + + for( ; ; ) + { + unsigned long ulReceivedValue; + + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue. */ + char buf[ 40 ]; + sprintf( buf, "%d: %s: received %ld", xGetCoreID(), + pcTaskGetName( xTaskGetCurrentTaskHandle() ), + ulReceivedValue ); + vSendString( buf ); + } } /*-----------------------------------------------------------*/ int main_blinky( void ) { - vSendString( "Hello FreeRTOS!" ); + vSendString( "Hello FreeRTOS!" ); - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); - if( xQueue != NULL ) - { - /* Start the two tasks as described in the comments at the top of this - file. */ - xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE * 2U, NULL, - mainQUEUE_RECEIVE_TASK_PRIORITY, NULL ); - xTaskCreate( prvQueueSendTask, "Tx", configMINIMAL_STACK_SIZE * 2U, NULL, - mainQUEUE_SEND_TASK_PRIORITY, NULL ); - } + if( xQueue != NULL ) + { + /* Start the two tasks as described in the comments at the top of this + * file. */ + xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE * 2U, NULL, + mainQUEUE_RECEIVE_TASK_PRIORITY, NULL ); + xTaskCreate( prvQueueSendTask, "Tx", configMINIMAL_STACK_SIZE * 2U, NULL, + mainQUEUE_SEND_TASK_PRIORITY, NULL ); + } - vTaskStartScheduler(); + vTaskStartScheduler(); - return 0; + return 0; } diff --git a/FreeRTOS/Demo/RISC-V-spike-htif_GCC/riscv-reg.h b/FreeRTOS/Demo/RISC-V-spike-htif_GCC/riscv-reg.h index fd5723d37aa..a5372311aae 100644 --- a/FreeRTOS/Demo/RISC-V-spike-htif_GCC/riscv-reg.h +++ b/FreeRTOS/Demo/RISC-V-spike-htif_GCC/riscv-reg.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V-spike-htif_GCC/riscv-virt.c b/FreeRTOS/Demo/RISC-V-spike-htif_GCC/riscv-virt.c index 658b3e6cf5f..8587b992af7 100644 --- a/FreeRTOS/Demo/RISC-V-spike-htif_GCC/riscv-virt.c +++ b/FreeRTOS/Demo/RISC-V-spike-htif_GCC/riscv-virt.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V-spike-htif_GCC/riscv-virt.h b/FreeRTOS/Demo/RISC-V-spike-htif_GCC/riscv-virt.h index f0d8be35904..1110372a080 100644 --- a/FreeRTOS/Demo/RISC-V-spike-htif_GCC/riscv-virt.h +++ b/FreeRTOS/Demo/RISC-V-spike-htif_GCC/riscv-virt.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/FreeRTOSConfig.h b/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/FreeRTOSConfig.h index 75ccb0ca822..6089c6f552a 100644 --- a/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/blinky_demo/main_blinky.c b/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/blinky_demo/main_blinky.c index 4ccc982f989..75355fa541f 100644 --- a/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/blinky_demo/main_blinky.c +++ b/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/blinky_demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/full_demo/main_full.c b/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/full_demo/main_full.c index 55a85f37161..886b48d3148 100644 --- a/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/full_demo/main_full.c +++ b/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/full_demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/main.c b/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/main.c index 42cf825cdaa..8fe59d4cb81 100644 --- a/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/main.c +++ b/FreeRTOS/Demo/RISC-V_RV32M1_Vega_GCC_Eclipse/projects/RTOSDemo_ri5cy/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/FreeRTOSConfig.h index e44cc1c825d..21a2938648c 100644 --- a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/main.c b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/main.c index fdfb58efb0c..1eac0409575 100644 --- a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/main.c +++ b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -56,40 +56,40 @@ #include /* This project provides two demo applications. A simple blinky style demo -application, and a more comprehensive test and demo application. The -mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is used to select between the two. - -If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is 1 then the blinky demo will be built. -The blinky demo is implemented and described in main_blinky.c. - -If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is not 1 then the comprehensive test and -demo application will be built. The comprehensive test and demo application is -implemented and described in main_full.c. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 + * application, and a more comprehensive test and demo application. The + * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is used to select between the two. + * + * If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is 1 then the blinky demo will be built. + * The blinky demo is implemented and described in main_blinky.c. + * + * If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is not 1 then the comprehensive test and + * demo application will be built. The comprehensive test and demo application is + * implemented and described in main_full.c. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 /* Set to 1 to use direct mode and set to 0 to use vectored mode. -VECTOR MODE=Direct --> all traps into machine mode cause the pc to be set to the -vector base address (BASE) in the mtvec register. -VECTOR MODE=Vectored --> all synchronous exceptions into machine mode cause the -pc to be set to the BASE, whereas interrupts cause the pc to be set to the -address BASE plus four times the interrupt cause number. -*/ -#define mainVECTOR_MODE_DIRECT 0 + * VECTOR MODE=Direct --> all traps into machine mode cause the pc to be set to the + * vector base address (BASE) in the mtvec register. + * VECTOR MODE=Vectored --> all synchronous exceptions into machine mode cause the + * pc to be set to the BASE, whereas interrupts cause the pc to be set to the + * address BASE plus four times the interrupt cause number. + */ +#define mainVECTOR_MODE_DIRECT 0 /* printf() output uses the UART. These constants define the addresses of the -required UART registers. */ -#define UART0_ADDRESS ( 0x40004000UL ) -#define UART0_DATA ( * ( ( ( volatile uint32_t * )( UART0_ADDRESS + 0UL ) ) ) ) -#define UART0_STATE ( * ( ( ( volatile uint32_t * )( UART0_ADDRESS + 4UL ) ) ) ) -#define UART0_CTRL ( * ( ( ( volatile uint32_t * )( UART0_ADDRESS + 8UL ) ) ) ) -#define UART0_BAUDDIV ( * ( ( ( volatile uint32_t * )( UART0_ADDRESS + 16UL ) ) ) ) -#define TX_BUFFER_MASK ( 1UL ) + * required UART registers. */ +#define UART0_ADDRESS ( 0x40004000UL ) +#define UART0_DATA ( *( ( ( volatile uint32_t * ) ( UART0_ADDRESS + 0UL ) ) ) ) +#define UART0_STATE ( *( ( ( volatile uint32_t * ) ( UART0_ADDRESS + 4UL ) ) ) ) +#define UART0_CTRL ( *( ( ( volatile uint32_t * ) ( UART0_ADDRESS + 8UL ) ) ) ) +#define UART0_BAUDDIV ( *( ( ( volatile uint32_t * ) ( UART0_ADDRESS + 16UL ) ) ) ) +#define TX_BUFFER_MASK ( 1UL ) /* Registers used to initialise the PLIC. */ -#define mainPLIC_PENDING_0 ( * ( ( volatile uint32_t * ) 0x0C001000UL ) ) -#define mainPLIC_PENDING_1 ( * ( ( volatile uint32_t * ) 0x0C001004UL ) ) -#define mainPLIC_ENABLE_0 ( * ( ( volatile uint32_t * ) 0x0C002000UL ) ) -#define mainPLIC_ENABLE_1 ( * ( ( volatile uint32_t * ) 0x0C002004UL ) ) +#define mainPLIC_PENDING_0 ( *( ( volatile uint32_t * ) 0x0C001000UL ) ) +#define mainPLIC_PENDING_1 ( *( ( volatile uint32_t * ) 0x0C001004UL ) ) +#define mainPLIC_ENABLE_0 ( *( ( volatile uint32_t * ) 0x0C002000UL ) ) +#define mainPLIC_ENABLE_1 ( *( ( volatile uint32_t * ) 0x0C002004UL ) ) extern void freertos_risc_v_trap_handler( void ); extern void freertos_vector_table( void ); @@ -112,213 +112,231 @@ void vFullDemoIdleFunction( void ); void main( void ) { - /* See https://www.freertos.org/freertos-on-qemu-mps2-an385-model.html for - instructions. */ - - #if( mainVECTOR_MODE_DIRECT == 1 ) - { - __asm__ volatile( "csrw mtvec, %0" :: "r"( freertos_risc_v_trap_handler ) ); - } - #else - { - __asm__ volatile( "csrw mtvec, %0" :: "r"( ( uintptr_t )freertos_vector_table | 0x1 ) ); - } - #endif - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - { - main_blinky(); - } - #else - { - main_full(); - } - #endif + /* See https://www.freertos.org/freertos-on-qemu-mps2-an385-model.html for + * instructions. */ + + #if ( mainVECTOR_MODE_DIRECT == 1 ) + { + __asm__ volatile ( "csrw mtvec, %0" : : "r" ( freertos_risc_v_trap_handler ) ); + } + #else + { + __asm__ volatile ( "csrw mtvec, %0" : : "r" ( ( uintptr_t ) freertos_vector_table | 0x1 ) ); + } + #endif + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + { + main_blinky(); + } + #else + { + main_full(); + } + #endif } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - pvPortMalloc() is called internally by the kernel whenever a task, queue, - timer or semaphore is created using the dynamic allocation (as opposed to - static allocation) option. It is also called by various parts of the - demo application. If heap_1.c, heap_2.c or heap_4.c is being 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 to query the size of free heap space that remains - (although it does not provide information on how the remaining heap might be - fragmented). See http://www.freertos.org/a00111.html for more - information. */ - printf( "\r\n\r\nMalloc failed\r\n" ); - portDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * pvPortMalloc() is called internally by the kernel whenever a task, queue, + * timer or semaphore is created using the dynamic allocation (as opposed to + * static allocation) option. It is also called by various parts of the + * demo application. If heap_1.c, heap_2.c or heap_4.c is being 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 to query the size of free heap space that remains + * (although it does not provide information on how the remaining heap might be + * fragmented). See http://www.freertos.org/a00111.html for more + * information. */ + printf( "\r\n\r\nMalloc failed\r\n" ); + portDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - specified, or call vTaskDelay()). If application tasks make use of the - vTaskDelete() API function to delete themselves then it is also important - that vApplicationIdleHook() is permitted to return to its calling function, - because it is the responsibility of the idle task to clean up memory - allocated by the kernel to any task that has since deleted itself. */ + /* 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 + * specified, or call vTaskDelay()). If application tasks make use of the + * vTaskDelete() API function to delete themselves then it is also important + * that vApplicationIdleHook() is permitted to return to its calling function, + * because it is the responsibility of the idle task to clean up memory + * allocated by the kernel to any task that has since deleted itself. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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. */ - printf( "\r\n\r\nStack overflow in %s\r\n", pcTaskName ); - portDISABLE_INTERRUPTS(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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. */ + printf( "\r\n\r\nStack overflow in %s\r\n", pcTaskName ); + portDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* This function will be called by each tick interrupt if - configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - added here, but the tick hook is called from an interrupt context, so - code must not attempt to block, and only the interrupt safe FreeRTOS API - functions can be used (those that end in FromISR()). */ - - #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) - { - extern void vFullDemoTickHookFunction( void ); - - vFullDemoTickHookFunction(); - } - #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */ + /* This function will be called by each tick interrupt if + * configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + * added here, but the tick hook is called from an interrupt context, so + * code must not attempt to block, and only the interrupt safe FreeRTOS API + * functions can be used (those that end in FromISR()). */ + + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) + { + extern void vFullDemoTickHookFunction( void ); + + vFullDemoTickHookFunction(); + } + #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */ } /*-----------------------------------------------------------*/ void vApplicationDaemonTaskStartupHook( void ) { - /* This function will be called once only, when the daemon task starts to - execute (sometimes called the timer task). This is useful if the - application includes initialisation code that would benefit from executing - after the scheduler has been started. */ + /* This function will be called once only, when the daemon task starts to + * execute (sometimes called the timer task). This is useful if the + * application includes initialisation code that would benefit from executing + * after the scheduler has been started. */ } /*-----------------------------------------------------------*/ -void vAssertCalled( const char *pcFileName, uint32_t ulLine ) +void vAssertCalled( const char * pcFileName, + uint32_t ulLine ) { -volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0; - - /* Called if an assertion passed to configASSERT() fails. See - http://www.freertos.org/a00110.html#configASSERT for more information. */ - - printf( "ASSERT! Line %d, file %s\r\n", ( int ) ulLine, pcFileName ); - - taskENTER_CRITICAL(); - { - /* You can step out of this function to debug the assertion by using - the debugger to set ulSetToNonZeroInDebuggerToContinue to a non-zero - value. */ - while( ulSetToNonZeroInDebuggerToContinue == 0 ) - { - __asm volatile( "NOP" ); - __asm volatile( "NOP" ); - } - } - taskEXIT_CRITICAL(); + volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0; + + /* Called if an assertion passed to configASSERT() fails. See + * http://www.freertos.org/a00110.html#configASSERT for more information. */ + + printf( "ASSERT! Line %d, file %s\r\n", ( int ) ulLine, pcFileName ); + + taskENTER_CRITICAL(); + { + /* You can step out of this function to debug the assertion by using + * the debugger to set ulSetToNonZeroInDebuggerToContinue to a non-zero + * value. */ + while( ulSetToNonZeroInDebuggerToContinue == 0 ) + { + __asm volatile ( "NOP" ); + __asm volatile ( "NOP" ); + } + } + taskEXIT_CRITICAL(); } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an -implementation of vApplicationGetIdleTaskMemory() to provide the memory that is -used by the Idle task. */ -void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) + * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is + * used by the Idle task. */ +void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, + StackType_t ** ppxIdleTaskStackBuffer, + uint32_t * pulIdleTaskStackSize ) { /* If the buffers to be provided to the Idle task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xIdleTaskTCB; -static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Idle task's - state will be stored. */ - *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; - - /* Pass out the array that will be used as the Idle task's stack. */ - *ppxIdleTaskStackBuffer = uxIdleTaskStack; - - /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xIdleTaskTCB; + static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Idle task's + * state will be stored. */ + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + + /* Pass out the array that will be used as the Idle task's stack. */ + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + + /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; } /*-----------------------------------------------------------*/ /* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the -application must provide an implementation of vApplicationGetTimerTaskMemory() -to provide the memory that is used by the Timer service task. */ -void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) + * application must provide an implementation of vApplicationGetTimerTaskMemory() + * to provide the memory that is used by the Timer service task. */ +void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, + StackType_t ** ppxTimerTaskStackBuffer, + uint32_t * pulTimerTaskStackSize ) { /* If the buffers to be provided to the Timer task are declared inside this -function then they must be declared static - otherwise they will be allocated on -the stack and so not exists after this function exits. */ -static StaticTask_t xTimerTaskTCB; -static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Timer - task's state will be stored. */ - *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; - - /* Pass out the array that will be used as the Timer task's stack. */ - *ppxTimerTaskStackBuffer = uxTimerTaskStack; - - /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xTimerTaskTCB; + static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Timer + * task's state will be stored. */ + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + + /* Pass out the array that will be used as the Timer task's stack. */ + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + + /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. + * Note that, as the array is necessarily of type StackType_t, + * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } /*-----------------------------------------------------------*/ -int __write( int iFile, char *pcString, int iStringLength ) +int __write( int iFile, + char * pcString, + int iStringLength ) { - int iNextChar; + int iNextChar; + + /* Avoid compiler warnings about unused parameters. */ + ( void ) iFile; - /* Avoid compiler warnings about unused parameters. */ - ( void ) iFile; + /* Output the formatted string to the UART. */ + for( iNextChar = 0; iNextChar < iStringLength; iNextChar++ ) + { + while( ( UART0_STATE & TX_BUFFER_MASK ) != 0 ) + { + } - /* Output the formatted string to the UART. */ - for( iNextChar = 0; iNextChar < iStringLength; iNextChar++ ) - { - while( ( UART0_STATE & TX_BUFFER_MASK ) != 0 ); - UART0_DATA = *pcString; - pcString++; - } + UART0_DATA = *pcString; + pcString++; + } - return iStringLength; + return iStringLength; } /*-----------------------------------------------------------*/ -void *malloc( size_t size ) +void * malloc( size_t size ) { - ( void ) size; + ( void ) size; - /* This project uses heap_4 so doesn't set up a heap for use by the C - library - but something is calling the C library malloc(). See - https://freertos.org/a00111.html for more information. */ - printf( "\r\n\r\nUnexpected call to malloc() - should be using pvPortMalloc()\r\n" ); - portDISABLE_INTERRUPTS(); - for( ;; ); + /* This project uses heap_4 so doesn't set up a heap for use by the C + * library - but something is calling the C library malloc(). See + * https://freertos.org/a00111.html for more information. */ + printf( "\r\n\r\nUnexpected call to malloc() - should be using pvPortMalloc()\r\n" ); + portDISABLE_INTERRUPTS(); + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/main_blinky.c b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/main_blinky.c index 27d0d2a293d..7fcc3b8050c 100644 --- a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/main_blinky.c +++ b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -66,29 +66,29 @@ #include "queue.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The times are converted from -milliseconds to ticks using the pdMS_TO_TICKS() macro. */ -#define mainTASK_SEND_FREQUENCY_MS pdMS_TO_TICKS( 200UL ) -#define mainTIMER_SEND_FREQUENCY_MS pdMS_TO_TICKS( 2000UL ) + * milliseconds to ticks using the pdMS_TO_TICKS() macro. */ +#define mainTASK_SEND_FREQUENCY_MS pdMS_TO_TICKS( 200UL ) +#define mainTIMER_SEND_FREQUENCY_MS pdMS_TO_TICKS( 2000UL ) /* The number of items the queue can hold at once. */ -#define mainQUEUE_LENGTH ( 2 ) +#define mainQUEUE_LENGTH ( 2 ) /* The values sent to the queue receive task from the queue send task and the -queue send software timer respectively. */ -#define mainVALUE_SENT_FROM_TASK ( 100UL ) -#define mainVALUE_SENT_FROM_TIMER ( 200UL ) + * queue send software timer respectively. */ +#define mainVALUE_SENT_FROM_TASK ( 100UL ) +#define mainVALUE_SENT_FROM_TIMER ( 200UL ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * The callback function executed when the software timer expires. @@ -108,128 +108,128 @@ static TimerHandle_t xTimer = NULL; /*** SEE THE COMMENTS AT THE TOP OF THIS FILE ***/ void main_blinky( void ) { -const TickType_t xTimerPeriod = mainTIMER_SEND_FREQUENCY_MS; - - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); - - if( xQueue != NULL ) - { - /* Start the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - NULL, /* The parameter passed to the task - not used in this simple case. */ - mainQUEUE_RECEIVE_TASK_PRIORITY,/* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ - - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Create the software timer, but don't start it yet. */ - xTimer = xTimerCreate( "Timer", /* The text name assigned to the software timer - for debug only as it is not used by the kernel. */ - xTimerPeriod, /* The period of the software timer in ticks. */ - pdTRUE, /* xAutoReload is set to pdTRUE, so this is an auto-reload timer. */ - NULL, /* The timer's ID is not used. */ - prvQueueSendTimerCallback );/* The function executed when the timer expires. */ - - xTimerStart( xTimer, 0 ); /* The scheduler has not started so use a block time of 0. */ - - /* Start the tasks and timer running. */ - 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 insufficient FreeRTOS heap memory available for the idle and/or - timer tasks to be created. See the memory management section on the - FreeRTOS web site for more details. NOTE: This demo uses static allocation - for the idle and timer tasks so this line should never execute. */ - for( ;; ); + const TickType_t xTimerPeriod = mainTIMER_SEND_FREQUENCY_MS; + + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); + + if( xQueue != NULL ) + { + /* Start the two tasks as described in the comments at the top of this + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + NULL, /* The parameter passed to the task - not used in this simple case. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ + + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Create the software timer, but don't start it yet. */ + xTimer = xTimerCreate( "Timer", /* The text name assigned to the software timer - for debug only as it is not used by the kernel. */ + xTimerPeriod, /* The period of the software timer in ticks. */ + pdTRUE, /* xAutoReload is set to pdTRUE, so this is an auto-reload timer. */ + NULL, /* The timer's ID is not used. */ + prvQueueSendTimerCallback ); /* The function executed when the timer expires. */ + + xTimerStart( xTimer, 0 ); /* The scheduler has not started so use a block time of 0. */ + + /* Start the tasks and timer running. */ + 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 insufficient FreeRTOS heap memory available for the idle and/or + * timer tasks to be created. See the memory management section on the + * FreeRTOS web site for more details. NOTE: This demo uses static allocation + * for the idle and timer tasks so this line should never execute. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const TickType_t xBlockTime = mainTASK_SEND_FREQUENCY_MS; -const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TASK; - - /* Prevent the compiler warning about the unused parameter. */ - ( void ) pvParameters; - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, pdMS_TO_TICKS() was used to - convert a time specified in milliseconds into a time specified in ticks. - While in the Blocked state this task will not consume any CPU time. */ - vTaskDelayUntil( &xNextWakeTime, xBlockTime ); - - /* Send to the queue - causing the queue receive task to unblock and - write to the console. 0 is used as the block time so the send operation - will not block - it shouldn't need to block as the queue should always - have at least one space at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } + TickType_t xNextWakeTime; + const TickType_t xBlockTime = mainTASK_SEND_FREQUENCY_MS; + const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TASK; + + /* Prevent the compiler warning about the unused parameter. */ + ( void ) pvParameters; + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, pdMS_TO_TICKS() was used to + * convert a time specified in milliseconds into a time specified in ticks. + * While in the Blocked state this task will not consume any CPU time. */ + vTaskDelayUntil( &xNextWakeTime, xBlockTime ); + + /* Send to the queue - causing the queue receive task to unblock and + * write to the console. 0 is used as the block time so the send operation + * will not block - it shouldn't need to block as the queue should always + * have at least one space at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } } /*-----------------------------------------------------------*/ static void prvQueueSendTimerCallback( TimerHandle_t xTimerHandle ) { -const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TIMER; + const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TIMER; - /* This is the software timer callback function. The software timer has a - period of two seconds and is reset each time a key is pressed. This - callback function will execute if the timer expires, which will only happen - if a key is not pressed for two seconds. */ + /* This is the software timer callback function. The software timer has a + * period of two seconds and is reset each time a key is pressed. This + * callback function will execute if the timer expires, which will only happen + * if a key is not pressed for two seconds. */ - /* Avoid compiler warnings resulting from the unused parameter. */ - ( void ) xTimerHandle; + /* Avoid compiler warnings resulting from the unused parameter. */ + ( void ) xTimerHandle; - /* Send to the queue - causing the queue receive task to unblock and - write out a message. This function is called from the timer/daemon task, so - must not block. Hence the block time is set to 0. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); + /* Send to the queue - causing the queue receive task to unblock and + * write out a message. This function is called from the timer/daemon task, so + * must not block. Hence the block time is set to 0. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -uint32_t ulReceivedValue; - - /* Prevent the compiler warning about the unused parameter. */ - ( void ) pvParameters; - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. It will not use any CPU time while it is in the - Blocked state. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - is it an expected value? */ - if( ulReceivedValue == mainVALUE_SENT_FROM_TASK ) - { - /* It is normally not good to call printf() from an embedded system, - although it is ok in this simulated case. */ - printf( "Message received from task\r\n" ); - } - else if( ulReceivedValue == mainVALUE_SENT_FROM_TIMER ) - { - printf( "Message received from software timer\r\n" ); - } - else - { - printf( "Unexpected message\r\n" ); - } - } + uint32_t ulReceivedValue; + + /* Prevent the compiler warning about the unused parameter. */ + ( void ) pvParameters; + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. It will not use any CPU time while it is in the + * Blocked state. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it an expected value? */ + if( ulReceivedValue == mainVALUE_SENT_FROM_TASK ) + { + /* It is normally not good to call printf() from an embedded system, + * although it is ok in this simulated case. */ + printf( "Message received from task\r\n" ); + } + else if( ulReceivedValue == mainVALUE_SENT_FROM_TIMER ) + { + printf( "Message received from software timer\r\n" ); + } + else + { + printf( "Unexpected message\r\n" ); + } + } } /*-----------------------------------------------------------*/ - - diff --git a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/main_full.c b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/main_full.c index 5120ef1ca66..974507ee64f 100644 --- a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/main_full.c +++ b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -97,23 +97,23 @@ /*-----------------------------------------------------------*/ /* Task priorities. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) /* Stack sizes are defined relative to configMINIMAL_STACK_SIZE so they scale -across projects that have that constant set differently - in this case the -constant is different depending on the compiler in use. */ -#define mainMESSAGE_BUFFER_STACK_SIZE ( configMINIMAL_STACK_SIZE + ( configMINIMAL_STACK_SIZE >> 1 ) ) -#define mainCHECK_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE + ( configMINIMAL_STACK_SIZE >> 1 ) ) -#define mainREG_TEST_STACK_SIZE_WORDS 90 + * across projects that have that constant set differently - in this case the + * constant is different depending on the compiler in use. */ +#define mainMESSAGE_BUFFER_STACK_SIZE ( configMINIMAL_STACK_SIZE + ( configMINIMAL_STACK_SIZE >> 1 ) ) +#define mainCHECK_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE + ( configMINIMAL_STACK_SIZE >> 1 ) ) +#define mainREG_TEST_STACK_SIZE_WORDS 90 /* 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 ) + * 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 ) /*-----------------------------------------------------------*/ @@ -123,279 +123,282 @@ purpose of ensuring parameters are passed into tasks correctly. */ * entry points are kept in the C file for the convenience of checking the task * parameter. */ -static void prvRegTestTaskEntry1( void *pvParameters ); +static void prvRegTestTaskEntry1( void * pvParameters ); extern void vRegTest1Implementation( void ); -static void prvRegTestTaskEntry2( void *pvParameters ); +static void prvRegTestTaskEntry2( void * pvParameters ); extern void vRegTest2Implementation( void ); /* The task that checks the operation of all the other standard demo tasks, as * described at the top of this file. */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); /*-----------------------------------------------------------*/ /* 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 -stops incrementing, then an error has been found. */ + * 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 + * stops incrementing, then an error has been found. */ uint32_t ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL; -volatile uint32_t *pulRegTest1LoopCounter = &ulRegTest1LoopCounter; -volatile uint32_t *pulRegTest2LoopCounter = &ulRegTest2LoopCounter; +volatile uint32_t * pulRegTest1LoopCounter = &ulRegTest1LoopCounter; +volatile uint32_t * pulRegTest2LoopCounter = &ulRegTest2LoopCounter; /*-----------------------------------------------------------*/ void main_full( void ) { - /* Start the standard demo tasks. */ - vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); - vStartRecursiveMutexTasks(); - vCreateBlockTimeTasks(); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartQueuePeekTasks(); - vStartQueueSetTasks(); - vStartEventGroupTasks(); - vStartMessageBufferTasks( mainMESSAGE_BUFFER_STACK_SIZE ); - vStartStreamBufferTasks(); - vCreateAbortDelayTasks(); - vStartCountingSemaphoreTasks(); - vStartDynamicPriorityTasks(); - vStartMessageBufferAMPTasks( configMINIMAL_STACK_SIZE ); - vStartQueueOverwriteTask( tskIDLE_PRIORITY ); - vStartQueueSetPollingTask(); - vStartStaticallyAllocatedTasks(); - vStartTaskNotifyTask(); - vStartTaskNotifyArrayTask(); - vStartTimerDemoTask( 50 ); - vStartStreamBufferInterruptDemo(); - vStartInterruptSemaphoreTasks(); - - /* Create the register check tasks, as described at the top of this file. - Use xTaskCreateStatic() to create a task using only statically allocated - memory. */ - xTaskCreate( prvRegTestTaskEntry1, /* The function that implements the task. */ - "Reg1", /* The name of the task. */ - mainREG_TEST_STACK_SIZE_WORDS, /* Size of stack to allocate for the task - in words not bytes!. */ - mainREG_TEST_TASK_1_PARAMETER, /* Parameter passed into the task. */ - tskIDLE_PRIORITY, /* Priority of the task. */ - NULL ); /* Can be used to pass out a handle to the created task. */ - xTaskCreate( prvRegTestTaskEntry2, "Reg2", mainREG_TEST_STACK_SIZE_WORDS, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL ); - - /* The suicide tasks must be created last as they need to know how many - tasks were running prior to their creation in order to ascertain whether - or not the correct/expected number of tasks are running at any given time. */ - vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - - xTaskCreate( prvCheckTask, "Check", mainCHECK_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - - /* Start the scheduler. */ - vTaskStartScheduler(); - - /* If configSUPPORT_STATIC_ALLOCATION was false then execution would only - get here if there was insufficient heap memory to create either the idle or - timer tasks. As static allocation is used execution should never be able - to reach here. */ - for( ;; ); + /* Start the standard demo tasks. */ + vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); + vStartRecursiveMutexTasks(); + vCreateBlockTimeTasks(); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartQueuePeekTasks(); + vStartQueueSetTasks(); + vStartEventGroupTasks(); + vStartMessageBufferTasks( mainMESSAGE_BUFFER_STACK_SIZE ); + vStartStreamBufferTasks(); + vCreateAbortDelayTasks(); + vStartCountingSemaphoreTasks(); + vStartDynamicPriorityTasks(); + vStartMessageBufferAMPTasks( configMINIMAL_STACK_SIZE ); + vStartQueueOverwriteTask( tskIDLE_PRIORITY ); + vStartQueueSetPollingTask(); + vStartStaticallyAllocatedTasks(); + vStartTaskNotifyTask(); + vStartTaskNotifyArrayTask(); + vStartTimerDemoTask( 50 ); + vStartStreamBufferInterruptDemo(); + vStartInterruptSemaphoreTasks(); + + /* Create the register check tasks, as described at the top of this file. + * Use xTaskCreateStatic() to create a task using only statically allocated + * memory. */ + xTaskCreate( prvRegTestTaskEntry1, /* The function that implements the task. */ + "Reg1", /* The name of the task. */ + mainREG_TEST_STACK_SIZE_WORDS, /* Size of stack to allocate for the task - in words not bytes!. */ + mainREG_TEST_TASK_1_PARAMETER, /* Parameter passed into the task. */ + tskIDLE_PRIORITY, /* Priority of the task. */ + NULL ); /* Can be used to pass out a handle to the created task. */ + xTaskCreate( prvRegTestTaskEntry2, "Reg2", mainREG_TEST_STACK_SIZE_WORDS, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL ); + + /* The suicide tasks must be created last as they need to know how many + * tasks were running prior to their creation in order to ascertain whether + * or not the correct/expected number of tasks are running at any given time. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + + xTaskCreate( prvCheckTask, "Check", mainCHECK_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + + /* Start the scheduler. */ + vTaskStartScheduler(); + + /* If configSUPPORT_STATIC_ALLOCATION was false then execution would only + * get here if there was insufficient heap memory to create either the idle or + * timer tasks. As static allocation is used execution should never be able + * to reach here. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvRegTestTaskEntry1( void *pvParameters ) +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 task will detect that the regtest loop counter is - not being incremented and flag an error. */ - vTaskDelete( NULL ); + /* 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 task will detect that the regtest loop counter is + * not being incremented and flag an error. */ + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ -static void prvRegTestTaskEntry2( void *pvParameters ) +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 task will detect that the regtest loop counter is - not being incremented and flag an error. */ - vTaskDelete( NULL ); + /* 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 task will detect that the regtest loop counter is + * not being incremented and flag an error. */ + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ /* See the comments at the top of this file. */ -static void prvCheckTask( void *pvParameters ) +static void prvCheckTask( void * pvParameters ) { -static const char * pcMessage = "FreeRTOS Demo SUCCESS:"; -const TickType_t xTaskPeriod = pdMS_TO_TICKS( 5000UL ); -TickType_t xPreviousWakeTime; -uint32_t ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; + static const char * pcMessage = "FreeRTOS Demo SUCCESS:"; + const TickType_t xTaskPeriod = pdMS_TO_TICKS( 5000UL ); + TickType_t xPreviousWakeTime; + uint32_t ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; /* Avoid warning about unused parameter. */ ( void ) pvParameters; - /* Demo start marker. */ - printf( "FreeRTOS Demo Start\r\n" ); - - xPreviousWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - vTaskDelayUntil( &xPreviousWakeTime, xTaskPeriod ); - - /* Has an error been found in any task? */ - if( xAreStreamBufferTasksStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreStreamBufferTasksStillRunning() returned false"; - } - else if( xAreMessageBufferTasksStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreMessageBufferTasksStillRunning() returned false"; - } - if( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreGenericQueueTasksStillRunning() returned false"; - } - else if( xIsCreateTaskStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xIsCreateTaskStillRunning() returned false"; - } - else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreBlockTimeTestTasksStillRunning() returned false"; - } - else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreSemaphoreTasksStillRunning() returned false"; - } - else if( xArePollingQueuesStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xArePollingQueuesStillRunning() returned false"; - } - else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreQueuePeekTasksStillRunning() returned false"; - } - else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreRecursiveMutexTasksStillRunning() returned false"; - } - else if( xAreQueueSetTasksStillRunning() != pdPASS ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreQueueSetTasksStillRunning() returned false"; - } - else if( xAreEventGroupTasksStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreEventGroupTasksStillRunning() returned false"; - } - else if( xAreAbortDelayTestTasksStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreAbortDelayTestTasksStillRunning() returned false"; - } - else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreCountingSemaphoreTasksStillRunning() returned false"; - } - else if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreDynamicPriorityTasksStillRunning() returned false"; - } - else if( xAreMessageBufferAMPTasksStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreMessageBufferAMPTasksStillRunning() returned false"; - } - else if( xIsQueueOverwriteTaskStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xIsQueueOverwriteTaskStillRunning() returned false"; - } - else if( xAreQueueSetPollTasksStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreQueueSetPollTasksStillRunning() returned false"; - } - else if( xAreStaticAllocationTasksStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreStaticAllocationTasksStillRunning() returned false"; - } - else if( xAreTaskNotificationTasksStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreTaskNotificationTasksStillRunning() returned false"; - } - else if( xAreTaskNotificationArrayTasksStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreTaskNotificationArrayTasksStillRunning() returned false"; - } - else if( xAreTimerDemoTasksStillRunning( xTaskPeriod ) != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreTimerDemoTasksStillRunning() returned false"; - } - else if( xIsInterruptStreamBufferDemoStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xIsInterruptStreamBufferDemoStillRunning() returned false"; - } - else if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE ) - { - pcMessage = "FreeRTOS Demo ERROR: xAreInterruptSemaphoreTasksStillRunning() returned false"; - } - else if( ulLastRegTest1Value == ulRegTest1LoopCounter ) /* Check that the register test 1 task is still running. */ - { - pcMessage = "FreeRTOS Demo ERROR: Register test 1.\r\n"; - } - else if( ulLastRegTest2Value == ulRegTest2LoopCounter ) /* Check that the register test 2 task is still running. */ - { - pcMessage = "FreeRTOS Demo ERROR: Register test 2.\r\n"; - } - - ulLastRegTest1Value = ulRegTest1LoopCounter; - ulLastRegTest2Value = ulRegTest2LoopCounter; - - /* It is normally not good to call printf() from an embedded system, - although it is ok in this simulated case. */ - printf( "%s : %d\r\n", pcMessage, (int) xTaskGetTickCount() ); - } + /* Demo start marker. */ + printf( "FreeRTOS Demo Start\r\n" ); + + xPreviousWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + vTaskDelayUntil( &xPreviousWakeTime, xTaskPeriod ); + + /* Has an error been found in any task? */ + if( xAreStreamBufferTasksStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreStreamBufferTasksStillRunning() returned false"; + } + else if( xAreMessageBufferTasksStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreMessageBufferTasksStillRunning() returned false"; + } + + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreGenericQueueTasksStillRunning() returned false"; + } + else if( xIsCreateTaskStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xIsCreateTaskStillRunning() returned false"; + } + else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreBlockTimeTestTasksStillRunning() returned false"; + } + else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreSemaphoreTasksStillRunning() returned false"; + } + else if( xArePollingQueuesStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xArePollingQueuesStillRunning() returned false"; + } + else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreQueuePeekTasksStillRunning() returned false"; + } + else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreRecursiveMutexTasksStillRunning() returned false"; + } + else if( xAreQueueSetTasksStillRunning() != pdPASS ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreQueueSetTasksStillRunning() returned false"; + } + else if( xAreEventGroupTasksStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreEventGroupTasksStillRunning() returned false"; + } + else if( xAreAbortDelayTestTasksStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreAbortDelayTestTasksStillRunning() returned false"; + } + else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreCountingSemaphoreTasksStillRunning() returned false"; + } + else if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreDynamicPriorityTasksStillRunning() returned false"; + } + else if( xAreMessageBufferAMPTasksStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreMessageBufferAMPTasksStillRunning() returned false"; + } + else if( xIsQueueOverwriteTaskStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xIsQueueOverwriteTaskStillRunning() returned false"; + } + else if( xAreQueueSetPollTasksStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreQueueSetPollTasksStillRunning() returned false"; + } + else if( xAreStaticAllocationTasksStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreStaticAllocationTasksStillRunning() returned false"; + } + else if( xAreTaskNotificationTasksStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreTaskNotificationTasksStillRunning() returned false"; + } + else if( xAreTaskNotificationArrayTasksStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreTaskNotificationArrayTasksStillRunning() returned false"; + } + else if( xAreTimerDemoTasksStillRunning( xTaskPeriod ) != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreTimerDemoTasksStillRunning() returned false"; + } + else if( xIsInterruptStreamBufferDemoStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xIsInterruptStreamBufferDemoStillRunning() returned false"; + } + else if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE ) + { + pcMessage = "FreeRTOS Demo ERROR: xAreInterruptSemaphoreTasksStillRunning() returned false"; + } + else if( ulLastRegTest1Value == ulRegTest1LoopCounter ) /* Check that the register test 1 task is still running. */ + { + pcMessage = "FreeRTOS Demo ERROR: Register test 1.\r\n"; + } + else if( ulLastRegTest2Value == ulRegTest2LoopCounter ) /* Check that the register test 2 task is still running. */ + { + pcMessage = "FreeRTOS Demo ERROR: Register test 2.\r\n"; + } + + ulLastRegTest1Value = ulRegTest1LoopCounter; + ulLastRegTest2Value = ulRegTest2LoopCounter; + + /* It is normally not good to call printf() from an embedded system, + * although it is ok in this simulated case. */ + printf( "%s : %d\r\n", pcMessage, ( int ) xTaskGetTickCount() ); + } } /*-----------------------------------------------------------*/ void vFullDemoTickHookFunction( void ) { - /* Write to a queue that is in use as part of the queue set demo to - demonstrate using queue sets from an ISR. */ - vQueueSetAccessQueueSetFromISR(); + /* Write to a queue that is in use as part of the queue set demo to + * demonstrate using queue sets from an ISR. */ + vQueueSetAccessQueueSetFromISR(); - /* Call the event group ISR tests. */ - vPeriodicEventGroupsProcessing(); + /* Call the event group ISR tests. */ + vPeriodicEventGroupsProcessing(); - /* Exercise stream buffers from interrupts. */ - vPeriodicStreamBufferProcessing(); + /* Exercise stream buffers from interrupts. */ + vPeriodicStreamBufferProcessing(); - /* Exercise using queue overwrites from interrupts. */ - vQueueOverwritePeriodicISRDemo(); + /* Exercise using queue overwrites from interrupts. */ + vQueueOverwritePeriodicISRDemo(); - /* Exercise using Queue Sets from interrupts. */ - vQueueSetPollingInterruptAccess(); + /* Exercise using Queue Sets from interrupts. */ + vQueueSetPollingInterruptAccess(); - /* Exercise using task notifications from interrupts. */ - xNotifyTaskFromISR(); - xNotifyArrayTaskFromISR(); + /* Exercise using task notifications from interrupts. */ + xNotifyTaskFromISR(); + xNotifyArrayTaskFromISR(); - /* Exercise software timers from interrupts. */ - vTimerPeriodicISRTests(); + /* Exercise software timers from interrupts. */ + vTimerPeriodicISRTests(); - /* Exercise stream buffers from interrupts. */ - vBasicStreamBufferSendFromISR(); + /* Exercise stream buffers from interrupts. */ + vBasicStreamBufferSendFromISR(); - /* Exercise semaphores from interrupts. */ - vInterruptSemaphorePeriodicTest(); + /* Exercise semaphores from interrupts. */ + vInterruptSemaphorePeriodicTest(); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/ns16550.c b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/ns16550.c index 627413ad536..e6518627262 100644 --- a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/ns16550.c +++ b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/ns16550.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/ns16550.h b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/ns16550.h index 7495bcb233c..28cfc713dda 100644 --- a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/ns16550.h +++ b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/ns16550.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/riscv-reg.h b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/riscv-reg.h index fd5723d37aa..a5372311aae 100644 --- a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/riscv-reg.h +++ b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/riscv-reg.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/riscv-virt.h b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/riscv-virt.h index 36e5b23f475..09b451108c1 100644 --- a/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/riscv-virt.h +++ b/FreeRTOS/Demo/RISC-V_RV32_QEMU_VIRT_GCC/riscv-virt.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/FreeRTOSConfig.h b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/FreeRTOSConfig.h index 16b1f169778..ffb41d0ce91 100644 --- a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/blinky_demo/main_blinky.c b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/blinky_demo/main_blinky.c index e91f7783ab7..be9881e2765 100644 --- a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/blinky_demo/main_blinky.c +++ b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/blinky_demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/full_demo/main_full.c b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/full_demo/main_full.c index 2c9f0c0279c..ec7e57b0b4a 100644 --- a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/full_demo/main_full.c +++ b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/full_demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/main.c b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/main.c index 7c51650265d..2892a75be29 100644 --- a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/main.c +++ b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -56,28 +56,28 @@ #include /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 /* Set to 1 to use direct mode and set to 0 to use vectored mode. - -VECTOR MODE=Direct --> all traps into machine mode cause the pc to be set to the -vector base address (BASE) in the mtvec register. - -VECTOR MODE=Vectored --> all synchronous exceptions into machine mode cause the -pc to be set to the BASE, whereas interrupts cause the pc to be set to the -address BASE plus four times the interrupt cause number. -*/ -#define mainVECTOR_MODE_DIRECT 0 + * + * VECTOR MODE=Direct --> all traps into machine mode cause the pc to be set to the + * vector base address (BASE) in the mtvec register. + * + * VECTOR MODE=Vectored --> all synchronous exceptions into machine mode cause the + * pc to be set to the BASE, whereas interrupts cause the pc to be set to the + * address BASE plus four times the interrupt cause number. + */ +#define mainVECTOR_MODE_DIRECT 0 /* Index to first HART (there is only one). */ -#define mainHART_0 0 +#define mainHART_0 0 /* Registers used to initialise the PLIC. */ -#define mainPLIC_PENDING_0 ( * ( ( volatile uint32_t * ) 0x0C001000UL ) ) -#define mainPLIC_PENDING_1 ( * ( ( volatile uint32_t * ) 0x0C001004UL ) ) -#define mainPLIC_ENABLE_0 ( * ( ( volatile uint32_t * ) 0x0C002000UL ) ) -#define mainPLIC_ENABLE_1 ( * ( ( volatile uint32_t * ) 0x0C002004UL ) ) +#define mainPLIC_PENDING_0 ( *( ( volatile uint32_t * ) 0x0C001000UL ) ) +#define mainPLIC_PENDING_1 ( *( ( volatile uint32_t * ) 0x0C001004UL ) ) +#define mainPLIC_ENABLE_0 ( *( ( volatile uint32_t * ) 0x0C002000UL ) ) +#define mainPLIC_ENABLE_1 ( *( ( volatile uint32_t * ) 0x0C002004UL ) ) /*-----------------------------------------------------------*/ @@ -89,9 +89,9 @@ extern void freertos_vector_table( void ); * main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0. */ #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 - extern void main_blinky( void ); + extern void main_blinky( void ); #else - extern void main_full( void ); + extern void main_full( void ); #endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */ /* @@ -100,7 +100,8 @@ extern void freertos_vector_table( void ); */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /* @@ -111,199 +112,206 @@ static void prvSetupHardware( void ); /* * Used by the Freedom Metal drivers. */ -static struct metal_led *pxBlueLED = NULL; +static struct metal_led * pxBlueLED = NULL; /*-----------------------------------------------------------*/ int main( void ) { - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - { - main_blinky(); - } - #else - { - main_full(); - } - #endif + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + { + main_blinky(); + } + #else + { + main_full(); + } + #endif } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { -struct metal_cpu *pxCPU; -struct metal_interrupt *pxInterruptController; - - /* Initialise the blue LED. */ - pxBlueLED = metal_led_get_rgb( "LD0", "blue" ); - configASSERT( pxBlueLED ); - metal_led_enable( pxBlueLED ); - metal_led_off( pxBlueLED ); - - /* Initialise the interrupt controller. */ - pxCPU = metal_cpu_get( mainHART_0 ); - configASSERT( pxCPU ); - pxInterruptController = metal_cpu_interrupt_controller( pxCPU ); - configASSERT( pxInterruptController ); - metal_interrupt_init( pxInterruptController ); - - #if( mainVECTOR_MODE_DIRECT == 1 ) - { - __asm__ volatile( "csrw mtvec, %0" :: "r"( freertos_risc_v_trap_handler ) ); - } - #else - { - __asm__ volatile( "csrw mtvec, %0" :: "r"( ( uintptr_t )freertos_vector_table | 0x1 ) ); - } - #endif - - /* Set all interrupt enable bits to 0. */ - mainPLIC_ENABLE_0 = 0UL; - mainPLIC_ENABLE_1 = 0UL; + struct metal_cpu * pxCPU; + struct metal_interrupt * pxInterruptController; + + /* Initialise the blue LED. */ + pxBlueLED = metal_led_get_rgb( "LD0", "blue" ); + configASSERT( pxBlueLED ); + metal_led_enable( pxBlueLED ); + metal_led_off( pxBlueLED ); + + /* Initialise the interrupt controller. */ + pxCPU = metal_cpu_get( mainHART_0 ); + configASSERT( pxCPU ); + pxInterruptController = metal_cpu_interrupt_controller( pxCPU ); + configASSERT( pxInterruptController ); + metal_interrupt_init( pxInterruptController ); + + #if ( mainVECTOR_MODE_DIRECT == 1 ) + { + __asm__ volatile ( "csrw mtvec, %0" : : "r" ( freertos_risc_v_trap_handler ) ); + } + #else + { + __asm__ volatile ( "csrw mtvec, %0" : : "r" ( ( uintptr_t ) freertos_vector_table | 0x1 ) ); + } + #endif + + /* Set all interrupt enable bits to 0. */ + mainPLIC_ENABLE_0 = 0UL; + mainPLIC_ENABLE_1 = 0UL; } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* The tests in the full demo expect some interaction with interrupts. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) - { - extern void vFullDemoTickHook( void ); - vFullDemoTickHook(); - } - #endif + /* The tests in the full demo expect some interaction with interrupts. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) + { + extern void vFullDemoTickHook( void ); + vFullDemoTickHook(); + } + #endif } /*-----------------------------------------------------------*/ void vAssertCalled( void ) { -static struct metal_led *pxRedLED = NULL; -volatile uint32_t ul; -const uint32_t ulNullLoopDelay = 0x1ffffUL; - - taskDISABLE_INTERRUPTS(); - - /* Initialise the red LED. */ - pxRedLED = metal_led_get_rgb( "LD0", "red" ); - configASSERT( pxRedLED ); - metal_led_enable( pxRedLED ); - metal_led_off( pxRedLED ); - - /* Flash the red LED to indicate that assert was hit - interrupts are off - here to prevent any further tick interrupts or context switches, so the - delay is implemented as a crude loop instead of a peripheral timer. */ - for( ;; ) - { - for( ul = 0; ul < ulNullLoopDelay; ul++ ) - { - __asm volatile( "nop" ); - } - metal_led_toggle( pxRedLED ); - } + static struct metal_led * pxRedLED = NULL; + volatile uint32_t ul; + const uint32_t ulNullLoopDelay = 0x1ffffUL; + + taskDISABLE_INTERRUPTS(); + + /* Initialise the red LED. */ + pxRedLED = metal_led_get_rgb( "LD0", "red" ); + configASSERT( pxRedLED ); + metal_led_enable( pxRedLED ); + metal_led_off( pxRedLED ); + + /* Flash the red LED to indicate that assert was hit - interrupts are off + * here to prevent any further tick interrupts or context switches, so the + * delay is implemented as a crude loop instead of a peripheral timer. */ + for( ; ; ) + { + for( ul = 0; ul < ulNullLoopDelay; ul++ ) + { + __asm volatile ( "nop" ); + } + + metal_led_toggle( pxRedLED ); + } } /*-----------------------------------------------------------*/ void handle_trap( void ) { -volatile uint32_t ulMEPC = 0UL, ulMCAUSE = 0UL, ulPLICPending0Register = 0UL, ulPLICPending1Register = 0UL; - - /* Store a few register values that might be useful when determining why this - function was called. */ - __asm volatile( "csrr %0, mepc" : "=r"( ulMEPC ) ); - __asm volatile( "csrr %0, mcause" : "=r"( ulMCAUSE ) ); - ulPLICPending0Register = mainPLIC_PENDING_0; - ulPLICPending1Register = mainPLIC_PENDING_1; - - /* Prevent compiler warnings about unused variables. */ - ( void ) ulPLICPending0Register; - ( void ) ulPLICPending1Register; - - /* Force an assert as this function has not been implemented as the demo - does not use external interrupts. */ - configASSERT( metal_cpu_get( mainHART_0 ) == 0x00 ); + volatile uint32_t ulMEPC = 0UL, ulMCAUSE = 0UL, ulPLICPending0Register = 0UL, ulPLICPending1Register = 0UL; + + /* Store a few register values that might be useful when determining why this + * function was called. */ + __asm volatile ( "csrr %0, mepc" : "=r" ( ulMEPC ) ); + __asm volatile ( "csrr %0, mcause" : "=r" ( ulMCAUSE ) ); + + ulPLICPending0Register = mainPLIC_PENDING_0; + ulPLICPending1Register = mainPLIC_PENDING_1; + + /* Prevent compiler warnings about unused variables. */ + ( void ) ulPLICPending0Register; + ( void ) ulPLICPending1Register; + + /* Force an assert as this function has not been implemented as the demo + * does not use external interrupts. */ + configASSERT( metal_cpu_get( mainHART_0 ) == 0x00 ); } /*-----------------------------------------------------------*/ void freertos_risc_v_application_interrupt_handler( uint32_t ulMcause ) { - ( void )ulMcause; + ( void ) ulMcause; - handle_trap(); + handle_trap(); } /*-----------------------------------------------------------*/ void freertos_risc_v_application_exception_handler( uint32_t ulMcause ) { - ( void )ulMcause; + ( void ) ulMcause; - handle_trap(); + handle_trap(); } /*-----------------------------------------------------------*/ void vToggleLED( void ) { - metal_led_toggle( pxBlueLED ); + metal_led_toggle( pxBlueLED ); } /*-----------------------------------------------------------*/ -void *malloc( size_t xSize ) +void * malloc( size_t xSize ) { - /* The linker script does not define a heap so artificially force an assert() - if something unexpectedly uses the C library heap. See - https://www.freertos.org/a00111.html for more information. */ - configASSERT( metal_cpu_get( mainHART_0 ) == 0x00 ); - - /* Remove warnings about unused parameter. */ - ( void ) xSize; - return NULL; + /* The linker script does not define a heap so artificially force an assert() + * if something unexpectedly uses the C library heap. See + * https://www.freertos.org/a00111.html for more information. */ + configASSERT( metal_cpu_get( mainHART_0 ) == 0x00 ); + + /* Remove warnings about unused parameter. */ + ( void ) xSize; + return NULL; } /*-----------------------------------------------------------*/ - - diff --git a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_IAR/FreeRTOSConfig.h index de3dbc8f240..80ea71207f5 100644 --- a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_IAR/blinky_demo/main_blinky.c b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_IAR/blinky_demo/main_blinky.c index 719f149c62e..b1044bdf8ec 100644 --- a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_IAR/blinky_demo/main_blinky.c +++ b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_IAR/blinky_demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_IAR/full_demo/main_full.c b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_IAR/full_demo/main_full.c index 574d66fe4e3..b85d31775ab 100644 --- a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_IAR/full_demo/main_full.c +++ b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_IAR/full_demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_IAR/main.c b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_IAR/main.c index 8a8a52bb393..f0dd2d650f9 100644 --- a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_IAR/main.c +++ b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -55,8 +55,8 @@ #include /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 /* Set to 1 to use direct mode and set to 0 to use vectored mode. * @@ -66,47 +66,47 @@ or 0 to run the more comprehensive test and demo application. */ * VECTOR MODE=Vectored --> all synchronous exceptions into machine mode cause the * pc to be set to the BASE, whereas interrupts cause the pc to be set to the * address BASE plus four times the interrupt cause number. -*/ -#define mainVECTOR_MODE_DIRECT 0 + */ +#define mainVECTOR_MODE_DIRECT 0 /* UART hardware constants. */ -#define mainUART_BASE_ADDRESS ( *( volatile uint32_t * ) 0x20000000UL ) -#define mainUART_TX_DATA 0x00 -#define mainUART_TX_CTRL 0x08 -#define mainUART_RX_CTRL 0x0c -#define mainUART_CLOCK_DIV 0x18 -#define mainUART_TX_ENABLE_BIT (1UL << 0UL) -#define mainUART_RX_ENABLE_BIT (1UL << 0UL) -#define mainUART_TX_FULL_BIT (1UL << 31UL) +#define mainUART_BASE_ADDRESS ( *( volatile uint32_t * ) 0x20000000UL ) +#define mainUART_TX_DATA 0x00 +#define mainUART_TX_CTRL 0x08 +#define mainUART_RX_CTRL 0x0c +#define mainUART_CLOCK_DIV 0x18 +#define mainUART_TX_ENABLE_BIT ( 1UL << 0UL ) +#define mainUART_RX_ENABLE_BIT ( 1UL << 0UL ) +#define mainUART_TX_FULL_BIT ( 1UL << 31UL ) #define mainUART_REGISTER( offset ) ( ( mainUART_BASE_ADDRESS + offset ) ) #define mainUART_REGISTER_WORD( offset ) ( *( ( uint32_t * ) mainUART_REGISTER( offset ) ) ) /* Hardware LED specifics. */ -#define mainRED_LED_PIN ( 1UL << 0x16UL ) -#define mainLED_IO_BASE_ADDRESS ( 0x10012000UL ) -#define mainRED_LED_INPUT_ENABLE_REG ( * ( uint32_t * ) ( mainLED_IO_BASE_ADDRESS + 4UL ) ) -#define mainRED_LED_OUTPUT_ENABLE_REG ( * ( uint32_t * ) ( mainLED_IO_BASE_ADDRESS + 8UL ) ) +#define mainRED_LED_PIN ( 1UL << 0x16UL ) +#define mainLED_IO_BASE_ADDRESS ( 0x10012000UL ) +#define mainRED_LED_INPUT_ENABLE_REG ( *( uint32_t * ) ( mainLED_IO_BASE_ADDRESS + 4UL ) ) +#define mainRED_LED_OUTPUT_ENABLE_REG ( *( uint32_t * ) ( mainLED_IO_BASE_ADDRESS + 8UL ) ) /* Hardware LED specifics. */ -#define mainUART_PINMUX_BASE_ADDRESS ( 0x10012000 ) -#define mainUART0_BASE_ADDRESS 0x10013000UL -#define mainUART_CLOCK_RATE 16000000UL -#define mainUART_BAUD_RATE 115200UL -#define mainUART0_TX_DATA_REG ( * ( uint32_t * ) ( mainUART0_BASE_ADDRESS + 0UL ) ) -#define mainUART0_TX_DATA_BYTE_REG ( * ( uint8_t * ) ( mainUART0_BASE_ADDRESS + 0UL ) ) -#define mainUART0_DIV_REG ( * ( uint32_t * ) ( mainUART0_BASE_ADDRESS + 24UL ) ) -#define mainUART0_TXCTRL_REG ( * ( uint32_t * ) ( mainUART0_BASE_ADDRESS + 8UL ) ) -#define mainUART0_RXCTRL_REG ( * ( uint32_t * ) ( mainUART0_BASE_ADDRESS + 12UL ) ) -#define mainUART0_GPIO_SEL_REG ( * ( uint32_t * ) ( mainUART_PINMUX_BASE_ADDRESS + 60UL ) ) -#define mainUART0_GPIO_SEL_EN ( * ( uint32_t * ) ( mainUART_PINMUX_BASE_ADDRESS + 56UL ) ) -#define mainUART_TXEN_BIT ( 1UL ) -#define mainUART0_PIN ( 0x30000UL ) +#define mainUART_PINMUX_BASE_ADDRESS ( 0x10012000 ) +#define mainUART0_BASE_ADDRESS 0x10013000UL +#define mainUART_CLOCK_RATE 16000000UL +#define mainUART_BAUD_RATE 115200UL +#define mainUART0_TX_DATA_REG ( *( uint32_t * ) ( mainUART0_BASE_ADDRESS + 0UL ) ) +#define mainUART0_TX_DATA_BYTE_REG ( *( uint8_t * ) ( mainUART0_BASE_ADDRESS + 0UL ) ) +#define mainUART0_DIV_REG ( *( uint32_t * ) ( mainUART0_BASE_ADDRESS + 24UL ) ) +#define mainUART0_TXCTRL_REG ( *( uint32_t * ) ( mainUART0_BASE_ADDRESS + 8UL ) ) +#define mainUART0_RXCTRL_REG ( *( uint32_t * ) ( mainUART0_BASE_ADDRESS + 12UL ) ) +#define mainUART0_GPIO_SEL_REG ( *( uint32_t * ) ( mainUART_PINMUX_BASE_ADDRESS + 60UL ) ) +#define mainUART0_GPIO_SEL_EN ( *( uint32_t * ) ( mainUART_PINMUX_BASE_ADDRESS + 56UL ) ) +#define mainUART_TXEN_BIT ( 1UL ) +#define mainUART0_PIN ( 0x30000UL ) /* Registers used to initialise the PLIC. */ -#define mainPLIC_PENDING_0 ( * ( ( volatile uint32_t * ) 0x0C001000UL ) ) -#define mainPLIC_PENDING_1 ( * ( ( volatile uint32_t * ) 0x0C001004UL ) ) -#define mainPLIC_ENABLE_0 ( * ( ( volatile uint32_t * ) 0x0C002000UL ) ) -#define mainPLIC_ENABLE_1 ( * ( ( volatile uint32_t * ) 0x0C002004UL ) ) +#define mainPLIC_PENDING_0 ( *( ( volatile uint32_t * ) 0x0C001000UL ) ) +#define mainPLIC_PENDING_1 ( *( ( volatile uint32_t * ) 0x0C001004UL ) ) +#define mainPLIC_ENABLE_0 ( *( ( volatile uint32_t * ) 0x0C002000UL ) ) +#define mainPLIC_ENABLE_1 ( *( ( volatile uint32_t * ) 0x0C002004UL ) ) /*-----------------------------------------------------------*/ @@ -129,7 +129,8 @@ extern void freertos_vector_table( void ); */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /* @@ -151,7 +152,7 @@ int main( void ) /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top * of this file. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) { main_blinky(); } @@ -187,13 +188,13 @@ static void prvSetupHardware( void ) mainUART0_GPIO_SEL_REG &= mainUART0_PIN; mainUART0_GPIO_SEL_EN |= mainUART0_PIN; - #if( mainVECTOR_MODE_DIRECT == 1 ) + #if ( mainVECTOR_MODE_DIRECT == 1 ) { - __asm__ volatile( "csrw mtvec, %0" :: "r"( freertos_risc_v_trap_handler ) ); + __asm__ volatile ( "csrw mtvec, %0" : : "r" ( freertos_risc_v_trap_handler ) ); } #else { - __asm__ volatile( "csrw mtvec, %0" :: "r"( ( uintptr_t )freertos_vector_table | 0x1 ) ); + __asm__ volatile ( "csrw mtvec, %0" : : "r" ( ( uintptr_t ) freertos_vector_table | 0x1 ) ); } #endif } @@ -201,7 +202,7 @@ static void prvSetupHardware( void ) void vToggleLED( void ) { -static uint32_t ulLEDState = 0; + static uint32_t ulLEDState = 0; if( ulLEDState == 0 ) { @@ -211,18 +212,22 @@ static uint32_t ulLEDState = 0; { mainRED_LED_OUTPUT_ENABLE_REG &= ~mainRED_LED_PIN; } + ulLEDState = !ulLEDState; } /*-----------------------------------------------------------*/ void vSendString( const char * const pcString ) { -uint32_t ulIndex = 0; + uint32_t ulIndex = 0; /* Crude polling UART Tx. */ while( pcString[ ulIndex ] != 0x00 ) { - while( ( mainUART0_TX_DATA_REG & mainUART_TX_FULL_BIT ) != 0UL ); + while( ( mainUART0_TX_DATA_REG & mainUART_TX_FULL_BIT ) != 0UL ) + { + } + mainUART0_TX_DATA_BYTE_REG = pcString[ ulIndex ]; ulIndex++; } @@ -242,7 +247,10 @@ void vApplicationMallocFailedHook( 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). */ taskDISABLE_INTERRUPTS(); - for( ;; ); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ @@ -260,7 +268,8 @@ void vApplicationIdleHook( void ) } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { ( void ) pcTaskName; ( void ) pxTask; @@ -269,14 +278,17 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) * configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook * function is called if a stack overflow is detected. */ taskDISABLE_INTERRUPTS(); - for( ;; ); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { /* The tests in the full demo expect some interaction with interrupts. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) { extern void vFullDemoTickHook( void ); vFullDemoTickHook(); @@ -287,7 +299,7 @@ void vApplicationTickHook( void ) void freertos_risc_v_application_interrupt_handler( uint32_t ulMcause ) { -char pcCause[ 20 ]; + char pcCause[ 20 ]; /* Not implemented yet! */ sprintf( pcCause, "%u", ulMcause ); @@ -298,7 +310,7 @@ char pcCause[ 20 ]; void freertos_risc_v_application_exception_handler( uint32_t ulMcause ) { -char pcCause[ 20 ]; + char pcCause[ 20 ]; /* Not implemented yet! */ sprintf( pcCause, "%u", ulMcause ); @@ -307,7 +319,7 @@ char pcCause[ 20 ]; } /*-----------------------------------------------------------*/ -void *malloc( size_t xSize ) +void * malloc( size_t xSize ) { /* The linker script does not define a heap so artificially force an assert() * if something unexpectedly uses the C library heap. See diff --git a/FreeRTOS/Demo/RISC-V_RV64_PolarFire_SoftConsole/main.c b/FreeRTOS/Demo/RISC-V_RV64_PolarFire_SoftConsole/main.c index 94536f24345..17a401d4e45 100644 --- a/FreeRTOS/Demo/RISC-V_RV64_PolarFire_SoftConsole/main.c +++ b/FreeRTOS/Demo/RISC-V_RV64_PolarFire_SoftConsole/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -57,19 +57,19 @@ #include "drivers/mss/mss_mmuart/mss_uart.h" /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 /* Set to 1 to use direct mode and set to 0 to use vectored mode. - -VECTOR MODE=Direct --> all traps into machine mode cause the pc to be set to the -vector base address (BASE) in the mtvec register. - -VECTOR MODE=Vectored --> all synchronous exceptions into machine mode cause the -pc to be set to the BASE, whereas interrupts cause the pc to be set to the -address BASE plus four times the interrupt cause number. -*/ -#define mainVECTOR_MODE_DIRECT 0 + * + * VECTOR MODE=Direct --> all traps into machine mode cause the pc to be set to the + * vector base address (BASE) in the mtvec register. + * + * VECTOR MODE=Vectored --> all synchronous exceptions into machine mode cause the + * pc to be set to the BASE, whereas interrupts cause the pc to be set to the + * address BASE plus four times the interrupt cause number. + */ +#define mainVECTOR_MODE_DIRECT 0 /*-----------------------------------------------------------*/ @@ -92,7 +92,8 @@ extern void freertos_vector_table( void ); */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /* @@ -110,7 +111,7 @@ void e51( void ) /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top * of this file. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) { main_blinky(); } @@ -126,25 +127,25 @@ static void prvSetupHardware( void ) { /* Configure UART0. */ SYSREG->SUBBLK_CLOCK_CR |= SUBBLK_CLOCK_CR_MMUART0_MASK; - SYSREG->SOFT_RESET_CR &= ~SOFT_RESET_CR_MMUART0_MASK; + SYSREG->SOFT_RESET_CR &= ~SOFT_RESET_CR_MMUART0_MASK; MSS_UART_init( &( g_mss_uart0_lo ), MSS_UART_115200_BAUD, MSS_UART_DATA_8_BITS | MSS_UART_NO_PARITY | MSS_UART_ONE_STOP_BIT ); /* Configure the LED. */ - mss_config_clk_rst( MSS_PERIPH_GPIO2, ( uint8_t )MPFS_HAL_FIRST_HART, PERIPHERAL_ON ); + mss_config_clk_rst( MSS_PERIPH_GPIO2, ( uint8_t ) MPFS_HAL_FIRST_HART, PERIPHERAL_ON ); MSS_GPIO_config( GPIO2_LO, MSS_GPIO_16, MSS_GPIO_OUTPUT_MODE ); /* Red Led (LED1). */ MSS_GPIO_config( GPIO2_LO, MSS_GPIO_18, MSS_GPIO_OUTPUT_MODE ); /* Yellow Led (LED3). */ - #if( mainVECTOR_MODE_DIRECT == 1 ) - { - __asm__ volatile( "csrw mtvec, %0" :: "r"( freertos_risc_v_trap_handler ) ); - } - #else - { - __asm__ volatile( "csrw mtvec, %0" :: "r"( ( uintptr_t )freertos_vector_table | 0x1 ) ); - } - #endif + #if ( mainVECTOR_MODE_DIRECT == 1 ) + { + __asm__ volatile ( "csrw mtvec, %0" : : "r" ( freertos_risc_v_trap_handler ) ); + } + #else + { + __asm__ volatile ( "csrw mtvec, %0" : : "r" ( ( uintptr_t ) freertos_vector_table | 0x1 ) ); + } + #endif } /*-----------------------------------------------------------*/ @@ -161,7 +162,10 @@ void vApplicationMallocFailedHook( 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). */ taskDISABLE_INTERRUPTS(); - for( ;; ); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ @@ -179,7 +183,8 @@ void vApplicationIdleHook( void ) } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { ( void ) pcTaskName; ( void ) pxTask; @@ -188,14 +193,17 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) * configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook * function is called if a stack overflow is detected. */ taskDISABLE_INTERRUPTS(); - for( ;; ); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { /* The tests in the full demo expect some interaction with interrupts. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) { extern void vFullDemoTickHook( void ); vFullDemoTickHook(); @@ -206,7 +214,7 @@ void vApplicationTickHook( void ) void vToggleLED( void ) { -static volatile uint8_t value = 0u; + static volatile uint8_t value = 0u; value = ( value == 0u ) ? 1u : 0u; MSS_GPIO_set_output( GPIO2_LO, MSS_GPIO_18, value ); @@ -215,20 +223,20 @@ static volatile uint8_t value = 0u; void vAssertCalled( void ) { -volatile uint32_t ul; -const uint32_t ulNullLoopDelay = 0x1ffffUL; -static volatile uint8_t value = 0u; + volatile uint32_t ul; + const uint32_t ulNullLoopDelay = 0x1ffffUL; + static volatile uint8_t value = 0u; taskDISABLE_INTERRUPTS(); /* Flash the red LED to indicate that assert was hit - interrupts are off * here to prevent any further tick interrupts or context switches, so the * delay is implemented as a crude loop instead of a peripheral timer. */ - for( ;; ) + for( ; ; ) { for( ul = 0; ul < ulNullLoopDelay; ul++ ) { - __asm volatile( "nop" ); + __asm volatile ( "nop" ); } value = ( value == 0u ) ? 1u : 0u; diff --git a/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/FreeRTOSConfig.h b/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/FreeRTOSConfig.h index 80021cfcc67..e7385f64464 100644 --- a/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/blinky_demo/main_blinky.c b/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/blinky_demo/main_blinky.c index 3858cfbc8f3..a2b68a62fc2 100644 --- a/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/blinky_demo/main_blinky.c +++ b/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/blinky_demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/full_demo/main_full.c b/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/full_demo/main_full.c index 48835d20664..ff940ad59d0 100644 --- a/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/full_demo/main_full.c +++ b/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/full_demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/main.c b/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/main.c index c2f8f693c81..5c3d7be2591 100644 --- a/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/main.c +++ b/FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -50,24 +50,25 @@ */ /* 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. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1 + * or 0 to run the more comprehensive test and demo application. */ +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 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. */ #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 - extern void main_blinky( void ); + extern void main_blinky( void ); #else - extern void main_full( void ); + extern void main_full( void ); #endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */ /* 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 vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /* Prepare hardware to run the demo. */ @@ -86,105 +87,111 @@ static gpio_instance_t g_gpio_out; int main( void ) { - prvSetupHardware(); - - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - { - main_blinky(); - } - #else - { - main_full(); - } - #endif + prvSetupHardware(); + + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + { + main_blinky(); + } + #else + { + main_full(); + } + #endif } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - PLIC_init(); - UART_init( &g_uart, COREUARTAPB0_BASE_ADDR, BAUD_VALUE_115200, ( DATA_8_BITS | NO_PARITY ) ); + PLIC_init(); + UART_init( &g_uart, COREUARTAPB0_BASE_ADDR, BAUD_VALUE_115200, ( DATA_8_BITS | NO_PARITY ) ); } /*-----------------------------------------------------------*/ void vToggleLED( void ) { -static uint32_t ulLEDState = 0; + static uint32_t ulLEDState = 0; - GPIO_set_outputs( &g_gpio_out, ulLEDState ); - ulLEDState = !ulLEDState; + GPIO_set_outputs( &g_gpio_out, ulLEDState ); + ulLEDState = !ulLEDState; } /*-----------------------------------------------------------*/ void vSendString( const char * const pcString ) { - UART_polled_tx_string( &g_uart, ( const uint8_t * ) pcString ); + UART_polled_tx_string( &g_uart, ( const uint8_t * ) pcString ); } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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 - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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 + * FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* The tests in the full demo expect some interaction with interrupts. */ - #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) - { - extern void vFullDemoTickHook( void ); - vFullDemoTickHook(); - } - #endif + /* The tests in the full demo expect some interaction with interrupts. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) + { + extern void vFullDemoTickHook( void ); + vFullDemoTickHook(); + } + #endif } /*-----------------------------------------------------------*/ -void *_sbrk( ptrdiff_t incr ) +void * _sbrk( ptrdiff_t incr ) { - /* Required to link, but force an assert to ensure it is never actually - called. */ - configASSERT( ( void * ) incr == NULL ); - return NULL; + /* Required to link, but force an assert to ensure it is never actually + * called. */ + configASSERT( ( void * ) incr == NULL ); + return NULL; } - diff --git a/FreeRTOS/Demo/RL78_multiple_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/RL78_multiple_IAR/FreeRTOSConfig.h index d52832b9219..e7c4e0fd6a9 100644 --- a/FreeRTOS/Demo/RL78_multiple_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RL78_multiple_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RL78_multiple_IAR/demo_specific_io.h b/FreeRTOS/Demo/RL78_multiple_IAR/demo_specific_io.h index d92e8a60c8d..040a8a56b99 100644 --- a/FreeRTOS/Demo/RL78_multiple_IAR/demo_specific_io.h +++ b/FreeRTOS/Demo/RL78_multiple_IAR/demo_specific_io.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RL78_multiple_IAR/main.c b/FreeRTOS/Demo/RL78_multiple_IAR/main.c index 6b1844ed850..1f8eaa30c23 100644 --- a/FreeRTOS/Demo/RL78_multiple_IAR/main.c +++ b/FreeRTOS/Demo/RL78_multiple_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -57,7 +57,7 @@ #include "demo_specific_io.h" /* 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 /*-----------------------------------------------------------*/ @@ -73,13 +73,14 @@ extern void main_full( void ); * This function is called from the C startup routine to setup the processor - * in particular the CPU clock source. */ -int __low_level_init(void); +int __low_level_init( void ); /* Prototypes for the standard FreeRTOS callback/hook functions implemented -within this file. */ + * within this file. */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /* Prototype for the application-implemented timer for the OS tick */ @@ -88,18 +89,18 @@ void vApplicationSetupTimerInterrupt( void ); /*-----------------------------------------------------------*/ /* This variable is not actually used, but provided to allow an example of how -to write an ISR to be included in this file. */ + * to write an ISR to be included in this file. */ static SemaphoreHandle_t xSemaphore = NULL; /* RL78 Option Byte Definition. Watchdog disabled, LVI enabled, OCD interface -enabled. */ -__root __far const unsigned char OptionByte[] @ 0x00C0 = + * enabled. */ +__root __far const unsigned char OptionByte[] @0x00C0 = { 0x6eU, 0xffU, 0xe8U, 0x85U }; /* Security byte definition */ -__root __far const unsigned char ucSecurityCode[] @ 0x00C4 = +__root __far const unsigned char ucSecurityCode[] @0x00C4 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -109,7 +110,7 @@ __root __far const unsigned char ucSecurityCode[] @ 0x00C4 = void main( void ) { /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - of this file. */ + * of this file. */ #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 { main_blinky(); @@ -136,25 +137,25 @@ void vAnExampleISR_C_Handler( void ) * Also see the documentation page for this demo on the FreeRTOS.org website * for full instructions. */ -short sHigherPriorityTaskWoken = pdFALSE; + short sHigherPriorityTaskWoken = pdFALSE; /* Handler code goes here...*/ /* For purposes of demonstration, assume at some point the hander calls - xSemaphoreGiveFromISR().*/ + * xSemaphoreGiveFromISR().*/ xSemaphoreGiveFromISR( xSemaphore, &sHigherPriorityTaskWoken ); /* If giving the semaphore unblocked a task, and the unblocked task has a - priority higher than or equal to the currently running task, then - sHigherPriorityTaskWoken will have been set to pdTRUE internally within the - xSemaphoreGiveFromISR() function. Passing a pdTRUE value to - portYIELD_FROM_ISR() will cause this interrupt to return directly to the - higher priority unblocked task. */ + * priority higher than or equal to the currently running task, then + * sHigherPriorityTaskWoken will have been set to pdTRUE internally within the + * xSemaphoreGiveFromISR() function. Passing a pdTRUE value to + * portYIELD_FROM_ISR() will cause this interrupt to return directly to the + * higher priority unblocked task. */ portYIELD_FROM_ISR( sHigherPriorityTaskWoken ); } /*-----------------------------------------------------------*/ -int __low_level_init(void) +int __low_level_init( void ) { portDISABLE_INTERRUPTS(); @@ -184,14 +185,14 @@ int __low_level_init(void) void vApplicationSetupTimerInterrupt( void ) { -const uint16_t usClockHz = 15000UL; /* Internal clock. */ -const uint16_t usCompareMatch = ( usClockHz / configTICK_RATE_HZ ) + 1UL; + const uint16_t usClockHz = 15000UL; /* Internal clock. */ + const uint16_t usCompareMatch = ( usClockHz / configTICK_RATE_HZ ) + 1UL; /* Use the internal 15 kHz clock. */ OSMC = ( uint8_t ) 0x16; /* The clock source for the Interval Timer peripheral used for generating - the tick interrupt depends on the RL78 device in use. */ + * the tick interrupt depends on the RL78 device in use. */ #if configTICK_VECTOR == 0x38 { /* Supply the interval timer clock. */ @@ -232,48 +233,55 @@ const uint16_t usCompareMatch = ( usClockHz / configTICK_RATE_HZ ) + 1UL; /* Enable INTIT interrupt. */ TMKAMK = ( uint8_t ) 0; } - #else - #error "It is necessary to configure a suitable timer interrupt for the tick." - #endif + #else /* if configTICK_VECTOR == 0x38 */ + #error "It is necessary to configure a suitable timer interrupt for the tick." + #endif /* if configTICK_VECTOR == 0x38 */ } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { /* Called if a call to pvPortMalloc() fails because there is insufficient - free memory available in the FreeRTOS heap. pvPortMalloc() is called - internally by FreeRTOS API functions that create tasks, queues, software - timers, and semaphores. The size of the FreeRTOS heap is set by the - configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ + * free memory available in the FreeRTOS heap. pvPortMalloc() is called + * internally by FreeRTOS API functions that create tasks, queues, software + * timers, and semaphores. The size of the FreeRTOS heap is set by the + * configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ taskDISABLE_INTERRUPTS(); - for( ;; ); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { ( void ) pcTaskName; ( void ) pxTask; /* 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. */ + * configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook + * function is called if a stack overflow is detected. */ taskDISABLE_INTERRUPTS(); - for( ;; ); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -volatile size_t xFreeHeapSpace; + volatile size_t xFreeHeapSpace; /* This is just a trivial example of an idle hook. It is called on each - cycle of the idle task. It must *NOT* attempt to block. In this case the - idle task just queries the amount of FreeRTOS heap that remains. See the - memory management section on the http://www.FreeRTOS.org web site for memory - management options. If there is a lot of heap memory free then the - configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up - RAM. */ + * cycle of the idle task. It must *NOT* attempt to block. In this case the + * idle task just queries the amount of FreeRTOS heap that remains. See the + * memory management section on the http://www.FreeRTOS.org web site for memory + * management options. If there is a lot of heap memory free then the + * configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up + * RAM. */ xFreeHeapSpace = xPortGetFreeHeapSize(); /* Remove compiler warning about xFreeHeapSpace being set but never used. */ diff --git a/FreeRTOS/Demo/RL78_multiple_IAR/main_blinky.c b/FreeRTOS/Demo/RL78_multiple_IAR/main_blinky.c index 683458b5822..4cfef2c934f 100644 --- a/FreeRTOS/Demo/RL78_multiple_IAR/main_blinky.c +++ b/FreeRTOS/Demo/RL78_multiple_IAR/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -74,33 +74,33 @@ #include "demo_specific_io.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The 200ms value is converted -to ticks using the portTICK_PERIOD_MS constant. */ -#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) + * to ticks using the portTICK_PERIOD_MS constant. */ +#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS ) /* The number of items the queue can hold. This is 1 as the receive task -will remove items as they are added, meaning the send task should always find -the queue empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * will remove items as they are added, meaning the send task should always find + * the queue empty. */ +#define mainQUEUE_LENGTH ( 1 ) /* Used to check the task parameter passing in both supported memory models. */ #if __DATA_MODEL__ == __DATA_MODEL_FAR__ - #define mainQUEUE_SEND_PARAMETER ( ( void * ) 0x12345678UL ) - #define mainQUEUE_RECEIVE_PARAMETER ( ( void * ) 0x11223344UL ) + #define mainQUEUE_SEND_PARAMETER ( ( void * ) 0x12345678UL ) + #define mainQUEUE_RECEIVE_PARAMETER ( ( void * ) 0x11223344UL ) #else - #define mainQUEUE_SEND_PARAMETER ( ( void * ) 0x1234U ) - #define mainQUEUE_RECEIVE_PARAMETER ( ( void * ) 0x1122U ) + #define mainQUEUE_SEND_PARAMETER ( ( void * ) 0x1234U ) + #define mainQUEUE_RECEIVE_PARAMETER ( ( void * ) 0x1122U ) #endif /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * Called by main() to create the simply blinky style application if @@ -123,13 +123,13 @@ void main_blinky( void ) if( xQueue != NULL ) { /* Start the two tasks as described in the comments at the top of this - file. */ + * file. */ 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just used to check the port in this case. */ - mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ + "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just used to check the port in this case. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL ); @@ -138,18 +138,20 @@ void main_blinky( void ) } /* 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 insufficient FreeRTOS heap memory available for the idle and/or - timer tasks to be created. See the memory management section on the - FreeRTOS web site for more details. http://www.freertos.org/a00111.html. */ - for( ;; ); + * line will never be reached. If the following line does execute, then + * there was insufficient FreeRTOS heap memory available for the idle and/or + * timer tasks to be created. See the memory management section on the + * FreeRTOS web site for more details. http://www.freertos.org/a00111.html. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const unsigned long ulValueToSend = 100UL; + TickType_t xNextWakeTime; + const unsigned long ulValueToSend = 100UL; /* Check the parameter was passed in correctly. */ configASSERT( pvParameters == mainQUEUE_SEND_PARAMETER ) @@ -157,7 +159,7 @@ const unsigned long ulValueToSend = 100UL; /* Initialise xNextWakeTime - this only needs to be done once. */ xNextWakeTime = xTaskGetTickCount(); - for( ;; ) + for( ; ; ) { /* Place this task in the blocked state until it is time to run again. */ vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); @@ -173,15 +175,15 @@ const unsigned long ulValueToSend = 100UL; } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; -const unsigned long ulExpectedValue = 100UL; + unsigned long ulReceivedValue; + const unsigned long ulExpectedValue = 100UL; /* Check the parameter was passed in correctly. */ configASSERT( pvParameters == mainQUEUE_RECEIVE_PARAMETER ) - for( ;; ) + for( ; ; ) { /* * Wait until something arrives in the queue - this task will block diff --git a/FreeRTOS/Demo/RL78_multiple_IAR/main_full.c b/FreeRTOS/Demo/RL78_multiple_IAR/main_full.c index 484648ea1b3..d8b9e09b5a2 100644 --- a/FreeRTOS/Demo/RL78_multiple_IAR/main_full.c +++ b/FreeRTOS/Demo/RL78_multiple_IAR/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -92,30 +92,30 @@ #include "demo_specific_io.h" /* The period at 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 mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS ) + * 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 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, the check tasks, or the demo timer. -ms are converted to the equivalent in ticks using the portTICK_PERIOD_MS -constant. */ -#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) + * reported in one of the standard demo tasks, the check tasks, or the demo timer. + * ms are converted to the equivalent in ticks using the portTICK_PERIOD_MS + * constant. */ +#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) /* These two definitions are used to set the period of the demo timer. The demo -timer period is always relative to the check timer period, so the check timer -can determine if the demo timer has expired the expected number of times between -its own executions. */ + * timer period is always relative to the check timer period, so the check timer + * can determine if the demo timer has expired the expected number of times between + * its own executions. */ #define mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT ( 100UL ) -#define mainDEMO_TIMER_PERIOD_MS ( mainCHECK_TIMER_PERIOD_MS / mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT ) +#define mainDEMO_TIMER_PERIOD_MS ( mainCHECK_TIMER_PERIOD_MS / mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT ) /* A block time of zero simply means "don't block". */ -#define mainDONT_BLOCK ( 0U ) +#define mainDONT_BLOCK ( 0U ) /* Values that are passed as parameters into the reg test tasks (purely to -ensure task parameters are passed correctly). */ -#define mainREG_TEST_1_PARAMETER ( ( void * ) 0x1234 ) -#define mainREG_TEST_2_PARAMETER ( ( void * ) 0x5678 ) + * ensure task parameters are passed correctly). */ +#define mainREG_TEST_1_PARAMETER ( ( void * ) 0x1234 ) +#define mainREG_TEST_2_PARAMETER ( ( void * ) 0x5678 ) /*-----------------------------------------------------------*/ @@ -137,8 +137,8 @@ static void prvDemoTimerCallback( TimerHandle_t xTimer ); */ extern void vRegTest1Task( void ); extern void vRegTest2Task( void ); -static void prvRegTest1Entry( void *pvParameters ); -static void prvRegTest2Entry( void *pvParameters ); +static void prvRegTest1Entry( void * pvParameters ); +static void prvRegTest2Entry( void * pvParameters ); /* * Called if a RegTest task discovers an error as a mechanism to stop the @@ -156,11 +156,11 @@ void main_full( void ); /*-----------------------------------------------------------*/ /* Variables that are incremented on each cycle of the two reg tests to allow -the check timer to know that they are still executing. */ + * the check timer to know that they are still executing. */ unsigned short usRegTest1LoopCounter = 0, usRegTest2LoopCounter; /* The check timer. This uses prvCheckTimerCallback() as its callback -function. */ + * function. */ static TimerHandle_t xCheckTimer = NULL; /* The demo timer. This uses prvDemoTimerCallback() as its callback function. */ @@ -176,40 +176,40 @@ void main_full( void ) /* Creates all the tasks and timers, then starts the scheduler. */ /* First create the 'standard demo' tasks. These are used to demonstrate - API functions being used and also to test the kernel port. More information - is provided on the FreeRTOS.org WEB site. */ + * API functions being used and also to test the kernel port. More information + * is provided on the FreeRTOS.org WEB site. */ vStartDynamicPriorityTasks(); vStartPolledQueueTasks( tskIDLE_PRIORITY ); vCreateBlockTimeTasks(); /* Create the RegTest tasks as described at the top of this file. */ - xTaskCreate( prvRegTest1Entry, /* The function that implements the task. */ - "Reg1", /* Text name for the task - to assist debugging only, not used by the kernel. */ - configMINIMAL_STACK_SIZE, /* The size of the stack allocated to the task (in words, not bytes). */ - mainREG_TEST_1_PARAMETER, /* The parameter passed into the task. */ - tskIDLE_PRIORITY, /* The priority at which the task will execute. */ - NULL ); /* Used to pass the handle of the created task out to the function caller - not used in this case. */ + xTaskCreate( prvRegTest1Entry, /* The function that implements the task. */ + "Reg1", /* Text name for the task - to assist debugging only, not used by the kernel. */ + configMINIMAL_STACK_SIZE, /* The size of the stack allocated to the task (in words, not bytes). */ + mainREG_TEST_1_PARAMETER, /* The parameter passed into the task. */ + tskIDLE_PRIORITY, /* The priority at which the task will execute. */ + NULL ); /* Used to pass the handle of the created task out to the function caller - not used in this case. */ xTaskCreate( prvRegTest2Entry, "Reg2", configMINIMAL_STACK_SIZE, mainREG_TEST_2_PARAMETER, tskIDLE_PRIORITY, NULL ); /* Create the software timer that performs the 'check' functionality, - as described at the top of this file. */ - xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ - ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvCheckTimerCallback ); /* The callback function that inspects the status of all the other tasks. */ + * as described at the top of this file. */ + xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ + ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvCheckTimerCallback ); /* The callback function that inspects the status of all the other tasks. */ /* Create the software timer that just increments a variable for demo - purposes. */ - xDemoTimer = xTimerCreate( "DemoTimer",/* A text name, purely to help debugging. */ - ( mainDEMO_TIMER_PERIOD_MS ), /* The timer period, in this case it is always calculated relative to the check timer period (see the definition of mainDEMO_TIMER_PERIOD_MS). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvDemoTimerCallback ); /* The callback function that inspects the status of all the other tasks. */ + * purposes. */ + xDemoTimer = xTimerCreate( "DemoTimer", /* A text name, purely to help debugging. */ + ( mainDEMO_TIMER_PERIOD_MS ), /* The timer period, in this case it is always calculated relative to the check timer period (see the definition of mainDEMO_TIMER_PERIOD_MS). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvDemoTimerCallback ); /* The callback function that inspects the status of all the other tasks. */ /* Start both the check timer and the demo timer. The timers won't actually - start until the scheduler is started. */ + * start until the scheduler is started. */ xTimerStart( xCheckTimer, mainDONT_BLOCK ); xTimerStart( xDemoTimer, mainDONT_BLOCK ); @@ -217,10 +217,12 @@ void main_full( void ) vTaskStartScheduler(); /* If all is well execution will never reach here as the scheduler will be - running. If this null loop is reached then it is likely there was - insufficient FreeRTOS heap available for the idle task and/or timer task to - be created. See http://www.freertos.org/a00111.html. */ - for( ;; ); + * running. If this null loop is reached then it is likely there was + * insufficient FreeRTOS heap available for the idle task and/or timer task to + * be created. See http://www.freertos.org/a00111.html. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ @@ -230,17 +232,17 @@ static void prvDemoTimerCallback( TimerHandle_t xTimer ) ( void ) xTimer; /* The demo timer has expired. All it does is increment a variable. The - period of the demo timer is relative to that of the check timer, so the - check timer knows how many times this variable should have been incremented - between each execution of the check timer's own callback. */ + * period of the demo timer is relative to that of the check timer, so the + * check timer knows how many times this variable should have been incremented + * between each execution of the check timer's own callback. */ ulDemoSoftwareTimerCounter++; } /*-----------------------------------------------------------*/ static void prvCheckTimerCallback( TimerHandle_t xTimer ) { -static portBASE_TYPE xChangedTimerPeriodAlready = pdFALSE, xErrorStatus = pdPASS; -static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0; + static portBASE_TYPE xChangedTimerPeriodAlready = pdFALSE, xErrorStatus = pdPASS; + static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0; /* Remove compiler warning about unused parameter. */ ( void ) xTimer; @@ -262,7 +264,7 @@ static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0; } /* Indicate an error if either of the reg test loop counters have not - incremented since the last time this function was called. */ + * incremented since the last time this function was called. */ if( usLastRegTest1Counter == usRegTest1LoopCounter ) { xErrorStatus = pdFAIL; @@ -282,14 +284,14 @@ static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0; } /* Ensure that the demo software timer has expired - mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT times in between - each call of this function. A critical section is not required to access - ulDemoSoftwareTimerCounter as the variable is only accessed from another - software timer callback, and only one software timer callback can be - executing at any time. */ + * mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT times in between + * each call of this function. A critical section is not required to access + * ulDemoSoftwareTimerCounter as the variable is only accessed from another + * software timer callback, and only one software timer callback can be + * executing at any time. */ if( ( ulDemoSoftwareTimerCounter < ( mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT - 1 ) ) || ( ulDemoSoftwareTimerCounter > ( mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT + 1 ) ) - ) + ) { xErrorStatus = pdFAIL; } @@ -301,19 +303,19 @@ static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0; if( ( xErrorStatus == pdFAIL ) && ( xChangedTimerPeriodAlready == pdFALSE ) ) { /* An error has occurred, but the timer's period has not yet been changed, - change it now, and remember that it has been changed. Shortening the - timer's period means the LED will toggle at a faster rate, giving a - visible indication that something has gone wrong. */ + * change it now, and remember that it has been changed. Shortening the + * timer's period means the LED will toggle at a faster rate, giving a + * visible indication that something has gone wrong. */ xChangedTimerPeriodAlready = pdTRUE; /* This call to xTimerChangePeriod() uses a zero block time. Functions - called from inside of a timer callback function must *never* attempt to - block. */ + * called from inside of a timer callback function must *never* attempt to + * block. */ xTimerChangePeriod( xCheckTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); } /* Toggle the LED. The toggle rate will depend on whether or not an error - has been found in any tasks. */ + * has been found in any tasks. */ LED_BIT = !LED_BIT; } /*-----------------------------------------------------------*/ @@ -321,17 +323,19 @@ static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0; void vRegTestError( void ) { /* Called by both reg test tasks if an error is found. There is no way out - of this function so the loop counter of the calling task will stop - incrementing, which will result in the check timer signaling an error. */ - for( ;; ); + * of this function so the loop counter of the calling task will stop + * incrementing, which will result in the check timer signaling an error. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvRegTest1Entry( void *pvParameters ) +static void prvRegTest1Entry( void * pvParameters ) { /* If the parameter has its expected value then start the first reg test - task (this is only done to test that the RTOS port is correctly handling - task parameters. */ + * task (this is only done to test that the RTOS port is correctly handling + * task parameters. */ if( pvParameters == mainREG_TEST_1_PARAMETER ) { vRegTest1Task(); @@ -342,15 +346,15 @@ static void prvRegTest1Entry( void *pvParameters ) } /* It is not possible to get here as neither of the two functions called - above will ever return. */ + * above will ever return. */ } /*-----------------------------------------------------------*/ -static void prvRegTest2Entry( void *pvParameters ) +static void prvRegTest2Entry( void * pvParameters ) { /* If the parameter has its expected value then start the first reg test - task (this is only done to test that the RTOS port is correctly handling - task parameters. */ + * task (this is only done to test that the RTOS port is correctly handling + * task parameters. */ if( pvParameters == mainREG_TEST_2_PARAMETER ) { vRegTest2Task(); @@ -361,7 +365,6 @@ static void prvRegTest2Entry( void *pvParameters ) } /* It is not possible to get here as neither of the two functions called - above will ever return. */ + * above will ever return. */ } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/FreeRTOSConfig.h b/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/FreeRTOSConfig.h index 18763242473..15ba7af866e 100644 --- a/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/ParTest.c b/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/ParTest.c index 72ae59ef0f3..f3cc76a3a7c 100644 --- a/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/ParTest.c +++ b/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/main.c b/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/main.c index 7f38b90d121..1892200f11c 100644 --- a/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/main.c +++ b/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/main_full.c b/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/main_full.c index 9e6f03f9d73..ef60539eebd 100644 --- a/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/main_full.c +++ b/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/main_low_power.c b/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/main_low_power.c index 6b663243998..7f32e08994f 100644 --- a/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/main_low_power.c +++ b/FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/main_low_power.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100-RSK_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/RX100-RSK_IAR/FreeRTOSConfig.h index c28c0ae7047..d5ea8483902 100644 --- a/FreeRTOS/Demo/RX100-RSK_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RX100-RSK_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100-RSK_IAR/ParTest.c b/FreeRTOS/Demo/RX100-RSK_IAR/ParTest.c index 72ae59ef0f3..f3cc76a3a7c 100644 --- a/FreeRTOS/Demo/RX100-RSK_IAR/ParTest.c +++ b/FreeRTOS/Demo/RX100-RSK_IAR/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100-RSK_IAR/PriorityDefinitions.h b/FreeRTOS/Demo/RX100-RSK_IAR/PriorityDefinitions.h index c998416033f..2ff5c0b9a79 100644 --- a/FreeRTOS/Demo/RX100-RSK_IAR/PriorityDefinitions.h +++ b/FreeRTOS/Demo/RX100-RSK_IAR/PriorityDefinitions.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100-RSK_IAR/main.c b/FreeRTOS/Demo/RX100-RSK_IAR/main.c index 8e51a6b30ba..9f6d27af358 100644 --- a/FreeRTOS/Demo/RX100-RSK_IAR/main.c +++ b/FreeRTOS/Demo/RX100-RSK_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -59,105 +59,113 @@ extern void main_low_power( void ); extern void main_full( void ); /* Prototypes for the standard FreeRTOS callback/hook functions implemented -within this file. */ + * within this file. */ void vApplicationMallocFailedHook( void ); void vApplicationIdleHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /*-----------------------------------------------------------*/ /* See the documentation page for this demo on the FreeRTOS.org web site for -full information - including hardware setup requirements. */ + * full information - including hardware setup requirements. */ void main( void ) { - /* Call the Renesas provided setup. */ - vHardwareSetup(); - lcd_initialize(); - lcd_display( LCD_LINE1, "FreeRTOS" ); - - /* The configCREATE_LOW_POWER_DEMO setting is described in FreeRTOSConfig.h. */ - #if configCREATE_LOW_POWER_DEMO == 1 - { - lcd_display( LCD_LINE2, "LP Demo" ); - main_low_power(); - } - #else - { - lcd_display( LCD_LINE2, "Ful Demo" ); - main_full(); - } - #endif + /* Call the Renesas provided setup. */ + vHardwareSetup(); + lcd_initialize(); + lcd_display( LCD_LINE1, "FreeRTOS" ); + + /* The configCREATE_LOW_POWER_DEMO setting is described in FreeRTOSConfig.h. */ + #if configCREATE_LOW_POWER_DEMO == 1 + { + lcd_display( LCD_LINE2, "LP Demo" ); + main_low_power(); + } + #else + { + lcd_display( LCD_LINE2, "Ful Demo" ); + main_full(); + } + #endif } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - 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. - 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, heap_2.c or heap_4.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 - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ - taskDISABLE_INTERRUPTS(); - for( ;; ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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, heap_2.c or heap_4.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 + * to query the size of free heap space that remains (although it does not + * provide information on how the remaining heap might be fragmented). */ + taskDISABLE_INTERRUPTS(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* 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 - 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 - 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 + * 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 + * 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. */ } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; - - /* 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(); - for( ;; ); + ( void ) pcTaskName; + ( void ) pxTask; + + /* 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(); + + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* This function will be called by each tick interrupt if - configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - added here, but the tick hook is called from an interrupt context, so - code must not attempt to block, and only the interrupt safe FreeRTOS API - functions can be used (those that end in FromISR()). */ + /* This function will be called by each tick interrupt if + * configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + * added here, but the tick hook is called from an interrupt context, so + * code must not attempt to block, and only the interrupt safe FreeRTOS API + * functions can be used (those that end in FromISR()). */ } /*-----------------------------------------------------------*/ void vAssertCalled( void ) { -volatile unsigned long ul = 0; - - taskENTER_CRITICAL(); - { - /* Set ul to a non-zero value using the debugger to step out of this - function. */ - while( ul == 0 ) - { - __asm volatile( "NOP" ); - } - } - taskEXIT_CRITICAL(); + volatile unsigned long ul = 0; + + taskENTER_CRITICAL(); + { + /* Set ul to a non-zero value using the debugger to step out of this + * function. */ + while( ul == 0 ) + { + __asm volatile ( "NOP" ); + } + } + taskEXIT_CRITICAL(); } diff --git a/FreeRTOS/Demo/RX100-RSK_IAR/main_full.c b/FreeRTOS/Demo/RX100-RSK_IAR/main_full.c index c4c81278e3a..485d3f45682 100644 --- a/FreeRTOS/Demo/RX100-RSK_IAR/main_full.c +++ b/FreeRTOS/Demo/RX100-RSK_IAR/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -65,7 +65,7 @@ * *NOTE 1* The CPU must be in Supervisor mode when the scheduler is started. * The PowerON_Reset_PC() supplied in resetprg.c with this demo has * Change_PSW_PM_to_UserMode() commented out to ensure this is the case. -*/ + */ /* Standard includes. */ #include @@ -88,211 +88,213 @@ /* Variables that are incremented on each iteration of the reg test tasks are -declared outside of the #if configCREATE_LOW_POWER_DEMO conditional compilation -to prevent linker issues when configCREATE_LOW_POWER_DEMO is set to 1. 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. */ + * declared outside of the #if configCREATE_LOW_POWER_DEMO conditional compilation + * to prevent linker issues when configCREATE_LOW_POWER_DEMO is set to 1. 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. */ unsigned long volatile ulRegTest1CycleCount = 0UL, ulRegTest2CycleCount = 0UL; /* The code in this file is only built when configCREATE_LOW_POWER_DEMO is set -to 0, otherwise the code in main_low_power.c is used. */ + * to 0, otherwise the code in main_low_power.c is used. */ #if configCREATE_LOW_POWER_DEMO == 0 /* Values that are passed into the reg test tasks using the task parameter. -The tasks check that the values are passed in correctly. */ -#define mainREG_TEST_1_PARAMETER ( 0x12121212UL ) -#define mainREG_TEST_2_PARAMETER ( 0x12345678UL ) + * The tasks check that the values are passed in correctly. */ + #define mainREG_TEST_1_PARAMETER ( 0x12121212UL ) + #define mainREG_TEST_2_PARAMETER ( 0x12345678UL ) /* Priorities at which the standard demo tasks are created. */ -#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) + #define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) + #define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) /* The LED toggled by the check timer. */ -#define mainCHECK_LED ( 0 ) + #define mainCHECK_LED ( 0 ) /* The period at 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 mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS ) + * 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 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_PERIOD_MS constant. */ -#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) + * 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_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS ) /* A block time of zero simple means "Don't Block". */ -#define mainDONT_BLOCK ( 0UL ) + #define mainDONT_BLOCK ( 0UL ) /* * The reg test tasks as described at the top of this file. */ -static void prvRegTest1Task( void *pvParameters ); -static void prvRegTest2Task( void *pvParameters ); + static void prvRegTest1Task( void * pvParameters ); + static void prvRegTest2Task( void * pvParameters ); /* * The actual implementation of the reg test functionality, which, because of * the direct register access, have to be in assembly. */ -void vRegTest1Implementation( void ); -void vRegTest2Implementation( void ); + void vRegTest1Implementation( void ); + void vRegTest2Implementation( void ); /* * The check timer callback function, as described at the top of this file. */ -static void prvCheckTimerCallback( TimerHandle_t xTimer ); + static void prvCheckTimerCallback( TimerHandle_t xTimer ); /*-----------------------------------------------------------*/ /* The check timer. This uses prvCheckTimerCallback() as its callback -function. */ -static TimerHandle_t xCheckTimer = NULL; + * function. */ + static TimerHandle_t xCheckTimer = NULL; /*-----------------------------------------------------------*/ -void main_full( void ) -{ - /* Start the reg test tasks which test the context switching mechanism. */ - xTaskCreate( prvRegTest1Task, "RegTst1", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_1_PARAMETER, tskIDLE_PRIORITY, NULL ); - xTaskCreate( prvRegTest2Task, "RegTst2", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_2_PARAMETER, tskIDLE_PRIORITY, NULL ); - - /* Create the standard demo tasks. */ - vCreateBlockTimeTasks(); - vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); - vStartRecursiveMutexTasks(); - - /* The suicide tasks must be created last as they need to know how many - tasks were running prior to their creation in order to ascertain whether - or not the correct/expected number of tasks are running at any given time. */ - vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - - /* Create the software timer that performs the 'check' functionality, - as described at the top of this file. */ - xCheckTimer = xTimerCreate( "CheckTimer",/* A text name, purely to help debugging. */ - ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */ - pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ - ( void * ) 0, /* The ID is not used, so can be set to anything. */ - prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - - configASSERT( xCheckTimer ); - - /* Start the check timer. It will actually start when the scheduler is - started. */ - xTimerStart( xCheckTimer, mainDONT_BLOCK ); - - /* Start the tasks running. */ - vTaskStartScheduler(); - - /* If all is well execution will never reach here as the scheduler will be - running. If this null loop is reached then it is likely there was - insufficient FreeRTOS heap available for the idle task and/or timer task to - be created. See http://www.freertos.org/a00111.html. */ - for( ;; ); -} + void main_full( void ) + { + /* Start the reg test tasks which test the context switching mechanism. */ + xTaskCreate( prvRegTest1Task, "RegTst1", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_1_PARAMETER, tskIDLE_PRIORITY, NULL ); + xTaskCreate( prvRegTest2Task, "RegTst2", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_2_PARAMETER, tskIDLE_PRIORITY, NULL ); + + /* Create the standard demo tasks. */ + vCreateBlockTimeTasks(); + vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); + vStartRecursiveMutexTasks(); + + /* The suicide tasks must be created last as they need to know how many + * tasks were running prior to their creation in order to ascertain whether + * or not the correct/expected number of tasks are running at any given time. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + + /* Create the software timer that performs the 'check' functionality, + * as described at the top of this file. */ + xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */ + ( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */ + pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ + ( void * ) 0, /* The ID is not used, so can be set to anything. */ + prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ + ); + + configASSERT( xCheckTimer ); + + /* Start the check timer. It will actually start when the scheduler is + * started. */ + xTimerStart( xCheckTimer, mainDONT_BLOCK ); + + /* Start the tasks running. */ + vTaskStartScheduler(); + + /* If all is well execution will never reach here as the scheduler will be + * running. If this null loop is reached then it is likely there was + * insufficient FreeRTOS heap available for the idle task and/or timer task to + * be created. See http://www.freertos.org/a00111.html. */ + for( ; ; ) + { + } + } /*-----------------------------------------------------------*/ -static void prvCheckTimerCallback( TimerHandle_t xTimer ) -{ -static long lChangedTimerPeriodAlready = pdFALSE, lErrorStatus = pdPASS; -static volatile unsigned long ulLastRegTest1CycleCount = 0UL, ulLastRegTest2CycleCount = 0UL; - - /* Remove compiler warnings about unused parameters. */ - ( void ) xTimer; - - /* Check the standard demo tasks are running without error. */ - if( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - lErrorStatus = pdFAIL; - } - else if( xIsCreateTaskStillRunning() != pdTRUE ) - { - lErrorStatus = pdFAIL; - } - else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - lErrorStatus = pdFAIL; - } - else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - lErrorStatus = pdFAIL; - } - - /* Check the reg test tasks are still cycling. They will stop incrementing - their loop counters if they encounter an error. */ - if( ulRegTest1CycleCount == ulLastRegTest1CycleCount ) - { - lErrorStatus = pdFAIL; - } - - if( ulRegTest2CycleCount == ulLastRegTest2CycleCount ) - { - lErrorStatus = pdFAIL; - } - - /* Remember the loop counter values this time around so they can be checked - again the next time this callback function executes. */ - ulLastRegTest1CycleCount = ulRegTest1CycleCount; - ulLastRegTest2CycleCount = ulRegTest2CycleCount; - - /* Toggle the check LED to give an indication of the system status. If - the LED toggles every three seconds then everything is ok. A faster toggle - indicates an error. */ - vParTestToggleLED( mainCHECK_LED ); - - /* Was an error detected this time through the callback execution? */ - if( lErrorStatus != pdPASS ) - { - if( lChangedTimerPeriodAlready == pdFALSE ) - { - lChangedTimerPeriodAlready = pdTRUE; - - /* This call to xTimerChangePeriod() uses a zero block time. - Functions called from inside of a timer callback function must - *never* attempt to block. */ - xTimerChangePeriod( xCheckTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); - } - } -} + static void prvCheckTimerCallback( TimerHandle_t xTimer ) + { + static long lChangedTimerPeriodAlready = pdFALSE, lErrorStatus = pdPASS; + static volatile unsigned long ulLastRegTest1CycleCount = 0UL, ulLastRegTest2CycleCount = 0UL; + + /* Remove compiler warnings about unused parameters. */ + ( void ) xTimer; + + /* Check the standard demo tasks are running without error. */ + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + lErrorStatus = pdFAIL; + } + else if( xIsCreateTaskStillRunning() != pdTRUE ) + { + lErrorStatus = pdFAIL; + } + else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + lErrorStatus = pdFAIL; + } + else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + lErrorStatus = pdFAIL; + } + + /* Check the reg test tasks are still cycling. They will stop incrementing + * their loop counters if they encounter an error. */ + if( ulRegTest1CycleCount == ulLastRegTest1CycleCount ) + { + lErrorStatus = pdFAIL; + } + + if( ulRegTest2CycleCount == ulLastRegTest2CycleCount ) + { + lErrorStatus = pdFAIL; + } + + /* Remember the loop counter values this time around so they can be checked + * again the next time this callback function executes. */ + ulLastRegTest1CycleCount = ulRegTest1CycleCount; + ulLastRegTest2CycleCount = ulRegTest2CycleCount; + + /* Toggle the check LED to give an indication of the system status. If + * the LED toggles every three seconds then everything is ok. A faster toggle + * indicates an error. */ + vParTestToggleLED( mainCHECK_LED ); + + /* Was an error detected this time through the callback execution? */ + if( lErrorStatus != pdPASS ) + { + if( lChangedTimerPeriodAlready == pdFALSE ) + { + lChangedTimerPeriodAlready = pdTRUE; + + /* This call to xTimerChangePeriod() uses a zero block time. + * Functions called from inside of a timer callback function must + * never* attempt to block. */ + xTimerChangePeriod( xCheckTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK ); + } + } + } /*-----------------------------------------------------------*/ /* This function is explained in the comments at the top of this file. */ -static void prvRegTest1Task( void *pvParameters ) -{ - if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_1_PARAMETER ) - { - /* The parameter did not contain the expected value. */ - for( ;; ) - { - /* Stop the tick interrupt so its obvious something has gone wrong. */ - taskDISABLE_INTERRUPTS(); - } - } - - /* This is an inline asm function that never returns. */ - vRegTest1Implementation(); -} + static void prvRegTest1Task( void * pvParameters ) + { + if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_1_PARAMETER ) + { + /* The parameter did not contain the expected value. */ + for( ; ; ) + { + /* Stop the tick interrupt so its obvious something has gone wrong. */ + taskDISABLE_INTERRUPTS(); + } + } + + /* This is an inline asm function that never returns. */ + vRegTest1Implementation(); + } /*-----------------------------------------------------------*/ /* This function is explained in the comments at the top of this file. */ -static void prvRegTest2Task( void *pvParameters ) -{ - if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_2_PARAMETER ) - { - /* The parameter did not contain the expected value. */ - for( ;; ) - { - /* Stop the tick interrupt so its obvious something has gone wrong. */ - taskDISABLE_INTERRUPTS(); - } - } - - /* This is an inline asm function that never returns. */ - vRegTest2Implementation(); -} + static void prvRegTest2Task( void * pvParameters ) + { + if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_2_PARAMETER ) + { + /* The parameter did not contain the expected value. */ + for( ; ; ) + { + /* Stop the tick interrupt so its obvious something has gone wrong. */ + taskDISABLE_INTERRUPTS(); + } + } + + /* This is an inline asm function that never returns. */ + vRegTest2Implementation(); + } /*-----------------------------------------------------------*/ #endif /* configCREATE_LOW_POWER_DEMO */ diff --git a/FreeRTOS/Demo/RX100-RSK_IAR/main_low_power.c b/FreeRTOS/Demo/RX100-RSK_IAR/main_low_power.c index 20f9f68df02..d22bd3ead6a 100644 --- a/FreeRTOS/Demo/RX100-RSK_IAR/main_low_power.c +++ b/FreeRTOS/Demo/RX100-RSK_IAR/main_low_power.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -122,43 +122,43 @@ #include "partest.h" /* Priorities at which the Rx and Tx tasks are created. */ -#define configQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define configQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define configQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define configQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* The number of items the queue can hold. This is 1 as the Rx task will -remove items as they are added so the Tx task should always find the queue -empty. */ -#define mainQUEUE_LENGTH ( 1 ) + * remove items as they are added so the Tx task should always find the queue + * empty. */ +#define mainQUEUE_LENGTH ( 1 ) /* The LED used to indicate that a value has been received on the queue. */ -#define mainQUEUE_LED ( 0 ) +#define mainQUEUE_LED ( 0 ) /* The LED used to indicate that full power is being used (the MCU is not in -deep sleep or software standby mode). */ -#define mainFULL_POWER_LED ( 1 ) + * deep sleep or software standby mode). */ +#define mainFULL_POWER_LED ( 1 ) /* The LED used to indicate that deep sleep mode is being used. */ -#define mainDEEP_SLEEP_LED ( 2 ) +#define mainDEEP_SLEEP_LED ( 2 ) /* The Tx task sends to the queue with a frequency that is set by the value -read from the potentiometer until the value goes above that set by the -mainSOFTWARE_STANDBY_DELAY constant - at which time the Tx task instead blocks -indefinitely on a semaphore. */ -#define mainSOFTWARE_STANDBY_DELAY ( 3000UL ) + * read from the potentiometer until the value goes above that set by the + * mainSOFTWARE_STANDBY_DELAY constant - at which time the Tx task instead blocks + * indefinitely on a semaphore. */ +#define mainSOFTWARE_STANDBY_DELAY ( 3000UL ) /* A block time of zero simply means "don't block". */ -#define mainDONT_BLOCK ( 0 ) +#define mainDONT_BLOCK ( 0 ) /* The value that is sent from the Tx task to the Rx task on the queue. */ -#define mainQUEUED_VALUE ( 100UL ) +#define mainQUEUED_VALUE ( 100UL ) /*-----------------------------------------------------------*/ /* * The Rx and Tx tasks as described at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * Reads and returns the value of the ADC connected to the potentiometer built @@ -183,207 +183,209 @@ static SemaphoreHandle_t xSemaphore = NULL; void main_low_power( void ) { - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); - configASSERT( xQueue ); - - /* Create the semaphore that is 'given' by an interrupt generated from a - button push. */ - vSemaphoreCreateBinary( xSemaphore ); - configASSERT( xSemaphore ); - - /* Make sure the semaphore starts in the expected state - no button pushes - have yet occurred. A block time of zero can be used as it is guaranteed - that the semaphore will be available because it has just been created. */ - xSemaphoreTake( xSemaphore, mainDONT_BLOCK ); - - /* Start the two tasks as described at the top of this file. */ - xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, configQUEUE_RECEIVE_TASK_PRIORITY, NULL ); - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, configQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* The CPU is currently running, not sleeping, so turn on the LED that - shows the CPU is not in a sleep mode. */ - vParTestSetLED( mainFULL_POWER_LED, pdTRUE ); - - /* Start the scheduler running running. */ - vTaskStartScheduler(); - - /* If all is well the next line of code will not be reached as the - scheduler will be running. If the next line is reached then it is likely - there was insufficient FreeRTOS heap available for the idle task and/or - timer task to be created. See http://www.freertos.org/a00111.html. */ - for( ;; ); + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) ); + configASSERT( xQueue ); + + /* Create the semaphore that is 'given' by an interrupt generated from a + * button push. */ + vSemaphoreCreateBinary( xSemaphore ); + configASSERT( xSemaphore ); + + /* Make sure the semaphore starts in the expected state - no button pushes + * have yet occurred. A block time of zero can be used as it is guaranteed + * that the semaphore will be available because it has just been created. */ + xSemaphoreTake( xSemaphore, mainDONT_BLOCK ); + + /* Start the two tasks as described at the top of this file. */ + xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, configQUEUE_RECEIVE_TASK_PRIORITY, NULL ); + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, configQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* The CPU is currently running, not sleeping, so turn on the LED that + * shows the CPU is not in a sleep mode. */ + vParTestSetLED( mainFULL_POWER_LED, pdTRUE ); + + /* Start the scheduler running running. */ + vTaskStartScheduler(); + + /* If all is well the next line of code will not be reached as the + * scheduler will be running. If the next line is reached then it is likely + * there was insufficient FreeRTOS heap available for the idle task and/or + * timer task to be created. See http://www.freertos.org/a00111.html. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xDelay; -const unsigned long ulValueToSend = mainQUEUED_VALUE; - - /* Remove compiler warning about unused parameter. */ - ( void ) pvParameters; - - for( ;; ) - { - /* The delay period between successive sends to the queue is set by - the potentiometer reading. */ - xDelay = ( TickType_t ) prvReadPOT(); - - /* If the block time is greater than 3000 milliseconds then block - indefinitely waiting for a button push. */ - if( xDelay > mainSOFTWARE_STANDBY_DELAY ) - { - /* As this is an indefinite delay the kernel will place the CPU - into software standby mode the next time the idle task runs. */ - xSemaphoreTake( xSemaphore, portMAX_DELAY ); - } - else - { - /* Convert a time in milliseconds to a time in ticks. */ - xDelay /= portTICK_PERIOD_MS; - - /* Place this task in the blocked state until it is time to run - again. As this is not an indefinite sleep the kernel will place - the CPU into the deep sleep state when the idle task next runs. */ - vTaskDelay( xDelay ); - } - - /* Send to the queue - causing the queue receive task to flash its LED. - It should not be necessary to block on the queue send because the Rx - task will have removed the last queued item. */ - xQueueSend( xQueue, &ulValueToSend, mainDONT_BLOCK ); - } + TickType_t xDelay; + const unsigned long ulValueToSend = mainQUEUED_VALUE; + + /* Remove compiler warning about unused parameter. */ + ( void ) pvParameters; + + for( ; ; ) + { + /* The delay period between successive sends to the queue is set by + * the potentiometer reading. */ + xDelay = ( TickType_t ) prvReadPOT(); + + /* If the block time is greater than 3000 milliseconds then block + * indefinitely waiting for a button push. */ + if( xDelay > mainSOFTWARE_STANDBY_DELAY ) + { + /* As this is an indefinite delay the kernel will place the CPU + * into software standby mode the next time the idle task runs. */ + xSemaphoreTake( xSemaphore, portMAX_DELAY ); + } + else + { + /* Convert a time in milliseconds to a time in ticks. */ + xDelay /= portTICK_PERIOD_MS; + + /* Place this task in the blocked state until it is time to run + * again. As this is not an indefinite sleep the kernel will place + * the CPU into the deep sleep state when the idle task next runs. */ + vTaskDelay( xDelay ); + } + + /* Send to the queue - causing the queue receive task to flash its LED. + * It should not be necessary to block on the queue send because the Rx + * task will have removed the last queued item. */ + xQueueSend( xQueue, &ulValueToSend, mainDONT_BLOCK ); + } } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -unsigned long ulReceivedValue; - - /* Remove compiler warning about unused parameter. */ - ( void ) pvParameters; - - for( ;; ) - { - /* Wait until something arrives in the queue - this will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have arrived, but is it the expected - value? If it is, toggle the LED. */ - if( ulReceivedValue == mainQUEUED_VALUE ) - { - vParTestToggleLED( mainQUEUE_LED ); - } - } + unsigned long ulReceivedValue; + + /* Remove compiler warning about unused parameter. */ + ( void ) pvParameters; + + for( ; ; ) + { + /* Wait until something arrives in the queue - this will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have arrived, but is it the expected + * value? If it is, toggle the LED. */ + if( ulReceivedValue == mainQUEUED_VALUE ) + { + vParTestToggleLED( mainQUEUE_LED ); + } + } } /*-----------------------------------------------------------*/ void vPreSleepProcessing( unsigned long ulExpectedIdleTime ) { - /* Called by the kernel before it places the MCU into a sleep mode because - configPRE_SLEEP_PROCESSING() is #defined to vPreSleepProcessing(). - - NOTE: Additional actions can be taken here to get the power consumption - even lower. For example, the ADC input used by this demo could be turned - off here, and then back on again in the post sleep processing function. - For maximum power saving ensure all unused pins are in their lowest power - state. */ - - /* Avoid compiler warnings about the unused parameter. */ - ( void ) ulExpectedIdleTime; - - /* Is the MCU about to enter deep sleep mode or software standby mode? */ - if( SYSTEM.SBYCR.BIT.SSBY == 0 ) - { - /* Turn on the LED that indicates deep sleep mode is being entered. */ - vParTestSetLED( mainDEEP_SLEEP_LED, pdTRUE ); - } - else - { - /* Software standby mode is being used, so no LEDs are illuminated to - ensure minimum power readings are obtained. Ensure the Queue LED is - also off. */ - vParTestSetLED( mainQUEUE_LED, pdFALSE ); - } - - /* Turn off the LED that indicates full power is being used. */ - vParTestSetLED( mainFULL_POWER_LED, pdFALSE ); + /* Called by the kernel before it places the MCU into a sleep mode because + * configPRE_SLEEP_PROCESSING() is #defined to vPreSleepProcessing(). + * + * NOTE: Additional actions can be taken here to get the power consumption + * even lower. For example, the ADC input used by this demo could be turned + * off here, and then back on again in the post sleep processing function. + * For maximum power saving ensure all unused pins are in their lowest power + * state. */ + + /* Avoid compiler warnings about the unused parameter. */ + ( void ) ulExpectedIdleTime; + + /* Is the MCU about to enter deep sleep mode or software standby mode? */ + if( SYSTEM.SBYCR.BIT.SSBY == 0 ) + { + /* Turn on the LED that indicates deep sleep mode is being entered. */ + vParTestSetLED( mainDEEP_SLEEP_LED, pdTRUE ); + } + else + { + /* Software standby mode is being used, so no LEDs are illuminated to + * ensure minimum power readings are obtained. Ensure the Queue LED is + * also off. */ + vParTestSetLED( mainQUEUE_LED, pdFALSE ); + } + + /* Turn off the LED that indicates full power is being used. */ + vParTestSetLED( mainFULL_POWER_LED, pdFALSE ); } /*-----------------------------------------------------------*/ void vPostSleepProcessing( unsigned long ulExpectedIdleTime ) { - /* Called by the kernel when the MCU exits a sleep mode because - configPOST_SLEEP_PROCESSING is #defined to vPostSleepProcessing(). */ + /* Called by the kernel when the MCU exits a sleep mode because + * configPOST_SLEEP_PROCESSING is #defined to vPostSleepProcessing(). */ - /* Avoid compiler warnings about the unused parameter. */ - ( void ) ulExpectedIdleTime; + /* Avoid compiler warnings about the unused parameter. */ + ( void ) ulExpectedIdleTime; - /* Turn off the LED that indicates deep sleep mode, and turn on the LED - that indicates full power is being used. */ - vParTestSetLED( mainDEEP_SLEEP_LED, pdFALSE ); - vParTestSetLED( mainFULL_POWER_LED, pdTRUE ); + /* Turn off the LED that indicates deep sleep mode, and turn on the LED + * that indicates full power is being used. */ + vParTestSetLED( mainDEEP_SLEEP_LED, pdFALSE ); + vParTestSetLED( mainFULL_POWER_LED, pdTRUE ); } /*-----------------------------------------------------------*/ static unsigned short prvReadPOT( void ) { -unsigned short usADCValue; -const unsigned short usMinADCValue = 128; - - /* Start an ADC scan. */ - S12AD.ADCSR.BIT.ADST = 1; - while( S12AD.ADCSR.BIT.ADST == 1 ) - { - /* Just waiting for the ADC scan to complete. Inefficient - polling! */ - } - - usADCValue = S12AD.ADDR4; - - /* Don't let the ADC value get too small as the LED behaviour will look - erratic. */ - if( usADCValue < usMinADCValue ) - { - usADCValue = usMinADCValue; - } - - return usADCValue; + unsigned short usADCValue; + const unsigned short usMinADCValue = 128; + + /* Start an ADC scan. */ + S12AD.ADCSR.BIT.ADST = 1; + + while( S12AD.ADCSR.BIT.ADST == 1 ) + { + /* Just waiting for the ADC scan to complete. Inefficient + * polling! */ + } + + usADCValue = S12AD.ADDR4; + + /* Don't let the ADC value get too small as the LED behaviour will look + * erratic. */ + if( usADCValue < usMinADCValue ) + { + usADCValue = usMinADCValue; + } + + return usADCValue; } /*-----------------------------------------------------------*/ #pragma vector = VECT_ICU_IRQ0, VECT_ICU_IRQ1, VECT_ICU_IRQ4 __interrupt void vButtonInterrupt1( void ) { -long lHigherPriorityTaskWoken = pdFALSE; - - /* The semaphore is only created when the build is configured to create the - low power demo. */ - if( xSemaphore != NULL ) - { - /* This interrupt will bring the CPU out of deep sleep and software - standby modes. Give the semaphore that was used to place the Tx task - into an indefinite sleep. */ - if( uxQueueMessagesWaitingFromISR( xSemaphore ) == 0 ) - { - xSemaphoreGiveFromISR( xSemaphore, &lHigherPriorityTaskWoken ); - } - else - { - /* The semaphore was already available, so the task is not blocked - on it and there is no point giving it. */ - } - - /* If giving the semaphore caused a task to leave the Blocked state, - and the task that left the Blocked state has a priority equal to or - above the priority of the task that this interrupt interrupted, then - lHigherPriorityTaskWoken will have been set to pdTRUE inside the call - to xSemaphoreGiveFromISR(), and calling portYIELD_FROM_ISR() will cause - a context switch to the unblocked task. */ - portYIELD_FROM_ISR( lHigherPriorityTaskWoken ); - } + long lHigherPriorityTaskWoken = pdFALSE; + + /* The semaphore is only created when the build is configured to create the + * low power demo. */ + if( xSemaphore != NULL ) + { + /* This interrupt will bring the CPU out of deep sleep and software + * standby modes. Give the semaphore that was used to place the Tx task + * into an indefinite sleep. */ + if( uxQueueMessagesWaitingFromISR( xSemaphore ) == 0 ) + { + xSemaphoreGiveFromISR( xSemaphore, &lHigherPriorityTaskWoken ); + } + else + { + /* The semaphore was already available, so the task is not blocked + * on it and there is no point giving it. */ + } + + /* If giving the semaphore caused a task to leave the Blocked state, + * and the task that left the Blocked state has a priority equal to or + * above the priority of the task that this interrupt interrupted, then + * lHigherPriorityTaskWoken will have been set to pdTRUE inside the call + * to xSemaphoreGiveFromISR(), and calling portYIELD_FROM_ISR() will cause + * a context switch to the unblocked task. */ + portYIELD_FROM_ISR( lHigherPriorityTaskWoken ); + } } - diff --git a/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/FreeRTOSConfig.h b/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/FreeRTOSConfig.h index 69310f5f5a0..5be83a217d6 100644 --- a/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/ParTest.c b/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/ParTest.c index 72ae59ef0f3..f3cc76a3a7c 100644 --- a/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/ParTest.c +++ b/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/main.c b/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/main.c index 767c58ca430..480e7437c2f 100644 --- a/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/main.c +++ b/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/main_full.c b/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/main_full.c index 9b306c6fce4..11a0fccc40d 100644 --- a/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/main_full.c +++ b/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/main_low_power.c b/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/main_low_power.c index 1f0e1817f25..2288f7812d3 100644 --- a/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/main_low_power.c +++ b/FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/main_low_power.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Blinky_Demo/main_blinky.c index c390230c615..49d10398a70 100644 --- a/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/FreeRTOSConfig.h b/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/FreeRTOSConfig.h index 1e7a9912a17..29f838e8557 100644 --- a/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.c index 595bd9bd310..cadb773adc9 100644 --- a/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.h index 76d462f796c..8f1a766766e 100644 --- a/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Full_Demo/main_full.c b/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Full_Demo/main_full.c index 2a5b8a0f1d8..100845c8c2a 100644 --- a/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/PriorityDefinitions.h b/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/PriorityDefinitions.h index 619752578e0..8c5f632e6ec 100644 --- a/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/PriorityDefinitions.h +++ b/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/PriorityDefinitions.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/main.c b/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/main.c index 27c1f24c594..83a24c3d7a0 100644 --- a/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/main.c +++ b/FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/Blinky_Demo/main_blinky.c index c390230c615..49d10398a70 100644 --- a/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/FreeRTOSConfig.h b/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/FreeRTOSConfig.h index 8867fd1ee09..a16d5eb6d61 100644 --- a/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.c index e67c978b0eb..9d6109da5ea 100644 --- a/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.h index 4fb214c4093..dc540323649 100644 --- a/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/Full_Demo/main_full.c b/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/Full_Demo/main_full.c index 02642be01c1..090105bc740 100644 --- a/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/main.c b/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/main.c index 41eb478b5d8..a46ebac462f 100644 --- a/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/main.c +++ b/FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/ButtonAndLCD.c b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/ButtonAndLCD.c index 2f0f7fd2b69..f0969de0aca 100644 --- a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/ButtonAndLCD.c +++ b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/ButtonAndLCD.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/FreeRTOSConfig.h b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/FreeRTOSConfig.h index 8ef845cd994..3866f2f7818 100644 --- a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/HighFrequencyTimerTest.c b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/HighFrequencyTimerTest.c index 88daf86ab01..5a5f62d994e 100644 --- a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/HighFrequencyTimerTest.c +++ b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/HighFrequencyTimerTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/IntQueueTimer.c b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/IntQueueTimer.c index ce1fe905986..e707bd2e922 100644 --- a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/IntQueueTimer.c +++ b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/ParTest.c b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/ParTest.c index 0b84dd9a665..a23e025050a 100644 --- a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/ParTest.c +++ b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/include/ButtonAndLCD.h b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/include/ButtonAndLCD.h index 42ab28a71ba..590a6ba9b5b 100644 --- a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/include/ButtonAndLCD.h +++ b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/include/ButtonAndLCD.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/include/IntQueueTimer.h b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/include/IntQueueTimer.h index 4fb214c4093..dc540323649 100644 --- a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/include/IntQueueTimer.h +++ b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/include/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/main-blinky.c b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/main-blinky.c index 98f79a42131..9055885dc61 100644 --- a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/main-blinky.c +++ b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/main-blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/main-full.c b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/main-full.c index 9d2815a2710..251973c126a 100644 --- a/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/main-full.c +++ b/FreeRTOS/Demo/RX200_RX210-RSK_Renesas/RTOSDemo/main-full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Blinky_Demo/main_blinky.c index 877d603cb3e..369f741e392 100644 --- a/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/FreeRTOSConfig.h b/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/FreeRTOSConfig.h index 50205726a49..3b5fab85c4f 100644 --- a/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.c index b40a5fa8d1d..9e588307063 100644 --- a/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.h index 76d462f796c..8f1a766766e 100644 --- a/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Full_Demo/main_full.c b/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Full_Demo/main_full.c index c53fd1f8cba..62df37472d2 100644 --- a/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/PriorityDefinitions.h b/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/PriorityDefinitions.h index 619752578e0..8c5f632e6ec 100644 --- a/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/PriorityDefinitions.h +++ b/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/PriorityDefinitions.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/main.c b/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/main.c index fee383e0de5..2259baeb95b 100644 --- a/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/main.c +++ b/FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/Blinky_Demo/main_blinky.c index 877d603cb3e..369f741e392 100644 --- a/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/FreeRTOSConfig.h b/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/FreeRTOSConfig.h index 313fdfd1f58..621eec69c51 100644 --- a/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.c index 1d278f25dc3..5a9d946b882 100644 --- a/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.h index 76d462f796c..8f1a766766e 100644 --- a/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/Full_Demo/main_full.c b/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/Full_Demo/main_full.c index f930a61374d..71b62394c24 100644 --- a/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/main.c b/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/main.c index 69e2b747667..3da55b28dad 100644 --- a/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/main.c +++ b/FreeRTOS/Demo/RX200_RX231-RSK_Renesas_e2studio/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/FreeRTOSConfig.h b/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/FreeRTOSConfig.h index 0d46a75b0b7..9e3dcdb27af 100644 --- a/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/HighFrequencyTimerTest.c b/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/HighFrequencyTimerTest.c index 88daf86ab01..5a5f62d994e 100644 --- a/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/HighFrequencyTimerTest.c +++ b/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/HighFrequencyTimerTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/IntQueueTimer.c b/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/IntQueueTimer.c index ce1fe905986..e707bd2e922 100644 --- a/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/IntQueueTimer.c +++ b/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/ParTest.c b/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/ParTest.c index 0b84dd9a665..a23e025050a 100644 --- a/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/ParTest.c +++ b/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/include/IntQueueTimer.h b/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/include/IntQueueTimer.h index 4fb214c4093..dc540323649 100644 --- a/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/include/IntQueueTimer.h +++ b/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/include/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/main-blinky.c b/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/main-blinky.c index 8f3e30b3b41..b3bab791c0c 100644 --- a/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/main-blinky.c +++ b/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/main-blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/main-full.c b/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/main-full.c index c10a5b9a8cc..e67cb76119e 100644 --- a/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/main-full.c +++ b/FreeRTOS/Demo/RX600_RX630-RSK_Renesas/RTOSDemo/main-full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/FreeRTOSConfig.h b/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/FreeRTOSConfig.h index 1c71cb65358..71bfabd8ed8 100644 --- a/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/IntQueueTimer.c b/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/IntQueueTimer.c index ce35edd3bfb..9818b398fbc 100644 --- a/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/IntQueueTimer.c +++ b/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/IntQueueTimer.h b/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/IntQueueTimer.h index 4fb214c4093..dc540323649 100644 --- a/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/IntQueueTimer.h +++ b/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/ParTest.c b/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/ParTest.c index 2835d56ca58..3b9110d6ad9 100644 --- a/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/ParTest.c +++ b/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/main.c b/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/main.c index 22067bb8d3b..91d6e452133 100644 --- a/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/main.c +++ b/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/main_blinky.c b/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/main_blinky.c index 77e56bd8ed2..662587aba38 100644 --- a/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/main_blinky.c +++ b/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/main_full.c b/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/main_full.c index 7b949a15a8b..09189f93c9d 100644 --- a/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/main_full.c +++ b/FreeRTOS/Demo/RX600_RX64M_RSK_GCC_e2studio/src/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/FreeRTOSConfig.h b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/FreeRTOSConfig.h index 1c71cb65358..71bfabd8ed8 100644 --- a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/IntQueueTimer.c b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/IntQueueTimer.c index 103197cdcb5..96c1b9b3e40 100644 --- a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/IntQueueTimer.c +++ b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/IntQueueTimer.h b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/IntQueueTimer.h index 4fb214c4093..dc540323649 100644 --- a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/IntQueueTimer.h +++ b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/ParTest.c b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/ParTest.c index c1f6b2db94a..ea36c0dbd21 100644 --- a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/ParTest.c +++ b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main.c b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main.c index d548f4d32b8..c24e4a992d3 100644 --- a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main.c +++ b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main_blinky.c b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main_blinky.c index 77e56bd8ed2..662587aba38 100644 --- a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main_blinky.c +++ b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main_full.c b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main_full.c index 00bd999961a..8509ec078ab 100644 --- a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main_full.c +++ b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/Blinky_Demo/main_blinky.c index 6af776b2262..26d6a89ff47 100644 --- a/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/FreeRTOSConfig.h b/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/FreeRTOSConfig.h index e122b0dcfa4..4563da077b8 100644 --- a/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.c index 8726b6e021f..f01179528ba 100644 --- a/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.h index 76d462f796c..8f1a766766e 100644 --- a/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/Full_Demo/main_full.c b/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/Full_Demo/main_full.c index 25450e1de9f..d6009220e5d 100644 --- a/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/PriorityDefinitions.h b/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/PriorityDefinitions.h index 619752578e0..8c5f632e6ec 100644 --- a/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/PriorityDefinitions.h +++ b/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/PriorityDefinitions.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/main.c b/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/main.c index f87ddeae061..4580fbd9d75 100644 --- a/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/main.c +++ b/FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/Blinky_Demo/main_blinky.c index 6af776b2262..26d6a89ff47 100644 --- a/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/FreeRTOSConfig.h b/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/FreeRTOSConfig.h index 3759cf111b6..456e710045c 100644 --- a/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.c index d43f9f1b8e0..dc28b74e6c7 100644 --- a/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.h index 76d462f796c..8f1a766766e 100644 --- a/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/Full_Demo/main_full.c b/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/Full_Demo/main_full.c index 4b4af75e8da..645d2c058ec 100644 --- a/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/main.c b/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/main.c index ea8d075ed81..34eb54e5125 100644 --- a/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/main.c +++ b/FreeRTOS/Demo/RX700_RX71M_RSK_Renesas_e2studio/src/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Blinky_Demo/main_blinky.c index 1a2a4dd5c36..7dccf30842e 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.c index 65243e53af4..e945e1858f0 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.h index a3fe268cf8d..3b9f6729476 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Full_Demo/main_full.c b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Full_Demo/main_full.c index 64fbed10bc1..08cd9f6e491 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Full_Demo/serial.c b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Full_Demo/serial.c index a2468dbc7d6..e1002e695eb 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Full_Demo/serial.c +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/Full_Demo/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/demo_specific_io.h b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/demo_specific_io.h index 8b44fb16de4..5ff63166ca6 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/demo_specific_io.h +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/FreeRTOS_Demo/demo_specific_io.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/frtos_config/FreeRTOSConfig.h b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/frtos_config/FreeRTOSConfig.h index 91cbfd6e0fa..b39827e5ef5 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/frtos_config/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_GCC_e2studio/src/frtos_config/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Blinky_Demo/main_blinky.c index 1a2a4dd5c36..7dccf30842e 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.c index 65243e53af4..e945e1858f0 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.h index a3fe268cf8d..3b9f6729476 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Full_Demo/main_full.c b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Full_Demo/main_full.c index 64fbed10bc1..08cd9f6e491 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Full_Demo/serial.c b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Full_Demo/serial.c index a2468dbc7d6..e1002e695eb 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Full_Demo/serial.c +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/Full_Demo/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/demo_specific_io.h b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/demo_specific_io.h index 8b44fb16de4..5ff63166ca6 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/demo_specific_io.h +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/FreeRTOS_Demo/demo_specific_io.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/frtos_config/FreeRTOSConfig.h b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/frtos_config/FreeRTOSConfig.h index 91cbfd6e0fa..b39827e5ef5 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/frtos_config/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_IAR_e2studio_EWRX/src/frtos_config/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Blinky_Demo/main_blinky.c b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Blinky_Demo/main_blinky.c index 1a2a4dd5c36..7dccf30842e 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Blinky_Demo/main_blinky.c +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Blinky_Demo/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.c b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.c index 65243e53af4..e945e1858f0 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.c +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.h b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.h index a3fe268cf8d..3b9f6729476 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.h +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Full_Demo/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Full_Demo/main_full.c b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Full_Demo/main_full.c index 64fbed10bc1..08cd9f6e491 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Full_Demo/main_full.c +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Full_Demo/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Full_Demo/serial.c b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Full_Demo/serial.c index a2468dbc7d6..e1002e695eb 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Full_Demo/serial.c +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/Full_Demo/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/demo_specific_io.h b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/demo_specific_io.h index 8b44fb16de4..5ff63166ca6 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/demo_specific_io.h +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/FreeRTOS_Demo/demo_specific_io.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/frtos_config/FreeRTOSConfig.h b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/frtos_config/FreeRTOSConfig.h index 91cbfd6e0fa..b39827e5ef5 100644 --- a/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/frtos_config/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RX700_RX72N_EnvisionKit_Renesas_e2studio_CS+/src/frtos_config/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/interrupt_handler_task.c b/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/interrupt_handler_task.c index a80ae326d8e..bfe747b6618 100644 --- a/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/interrupt_handler_task.c +++ b/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/interrupt_handler_task.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/interrupt_handler_task.h b/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/interrupt_handler_task.h index 25498a05309..7698485c6b6 100644 --- a/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/interrupt_handler_task.h +++ b/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/interrupt_handler_task.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/led_demo.c b/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/led_demo.c index 2a8dcebfb20..f9f15cc00a7 100644 --- a/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/led_demo.c +++ b/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/led_demo.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/led_demo.h b/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/led_demo.h index ed6ccb8922a..a2a59de3c19 100644 --- a/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/led_demo.h +++ b/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/led_demo.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/main.c b/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/main.c index 7b34a7d615b..da3e0977ba7 100644 --- a/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/main.c +++ b/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/uart_demo.c b/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/uart_demo.c index 283b7356161..0d2d6060ead 100644 --- a/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/uart_demo.c +++ b/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/uart_demo.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/uart_demo.h b/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/uart_demo.h index c930083c3d8..de6d6592c99 100644 --- a/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/uart_demo.h +++ b/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Application/uart_demo.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Config/FreeRTOSConfig.h b/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Config/FreeRTOSConfig.h index 1b936bf92c2..0e29284bd8c 100644 --- a/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Config/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/Safer_Interrupts_M33F_NXP_LPC55S69_MCUXpresso/Config/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/T-HEAD_CB2201_CDK/FreeRTOSConfig.h b/FreeRTOS/Demo/T-HEAD_CB2201_CDK/FreeRTOSConfig.h index 270e4daf0fd..438ba43739b 100644 --- a/FreeRTOS/Demo/T-HEAD_CB2201_CDK/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/T-HEAD_CB2201_CDK/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/FreeRTOSConfig.h b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/FreeRTOSConfig.h index c2b48f97f81..14b24ffed38 100644 --- a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/IntQueueTimer.c b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/IntQueueTimer.c index d48742f3e53..1bd16f6f56f 100644 --- a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/IntQueueTimer.c +++ b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/IntQueueTimer.h b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/IntQueueTimer.h index 2fdd6b75ded..687792e19ba 100644 --- a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/IntQueueTimer.h +++ b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/main.c b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/main.c index 4465540f238..91f400301bc 100644 --- a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/main.c +++ b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -61,7 +61,7 @@ * and demo application will be built. The comprehensive test and demo application * is implemented and described in main_full.c. */ -#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 +#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 /*-----------------------------------------------------------*/ /** @@ -85,7 +85,8 @@ extern void main_full( void ); * @see http://www.freertos.org/a00016.html */ void vApplicationMallocFailedHook( void ); -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ); +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ); void vApplicationTickHook( void ); /** @@ -100,90 +101,92 @@ void vFullDemoTickHookFunction( void ); int main( void ) { - /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top - * of this file. */ - #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - { - main_blinky(); - } - #else - { - main_full(); - } - #endif - - return 0; + /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top + * of this file. */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) + { + main_blinky(); + } + #else + { + main_full(); + } + #endif + + return 0; } /*-----------------------------------------------------------*/ void vApplicationMallocFailedHook( void ) { - /* vApplicationMallocFailedHook() will only be called if - * 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. - * 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, heap_2.c or heap_4.c is being 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 to query the size of free heap space that remains - * (although it does not provide information on how the remaining heap might be - * fragmented). See http://www.freertos.org/a00111.html for more information. - */ - vAssertCalled( __LINE__, __FILE__ ); + /* vApplicationMallocFailedHook() will only be called if + * 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. + * 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, heap_2.c or heap_4.c is being 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 to query the size of free heap space that remains + * (although it does not provide information on how the remaining heap might be + * fragmented). See http://www.freertos.org/a00111.html for more information. + */ + vAssertCalled( __LINE__, __FILE__ ); } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, + char * pcTaskName ) { - ( void ) pcTaskName; - ( void ) pxTask; + ( void ) pcTaskName; + ( void ) pxTask; - /* 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. */ - vAssertCalled( __LINE__, __FILE__ ); + /* 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. */ + vAssertCalled( __LINE__, __FILE__ ); } /*-----------------------------------------------------------*/ void vApplicationTickHook( void ) { - /* This function will be called by each tick interrupt if - * configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - * added here, but the tick hook is called from an interrupt context, so - * code must not attempt to block, and only the interrupt safe FreeRTOS API - * functions can be used (those that end in FromISR()). */ - #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) - { - vFullDemoTickHookFunction(); - } - #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */ + /* This function will be called by each tick interrupt if + * configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + * added here, but the tick hook is called from an interrupt context, so + * code must not attempt to block, and only the interrupt safe FreeRTOS API + * functions can be used (those that end in FromISR()). */ + #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) + { + vFullDemoTickHookFunction(); + } + #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */ } /*-----------------------------------------------------------*/ -void vAssertCalled( unsigned long ulLine, const char * const pcFileName ) +void vAssertCalled( unsigned long ulLine, + const char * const pcFileName ) { -static BaseType_t xPrinted = pdFALSE; -volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0; - - /* Called if an assertion passed to configASSERT() fails. See - * https://www.FreeRTOS.org/a00110.html#configASSERT for more information. */ - - /* Parameters are not used. */ - ( void ) ulLine; - ( void ) pcFileName; - - taskENTER_CRITICAL(); - { - /* You can step out of this function to debug the assertion by using - * the debugger to set ulSetToNonZeroInDebuggerToContinue to a non-zero - * value. */ - while( ulSetToNonZeroInDebuggerToContinue == 0 ) - { - __asm volatile( "NOP" ); - __asm volatile( "NOP" ); - } - } - taskEXIT_CRITICAL(); + static BaseType_t xPrinted = pdFALSE; + volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0; + + /* Called if an assertion passed to configASSERT() fails. See + * https://www.FreeRTOS.org/a00110.html#configASSERT for more information. */ + + /* Parameters are not used. */ + ( void ) ulLine; + ( void ) pcFileName; + + taskENTER_CRITICAL(); + { + /* You can step out of this function to debug the assertion by using + * the debugger to set ulSetToNonZeroInDebuggerToContinue to a non-zero + * value. */ + while( ulSetToNonZeroInDebuggerToContinue == 0 ) + { + __asm volatile ( "NOP" ); + __asm volatile ( "NOP" ); + } + } + taskEXIT_CRITICAL(); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/main_blinky.c b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/main_blinky.c index 3b99e3df3eb..a4d932919a3 100644 --- a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/main_blinky.c +++ b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -71,34 +71,34 @@ /** * Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /** * The rate at which data is sent to the queue. The times are converted from * milliseconds to ticks using the pdMS_TO_TICKS() macro. */ -#define mainTASK_SEND_FREQUENCY_MS pdMS_TO_TICKS( 200UL ) -#define mainTIMER_SEND_FREQUENCY_MS pdMS_TO_TICKS( 2000UL ) +#define mainTASK_SEND_FREQUENCY_MS pdMS_TO_TICKS( 200UL ) +#define mainTIMER_SEND_FREQUENCY_MS pdMS_TO_TICKS( 2000UL ) /** * The number of items the queue can hold at once. */ -#define mainQUEUE_LENGTH ( 2 ) +#define mainQUEUE_LENGTH ( 2 ) /** * The values sent to the queue receive task from the queue send task and the * queue send software timer respectively. */ -#define mainVALUE_SENT_FROM_TASK ( 100UL ) -#define mainVALUE_SENT_FROM_TIMER ( 200UL ) +#define mainVALUE_SENT_FROM_TASK ( 100UL ) +#define mainVALUE_SENT_FROM_TIMER ( 200UL ) /*-----------------------------------------------------------*/ /** * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /** * The callback function executed when the software timer expires. @@ -119,129 +119,131 @@ static TimerHandle_t xTimer = NULL; void main_blinky( void ) { -const TickType_t xTimerPeriod = mainTIMER_SEND_FREQUENCY_MS; - - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); - - if( xQueue != NULL ) - { - /* Start the two tasks as described in the comments at the top of this - * file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - NULL, /* The parameter passed to the task - not used in this simple case. */ - mainQUEUE_RECEIVE_TASK_PRIORITY,/* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ - - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Create the software timer, but don't start it yet. */ - xTimer = xTimerCreate( "Timer", /* The text name assigned to the software timer - for debug only as it is not used by the kernel. */ - xTimerPeriod, /* The period of the software timer in ticks. */ - pdTRUE, /* xAutoReload is set to pdTRUE. */ - NULL, /* The timer's ID is not used. */ - prvQueueSendTimerCallback );/* The function executed when the timer expires. */ - - if( xTimer != NULL ) - { - xTimerStart( xTimer, 0 ); - } - - /* Start the tasks and timer running. */ - 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 insufficient FreeRTOS heap memory available for the idle and/or - * timer tasks to be created. See the memory management section on the - * FreeRTOS web site for more details. */ - for( ;; ); + const TickType_t xTimerPeriod = mainTIMER_SEND_FREQUENCY_MS; + + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); + + if( xQueue != NULL ) + { + /* Start the two tasks as described in the comments at the top of this + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + NULL, /* The parameter passed to the task - not used in this simple case. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ + + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Create the software timer, but don't start it yet. */ + xTimer = xTimerCreate( "Timer", /* The text name assigned to the software timer - for debug only as it is not used by the kernel. */ + xTimerPeriod, /* The period of the software timer in ticks. */ + pdTRUE, /* xAutoReload is set to pdTRUE. */ + NULL, /* The timer's ID is not used. */ + prvQueueSendTimerCallback ); /* The function executed when the timer expires. */ + + if( xTimer != NULL ) + { + xTimerStart( xTimer, 0 ); + } + + /* Start the tasks and timer running. */ + 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 insufficient FreeRTOS heap memory available for the idle and/or + * timer tasks to be created. See the memory management section on the + * FreeRTOS web site for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const TickType_t xBlockTime = mainTASK_SEND_FREQUENCY_MS; -const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TASK; - - /* Prevent the compiler warning about the unused parameter. */ - ( void ) pvParameters; - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - * The block time is specified in ticks, pdMS_TO_TICKS() was used to - * convert a time specified in milliseconds into a time specified in ticks. - * While in the Blocked state this task will not consume any CPU time. */ - vTaskDelayUntil( &xNextWakeTime, xBlockTime ); - - /* Send to the queue - causing the queue receive task to unblock and - * write to the console. 0 is used as the block time so the send operation - * will not block - it shouldn't need to block as the queue should always - * have at least one space at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } + TickType_t xNextWakeTime; + const TickType_t xBlockTime = mainTASK_SEND_FREQUENCY_MS; + const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TASK; + + /* Prevent the compiler warning about the unused parameter. */ + ( void ) pvParameters; + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, pdMS_TO_TICKS() was used to + * convert a time specified in milliseconds into a time specified in ticks. + * While in the Blocked state this task will not consume any CPU time. */ + vTaskDelayUntil( &xNextWakeTime, xBlockTime ); + + /* Send to the queue - causing the queue receive task to unblock and + * write to the console. 0 is used as the block time so the send operation + * will not block - it shouldn't need to block as the queue should always + * have at least one space at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } } /*-----------------------------------------------------------*/ static void prvQueueSendTimerCallback( TimerHandle_t xTimerHandle ) { -const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TIMER; + const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TIMER; - /* This is the software timer callback function. The software timer has a - * period of two seconds and is reset each time a key is pressed. This - * callback function will execute if the timer expires, which will only happen - * if a key is not pressed for two seconds. */ + /* This is the software timer callback function. The software timer has a + * period of two seconds and is reset each time a key is pressed. This + * callback function will execute if the timer expires, which will only happen + * if a key is not pressed for two seconds. */ - /* Avoid compiler warnings resulting from the unused parameter. */ - ( void ) xTimerHandle; + /* Avoid compiler warnings resulting from the unused parameter. */ + ( void ) xTimerHandle; - /* Send to the queue - causing the queue receive task to unblock and - * write out a message. This function is called from the timer/daemon task, - * so must not block. Hence the block time is set to 0. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); + /* Send to the queue - causing the queue receive task to unblock and + * write out a message. This function is called from the timer/daemon task, + * so must not block. Hence the block time is set to 0. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -uint32_t ulReceivedValue; - - /* Prevent the compiler warning about the unused parameter. */ - ( void ) pvParameters; - - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - * FreeRTOSConfig.h. It will not use any CPU time while it is in the - * Blocked state. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); - - /* To get here something must have been received from the queue, but - * is it an expected value? This is the only task that uses stdout so its - * ok to call printf() directly. Do not call printf from any other task. */ - if( ulReceivedValue == mainVALUE_SENT_FROM_TASK ) - { - printf( "Message received from task\r\n" ); - } - else if( ulReceivedValue == mainVALUE_SENT_FROM_TIMER ) - { - printf( "Message received from software timer\r\n" ); - } - else - { - printf( "Unexpected message\r\n" ); - } - - fflush( stdout ); - } + uint32_t ulReceivedValue; + + /* Prevent the compiler warning about the unused parameter. */ + ( void ) pvParameters; + + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. It will not use any CPU time while it is in the + * Blocked state. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + + /* To get here something must have been received from the queue, but + * is it an expected value? This is the only task that uses stdout so its + * ok to call printf() directly. Do not call printf from any other task. */ + if( ulReceivedValue == mainVALUE_SENT_FROM_TASK ) + { + printf( "Message received from task\r\n" ); + } + else if( ulReceivedValue == mainVALUE_SENT_FROM_TIMER ) + { + printf( "Message received from software timer\r\n" ); + } + else + { + printf( "Unexpected message\r\n" ); + } + + fflush( stdout ); + } } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/main_full.c b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/main_full.c index 2e99c090b83..f2cf3d3738b 100644 --- a/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/main_full.c +++ b/FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/main_full.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -95,28 +95,28 @@ /** * Priorities at which the tasks are created. */ -#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainQUEUE_OVERWRITE_PRIORITY ( tskIDLE_PRIORITY ) +#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainQUEUE_OVERWRITE_PRIORITY ( tskIDLE_PRIORITY ) /** * Period used in timer tests. */ -#define mainTIMER_TEST_PERIOD ( 50 ) +#define mainTIMER_TEST_PERIOD ( 50 ) /** * 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 ) +#define mainREG_TEST_TASK_1_PARAMETER ( ( void * ) 0x12345678 ) +#define mainREG_TEST_TASK_2_PARAMETER ( ( void * ) 0x87654321 ) /** * Determines whether to enable interrupt queue tests. @@ -130,20 +130,20 @@ * * When mainENABLE_INT_QUEUE_TESTS is set to 0, interrupt queue tests are * disabled and every other test is enabled. */ -#define mainENABLE_INT_QUEUE_TESTS ( 0 ) +#define mainENABLE_INT_QUEUE_TESTS ( 0 ) /*-----------------------------------------------------------*/ /** * The task that periodically checks that all the standard demo tasks are * still executing and error free. */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); /** * Tasks that implement register tests. */ -static void prvRegTest1Task( void *pvParameters ); -static void prvRegTest2Task( void *pvParameters ); +static void prvRegTest1Task( void * pvParameters ); +static void prvRegTest2Task( void * pvParameters ); /** * Functions that implement register tests. @@ -157,7 +157,7 @@ extern void vRegTest2( void ); /** * The variable into which error messages are latched. */ -static char *pcStatusMessage = "No errors"; +static char * pcStatusMessage = "No errors"; /** * The following two variables are used to communicate the status of the @@ -178,304 +178,304 @@ volatile BaseType_t xTimerForQueueTestInitialized = pdFALSE; int main_full( void ) { - /* Start the check task as described at the top of this file. */ - xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - - #if( mainENABLE_INT_QUEUE_TESTS == 0 ) - { - /* Create the standard demo tasks. */ - vStartTaskNotifyTask(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY ); - vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); - - vStartQueuePeekTasks(); - vStartMathTasks( mainFLOP_TASK_PRIORITY ); - vStartRecursiveMutexTasks(); - vStartCountingSemaphoreTasks(); - vStartQueueSetTasks(); - - vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY ); - vStartEventGroupTasks(); - vStartInterruptSemaphoreTasks(); - vStartQueueSetPollingTask(); - vCreateBlockTimeTasks(); - - #if( configUSE_PREEMPTION != 0 ) - { - /* Don't expect these tasks to pass when preemption is not used. */ - vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); - } - #endif - - vCreateAbortDelayTasks(); - vStartMessageBufferTasks( configMINIMAL_STACK_SIZE ); - - vStartStreamBufferTasks(); - vStartStreamBufferInterruptDemo(); - - /* Create the register check tasks, as described at the top of this file */ - xTaskCreate( prvRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_1_PARAMETER, tskIDLE_PRIORITY, NULL ); - xTaskCreate( prvRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL ); - - /* The suicide tasks must be created last as they need to know how many - * tasks were running prior to their creation. This then allows them to - * ascertain whether or not the correct/expected number of tasks are - * running at any given time. */ - vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - } - #else /* mainENABLE_INT_QUEUE_TESTS */ - { - /* Start interrupt queue test tasks. */ - vStartInterruptQueueTasks(); - } - #endif /* mainENABLE_INT_QUEUE_TESTS */ - - /* Start the scheduler itself. */ - vTaskStartScheduler(); - - /* Should never get here unless there was not enough heap space to create - * the idle and other system tasks. */ - return 0; + /* Start the check task as described at the top of this file. */ + xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + + #if ( mainENABLE_INT_QUEUE_TESTS == 0 ) + { + /* Create the standard demo tasks. */ + vStartTaskNotifyTask(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY ); + vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); + + vStartQueuePeekTasks(); + vStartMathTasks( mainFLOP_TASK_PRIORITY ); + vStartRecursiveMutexTasks(); + vStartCountingSemaphoreTasks(); + vStartQueueSetTasks(); + + vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY ); + vStartEventGroupTasks(); + vStartInterruptSemaphoreTasks(); + vStartQueueSetPollingTask(); + vCreateBlockTimeTasks(); + + #if ( configUSE_PREEMPTION != 0 ) + { + /* Don't expect these tasks to pass when preemption is not used. */ + vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); + } + #endif + + vCreateAbortDelayTasks(); + vStartMessageBufferTasks( configMINIMAL_STACK_SIZE ); + + vStartStreamBufferTasks(); + vStartStreamBufferInterruptDemo(); + + /* Create the register check tasks, as described at the top of this file */ + xTaskCreate( prvRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_1_PARAMETER, tskIDLE_PRIORITY, NULL ); + xTaskCreate( prvRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL ); + + /* The suicide tasks must be created last as they need to know how many + * tasks were running prior to their creation. This then allows them to + * ascertain whether or not the correct/expected number of tasks are + * running at any given time. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + } + #else /* mainENABLE_INT_QUEUE_TESTS */ + { + /* Start interrupt queue test tasks. */ + vStartInterruptQueueTasks(); + } + #endif /* mainENABLE_INT_QUEUE_TESTS */ + + /* Start the scheduler itself. */ + vTaskStartScheduler(); + + /* Should never get here unless there was not enough heap space to create + * the idle and other system tasks. */ + return 0; } /*-----------------------------------------------------------*/ -static void prvCheckTask( void *pvParameters ) +static void prvCheckTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const TickType_t xCycleFrequency = pdMS_TO_TICKS( 5000UL ); -static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; - - /* Just to remove compiler warning. */ - ( void ) pvParameters; - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. */ - vTaskDelayUntil( &xNextWakeTime, xCycleFrequency ); - - #if( mainENABLE_INT_QUEUE_TESTS == 0 ) - { - /* Check the standard demo tasks are running without error. */ - #if( configUSE_PREEMPTION != 0 ) - { - /* These tasks are only created when preemption is used. */ - if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE ) - { - pcStatusMessage = "Error: TimerDemo"; - } - } - #endif - - if( xAreTaskNotificationTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: Notification"; - } - else if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: BlockQueue"; - } - else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: SemTest"; - } - else if( xArePollingQueuesStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: PollQueue"; - } - else if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: IntMath"; - } - else if( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: GenQueue"; - } - else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: QueuePeek"; - } - else if( xAreMathsTaskStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: Flop"; - } - else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: RecMutex"; - } - else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: CountSem"; - } - else if( xAreQueueSetTasksStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: Queue set"; - } - else if( xIsQueueOverwriteTaskStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: Queue overwrite"; - } - else if( xAreEventGroupTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: EventGroup"; - } - else if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: IntSem"; - } - else if( xAreQueueSetPollTasksStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: Queue set polling"; - } - else if( xAreBlockTimeTestTasksStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: Block time"; - } - else if( xAreAbortDelayTestTasksStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: Abort delay"; - } - else if( xAreMessageBufferTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: MessageBuffer"; - } - else if( xAreStreamBufferTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: StreamBuffer"; - } - else if( xIsInterruptStreamBufferDemoStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: Stream buffer interrupt"; - } - else if( xIsCreateTaskStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: Death"; - } - else if( ulLastRegTest1Value == ulRegTest1Counter ) - { - pcStatusMessage = "Error: Reg Test 1"; - } - else if( ulLastRegTest2Value == ulRegTest2Counter ) - { - pcStatusMessage = "Error: Reg Test 2"; - } - - /* Update register test counters. */ - ulLastRegTest1Value = ulRegTest1Counter; - ulLastRegTest2Value = ulRegTest2Counter; - } - #else /* mainENABLE_INT_QUEUE_TESTS */ - { - if( xAreIntQueueTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: IntQueue"; - } - } - #endif /* mainENABLE_INT_QUEUE_TESTS */ - - /* This is the only task that uses stdout so its ok to call printf() - * directly. Do not call printf from any other task. */ - printf( "%s - tick count %zu - free heap %zu - min free heap %zu\r\n", pcStatusMessage, - xTaskGetTickCount(), - xPortGetFreeHeapSize(), - xPortGetMinimumEverFreeHeapSize() ); - } + TickType_t xNextWakeTime; + const TickType_t xCycleFrequency = pdMS_TO_TICKS( 5000UL ); + static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; + + /* Just to remove compiler warning. */ + ( void ) pvParameters; + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. */ + vTaskDelayUntil( &xNextWakeTime, xCycleFrequency ); + + #if ( mainENABLE_INT_QUEUE_TESTS == 0 ) + { + /* Check the standard demo tasks are running without error. */ + #if ( configUSE_PREEMPTION != 0 ) + { + /* These tasks are only created when preemption is used. */ + if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE ) + { + pcStatusMessage = "Error: TimerDemo"; + } + } + #endif + + if( xAreTaskNotificationTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: Notification"; + } + else if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: BlockQueue"; + } + else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: SemTest"; + } + else if( xArePollingQueuesStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: PollQueue"; + } + else if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: IntMath"; + } + else if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: GenQueue"; + } + else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: QueuePeek"; + } + else if( xAreMathsTaskStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: Flop"; + } + else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: RecMutex"; + } + else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: CountSem"; + } + else if( xAreQueueSetTasksStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: Queue set"; + } + else if( xIsQueueOverwriteTaskStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: Queue overwrite"; + } + else if( xAreEventGroupTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: EventGroup"; + } + else if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: IntSem"; + } + else if( xAreQueueSetPollTasksStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: Queue set polling"; + } + else if( xAreBlockTimeTestTasksStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: Block time"; + } + else if( xAreAbortDelayTestTasksStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: Abort delay"; + } + else if( xAreMessageBufferTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: MessageBuffer"; + } + else if( xAreStreamBufferTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: StreamBuffer"; + } + else if( xIsInterruptStreamBufferDemoStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: Stream buffer interrupt"; + } + else if( xIsCreateTaskStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: Death"; + } + else if( ulLastRegTest1Value == ulRegTest1Counter ) + { + pcStatusMessage = "Error: Reg Test 1"; + } + else if( ulLastRegTest2Value == ulRegTest2Counter ) + { + pcStatusMessage = "Error: Reg Test 2"; + } + + /* Update register test counters. */ + ulLastRegTest1Value = ulRegTest1Counter; + ulLastRegTest2Value = ulRegTest2Counter; + } + #else /* mainENABLE_INT_QUEUE_TESTS */ + { + if( xAreIntQueueTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: IntQueue"; + } + } + #endif /* mainENABLE_INT_QUEUE_TESTS */ + + /* This is the only task that uses stdout so its ok to call printf() + * directly. Do not call printf from any other task. */ + printf( "%s - tick count %zu - free heap %zu - min free heap %zu\r\n", pcStatusMessage, + xTaskGetTickCount(), + xPortGetFreeHeapSize(), + xPortGetMinimumEverFreeHeapSize() ); + } } /*-----------------------------------------------------------*/ /* Called by vApplicationTickHook(), which is defined in main.c. */ void vFullDemoTickHookFunction( void ) { -TaskHandle_t xTimerTask; - - #if( mainENABLE_INT_QUEUE_TESTS == 0 ) - { - /* Exercise using task notifications from an interrupt. */ - xNotifyTaskFromISR(); - - /* Write to a queue that is in use as part of the queue set demo to - * demonstrate using queue sets from an ISR. */ - vQueueSetAccessQueueSetFromISR(); - - /* Call the periodic queue overwrite from ISR demo. */ - vQueueOverwritePeriodicISRDemo(); - - /* Exercise event groups from interrupts. */ - vPeriodicEventGroupsProcessing(); - - /* Exercise giving mutexes from an interrupt. */ - vInterruptSemaphorePeriodicTest(); - - /* Queue set access from interrupt. */ - vQueueSetPollingInterruptAccess(); - - /* Call the periodic timer test, which tests the timer API functions that - * can be called from an ISR. */ - #if( configUSE_PREEMPTION != 0 ) - { - /* Only created when preemption is used. */ - vTimerPeriodicISRTests(); - } - #endif - - /* Writes to stream buffer byte by byte to test the stream buffer trigger - * level functionality. */ - vPeriodicStreamBufferProcessing(); - - /* Writes a string to a string buffer four bytes at a time to demonstrate - * a stream being sent from an interrupt to a task. */ - vBasicStreamBufferSendFromISR(); - } - #else /* mainENABLE_INT_QUEUE_TESTS */ - { - /* Access queues from interrupt. Make sure to access after the queues have - * been created. */ - if( xTimerForQueueTestInitialized == pdTRUE ) - { - portYIELD_FROM_ISR( xFirstTimerHandler() ); - } - } - #endif /* mainENABLE_INT_QUEUE_TESTS */ + TaskHandle_t xTimerTask; + + #if ( mainENABLE_INT_QUEUE_TESTS == 0 ) + { + /* Exercise using task notifications from an interrupt. */ + xNotifyTaskFromISR(); + + /* Write to a queue that is in use as part of the queue set demo to + * demonstrate using queue sets from an ISR. */ + vQueueSetAccessQueueSetFromISR(); + + /* Call the periodic queue overwrite from ISR demo. */ + vQueueOverwritePeriodicISRDemo(); + + /* Exercise event groups from interrupts. */ + vPeriodicEventGroupsProcessing(); + + /* Exercise giving mutexes from an interrupt. */ + vInterruptSemaphorePeriodicTest(); + + /* Queue set access from interrupt. */ + vQueueSetPollingInterruptAccess(); + + /* Call the periodic timer test, which tests the timer API functions that + * can be called from an ISR. */ + #if ( configUSE_PREEMPTION != 0 ) + { + /* Only created when preemption is used. */ + vTimerPeriodicISRTests(); + } + #endif + + /* Writes to stream buffer byte by byte to test the stream buffer trigger + * level functionality. */ + vPeriodicStreamBufferProcessing(); + + /* Writes a string to a string buffer four bytes at a time to demonstrate + * a stream being sent from an interrupt to a task. */ + vBasicStreamBufferSendFromISR(); + } + #else /* mainENABLE_INT_QUEUE_TESTS */ + { + /* Access queues from interrupt. Make sure to access after the queues have + * been created. */ + if( xTimerForQueueTestInitialized == pdTRUE ) + { + portYIELD_FROM_ISR( xFirstTimerHandler() ); + } + } + #endif /* mainENABLE_INT_QUEUE_TESTS */ } /*-----------------------------------------------------------*/ -static void prvRegTest1Task( void *pvParameters ) +static void prvRegTest1Task( void * pvParameters ) { - /* Although the regtest task is written in assembly, 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 assembly. */ - vRegTest1(); - } - - /* 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 - * not being incremented and flag an error. */ - vTaskDelete( NULL ); + /* Although the regtest task is written in assembly, 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 assembly. */ + vRegTest1(); + } + + /* 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 + * not being incremented and flag an error. */ + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ -static void prvRegTest2Task( void *pvParameters ) +static void prvRegTest2Task( void * pvParameters ) { - /* Although the regtest task is written in assembly, 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 assembly. */ - vRegTest2(); - } - - /* 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 - * not being incremented and flag an error. */ - vTaskDelete( NULL ); + /* Although the regtest task is written in assembly, 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 assembly. */ + vRegTest2(); + } + + /* 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 + * not being incremented and flag an error. */ + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/ThirdParty/Template/IntQueueTimer.c b/FreeRTOS/Demo/ThirdParty/Template/IntQueueTimer.c index 8a19ba5423d..b156150ac79 100644 --- a/FreeRTOS/Demo/ThirdParty/Template/IntQueueTimer.c +++ b/FreeRTOS/Demo/ThirdParty/Template/IntQueueTimer.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ThirdParty/Template/IntQueueTimer.h b/FreeRTOS/Demo/ThirdParty/Template/IntQueueTimer.h index bb7f02d9f33..3e7c1b2aaf2 100644 --- a/FreeRTOS/Demo/ThirdParty/Template/IntQueueTimer.h +++ b/FreeRTOS/Demo/ThirdParty/Template/IntQueueTimer.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ThirdParty/Template/RegTests.c b/FreeRTOS/Demo/ThirdParty/Template/RegTests.c index fc9b935d07e..3201bbd2bc9 100644 --- a/FreeRTOS/Demo/ThirdParty/Template/RegTests.c +++ b/FreeRTOS/Demo/ThirdParty/Template/RegTests.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ThirdParty/Template/RegTests.h b/FreeRTOS/Demo/ThirdParty/Template/RegTests.h index 5b5dffe9785..260603083d9 100644 --- a/FreeRTOS/Demo/ThirdParty/Template/RegTests.h +++ b/FreeRTOS/Demo/ThirdParty/Template/RegTests.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ThirdParty/Template/TestRunner.c b/FreeRTOS/Demo/ThirdParty/Template/TestRunner.c index 3782087bf1c..e584cc1832a 100644 --- a/FreeRTOS/Demo/ThirdParty/Template/TestRunner.c +++ b/FreeRTOS/Demo/ThirdParty/Template/TestRunner.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/ThirdParty/Template/TestRunner.h b/FreeRTOS/Demo/ThirdParty/Template/TestRunner.h index 2a17f6ce510..150996dca3d 100644 --- a/FreeRTOS/Demo/ThirdParty/Template/TestRunner.h +++ b/FreeRTOS/Demo/ThirdParty/Template/TestRunner.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/FreeRTOSConfig.h b/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/FreeRTOSConfig.h index 79f21b34906..85b98d46108 100644 --- a/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/InterruptNestTest.c b/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/InterruptNestTest.c index 12b2a80d65a..71b836c4a89 100644 --- a/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/InterruptNestTest.c +++ b/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/InterruptNestTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/InterruptNestTest.h b/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/InterruptNestTest.h index 4b64fd60cd6..ff5c4261ea8 100644 --- a/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/InterruptNestTest.h +++ b/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/InterruptNestTest.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/ParTest.c b/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/ParTest.c index 519f07d58bd..efd945e4cec 100644 --- a/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/ParTest.c +++ b/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/main.c b/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/main.c index 22bf7b38562..1b5ff5b1397 100644 --- a/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/main.c +++ b/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/serial.c b/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/serial.c index 4343965c434..43140ce8d34 100644 --- a/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/serial.c +++ b/FreeRTOS/Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WIN32-MSVC-Static-Allocation-Only/main.c b/FreeRTOS/Demo/WIN32-MSVC-Static-Allocation-Only/main.c index 84d0d585762..a5a92fc26b5 100644 --- a/FreeRTOS/Demo/WIN32-MSVC-Static-Allocation-Only/main.c +++ b/FreeRTOS/Demo/WIN32-MSVC-Static-Allocation-Only/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WIN32-MSVC/main.c b/FreeRTOS/Demo/WIN32-MSVC/main.c index e1a9427bc77..639102a701e 100644 --- a/FreeRTOS/Demo/WIN32-MSVC/main.c +++ b/FreeRTOS/Demo/WIN32-MSVC/main.c @@ -224,15 +224,15 @@ int main( void ) /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top * of this file. */ #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - { - printf( "\nStarting the blinky demo.\r\n" ); - main_blinky(); - } + { + printf( "\nStarting the blinky demo.\r\n" ); + main_blinky(); + } #else - { - printf( "\nStarting the full demo.\r\n" ); - main_full(); - } + { + printf( "\nStarting the full demo.\r\n" ); + main_full(); + } #endif /* if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) */ return 0; @@ -270,11 +270,11 @@ void vApplicationIdleHook( void ) * allocated by the kernel to any task that has since deleted itself. */ #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) - { - /* Call the idle task processing used by the full demo. The simple - * blinky demo does not use the idle task hook. */ - vFullDemoIdleFunction(); - } + { + /* Call the idle task processing used by the full demo. The simple + * blinky demo does not use the idle task hook. */ + vFullDemoIdleFunction(); + } #endif } @@ -304,9 +304,9 @@ void vApplicationTickHook( void ) * functions can be used (those that end in FromISR()). */ #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) - { - vFullDemoTickHookFunction(); - } + { + vFullDemoTickHookFunction(); + } #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */ } /*-----------------------------------------------------------*/ @@ -482,6 +482,7 @@ static uint32_t prvKeyboardInterruptHandler( void ) break; case mainOUTPUT_TRACE_KEY: + /* Saving the trace file requires Windows system calls, so enter a critical * section to prevent deadlock or errors resulting from calling a Windows * system call from within the FreeRTOS simulator. */ diff --git a/FreeRTOS/Demo/WIN32-MSVC/main_blinky.c b/FreeRTOS/Demo/WIN32-MSVC/main_blinky.c index 63ce77a5bf7..cf02ed8ded3 100644 --- a/FreeRTOS/Demo/WIN32-MSVC/main_blinky.c +++ b/FreeRTOS/Demo/WIN32-MSVC/main_blinky.c @@ -92,33 +92,33 @@ #include "semphr.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The times are converted from -milliseconds to ticks using the pdMS_TO_TICKS() macro. */ -#define mainTASK_SEND_FREQUENCY_MS pdMS_TO_TICKS( 200UL ) -#define mainTIMER_SEND_FREQUENCY_MS pdMS_TO_TICKS( 2000UL ) + * milliseconds to ticks using the pdMS_TO_TICKS() macro. */ +#define mainTASK_SEND_FREQUENCY_MS pdMS_TO_TICKS( 200UL ) +#define mainTIMER_SEND_FREQUENCY_MS pdMS_TO_TICKS( 2000UL ) /* The number of items the queue can hold at once. */ -#define mainQUEUE_LENGTH ( 2 ) +#define mainQUEUE_LENGTH ( 2 ) /* The values sent to the queue receive task from the queue send task and the -queue send software timer respectively. */ -#define mainVALUE_SENT_FROM_TASK ( 100UL ) -#define mainVALUE_SENT_FROM_TIMER ( 200UL ) + * queue send software timer respectively. */ +#define mainVALUE_SENT_FROM_TASK ( 100UL ) +#define mainVALUE_SENT_FROM_TIMER ( 200UL ) /* This demo allows for users to perform actions with the keyboard. */ -#define mainNO_KEY_PRESS_VALUE ( -1 ) -#define mainRESET_TIMER_KEY ( 'r' ) +#define mainNO_KEY_PRESS_VALUE ( -1 ) +#define mainRESET_TIMER_KEY ( 'r' ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * The callback function executed when the software timer expires. @@ -138,138 +138,140 @@ static TimerHandle_t xTimer = NULL; /*** SEE THE COMMENTS AT THE TOP OF THIS FILE ***/ void main_blinky( void ) { -const TickType_t xTimerPeriod = mainTIMER_SEND_FREQUENCY_MS; + const TickType_t xTimerPeriod = mainTIMER_SEND_FREQUENCY_MS; printf( "\r\nStarting the blinky demo. Press \'%c\' to reset the software timer used in this demo.\r\n\r\n", mainRESET_TIMER_KEY ); - /* Create the queue. */ - xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); - - if( xQueue != NULL ) - { - /* Start the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - NULL, /* The parameter passed to the task - not used in this simple case. */ - mainQUEUE_RECEIVE_TASK_PRIORITY,/* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ - - xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); - - /* Create the software timer, but don't start it yet. */ - xTimer = xTimerCreate( "Timer", /* The text name assigned to the software timer - for debug only as it is not used by the kernel. */ - xTimerPeriod, /* The period of the software timer in ticks. */ - pdTRUE, /* xAutoReload is set to pdTRUE, so this timer goes off periodically with a period of xTimerPeriod ticks. */ - NULL, /* The timer's ID is not used. */ - prvQueueSendTimerCallback );/* The function executed when the timer expires. */ - - xTimerStart( xTimer, 0 ); /* The scheduler has not started so use a block time of 0. */ - - /* Start the tasks and timer running. */ - 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 insufficient FreeRTOS heap memory available for the idle and/or - timer tasks to be created. See the memory management section on the - FreeRTOS web site for more details. */ - for( ;; ); + /* Create the queue. */ + xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); + + if( xQueue != NULL ) + { + /* Start the two tasks as described in the comments at the top of this + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + NULL, /* The parameter passed to the task - not used in this simple case. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ + + xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); + + /* Create the software timer, but don't start it yet. */ + xTimer = xTimerCreate( "Timer", /* The text name assigned to the software timer - for debug only as it is not used by the kernel. */ + xTimerPeriod, /* The period of the software timer in ticks. */ + pdTRUE, /* xAutoReload is set to pdTRUE, so this timer goes off periodically with a period of xTimerPeriod ticks. */ + NULL, /* The timer's ID is not used. */ + prvQueueSendTimerCallback ); /* The function executed when the timer expires. */ + + xTimerStart( xTimer, 0 ); /* The scheduler has not started so use a block time of 0. */ + + /* Start the tasks and timer running. */ + 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 insufficient FreeRTOS heap memory available for the idle and/or + * timer tasks to be created. See the memory management section on the + * FreeRTOS web site for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const TickType_t xBlockTime = mainTASK_SEND_FREQUENCY_MS; -const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TASK; - - /* Prevent the compiler warning about the unused parameter. */ - ( void ) pvParameters; - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, pdMS_TO_TICKS() was used to - convert a time specified in milliseconds into a time specified in ticks. - While in the Blocked state this task will not consume any CPU time. */ - vTaskDelayUntil( &xNextWakeTime, xBlockTime ); - - /* Send to the queue - causing the queue receive task to unblock and - write to the console. 0 is used as the block time so the send operation - will not block - it shouldn't need to block as the queue should always - have at least one space at this point in the code. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); - } + TickType_t xNextWakeTime; + const TickType_t xBlockTime = mainTASK_SEND_FREQUENCY_MS; + const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TASK; + + /* Prevent the compiler warning about the unused parameter. */ + ( void ) pvParameters; + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. + * The block time is specified in ticks, pdMS_TO_TICKS() was used to + * convert a time specified in milliseconds into a time specified in ticks. + * While in the Blocked state this task will not consume any CPU time. */ + vTaskDelayUntil( &xNextWakeTime, xBlockTime ); + + /* Send to the queue - causing the queue receive task to unblock and + * write to the console. 0 is used as the block time so the send operation + * will not block - it shouldn't need to block as the queue should always + * have at least one space at this point in the code. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); + } } /*-----------------------------------------------------------*/ static void prvQueueSendTimerCallback( TimerHandle_t xTimerHandle ) { -const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TIMER; + const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TIMER; - /* This is the software timer callback function. The software timer has a - period of two seconds and is reset each time a key is pressed. This - callback function will execute if the timer expires, which will only happen - if a key is not pressed for two seconds. */ + /* This is the software timer callback function. The software timer has a + * period of two seconds and is reset each time a key is pressed. This + * callback function will execute if the timer expires, which will only happen + * if a key is not pressed for two seconds. */ - /* Avoid compiler warnings resulting from the unused parameter. */ - ( void ) xTimerHandle; + /* Avoid compiler warnings resulting from the unused parameter. */ + ( void ) xTimerHandle; - /* Send to the queue - causing the queue receive task to unblock and - write out a message. This function is called from the timer/daemon task, so - must not block. Hence the block time is set to 0. */ - xQueueSend( xQueue, &ulValueToSend, 0U ); + /* Send to the queue - causing the queue receive task to unblock and + * write out a message. This function is called from the timer/daemon task, so + * must not block. Hence the block time is set to 0. */ + xQueueSend( xQueue, &ulValueToSend, 0U ); } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -uint32_t ulReceivedValue; + uint32_t ulReceivedValue; - /* Prevent the compiler warning about the unused parameter. */ - ( void ) pvParameters; + /* Prevent the compiler warning about the unused parameter. */ + ( void ) pvParameters; - for( ;; ) - { - /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. It will not use any CPU time while it is in the - Blocked state. */ - xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); + for( ; ; ) + { + /* Wait until something arrives in the queue - this task will block + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. It will not use any CPU time while it is in the + * Blocked state. */ + xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); /* Enter critical section to use printf. Not doing this could potentially cause - a deadlock if the FreeRTOS simulator switches contexts and another task - tries to call printf - it should be noted that use of printf within - the FreeRTOS simulator is unsafe, but used here for simplicity. */ + * a deadlock if the FreeRTOS simulator switches contexts and another task + * tries to call printf - it should be noted that use of printf within + * the FreeRTOS simulator is unsafe, but used here for simplicity. */ taskENTER_CRITICAL(); { /* To get here something must have been received from the queue, but - is it an expected value? Normally calling printf() from a task is not - a good idea. Here there is lots of stack space and only one task is - using console IO so it is ok. However, note the comments at the top of - this file about the risks of making Windows system calls (such as - console output) from a FreeRTOS task. */ - if (ulReceivedValue == mainVALUE_SENT_FROM_TASK) + * is it an expected value? Normally calling printf() from a task is not + * a good idea. Here there is lots of stack space and only one task is + * using console IO so it is ok. However, note the comments at the top of + * this file about the risks of making Windows system calls (such as + * console output) from a FreeRTOS task. */ + if( ulReceivedValue == mainVALUE_SENT_FROM_TASK ) { - printf("Message received from task - idle time %llu%%\r\n", ulTaskGetIdleRunTimePercent()); + printf( "Message received from task - idle time %llu%%\r\n", ulTaskGetIdleRunTimePercent() ); } - else if (ulReceivedValue == mainVALUE_SENT_FROM_TIMER) + else if( ulReceivedValue == mainVALUE_SENT_FROM_TIMER ) { - printf("Message received from software timer\r\n"); + printf( "Message received from software timer\r\n" ); } else { - printf("Unexpected message\r\n"); + printf( "Unexpected message\r\n" ); } } taskEXIT_CRITICAL(); - } + } } /*-----------------------------------------------------------*/ @@ -277,29 +279,27 @@ uint32_t ulReceivedValue; void vBlinkyKeyboardInterruptHandler( int xKeyPressed ) { /* Handle keyboard input. */ - switch ( xKeyPressed ) + switch( xKeyPressed ) { - case mainRESET_TIMER_KEY: + case mainRESET_TIMER_KEY: - if ( xTimer != NULL ) - { - /* Critical section around printf to prevent a deadlock - on context switch. */ - taskENTER_CRITICAL(); + if( xTimer != NULL ) { - printf("\r\nResetting software timer.\r\n\r\n"); + /* Critical section around printf to prevent a deadlock + * on context switch. */ + taskENTER_CRITICAL(); + { + printf( "\r\nResetting software timer.\r\n\r\n" ); + } + taskEXIT_CRITICAL(); + + /* Reset the software timer. */ + xTimerReset( xTimer, portMAX_DELAY ); } - taskEXIT_CRITICAL(); - /* Reset the software timer. */ - xTimerReset( xTimer, portMAX_DELAY ); - } - - break; + break; - default: - break; + default: + break; } } - - diff --git a/FreeRTOS/Demo/WIN32-MSVC/main_full.c b/FreeRTOS/Demo/WIN32-MSVC/main_full.c index 6667a548751..090690b61bf 100644 --- a/FreeRTOS/Demo/WIN32-MSVC/main_full.c +++ b/FreeRTOS/Demo/WIN32-MSVC/main_full.c @@ -107,25 +107,25 @@ #include "MessageBufferAMP.h" /* Priorities at which the tasks are created. */ -#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainQUEUE_OVERWRITE_PRIORITY ( tskIDLE_PRIORITY ) - -#define mainTIMER_TEST_PERIOD ( 50 ) +#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainQUEUE_OVERWRITE_PRIORITY ( tskIDLE_PRIORITY ) + +#define mainTIMER_TEST_PERIOD ( 50 ) /* Task function prototypes. */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); /* A task that is created from the idle task to test the functionality of -eTaskStateGet(). */ -static void prvTestTask( void *pvParameters ); + * eTaskStateGet(). */ +static void prvTestTask( void * pvParameters ); /* * Called from the idle task hook function to demonstrate a few utility @@ -143,7 +143,8 @@ static void prvDemonstratePendingFunctionCall( void ); /* * The function that is pended by prvDemonstratePendingFunctionCall(). */ -static void prvPendedFunction( void *pvParameter1, uint32_t ulParameter2 ); +static void prvPendedFunction( void * pvParameter1, + uint32_t ulParameter2 ); /* * prvDemonstrateTimerQueryFunctions() is called from the idle task hook @@ -157,660 +158,662 @@ static void prvTestTimerCallback( TimerHandle_t xTimer ); /* * A task to demonstrate the use of the xQueueSpacesAvailable() function. */ -static void prvDemoQueueSpaceFunctions( void *pvParameters ); +static void prvDemoQueueSpaceFunctions( void * pvParameters ); /* * Tasks that ensure indefinite delays are truly indefinite. */ -static void prvPermanentlyBlockingSemaphoreTask( void *pvParameters ); -static void prvPermanentlyBlockingNotificationTask( void *pvParameters ); +static void prvPermanentlyBlockingSemaphoreTask( void * pvParameters ); +static void prvPermanentlyBlockingNotificationTask( void * pvParameters ); /*-----------------------------------------------------------*/ /* The variable into which error messages are latched. */ -static char *pcStatusMessage = "No errors"; +static char * pcStatusMessage = "No errors"; /* This semaphore is created purely to test using the vSemaphoreDelete() and -semaphore tracing API functions. It has no other purpose. */ + * semaphore tracing API functions. It has no other purpose. */ static SemaphoreHandle_t xMutexToDelete = NULL; /*-----------------------------------------------------------*/ int main_full( void ) { - /* Start the check task as described at the top of this file. */ - xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - - /* Create the standard demo tasks. */ - vStartTaskNotifyTask(); - vStartTaskNotifyArrayTask(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY ); - vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); - vStartQueuePeekTasks(); - vStartMathTasks( mainFLOP_TASK_PRIORITY ); - vStartRecursiveMutexTasks(); - vStartCountingSemaphoreTasks(); - vStartDynamicPriorityTasks(); - vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY ); - vStartEventGroupTasks(); - vStartInterruptSemaphoreTasks(); - vCreateBlockTimeTasks(); - vCreateAbortDelayTasks(); - xTaskCreate( prvDemoQueueSpaceFunctions, "QSpace", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - xTaskCreate( prvPermanentlyBlockingSemaphoreTask, "BlockSem", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - xTaskCreate( prvPermanentlyBlockingNotificationTask, "BlockNoti", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - - vStartMessageBufferTasks( configMINIMAL_STACK_SIZE ); - vStartStreamBufferTasks(); - vStartStreamBufferInterruptDemo(); - vStartMessageBufferAMPTasks( configMINIMAL_STACK_SIZE ); - - #if( configUSE_QUEUE_SETS == 1 ) - { - vStartQueueSetTasks(); - vStartQueueSetPollingTask(); - } - #endif - - #if( configSUPPORT_STATIC_ALLOCATION == 1 ) - { - vStartStaticallyAllocatedTasks(); - } - #endif - - #if( configUSE_PREEMPTION != 0 ) - { - /* Don't expect these tasks to pass when preemption is not used. */ - vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); - } - #endif - - /* The suicide tasks must be created last as they need to know how many - tasks were running prior to their creation. This then allows them to - ascertain whether or not the correct/expected number of tasks are running at - any given time. */ - vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - - /* Create the semaphore that will be deleted in the idle task hook. This - is done purely to test the use of vSemaphoreDelete(). */ - xMutexToDelete = xSemaphoreCreateMutex(); - - /* Start the scheduler itself. */ - vTaskStartScheduler(); - - /* Should never get here unless there was not enough heap space to create - the idle and other system tasks. */ - return 0; + /* Start the check task as described at the top of this file. */ + xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + + /* Create the standard demo tasks. */ + vStartTaskNotifyTask(); + vStartTaskNotifyArrayTask(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY ); + vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); + vStartQueuePeekTasks(); + vStartMathTasks( mainFLOP_TASK_PRIORITY ); + vStartRecursiveMutexTasks(); + vStartCountingSemaphoreTasks(); + vStartDynamicPriorityTasks(); + vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY ); + vStartEventGroupTasks(); + vStartInterruptSemaphoreTasks(); + vCreateBlockTimeTasks(); + vCreateAbortDelayTasks(); + xTaskCreate( prvDemoQueueSpaceFunctions, "QSpace", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( prvPermanentlyBlockingSemaphoreTask, "BlockSem", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( prvPermanentlyBlockingNotificationTask, "BlockNoti", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + + vStartMessageBufferTasks( configMINIMAL_STACK_SIZE ); + vStartStreamBufferTasks(); + vStartStreamBufferInterruptDemo(); + vStartMessageBufferAMPTasks( configMINIMAL_STACK_SIZE ); + + #if ( configUSE_QUEUE_SETS == 1 ) + { + vStartQueueSetTasks(); + vStartQueueSetPollingTask(); + } + #endif + + #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) + { + vStartStaticallyAllocatedTasks(); + } + #endif + + #if ( configUSE_PREEMPTION != 0 ) + { + /* Don't expect these tasks to pass when preemption is not used. */ + vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); + } + #endif + + /* The suicide tasks must be created last as they need to know how many + * tasks were running prior to their creation. This then allows them to + * ascertain whether or not the correct/expected number of tasks are running at + * any given time. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + + /* Create the semaphore that will be deleted in the idle task hook. This + * is done purely to test the use of vSemaphoreDelete(). */ + xMutexToDelete = xSemaphoreCreateMutex(); + + /* Start the scheduler itself. */ + vTaskStartScheduler(); + + /* Should never get here unless there was not enough heap space to create + * the idle and other system tasks. */ + return 0; } /*-----------------------------------------------------------*/ -static void prvCheckTask( void *pvParameters ) +static void prvCheckTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const TickType_t xCycleFrequency = pdMS_TO_TICKS( 5000UL ); -HeapStats_t xHeapStats; - - /* Just to remove compiler warning. */ - ( void ) pvParameters; - - /* Initialise xNextWakeTime - this only needs to be done once. */ - xNextWakeTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Place this task in the blocked state until it is time to run again. */ - vTaskDelayUntil( &xNextWakeTime, xCycleFrequency ); - - /* Check the standard demo tasks are running without error. */ - #if( configUSE_PREEMPTION != 0 ) - { - /* These tasks are only created when preemption is used. */ - if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE ) - { - pcStatusMessage = "Error: TimerDemo"; - } - } - #endif - - if( xAreStreamBufferTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: StreamBuffer"; - } - else if( xAreMessageBufferTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: MessageBuffer"; - } - else if( xAreTaskNotificationTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: Notification"; - } - else if( xAreTaskNotificationArrayTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: NotificationArray"; - } - else if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: IntSem"; - } - else if( xAreEventGroupTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: EventGroup"; - } - else if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: IntMath"; - } - else if( xAreGenericQueueTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: GenQueue"; - } - else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: QueuePeek"; - } - else if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: BlockQueue"; - } - else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: SemTest"; - } - else if( xArePollingQueuesStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: PollQueue"; - } - else if( xAreMathsTaskStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: Flop"; - } - else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: RecMutex"; - } - else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: CountSem"; - } - else if( xIsCreateTaskStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: Death"; - } - else if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: Dynamic"; - } - else if( xIsQueueOverwriteTaskStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: Queue overwrite"; - } - else if( xAreBlockTimeTestTasksStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: Block time"; - } - else if( xAreAbortDelayTestTasksStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: Abort delay"; - } - else if( xIsInterruptStreamBufferDemoStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: Stream buffer interrupt"; - } - else if( xAreMessageBufferAMPTasksStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: Message buffer AMP"; - } - - #if( configUSE_QUEUE_SETS == 1 ) - else if( xAreQueueSetTasksStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: Queue set"; - } - else if( xAreQueueSetPollTasksStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: Queue set polling"; - } - #endif - - #if( configSUPPORT_STATIC_ALLOCATION == 1 ) - else if( xAreStaticAllocationTasksStillRunning() != pdPASS ) - { - pcStatusMessage = "Error: Static allocation"; - } - #endif /* configSUPPORT_STATIC_ALLOCATION */ - - /* This is the only task that uses stdout so its ok to call printf() - directly. */ - vPortGetHeapStats( &xHeapStats ); - - configASSERT( xHeapStats.xAvailableHeapSpaceInBytes == xPortGetFreeHeapSize() ); - configASSERT( xHeapStats.xMinimumEverFreeBytesRemaining == xPortGetMinimumEverFreeHeapSize() ); - - printf( "%s - tick count %zu - free heap %zu - min free heap %zu - largest free block %zu - idle time %llu%%\r\n", - pcStatusMessage, - xTaskGetTickCount(), - xHeapStats.xAvailableHeapSpaceInBytes, - xHeapStats.xMinimumEverFreeBytesRemaining, - xHeapStats.xSizeOfLargestFreeBlockInBytes, - ulTaskGetIdleRunTimePercent() ); - } + TickType_t xNextWakeTime; + const TickType_t xCycleFrequency = pdMS_TO_TICKS( 5000UL ); + HeapStats_t xHeapStats; + + /* Just to remove compiler warning. */ + ( void ) pvParameters; + + /* Initialise xNextWakeTime - this only needs to be done once. */ + xNextWakeTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Place this task in the blocked state until it is time to run again. */ + vTaskDelayUntil( &xNextWakeTime, xCycleFrequency ); + + /* Check the standard demo tasks are running without error. */ + #if ( configUSE_PREEMPTION != 0 ) + { + /* These tasks are only created when preemption is used. */ + if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE ) + { + pcStatusMessage = "Error: TimerDemo"; + } + } + #endif + + if( xAreStreamBufferTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: StreamBuffer"; + } + else if( xAreMessageBufferTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: MessageBuffer"; + } + else if( xAreTaskNotificationTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: Notification"; + } + else if( xAreTaskNotificationArrayTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: NotificationArray"; + } + else if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: IntSem"; + } + else if( xAreEventGroupTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: EventGroup"; + } + else if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: IntMath"; + } + else if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: GenQueue"; + } + else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: QueuePeek"; + } + else if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: BlockQueue"; + } + else if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: SemTest"; + } + else if( xArePollingQueuesStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: PollQueue"; + } + else if( xAreMathsTaskStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: Flop"; + } + else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: RecMutex"; + } + else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: CountSem"; + } + else if( xIsCreateTaskStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: Death"; + } + else if( xAreDynamicPriorityTasksStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: Dynamic"; + } + else if( xIsQueueOverwriteTaskStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: Queue overwrite"; + } + else if( xAreBlockTimeTestTasksStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: Block time"; + } + else if( xAreAbortDelayTestTasksStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: Abort delay"; + } + else if( xIsInterruptStreamBufferDemoStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: Stream buffer interrupt"; + } + else if( xAreMessageBufferAMPTasksStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: Message buffer AMP"; + } + + #if ( configUSE_QUEUE_SETS == 1 ) + else if( xAreQueueSetTasksStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: Queue set"; + } + else if( xAreQueueSetPollTasksStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: Queue set polling"; + } + #endif + + #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) + else if( xAreStaticAllocationTasksStillRunning() != pdPASS ) + { + pcStatusMessage = "Error: Static allocation"; + } + #endif /* configSUPPORT_STATIC_ALLOCATION */ + + /* This is the only task that uses stdout so its ok to call printf() + * directly. */ + vPortGetHeapStats( &xHeapStats ); + + configASSERT( xHeapStats.xAvailableHeapSpaceInBytes == xPortGetFreeHeapSize() ); + configASSERT( xHeapStats.xMinimumEverFreeBytesRemaining == xPortGetMinimumEverFreeHeapSize() ); + + printf( "%s - tick count %zu - free heap %zu - min free heap %zu - largest free block %zu - idle time %llu%%\r\n", + pcStatusMessage, + xTaskGetTickCount(), + xHeapStats.xAvailableHeapSpaceInBytes, + xHeapStats.xMinimumEverFreeBytesRemaining, + xHeapStats.xSizeOfLargestFreeBlockInBytes, + ulTaskGetIdleRunTimePercent() ); + } } /*-----------------------------------------------------------*/ -static void prvTestTask( void *pvParameters ) +static void prvTestTask( void * pvParameters ) { -const unsigned long ulMSToSleep = 5; - - /* Just to remove compiler warnings. */ - ( void ) pvParameters; - - /* This task is just used to test the eTaskStateGet() function. It - does not have anything to do. */ - for( ;; ) - { - /* Sleep to reduce CPU load, but don't sleep indefinitely in case there are - tasks waiting to be terminated by the idle task. */ - Sleep( ulMSToSleep ); - } + const unsigned long ulMSToSleep = 5; + + /* Just to remove compiler warnings. */ + ( void ) pvParameters; + + /* This task is just used to test the eTaskStateGet() function. It + * does not have anything to do. */ + for( ; ; ) + { + /* Sleep to reduce CPU load, but don't sleep indefinitely in case there are + * tasks waiting to be terminated by the idle task. */ + Sleep( ulMSToSleep ); + } } /*-----------------------------------------------------------*/ /* Called from vApplicationIdleHook(), which is defined in main.c. */ void vFullDemoIdleFunction( void ) { -const unsigned long ulMSToSleep = 15; -void *pvAllocated; - - /* Sleep to reduce CPU load, but don't sleep indefinitely in case there are - tasks waiting to be terminated by the idle task. */ - Sleep( ulMSToSleep ); - - /* Demonstrate a few utility functions that are not demonstrated by any of - the standard demo tasks. */ - prvDemonstrateTaskStateAndHandleGetFunctions(); - - /* Demonstrate the use of xTimerPendFunctionCall(), which is not - demonstrated by any of the standard demo tasks. */ - prvDemonstratePendingFunctionCall(); - - /* Demonstrate the use of functions that query information about a software - timer. */ - prvDemonstrateTimerQueryFunctions(); - - - /* If xMutexToDelete has not already been deleted, then delete it now. - This is done purely to demonstrate the use of, and test, the - vSemaphoreDelete() macro. Care must be taken not to delete a semaphore - that has tasks blocked on it. */ - if( xMutexToDelete != NULL ) - { - /* For test purposes, add the mutex to the registry, then remove it - again, before it is deleted - checking its name is as expected before - and after the assertion into the registry and its removal from the - registry. */ - configASSERT( pcQueueGetName( xMutexToDelete ) == NULL ); - vQueueAddToRegistry( xMutexToDelete, "Test_Mutex" ); - configASSERT( strcmp( pcQueueGetName( xMutexToDelete ), "Test_Mutex" ) == 0 ); - vQueueUnregisterQueue( xMutexToDelete ); - configASSERT( pcQueueGetName( xMutexToDelete ) == NULL ); - - vSemaphoreDelete( xMutexToDelete ); - xMutexToDelete = NULL; - } - - /* Exercise heap_5 a bit. The malloc failed hook will trap failed - allocations so there is no need to test here. */ - pvAllocated = pvPortMalloc( ( rand() % 500 ) + 1 ); - vPortFree( pvAllocated ); + const unsigned long ulMSToSleep = 15; + void * pvAllocated; + + /* Sleep to reduce CPU load, but don't sleep indefinitely in case there are + * tasks waiting to be terminated by the idle task. */ + Sleep( ulMSToSleep ); + + /* Demonstrate a few utility functions that are not demonstrated by any of + * the standard demo tasks. */ + prvDemonstrateTaskStateAndHandleGetFunctions(); + + /* Demonstrate the use of xTimerPendFunctionCall(), which is not + * demonstrated by any of the standard demo tasks. */ + prvDemonstratePendingFunctionCall(); + + /* Demonstrate the use of functions that query information about a software + * timer. */ + prvDemonstrateTimerQueryFunctions(); + + /* If xMutexToDelete has not already been deleted, then delete it now. + * This is done purely to demonstrate the use of, and test, the + * vSemaphoreDelete() macro. Care must be taken not to delete a semaphore + * that has tasks blocked on it. */ + if( xMutexToDelete != NULL ) + { + /* For test purposes, add the mutex to the registry, then remove it + * again, before it is deleted - checking its name is as expected before + * and after the assertion into the registry and its removal from the + * registry. */ + configASSERT( pcQueueGetName( xMutexToDelete ) == NULL ); + vQueueAddToRegistry( xMutexToDelete, "Test_Mutex" ); + configASSERT( strcmp( pcQueueGetName( xMutexToDelete ), "Test_Mutex" ) == 0 ); + vQueueUnregisterQueue( xMutexToDelete ); + configASSERT( pcQueueGetName( xMutexToDelete ) == NULL ); + + vSemaphoreDelete( xMutexToDelete ); + xMutexToDelete = NULL; + } + + /* Exercise heap_5 a bit. The malloc failed hook will trap failed + * allocations so there is no need to test here. */ + pvAllocated = pvPortMalloc( ( rand() % 500 ) + 1 ); + vPortFree( pvAllocated ); } /*-----------------------------------------------------------*/ /* Called by vApplicationTickHook(), which is defined in main.c. */ void vFullDemoTickHookFunction( void ) { -TaskHandle_t xTimerTask; - - /* Call the periodic timer test, which tests the timer API functions that - can be called from an ISR. */ - #if( configUSE_PREEMPTION != 0 ) - { - /* Only created when preemption is used. */ - vTimerPeriodicISRTests(); - } - #endif - - /* Call the periodic queue overwrite from ISR demo. */ - vQueueOverwritePeriodicISRDemo(); - - #if( configUSE_QUEUE_SETS == 1 ) /* Remove the tests if queue sets are not defined. */ - { - /* Write to a queue that is in use as part of the queue set demo to - demonstrate using queue sets from an ISR. */ - vQueueSetAccessQueueSetFromISR(); - vQueueSetPollingInterruptAccess(); - } - #endif - - /* Exercise event groups from interrupts. */ - vPeriodicEventGroupsProcessing(); - - /* Exercise giving mutexes from an interrupt. */ - vInterruptSemaphorePeriodicTest(); - - /* Exercise using task notifications from an interrupt. */ - xNotifyTaskFromISR(); - xNotifyArrayTaskFromISR(); - - /* Writes to stream buffer byte by byte to test the stream buffer trigger - level functionality. */ - vPeriodicStreamBufferProcessing(); - - /* Writes a string to a string buffer four bytes at a time to demonstrate - a stream being sent from an interrupt to a task. */ - vBasicStreamBufferSendFromISR(); - - /* For code coverage purposes. */ - xTimerTask = xTimerGetTimerDaemonTaskHandle(); - configASSERT( uxTaskPriorityGetFromISR( xTimerTask ) == configTIMER_TASK_PRIORITY ); + TaskHandle_t xTimerTask; + + /* Call the periodic timer test, which tests the timer API functions that + * can be called from an ISR. */ + #if ( configUSE_PREEMPTION != 0 ) + { + /* Only created when preemption is used. */ + vTimerPeriodicISRTests(); + } + #endif + + /* Call the periodic queue overwrite from ISR demo. */ + vQueueOverwritePeriodicISRDemo(); + + #if ( configUSE_QUEUE_SETS == 1 ) /* Remove the tests if queue sets are not defined. */ + { + /* Write to a queue that is in use as part of the queue set demo to + * demonstrate using queue sets from an ISR. */ + vQueueSetAccessQueueSetFromISR(); + vQueueSetPollingInterruptAccess(); + } + #endif + + /* Exercise event groups from interrupts. */ + vPeriodicEventGroupsProcessing(); + + /* Exercise giving mutexes from an interrupt. */ + vInterruptSemaphorePeriodicTest(); + + /* Exercise using task notifications from an interrupt. */ + xNotifyTaskFromISR(); + xNotifyArrayTaskFromISR(); + + /* Writes to stream buffer byte by byte to test the stream buffer trigger + * level functionality. */ + vPeriodicStreamBufferProcessing(); + + /* Writes a string to a string buffer four bytes at a time to demonstrate + * a stream being sent from an interrupt to a task. */ + vBasicStreamBufferSendFromISR(); + + /* For code coverage purposes. */ + xTimerTask = xTimerGetTimerDaemonTaskHandle(); + configASSERT( uxTaskPriorityGetFromISR( xTimerTask ) == configTIMER_TASK_PRIORITY ); } /*-----------------------------------------------------------*/ -static void prvPendedFunction( void *pvParameter1, uint32_t ulParameter2 ) +static void prvPendedFunction( void * pvParameter1, + uint32_t ulParameter2 ) { -static uint32_t ulLastParameter1 = 1000UL, ulLastParameter2 = 0UL; -uint32_t ulParameter1; + static uint32_t ulLastParameter1 = 1000UL, ulLastParameter2 = 0UL; + uint32_t ulParameter1; - ulParameter1 = ( uint32_t ) pvParameter1; + ulParameter1 = ( uint32_t ) pvParameter1; - /* Ensure the parameters are as expected. */ - configASSERT( ulParameter1 == ( ulLastParameter1 + 1 ) ); - configASSERT( ulParameter2 == ( ulLastParameter2 + 1 ) ); + /* Ensure the parameters are as expected. */ + configASSERT( ulParameter1 == ( ulLastParameter1 + 1 ) ); + configASSERT( ulParameter2 == ( ulLastParameter2 + 1 ) ); - /* Remember the parameters for the next time the function is called. */ - ulLastParameter1 = ulParameter1; - ulLastParameter2 = ulParameter2; + /* Remember the parameters for the next time the function is called. */ + ulLastParameter1 = ulParameter1; + ulLastParameter2 = ulParameter2; } /*-----------------------------------------------------------*/ static void prvTestTimerCallback( TimerHandle_t xTimer ) { - /* This is the callback function for the timer accessed by - prvDemonstrateTimerQueryFunctions(). The callback does not do anything. */ - ( void ) xTimer; + /* This is the callback function for the timer accessed by + * prvDemonstrateTimerQueryFunctions(). The callback does not do anything. */ + ( void ) xTimer; } /*-----------------------------------------------------------*/ static void prvDemonstrateTimerQueryFunctions( void ) { -static TimerHandle_t xTimer = NULL; -const char *pcTimerName = "TestTimer"; -volatile TickType_t xExpiryTime; -const TickType_t xDontBlock = 0; - - if( xTimer == NULL ) - { - xTimer = xTimerCreate( pcTimerName, portMAX_DELAY, pdTRUE, NULL, prvTestTimerCallback ); - - if( xTimer != NULL ) - { - /* Called from the idle task so a block time must not be - specified. */ - xTimerStart( xTimer, xDontBlock ); - } - } - - if( xTimer != NULL ) - { - /* Demonstrate querying a timer's name. */ - configASSERT( strcmp( pcTimerGetName( xTimer ), pcTimerName ) == 0 ); - - /* Demonstrate querying a timer's period. */ - configASSERT( xTimerGetPeriod( xTimer ) == portMAX_DELAY ); - - /* Demonstrate querying a timer's next expiry time, although nothing is - done with the returned value. Note if the expiry time is less than the - maximum tick count then the expiry time has overflowed from the current - time. In this case the expiry time was set to portMAX_DELAY, so it is - expected to be less than the current time until the current time has - itself overflowed. */ - xExpiryTime = xTimerGetExpiryTime( xTimer ); - ( void ) xExpiryTime; - } + static TimerHandle_t xTimer = NULL; + const char * pcTimerName = "TestTimer"; + volatile TickType_t xExpiryTime; + const TickType_t xDontBlock = 0; + + if( xTimer == NULL ) + { + xTimer = xTimerCreate( pcTimerName, portMAX_DELAY, pdTRUE, NULL, prvTestTimerCallback ); + + if( xTimer != NULL ) + { + /* Called from the idle task so a block time must not be + * specified. */ + xTimerStart( xTimer, xDontBlock ); + } + } + + if( xTimer != NULL ) + { + /* Demonstrate querying a timer's name. */ + configASSERT( strcmp( pcTimerGetName( xTimer ), pcTimerName ) == 0 ); + + /* Demonstrate querying a timer's period. */ + configASSERT( xTimerGetPeriod( xTimer ) == portMAX_DELAY ); + + /* Demonstrate querying a timer's next expiry time, although nothing is + * done with the returned value. Note if the expiry time is less than the + * maximum tick count then the expiry time has overflowed from the current + * time. In this case the expiry time was set to portMAX_DELAY, so it is + * expected to be less than the current time until the current time has + * itself overflowed. */ + xExpiryTime = xTimerGetExpiryTime( xTimer ); + ( void ) xExpiryTime; + } } /*-----------------------------------------------------------*/ static void prvDemonstratePendingFunctionCall( void ) { -static uint32_t ulParameter1 = 1000UL, ulParameter2 = 0UL; -const TickType_t xDontBlock = 0; /* This is called from the idle task so must *not* attempt to block. */ + static uint32_t ulParameter1 = 1000UL, ulParameter2 = 0UL; + const TickType_t xDontBlock = 0; /* This is called from the idle task so must *not* attempt to block. */ - /* prvPendedFunction() just expects the parameters to be incremented by one - each time it is called. */ - ulParameter1++; - ulParameter2++; + /* prvPendedFunction() just expects the parameters to be incremented by one + * each time it is called. */ - /* Pend the function call, sending the parameters. */ - xTimerPendFunctionCall( prvPendedFunction, ( void * ) ulParameter1, ulParameter2, xDontBlock ); + ulParameter1++; + ulParameter2++; + + /* Pend the function call, sending the parameters. */ + xTimerPendFunctionCall( prvPendedFunction, ( void * ) ulParameter1, ulParameter2, xDontBlock ); } /*-----------------------------------------------------------*/ static void prvDemonstrateTaskStateAndHandleGetFunctions( void ) { -TaskHandle_t xIdleTaskHandle, xTimerTaskHandle; -char *pcTaskName; -static portBASE_TYPE xPerformedOneShotTests = pdFALSE; -TaskHandle_t xTestTask; -TaskStatus_t xTaskInfo; -extern StackType_t uxTimerTaskStack[]; - - /* Demonstrate the use of the xTimerGetTimerDaemonTaskHandle() and - xTaskGetIdleTaskHandle() functions. Also try using the function that sets - the task number. */ - xIdleTaskHandle = xTaskGetIdleTaskHandle(); - xTimerTaskHandle = xTimerGetTimerDaemonTaskHandle(); - - /* This is the idle hook, so the current task handle should equal the - returned idle task handle. */ - if( xTaskGetCurrentTaskHandle() != xIdleTaskHandle ) - { - pcStatusMessage = "Error: Returned idle task handle was incorrect"; - } - - /* Check the same handle is obtained using the idle task's name. First try - with the wrong name, then the right name. */ - if( xTaskGetHandle( "Idle" ) == xIdleTaskHandle ) - { - pcStatusMessage = "Error: Returned handle for name Idle was incorrect"; - } - - if( xTaskGetHandle( "IDLE" ) != xIdleTaskHandle ) - { - pcStatusMessage = "Error: Returned handle for name Idle was incorrect"; - } - - /* Check the timer task handle was returned correctly. */ - pcTaskName = pcTaskGetName( xTimerTaskHandle ); - if( strcmp( pcTaskName, "Tmr Svc" ) != 0 ) - { - pcStatusMessage = "Error: Returned timer task handle was incorrect"; - } - - if( xTaskGetHandle( "Tmr Svc" ) != xTimerTaskHandle ) - { - pcStatusMessage = "Error: Returned handle for name Tmr Svc was incorrect"; - } - - /* This task is running, make sure it's state is returned as running. */ - if( eTaskStateGet( xIdleTaskHandle ) != eRunning ) - { - pcStatusMessage = "Error: Returned idle task state was incorrect"; - } - - /* If this task is running, then the timer task must be blocked. */ - if( eTaskStateGet( xTimerTaskHandle ) != eBlocked ) - { - pcStatusMessage = "Error: Returned timer task state was incorrect"; - } - - /* Also with the vTaskGetInfo() function. */ - vTaskGetInfo( xTimerTaskHandle, /* The task being queried. */ - &xTaskInfo, /* The structure into which information on the task will be written. */ - pdTRUE, /* Include the task's high watermark in the structure. */ - eInvalid ); /* Include the task state in the structure. */ - - /* Check the information returned by vTaskGetInfo() is as expected. */ - if( ( xTaskInfo.eCurrentState != eBlocked ) || - ( strcmp( xTaskInfo.pcTaskName, "Tmr Svc" ) != 0 ) || - ( xTaskInfo.uxCurrentPriority != configTIMER_TASK_PRIORITY ) || - ( xTaskInfo.pxStackBase != uxTimerTaskStack ) || - ( xTaskInfo.xHandle != xTimerTaskHandle ) ) - { - pcStatusMessage = "Error: vTaskGetInfo() returned incorrect information about the timer task"; - } - - /* Other tests that should only be performed once follow. The test task - is not created on each iteration because to do so would cause the death - task to report an error (too many tasks running). */ - if( xPerformedOneShotTests == pdFALSE ) - { - /* Don't run this part of the test again. */ - xPerformedOneShotTests = pdTRUE; - - /* Create a test task to use to test other eTaskStateGet() return values. */ - if( xTaskCreate( prvTestTask, "Test", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, &xTestTask ) == pdPASS ) - { - /* If this task is running, the test task must be in the ready state. */ - if( eTaskStateGet( xTestTask ) != eReady ) - { - pcStatusMessage = "Error: Returned test task state was incorrect 1"; - } - - /* Now suspend the test task and check its state is reported correctly. */ - vTaskSuspend( xTestTask ); - if( eTaskStateGet( xTestTask ) != eSuspended ) - { - pcStatusMessage = "Error: Returned test task state was incorrect 2"; - } - - /* Now delete the task and check its state is reported correctly. */ - vTaskDelete( xTestTask ); - if( eTaskStateGet( xTestTask ) != eDeleted ) - { - pcStatusMessage = "Error: Returned test task state was incorrect 3"; - } - } - } + TaskHandle_t xIdleTaskHandle, xTimerTaskHandle; + char * pcTaskName; + static portBASE_TYPE xPerformedOneShotTests = pdFALSE; + TaskHandle_t xTestTask; + TaskStatus_t xTaskInfo; + extern StackType_t uxTimerTaskStack[]; + + /* Demonstrate the use of the xTimerGetTimerDaemonTaskHandle() and + * xTaskGetIdleTaskHandle() functions. Also try using the function that sets + * the task number. */ + xIdleTaskHandle = xTaskGetIdleTaskHandle(); + xTimerTaskHandle = xTimerGetTimerDaemonTaskHandle(); + + /* This is the idle hook, so the current task handle should equal the + * returned idle task handle. */ + if( xTaskGetCurrentTaskHandle() != xIdleTaskHandle ) + { + pcStatusMessage = "Error: Returned idle task handle was incorrect"; + } + + /* Check the same handle is obtained using the idle task's name. First try + * with the wrong name, then the right name. */ + if( xTaskGetHandle( "Idle" ) == xIdleTaskHandle ) + { + pcStatusMessage = "Error: Returned handle for name Idle was incorrect"; + } + + if( xTaskGetHandle( "IDLE" ) != xIdleTaskHandle ) + { + pcStatusMessage = "Error: Returned handle for name Idle was incorrect"; + } + + /* Check the timer task handle was returned correctly. */ + pcTaskName = pcTaskGetName( xTimerTaskHandle ); + + if( strcmp( pcTaskName, "Tmr Svc" ) != 0 ) + { + pcStatusMessage = "Error: Returned timer task handle was incorrect"; + } + + if( xTaskGetHandle( "Tmr Svc" ) != xTimerTaskHandle ) + { + pcStatusMessage = "Error: Returned handle for name Tmr Svc was incorrect"; + } + + /* This task is running, make sure it's state is returned as running. */ + if( eTaskStateGet( xIdleTaskHandle ) != eRunning ) + { + pcStatusMessage = "Error: Returned idle task state was incorrect"; + } + + /* If this task is running, then the timer task must be blocked. */ + if( eTaskStateGet( xTimerTaskHandle ) != eBlocked ) + { + pcStatusMessage = "Error: Returned timer task state was incorrect"; + } + + /* Also with the vTaskGetInfo() function. */ + vTaskGetInfo( xTimerTaskHandle, /* The task being queried. */ + &xTaskInfo, /* The structure into which information on the task will be written. */ + pdTRUE, /* Include the task's high watermark in the structure. */ + eInvalid ); /* Include the task state in the structure. */ + + /* Check the information returned by vTaskGetInfo() is as expected. */ + if( ( xTaskInfo.eCurrentState != eBlocked ) || + ( strcmp( xTaskInfo.pcTaskName, "Tmr Svc" ) != 0 ) || + ( xTaskInfo.uxCurrentPriority != configTIMER_TASK_PRIORITY ) || + ( xTaskInfo.pxStackBase != uxTimerTaskStack ) || + ( xTaskInfo.xHandle != xTimerTaskHandle ) ) + { + pcStatusMessage = "Error: vTaskGetInfo() returned incorrect information about the timer task"; + } + + /* Other tests that should only be performed once follow. The test task + * is not created on each iteration because to do so would cause the death + * task to report an error (too many tasks running). */ + if( xPerformedOneShotTests == pdFALSE ) + { + /* Don't run this part of the test again. */ + xPerformedOneShotTests = pdTRUE; + + /* Create a test task to use to test other eTaskStateGet() return values. */ + if( xTaskCreate( prvTestTask, "Test", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, &xTestTask ) == pdPASS ) + { + /* If this task is running, the test task must be in the ready state. */ + if( eTaskStateGet( xTestTask ) != eReady ) + { + pcStatusMessage = "Error: Returned test task state was incorrect 1"; + } + + /* Now suspend the test task and check its state is reported correctly. */ + vTaskSuspend( xTestTask ); + + if( eTaskStateGet( xTestTask ) != eSuspended ) + { + pcStatusMessage = "Error: Returned test task state was incorrect 2"; + } + + /* Now delete the task and check its state is reported correctly. */ + vTaskDelete( xTestTask ); + + if( eTaskStateGet( xTestTask ) != eDeleted ) + { + pcStatusMessage = "Error: Returned test task state was incorrect 3"; + } + } + } } /*-----------------------------------------------------------*/ -static void prvDemoQueueSpaceFunctions( void *pvParameters ) +static void prvDemoQueueSpaceFunctions( void * pvParameters ) { -QueueHandle_t xQueue = NULL; -const unsigned portBASE_TYPE uxQueueLength = 10; -unsigned portBASE_TYPE uxReturn, x; - - /* Remove compiler warnings. */ - ( void ) pvParameters; - - /* Create the queue that will be used. Nothing is actually going to be - sent or received so the queue item size is set to 0. */ - xQueue = xQueueCreate( uxQueueLength, 0 ); - configASSERT( xQueue ); - - for( ;; ) - { - for( x = 0; x < uxQueueLength; x++ ) - { - /* Ask how many messages are available... */ - uxReturn = uxQueueMessagesWaiting( xQueue ); - - /* Check the number of messages being reported as being available - is as expected, and force an assert if not. */ - if( uxReturn != x ) - { - /* xQueue cannot be NULL so this is deliberately causing an - assert to be triggered as there is an error. */ - configASSERT( xQueue == NULL ); - } - - /* Ask how many spaces remain in the queue... */ - uxReturn = uxQueueSpacesAvailable( xQueue ); - - /* Check the number of spaces being reported as being available - is as expected, and force an assert if not. */ - if( uxReturn != ( uxQueueLength - x ) ) - { - /* xQueue cannot be NULL so this is deliberately causing an - assert to be triggered as there is an error. */ - configASSERT( xQueue == NULL ); - } - - /* Fill one more space in the queue. */ - xQueueSendToBack( xQueue, NULL, 0 ); - } - - /* Perform the same check while the queue is full. */ - uxReturn = uxQueueMessagesWaiting( xQueue ); - if( uxReturn != uxQueueLength ) - { - configASSERT( xQueue == NULL ); - } - - uxReturn = uxQueueSpacesAvailable( xQueue ); - - if( uxReturn != 0 ) - { - configASSERT( xQueue == NULL ); - } - - /* The queue is full, start again. */ - xQueueReset( xQueue ); - - #if( configUSE_PREEMPTION == 0 ) - taskYIELD(); - #endif - } + QueueHandle_t xQueue = NULL; + const unsigned portBASE_TYPE uxQueueLength = 10; + unsigned portBASE_TYPE uxReturn, x; + + /* Remove compiler warnings. */ + ( void ) pvParameters; + + /* Create the queue that will be used. Nothing is actually going to be + * sent or received so the queue item size is set to 0. */ + xQueue = xQueueCreate( uxQueueLength, 0 ); + configASSERT( xQueue ); + + for( ; ; ) + { + for( x = 0; x < uxQueueLength; x++ ) + { + /* Ask how many messages are available... */ + uxReturn = uxQueueMessagesWaiting( xQueue ); + + /* Check the number of messages being reported as being available + * is as expected, and force an assert if not. */ + if( uxReturn != x ) + { + /* xQueue cannot be NULL so this is deliberately causing an + * assert to be triggered as there is an error. */ + configASSERT( xQueue == NULL ); + } + + /* Ask how many spaces remain in the queue... */ + uxReturn = uxQueueSpacesAvailable( xQueue ); + + /* Check the number of spaces being reported as being available + * is as expected, and force an assert if not. */ + if( uxReturn != ( uxQueueLength - x ) ) + { + /* xQueue cannot be NULL so this is deliberately causing an + * assert to be triggered as there is an error. */ + configASSERT( xQueue == NULL ); + } + + /* Fill one more space in the queue. */ + xQueueSendToBack( xQueue, NULL, 0 ); + } + + /* Perform the same check while the queue is full. */ + uxReturn = uxQueueMessagesWaiting( xQueue ); + + if( uxReturn != uxQueueLength ) + { + configASSERT( xQueue == NULL ); + } + + uxReturn = uxQueueSpacesAvailable( xQueue ); + + if( uxReturn != 0 ) + { + configASSERT( xQueue == NULL ); + } + + /* The queue is full, start again. */ + xQueueReset( xQueue ); + + #if ( configUSE_PREEMPTION == 0 ) + taskYIELD(); + #endif + } } /*-----------------------------------------------------------*/ -static void prvPermanentlyBlockingSemaphoreTask( void *pvParameters ) +static void prvPermanentlyBlockingSemaphoreTask( void * pvParameters ) { -SemaphoreHandle_t xSemaphore; + SemaphoreHandle_t xSemaphore; - /* Prevent compiler warning about unused parameter in the case that - configASSERT() is not defined. */ - ( void ) pvParameters; + /* Prevent compiler warning about unused parameter in the case that + * configASSERT() is not defined. */ + ( void ) pvParameters; - /* This task should block on a semaphore, and never return. */ - xSemaphore = xSemaphoreCreateBinary(); - configASSERT( xSemaphore ); + /* This task should block on a semaphore, and never return. */ + xSemaphore = xSemaphoreCreateBinary(); + configASSERT( xSemaphore ); - xSemaphoreTake( xSemaphore, portMAX_DELAY ); + xSemaphoreTake( xSemaphore, portMAX_DELAY ); - /* The above xSemaphoreTake() call should never return, force an assert if - it does. */ - configASSERT( pvParameters != NULL ); - vTaskDelete( NULL ); + /* The above xSemaphoreTake() call should never return, force an assert if + * it does. */ + configASSERT( pvParameters != NULL ); + vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ -static void prvPermanentlyBlockingNotificationTask( void *pvParameters ) +static void prvPermanentlyBlockingNotificationTask( void * pvParameters ) { - /* Prevent compiler warning about unused parameter in the case that - configASSERT() is not defined. */ - ( void ) pvParameters; + /* Prevent compiler warning about unused parameter in the case that + * configASSERT() is not defined. */ + ( void ) pvParameters; - /* This task should block on a task notification, and never return. */ - ulTaskNotifyTake( pdTRUE, portMAX_DELAY ); + /* This task should block on a task notification, and never return. */ + ulTaskNotifyTake( pdTRUE, portMAX_DELAY ); - /* The above ulTaskNotifyTake() call should never return, force an assert - if it does. */ - configASSERT( pvParameters != NULL ); - vTaskDelete( NULL ); + /* The above ulTaskNotifyTake() call should never return, force an assert + * if it does. */ + configASSERT( pvParameters != NULL ); + vTaskDelete( NULL ); } - - - diff --git a/FreeRTOS/Demo/WIN32-MingW/DemosModifiedForLowTickRate/recmutex.c b/FreeRTOS/Demo/WIN32-MingW/DemosModifiedForLowTickRate/recmutex.c index fea12c48543..c1ed9297090 100644 --- a/FreeRTOS/Demo/WIN32-MingW/DemosModifiedForLowTickRate/recmutex.c +++ b/FreeRTOS/Demo/WIN32-MingW/DemosModifiedForLowTickRate/recmutex.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WIN32-MingW/FreeRTOSConfig.h b/FreeRTOS/Demo/WIN32-MingW/FreeRTOSConfig.h index c3d8ddb7589..7fded6bc379 100644 --- a/FreeRTOS/Demo/WIN32-MingW/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/WIN32-MingW/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WIN32-MingW/Run-time-stats-utils.c b/FreeRTOS/Demo/WIN32-MingW/Run-time-stats-utils.c index ef30de29618..d5c7b45887e 100644 --- a/FreeRTOS/Demo/WIN32-MingW/Run-time-stats-utils.c +++ b/FreeRTOS/Demo/WIN32-MingW/Run-time-stats-utils.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WIN32-MingW/code_coverage_additions.c b/FreeRTOS/Demo/WIN32-MingW/code_coverage_additions.c index 32838c14fd4..60713674816 100644 --- a/FreeRTOS/Demo/WIN32-MingW/code_coverage_additions.c +++ b/FreeRTOS/Demo/WIN32-MingW/code_coverage_additions.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/WIN32-MingW/main.c b/FreeRTOS/Demo/WIN32-MingW/main.c index cbdaf23a14a..cc8f946dab6 100644 --- a/FreeRTOS/Demo/WIN32-MingW/main.c +++ b/FreeRTOS/Demo/WIN32-MingW/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -201,37 +201,37 @@ int main( void ) /* Do not include trace code when performing a code coverage analysis. */ #if ( projCOVERAGE_TEST != 1 ) - { - /* Initialise the trace recorder. Use of the trace recorder is optional. - * See http://www.FreeRTOS.org/trace for more information. */ - configASSERT( xTraceInitialize() == TRC_SUCCESS ); - - /* Start the trace recording - the recording is written to a file if - * configASSERT() is called. */ - printf( - "Trace started.\r\n" - "Note that the trace output uses the ring buffer mode, meaning that the output trace\r\n" - "will only be the most recent data able to fit within the trace recorder buffer.\r\n\r\n" - "The trace will be dumped to the file \"%s\" whenever a call to configASSERT()\r\n" - "fails or the \'%c\' key is pressed.\r\n" - "Note that key presses cannot be captured in the Eclipse console, so for key presses to work\r\n" - "you will have to run this demo in a Windows console.\r\n\r\n", - mainTRACE_FILE_NAME, mainOUTPUT_TRACE_KEY ); - fflush( stdout ); - configASSERT( xTraceEnable( TRC_START ) == TRC_SUCCESS ); - } + { + /* Initialise the trace recorder. Use of the trace recorder is optional. + * See http://www.FreeRTOS.org/trace for more information. */ + configASSERT( xTraceInitialize() == TRC_SUCCESS ); + + /* Start the trace recording - the recording is written to a file if + * configASSERT() is called. */ + printf( + "Trace started.\r\n" + "Note that the trace output uses the ring buffer mode, meaning that the output trace\r\n" + "will only be the most recent data able to fit within the trace recorder buffer.\r\n\r\n" + "The trace will be dumped to the file \"%s\" whenever a call to configASSERT()\r\n" + "fails or the \'%c\' key is pressed.\r\n" + "Note that key presses cannot be captured in the Eclipse console, so for key presses to work\r\n" + "you will have to run this demo in a Windows console.\r\n\r\n", + mainTRACE_FILE_NAME, mainOUTPUT_TRACE_KEY ); + fflush( stdout ); + configASSERT( xTraceEnable( TRC_START ) == TRC_SUCCESS ); + } #endif /* if ( projCOVERAGE_TEST != 1 ) */ /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top * of this file. */ #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) - { - main_blinky(); - } + { + main_blinky(); + } #else - { - main_full(); - } + { + main_full(); + } #endif return 0; @@ -269,11 +269,11 @@ void vApplicationIdleHook( void ) * allocated by the kernel to any task that has since deleted itself. */ #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) - { - /* Call the idle task processing used by the full demo. The simple - * blinky demo does not use the idle task hook. */ - vFullDemoIdleFunction(); - } + { + /* Call the idle task processing used by the full demo. The simple + * blinky demo does not use the idle task hook. */ + vFullDemoIdleFunction(); + } #endif } /*-----------------------------------------------------------*/ @@ -296,15 +296,15 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask, void vApplicationTickHook( void ) { /* This function will be called by each tick interrupt if - * configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - * added here, but the tick hook is called from an interrupt context, so - * code must not attempt to block, and only the interrupt safe FreeRTOS API - * functions can be used (those that end in FromISR()). */ + * configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + * added here, but the tick hook is called from an interrupt context, so + * code must not attempt to block, and only the interrupt safe FreeRTOS API + * functions can be used (those that end in FromISR()). */ #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) - { - vFullDemoTickHookFunction(); - } + { + vFullDemoTickHookFunction(); + } #endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */ } /*-----------------------------------------------------------*/ @@ -337,11 +337,11 @@ void vAssertCalled( unsigned long ulLine, fflush( stdout ); #if ( projCOVERAGE_TEST != 1 ) - { - /* Stop the trace recording. */ - ( void ) xTraceDisable(); - prvSaveTraceFile(); - } + { + /* Stop the trace recording. */ + ( void ) xTraceDisable(); + prvSaveTraceFile(); + } #endif /* You can step out of this function to debug the assertion by using @@ -354,10 +354,10 @@ void vAssertCalled( unsigned long ulLine, } #if ( projCOVERAGE_TEST != 1 ) - { - /* Re-enable recording */ - ( void ) xTraceEnable( TRC_START ); - } + { + /* Re-enable recording */ + ( void ) xTraceEnable( TRC_START ); + } #endif } taskEXIT_CRITICAL(); @@ -368,24 +368,24 @@ static void prvSaveTraceFile( void ) { /* Tracing is not used when code coverage analysis is being performed. */ #if ( projCOVERAGE_TEST != 1 ) + { + FILE * pxOutputFile; + + pxOutputFile = fopen( mainTRACE_FILE_NAME, "wb" ); + + if( pxOutputFile != NULL ) + { + fwrite( RecorderDataPtr, sizeof( RecorderDataType ), 1, pxOutputFile ); + fclose( pxOutputFile ); + printf( "\r\nTrace output saved to %s\r\n", mainTRACE_FILE_NAME ); + fflush( stdout ); + } + else { - FILE * pxOutputFile; - - pxOutputFile = fopen( mainTRACE_FILE_NAME, "wb" ); - - if( pxOutputFile != NULL ) - { - fwrite( RecorderDataPtr, sizeof( RecorderDataType ), 1, pxOutputFile ); - fclose( pxOutputFile ); - printf( "\r\nTrace output saved to %s\r\n", mainTRACE_FILE_NAME ); - fflush( stdout ); - } - else - { - printf( "\r\nFailed to create trace dump file\r\n" ); - fflush( stdout ); - } + printf( "\r\nFailed to create trace dump file\r\n" ); + fflush( stdout ); } + } #endif /* if ( projCOVERAGE_TEST != 1 ) */ } /*-----------------------------------------------------------*/ @@ -565,6 +565,7 @@ static uint32_t prvKeyboardInterruptHandler( void ) case mainOUTPUT_TRACE_KEY: #if ( projCOVERAGE_TEST != 1 ) + /* Saving the trace file requires Windows system calls, so enter a critical * section to prevent deadlock or errors resulting from calling a Windows * system call from within the FreeRTOS simulator. */ diff --git a/FreeRTOS/Demo/WIN32-MingW/main_blinky.c b/FreeRTOS/Demo/WIN32-MingW/main_blinky.c index 4864b5c108c..a98dad1e319 100644 --- a/FreeRTOS/Demo/WIN32-MingW/main_blinky.c +++ b/FreeRTOS/Demo/WIN32-MingW/main_blinky.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -91,32 +91,32 @@ #include "semphr.h" /* Priorities at which the tasks are created. */ -#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* The rate at which data is sent to the queue. The times are converted from -milliseconds to ticks using the pdMS_TO_TICKS() macro. */ -#define mainTASK_SEND_FREQUENCY_MS pdMS_TO_TICKS( 200UL ) -#define mainTIMER_SEND_FREQUENCY_MS pdMS_TO_TICKS( 2000UL ) + * milliseconds to ticks using the pdMS_TO_TICKS() macro. */ +#define mainTASK_SEND_FREQUENCY_MS pdMS_TO_TICKS( 200UL ) +#define mainTIMER_SEND_FREQUENCY_MS pdMS_TO_TICKS( 2000UL ) /* The number of items the queue can hold at once. */ -#define mainQUEUE_LENGTH ( 2 ) +#define mainQUEUE_LENGTH ( 2 ) /* The values sent to the queue receive task from the queue send task and the -queue send software timer respectively. */ -#define mainVALUE_SENT_FROM_TASK ( 100UL ) -#define mainVALUE_SENT_FROM_TIMER ( 200UL ) + * queue send software timer respectively. */ +#define mainVALUE_SENT_FROM_TASK ( 100UL ) +#define mainVALUE_SENT_FROM_TIMER ( 200UL ) /* This demo allows for users to perform actions with the keyboard. */ -#define mainRESET_TIMER_KEY ( 'r' ) +#define mainRESET_TIMER_KEY ( 'r' ) /*-----------------------------------------------------------*/ /* * The tasks as described in the comments at the top of this file. */ -static void prvQueueReceiveTask( void *pvParameters ); -static void prvQueueSendTask( void *pvParameters ); +static void prvQueueReceiveTask( void * pvParameters ); +static void prvQueueSendTask( void * pvParameters ); /* * The callback function executed when the software timer expires. @@ -136,7 +136,7 @@ static TimerHandle_t xTimer = NULL; /*** SEE THE COMMENTS AT THE TOP OF THIS FILE ***/ void main_blinky( void ) { -const TickType_t xTimerPeriod = mainTIMER_SEND_FREQUENCY_MS; + const TickType_t xTimerPeriod = mainTIMER_SEND_FREQUENCY_MS; printf( "\r\nStarting the blinky demo. Press \'%c\' to reset the software timer used in this demo.\r\n\r\n", mainRESET_TIMER_KEY ); /* Create the queue. */ @@ -145,22 +145,22 @@ const TickType_t xTimerPeriod = mainTIMER_SEND_FREQUENCY_MS; if( xQueue != NULL ) { /* Start the two tasks as described in the comments at the top of this - file. */ - 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. */ - configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ - NULL, /* The parameter passed to the task - not used in this simple case. */ - mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ - NULL ); /* The task handle is not required, so NULL is passed. */ + * file. */ + 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. */ + configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ + NULL, /* The parameter passed to the task - not used in this simple case. */ + mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */ + NULL ); /* The task handle is not required, so NULL is passed. */ xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL ); /* Create the software timer, but don't start it yet. */ - xTimer = xTimerCreate( "Timer", /* The text name assigned to the software timer - for debug only as it is not used by the kernel. */ - xTimerPeriod, /* The period of the software timer in ticks. */ - pdTRUE, /* xAutoReload is set to pdTRUE. */ - NULL, /* The timer's ID is not used. */ - prvQueueSendTimerCallback ); /* The function executed when the timer expires. */ + xTimer = xTimerCreate( "Timer", /* The text name assigned to the software timer - for debug only as it is not used by the kernel. */ + xTimerPeriod, /* The period of the software timer in ticks. */ + pdTRUE, /* xAutoReload is set to pdTRUE. */ + NULL, /* The timer's ID is not used. */ + prvQueueSendTimerCallback ); /* The function executed when the timer expires. */ if( xTimer != NULL ) { @@ -172,19 +172,21 @@ const TickType_t xTimerPeriod = mainTIMER_SEND_FREQUENCY_MS; } /* 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 insufficient FreeRTOS heap memory available for the idle and/or - timer tasks to be created. See the memory management section on the - FreeRTOS web site for more details. */ - for( ;; ); + * line will never be reached. If the following line does execute, then + * there was insufficient FreeRTOS heap memory available for the idle and/or + * timer tasks to be created. See the memory management section on the + * FreeRTOS web site for more details. */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ -static void prvQueueSendTask( void *pvParameters ) +static void prvQueueSendTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const TickType_t xBlockTime = mainTASK_SEND_FREQUENCY_MS; -const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TASK; + TickType_t xNextWakeTime; + const TickType_t xBlockTime = mainTASK_SEND_FREQUENCY_MS; + const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TASK; /* Prevent the compiler warning about the unused parameter. */ ( void ) pvParameters; @@ -192,18 +194,18 @@ const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TASK; /* Initialise xNextWakeTime - this only needs to be done once. */ xNextWakeTime = xTaskGetTickCount(); - for( ;; ) + for( ; ; ) { /* Place this task in the blocked state until it is time to run again. - The block time is specified in ticks, pdMS_TO_TICKS() was used to - convert a time specified in milliseconds into a time specified in ticks. - While in the Blocked state this task will not consume any CPU time. */ + * The block time is specified in ticks, pdMS_TO_TICKS() was used to + * convert a time specified in milliseconds into a time specified in ticks. + * While in the Blocked state this task will not consume any CPU time. */ vTaskDelayUntil( &xNextWakeTime, xBlockTime ); /* Send to the queue - causing the queue receive task to unblock and - write to the console. 0 is used as the block time so the send operation - will not block - it shouldn't need to block as the queue should always - have at least one space at this point in the code. */ + * write to the console. 0 is used as the block time so the send operation + * will not block - it shouldn't need to block as the queue should always + * have at least one space at this point in the code. */ xQueueSend( xQueue, &ulValueToSend, 0U ); } } @@ -211,50 +213,50 @@ const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TASK; static void prvQueueSendTimerCallback( TimerHandle_t xTimerHandle ) { -const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TIMER; + const uint32_t ulValueToSend = mainVALUE_SENT_FROM_TIMER; /* This is the software timer callback function. The software timer has a - period of two seconds and is reset each time a key is pressed. This - callback function will execute if the timer expires, which will only happen - if a key is not pressed for two seconds. */ + * period of two seconds and is reset each time a key is pressed. This + * callback function will execute if the timer expires, which will only happen + * if a key is not pressed for two seconds. */ /* Avoid compiler warnings resulting from the unused parameter. */ ( void ) xTimerHandle; /* Send to the queue - causing the queue receive task to unblock and - write out a message. This function is called from the timer/daemon task, so - must not block. Hence the block time is set to 0. */ + * write out a message. This function is called from the timer/daemon task, so + * must not block. Hence the block time is set to 0. */ xQueueSend( xQueue, &ulValueToSend, 0U ); } /*-----------------------------------------------------------*/ -static void prvQueueReceiveTask( void *pvParameters ) +static void prvQueueReceiveTask( void * pvParameters ) { -uint32_t ulReceivedValue; + uint32_t ulReceivedValue; /* Prevent the compiler warning about the unused parameter. */ ( void ) pvParameters; - for( ;; ) + for( ; ; ) { /* Wait until something arrives in the queue - this task will block - indefinitely provided INCLUDE_vTaskSuspend is set to 1 in - FreeRTOSConfig.h. It will not use any CPU time while it is in the - Blocked state. */ + * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in + * FreeRTOSConfig.h. It will not use any CPU time while it is in the + * Blocked state. */ xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); /* Enter critical section to use printf. Not doing this could potentially cause - a deadlock if the FreeRTOS simulator switches contexts and another task - tries to call printf - it should be noted that use of printf within - the FreeRTOS simulator is unsafe, but used here for simplicity. */ + * a deadlock if the FreeRTOS simulator switches contexts and another task + * tries to call printf - it should be noted that use of printf within + * the FreeRTOS simulator is unsafe, but used here for simplicity. */ taskENTER_CRITICAL(); { /* To get here something must have been received from the queue, but - is it an expected value? Normally calling printf() from a task is not - a good idea. Here there is lots of stack space and only one task is - using console IO so it is ok. However, note the comments at the top of - this file about the risks of making Windows system calls (such as - console output) from a FreeRTOS task. */ + * is it an expected value? Normally calling printf() from a task is not + * a good idea. Here there is lots of stack space and only one task is + * using console IO so it is ok. However, note the comments at the top of + * this file about the risks of making Windows system calls (such as + * console output) from a FreeRTOS task. */ if( ulReceivedValue == mainVALUE_SENT_FROM_TASK ) { printf( "Message received from task\r\n" ); @@ -280,30 +282,28 @@ uint32_t ulReceivedValue; void vBlinkyKeyboardInterruptHandler( int xKeyPressed ) { /* Handle keyboard input. */ - switch ( xKeyPressed ) + switch( xKeyPressed ) { + case mainRESET_TIMER_KEY: - case mainRESET_TIMER_KEY: - - if ( xTimer != NULL ) - { - /* Critical section around printf to prevent a deadlock - on context switch. */ - portENTER_CRITICAL(); + if( xTimer != NULL ) { - printf("\r\nResetting software timer.\r\n\r\n"); + /* Critical section around printf to prevent a deadlock + * on context switch. */ + portENTER_CRITICAL(); + { + printf( "\r\nResetting software timer.\r\n\r\n" ); + } + portEXIT_CRITICAL(); + + /* Reset the software timer. */ + xTimerReset( xTimer, portMAX_DELAY ); } - portEXIT_CRITICAL(); - /* Reset the software timer. */ - xTimerReset( xTimer, portMAX_DELAY ); - } - - break; + break; - default: + default: - break; + break; } } - diff --git a/FreeRTOS/Demo/WIN32-MingW/main_full.c b/FreeRTOS/Demo/WIN32-MingW/main_full.c index 6b202636942..03317e22b2d 100644 --- a/FreeRTOS/Demo/WIN32-MingW/main_full.c +++ b/FreeRTOS/Demo/WIN32-MingW/main_full.c @@ -107,18 +107,18 @@ #include "MessageBufferAMP.h" /* Priorities at which the tasks are created. */ -#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainQUEUE_OVERWRITE_PRIORITY ( tskIDLE_PRIORITY ) - -#define mainTIMER_TEST_PERIOD ( 50 ) +#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainQUEUE_OVERWRITE_PRIORITY ( tskIDLE_PRIORITY ) + +#define mainTIMER_TEST_PERIOD ( 50 ) /* * Exercises code that is not otherwise covered by the standard demo/test @@ -127,11 +127,11 @@ extern BaseType_t xRunCodeCoverageTestAdditions( void ); /* Task function prototypes. */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); /* A task that is created from the idle task to test the functionality of -eTaskStateGet(). */ -static void prvTestTask( void *pvParameters ); + * eTaskStateGet(). */ +static void prvTestTask( void * pvParameters ); /* * Called from the idle task hook function to demonstrate a few utility @@ -149,7 +149,8 @@ static void prvDemonstratePendingFunctionCall( void ); /* * The function that is pended by prvDemonstratePendingFunctionCall(). */ -static void prvPendedFunction( void *pvParameter1, uint32_t ulParameter2 ); +static void prvPendedFunction( void * pvParameter1, + uint32_t ulParameter2 ); /* * prvDemonstrateTimerQueryFunctions() is called from the idle task hook @@ -163,28 +164,28 @@ static void prvTestTimerCallback( TimerHandle_t xTimer ); /* * A task to demonstrate the use of the xQueueSpacesAvailable() function. */ -static void prvDemoQueueSpaceFunctions( void *pvParameters ); +static void prvDemoQueueSpaceFunctions( void * pvParameters ); /* * Tasks that ensure indefinite delays are truly indefinite. */ -static void prvPermanentlyBlockingSemaphoreTask( void *pvParameters ); -static void prvPermanentlyBlockingNotificationTask( void *pvParameters ); +static void prvPermanentlyBlockingSemaphoreTask( void * pvParameters ); +static void prvPermanentlyBlockingNotificationTask( void * pvParameters ); /* * The test function and callback function used when exercising the timer AP * function that changes the timer's auto-reload mode. */ -static void prvDemonstrateChangingTimerReloadMode( void *pvParameters ); +static void prvDemonstrateChangingTimerReloadMode( void * pvParameters ); static void prvReloadModeTestTimerCallback( TimerHandle_t xTimer ); /*-----------------------------------------------------------*/ /* The variable into which error messages are latched. */ -static char *pcStatusMessage = "No errors"; +static char * pcStatusMessage = "No errors"; /* This semaphore is created purely to test using the vSemaphoreDelete() and -semaphore tracing API functions. It has no other purpose. */ + * semaphore tracing API functions. It has no other purpose. */ static SemaphoreHandle_t xMutexToDelete = NULL; /*-----------------------------------------------------------*/ @@ -224,13 +225,13 @@ int main_full( void ) vStartStreamBufferInterruptDemo(); vStartMessageBufferAMPTasks( configMINIMAL_STACK_SIZE ); - #if( configSUPPORT_STATIC_ALLOCATION == 1 ) + #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) { vStartStaticallyAllocatedTasks(); } #endif - #if( configUSE_PREEMPTION != 0 ) + #if ( configUSE_PREEMPTION != 0 ) { /* Don't expect these tasks to pass when preemption is not used. */ vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); @@ -238,29 +239,29 @@ int main_full( void ) #endif /* The suicide tasks must be created last as they need to know how many - tasks were running prior to their creation. This then allows them to - ascertain whether or not the correct/expected number of tasks are running at - any given time. */ + * tasks were running prior to their creation. This then allows them to + * ascertain whether or not the correct/expected number of tasks are running at + * any given time. */ vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); /* Create the semaphore that will be deleted in the idle task hook. This - is done purely to test the use of vSemaphoreDelete(). */ + * is done purely to test the use of vSemaphoreDelete(). */ xMutexToDelete = xSemaphoreCreateMutex(); /* Start the scheduler itself. */ vTaskStartScheduler(); /* Should never get here unless there was not enough heap space to create - the idle and other system tasks. */ + * the idle and other system tasks. */ return 0; } /*-----------------------------------------------------------*/ -static void prvCheckTask( void *pvParameters ) +static void prvCheckTask( void * pvParameters ) { -TickType_t xNextWakeTime; -const TickType_t xCyclePeriod = pdMS_TO_TICKS( 5000UL ); -HeapStats_t xHeapStats; + TickType_t xNextWakeTime; + const TickType_t xCyclePeriod = pdMS_TO_TICKS( 5000UL ); + HeapStats_t xHeapStats; /* Just to remove compiler warning. */ ( void ) pvParameters; @@ -268,13 +269,13 @@ HeapStats_t xHeapStats; /* Initialise xNextWakeTime - this only needs to be done once. */ xNextWakeTime = xTaskGetTickCount(); - for( ;; ) + for( ; ; ) { /* Place this task in the blocked state until it is time to run again. */ vTaskDelayUntil( &xNextWakeTime, xCyclePeriod ); /* Check the standard demo tasks are running without error. */ - #if( configUSE_PREEMPTION != 0 ) + #if ( configUSE_PREEMPTION != 0 ) { /* These tasks are only created when preemption is used. */ if( xAreTimerDemoTasksStillRunning( xCyclePeriod ) != pdTRUE ) @@ -377,7 +378,7 @@ HeapStats_t xHeapStats; pcStatusMessage = "Error: Message buffer AMP"; } - #if( configSUPPORT_STATIC_ALLOCATION == 1 ) + #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) else if( xAreStaticAllocationTasksStillRunning() != pdPASS ) { pcStatusMessage = "Error: Static allocation"; @@ -385,38 +386,38 @@ HeapStats_t xHeapStats; #endif /* configSUPPORT_STATIC_ALLOCATION */ /* This is the only task that uses stdout so its ok to call printf() - directly. */ + * directly. */ vPortGetHeapStats( &xHeapStats ); configASSERT( xHeapStats.xAvailableHeapSpaceInBytes == xPortGetFreeHeapSize() ); configASSERT( xHeapStats.xMinimumEverFreeBytesRemaining == xPortGetMinimumEverFreeHeapSize() ); printf( "%s - tick count %u - free heap %u - min free heap %u - largest free block %u - number of free blocks %u\r\n", - pcStatusMessage, - xTaskGetTickCount(), - xHeapStats.xAvailableHeapSpaceInBytes, - xHeapStats.xMinimumEverFreeBytesRemaining, - xHeapStats.xSizeOfLargestFreeBlockInBytes, - xHeapStats.xNumberOfFreeBlocks ); + pcStatusMessage, + xTaskGetTickCount(), + xHeapStats.xAvailableHeapSpaceInBytes, + xHeapStats.xMinimumEverFreeBytesRemaining, + xHeapStats.xSizeOfLargestFreeBlockInBytes, + xHeapStats.xNumberOfFreeBlocks ); fflush( stdout ); } } /*-----------------------------------------------------------*/ -static void prvTestTask( void *pvParameters ) +static void prvTestTask( void * pvParameters ) { -const unsigned long ulMSToSleep = 5; + const unsigned long ulMSToSleep = 5; /* Just to remove compiler warnings. */ ( void ) pvParameters; /* This task is just used to test the eTaskStateGet() function. It - does not have anything to do. */ - for( ;; ) + * does not have anything to do. */ + for( ; ; ) { /* Sleep to reduce CPU load, but don't sleep indefinitely in case there are - tasks waiting to be terminated by the idle task. */ + * tasks waiting to be terminated by the idle task. */ Sleep( ulMSToSleep ); } } @@ -425,35 +426,35 @@ const unsigned long ulMSToSleep = 5; /* Called from vApplicationIdleHook(), which is defined in main.c. */ void vFullDemoIdleFunction( void ) { -const unsigned long ulMSToSleep = 15; -void *pvAllocated; + const unsigned long ulMSToSleep = 15; + void * pvAllocated; /* Sleep to reduce CPU load, but don't sleep indefinitely in case there are - tasks waiting to be terminated by the idle task. */ + * tasks waiting to be terminated by the idle task. */ Sleep( ulMSToSleep ); /* Demonstrate a few utility functions that are not demonstrated by any of - the standard demo tasks. */ + * the standard demo tasks. */ prvDemonstrateTaskStateAndHandleGetFunctions(); /* Demonstrate the use of xTimerPendFunctionCall(), which is not - demonstrated by any of the standard demo tasks. */ + * demonstrated by any of the standard demo tasks. */ prvDemonstratePendingFunctionCall(); /* Demonstrate the use of functions that query information about a software - timer. */ + * timer. */ prvDemonstrateTimerQueryFunctions(); /* If xMutexToDelete has not already been deleted, then delete it now. - This is done purely to demonstrate the use of, and test, the - vSemaphoreDelete() macro. Care must be taken not to delete a semaphore - that has tasks blocked on it. */ + * This is done purely to demonstrate the use of, and test, the + * vSemaphoreDelete() macro. Care must be taken not to delete a semaphore + * that has tasks blocked on it. */ if( xMutexToDelete != NULL ) { /* For test purposes, add the mutex to the registry, then remove it - again, before it is deleted - checking its name is as expected before - and after the assertion into the registry and its removal from the - registry. */ + * again, before it is deleted - checking its name is as expected before + * and after the assertion into the registry and its removal from the + * registry. */ configASSERT( pcQueueGetName( xMutexToDelete ) == NULL ); vQueueAddToRegistry( xMutexToDelete, "Test_Mutex" ); configASSERT( strcmp( pcQueueGetName( xMutexToDelete ), "Test_Mutex" ) == 0 ); @@ -465,13 +466,13 @@ void *pvAllocated; } /* Exercise heap_5 a bit. The malloc failed hook will trap failed - allocations so there is no need to test here. */ + * allocations so there is no need to test here. */ pvAllocated = pvPortMalloc( ( rand() % 500 ) + 1 ); vPortFree( pvAllocated ); /* Exit after a fixed time so code coverage results are written to the - disk. */ - #if( projCOVERAGE_TEST == 1 ) + * disk. */ + #if ( projCOVERAGE_TEST == 1 ) { const TickType_t xMaxRunTime = pdMS_TO_TICKS( 30000UL ); @@ -486,18 +487,18 @@ void *pvAllocated; vTaskEndScheduler(); } } - #endif + #endif /* if ( projCOVERAGE_TEST == 1 ) */ } /*-----------------------------------------------------------*/ /* Called by vApplicationTickHook(), which is defined in main.c. */ void vFullDemoTickHookFunction( void ) { -TaskHandle_t xTimerTask; + TaskHandle_t xTimerTask; /* Call the periodic timer test, which tests the timer API functions that - can be called from an ISR. */ - #if( configUSE_PREEMPTION != 0 ) + * can be called from an ISR. */ + #if ( configUSE_PREEMPTION != 0 ) { /* Only created when preemption is used. */ vTimerPeriodicISRTests(); @@ -508,7 +509,7 @@ TaskHandle_t xTimerTask; vQueueOverwritePeriodicISRDemo(); /* Write to a queue that is in use as part of the queue set demo to - demonstrate using queue sets from an ISR. */ + * demonstrate using queue sets from an ISR. */ vQueueSetAccessQueueSetFromISR(); vQueueSetPollingInterruptAccess(); @@ -522,11 +523,11 @@ TaskHandle_t xTimerTask; xNotifyTaskFromISR(); /* Writes to stream buffer byte by byte to test the stream buffer trigger - level functionality. */ + * level functionality. */ vPeriodicStreamBufferProcessing(); /* 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(); /* For code coverage purposes. */ @@ -536,10 +537,11 @@ TaskHandle_t xTimerTask; } /*-----------------------------------------------------------*/ -static void prvPendedFunction( void *pvParameter1, uint32_t ulParameter2 ) +static void prvPendedFunction( void * pvParameter1, + uint32_t ulParameter2 ) { -static uint32_t ulLastParameter1 = 1000UL, ulLastParameter2 = 0UL; -uint32_t ulParameter1; + static uint32_t ulLastParameter1 = 1000UL, ulLastParameter2 = 0UL; + uint32_t ulParameter1; ulParameter1 = ( uint32_t ) pvParameter1; @@ -560,17 +562,17 @@ uint32_t ulParameter1; static void prvTestTimerCallback( TimerHandle_t xTimer ) { /* This is the callback function for the timer accessed by - prvDemonstrateTimerQueryFunctions(). The callback does not do anything. */ + * prvDemonstrateTimerQueryFunctions(). The callback does not do anything. */ ( void ) xTimer; } /*-----------------------------------------------------------*/ static void prvDemonstrateTimerQueryFunctions( void ) { -static TimerHandle_t xTimer = NULL; -const char *pcTimerName = "TestTimer"; -volatile TickType_t xExpiryTime; -const TickType_t xDontBlock = 0; + static TimerHandle_t xTimer = NULL; + const char * pcTimerName = "TestTimer"; + volatile TickType_t xExpiryTime; + const TickType_t xDontBlock = 0; if( xTimer == NULL ) { @@ -579,7 +581,7 @@ const TickType_t xDontBlock = 0; if( xTimer != NULL ) { /* Called from the idle task so a block time must not be - specified. */ + * specified. */ xTimerStart( xTimer, xDontBlock ); } } @@ -593,11 +595,11 @@ const TickType_t xDontBlock = 0; configASSERT( xTimerGetPeriod( xTimer ) == portMAX_DELAY ); /* Demonstrate querying a timer's next expiry time, although nothing is - done with the returned value. Note if the expiry time is less than the - maximum tick count then the expiry time has overflowed from the current - time. In this case the expiry time was set to portMAX_DELAY, so it is - expected to be less than the current time until the current time has - itself overflowed. */ + * done with the returned value. Note if the expiry time is less than the + * maximum tick count then the expiry time has overflowed from the current + * time. In this case the expiry time was set to portMAX_DELAY, so it is + * expected to be less than the current time until the current time has + * itself overflowed. */ xExpiryTime = xTimerGetExpiryTime( xTimer ); ( void ) xExpiryTime; } @@ -606,11 +608,12 @@ const TickType_t xDontBlock = 0; static void prvDemonstratePendingFunctionCall( void ) { -static uint32_t ulParameter1 = 1000UL, ulParameter2 = 0UL; -const TickType_t xDontBlock = 0; /* This is called from the idle task so must *not* attempt to block. */ + static uint32_t ulParameter1 = 1000UL, ulParameter2 = 0UL; + const TickType_t xDontBlock = 0; /* This is called from the idle task so must *not* attempt to block. */ /* prvPendedFunction() just expects the parameters to be incremented by one - each time it is called. */ + * each time it is called. */ + ulParameter1++; ulParameter2++; @@ -621,30 +624,30 @@ const TickType_t xDontBlock = 0; /* This is called from the idle task so must *n static void prvDemonstrateTaskStateAndHandleGetFunctions( void ) { -TaskHandle_t xIdleTaskHandle, xTimerTaskHandle; -char *pcTaskName; -static portBASE_TYPE xPerformedOneShotTests = pdFALSE; -TaskHandle_t xTestTask; -TaskStatus_t xTaskInfo; -extern StackType_t uxTimerTaskStack[]; -static uint32_t ulLastIdleExecutionTime = 0; -uint32_t ulIdleExecutionTime; + TaskHandle_t xIdleTaskHandle, xTimerTaskHandle; + char * pcTaskName; + static portBASE_TYPE xPerformedOneShotTests = pdFALSE; + TaskHandle_t xTestTask; + TaskStatus_t xTaskInfo; + extern StackType_t uxTimerTaskStack[]; + static uint32_t ulLastIdleExecutionTime = 0; + uint32_t ulIdleExecutionTime; /* Demonstrate the use of the xTimerGetTimerDaemonTaskHandle() and - xTaskGetIdleTaskHandle() functions. Also try using the function that sets - the task number. */ + * xTaskGetIdleTaskHandle() functions. Also try using the function that sets + * the task number. */ xIdleTaskHandle = xTaskGetIdleTaskHandle(); xTimerTaskHandle = xTimerGetTimerDaemonTaskHandle(); /* This is the idle hook, so the current task handle should equal the - returned idle task handle. */ + * returned idle task handle. */ if( xTaskGetCurrentTaskHandle() != xIdleTaskHandle ) { pcStatusMessage = "Error: Returned idle task handle was incorrect"; } /* Check the same handle is obtained using the idle task's name. First try - with the wrong name, then the right name. */ + * with the wrong name, then the right name. */ if( xTaskGetHandle( "Idle" ) == xIdleTaskHandle ) { pcStatusMessage = "Error: Returned handle for name Idle was incorrect"; @@ -657,6 +660,7 @@ uint32_t ulIdleExecutionTime; /* Check the timer task handle was returned correctly. */ pcTaskName = pcTaskGetName( xTimerTaskHandle ); + if( strcmp( pcTaskName, "Tmr Svc" ) != 0 ) { pcStatusMessage = "Error: Returned timer task handle was incorrect"; @@ -680,24 +684,24 @@ uint32_t ulIdleExecutionTime; } /* Also with the vTaskGetInfo() function. */ - vTaskGetInfo( xTimerTaskHandle, /* The task being queried. */ - &xTaskInfo, /* The structure into which information on the task will be written. */ - pdTRUE, /* Include the task's high watermark in the structure. */ - eInvalid ); /* Include the task state in the structure. */ + vTaskGetInfo( xTimerTaskHandle, /* The task being queried. */ + &xTaskInfo, /* The structure into which information on the task will be written. */ + pdTRUE, /* Include the task's high watermark in the structure. */ + eInvalid ); /* Include the task state in the structure. */ /* Check the information returned by vTaskGetInfo() is as expected. */ - if( ( xTaskInfo.eCurrentState != eBlocked ) || - ( strcmp( xTaskInfo.pcTaskName, "Tmr Svc" ) != 0 ) || + if( ( xTaskInfo.eCurrentState != eBlocked ) || + ( strcmp( xTaskInfo.pcTaskName, "Tmr Svc" ) != 0 ) || ( xTaskInfo.uxCurrentPriority != configTIMER_TASK_PRIORITY ) || - ( xTaskInfo.pxStackBase != uxTimerTaskStack ) || + ( xTaskInfo.pxStackBase != uxTimerTaskStack ) || ( xTaskInfo.xHandle != xTimerTaskHandle ) ) { pcStatusMessage = "Error: vTaskGetInfo() returned incorrect information about the timer task"; } /* Other tests that should only be performed once follow. The test task - is not created on each iteration because to do so would cause the death - task to report an error (too many tasks running). */ + * is not created on each iteration because to do so would cause the death + * task to report an error (too many tasks running). */ if( xPerformedOneShotTests == pdFALSE ) { /* Don't run this part of the test again. */ @@ -714,6 +718,7 @@ uint32_t ulIdleExecutionTime; /* Now suspend the test task and check its state is reported correctly. */ vTaskSuspend( xTestTask ); + if( eTaskStateGet( xTestTask ) != eSuspended ) { pcStatusMessage = "Error: Returned test task state was incorrect 2"; @@ -721,6 +726,7 @@ uint32_t ulIdleExecutionTime; /* Now delete the task and check its state is reported correctly. */ vTaskDelete( xTestTask ); + if( eTaskStateGet( xTestTask ) != eDeleted ) { pcStatusMessage = "Error: Returned test task state was incorrect 3"; @@ -729,29 +735,31 @@ uint32_t ulIdleExecutionTime; } ulIdleExecutionTime = ulTaskGetIdleRunTimeCounter(); + if( ulIdleExecutionTime == ulLastIdleExecutionTime ) { pcStatusMessage = "Error: Total amount of Idle task execution time did not change"; } + ulLastIdleExecutionTime = ulIdleExecutionTime; } /*-----------------------------------------------------------*/ -static void prvDemoQueueSpaceFunctions( void *pvParameters ) +static void prvDemoQueueSpaceFunctions( void * pvParameters ) { -QueueHandle_t xQueue = NULL; -const unsigned portBASE_TYPE uxQueueLength = 10; -unsigned portBASE_TYPE uxReturn, x; + QueueHandle_t xQueue = NULL; + const unsigned portBASE_TYPE uxQueueLength = 10; + unsigned portBASE_TYPE uxReturn, x; /* Remove compiler warnings. */ ( void ) pvParameters; /* Create the queue that will be used. Nothing is actually going to be - sent or received so the queue item size is set to 0. */ + * sent or received so the queue item size is set to 0. */ xQueue = xQueueCreate( uxQueueLength, 0 ); configASSERT( xQueue ); - for( ;; ) + for( ; ; ) { for( x = 0; x < uxQueueLength; x++ ) { @@ -759,11 +767,11 @@ unsigned portBASE_TYPE uxReturn, x; uxReturn = uxQueueMessagesWaiting( xQueue ); /* Check the number of messages being reported as being available - is as expected, and force an assert if not. */ + * is as expected, and force an assert if not. */ if( uxReturn != x ) { /* xQueue cannot be NULL so this is deliberately causing an - assert to be triggered as there is an error. */ + * assert to be triggered as there is an error. */ configASSERT( xQueue == NULL ); } @@ -771,11 +779,11 @@ unsigned portBASE_TYPE uxReturn, x; uxReturn = uxQueueSpacesAvailable( xQueue ); /* Check the number of spaces being reported as being available - is as expected, and force an assert if not. */ + * is as expected, and force an assert if not. */ if( uxReturn != ( uxQueueLength - x ) ) { /* xQueue cannot be NULL so this is deliberately causing an - assert to be triggered as there is an error. */ + * assert to be triggered as there is an error. */ configASSERT( xQueue == NULL ); } @@ -785,6 +793,7 @@ unsigned portBASE_TYPE uxReturn, x; /* Perform the same check while the queue is full. */ uxReturn = uxQueueMessagesWaiting( xQueue ); + if( uxReturn != uxQueueLength ) { configASSERT( xQueue == NULL ); @@ -800,19 +809,19 @@ unsigned portBASE_TYPE uxReturn, x; /* The queue is full, start again. */ xQueueReset( xQueue ); - #if( configUSE_PREEMPTION == 0 ) + #if ( configUSE_PREEMPTION == 0 ) taskYIELD(); #endif } } /*-----------------------------------------------------------*/ -static void prvPermanentlyBlockingSemaphoreTask( void *pvParameters ) +static void prvPermanentlyBlockingSemaphoreTask( void * pvParameters ) { -SemaphoreHandle_t xSemaphore; + SemaphoreHandle_t xSemaphore; /* Prevent compiler warning about unused parameter in the case that - configASSERT() is not defined. */ + * configASSERT() is not defined. */ ( void ) pvParameters; /* This task should block on a semaphore, and never return. */ @@ -822,23 +831,23 @@ SemaphoreHandle_t xSemaphore; xSemaphoreTake( xSemaphore, portMAX_DELAY ); /* The above xSemaphoreTake() call should never return, force an assert if - it does. */ + * it does. */ configASSERT( pvParameters != NULL ); vTaskDelete( NULL ); } /*-----------------------------------------------------------*/ -static void prvPermanentlyBlockingNotificationTask( void *pvParameters ) +static void prvPermanentlyBlockingNotificationTask( void * pvParameters ) { /* Prevent compiler warning about unused parameter in the case that - configASSERT() is not defined. */ + * configASSERT() is not defined. */ ( void ) pvParameters; /* This task should block on a task notification, and never return. */ ulTaskNotifyTake( pdTRUE, portMAX_DELAY ); /* The above ulTaskNotifyTake() call should never return, force an assert - if it does. */ + * if it does. */ configASSERT( pvParameters != NULL ); vTaskDelete( NULL ); } @@ -846,7 +855,7 @@ static void prvPermanentlyBlockingNotificationTask( void *pvParameters ) static void prvReloadModeTestTimerCallback( TimerHandle_t xTimer ) { -uint32_t ulTimerID; + uint32_t ulTimerID; /* Increment the timer's ID to show the callback has executed. */ ulTimerID = ( uint32_t ) pvTimerGetTimerID( xTimer ); @@ -855,7 +864,7 @@ uint32_t ulTimerID; } /*-----------------------------------------------------------*/ -static void prvDemonstrateChangingTimerReloadMode( void *pvParameters ) +static void prvDemonstrateChangingTimerReloadMode( void * pvParameters ) { TimerHandle_t xTimer; const char * const pcTimerName = "TestTimer"; @@ -865,7 +874,7 @@ static void prvDemonstrateChangingTimerReloadMode( void *pvParameters ) ( void ) pvParameters; /* The duration of 1 period is kept at 50ms to allow IDLE task to - * free up this task's resources before suicidal tests can run. */ + * free up this task's resources before suicidal tests can run. */ xTimer = xTimerCreate( pcTimerName, x50ms, pdFALSE, /* Created as a one-shot timer. */ diff --git a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/FreeRTOSConfig.h b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/FreeRTOSConfig.h index 3cd6855c1ec..f8598f3cc06 100644 --- a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.c b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.c index 742c037b317..3f7a81e3b63 100644 --- a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.c +++ b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.h b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.h index f5347ec8b2e..b6cf978339e 100644 --- a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.h +++ b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/HTTP_Serv.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/TCP.c b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/TCP.c index 899c664667f..03a20a03ef9 100644 --- a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/TCP.c +++ b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/TCP.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/TCP.h b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/TCP.h index aa62732c3de..1b28e7b83ce 100644 --- a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/TCP.h +++ b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/TCP.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/TCPISR.c b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/TCPISR.c index 2cf0615479b..2770c7f4832 100644 --- a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/TCPISR.c +++ b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/TCPISR.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/html_pages.h b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/html_pages.h index 6c3acce8c29..1eb3d085f7d 100644 --- a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/html_pages.h +++ b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/html_pages.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/i2c.c b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/i2c.c index 4631c2134e5..38f4c6be8dd 100644 --- a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/i2c.c +++ b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/i2c.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/i2c.h b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/i2c.h index 10282fa867b..ab565afaab1 100644 --- a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/i2c.h +++ b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/i2c.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/i2cISR.c b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/i2cISR.c index 6eabeb36579..ec18665de47 100644 --- a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/i2cISR.c +++ b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/i2cISR.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/main.c b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/main.c index 6e1507d5d56..8a1b0dbca4f 100644 --- a/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/main.c +++ b/FreeRTOS/Demo/WizNET_DEMO_GCC_ARM7/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -25,12 +25,12 @@ */ /* - NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. - The processor MUST be in supervisor mode when vTaskStartScheduler is - called. The demo applications included in the FreeRTOS.org download switch - to supervisor mode prior to main being called. If you are not using one of - these demo application projects then ensure Supervisor mode is used. -*/ + * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + * The processor MUST be in supervisor mode when vTaskStartScheduler is + * called. The demo applications included in the FreeRTOS.org download switch + * to supervisor mode prior to main being called. If you are not using one of + * these demo application projects then ensure Supervisor mode is used. + */ /* @@ -69,37 +69,37 @@ /*-----------------------------------------------------------*/ /* Constants to setup the PLL. */ -#define mainPLL_MUL_4 ( ( unsigned char ) 0x0003 ) -#define mainPLL_DIV_1 ( ( unsigned char ) 0x0000 ) -#define mainPLL_ENABLE ( ( unsigned char ) 0x0001 ) -#define mainPLL_CONNECT ( ( unsigned char ) 0x0003 ) -#define mainPLL_FEED_BYTE1 ( ( unsigned char ) 0xaa ) -#define mainPLL_FEED_BYTE2 ( ( unsigned char ) 0x55 ) -#define mainPLL_LOCK ( ( unsigned long ) 0x0400 ) +#define mainPLL_MUL_4 ( ( unsigned char ) 0x0003 ) +#define mainPLL_DIV_1 ( ( unsigned char ) 0x0000 ) +#define mainPLL_ENABLE ( ( unsigned char ) 0x0001 ) +#define mainPLL_CONNECT ( ( unsigned char ) 0x0003 ) +#define mainPLL_FEED_BYTE1 ( ( unsigned char ) 0xaa ) +#define mainPLL_FEED_BYTE2 ( ( unsigned char ) 0x55 ) +#define mainPLL_LOCK ( ( unsigned long ) 0x0400 ) /* Constants to setup the MAM. */ -#define mainMAM_TIM_3 ( ( unsigned char ) 0x03 ) -#define mainMAM_MODE_FULL ( ( unsigned char ) 0x02 ) +#define mainMAM_TIM_3 ( ( unsigned char ) 0x03 ) +#define mainMAM_MODE_FULL ( ( unsigned char ) 0x02 ) /* Constants to setup the peripheral bus. */ -#define mainBUS_CLK_FULL ( ( unsigned char ) 0x01 ) +#define mainBUS_CLK_FULL ( ( unsigned char ) 0x01 ) /* Constants to setup I/O and processor. */ -#define mainBUS_CLK_FULL ( ( unsigned char ) 0x01 ) -#define mainLED_TO_OUTPUT ( ( unsigned long ) 0xff0000 ) -#define mainJTAG_PORT ( ( unsigned long ) 0x3E0000UL ) +#define mainBUS_CLK_FULL ( ( unsigned char ) 0x01 ) +#define mainLED_TO_OUTPUT ( ( unsigned long ) 0xff0000 ) +#define mainJTAG_PORT ( ( unsigned long ) 0x3E0000UL ) /* Priorities for the demo application tasks. */ -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainHTTP_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainERROR_CHECK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainHTTP_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainERROR_CHECK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* Flash rates of the on board LED to indicate the health of the system. */ -#define mainNO_ERROR_DELAY ( 3000 ) -#define mainERROR_DELAY ( 500 ) -#define mainON_BOARD_LED_BIT ( ( unsigned long ) 0x80 ) +#define mainNO_ERROR_DELAY ( 3000 ) +#define mainERROR_DELAY ( 500 ) +#define mainON_BOARD_LED_BIT ( ( unsigned long ) 0x80 ) /*-----------------------------------------------------------*/ @@ -117,7 +117,7 @@ static void prvSetupHardware( void ); /* * Simply check for errors and toggle the onboard LED. */ -static void prvErrorChecks( void *pvParameters ); +static void prvErrorChecks( void * pvParameters ); /* * Return true if the demo tasks are executing without error - otherwise @@ -135,158 +135,160 @@ long lErrorInTask = pdFALSE; */ int main( void ) { - /* Setup the hardware for use with the Olimex demo board. */ - prvSetupHardware(); - - /* Start the standard flash tasks so the WEB server is not the only thing - running. */ - vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - vStartSemaphoreTasks( tskIDLE_PRIORITY ); - vStartDynamicPriorityTasks(); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - - /* Start the WEB server task and the error check task. */ - xTaskCreate( vHTTPServerTask, "HTTP", configMINIMAL_STACK_SIZE, NULL, mainHTTP_TASK_PRIORITY, NULL ); - xTaskCreate( prvErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainERROR_CHECK_PRIORITY, NULL ); - - /* Now all the tasks have been started - start the scheduler. - - NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. - The processor MUST be in supervisor mode when vTaskStartScheduler is - called. The demo applications included in the FreeRTOS.org download switch - to supervisor mode prior to main being called. If you are not using one of - these demo application projects then ensure Supervisor mode is used. */ - vTaskStartScheduler(); - - /* Should never reach here! */ - return 0; + /* Setup the hardware for use with the Olimex demo board. */ + prvSetupHardware(); + + /* Start the standard flash tasks so the WEB server is not the only thing + * running. */ + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + vStartSemaphoreTasks( tskIDLE_PRIORITY ); + vStartDynamicPriorityTasks(); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + + /* Start the WEB server task and the error check task. */ + xTaskCreate( vHTTPServerTask, "HTTP", configMINIMAL_STACK_SIZE, NULL, mainHTTP_TASK_PRIORITY, NULL ); + xTaskCreate( prvErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainERROR_CHECK_PRIORITY, NULL ); + + /* Now all the tasks have been started - start the scheduler. + * + * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + * The processor MUST be in supervisor mode when vTaskStartScheduler is + * called. The demo applications included in the FreeRTOS.org download switch + * to supervisor mode prior to main being called. If you are not using one of + * these demo application projects then ensure Supervisor mode is used. */ + vTaskStartScheduler(); + + /* Should never reach here! */ + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - #ifdef RUN_FROM_RAM - /* Remap the interrupt vectors to RAM if we are are running from RAM. */ - SCB_MEMMAP = 2; - #endif - - /* Set all GPIO to output other than the P0.14 (BSL), and the JTAG pins. - The JTAG pins are left as input as I'm not sure what will happen if the - Wiggler is connected after powerup - not that it would be a good idea to - do that anyway. */ - GPIO_IODIR = ~( mainJTAG_PORT ); - - /* Setup the PLL to multiply the XTAL input by 4. */ - SCB_PLLCFG = ( mainPLL_MUL_4 | mainPLL_DIV_1 ); - - /* Activate the PLL by turning it on then feeding the correct sequence of - bytes. */ - SCB_PLLCON = mainPLL_ENABLE; - SCB_PLLFEED = mainPLL_FEED_BYTE1; - SCB_PLLFEED = mainPLL_FEED_BYTE2; - - /* Wait for the PLL to lock... */ - while( !( SCB_PLLSTAT & mainPLL_LOCK ) ); - - /* ...before connecting it using the feed sequence again. */ - SCB_PLLCON = mainPLL_CONNECT; - SCB_PLLFEED = mainPLL_FEED_BYTE1; - SCB_PLLFEED = mainPLL_FEED_BYTE2; - - /* Setup and turn on the MAM. Three cycle access is used due to the fast - PLL used. It is possible faster overall performance could be obtained by - tuning the MAM and PLL settings. */ - MAM_TIM = mainMAM_TIM_3; - MAM_CR = mainMAM_MODE_FULL; - - /* Setup the peripheral bus to be the same as the PLL output. */ - SCB_VPBDIV = mainBUS_CLK_FULL; - - /* Initialise the i2c peripheral. */ - i2cInit(); - - /* Initialise the LED's used by the flash tasks. */ - vParTestInitialise(); + #ifdef RUN_FROM_RAM + /* Remap the interrupt vectors to RAM if we are are running from RAM. */ + SCB_MEMMAP = 2; + #endif + + /* Set all GPIO to output other than the P0.14 (BSL), and the JTAG pins. + * The JTAG pins are left as input as I'm not sure what will happen if the + * Wiggler is connected after powerup - not that it would be a good idea to + * do that anyway. */ + GPIO_IODIR = ~( mainJTAG_PORT ); + + /* Setup the PLL to multiply the XTAL input by 4. */ + SCB_PLLCFG = ( mainPLL_MUL_4 | mainPLL_DIV_1 ); + + /* Activate the PLL by turning it on then feeding the correct sequence of + * bytes. */ + SCB_PLLCON = mainPLL_ENABLE; + SCB_PLLFEED = mainPLL_FEED_BYTE1; + SCB_PLLFEED = mainPLL_FEED_BYTE2; + + /* Wait for the PLL to lock... */ + while( !( SCB_PLLSTAT & mainPLL_LOCK ) ) + { + } + + /* ...before connecting it using the feed sequence again. */ + SCB_PLLCON = mainPLL_CONNECT; + SCB_PLLFEED = mainPLL_FEED_BYTE1; + SCB_PLLFEED = mainPLL_FEED_BYTE2; + + /* Setup and turn on the MAM. Three cycle access is used due to the fast + * PLL used. It is possible faster overall performance could be obtained by + * tuning the MAM and PLL settings. */ + MAM_TIM = mainMAM_TIM_3; + MAM_CR = mainMAM_MODE_FULL; + + /* Setup the peripheral bus to be the same as the PLL output. */ + SCB_VPBDIV = mainBUS_CLK_FULL; + + /* Initialise the i2c peripheral. */ + i2cInit(); + + /* Initialise the LED's used by the flash tasks. */ + vParTestInitialise(); } /*-----------------------------------------------------------*/ static void prvMainCheckOtherTasksAreStillRunning( void ) { - /* Check all the demo tasks (other than the flash tasks) to ensure - that they are all still running, and that none of them have detected - an error. */ - - /* This function is called from more than one task. */ - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - lErrorInTask = pdTRUE; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - lErrorInTask = pdTRUE; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - lErrorInTask = pdTRUE; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - lErrorInTask = pdTRUE; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - lErrorInTask = pdTRUE; - } + /* Check all the demo tasks (other than the flash tasks) to ensure + * that they are all still running, and that none of them have detected + * an error. */ + + /* This function is called from more than one task. */ + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + lErrorInTask = pdTRUE; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + lErrorInTask = pdTRUE; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + lErrorInTask = pdTRUE; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + lErrorInTask = pdTRUE; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + lErrorInTask = pdTRUE; + } } /*-----------------------------------------------------------*/ void prvToggleOnBoardLED( void ) { -unsigned long ulState; - - ulState = GPIO0_IOPIN; - if( ulState & mainON_BOARD_LED_BIT ) - { - GPIO_IOCLR = mainON_BOARD_LED_BIT; - } - else - { - GPIO_IOSET = mainON_BOARD_LED_BIT; - } + unsigned long ulState; + + ulState = GPIO0_IOPIN; + + if( ulState & mainON_BOARD_LED_BIT ) + { + GPIO_IOCLR = mainON_BOARD_LED_BIT; + } + else + { + GPIO_IOSET = mainON_BOARD_LED_BIT; + } } /*-----------------------------------------------------------*/ -static void prvErrorChecks( void *pvParameters ) +static void prvErrorChecks( void * pvParameters ) { -TickType_t xDelay = mainNO_ERROR_DELAY; - - /* The parameters are not used. */ - ( void ) pvParameters; - - for( ;; ) - { - /* How long we delay depends on whether an error has been detected - or not. Therefore the flash rate of the on board LED indicates - whether or not an error has occurred. */ - vTaskDelay( xDelay ); - - /* Update the lErrorInTask flag. */ - prvMainCheckOtherTasksAreStillRunning(); - - if( lErrorInTask ) - { - /* An error has been found so reduce the delay period and in so - doing speed up the flash rate of the on board LED. */ - xDelay = mainERROR_DELAY; - } - - prvToggleOnBoardLED(); - } + TickType_t xDelay = mainNO_ERROR_DELAY; + + /* The parameters are not used. */ + ( void ) pvParameters; + + for( ; ; ) + { + /* How long we delay depends on whether an error has been detected + * or not. Therefore the flash rate of the on board LED indicates + * whether or not an error has occurred. */ + vTaskDelay( xDelay ); + + /* Update the lErrorInTask flag. */ + prvMainCheckOtherTasksAreStillRunning(); + + if( lErrorInTask ) + { + /* An error has been found so reduce the delay period and in so + * doing speed up the flash rate of the on board LED. */ + xDelay = mainERROR_DELAY; + } + + prvToggleOnBoardLED(); + } } - diff --git a/FreeRTOS/Demo/WizNET_DEMO_TERN_186/FreeRTOSConfig.h b/FreeRTOS/Demo/WizNET_DEMO_TERN_186/FreeRTOSConfig.h index 57e96582575..ed03c7316ed 100644 --- a/FreeRTOS/Demo/WizNET_DEMO_TERN_186/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/WizNET_DEMO_TERN_186/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WizNET_DEMO_TERN_186/HTTPTask.c b/FreeRTOS/Demo/WizNET_DEMO_TERN_186/HTTPTask.c index a51a9a7118d..0e60d2a5151 100644 --- a/FreeRTOS/Demo/WizNET_DEMO_TERN_186/HTTPTask.c +++ b/FreeRTOS/Demo/WizNET_DEMO_TERN_186/HTTPTask.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WizNET_DEMO_TERN_186/HTTPTask.h b/FreeRTOS/Demo/WizNET_DEMO_TERN_186/HTTPTask.h index 03a9deef371..1d46777ffd0 100644 --- a/FreeRTOS/Demo/WizNET_DEMO_TERN_186/HTTPTask.h +++ b/FreeRTOS/Demo/WizNET_DEMO_TERN_186/HTTPTask.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/WizNET_DEMO_TERN_186/main.c b/FreeRTOS/Demo/WizNET_DEMO_TERN_186/main.c index c9cc2c162d5..ae4b0400bbc 100644 --- a/FreeRTOS/Demo/WizNET_DEMO_TERN_186/main.c +++ b/FreeRTOS/Demo/WizNET_DEMO_TERN_186/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -25,8 +25,8 @@ */ /* - * Creates all the demo application tasks then starts the scheduler. In - * addition to the standard demo application tasks main() creates the + * Creates all the demo application tasks then starts the scheduler. In + * addition to the standard demo application tasks main() creates the * HTTPServer task, and a "Check" task. The Check task periodically inspects * all the other tasks in the system to see if any errors have been reported. * The error status is then displayed on the served WEB page. @@ -52,20 +52,20 @@ #include "comtest.h" /* How often should the "check" task execute? */ -#define mainCHECK_DELAY ( 3000 / portTICK_PERIOD_MS ) +#define mainCHECK_DELAY ( 3000 / portTICK_PERIOD_MS ) /* Priorities allocated to the various tasks. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainHTTP_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainSUICIDE_TASKS_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainHTTP_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainSUICIDE_TASKS_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) /* Used to indicate the error status. A value of 0 means that an error has not -been detected in any task. A non zero value indicates which group of demo -tasks has reported an error. See prvCheckTask() for bit definitions. */ + * been detected in any task. A non zero value indicates which group of demo + * tasks has reported an error. See prvCheckTask() for bit definitions. */ unsigned short usCheckStatus = 0; /*-----------------------------------------------------------*/ @@ -80,111 +80,101 @@ static void prvSetupHardware( void ); * Periodically inspect all the other tasks, updating usCheckStatus should an * error be discovered in any task. */ -static void prvCheckTask( void *pvParameters ); +static void prvCheckTask( void * pvParameters ); /*-----------------------------------------------------------*/ -void main(void) +void main( void ) { - prvSetupHardware(); + prvSetupHardware(); /* Start the HTTP server task. */ - xTaskCreate( vHTTPTask, "WizNet", configMINIMAL_STACK_SIZE, NULL, mainHTTP_TASK_PRIORITY, NULL ); - - /* Start the demo/test application tasks. See the demo application - section of the FreeRTOS.org WEB site for more information. */ - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartDynamicPriorityTasks(); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + xTaskCreate( vHTTPTask, "WizNet", configMINIMAL_STACK_SIZE, NULL, mainHTTP_TASK_PRIORITY, NULL ); + + /* Start the demo/test application tasks. See the demo application + * section of the FreeRTOS.org WEB site for more information. */ + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartDynamicPriorityTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); vStartComTestTasks( mainCOM_TEST_PRIORITY, serCOM2, ser57600 ); - /* Start the task that checks the other demo tasks for errors. */ + /* Start the task that checks the other demo tasks for errors. */ xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - /* The suicide tasks must be created last as they monitor the number of - tasks in the system to ensure there are no more or fewer than expected - compared to the number that were executing when the task started. */ - vCreateSuicidalTasks( mainSUICIDE_TASKS_PRIORITY ); - - /* Finally start the scheduler. */ + /* The suicide tasks must be created last as they monitor the number of + * tasks in the system to ensure there are no more or fewer than expected + * compared to the number that were executing when the task started. */ + vCreateSuicidalTasks( mainSUICIDE_TASKS_PRIORITY ); + + /* Finally start the scheduler. */ vTaskStartScheduler(); - /* Should not get here! */ - for( ;; ); + /* Should not get here! */ + for( ; ; ) + { + } } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - ae_init(); + ae_init(); } /*-----------------------------------------------------------*/ -static void prvCheckTask( void *pvParameters ) +static void prvCheckTask( void * pvParameters ) { - ( void ) pvParameters; + ( void ) pvParameters; - /* Check all the demo tasks to ensure that they are all still running, and - that none of them have detected an error. */ - for( ;; ) + /* Check all the demo tasks to ensure that they are all still running, and + * that none of them have detected an error. */ + for( ; ; ) { - /* Block until it is time to check again. */ - vTaskDelay( mainCHECK_DELAY ); - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - usCheckStatus |= 0x01; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - usCheckStatus |= 0x02; - } - - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - usCheckStatus |= 0x04; - } - - if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) - { - usCheckStatus |= 0x08; - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - usCheckStatus |= 0x10; - } + /* Block until it is time to check again. */ + vTaskDelay( mainCHECK_DELAY ); + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + usCheckStatus |= 0x01; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + usCheckStatus |= 0x02; + } + + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + usCheckStatus |= 0x04; + } + + if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) + { + usCheckStatus |= 0x08; + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + usCheckStatus |= 0x10; + } if( xIsCreateTaskStillRunning() != pdTRUE ) { - usCheckStatus |= 0x20; + usCheckStatus |= 0x20; } if( xAreComTestTasksStillRunning() != pdTRUE ) { - usCheckStatus |= 0x40; + usCheckStatus |= 0x40; } - } + } } /*-----------------------------------------------------------*/ /* This is included to prevent link errors - allowing the 'full' version of -the comtest tasks to be used. It can be ignored. */ + * the comtest tasks to be used. It can be ignored. */ void vPrintDisplayMessage( const char * const * ppcMessageToSend ) { - ( void ) ppcMessageToSend; + ( void ) ppcMessageToSend; } - - - - - - - - - - - - diff --git a/FreeRTOS/Demo/WizNET_DEMO_TERN_186/serial/serial.c b/FreeRTOS/Demo/WizNET_DEMO_TERN_186/serial/serial.c index 57b08b342b1..9a4bff94038 100644 --- a/FreeRTOS/Demo/WizNET_DEMO_TERN_186/serial/serial.c +++ b/FreeRTOS/Demo/WizNET_DEMO_TERN_186/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/dsPIC_MPLAB/FreeRTOSConfig.h b/FreeRTOS/Demo/dsPIC_MPLAB/FreeRTOSConfig.h index 6103687cb5b..dd3301ab104 100644 --- a/FreeRTOS/Demo/dsPIC_MPLAB/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/dsPIC_MPLAB/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/dsPIC_MPLAB/ParTest/ParTest.c b/FreeRTOS/Demo/dsPIC_MPLAB/ParTest/ParTest.c index e37e38737e0..a8a32503432 100644 --- a/FreeRTOS/Demo/dsPIC_MPLAB/ParTest/ParTest.c +++ b/FreeRTOS/Demo/dsPIC_MPLAB/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/dsPIC_MPLAB/lcd.c b/FreeRTOS/Demo/dsPIC_MPLAB/lcd.c index 46844556070..0f07847ae8f 100644 --- a/FreeRTOS/Demo/dsPIC_MPLAB/lcd.c +++ b/FreeRTOS/Demo/dsPIC_MPLAB/lcd.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/dsPIC_MPLAB/lcd.h b/FreeRTOS/Demo/dsPIC_MPLAB/lcd.h index 39acdbf6451..3e55ce19b26 100644 --- a/FreeRTOS/Demo/dsPIC_MPLAB/lcd.h +++ b/FreeRTOS/Demo/dsPIC_MPLAB/lcd.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/dsPIC_MPLAB/main.c b/FreeRTOS/Demo/dsPIC_MPLAB/main.c index fd152211036..e45fbdb70ed 100644 --- a/FreeRTOS/Demo/dsPIC_MPLAB/main.c +++ b/FreeRTOS/Demo/dsPIC_MPLAB/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -76,46 +76,46 @@ #include "timertest.h" /* Demo task priorities. */ -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainCOM_TEST_PRIORITY ( 2 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainCOM_TEST_PRIORITY ( 2 ) /* The check task may require a bit more stack as it calls sprintf(). */ -#define mainCHECK_TAKS_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 ) +#define mainCHECK_TAKS_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 ) /* The execution period of the check task. */ -#define mainCHECK_TASK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainCHECK_TASK_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) /* The number of flash co-routines to create. */ -#define mainNUM_FLASH_COROUTINES ( 5 ) +#define mainNUM_FLASH_COROUTINES ( 5 ) /* Baud rate used by the comtest tasks. */ -#define mainCOM_TEST_BAUD_RATE ( 19200 ) +#define mainCOM_TEST_BAUD_RATE ( 19200 ) /* The LED used by the comtest tasks. mainCOM_TEST_LED + 1 is also used. -See the comtest.c file for more information. */ -#define mainCOM_TEST_LED ( 6 ) + * See the comtest.c file for more information. */ +#define mainCOM_TEST_LED ( 6 ) /* The frequency at which the "fast interrupt test" interrupt will occur. */ -#define mainTEST_INTERRUPT_FREQUENCY ( 20000 ) +#define mainTEST_INTERRUPT_FREQUENCY ( 20000 ) /* The number of processor clocks we expect to occur between each "fast -interrupt test" interrupt. */ -#define mainEXPECTED_CLOCKS_BETWEEN_INTERRUPTS ( configCPU_CLOCK_HZ / mainTEST_INTERRUPT_FREQUENCY ) + * interrupt test" interrupt. */ +#define mainEXPECTED_CLOCKS_BETWEEN_INTERRUPTS ( configCPU_CLOCK_HZ / mainTEST_INTERRUPT_FREQUENCY ) /* The number of nano seconds between each processor clock. */ -#define mainNS_PER_CLOCK ( ( unsigned short ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) ) +#define mainNS_PER_CLOCK ( ( unsigned short ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) ) /* Dimension the buffer used to hold the value of the maximum jitter time when -it is converted to a string. */ -#define mainMAX_STRING_LENGTH ( 20 ) + * it is converted to a string. */ +#define mainMAX_STRING_LENGTH ( 20 ) /*-----------------------------------------------------------*/ /* * The check task as described at the top of this file. */ -static void vCheckTask( void *pvParameters ); +static void vCheckTask( void * pvParameters ); /* * Setup the processor ready for the demo. @@ -134,113 +134,112 @@ static QueueHandle_t xLCDQueue; */ int main( void ) { - /* Configure any hardware required for this demo. */ - prvSetupHardware(); + /* Configure any hardware required for this demo. */ + prvSetupHardware(); - /* Create the standard demo tasks. */ - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vStartFlashCoRoutines( mainNUM_FLASH_COROUTINES ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - vCreateBlockTimeTasks(); + /* Create the standard demo tasks. */ + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartFlashCoRoutines( mainNUM_FLASH_COROUTINES ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); + vCreateBlockTimeTasks(); - /* Create the test tasks defined within this file. */ - xTaskCreate( vCheckTask, "Check", mainCHECK_TAKS_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + /* Create the test tasks defined within this file. */ + xTaskCreate( vCheckTask, "Check", mainCHECK_TAKS_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - /* Start the task that will control the LCD. This returns the handle - to the queue used to write text out to the task. */ - xLCDQueue = xStartLCDTask(); + /* Start the task that will control the LCD. This returns the handle + * to the queue used to write text out to the task. */ + xLCDQueue = xStartLCDTask(); - /* Start the high frequency interrupt test. */ - vSetupTimerTest( mainTEST_INTERRUPT_FREQUENCY ); + /* Start the high frequency interrupt test. */ + vSetupTimerTest( mainTEST_INTERRUPT_FREQUENCY ); - /* Finally start the scheduler. */ - vTaskStartScheduler(); + /* Finally start the scheduler. */ + vTaskStartScheduler(); - /* Will only reach here if there is insufficient heap available to start - the scheduler. */ - return 0; + /* Will only reach here if there is insufficient heap available to start + * the scheduler. */ + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - vParTestInitialise(); + vParTestInitialise(); } /*-----------------------------------------------------------*/ -static void vCheckTask( void *pvParameters ) +static void vCheckTask( void * pvParameters ) { /* Used to wake the task at the correct frequency. */ -TickType_t xLastExecutionTime; + TickType_t xLastExecutionTime; /* The maximum jitter time measured by the fast interrupt test. */ -extern unsigned short usMaxJitter ; + extern unsigned short usMaxJitter; /* Buffer into which the maximum jitter time is written as a string. */ -static char cStringBuffer[ mainMAX_STRING_LENGTH ]; + static char cStringBuffer[ mainMAX_STRING_LENGTH ]; /* The message that is sent on the queue to the LCD task. The first -parameter is the minimum time (in ticks) that the message should be -left on the LCD without being overwritten. The second parameter is a pointer -to the message to display itself. */ -xLCDMessage xMessage = { 0, cStringBuffer }; + * parameter is the minimum time (in ticks) that the message should be + * left on the LCD without being overwritten. The second parameter is a pointer + * to the message to display itself. */ + xLCDMessage xMessage = { 0, cStringBuffer }; /* Set to pdTRUE should an error be detected in any of the standard demo tasks. */ -unsigned short usErrorDetected = pdFALSE; - - /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() - works correctly. */ - xLastExecutionTime = xTaskGetTickCount(); - - for( ;; ) - { - /* Wait until it is time for the next cycle. */ - vTaskDelayUntil( &xLastExecutionTime, mainCHECK_TASK_PERIOD ); - - /* Has an error been found in any of the standard demo tasks? */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - usErrorDetected = pdTRUE; - sprintf( cStringBuffer, "FAIL #1" ); - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - usErrorDetected = pdTRUE; - sprintf( cStringBuffer, "FAIL #2" ); - } - - if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) - { - usErrorDetected = pdTRUE; - sprintf( cStringBuffer, "FAIL #3" ); - } - - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - usErrorDetected = pdTRUE; - sprintf( cStringBuffer, "FAIL #4" ); - } - - if( usErrorDetected == pdFALSE ) - { - /* No errors have been discovered, so display the maximum jitter - timer discovered by the "fast interrupt test". */ - sprintf( cStringBuffer, "%dns max jitter", ( short ) ( usMaxJitter - mainEXPECTED_CLOCKS_BETWEEN_INTERRUPTS ) * mainNS_PER_CLOCK ); - } - - /* Send the message to the LCD gatekeeper for display. */ - xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); - } + unsigned short usErrorDetected = pdFALSE; + + /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() + * works correctly. */ + xLastExecutionTime = xTaskGetTickCount(); + + for( ; ; ) + { + /* Wait until it is time for the next cycle. */ + vTaskDelayUntil( &xLastExecutionTime, mainCHECK_TASK_PERIOD ); + + /* Has an error been found in any of the standard demo tasks? */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + usErrorDetected = pdTRUE; + sprintf( cStringBuffer, "FAIL #1" ); + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + usErrorDetected = pdTRUE; + sprintf( cStringBuffer, "FAIL #2" ); + } + + if( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) + { + usErrorDetected = pdTRUE; + sprintf( cStringBuffer, "FAIL #3" ); + } + + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + usErrorDetected = pdTRUE; + sprintf( cStringBuffer, "FAIL #4" ); + } + + if( usErrorDetected == pdFALSE ) + { + /* No errors have been discovered, so display the maximum jitter + * timer discovered by the "fast interrupt test". */ + sprintf( cStringBuffer, "%dns max jitter", ( short ) ( usMaxJitter - mainEXPECTED_CLOCKS_BETWEEN_INTERRUPTS ) * mainNS_PER_CLOCK ); + } + + /* Send the message to the LCD gatekeeper for display. */ + xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); + } } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { - /* Schedule the co-routines from within the idle task hook. */ - vCoRoutineSchedule(); + /* Schedule the co-routines from within the idle task hook. */ + vCoRoutineSchedule(); } /*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/dsPIC_MPLAB/serial/serial.c b/FreeRTOS/Demo/dsPIC_MPLAB/serial/serial.c index 6f70cf2b657..1f2d340c273 100644 --- a/FreeRTOS/Demo/dsPIC_MPLAB/serial/serial.c +++ b/FreeRTOS/Demo/dsPIC_MPLAB/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/dsPIC_MPLAB/timertest.c b/FreeRTOS/Demo/dsPIC_MPLAB/timertest.c index 06ca0a57288..5ebf38a9290 100644 --- a/FreeRTOS/Demo/dsPIC_MPLAB/timertest.c +++ b/FreeRTOS/Demo/dsPIC_MPLAB/timertest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/dsPIC_MPLAB/timertest.h b/FreeRTOS/Demo/dsPIC_MPLAB/timertest.h index 0be42c8677c..8a8e11740fc 100644 --- a/FreeRTOS/Demo/dsPIC_MPLAB/timertest.h +++ b/FreeRTOS/Demo/dsPIC_MPLAB/timertest.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/lwIP_AVR32_UC3/main.c b/FreeRTOS/Demo/lwIP_AVR32_UC3/main.c index fe391687e4c..260f7cdb9ca 100644 --- a/FreeRTOS/Demo/lwIP_AVR32_UC3/main.c +++ b/FreeRTOS/Demo/lwIP_AVR32_UC3/main.c @@ -1,4 +1,5 @@ /*This file has been prepared for Doxygen automatic documentation generation.*/ + /*! \file ********************************************************************* * * \brief FreeRTOS and lwIP example for AVR32 UC3. @@ -58,88 +59,88 @@ #include "flash.h" /* Priority definitions for most of the tasks in the demo application. */ -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainETH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainETH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* Baud rate used by the serial port tasks. */ -#define mainCOM_BAUD_RATE ( ( unsigned long ) 57600 ) -#define mainCOM_BUFFER_LEN ( ( unsigned long ) 70 ) +#define mainCOM_BAUD_RATE ( ( unsigned long ) 57600 ) +#define mainCOM_BUFFER_LEN ( ( unsigned long ) 70 ) /* An address in the internal Flash used to count resets. This is used to check that -the demo application is not unexpectedly resetting. */ -#define mainRESET_COUNT_ADDRESS ( ( void * ) 0xC0000000 ) - - -//! -//! \fn main -//! \brief start the software here -//! 1) Initialize the microcontroller and the shared hardware resources -//! of the board. -//! 2) Launch the IP modules. -//! 3) Start FreeRTOS. -//! \return 42, which should never occur. -//! \note -//! + * the demo application is not unexpectedly resetting. */ +#define mainRESET_COUNT_ADDRESS ( ( void * ) 0xC0000000 ) + + +/*! */ +/*! \fn main */ +/*! \brief start the software here */ +/*! 1) Initialize the microcontroller and the shared hardware resources */ +/*! of the board. */ +/*! 2) Launch the IP modules. */ +/*! 3) Start FreeRTOS. */ +/*! \return 42, which should never occur. */ +/*! \note */ +/*! */ int main( void ) { -volatile avr32_pm_t* pm = &AVR32_PM; + volatile avr32_pm_t * pm = &AVR32_PM; - /* 1) Initialize the microcontroller and the shared hardware resources of the board. */ + /* 1) Initialize the microcontroller and the shared hardware resources of the board. */ - /* Switch to external oscillator 0 */ - pm_switch_to_osc0( pm, FOSC0, OSC0_STARTUP ); + /* Switch to external oscillator 0 */ + pm_switch_to_osc0( pm, FOSC0, OSC0_STARTUP ); - /* Setup PLL0 on OSC0, mul+1=16 ,divisor by 1, lockcount=16, ie. 12Mhzx16/1 = 192MHz output. - Extra div by 2 => 96MHz */ - pm_pll_setup(pm, /* volatile avr32_pm_t* pm */ - 0, /* unsigned int pll */ - 15, /* unsigned int mul */ - 1, /* unsigned int div, Sel Osc0/PLL0 or Osc1/Pll1 */ - 0, /* unsigned int osc */ - 16); /* unsigned int lockcount */ + /* Setup PLL0 on OSC0, mul+1=16 ,divisor by 1, lockcount=16, ie. 12Mhzx16/1 = 192MHz output. + * Extra div by 2 => 96MHz */ + pm_pll_setup( pm, /* volatile avr32_pm_t* pm */ + 0, /* unsigned int pll */ + 15, /* unsigned int mul */ + 1, /* unsigned int div, Sel Osc0/PLL0 or Osc1/Pll1 */ + 0, /* unsigned int osc */ + 16 ); /* unsigned int lockcount */ - pm_pll_set_option( pm, 0, // pll0 - 0, // Choose the range 160-240MHz. - 1, // div2 - 0 ); // wbwdisable + pm_pll_set_option( pm, 0, /* pll0 */ + 0, /* Choose the range 160-240MHz. */ + 1, /* div2 */ + 0 ); /* wbwdisable */ - /* Enable PLL0 */ - pm_pll_enable(pm,0); + /* Enable PLL0 */ + pm_pll_enable( pm, 0 ); - /* Wait for PLL0 locked */ - pm_wait_for_pll0_locked(pm) ; + /* Wait for PLL0 locked */ + pm_wait_for_pll0_locked( pm ); - /* Setup generic clock number 2 on PLL, with OSC0/PLL0, no divisor */ - pm_gc_setup(pm, - 0, - 1, /* Use Osc (=0) or PLL (=1) */ - 0, /* Sel Osc0/PLL0 or Osc1/Pll1 */ - 0, - 1); + /* Setup generic clock number 2 on PLL, with OSC0/PLL0, no divisor */ + pm_gc_setup( pm, + 0, + 1, /* Use Osc (=0) or PLL (=1) */ + 0, /* Sel Osc0/PLL0 or Osc1/Pll1 */ + 0, + 1 ); - /* Enable Generic clock 0*/ - pm_gc_enable(pm, 0); + /* Enable Generic clock 0*/ + pm_gc_enable( pm, 0 ); - /* switch to clock */ - pm_cksel( pm, 1, 1, 1, 0, 1, 0 ); - flashc_set_wait_state( 1 ); - pm_switch_to_clock( pm, AVR32_PM_MCCTRL_MCSEL_PLL0 ); + /* switch to clock */ + pm_cksel( pm, 1, 1, 1, 0, 1, 0 ); + flashc_set_wait_state( 1 ); + pm_switch_to_clock( pm, AVR32_PM_MCCTRL_MCSEL_PLL0 ); - /* Setup the LED's for output. */ - vParTestInitialise(); + /* Setup the LED's for output. */ + vParTestInitialise(); - /* Start the flash tasks just to provide visual feedback that the demo is - executing. */ - vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + /* Start the flash tasks just to provide visual feedback that the demo is + * executing. */ + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - /* 2) Start ethernet task. */ - vStartEthernetTask( mainETH_TASK_PRIORITY ); + /* 2) Start ethernet task. */ + vStartEthernetTask( mainETH_TASK_PRIORITY ); - /* 3) Start FreeRTOS. */ - vTaskStartScheduler(); + /* 3) Start FreeRTOS. */ + vTaskStartScheduler(); - /* Will only reach here if there was insufficient memory to create the idle task. */ + /* Will only reach here if there was insufficient memory to create the idle task. */ - return 0; + return 0; } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.c b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.c index 8adc358bc0b..b2a03c5e820 100644 --- a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.c +++ b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.h b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.h index a2b8aabdae5..99d88529d74 100644 --- a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.h +++ b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/BasicWEB.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.c b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.c index ebe209d1dfa..c32cce90cd2 100644 --- a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.c +++ b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.h b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.h index cecd09c5f91..21e28d31efe 100644 --- a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.h +++ b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -19,8 +19,8 @@ * 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. * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS * */ diff --git a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC_ISR.c b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC_ISR.c index dc930ff261c..9a836d4b0e0 100644 --- a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC_ISR.c +++ b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/EMAC/SAM7_EMAC_ISR.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/FreeRTOSConfig.h b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/FreeRTOSConfig.h index ec6eb53f67a..df77db07f52 100644 --- a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/ParTest/ParTest.c b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/ParTest/ParTest.c index 6ed025d25a1..eaf33bab15a 100644 --- a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/ParTest/ParTest.c +++ b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.c b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.c index fd2bd016108..8d2b9c9ae46 100644 --- a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.c +++ b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.h b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.h index 4689dd76f20..2df2b482cd3 100644 --- a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.h +++ b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/USB-CDC.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/USBIsr.c b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/USBIsr.c index 8e941f1e755..52cebcb06bf 100644 --- a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/USBIsr.c +++ b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/USBIsr.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/descriptors.h b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/descriptors.h index 4197f259129..9c5934bace2 100644 --- a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/descriptors.h +++ b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/descriptors.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/usb.h b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/usb.h index 74a9d0b84c6..665dda516c6 100644 --- a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/usb.h +++ b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/USB/usb.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/main.c b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/main.c index 7996d4b3af6..bd1b6765396 100644 --- a/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/main.c +++ b/FreeRTOS/Demo/lwIP_Demo_Rowley_ARM7/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -25,12 +25,12 @@ */ /* - NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. - The processor MUST be in supervisor mode when vTaskStartScheduler is - called. The demo applications included in the FreeRTOS.org download switch - to supervisor mode prior to main being called. If you are not using one of - these demo application projects then ensure Supervisor mode is used. -*/ + * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + * The processor MUST be in supervisor mode when vTaskStartScheduler is + * called. The demo applications included in the FreeRTOS.org download switch + * to supervisor mode prior to main being called. If you are not using one of + * these demo application projects then ensure Supervisor mode is used. + */ /* @@ -55,11 +55,11 @@ */ /* - Changes from V3.2.2 - - + Modified the stack sizes used by some tasks to permit use of the - command line GCC tools. -*/ + * Changes from V3.2.2 + * + + Modified the stack sizes used by some tasks to permit use of the + + command line GCC tools. + */ /* Library includes. */ #include @@ -87,29 +87,29 @@ #include "AT91SAM7X256.h" /* Priorities/stacks for the various tasks within the demo application. */ -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainWEBSERVER_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainUSB_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainUSB_TASK_STACK ( 200 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainWEBSERVER_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainUSB_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainUSB_TASK_STACK ( 200 ) /* The rate at which the on board LED will toggle when there is/is not an -error. */ -#define mainNO_ERROR_FLASH_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) -#define mainERROR_FLASH_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) + * error. */ +#define mainNO_ERROR_FLASH_PERIOD ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainERROR_FLASH_PERIOD ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) /* The rate at which the idle hook sends data to the USB port. */ -#define mainUSB_TX_FREQUENCY ( 100 / portTICK_PERIOD_MS ) +#define mainUSB_TX_FREQUENCY ( 100 / portTICK_PERIOD_MS ) /* The string that is transmitted down the USB port. */ -#define mainFIRST_TX_CHAR 'a' -#define mainLAST_TX_CHAR 'z' +#define mainFIRST_TX_CHAR 'a' +#define mainLAST_TX_CHAR 'z' /* The LED used by the check task to indicate the system status. */ -#define mainCHECK_LED ( 3 ) +#define mainCHECK_LED ( 3 ) /*-----------------------------------------------------------*/ /* @@ -123,7 +123,7 @@ static long prvCheckOtherTasksAreStillRunning( void ); * prvCheckOtherTasksAreStillRunning(). See the description at the top * of the file. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * Configure the processor for use with the Atmel demo board. This is very @@ -142,151 +142,150 @@ void vApplicationIdleHook( void ); */ int main( void ) { - /* Setup the ports. */ - prvSetupHardware(); + /* Setup the ports. */ + prvSetupHardware(); - /* Setup the IO required for the LED's. */ - vParTestInitialise(); + /* Setup the IO required for the LED's. */ + vParTestInitialise(); - /* Setup lwIP. */ + /* Setup lwIP. */ vlwIPInit(); - /* Create the lwIP task. This uses the lwIP RTOS abstraction layer.*/ + /* Create the lwIP task. This uses the lwIP RTOS abstraction layer.*/ sys_thread_new( vBasicWEBServer, ( void * ) NULL, mainWEBSERVER_PRIORITY ); - /* Create the demo USB CDC task. */ - xTaskCreate( vUSBCDCTask, "USB", mainUSB_TASK_STACK, NULL, mainUSB_PRIORITY, NULL ); + /* Create the demo USB CDC task. */ + xTaskCreate( vUSBCDCTask, "USB", mainUSB_TASK_STACK, NULL, mainUSB_PRIORITY, NULL ); - /* Create the standard demo application tasks. */ - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); - vStartLEDFlashTasks( mainFLASH_PRIORITY ); - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); + /* Create the standard demo application tasks. */ + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartLEDFlashTasks( mainFLASH_PRIORITY ); + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); - /* Start the check task - which is defined in this file. */ + /* Start the check task - which is defined in this file. */ xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - /* Finally, start the scheduler. - - NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. - The processor MUST be in supervisor mode when vTaskStartScheduler is - called. The demo applications included in the FreeRTOS.org download switch - to supervisor mode prior to main being called. If you are not using one of - these demo application projects then ensure Supervisor mode is used here. */ - vTaskStartScheduler(); - - /* Should never get here! */ - return 0; + /* Finally, start the scheduler. + * + * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode. + * The processor MUST be in supervisor mode when vTaskStartScheduler is + * called. The demo applications included in the FreeRTOS.org download switch + * to supervisor mode prior to main being called. If you are not using one of + * these demo application projects then ensure Supervisor mode is used here. */ + vTaskStartScheduler(); + + /* Should never get here! */ + return 0; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* When using the JTAG debugger the hardware is not always initialised to - the correct default state. This line just ensures that this does not - cause all interrupts to be masked at the start. */ - AT91C_BASE_AIC->AIC_EOICR = 0; - - /* Most setup is performed by the low level init function called from the - startup asm file. + /* When using the JTAG debugger the hardware is not always initialised to + * the correct default state. This line just ensures that this does not + * cause all interrupts to be masked at the start. */ + AT91C_BASE_AIC->AIC_EOICR = 0; - Configure the PIO Lines corresponding to LED1 to LED4 to be outputs as - well as the UART Tx line. */ - AT91C_BASE_PIOB->PIO_PER = LED_MASK; // Set in PIO mode - AT91C_BASE_PIOB->PIO_OER = LED_MASK; // Configure in Output + /* Most setup is performed by the low level init function called from the + * startup asm file. + * + * Configure the PIO Lines corresponding to LED1 to LED4 to be outputs as + * well as the UART Tx line. */ + AT91C_BASE_PIOB->PIO_PER = LED_MASK; /* Set in PIO mode */ + AT91C_BASE_PIOB->PIO_OER = LED_MASK; /* Configure in Output */ - /* Enable the peripheral clock. */ + /* Enable the peripheral clock. */ AT91C_BASE_PMC->PMC_PCER = 1 << AT91C_ID_PIOA; AT91C_BASE_PMC->PMC_PCER = 1 << AT91C_ID_PIOB; - AT91C_BASE_PMC->PMC_PCER = 1 << AT91C_ID_EMAC; + AT91C_BASE_PMC->PMC_PCER = 1 << AT91C_ID_EMAC; } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD; -TickType_t xLastWakeTime; - - /* The parameters are not used. */ - ( void ) pvParameters; - - /* Initialise xLastWakeTime to ensure the first call to vTaskDelayUntil() - functions correctly. */ - xLastWakeTime = xTaskGetTickCount(); - - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. If an error is detected then the delay period - is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so - the Check LED flash rate will increase. */ - for( ;; ) - { - /* Delay until it is time to execute again. The delay period is - shorter following an error. */ - vTaskDelayUntil( &xLastWakeTime, xDelayPeriod ); - - /* Check all the standard demo application tasks are executing without - error. */ - if( prvCheckOtherTasksAreStillRunning() != pdPASS ) - { - /* An error has been detected in one of the tasks - flash faster. */ - xDelayPeriod = mainERROR_FLASH_PERIOD; - } - - vParTestToggleLED( mainCHECK_LED ); - } + TickType_t xDelayPeriod = mainNO_ERROR_FLASH_PERIOD; + TickType_t xLastWakeTime; + + /* The parameters are not used. */ + ( void ) pvParameters; + + /* Initialise xLastWakeTime to ensure the first call to vTaskDelayUntil() + * functions correctly. */ + xLastWakeTime = xTaskGetTickCount(); + + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. If an error is detected then the delay period + * is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so + * the Check LED flash rate will increase. */ + for( ; ; ) + { + /* Delay until it is time to execute again. The delay period is + * shorter following an error. */ + vTaskDelayUntil( &xLastWakeTime, xDelayPeriod ); + + /* Check all the standard demo application tasks are executing without + * error. */ + if( prvCheckOtherTasksAreStillRunning() != pdPASS ) + { + /* An error has been detected in one of the tasks - flash faster. */ + xDelayPeriod = mainERROR_FLASH_PERIOD; + } + + vParTestToggleLED( mainCHECK_LED ); + } } /*-----------------------------------------------------------*/ static long prvCheckOtherTasksAreStillRunning( void ) { -long lReturn = ( long ) pdPASS; + long lReturn = ( long ) pdPASS; - /* Check all the demo tasks (other than the flash tasks) to ensure - that they are all still running, and that none of them have detected - an error. */ + /* Check all the demo tasks (other than the flash tasks) to ensure + * that they are all still running, and that none of them have detected + * an error. */ - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } - if( xAreSemaphoreTasksStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } - if( xAreBlockingQueuesStillRunning() != pdTRUE ) - { - lReturn = ( long ) pdFAIL; - } + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + lReturn = ( long ) pdFAIL; + } - return lReturn; + return lReturn; } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ) { -static TickType_t xLastTx = 0; -char cTxByte; - - /* The idle hook simply sends a string of characters to the USB port. - The characters will be buffered and sent once the port is connected. */ - if( ( xTaskGetTickCount() - xLastTx ) > mainUSB_TX_FREQUENCY ) - { - xLastTx = xTaskGetTickCount(); - for( cTxByte = mainFIRST_TX_CHAR; cTxByte <= mainLAST_TX_CHAR; cTxByte++ ) - { - vUSBSendByte( cTxByte ); - } - } + static TickType_t xLastTx = 0; + char cTxByte; + + /* The idle hook simply sends a string of characters to the USB port. + * The characters will be buffered and sent once the port is connected. */ + if( ( xTaskGetTickCount() - xLastTx ) > mainUSB_TX_FREQUENCY ) + { + xLastTx = xTaskGetTickCount(); + + for( cTxByte = mainFIRST_TX_CHAR; cTxByte <= mainLAST_TX_CHAR; cTxByte++ ) + { + vUSBSendByte( cTxByte ); + } + } } - - diff --git a/FreeRTOS/Demo/msp430_CrossWorks/FreeRTOSConfig.h b/FreeRTOS/Demo/msp430_CrossWorks/FreeRTOSConfig.h index 1048a5bc496..cfe118b6237 100644 --- a/FreeRTOS/Demo/msp430_CrossWorks/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/msp430_CrossWorks/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/msp430_CrossWorks/ParTest/ParTest.c b/FreeRTOS/Demo/msp430_CrossWorks/ParTest/ParTest.c index ebbe4dc11ba..f32732ca54f 100644 --- a/FreeRTOS/Demo/msp430_CrossWorks/ParTest/ParTest.c +++ b/FreeRTOS/Demo/msp430_CrossWorks/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/msp430_CrossWorks/main.c b/FreeRTOS/Demo/msp430_CrossWorks/main.c index 96602ea0a5b..884a844a2a4 100644 --- a/FreeRTOS/Demo/msp430_CrossWorks/main.c +++ b/FreeRTOS/Demo/msp430_CrossWorks/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -65,43 +65,43 @@ #include "PollQ.h" /* Constants required for hardware setup. */ -#define mainALL_BITS_OUTPUT ( ( unsigned char ) 0xff ) -#define mainMAX_FREQUENCY ( ( unsigned char ) 121 ) +#define mainALL_BITS_OUTPUT ( ( unsigned char ) 0xff ) +#define mainMAX_FREQUENCY ( ( unsigned char ) 121 ) /* Constants that define the LED's used by the various tasks. [in this case -the '*' characters on the LCD represent LED's] */ -#define mainCHECK_LED ( 4 ) -#define mainCOM_TEST_LED ( 10 ) + * the '*' characters on the LCD represent LED's] */ +#define mainCHECK_LED ( 4 ) +#define mainCOM_TEST_LED ( 10 ) /* Demo task priorities. */ -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* Baud rate used by the COM test tasks. */ -#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 19200 ) +#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 19200 ) /* The frequency at which the 'Check' tasks executes. See the comments at the -top of the page. When the system is operating error free the 'Check' task -toggles an LED every three seconds. If an error is discovered in any task the -rate is increased to 500 milliseconds. [in this case the '*' characters on the -LCD represent LED's]*/ -#define mainNO_ERROR_CHECK_DELAY ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) -#define mainERROR_CHECK_DELAY ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) + * top of the page. When the system is operating error free the 'Check' task + * toggles an LED every three seconds. If an error is discovered in any task the + * rate is increased to 500 milliseconds. [in this case the '*' characters on the + * LCD represent LED's]*/ +#define mainNO_ERROR_CHECK_DELAY ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainERROR_CHECK_DELAY ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) /* The constants used in the calculation. */ -#define intgCONST1 ( ( long ) 123 ) -#define intgCONST2 ( ( long ) 234567 ) -#define intgCONST3 ( ( long ) -3 ) -#define intgCONST4 ( ( long ) 7 ) -#define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 ) +#define intgCONST1 ( ( long ) 123 ) +#define intgCONST2 ( ( long ) 234567 ) +#define intgCONST3 ( ( long ) -3 ) +#define intgCONST4 ( ( long ) 7 ) +#define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 ) /* * The function that implements the Check task. See the comments at the head * of the page for implementation details. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * Called by the Check task. Returns pdPASS if all the other tasks are found @@ -126,87 +126,87 @@ volatile unsigned long ulIdleLoops = 0UL; */ int main( void ) { - /* Setup the hardware ready for the demo. */ - prvSetupHardware(); - vParTestInitialise(); + /* Setup the hardware ready for the demo. */ + prvSetupHardware(); + vParTestInitialise(); - /* Start the standard demo application tasks. */ - vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED - 1 ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + /* Start the standard demo application tasks. */ + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED - 1 ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - /* Start the 'Check' task which is defined in this file. */ - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + /* Start the 'Check' task which is defined in this file. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - /* Start the scheduler. */ - vTaskStartScheduler(); + /* Start the scheduler. */ + vTaskStartScheduler(); - /* As the scheduler has been started the demo applications tasks will be - executing and we should never get here! */ - return 0; + /* As the scheduler has been started the demo applications tasks will be + * executing and we should never get here! */ + return 0; } /*-----------------------------------------------------------*/ static portTASK_FUNCTION( vErrorChecks, pvParameters ) { -TickType_t xDelayPeriod = mainNO_ERROR_CHECK_DELAY; - - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. */ - for( ;; ) - { - /* Wait until it is time to check again. The time we wait here depends - on whether an error has been detected or not. When an error is - detected the time is shortened resulting in a faster LED flash rate. */ - vTaskDelay( xDelayPeriod ); - - /* See if the other tasks are all ok. */ - if( prvCheckOtherTasksAreStillRunning() != pdPASS ) - { - /* An error occurred in one of the tasks so shorten the delay - period - which has the effect of increasing the frequency of the - LED toggle. */ - xDelayPeriod = mainERROR_CHECK_DELAY; - } - - /* Flash! */ - vParTestToggleLED( mainCHECK_LED ); - } + TickType_t xDelayPeriod = mainNO_ERROR_CHECK_DELAY; + + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. */ + for( ; ; ) + { + /* Wait until it is time to check again. The time we wait here depends + * on whether an error has been detected or not. When an error is + * detected the time is shortened resulting in a faster LED flash rate. */ + vTaskDelay( xDelayPeriod ); + + /* See if the other tasks are all ok. */ + if( prvCheckOtherTasksAreStillRunning() != pdPASS ) + { + /* An error occurred in one of the tasks so shorten the delay + * period - which has the effect of increasing the frequency of the + * LED toggle. */ + xDelayPeriod = mainERROR_CHECK_DELAY; + } + + /* Flash! */ + vParTestToggleLED( mainCHECK_LED ); + } } /*-----------------------------------------------------------*/ static short prvCheckOtherTasksAreStillRunning( void ) { -static short sNoErrorFound = pdTRUE; -static unsigned long ulLastIdleLoopCount = 0UL; - - /* The demo tasks maintain a count that increments every cycle of the task - provided that the task has never encountered an error. This function - checks the counts maintained by the tasks to ensure they are still being - incremented. A count remaining at the same value between calls therefore - indicates that an error has been detected. Only tasks that do not flash - an LED are checked. */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - sNoErrorFound = pdFALSE; - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - sNoErrorFound = pdFALSE; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - sNoErrorFound = pdFALSE; - } - - if( xLocalError == pdTRUE ) - { - sNoErrorFound = pdFALSE; - } + static short sNoErrorFound = pdTRUE; + static unsigned long ulLastIdleLoopCount = 0UL; + + /* The demo tasks maintain a count that increments every cycle of the task + * provided that the task has never encountered an error. This function + * checks the counts maintained by the tasks to ensure they are still being + * incremented. A count remaining at the same value between calls therefore + * indicates that an error has been detected. Only tasks that do not flash + * an LED are checked. */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + sNoErrorFound = pdFALSE; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + sNoErrorFound = pdFALSE; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + sNoErrorFound = pdFALSE; + } + + if( xLocalError == pdTRUE ) + { + sNoErrorFound = pdFALSE; + } if( ulIdleLoops == ulLastIdleLoopCount ) { @@ -217,87 +217,83 @@ static unsigned long ulLastIdleLoopCount = 0UL; ulLastIdleLoopCount = ulIdleLoops; } - return sNoErrorFound; + return sNoErrorFound; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Stop the watchdog. */ - WDTCTL = WDTPW + WDTHOLD; + /* Stop the watchdog. */ + WDTCTL = WDTPW + WDTHOLD; - /* Setup DCO+ for ( xtal * D * (N + 1) ) operation. */ - FLL_CTL0 |= DCOPLUS + XCAP18PF; + /* Setup DCO+ for ( xtal * D * (N + 1) ) operation. */ + FLL_CTL0 |= DCOPLUS + XCAP18PF; - /* X2 DCO frequency, 8MHz nominal DCO */ - SCFI0 |= FN_4; + /* X2 DCO frequency, 8MHz nominal DCO */ + SCFI0 |= FN_4; - /* (121+1) x 32768 x 2 = 7.99 Mhz */ - SCFQCTL = mainMAX_FREQUENCY; + /* (121+1) x 32768 x 2 = 7.99 Mhz */ + SCFQCTL = mainMAX_FREQUENCY; - /* Setup the IO. This is just copied from the demo supplied by SoftBaugh - for the ES449 demo board. */ - P1SEL = 0x32; - P2SEL = 0x00; - P3SEL = 0x00; - P4SEL = 0xFC; - P5SEL = 0xFF; + /* Setup the IO. This is just copied from the demo supplied by SoftBaugh + * for the ES449 demo board. */ + P1SEL = 0x32; + P2SEL = 0x00; + P3SEL = 0x00; + P4SEL = 0xFC; + P5SEL = 0xFF; } /*-----------------------------------------------------------*/ /* The idle hook is just a copy of the standard integer maths tasks. See -Demo/Common/integer.c for rationale. */ + * Demo/Common/integer.c for rationale. */ void vApplicationIdleHook( void ) __toplevel { /* These variables are all effectively set to constants so they are volatile to -ensure the compiler does not just get rid of them. */ -volatile long lValue; -volatile signed portBASE_TYPE *pxTaskHasExecuted; - - /* Keep performing a calculation and checking the result against a constant. */ - for( ;; ) - { - /* Perform the calculation. This will store partial value in - registers, resulting in a good test of the context switch mechanism. */ - lValue = intgCONST1; - lValue += intgCONST2; - - /* Yield in case cooperative scheduling is being used. */ - #if configUSE_PREEMPTION == 0 - { - taskYIELD(); - } - #endif - - /* Finish off the calculation. */ - lValue *= intgCONST3; - lValue /= intgCONST4; - - /* If the calculation is found to be incorrect we stop setting the - TaskHasExecuted variable so the check task can see an error has - occurred. */ - if( lValue != intgEXPECTED_ANSWER ) /*lint !e774 volatile used to prevent this being optimised out. */ - { - /* Don't bother with mutual exclusion - it is only read from the - check task and never written. */ - xLocalError = pdTRUE; - } - /* Yield in case cooperative scheduling is being used. */ - #if configUSE_PREEMPTION == 0 - { - taskYIELD(); - } - #endif + * ensure the compiler does not just get rid of them. */ + volatile long lValue; + volatile signed portBASE_TYPE * pxTaskHasExecuted; + + /* Keep performing a calculation and checking the result against a constant. */ + for( ; ; ) + { + /* Perform the calculation. This will store partial value in + * registers, resulting in a good test of the context switch mechanism. */ + lValue = intgCONST1; + lValue += intgCONST2; + + /* Yield in case cooperative scheduling is being used. */ + #if configUSE_PREEMPTION == 0 + { + taskYIELD(); + } + #endif + + /* Finish off the calculation. */ + lValue *= intgCONST3; + lValue /= intgCONST4; + + /* If the calculation is found to be incorrect we stop setting the + * TaskHasExecuted variable so the check task can see an error has + * occurred. */ + if( lValue != intgEXPECTED_ANSWER ) /*lint !e774 volatile used to prevent this being optimised out. */ + { + /* Don't bother with mutual exclusion - it is only read from the + * check task and never written. */ + xLocalError = pdTRUE; + } + + /* Yield in case cooperative scheduling is being used. */ + #if configUSE_PREEMPTION == 0 + { + taskYIELD(); + } + #endif ulIdleLoops++; /* Place the processor into low power mode. */ LPM3; - } + } } - - - - - diff --git a/FreeRTOS/Demo/msp430_CrossWorks/serial/serial.c b/FreeRTOS/Demo/msp430_CrossWorks/serial/serial.c index 446cd3e2ebc..61e48a36134 100644 --- a/FreeRTOS/Demo/msp430_CrossWorks/serial/serial.c +++ b/FreeRTOS/Demo/msp430_CrossWorks/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/msp430_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/msp430_GCC/FreeRTOSConfig.h index 72d9aa66e90..348c4436968 100644 --- a/FreeRTOS/Demo/msp430_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/msp430_GCC/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -48,7 +48,7 @@ #define configTICK_RATE_HZ ( ( TickType_t ) 1000 ) #define configMAX_PRIORITIES ( 4 ) #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 50 ) -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 1800 ) ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 1700 ) ) #define configMAX_TASK_NAME_LEN ( 8 ) #define configUSE_TRACE_FACILITY 0 #define configUSE_16_BIT_TICKS 1 diff --git a/FreeRTOS/Demo/msp430_GCC/ParTest/ParTest.c b/FreeRTOS/Demo/msp430_GCC/ParTest/ParTest.c index 2f6de5ad7f6..e85836d46d0 100644 --- a/FreeRTOS/Demo/msp430_GCC/ParTest/ParTest.c +++ b/FreeRTOS/Demo/msp430_GCC/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/msp430_GCC/main.c b/FreeRTOS/Demo/msp430_GCC/main.c index 09b6b63d5c9..64cf64be45d 100644 --- a/FreeRTOS/Demo/msp430_GCC/main.c +++ b/FreeRTOS/Demo/msp430_GCC/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -27,23 +27,23 @@ /* * Creates all the demo application tasks, then starts the scheduler. The WEB * documentation provides more details of the demo application tasks. - * + * * This demo is configured to execute on the ES449 prototyping board from * SoftBaugh. The ES449 has a built in LCD display and a single built in user * LED. Therefore, in place of flashing an LED, the 'flash' and 'check' tasks * toggle '*' characters on the LCD. The left most '*' represents LED 0, the * next LED 1, etc. * - * Main. c also creates a task called 'Check'. This only executes every three - * seconds but has the highest priority so is guaranteed to get processor time. - * Its main function is to check that all the other tasks are still operational. - * Each task that does not flash an LED maintains a unique count that is - * incremented each time the task successfully completes its function. Should - * any error occur within such a task the count is permanently halted. The + * Main. c also creates a task called 'Check'. This only executes every three + * seconds but has the highest priority so is guaranteed to get processor time. + * Its main function is to check that all the other tasks are still operational. + * Each task that does not flash an LED maintains a unique count that is + * incremented each time the task successfully completes its function. Should + * any error occur within such a task the count is permanently halted. The * 'check' task inspects the count of each task to ensure it has changed since - * the last time the check task executed. If all the count variables have + * the last time the check task executed. If all the count variables have * changed all the tasks are still executing error free, and the check task - * toggles an LED with a three second period. Should any task contain an error + * toggles an LED with a three second period. Should any task contain an error * at any time the LED toggle rate will increase to 500ms. * * Please read the documentation for the MSP430 port available on @@ -66,36 +66,36 @@ #include "PollQ.h" /* Constants required for hardware setup. */ -#define mainALL_BITS_OUTPUT ( ( unsigned char ) 0xff ) -#define mainMAX_FREQUENCY ( ( unsigned char ) 121 ) +#define mainALL_BITS_OUTPUT ( ( unsigned char ) 0xff ) +#define mainMAX_FREQUENCY ( ( unsigned char ) 121 ) /* Constants that define the LED's used by the various tasks. [in this case -the '*' characters on the LCD represent LED's] */ -#define mainCHECK_LED ( 4 ) -#define mainCOM_TEST_LED ( 10 ) + * the '*' characters on the LCD represent LED's] */ +#define mainCHECK_LED ( 4 ) +#define mainCOM_TEST_LED ( 10 ) /* Demo task priorities. */ -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* Baud rate used by the COM test tasks. */ -#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 19200 ) +#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 19200 ) -/* The frequency at which the 'Check' tasks executes. See the comments at the -top of the page. When the system is operating error free the 'Check' task -toggles an LED every three seconds. If an error is discovered in any task the -rate is increased to 500 milliseconds. [in this case the '*' characters on the -LCD represent LED's]*/ -#define mainNO_ERROR_CHECK_DELAY ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) -#define mainERROR_CHECK_DELAY ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) +/* The frequency at which the 'Check' tasks executes. See the comments at the + * top of the page. When the system is operating error free the 'Check' task + * toggles an LED every three seconds. If an error is discovered in any task the + * rate is increased to 500 milliseconds. [in this case the '*' characters on the + * LCD represent LED's]*/ +#define mainNO_ERROR_CHECK_DELAY ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainERROR_CHECK_DELAY ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) -/* +/* * The function that implements the Check task. See the comments at the head * of the page for implementation details. - */ -static void vErrorChecks( void *pvParameters ); + */ +static void vErrorChecks( void * pvParameters ); /* * Called by the Check task. Returns pdPASS if all the other tasks are found @@ -103,7 +103,7 @@ static void vErrorChecks( void *pvParameters ); */ static short prvCheckOtherTasksAreStillRunning( void ); -/* +/* * Perform the hardware setup required by the ES449 in order to run the demo * application. */ @@ -119,138 +119,131 @@ static volatile unsigned long ulIdleLoops = 0UL; */ int main( void ) { - /* Setup the hardware ready for the demo. */ - prvSetupHardware(); - vParTestInitialise(); + /* Setup the hardware ready for the demo. */ + prvSetupHardware(); + vParTestInitialise(); - /* Start the standard demo application tasks. */ - vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED - 1 ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + /* Start the standard demo application tasks. */ + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED - 1 ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - /* Start the 'Check' task which is defined in this file. */ - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + /* Start the 'Check' task which is defined in this file. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - /* Start the scheduler. */ - vTaskStartScheduler(); + /* Start the scheduler. */ + vTaskStartScheduler(); - /* As the scheduler has been started the demo applications tasks will be - executing and we should never get here! */ - return 0; + /* As the scheduler has been started the demo applications tasks will be + * executing and we should never get here! */ + return 0; } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void vErrorChecks( void * pvParameters ) { -static volatile unsigned long ulDummyVariable = 3UL; -TickType_t xDelayPeriod = mainNO_ERROR_CHECK_DELAY; - - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. */ - for( ;; ) - { - /* Wait until it is time to check again. The time we wait here depends - on whether an error has been detected or not. When an error is - detected the time is shortened resulting in a faster LED flash rate. */ - vTaskDelay( xDelayPeriod ); - - /* Perform a bit of 32bit maths to ensure the registers used by the - integer tasks get some exercise outside of the integer tasks - themselves. The result here is not important we are just deliberately - changing registers used by other tasks to ensure that their context - switch is operating as required. - see the demo application - documentation for more info. */ - ulDummyVariable *= 3UL; - - /* See if the other tasks are all ok. */ - if( prvCheckOtherTasksAreStillRunning() != pdPASS ) - { - /* An error occurred in one of the tasks so shorten the delay - period - which has the effect of increasing the frequency of the - LED toggle. */ - xDelayPeriod = mainERROR_CHECK_DELAY; - } - - /* Flash! */ - vParTestToggleLED( mainCHECK_LED ); - } + static volatile unsigned long ulDummyVariable = 3UL; + TickType_t xDelayPeriod = mainNO_ERROR_CHECK_DELAY; + + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. */ + for( ; ; ) + { + /* Wait until it is time to check again. The time we wait here depends + * on whether an error has been detected or not. When an error is + * detected the time is shortened resulting in a faster LED flash rate. */ + vTaskDelay( xDelayPeriod ); + + /* Perform a bit of 32bit maths to ensure the registers used by the + * integer tasks get some exercise outside of the integer tasks + * themselves. The result here is not important we are just deliberately + * changing registers used by other tasks to ensure that their context + * switch is operating as required. - see the demo application + * documentation for more info. */ + ulDummyVariable *= 3UL; + + /* See if the other tasks are all ok. */ + if( prvCheckOtherTasksAreStillRunning() != pdPASS ) + { + /* An error occurred in one of the tasks so shorten the delay + * period - which has the effect of increasing the frequency of the + * LED toggle. */ + xDelayPeriod = mainERROR_CHECK_DELAY; + } + + /* Flash! */ + vParTestToggleLED( mainCHECK_LED ); + } } /*-----------------------------------------------------------*/ static short prvCheckOtherTasksAreStillRunning( void ) { -static short sNoErrorFound = pdTRUE; -static unsigned long ulLastIdleLoops = 0UL; - - /* The demo tasks maintain a count that increments every cycle of the task - provided that the task has never encountered an error. This function - checks the counts maintained by the tasks to ensure they are still being - incremented. A count remaining at the same value between calls therefore - indicates that an error has been detected. Only tasks that do not flash - an LED are checked. */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - sNoErrorFound = pdFALSE; - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - sNoErrorFound = pdFALSE; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - sNoErrorFound = pdFALSE; - } - - if( ulLastIdleLoops == ulIdleLoops ) - { - sNoErrorFound = pdFALSE; - } - - ulLastIdleLoops = ulIdleLoops; - - return sNoErrorFound; + static short sNoErrorFound = pdTRUE; + static unsigned long ulLastIdleLoops = 0UL; + + /* The demo tasks maintain a count that increments every cycle of the task + * provided that the task has never encountered an error. This function + * checks the counts maintained by the tasks to ensure they are still being + * incremented. A count remaining at the same value between calls therefore + * indicates that an error has been detected. Only tasks that do not flash + * an LED are checked. */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + sNoErrorFound = pdFALSE; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + sNoErrorFound = pdFALSE; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + sNoErrorFound = pdFALSE; + } + + if( ulLastIdleLoops == ulIdleLoops ) + { + sNoErrorFound = pdFALSE; + } + + ulLastIdleLoops = ulIdleLoops; + + return sNoErrorFound; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Stop the watchdog. */ - WDTCTL = WDTPW + WDTHOLD; + /* Stop the watchdog. */ + WDTCTL = WDTPW + WDTHOLD; - /* Setup DCO+ for ( xtal * D * (N + 1) ) operation. */ - FLL_CTL0 |= DCOPLUS + XCAP18PF; + /* Setup DCO+ for ( xtal * D * (N + 1) ) operation. */ + FLL_CTL0 |= DCOPLUS + XCAP18PF; - /* X2 DCO frequency, 8MHz nominal DCO */ - SCFI0 |= FN_4; + /* X2 DCO frequency, 8MHz nominal DCO */ + SCFI0 |= FN_4; - /* (121+1) x 32768 x 2 = 7.99 Mhz */ - SCFQCTL = mainMAX_FREQUENCY; + /* (121+1) x 32768 x 2 = 7.99 Mhz */ + SCFQCTL = mainMAX_FREQUENCY; - /* Setup the IO as per the SoftBaugh demo for the same target hardware. */ - P1SEL = 0x32; - P2SEL = 0x00; - P3SEL = 0x00; - P4SEL = 0xFC; - P5SEL = 0xFF; + /* Setup the IO as per the SoftBaugh demo for the same target hardware. */ + P1SEL = 0x32; + P2SEL = 0x00; + P3SEL = 0x00; + P4SEL = 0xFC; + P5SEL = 0xFF; } /*-----------------------------------------------------------*/ void vApplicationIdleHook( void ); void vApplicationIdleHook( void ) { - /* Simple put the CPU into lowpower mode. */ - _BIS_SR( LPM3_bits ); - ulIdleLoops++; + /* Simple put the CPU into lowpower mode. */ + _BIS_SR( LPM3_bits ); + ulIdleLoops++; } /*-----------------------------------------------------------*/ - - - - - - - diff --git a/FreeRTOS/Demo/msp430_IAR/FreeRTOSConfig.h b/FreeRTOS/Demo/msp430_IAR/FreeRTOSConfig.h index f48984f78a2..1947adc387b 100644 --- a/FreeRTOS/Demo/msp430_IAR/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/msp430_IAR/FreeRTOSConfig.h @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/msp430_IAR/ParTest/ParTest.c b/FreeRTOS/Demo/msp430_IAR/ParTest/ParTest.c index ebbe4dc11ba..f32732ca54f 100644 --- a/FreeRTOS/Demo/msp430_IAR/ParTest/ParTest.c +++ b/FreeRTOS/Demo/msp430_IAR/ParTest/ParTest.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Demo/msp430_IAR/main.c b/FreeRTOS/Demo/msp430_IAR/main.c index d807e1db59f..f32f85493da 100644 --- a/FreeRTOS/Demo/msp430_IAR/main.c +++ b/FreeRTOS/Demo/msp430_IAR/main.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in @@ -65,43 +65,43 @@ #include "PollQ.h" /* Constants required for hardware setup. */ -#define mainALL_BITS_OUTPUT ( ( unsigned char ) 0xff ) -#define mainMAX_FREQUENCY ( ( unsigned char ) 121 ) +#define mainALL_BITS_OUTPUT ( ( unsigned char ) 0xff ) +#define mainMAX_FREQUENCY ( ( unsigned char ) 121 ) /* Constants that define the LED's used by the various tasks. [in this case -the '*' characters on the LCD represent LED's] */ -#define mainCHECK_LED ( 4 ) -#define mainCOM_TEST_LED ( 10 ) + * the '*' characters on the LCD represent LED's] */ +#define mainCHECK_LED ( 4 ) +#define mainCOM_TEST_LED ( 10 ) /* Demo task priorities. */ -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) -#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) /* Baud rate used by the COM test tasks. */ -#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 19200 ) +#define mainCOM_TEST_BAUD_RATE ( ( unsigned long ) 19200 ) /* The frequency at which the 'Check' tasks executes. See the comments at the -top of the page. When the system is operating error free the 'Check' task -toggles an LED every three seconds. If an error is discovered in any task the -rate is increased to 500 milliseconds. [in this case the '*' characters on the -LCD represent LED's]*/ -#define mainNO_ERROR_CHECK_DELAY ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) -#define mainERROR_CHECK_DELAY ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) + * top of the page. When the system is operating error free the 'Check' task + * toggles an LED every three seconds. If an error is discovered in any task the + * rate is increased to 500 milliseconds. [in this case the '*' characters on the + * LCD represent LED's]*/ +#define mainNO_ERROR_CHECK_DELAY ( ( TickType_t ) 3000 / portTICK_PERIOD_MS ) +#define mainERROR_CHECK_DELAY ( ( TickType_t ) 500 / portTICK_PERIOD_MS ) /* The constants used in the calculation. */ -#define intgCONST1 ( ( long ) 123 ) -#define intgCONST2 ( ( long ) 234567 ) -#define intgCONST3 ( ( long ) -3 ) -#define intgCONST4 ( ( long ) 7 ) -#define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 ) +#define intgCONST1 ( ( long ) 123 ) +#define intgCONST2 ( ( long ) 234567 ) +#define intgCONST3 ( ( long ) -3 ) +#define intgCONST4 ( ( long ) 7 ) +#define intgEXPECTED_ANSWER ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 ) /* * The function that implements the Check task. See the comments at the head * of the page for implementation details. */ -static void vErrorChecks( void *pvParameters ); +static void vErrorChecks( void * pvParameters ); /* * Called by the Check task. Returns pdPASS if all the other tasks are found @@ -126,87 +126,87 @@ volatile unsigned long ulIdleLoops = 0UL; */ int main( void ) { - /* Setup the hardware ready for the demo. */ - prvSetupHardware(); - vParTestInitialise(); + /* Setup the hardware ready for the demo. */ + prvSetupHardware(); + vParTestInitialise(); - /* Start the standard demo application tasks. */ - vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); - vStartIntegerMathTasks( tskIDLE_PRIORITY ); - vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED - 1 ); - vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + /* Start the standard demo application tasks. */ + vStartLEDFlashTasks( mainLED_TASK_PRIORITY ); + vStartIntegerMathTasks( tskIDLE_PRIORITY ); + vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED - 1 ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); - /* Start the 'Check' task which is defined in this file. */ - xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + /* Start the 'Check' task which is defined in this file. */ + xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - /* Start the scheduler. */ - vTaskStartScheduler(); + /* Start the scheduler. */ + vTaskStartScheduler(); - /* As the scheduler has been started the demo applications tasks will be - executing and we should never get here! */ - return 0; + /* As the scheduler has been started the demo applications tasks will be + * executing and we should never get here! */ + return 0; } /*-----------------------------------------------------------*/ static portTASK_FUNCTION( vErrorChecks, pvParameters ) { -TickType_t xDelayPeriod = mainNO_ERROR_CHECK_DELAY; - - /* Cycle for ever, delaying then checking all the other tasks are still - operating without error. */ - for( ;; ) - { - /* Wait until it is time to check again. The time we wait here depends - on whether an error has been detected or not. When an error is - detected the time is shortened resulting in a faster LED flash rate. */ - vTaskDelay( xDelayPeriod ); - - /* See if the other tasks are all ok. */ - if( prvCheckOtherTasksAreStillRunning() != pdPASS ) - { - /* An error occurred in one of the tasks so shorten the delay - period - which has the effect of increasing the frequency of the - LED toggle. */ - xDelayPeriod = mainERROR_CHECK_DELAY; - } - - /* Flash! */ - vParTestToggleLED( mainCHECK_LED ); - } + TickType_t xDelayPeriod = mainNO_ERROR_CHECK_DELAY; + + /* Cycle for ever, delaying then checking all the other tasks are still + * operating without error. */ + for( ; ; ) + { + /* Wait until it is time to check again. The time we wait here depends + * on whether an error has been detected or not. When an error is + * detected the time is shortened resulting in a faster LED flash rate. */ + vTaskDelay( xDelayPeriod ); + + /* See if the other tasks are all ok. */ + if( prvCheckOtherTasksAreStillRunning() != pdPASS ) + { + /* An error occurred in one of the tasks so shorten the delay + * period - which has the effect of increasing the frequency of the + * LED toggle. */ + xDelayPeriod = mainERROR_CHECK_DELAY; + } + + /* Flash! */ + vParTestToggleLED( mainCHECK_LED ); + } } /*-----------------------------------------------------------*/ static short prvCheckOtherTasksAreStillRunning( void ) { -static short sNoErrorFound = pdTRUE; -static unsigned long ulLastIdleLoopCount = 0UL; - - /* The demo tasks maintain a count that increments every cycle of the task - provided that the task has never encountered an error. This function - checks the counts maintained by the tasks to ensure they are still being - incremented. A count remaining at the same value between calls therefore - indicates that an error has been detected. Only tasks that do not flash - an LED are checked. */ - - if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) - { - sNoErrorFound = pdFALSE; - } - - if( xAreComTestTasksStillRunning() != pdTRUE ) - { - sNoErrorFound = pdFALSE; - } - - if( xArePollingQueuesStillRunning() != pdTRUE ) - { - sNoErrorFound = pdFALSE; - } - - if( xLocalError == pdTRUE ) - { - sNoErrorFound = pdFALSE; - } + static short sNoErrorFound = pdTRUE; + static unsigned long ulLastIdleLoopCount = 0UL; + + /* The demo tasks maintain a count that increments every cycle of the task + * provided that the task has never encountered an error. This function + * checks the counts maintained by the tasks to ensure they are still being + * incremented. A count remaining at the same value between calls therefore + * indicates that an error has been detected. Only tasks that do not flash + * an LED are checked. */ + + if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) + { + sNoErrorFound = pdFALSE; + } + + if( xAreComTestTasksStillRunning() != pdTRUE ) + { + sNoErrorFound = pdFALSE; + } + + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + sNoErrorFound = pdFALSE; + } + + if( xLocalError == pdTRUE ) + { + sNoErrorFound = pdFALSE; + } if( ulIdleLoops == ulLastIdleLoopCount ) { @@ -217,87 +217,82 @@ static unsigned long ulLastIdleLoopCount = 0UL; ulLastIdleLoopCount = ulIdleLoops; } - return sNoErrorFound; + return sNoErrorFound; } /*-----------------------------------------------------------*/ static void prvSetupHardware( void ) { - /* Stop the watchdog. */ - WDTCTL = WDTPW + WDTHOLD; + /* Stop the watchdog. */ + WDTCTL = WDTPW + WDTHOLD; - /* Setup DCO+ for ( xtal * D * (N + 1) ) operation. */ - FLL_CTL0 |= DCOPLUS + XCAP18PF; + /* Setup DCO+ for ( xtal * D * (N + 1) ) operation. */ + FLL_CTL0 |= DCOPLUS + XCAP18PF; - /* X2 DCO frequency, 8MHz nominal DCO */ - SCFI0 |= FN_4; + /* X2 DCO frequency, 8MHz nominal DCO */ + SCFI0 |= FN_4; - /* (121+1) x 32768 x 2 = 7.99 Mhz */ - SCFQCTL = mainMAX_FREQUENCY; + /* (121+1) x 32768 x 2 = 7.99 Mhz */ + SCFQCTL = mainMAX_FREQUENCY; - /* Setup the IO. This is just copied from the demo supplied by SoftBaugh - for the ES449 demo board. */ - P1SEL = 0x32; - P2SEL = 0x00; - P3SEL = 0x00; - P4SEL = 0xFC; - P5SEL = 0xFF; + /* Setup the IO. This is just copied from the demo supplied by SoftBaugh + * for the ES449 demo board. */ + P1SEL = 0x32; + P2SEL = 0x00; + P3SEL = 0x00; + P4SEL = 0xFC; + P5SEL = 0xFF; } /*-----------------------------------------------------------*/ /* The idle hook is just a copy of the standard integer maths tasks. See -Demo/Common/integer.c for rationale. */ + * Demo/Common/integer.c for rationale. */ void vApplicationIdleHook( void ) { /* These variables are all effectively set to constants so they are volatile to -ensure the compiler does not just get rid of them. */ -volatile long lValue; - - /* Keep performing a calculation and checking the result against a constant. */ - for( ;; ) - { - /* Perform the calculation. This will store partial value in - registers, resulting in a good test of the context switch mechanism. */ - lValue = intgCONST1; - lValue += intgCONST2; - - /* Yield in case cooperative scheduling is being used. */ - #if configUSE_PREEMPTION == 0 - { - taskYIELD(); - } - #endif - - /* Finish off the calculation. */ - lValue *= intgCONST3; - lValue /= intgCONST4; - - /* If the calculation is found to be incorrect we stop setting the - TaskHasExecuted variable so the check task can see an error has - occurred. */ - if( lValue != intgEXPECTED_ANSWER ) /*lint !e774 volatile used to prevent this being optimised out. */ - { - /* Don't bother with mutual exclusion - it is only read from the - check task and never written. */ - xLocalError = pdTRUE; - } - /* Yield in case cooperative scheduling is being used. */ - #if configUSE_PREEMPTION == 0 - { - taskYIELD(); - } - #endif + * ensure the compiler does not just get rid of them. */ + volatile long lValue; + + /* Keep performing a calculation and checking the result against a constant. */ + for( ; ; ) + { + /* Perform the calculation. This will store partial value in + * registers, resulting in a good test of the context switch mechanism. */ + lValue = intgCONST1; + lValue += intgCONST2; + + /* Yield in case cooperative scheduling is being used. */ + #if configUSE_PREEMPTION == 0 + { + taskYIELD(); + } + #endif + + /* Finish off the calculation. */ + lValue *= intgCONST3; + lValue /= intgCONST4; + + /* If the calculation is found to be incorrect we stop setting the + * TaskHasExecuted variable so the check task can see an error has + * occurred. */ + if( lValue != intgEXPECTED_ANSWER ) /*lint !e774 volatile used to prevent this being optimised out. */ + { + /* Don't bother with mutual exclusion - it is only read from the + * check task and never written. */ + xLocalError = pdTRUE; + } + + /* Yield in case cooperative scheduling is being used. */ + #if configUSE_PREEMPTION == 0 + { + taskYIELD(); + } + #endif ulIdleLoops++; /* Place the processor into low power mode. */ LPM3; - } + } } - - - - - - diff --git a/FreeRTOS/Demo/msp430_IAR/serial/serial.c b/FreeRTOS/Demo/msp430_IAR/serial/serial.c index 80cbaa93269..0ee20c92341 100644 --- a/FreeRTOS/Demo/msp430_IAR/serial/serial.c +++ b/FreeRTOS/Demo/msp430_IAR/serial/serial.c @@ -1,6 +1,6 @@ /* * FreeRTOS V202212.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 * this software and associated documentation files (the "Software"), to deal in diff --git a/FreeRTOS/Source b/FreeRTOS/Source index ca907b445b5..cf2366c9497 160000 --- a/FreeRTOS/Source +++ b/FreeRTOS/Source @@ -1 +1 @@ -Subproject commit ca907b445b52f5814705761cf63cb2ef5e43605a +Subproject commit cf2366c949735eec9c5eee83b5909bb913cd1679 diff --git a/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c b/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c index 4fb1aa40324..a99773c53da 100644 --- a/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c +++ b/FreeRTOS/Test/CMock/smp/config_assert/config_assert_utest.c @@ -395,6 +395,10 @@ void test_vTaskDelete_assert_scheduler_suspended_eq_1( void ) listLIST_ITEM_CONTAINER_ExpectAnyArgsAndReturn( NULL ); vListInsertEnd_ExpectAnyArgs(); vPortCurrentTaskDying_ExpectAnyArgs(); + vFakePortExitCriticalSection_Expect(); + + /* Critical section for check task is running. */ + vFakePortEnterCriticalSection_Expect(); vFakePortGetCoreID_ExpectAndReturn( 1 ); EXPECT_ASSERT_BREAK( vTaskDelete( xTaskToDelete ) ); diff --git a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c index 2510cdbcc28..06e0613791c 100644 --- a/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c +++ b/FreeRTOS/Test/CMock/smp/multiple_priorities_no_timeslice_mock/covg_multiple_priorities_no_timeslice_mock_utest.c @@ -113,6 +113,10 @@ extern volatile UBaseType_t uxCurrentNumberOfTasks; extern volatile UBaseType_t uxSchedulerSuspended; extern volatile UBaseType_t uxTopReadyPriority; extern List_t pxReadyTasksLists[ configMAX_PRIORITIES ]; +extern List_t xDelayedTaskList1; +extern List_t xDelayedTaskList2; +extern List_t xTasksWaitingTermination; +extern List_t xSuspendedTaskList; extern UBaseType_t uxTaskNumber; extern volatile TickType_t xTickCount; extern volatile TickType_t xNextTaskUnblockTime; @@ -580,6 +584,10 @@ void test_coverage_vTaskDelete_task_not_running( void ) vFakePortExitCriticalSection_Expect(); + /* Critical section for check task is running. */ + vFakePortEnterCriticalSection_Expect(); + vFakePortExitCriticalSection_Expect(); + /* API Call */ vTaskDelete( xTaskToDelete ); @@ -1125,8 +1133,10 @@ void test_coverage_prvCreateIdleTasks_name_within_max_len( void ) TCB_t * xIdleTask; TCB_t xTask = { 0 }; int i; + UBaseType_t uxPriority; pcIdleTaskName = "IDLE longXX"; + xSchedulerRunning = pdFALSE; for( i = 0; i < configNUMBER_OF_CORES; i++ ) { @@ -1141,10 +1151,27 @@ void test_coverage_prvCreateIdleTasks_name_within_max_len( void ) listSET_LIST_ITEM_VALUE_ExpectAnyArgs(); pxPortInitialiseStack_ExpectAnyArgsAndReturn( NULL ); + /* prvAddNewTaskToReadyList. */ vFakePortEnterCriticalSection_Expect(); + + /* prvInitialiseTaskLists call when first task is initialised. */ + if( i == 0 ) + { + for( uxPriority = ( UBaseType_t ) 0U; uxPriority < ( UBaseType_t ) configMAX_PRIORITIES; uxPriority++ ) + { + vListInitialise_Expect( &pxReadyTasksLists[ uxPriority ] ); + } + + vListInitialise_Expect( &xDelayedTaskList1 ); + vListInitialise_Expect( &xDelayedTaskList2 ); + vListInitialise_Expect( &xPendingReadyList ); + + vListInitialise_Expect( &xTasksWaitingTermination ); + vListInitialise_Expect( &xSuspendedTaskList ); + } + listINSERT_END_ExpectAnyArgs(); portSetupTCB_CB_ExpectAnyArgs(); - vFakePortGetCoreID_ExpectAndReturn( 0 ); vFakePortExitCriticalSection_Expect(); } @@ -1190,6 +1217,7 @@ void test_coverage_prvCreateIdleTasks_name_too_long( void ) pcIdleTaskName = "IDLE long name"; uxCurrentNumberOfTasks = 2; + xSchedulerRunning = pdFALSE; for( i = 0; i < configNUMBER_OF_CORES; i++ ) { @@ -1203,10 +1231,10 @@ void test_coverage_prvCreateIdleTasks_name_too_long( void ) vListInitialiseItem_ExpectAnyArgs(); listSET_LIST_ITEM_VALUE_ExpectAnyArgs(); pxPortInitialiseStack_ExpectAnyArgsAndReturn( NULL ); + vFakePortEnterCriticalSection_Expect(); listINSERT_END_ExpectAnyArgs(); portSetupTCB_CB_ExpectAnyArgs(); - vFakePortGetCoreID_ExpectAndReturn( 0 ); vFakePortExitCriticalSection_Expect(); } diff --git a/manifest.yml b/manifest.yml index 1e65f71d016..8240ff67b81 100644 --- a/manifest.yml +++ b/manifest.yml @@ -5,7 +5,7 @@ license: "MIT" dependencies: - name: "FreeRTOS-Kernel" - version: "ca907b445" + version: "cf2366c" repository: type: "git" url: "https://github.com/FreeRTOS/FreeRTOS-Kernel.git"