]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_IAR/blinky_demo/main_blinky.c
Renamed RISC-V_RV32_SiFive_HiFive1_IAR directory to RISC-V_RV32_SiFive_HiFive1-RevB_I...
[freertos] / FreeRTOS / Demo / RISC-V_RV32_SiFive_HiFive1_IAR / blinky_demo / main_blinky.c
diff --git a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_IAR/blinky_demo/main_blinky.c b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_IAR/blinky_demo/main_blinky.c
deleted file mode 100644 (file)
index a1d1edb..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*\r
- * FreeRTOS Kernel V10.2.1\r
- * Copyright (C) 2019 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
- * NOTE 1:  This project provides two demo applications.  A simple blinky\r
- * style project, and a more comprehensive test and demo application.  The\r
- * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select\r
- * between the two.  See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY\r
- * in main.c.  This file implements the simply blinky style version.\r
- *\r
- * NOTE 2:  This file only contains the source code that is specific to the\r
- * basic demo.  Generic functions, such FreeRTOS hook functions, and functions\r
- * required to configure the hardware are defined in main.c.\r
- ******************************************************************************\r
- *\r
- * main_blinky() creates one queue, and two tasks.  It then starts the\r
- * scheduler.\r
- *\r
- * The Queue Send Task:\r
- * The queue send task is implemented by the prvQueueSendTask() function in\r
- * this file.  prvQueueSendTask() sits in a loop that causes it to repeatedly\r
- * block for 1000 milliseconds, before sending the value 100 to the queue that\r
- * was created within main_blinky().  Once the value is sent, the task loops\r
- * back around to block for another 1000 milliseconds...and so on.\r
- *\r
- * The Queue Receive Task:\r
- * The queue receive task is implemented by the prvQueueReceiveTask() function\r
- * in this file.  prvQueueReceiveTask() sits in a loop where it repeatedly\r
- * blocks on attempts to read data from the queue that was created within\r
- * main_blinky().  When data is received, the task checks the value of the\r
- * data, and if the value equals the expected 100, writes 'Blink' to the UART\r
- * (the UART is used in place of the LED to allow easy execution in QEMU).  The\r
- * 'block time' parameter passed to the queue receive function specifies that\r
- * the task should be held in the Blocked state indefinitely to wait for data to\r
- * be available on the queue.  The queue receive task will only leave the\r
- * Blocked state when the queue send task writes to the queue.  As the queue\r
- * send task writes to the queue every 1000 milliseconds, the queue receive\r
- * task leaves the Blocked state every 1000 milliseconds, and therefore toggles\r
- * the LED every 200 milliseconds.\r
- */\r
-\r
-/* Standard includes. */\r
-#include <stdio.h>\r
-#include <string.h>\r
-\r
-/* Kernel includes. */\r
-#include "FreeRTOS.h"\r
-#include "task.h"\r
-#include "queue.h"\r
-\r
-/* Priorities used by the tasks. */\r
-#define mainQUEUE_RECEIVE_TASK_PRIORITY                ( tskIDLE_PRIORITY + 2 )\r
-#define        mainQUEUE_SEND_TASK_PRIORITY            ( tskIDLE_PRIORITY + 1 )\r
-\r
-/* The rate at which data is sent to the queue.  The 200ms value is converted\r
-to ticks using the pdMS_TO_TICKS() macro. */\r
-#define mainQUEUE_SEND_FREQUENCY_MS                    pdMS_TO_TICKS( 1000 )\r
-\r
-/* The maximum number items the queue can hold.  The priority of the receiving\r
-task is above the priority of the sending task, so the receiving task will\r
-preempt the sending task and remove the queue items each time the sending task\r
-writes to the queue.  Therefore the queue will never have more than one item in\r
-it at any time, and even with a queue length of 1, the sending task will never\r
-find the queue full. */\r
-#define mainQUEUE_LENGTH                                       ( 1 )\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-/*\r
- * Called by main when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1 in\r
- * main.c.\r
- */\r
-void main_blinky( void );\r
-\r
-/*\r
- * The tasks as described in the comments at the top of this file.\r
- */\r
-static void prvQueueReceiveTask( void *pvParameters );\r
-static void prvQueueSendTask( void *pvParameters );\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-/* The queue used by both tasks. */\r
-static QueueHandle_t xQueue = NULL;\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-void main_blinky( void )\r
-{\r
-       /* Create the queue. */\r
-       xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );\r
-\r
-       if( xQueue != NULL )\r
-       {\r
-               /* Start the two tasks as described in the comments at the top of this\r
-               file. */\r
-               xTaskCreate( prvQueueReceiveTask,                               /* The function that implements the task. */\r
-                                       "Rx",                                                           /* The text name assigned to the task - for debug only as it is not used by the kernel. */\r
-                                       configMINIMAL_STACK_SIZE * 2U,                  /* The size of the stack to allocate to the task. */\r
-                                       NULL,                                                           /* The parameter passed to the task - not used in this case. */\r
-                                       mainQUEUE_RECEIVE_TASK_PRIORITY,        /* The priority assigned to the task. */\r
-                                       NULL );                                                         /* The task handle is not required, so NULL is passed. */\r
-\r
-               xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE * 2U, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );\r
-\r
-               /* Start the tasks and timer running. */\r
-               vTaskStartScheduler();\r
-       }\r
-\r
-       /* If all is well, the scheduler will now be running, and the following\r
-       line will never be reached.  If the following line does execute, then\r
-       there was insufficient FreeRTOS heap memory available for the Idle and/or\r
-       timer tasks to be created.  See the memory management section on the\r
-       FreeRTOS web site for more details on the FreeRTOS heap\r
-       http://www.freertos.org/a00111.html. */\r
-       for( ;; );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvQueueSendTask( void *pvParameters )\r
-{\r
-TickType_t xNextWakeTime;\r
-const unsigned long ulValueToSend = 100UL;\r
-BaseType_t xReturned;\r
-\r
-       /* Remove compiler warning about unused parameter. */\r
-       ( void ) pvParameters;\r
-\r
-       /* Initialise xNextWakeTime - this only needs to be done once. */\r
-       xNextWakeTime = xTaskGetTickCount();\r
-\r
-       for( ;; )\r
-       {\r
-               /* Place this task in the blocked state until it is time to run again. */\r
-               vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );\r
-\r
-               /* Send to the queue - causing the queue receive task to unblock and\r
-               toggle the LED.  0 is used as the block time so the sending operation\r
-               will not block - it shouldn't need to block as the queue should always\r
-               be empty at this point in the code. */\r
-               xReturned = xQueueSend( xQueue, &ulValueToSend, 0U );\r
-               configASSERT( xReturned == pdPASS );\r
-       }\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvQueueReceiveTask( void *pvParameters )\r
-{\r
-unsigned long ulReceivedValue;\r
-const unsigned long ulExpectedValue = 100UL;\r
-const char * const pcPassMessage = "Blink\r\n";\r
-const char * const pcFailMessage = "Unexpected value received\r\n";\r
-extern void vSendString( const char * const pcString );\r
-extern void vToggleLED( void );\r
-\r
-       /* Remove compiler warning about unused parameter. */\r
-       ( void ) pvParameters;\r
-\r
-       for( ;; )\r
-       {\r
-               /* Wait until something arrives in the queue - this task will block\r
-               indefinitely provided INCLUDE_vTaskSuspend is set to 1 in\r
-               FreeRTOSConfig.h. */\r
-               xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );\r
-\r
-               /*  To get here something must have been received from the queue, but\r
-               is it the expected value?  If it is, toggle the LED. */\r
-               if( ulReceivedValue == ulExpectedValue )\r
-               {\r
-                       vSendString( pcPassMessage );\r
-                       vToggleLED();\r
-                       ulReceivedValue = 0U;\r
-               }\r
-               else\r
-               {\r
-                       vSendString( pcFailMessage );\r
-               }\r
-       }\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r