/* The array used as the heap is declared by the application to allow the\r
__persistent keyword to be used. See http://www.freertos.org/a00111.html#heap_4 */\r
#define configAPPLICATION_ALLOCATED_HEAP 1\r
- \r
+\r
#define configUSE_PREEMPTION 1\r
#define configMAX_PRIORITIES ( 5 )\r
+#define configCPU_CLOCK_HZ ( 8000000 )\r
#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */\r
-#define configTOTAL_HEAP_SIZE ( 5 * 1024 )\r
+#define configTOTAL_HEAP_SIZE ( 20 * 1024 )\r
#define configMAX_TASK_NAME_LEN ( 15 )\r
#define configUSE_TRACE_FACILITY 1\r
#define configUSE_16_BIT_TICKS 0\r
#endif\r
\r
/* Hook function related definitions. */\r
-#define configUSE_TICK_HOOK 0\r
+#define configUSE_TICK_HOOK 1\r
#define configUSE_IDLE_HOOK 0\r
#define configUSE_MALLOC_FAILED_HOOK 1\r
#define configCHECK_FOR_STACK_OVERFLOW 2\r
\r
/* Software timer related definitions. */\r
-#define configUSE_TIMERS 0\r
+#define configUSE_TIMERS 1\r
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )\r
#define configTIMER_QUEUE_LENGTH 5\r
-#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )\r
+#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )\r
\r
/* Event group related definitions. */\r
#define configUSE_EVENT_GROUPS 0\r
\r
+/* Prevent the following line being included from asm files. */\r
+#ifdef __ICC430__\r
+ void vConfigureTimerForRunTimeStats( void );\r
+#endif\r
+\r
/* Run time stats gathering definitions. */\r
-#define configGENERATE_RUN_TIME_STATS 0\r
+extern volatile uint32_t ulRunTimeCounterOverflows;\r
+#define configGENERATE_RUN_TIME_STATS 1\r
+#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()\r
+/* Return the current timer counter value + the overflow counter. */\r
+#define portGET_RUN_TIME_COUNTER_VALUE() ( ( ( uint32_t ) TA1R ) + ulRunTimeCounterOverflows )\r
\r
/* Co-routine definitions. */\r
#define configUSE_CO_ROUTINES 0\r
#define INCLUDE_xTaskGetIdleTaskHandle 1\r
#define INCLUDE_xQueueGetMutexHolder 1\r
#define INCLUDE_eTaskGetState 1\r
-#define INCLUDE_xEventGroupSetBitFromISR 0\r
-#define INCLUDE_xTimerPendFunctionCall 0\r
+#define INCLUDE_xEventGroupSetBitFromISR 1\r
+#define INCLUDE_xTimerPendFunctionCall 1\r
#define INCLUDE_pcTaskGetTaskName 1\r
\r
-/* Not using stats, so no need to include the formatting functions. */\r
-#define configUSE_STATS_FORMATTING_FUNCTIONS 0\r
+/* Include functions that format system and run-time stats into human readable\r
+tables. */\r
+#define configUSE_STATS_FORMATTING_FUNCTIONS 1\r
\r
/* Assert call defined for debug builds. */\r
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }\r
case configTICK__VECTOR is set to TIMER0_A0_VECTOR. */\r
#define configTICK_VECTOR TIMER0_A0_VECTOR\r
\r
+/* The size of the buffer used by the CLI to place output generated by the CLI.\r
+WARNING: By default there is no overflow checking when writing to this\r
+buffer. */\r
+#define configCOMMAND_INT_MAX_OUTPUT_SIZE 1500\r
+\r
+/* The __persistent qualifier is needed on the buffer used to hold CLI output,\r
+so the buffer must be declared in application code, rather than in\r
+FreeRTOS_CLI.c. */\r
+#define configAPPLICATION_PROVIDES_cOutputBuffer 1\r
+\r
+/* Include the command that queries the amount of free heap remaining in the\r
+CLI. */\r
+#define configINCLUDE_QUERY_HEAP_COMMAND 1\r
+\r
+/* The baudrate used for the CLI. */\r
+#define configCLI_BAUD_RATE 19200\r
+\r
#endif /* FREERTOS_CONFIG_H */\r
\r
--- /dev/null
+/*\r
+ FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+ All rights reserved\r
+\r
+ VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+ ***************************************************************************\r
+ >>! NOTE: The modification to the GPL is included to allow you to !<<\r
+ >>! distribute a combined work that includes FreeRTOS without being !<<\r
+ >>! obliged to provide the source code for proprietary components !<<\r
+ >>! outside of the FreeRTOS kernel. !<<\r
+ ***************************************************************************\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+ FOR A PARTICULAR PURPOSE. Full license text is available on the following\r
+ link: http://www.freertos.org/a00114.html\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS provides completely free yet professionally developed, *\r
+ * robust, strictly quality controlled, supported, and cross *\r
+ * platform software that is more than just the market leader, it *\r
+ * is the industry's de facto standard. *\r
+ * *\r
+ * Help yourself get started quickly while simultaneously helping *\r
+ * to support the FreeRTOS project by purchasing a FreeRTOS *\r
+ * tutorial book, reference manual, or both: *\r
+ * http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading\r
+ the FAQ page "My application does not run, what could be wrong?". Have you\r
+ defined configASSERT()?\r
+\r
+ http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+ embedded software for free we request you assist our global community by\r
+ participating in the support forum.\r
+\r
+ http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+ be as productive as possible as early as possible. Now you can receive\r
+ FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+ Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+ http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+ including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+ compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+ http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+ Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+ http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+ Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS\r
+ licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+ engineered and independently SIL3 certified version for use in safety and\r
+ mission critical applications that require provable dependability.\r
+\r
+ 1 tab == 4 spaces!\r
+*/\r
+#include "msp430.h"\r
+#include "FreeRTOSConfig.h"\r
+#include "data_model.h"\r
+\r
+/*\r
+ * The definition of the "register test" tasks, as described at the top of\r
+ * main.c\r
+ */\r
+\r
+\r
+\r
+ IMPORT usRegTest1LoopCounter\r
+ IMPORT usRegTest2LoopCounter\r
+ IMPORT vPortYield\r
+\r
+ EXPORT vRegTest1Implementation\r
+ EXPORT vRegTest2Implementation\r
+\r
+ RSEG CODE\r
+\r
+ EVEN\r
+\r
+vRegTest1Implementation:\r
+\r
+ /* Fill each general purpose register with a known value. */\r
+ mov_x #0x4444, r4\r
+ mov_x #0x5555, r5\r
+ mov_x #0x6666, r6\r
+ mov_x #0x7777, r7\r
+ mov_x #0x8888, r8\r
+ mov_x #0x9999, r9\r
+ mov_x #0xaaaa, r10\r
+ mov_x #0xbbbb, r11\r
+ mov_x #0xcccc, r12\r
+ mov_x #0xdddd, r13\r
+ mov_x #0xeeee, r14\r
+ mov_x #0xffff, r15\r
+\r
+prvRegTest1Loop:\r
+\r
+ /* Test each general purpose register to check that it still contains the\r
+ expected known value, jumping to vRegTest1Error if any register contains\r
+ an unexpected value. */\r
+ cmp_x #0x4444, r4\r
+ jne vRegTest1Error\r
+ cmp_x #0x5555, r5\r
+ jne vRegTest1Error\r
+ cmp_x #0x6666, r6\r
+ jne vRegTest1Error\r
+ cmp_x #0x7777, r7\r
+ jne vRegTest1Error\r
+ cmp_x #0x8888, r8\r
+ jne vRegTest1Error\r
+ cmp_x #0x9999, r9\r
+ jne vRegTest1Error\r
+ cmp_x #0xaaaa, r10\r
+ jne vRegTest1Error\r
+ cmp_x #0xbbbb, r11\r
+ jne vRegTest1Error\r
+ cmp_x #0xcccc, r12\r
+ jne vRegTest1Error\r
+ cmp_x #0xdddd, r13\r
+ jne vRegTest1Error\r
+ cmp_x #0xeeee, r14\r
+ jne vRegTest1Error\r
+ cmp_x #0xffff, r15\r
+ jne vRegTest1Error\r
+\r
+ /* This task is still running without jumping to vRegTest1Error, so increment\r
+ the loop counter so the check task knows the task is running error free. */\r
+ incx.w &usRegTest1LoopCounter\r
+\r
+ /* Loop again, performing the same tests. */\r
+ jmp prvRegTest1Loop\r
+ nop\r
+\r
+\r
+ EVEN\r
+\r
+vRegTest1Error:\r
+ jmp vRegTest1Error\r
+ nop\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* See the comments in vRegTest1Implementation. This task is the same, it just uses\r
+different values in its registers. */\r
+vRegTest2Implementation:\r
+\r
+ mov_x #0x4441, r4\r
+ mov_x #0x5551, r5\r
+ mov_x #0x6661, r6\r
+ mov_x #0x7771, r7\r
+ mov_x #0x8881, r8\r
+ mov_x #0x9991, r9\r
+ mov_x #0xaaa1, r10\r
+ mov_x #0xbbb1, r11\r
+ mov_x #0xccc1, r12\r
+ mov_x #0xddd1, r13\r
+ mov_x #0xeee1, r14\r
+ mov_x #0xfff1, r15\r
+\r
+prvRegTest2Loop:\r
+\r
+ cmp_x #0x4441, r4\r
+ jne vRegTest2Error\r
+ cmp_x #0x5551, r5\r
+ jne vRegTest2Error\r
+ cmp_x #0x6661, r6\r
+ jne vRegTest2Error\r
+ cmp_x #0x7771, r7\r
+ jne vRegTest2Error\r
+ cmp_x #0x8881, r8\r
+ jne vRegTest2Error\r
+ cmp_x #0x9991, r9\r
+ jne vRegTest2Error\r
+ cmp_x #0xaaa1, r10\r
+ jne vRegTest2Error\r
+ cmp_x #0xbbb1, r11\r
+ jne vRegTest2Error\r
+ cmp_x #0xccc1, r12\r
+ jne vRegTest2Error\r
+ cmp_x #0xddd1, r13\r
+ jne vRegTest2Error\r
+ cmp_x #0xeee1, r14\r
+ jne vRegTest2Error\r
+ cmp_x #0xfff1, r15\r
+ jne vRegTest2Error\r
+\r
+ /* Also perform a manual yield, just to increase the scope of the test. */\r
+ calla #vPortYield\r
+\r
+ incx.w &usRegTest2LoopCounter\r
+ jmp prvRegTest2Loop\r
+ nop\r
+\r
+\r
+vRegTest2Error:\r
+ jmp vRegTest2Error\r
+ nop\r
+/*-----------------------------------------------------------*/\r
+\r
+\r
+ END\r
+\r
--- /dev/null
+/*\r
+ FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+ All rights reserved\r
+\r
+ VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+ ***************************************************************************\r
+ >>! NOTE: The modification to the GPL is included to allow you to !<<\r
+ >>! distribute a combined work that includes FreeRTOS without being !<<\r
+ >>! obliged to provide the source code for proprietary components !<<\r
+ >>! outside of the FreeRTOS kernel. !<<\r
+ ***************************************************************************\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+ FOR A PARTICULAR PURPOSE. Full license text is available on the following\r
+ link: http://www.freertos.org/a00114.html\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS provides completely free yet professionally developed, *\r
+ * robust, strictly quality controlled, supported, and cross *\r
+ * platform software that is more than just the market leader, it *\r
+ * is the industry's de facto standard. *\r
+ * *\r
+ * Help yourself get started quickly while simultaneously helping *\r
+ * to support the FreeRTOS project by purchasing a FreeRTOS *\r
+ * tutorial book, reference manual, or both: *\r
+ * http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading\r
+ the FAQ page "My application does not run, what could be wrong?". Have you\r
+ defined configASSERT()?\r
+\r
+ http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+ embedded software for free we request you assist our global community by\r
+ participating in the support forum.\r
+\r
+ http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+ be as productive as possible as early as possible. Now you can receive\r
+ FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+ Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+ http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+ including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+ compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+ http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+ Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+ http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+ Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS\r
+ licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+ engineered and independently SIL3 certified version for use in safety and\r
+ mission critical applications that require provable dependability.\r
+\r
+ 1 tab == 4 spaces!\r
+*/\r
+\r
+/******************************************************************************\r
+ * NOTE 1: This project provides two demo applications. A simple blinky style\r
+ * 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 comprehensive test and demo version.\r
+ *\r
+ * NOTE 2: This file only contains the source code that is specific to the\r
+ * full demo. Generic functions, such FreeRTOS hook functions, and functions\r
+ * required to configure the hardware, are defined in main.c.\r
+ *\r
+ ******************************************************************************\r
+ *\r
+ * main_full() creates all the demo application tasks and software timers, then\r
+ * starts the scheduler. The web documentation provides more details of the\r
+ * standard demo application tasks, which provide no particular functionality,\r
+ * but do provide a good example of how to use the FreeRTOS API.\r
+ *\r
+ * In addition to the standard demo tasks, the following tasks and tests are\r
+ * defined and/or created within this file:\r
+ *\r
+ * "Reg test" tasks - These fill both the microcontroller registers with known\r
+ * values, then check that each register maintains its expected value for the\r
+ * lifetime of the task. Each task uses a different set of values. The reg\r
+ * test tasks execute with a very low priority, so get preempted very\r
+ * frequently. A register containing an unexpected value is indicative of an\r
+ * error in the context switching mechanism.\r
+ *\r
+ * "Check" task - The check task period is initially set to three seconds. The\r
+ * task checks that all the standard demo tasks, and the register check tasks,\r
+ * are not only still executing, but are executing without reporting any errors.\r
+ * If the check task discovers that a task has either stalled, or reported an\r
+ * error, then it changes its own execution period from the initial three\r
+ * seconds, to just 200ms. The check task also toggles an LED each time it is\r
+ * called. This provides a visual indication of the system status: If the LED\r
+ * toggles every three seconds, then no issues have been discovered. If the LED\r
+ * toggles every 200ms, then an issue has been discovered with at least one\r
+ * task.\r
+ */\r
+\r
+/* Standard includes. */\r
+#include <stdio.h>\r
+\r
+/* Kernel includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "timers.h"\r
+#include "semphr.h"\r
+\r
+/* Standard demo application includes. */\r
+#include "dynamic.h"\r
+#include "blocktim.h"\r
+#include "countsem.h"\r
+#include "GenQTest.h"\r
+#include "recmutex.h"\r
+#include "partest.h"\r
+#include "EventGroupsDemo.h"\r
+#include "TaskNotify.h"\r
+\r
+/* Priorities for the check task, as described at the top of this file. */\r
+#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )\r
+\r
+/* Parameters for the task that handles the UART command console. */\r
+#define mainCOMMAND_CONSOLE_TASK_PRIORITY ( tskIDLE_PRIORITY )\r
+#define mainCOMMAND_CONSOLE_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 )\r
+\r
+/* The LED used by the check timer as described at the top of this file. */\r
+#define mainCHECK_LED ( 0 )\r
+\r
+/* The period after which the check timer will expire, in ms, provided no errors\r
+have been reported by any of the standard demo tasks. ms are converted to the\r
+equivalent in ticks using the pdMS_TO_TICKS() macro. */\r
+#define mainNO_ERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 3000 )\r
+\r
+/* The period at which the check timer will expire, in ms, if an error has been\r
+reported in one of the standard demo tasks. ms are converted to the equivalent\r
+in ticks using the pdMS_TO_TICKS() macro. */\r
+#define mainERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 200 )\r
+\r
+/* Parameters that are passed into the register check tasks solely for the\r
+purpose of ensuring parameters are passed into tasks correctly. */\r
+#define mainREG_TEST_TASK_1_PARAMETER ( ( void * ) 0x1234 )\r
+#define mainREG_TEST_TASK_2_PARAMETER ( ( void * ) 0x8765 )\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * Called by main() to run the full demo (as opposed to the blinky demo) when\r
+ * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.\r
+ */\r
+void main_full( void );\r
+\r
+/*\r
+ * The check task, as described at the top of this file.\r
+ */\r
+static void prvCheckTask( void *pvParameters );\r
+\r
+/*\r
+ * Register check tasks, as described at the top of this file. The nature of\r
+ * these files necessitates that they are written in an assembly file, but the\r
+ * entry points are kept in the C file for the convenience of checking the task\r
+ * parameter.\r
+ */\r
+static void prvRegTestTaskEntry1( void *pvParameters );\r
+extern void vRegTest1Implementation( void );\r
+static void prvRegTestTaskEntry2( void *pvParameters );\r
+extern void vRegTest2Implementation( void );\r
+\r
+/* Starts the 'standard' UART command console task. UART 0 is used at 19200\r
+baud. */\r
+extern void vUARTCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority );\r
+\r
+/* Registers a set of example commands that can be used in the command\r
+console. */\r
+void vRegisterSampleCLICommands( void );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* The following two variables are used to communicate the status of the\r
+register check tasks to the check task. If the variables keep incrementing,\r
+then the register check tasks have not discovered any errors. If a variable\r
+stops incrementing, then an error has been found. */\r
+volatile uint16_t usRegTest1LoopCounter = 0UL, usRegTest2LoopCounter = 0UL;\r
+\r
+/* cOutputBuffer is used by FreeRTOS+CLI. It is declared here so the\r
+__persistent qualifier can be used. For the buffer to be declared here, rather\r
+than in FreeRTOS_CLI.c, configAPPLICATION_PROVIDES_cOutputBuffer must be set to\r
+1 in FreeRTOSConfig.h. */\r
+__persistent char cOutputBuffer[ configCOMMAND_INT_MAX_OUTPUT_SIZE ];\r
+\r
+/* Used for maintaining a 32-bit run time stats counter from a 16-bit timer. */\r
+volatile uint32_t ulRunTimeCounterOverflows = 0;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void main_full( void )\r
+{\r
+ /* Start all the standard demo/test tasks. They have no particular\r
+ functionality, but do demonstrate how to use the FreeRTOS API and test the\r
+ kernel port. */\r
+ vStartDynamicPriorityTasks();\r
+ vCreateBlockTimeTasks();\r
+ vStartCountingSemaphoreTasks();\r
+ vStartGenericQueueTasks( tskIDLE_PRIORITY );\r
+ vStartRecursiveMutexTasks();\r
+ vStartEventGroupTasks();\r
+ vStartTaskNotifyTask();\r
+\r
+ /* Create the register check tasks, as described at the top of this file */\r
+ xTaskCreate( prvRegTestTaskEntry1, /* Task entry point. */\r
+ "Reg1", /* Text name for the task - not used by the kernel. */\r
+ configMINIMAL_STACK_SIZE, /* Stack to allocate to the task - in words not bytes! */\r
+ mainREG_TEST_TASK_1_PARAMETER, /* The parameter passed into the task. */\r
+ tskIDLE_PRIORITY, /* The task's priority. */\r
+ NULL ); /* Task handle is not needed, so NULL is passed. */\r
+\r
+ xTaskCreate( prvRegTestTaskEntry2, "Reg2", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL );\r
+\r
+ /* Create the task that performs the 'check' functionality, as described at\r
+ the top of this file. */\r
+ xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
+\r
+ /* Register an example set of CLI commands, then start the task that manages\r
+ the CLI using a UART for input and output. */\r
+ vRegisterSampleCLICommands();\r
+ vUARTCommandConsoleStart( mainCOMMAND_CONSOLE_STACK_SIZE, mainCOMMAND_CONSOLE_TASK_PRIORITY );\r
+\r
+ /* Start the scheduler. */\r
+ vTaskStartScheduler();\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 either insufficient FreeRTOS heap memory available for the idle\r
+ and/or 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 prvCheckTask( void *pvParameters )\r
+{\r
+TickType_t xDelayPeriod = mainNO_ERROR_CHECK_TASK_PERIOD;\r
+TickType_t xLastExecutionTime;\r
+static uint16_t usLastRegTest1Value = 0, usLastRegTest2Value = 0;\r
+uint16_t usErrorFound = pdFALSE;\r
+\r
+ /* Just to stop compiler warnings. */\r
+ ( void ) pvParameters;\r
+\r
+ /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()\r
+ works correctly. */\r
+ xLastExecutionTime = xTaskGetTickCount();\r
+\r
+ /* Cycle for ever, delaying then checking all the other tasks are still\r
+ operating without error. An on-board LED is toggled on each iteration.\r
+ If an error is detected then the delay period is decreased from\r
+ mainNO_ERROR_CHECK_TASK_PERIOD to mainERROR_CHECK_TASK_PERIOD. This has the\r
+ effect of increasing the rate at which the on-board LED toggles, and in so\r
+ doing gives visual feedback of the system status. */\r
+ for( ;; )\r
+ {\r
+ /* Delay until it is time to execute again. */\r
+ vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );\r
+\r
+ /* Check all the demo tasks to ensure they are all still running, and\r
+ that none have detected an error. */\r
+ if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
+ {\r
+ usErrorFound = 1UL << 0UL;\r
+ }\r
+\r
+ if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
+ {\r
+ usErrorFound = 1UL << 1UL;\r
+ }\r
+\r
+ if ( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
+ {\r
+ usErrorFound = 1UL << 2UL;\r
+ }\r
+\r
+ if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
+ {\r
+ usErrorFound = 1UL << 3UL;\r
+ }\r
+\r
+ if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )\r
+ {\r
+ usErrorFound = 1UL << 4UL;\r
+ }\r
+\r
+ if( xAreEventGroupTasksStillRunning() != pdPASS )\r
+ {\r
+ usErrorFound = 1UL << 5UL;\r
+ }\r
+\r
+ if( xAreTaskNotificationTasksStillRunning() != pdPASS )\r
+ {\r
+ usErrorFound = 1UL << 6UL;\r
+ }\r
+\r
+ /* Check that the register test 1 task is still running. */\r
+ if( usLastRegTest1Value == usRegTest1LoopCounter )\r
+ {\r
+ usErrorFound = 1UL << 7UL;\r
+ }\r
+ usLastRegTest1Value = usRegTest1LoopCounter;\r
+\r
+ /* Check that the register test 2 task is still running. */\r
+ if( usLastRegTest2Value == usRegTest2LoopCounter )\r
+ {\r
+ usErrorFound = 1UL << 8UL;\r
+ }\r
+ usLastRegTest2Value = usRegTest2LoopCounter;\r
+\r
+ /* Toggle the check LED to give an indication of the system status. If\r
+ the LED toggles every mainNO_ERROR_CHECK_TASK_PERIOD milliseconds then\r
+ everything is ok. A faster toggle indicates an error. */\r
+ vParTestToggleLED( mainCHECK_LED );\r
+\r
+ if( usErrorFound != pdFALSE )\r
+ {\r
+ /* An error has been detected in one of the tasks - flash the LED\r
+ at a higher frequency to give visible feedback that something has\r
+ gone wrong (it might just be that the loop back connector required\r
+ by the comtest tasks has not been fitted). */\r
+ xDelayPeriod = mainERROR_CHECK_TASK_PERIOD;\r
+ }\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvRegTestTaskEntry1( void *pvParameters )\r
+{\r
+ /* Although the regtest task is written in assembler, its entry point is\r
+ written in C for convenience of checking the task parameter is being passed\r
+ in correctly. */\r
+ if( pvParameters == mainREG_TEST_TASK_1_PARAMETER )\r
+ {\r
+ /* Start the part of the test that is written in assembler. */\r
+ vRegTest1Implementation();\r
+ }\r
+\r
+ /* The following line will only execute if the task parameter is found to\r
+ be incorrect. The check task will detect that the regtest loop counter is\r
+ not being incremented and flag an error. */\r
+ vTaskDelete( NULL );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvRegTestTaskEntry2( void *pvParameters )\r
+{\r
+ /* Although the regtest task is written in assembler, its entry point is\r
+ written in C for convenience of checking the task parameter is being passed\r
+ in correctly. */\r
+ if( pvParameters == mainREG_TEST_TASK_2_PARAMETER )\r
+ {\r
+ /* Start the part of the test that is written in assembler. */\r
+ vRegTest2Implementation();\r
+ }\r
+\r
+ /* The following line will only execute if the task parameter is found to\r
+ be incorrect. The check task will detect that the regtest loop counter is\r
+ not being incremented and flag an error. */\r
+ vTaskDelete( NULL );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vConfigureTimerForRunTimeStats( void )\r
+{\r
+ /* Configure a timer that is used as the time base for run time stats. See\r
+ http://www.freertos.org/rtos-run-time-stats.html */\r
+\r
+ /* Ensure the timer is stopped. */\r
+ TA1CTL = 0;\r
+\r
+ /* Start up clean. */\r
+ TA1CTL |= TACLR;\r
+\r
+ /* Run the timer from the ACLK/8, continuous mode, interrupt enable. */\r
+ TA1CTL = TASSEL_1 | ID__8 | MC__CONTINUOUS | TAIE;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+#pragma vector=TIMER1_A1_VECTOR\r
+__interrupt void v4RunTimeStatsTimerOverflow( void )\r
+{\r
+ TA1CTL &= ~TAIFG;\r
+ \r
+ /* 16-bit overflow, so add 17th bit. */\r
+ ulRunTimeCounterOverflows += 0x10000;\r
+ __bic_SR_register_on_exit( SCG1 + SCG0 + OSCOFF + CPUOFF );\r
+}\r
+\r
+\r
+\r
+\r
--- /dev/null
+/*\r
+ FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+ All rights reserved\r
+\r
+ VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+ ***************************************************************************\r
+ >>! NOTE: The modification to the GPL is included to allow you to !<<\r
+ >>! distribute a combined work that includes FreeRTOS without being !<<\r
+ >>! obliged to provide the source code for proprietary components !<<\r
+ >>! outside of the FreeRTOS kernel. !<<\r
+ ***************************************************************************\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+ FOR A PARTICULAR PURPOSE. Full license text is available on the following\r
+ link: http://www.freertos.org/a00114.html\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS provides completely free yet professionally developed, *\r
+ * robust, strictly quality controlled, supported, and cross *\r
+ * platform software that is more than just the market leader, it *\r
+ * is the industry's de facto standard. *\r
+ * *\r
+ * Help yourself get started quickly while simultaneously helping *\r
+ * to support the FreeRTOS project by purchasing a FreeRTOS *\r
+ * tutorial book, reference manual, or both: *\r
+ * http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading\r
+ the FAQ page "My application does not run, what could be wrong?". Have you\r
+ defined configASSERT()?\r
+\r
+ http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+ embedded software for free we request you assist our global community by\r
+ participating in the support forum.\r
+\r
+ http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+ be as productive as possible as early as possible. Now you can receive\r
+ FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+ Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+ http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+ including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+ compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+ http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+ Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+ http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+ Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS\r
+ licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+ engineered and independently SIL3 certified version for use in safety and\r
+ mission critical applications that require provable dependability.\r
+\r
+ 1 tab == 4 spaces!\r
+*/\r
+\r
+\r
+/* BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER.\r
+ *\r
+ * This is not a proper UART driver. It only supports one port, and is not\r
+ * intended to show an efficient implementation as queues are used to pass\r
+ * individual characters one at a time! This is ok for a slow interface, such\r
+ * as a command line interface (which this driver is used for), but is too\r
+ * inefficient for higher bandwidth applications.\r
+ */\r
+\r
+/* Standard includes. */\r
+#include <stdlib.h>\r
+\r
+/* Scheduler includes. */\r
+#include "FreeRTOS.h"\r
+#include "queue.h"\r
+#include "task.h"\r
+\r
+/* Demo application includes. */\r
+#include "serial.h"\r
+\r
+/* TI includes. */\r
+#include "driverlib.h"\r
+\r
+/* Misc. constants. */\r
+#define serNO_BLOCK ( ( TickType_t ) 0 )\r
+\r
+/* The queue used to hold received characters. */\r
+static QueueHandle_t xRxedChars;\r
+\r
+/* The queue used to hold characters waiting transmission. */\r
+static QueueHandle_t xCharsForTx;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, UBaseType_t uxQueueLength )\r
+{\r
+unsigned long ulBaudRateCount;\r
+\r
+ /* Initialise the hardware. */\r
+\r
+ /* Generate the baud rate constants for the wanted baud rate. */\r
+ ulBaudRateCount = configCPU_CLOCK_HZ / ulWantedBaud;\r
+\r
+ portENTER_CRITICAL();\r
+ {\r
+ /* Create the queues used by the com test task. */\r
+ xRxedChars = xQueueCreate( uxQueueLength, ( UBaseType_t ) sizeof( signed char ) );\r
+ xCharsForTx = xQueueCreate( uxQueueLength, ( UBaseType_t ) sizeof( signed char ) );\r
+\r
+ /* Reset UART. */\r
+ UCA0CTL1 |= UCSWRST;\r
+\r
+ /* Use SMCLK. */\r
+ UCA0CTL1 = UCSSEL0 | UCSSEL1;\r
+\r
+ /* Setup baud rate low byte. */\r
+ UCA0BR0 = ( unsigned char ) ( ulBaudRateCount & ( unsigned long ) 0xff );\r
+\r
+ /* Setup baud rate high byte. */\r
+ ulBaudRateCount >>= 8UL;\r
+ UCA0BR1 = ( unsigned char ) ( ulBaudRateCount & ( unsigned long ) 0xff );\r
+\r
+ /* Enable interrupts. */\r
+ UCA0IE |= UCRXIE;\r
+\r
+ /* Take out of reset. */\r
+ UCA0CTL1 &= ~UCSWRST;\r
+ }\r
+ portEXIT_CRITICAL();\r
+\r
+ /* Note the comments at the top of this file about this not being a generic\r
+ UART driver. */\r
+ return NULL;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+BaseType_t xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, TickType_t xBlockTime )\r
+{\r
+ /* Get the next character from the buffer. Return false if no characters\r
+ are available, or arrive before xBlockTime expires. */\r
+ if( xQueueReceive( xRxedChars, pcRxedChar, xBlockTime ) )\r
+ {\r
+ return pdTRUE;\r
+ }\r
+ else\r
+ {\r
+ return pdFALSE;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+BaseType_t xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, TickType_t xBlockTime )\r
+{\r
+BaseType_t xReturn;\r
+\r
+ /* Send the next character to the queue of characters waiting transmission,\r
+ then enable the UART Tx interrupt, just in case UART transmission has already\r
+ completed and switched itself off. */\r
+ xReturn = xQueueSend( xCharsForTx, &cOutChar, xBlockTime );\r
+ UCA0IE |= UCTXIE;\r
+\r
+ return xReturn;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )\r
+{\r
+UBaseType_t uxChar;\r
+const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 100 );\r
+\r
+ /* The driver only supports one port so the pxPort parameter is not used. */\r
+ ( void ) pxPort;\r
+\r
+ for( uxChar = 0; uxChar < usStringLength; uxChar++ )\r
+ {\r
+ if( xQueueSend( xCharsForTx, &( pcString[ uxChar ] ), xMaxBlockTime ) == pdFALSE )\r
+ {\r
+ break;\r
+ }\r
+ else\r
+ {\r
+ UCA0IE |= UCTXIE;\r
+ }\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* The implementation of this interrupt is provided to demonstrate the use\r
+of queues from inside an interrupt service routine. It is *not* intended to\r
+be an efficient interrupt implementation. A real application should make use\r
+of the DMA. Or, as a minimum, transmission and reception could use a simple\r
+RAM ring buffer, and synchronise with a task using a semaphore when a complete\r
+message has been received or transmitted. */\r
+#pragma vector=USCI_A0_VECTOR\r
+static __interrupt void prvUSCI_A0_ISR( void )\r
+{\r
+signed char cChar;\r
+BaseType_t xHigherPriorityTaskWoken = pdFALSE;\r
+\r
+ while( ( UCA0IFG & UCRXIFG ) != 0 )\r
+ {\r
+ /* Get the character from the UART and post it on the queue of Rxed\r
+ characters. */\r
+ cChar = UCA0RXBUF;\r
+ xQueueSendFromISR( xRxedChars, &cChar, &xHigherPriorityTaskWoken );\r
+ }\r
+\r
+ /* If there is a Tx interrupt pending and the tx interrupts are enabled. */\r
+ if( ( UCA0IFG & UCTXIFG ) != 0 )\r
+ {\r
+ /* The previous character has been transmitted. See if there are any\r
+ further characters waiting transmission. */\r
+ if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xHigherPriorityTaskWoken ) == pdTRUE )\r
+ {\r
+ /* There was another character queued - transmit it now. */\r
+ UCA0TXBUF = cChar;\r
+ }\r
+ else\r
+ {\r
+ /* There were no other characters to transmit - disable the Tx\r
+ interrupt. */\r
+ UCA0IE &= ~UCTXIE;\r
+ }\r
+ }\r
+\r
+ __bic_SR_register_on_exit( SCG1 + SCG0 + OSCOFF + CPUOFF );\r
+\r
+ /* If writing to a queue caused a task to unblock, and the unblocked task\r
+ has a priority equal to or above the task that this interrupt interrupted,\r
+ then lHigherPriorityTaskWoken will have been set to pdTRUE internally within\r
+ xQueuesendFromISR(), and portEND_SWITCHING_ISR() will ensure that this\r
+ interrupt returns directly to the higher priority unblocked task.\r
+\r
+ THIS MUST BE THE LAST THING DONE IN THE ISR. */\r
+ portYIELD_FROM_ISR( xHigherPriorityTaskWoken );\r
+}\r
+\r
+\r
</plugin>\r
<plugin>\r
<file>$TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin</file>\r
- <loadFlag>0</loadFlag>\r
+ <loadFlag>1</loadFlag>\r
</plugin>\r
<plugin>\r
<file>$TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin</file>\r
<option>\r
<name>Input variant</name>\r
<version>2</version>\r
- <state>3</state>\r
+ <state>7</state>\r
</option>\r
<option>\r
<name>Input description</name>\r
- <state>No specifier n, no float or long long.</state>\r
+ <state>No specifier n, no float nor long long, no scan set, no assignment suppressing, without multibyte support.</state>\r
</option>\r
<option>\r
<name>Output variant</name>\r
<version>2</version>\r
- <state>3</state>\r
+ <state>7</state>\r
</option>\r
<option>\r
<name>Output description</name>\r
- <state>No specifier a or A.</state>\r
+ <state>No specifier a, A, no specifier n, no float nor long long, without multibytes.</state>\r
</option>\r
<option>\r
<name>GRuntimeLibSelectSlave</name>\r
</option>\r
<option>\r
<name>GStackHeapOverride</name>\r
- <state>0</state>\r
+ <state>1</state>\r
</option>\r
<option>\r
<name>GStackSize2</name>\r
- <state>160</state>\r
+ <state>100</state>\r
</option>\r
<option>\r
<name>GHeapSize2</name>\r
- <state>160</state>\r
+ <state>0</state>\r
</option>\r
<option>\r
<name>RadioDataModelType</name>\r
</option>\r
<option>\r
<name>GHeap20Size</name>\r
- <state>80</state>\r
+ <state>0</state>\r
</option>\r
<option>\r
<name>GeneralMisraRules98</name>\r
<option>\r
<name>Math variant</name>\r
<version>0</version>\r
- <state>0</state>\r
+ <state>1</state>\r
</option>\r
<option>\r
<name>Math description</name>\r
- <state>Default variants of cos, sin, tan, log, log10, pow, and exp.</state>\r
+ <state>Smaller size, higher execution speed, less precision, smaller input range.</state>\r
</option>\r
</data>\r
</settings>\r
<state>$PROJ_DIR$\..\..\Source\include</state>\r
<state>$PROJ_DIR$\..\..\Source\portable\IAR\MSP430X</state>\r
<state>$PROJ_DIR$\..\Common\include</state>\r
+ <state>$PROJ_DIR$\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-CLI</state>\r
</option>\r
<option>\r
<name>CCStdIncCheck</name>\r
<file>\r
<name>$PROJ_DIR$\..\..\Source\portable\IAR\MSP430X\portext.s43</name>\r
</file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\Source\portable\IAR\MSP430X\portmacro.h</name>\r
+ </file>\r
</group>\r
<file>\r
<name>$PROJ_DIR$\..\..\Source\event_groups.c</name>\r
<name>$PROJ_DIR$\..\..\Source\timers.c</name>\r
</file>\r
</group>\r
+ <group>\r
+ <name>Full_Demo</name>\r
+ <group>\r
+ <name>FreeRTOS+CLI</name>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\..\FreeRTOS-Plus\Source\FreeRTOS-Plus-CLI\FreeRTOS_CLI.c</name>\r
+ </file>\r
+ </group>\r
+ <group>\r
+ <name>Standard Demo Tasks</name>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\blocktim.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\countsem.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\dynamic.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\EventGroupsDemo.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\GenQTest.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\recmutex.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Full_Demo\serial.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\TaskNotify.c</name>\r
+ </file>\r
+ </group>\r
+ <file>\r
+ <name>$PROJ_DIR$\Full_Demo\main_full.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\Full_Demo\RegTest.s43</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\..\FreeRTOS-Plus\Demo\Common\FreeRTOS_Plus_CLI_Demos\Sample-CLI-commands.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\..\..\FreeRTOS-Plus\Demo\Common\FreeRTOS_Plus_CLI_Demos\UARTCommandConsole.c</name>\r
+ </file>\r
+ </group>\r
<file>\r
<name>$PROJ_DIR$\FRAMLogMode.c</name>\r
<excluded>\r
#include "task.h"\r
#include "semphr.h"\r
\r
-/* Standard demo includes. */\r
-#include "TimerDemo.h"\r
-#include "QueueOverwrite.h"\r
+/* Standard demo includes, used so the tick hook can exercise some FreeRTOS\r
+functionality in an interrupt. */\r
#include "EventGroupsDemo.h"\r
-#include "IntSemTest.h"\r
#include "TaskNotify.h"\r
#include "ParTest.h" /* LEDs - a historic name for "Parallel Port". */\r
\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 1\r
+#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0\r
\r
/*-----------------------------------------------------------*/\r
\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void prvSetupHardware( void )\r
-{\r
- /* Set all GPIO pins to output and low. */\r
- GPIO_setOutputLowOnPin( GPIO_PORT_P1, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );\r
- GPIO_setOutputLowOnPin( GPIO_PORT_P2, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );\r
- GPIO_setOutputLowOnPin( GPIO_PORT_P3, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );\r
- GPIO_setOutputLowOnPin( GPIO_PORT_P4, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );\r
- 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 );\r
- GPIO_setAsOutputPin( GPIO_PORT_P1, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );\r
- GPIO_setAsOutputPin( GPIO_PORT_P2, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );\r
- GPIO_setAsOutputPin( GPIO_PORT_P3, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );\r
- GPIO_setAsOutputPin( GPIO_PORT_P4, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );\r
- 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 );\r
-\r
- /* Configure P2.0 for UCA0TXD and P2.1 for UCA0RXD. */\r
- GPIO_setOutputLowOnPin( GPIO_PORT_P2, GPIO_PIN0 );\r
- GPIO_setAsOutputPin( GPIO_PORT_P2, GPIO_PIN0 );\r
- GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_P2, GPIO_PIN1, GPIO_SECONDARY_MODULE_FUNCTION );\r
-\r
- /* Set PJ.4 and PJ.5 for LFXT. */\r
- GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_PJ, GPIO_PIN4 + GPIO_PIN5, GPIO_PRIMARY_MODULE_FUNCTION );\r
-\r
- /* Set DCO frequency to 1 MHz. */\r
- CS_setDCOFreq( CS_DCORSEL_0, CS_DCOFSEL_6 );\r
-\r
- /* Set external clock frequency to 32.768 KHz. */\r
- CS_setExternalClockSource( 32768, 0 );\r
-\r
- /* Set ACLK = LFXT. */\r
- CS_initClockSignal( CS_ACLK, CS_LFXTCLK_SELECT, CS_CLOCK_DIVIDER_1 );\r
-\r
- /* Set SMCLK = DCO with frequency divider of 1. */\r
- CS_initClockSignal( CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 );\r
-\r
- /* Set MCLK = DCO with frequency divider of 1. */\r
- CS_initClockSignal( CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 );\r
-\r
- /* Start XT1 with no time out. */\r
- CS_turnOnLFXT( CS_LFXT_DRIVE_0 );\r
-\r
- /* Disable the GPIO power-on default high-impedance mode. */\r
- PMM_unlockLPM5();\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
void vApplicationMallocFailedHook( void )\r
{\r
/* Called if a call to pvPortMalloc() fails because there is insufficient\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
+ function is called if a stack overflow is detected.\r
+ See http://www.freertos.org/Stacks-and-stack-overflow-checking.html */\r
\r
/* Force an assert. */\r
configASSERT( ( volatile void * ) NULL );\r
\r
void vApplicationTickHook( void )\r
{\r
- #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0\r
+ #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )\r
{\r
- /* The full demo includes a software timer demo/test that requires\r
- prodding periodically from the tick interrupt. */\r
- vTimerPeriodicISRTests();\r
-\r
- /* Call the periodic queue overwrite from ISR demo. */\r
- vQueueOverwritePeriodicISRDemo();\r
-\r
/* Call the periodic event group from ISR demo. */\r
vPeriodicEventGroupsProcessing();\r
\r
- /* Call the code that uses a mutex from an ISR. */\r
- vInterruptSemaphorePeriodicTest();\r
-\r
/* Call the code that 'gives' a task notification from an ISR. */\r
xNotifyTaskFromISR();\r
}\r
TA0CTL |= MC_1;\r
}\r
/*-----------------------------------------------------------*/\r
+\r
+static void prvSetupHardware( void )\r
+{\r
+ /* Set all GPIO pins to output and low. */\r
+ GPIO_setOutputLowOnPin( GPIO_PORT_P1, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );\r
+ GPIO_setOutputLowOnPin( GPIO_PORT_P2, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );\r
+ GPIO_setOutputLowOnPin( GPIO_PORT_P3, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );\r
+ GPIO_setOutputLowOnPin( GPIO_PORT_P4, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );\r
+ 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 );\r
+ GPIO_setAsOutputPin( GPIO_PORT_P1, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );\r
+ GPIO_setAsOutputPin( GPIO_PORT_P2, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );\r
+ GPIO_setAsOutputPin( GPIO_PORT_P3, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );\r
+ GPIO_setAsOutputPin( GPIO_PORT_P4, GPIO_PIN0 | GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7 );\r
+ 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 );\r
+\r
+ /* Configure P2.0 - UCA0TXD and P2.1 - UCA0RXD. */\r
+ GPIO_setOutputLowOnPin( GPIO_PORT_P2, GPIO_PIN0 );\r
+ GPIO_setAsOutputPin( GPIO_PORT_P2, GPIO_PIN0 );\r
+ GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_P2, GPIO_PIN1, GPIO_SECONDARY_MODULE_FUNCTION );\r
+ GPIO_setAsPeripheralModuleFunctionOutputPin( GPIO_PORT_P2, GPIO_PIN0, GPIO_SECONDARY_MODULE_FUNCTION );\r
+\r
+ /* Set PJ.4 and PJ.5 for LFXT. */\r
+ GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_PJ, GPIO_PIN4 + GPIO_PIN5, GPIO_PRIMARY_MODULE_FUNCTION );\r
+\r
+ /* Set DCO frequency to 8 MHz. */\r
+ CS_setDCOFreq( CS_DCORSEL_0, CS_DCOFSEL_6 );\r
+\r
+ /* Set external clock frequency to 32.768 KHz. */\r
+ CS_setExternalClockSource( 32768, 0 );\r
+\r
+ /* Set ACLK = LFXT. */\r
+ CS_initClockSignal( CS_ACLK, CS_LFXTCLK_SELECT, CS_CLOCK_DIVIDER_1 );\r
+\r
+ /* Set SMCLK = DCO with frequency divider of 1. */\r
+ CS_initClockSignal( CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 );\r
+\r
+ /* Set MCLK = DCO with frequency divider of 1. */\r
+ CS_initClockSignal( CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 );\r
+\r
+ /* Start XT1 with no time out. */\r
+ CS_turnOnLFXT( CS_LFXT_DRIVE_0 );\r
+\r
+ /* Disable the GPIO power-on default high-impedance mode. */\r
+ PMM_unlockLPM5();\r
+}\r
+/*-----------------------------------------------------------*/\r