+++ /dev/null
-/*\r
- * FreeRTOS Kernel V10.1.0\r
- * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
- * this software and associated documentation files (the "Software"), to deal in\r
- * the Software without restriction, including without limitation the rights to\r
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
- * the Software, and to permit persons to whom the Software is furnished to do so,\r
- * subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included in all\r
- * copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
- * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
- * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- * http://www.FreeRTOS.org\r
- * http://aws.amazon.com/freertos\r
- *\r
- * 1 tab == 4 spaces!\r
- */\r
-\r
-/******************************************************************************\r
- * This project provides two demo applications. A simple blinky style project,\r
- * and a more comprehensive test and demo application. The\r
- * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting (defined in this file) is used to\r
- * select between the two. The simply blinky demo is implemented and described\r
- * in main_blinky.c. The more comprehensive test and demo application is\r
- * implemented and described in main_full.c.\r
- *\r
- * This file implements the code that is not demo specific, including the\r
- * hardware setup and FreeRTOS hook functions.\r
- *\r
- * This project does not provide an example of how to write an RTOS compatible\r
- * interrupt service routine (other than the tick interrupt itself), so this\r
- * file contains the function vAnExampleISR_C_Handler() as a dummy example (that\r
- * is not actually installed) that can be used as a reference. Also see the\r
- * file ExampleISR.S, and the documentation page for this demo on the\r
- * FreeRTOS.org website for full instructions.\r
- *\r
- * ENSURE TO READ THE DOCUMENTATION PAGE FOR THIS PORT AND DEMO APPLICATION ON\r
- * THE http://www.FreeRTOS.org WEB SITE FOR FULL INFORMATION ON USING THIS DEMO\r
- * APPLICATION, AND ITS ASSOCIATE FreeRTOS ARCHITECTURE PORT!\r
- *\r
- */\r
-\r
-/* Scheduler include files. */\r
-#include "FreeRTOS.h"\r
-#include "task.h"\r
-#include "semphr.h"\r
-\r
-/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,\r
-or 0 to run the more comprehensive test and demo application. */\r
-#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-/*\r
- * main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.\r
- * main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.\r
- */\r
-#if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1\r
- extern void main_blinky( void );\r
-#else\r
- extern void main_full( void );\r
-#endif\r
-\r
-/* Prototypes for the standard FreeRTOS callback/hook functions implemented\r
-within this file. */\r
-void vApplicationMallocFailedHook( void );\r
-void vApplicationIdleHook( void );\r
-void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );\r
-void vApplicationTickHook( void );\r
-\r
-/* This variable is not actually used, but provided to allow an example of how\r
-to write an ISR to be included in this file. */\r
-static SemaphoreHandle_t xSemaphore = NULL;\r
-/*-----------------------------------------------------------*/\r
-\r
-#define portPSW ( 0xc6UL )\r
-volatile uint32_t *pulAddress;\r
-volatile uint32_t ulValue, ulError = 0;\r
-\r
-int main( void )\r
-{\r
- /* Store an address below 0x8000 */\r
- pulAddress = ( uint32_t * ) 0x7fff;\r
-\r
- /* Cast and OR with a value that uses the two most significant\r
- bytes. */\r
- ulValue = ( ( uint32_t ) pulAddress ) | ( portPSW << 24UL );\r
-\r
- /* This test passes. */\r
- if( ulValue != 0xc6007fff )\r
- {\r
- /* This line of code is not executed. */\r
- ulError = 1;\r
- }\r
-\r
- /* Now do the same, but with an address above 0x7fff, but\r
- still slower than the max 16-bit value. */\r
- pulAddress = ( uint32_t * ) 0x8000;\r
- ulValue = ( ( uint32_t ) pulAddress ) | ( portPSW << 24UL );\r
-\r
- /* This test *fails*. */\r
- if( ulValue != 0xc6008000 )\r
- {\r
- /* This line of code *is* executed. */\r
- ulError = 1;\r
- }\r
-\r
-\r
- /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is\r
- described at the top of this file. */\r
- #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1\r
- {\r
- main_blinky();\r
- }\r
- #else\r
- {\r
- main_full();\r
- }\r
- #endif\r
-\r
- /* Should not get here. See the definitions of main_blinky() and\r
- main_full(). */\r
- return 0;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vAnExampleISR_C_Handler( void )\r
-{\r
- /*\r
- * This demo does not include a functional interrupt service routine - so\r
- * this dummy handler (which is not actually installed) is provided as an\r
- * example of how an ISR that needs to cause a context switch needs to be\r
- * implemented. ISRs that do not cause a context switch have no special\r
- * requirements and can be written as per the compiler documentation.\r
- *\r
- * This C function is called from a wrapper function that is implemented\r
- * in assembly code. See vANExampleISR_ASM_Wrapper() in ExampleISR.S. Also\r
- * see the documentation page for this demo on the FreeRTOS.org website for\r
- * full instructions.\r
- */\r
-short sHigherPriorityTaskWoken = pdFALSE;\r
-\r
- /* Handler code goes here...*/\r
-\r
- /* For purposes of demonstration, assume at some point the hander calls\r
- xSemaphoreGiveFromISR().*/\r
- xSemaphoreGiveFromISR( xSemaphore, &sHigherPriorityTaskWoken );\r
-\r
- /* If giving the semaphore unblocked a task, and the unblocked task has a\r
- priority higher than or equal to the currently running task, then\r
- sHigherPriorityTaskWoken will have been set to pdTRUE internally within the\r
- xSemaphoreGiveFromISR() function. Passing a pdTRUE value to\r
- portYIELD_FROM_ISR() will cause this interrupt to return directly to the\r
- higher priority unblocked task. */\r
- portYIELD_FROM_ISR( sHigherPriorityTaskWoken );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vApplicationMallocFailedHook( void )\r
-{\r
- /* Called if a call to pvPortMalloc() fails because there is insufficient\r
- free memory available in the FreeRTOS heap. pvPortMalloc() is called\r
- internally by FreeRTOS API functions that create tasks, queues, software\r
- timers, and semaphores. The size of the FreeRTOS heap is set by the\r
- configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */\r
- taskDISABLE_INTERRUPTS();\r
- for( ;; );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )\r
-{\r
- ( void ) pcTaskName;\r
- ( void ) pxTask;\r
-\r
- /* Run time stack overflow checking is performed if\r
- configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook\r
- function is called if a stack overflow is detected. */\r
- taskDISABLE_INTERRUPTS();\r
- for( ;; );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vApplicationIdleHook( void )\r
-{\r
-volatile size_t xFreeHeapSpace;\r
-\r
- /* This is just a trivial example of an idle hook. It is called on each\r
- cycle of the idle task. It must *NOT* attempt to block. In this case the\r
- idle task just queries the amount of FreeRTOS heap that remains. See the\r
- memory management section on the http://www.FreeRTOS.org web site for memory\r
- management options. If there is a lot of heap memory free then the\r
- configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up\r
- RAM. */\r
- xFreeHeapSpace = xPortGetFreeHeapSize();\r
-\r
- /* Remove compiler warning about xFreeHeapSpace being set but never used. */\r
- ( void ) xFreeHeapSpace;\r
-}\r
-\r
-\r