<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DATA_MODEL.1471292597" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DATA_MODEL" value="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DATA_MODEL.large" valueType="enumerated"/>\r
</tool>\r
<tool id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.linkerDebug.1882128094" name="MSP430 Linker" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.linkerDebug">\r
-<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE.1907940977" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE" value="300" valueType="string"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE.1907940977" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE" value="0" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.STACK_SIZE.155131239" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.STACK_SIZE" value="300" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.USE_HW_MPY.1895647999" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.USE_HW_MPY" value="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.USE_HW_MPY.F5" valueType="enumerated"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.OUTPUT_FILE.2049770982" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.OUTPUT_FILE" value=""RTOSDemo.out"" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SINGLE_INLINE.153283919" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SINGLE_INLINE" value="true" valueType="boolean"/>\r
</tool>\r
<tool id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.linkerDebug.1554119117" name="MSP430 Linker" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.linkerDebug">\r
-<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE.884365605" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE" value="300" valueType="string"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE.884365605" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE" value="0" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.STACK_SIZE.1998221473" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.STACK_SIZE" value="300" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.USE_HW_MPY.1687098000" name="Link in hardware version of RTS mpy routine (--use_hw_mpy)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.USE_HW_MPY" value="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.USE_HW_MPY.F5" valueType="enumerated"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.OUTPUT_FILE.750680827" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.OUTPUT_FILE" value=""RTOSDemo.out"" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DIAG_WARNING.1302018091" name="Treat diagnostic <id> as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DIAG_WARNING" valueType="stringList">\r
<listOptionValue builtIn="false" value="225"/>\r
</option>\r
-<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.PRINTF_SUPPORT.1956765338" name="Level of printf support required (--printf_support)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.PRINTF_SUPPORT" value="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.PRINTF_SUPPORT.nofloat" valueType="enumerated"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.PRINTF_SUPPORT.1956765338" name="Level of printf support required (--printf_support)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.PRINTF_SUPPORT" value="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.PRINTF_SUPPORT.minimal" valueType="enumerated"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_VERSION.1373809772" name="Silicon version (--silicon_version, -v)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_VERSION.mspx" valueType="enumerated"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DEFINE.566602389" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DEFINE" valueType="definedSymbols">\r
<listOptionValue builtIn="false" value="__MSP430F5438A__"/>\r
</option>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.CODE_MODEL.1139014825" name="Specify the code memory model. (--code_model)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.CODE_MODEL" value="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.CODE_MODEL.large" valueType="enumerated"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DATA_MODEL.820058243" name="Specify the data memory model. (--data_model)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DATA_MODEL" value="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DATA_MODEL.small" valueType="enumerated"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_ERRATA.CPU15.1202920097" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_ERRATA.CPU15" value="true" valueType="boolean"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_ERRATA.CPU18.1795934125" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.SILICON_ERRATA.CPU18" value="true" valueType="boolean"/>\r
</tool>\r
<tool id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.linkerDebug.1837962732" name="MSP430 Linker" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.linkerDebug">\r
-<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE.728234211" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE" value="300" valueType="string"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE.728234211" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE" value="0" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.STACK_SIZE.312215125" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.STACK_SIZE" value="300" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.USE_HW_MPY.261762041" name="Link in hardware version of RTS mpy routine (--use_hw_mpy)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.USE_HW_MPY" value="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.USE_HW_MPY.F5" valueType="enumerated"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.OUTPUT_FILE.820149163" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.OUTPUT_FILE" value=""RTOSDemo.out"" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DATA_MODEL.102615768" name="Specify the data memory model. (--data_model)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DATA_MODEL" value="com.ti.ccstudio.buildDefinitions.MSP430_3.3.compilerID.DATA_MODEL.small" valueType="enumerated"/>\r
</tool>\r
<tool id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.linkerDebug.400652052" name="MSP430 Linker" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.exe.linkerDebug">\r
-<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE.1589461908" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE" value="300" valueType="string"/>\r
+<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE.1589461908" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.HEAP_SIZE" value="0" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.STACK_SIZE.761794468" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.STACK_SIZE" value="300" valueType="string"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.USE_HW_MPY.847690853" name="Link in hardware version of RTS mpy routine (--use_hw_mpy)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.USE_HW_MPY" value="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.USE_HW_MPY.F5" valueType="enumerated"/>\r
<option id="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.OUTPUT_FILE.1733576069" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.MSP430_3.3.linkerID.OUTPUT_FILE" value=""RTOSDemo.out"" valueType="string"/>\r
copy ..\..\Source\tasks.c FreeRTOS_Source\r
copy ..\..\Source\queue.c FreeRTOS_Source\r
copy ..\..\Source\list.c FreeRTOS_Source\r
+ copy ..\..\Source\timers.c FreeRTOS_Source\r
\r
REM Copy the common header files\r
\r
copy ..\Common\minimal\dynamic.c Demo_Source\Common_Demo_Files\r
copy ..\Common\minimal\comtest.c Demo_Source\Common_Demo_Files\r
copy ..\Common\minimal\GenQTest.c Demo_Source\Common_Demo_Files\r
+ copy ..\Common\minimal\TimerDemo.c Demo_Source\Common_Demo_Files\r
+ copy ..\Common\minimal\countsem.c Demo_Source\Common_Demo_Files\r
\r
REM Copy the common demo file headers.\r
copy ..\Common\include\dynamic.h Demo_Source\Common_Demo_Files\include\r
copy ..\Common\include\GenQTest.h Demo_Source\Common_Demo_Files\include\r
copy ..\Common\include\serial.h Demo_Source\Common_Demo_Files\include\r
copy ..\Common\include\partest.h Demo_Source\Common_Demo_Files\include\r
+ copy ..\Common\include\TimerDemo.h Demo_Source\Common_Demo_Files\include\r
+ copy ..\Common\include\countsem.h Demo_Source\Common_Demo_Files\include\r
\r
-: END
\ No newline at end of file
+: END\r
#define configCPU_CLOCK_HZ ( 25000000UL ) \r
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )\r
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )\r
-#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 9 * 1024 ) )\r
+#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 10 * 1024 ) )\r
#define configMAX_TASK_NAME_LEN ( 10 )\r
-#define configUSE_TRACE_FACILITY 1\r
-#define configUSE_16_BIT_TICKS 0\r
+#define configUSE_TRACE_FACILITY 0\r
+#define configUSE_16_BIT_TICKS 1\r
#define configIDLE_SHOULD_YIELD 1\r
#define configUSE_MUTEXES 1\r
#define configQUEUE_REGISTRY_SIZE 0\r
-#define configGENERATE_RUN_TIME_STATS 1\r
+#define configGENERATE_RUN_TIME_STATS 0\r
#define configCHECK_FOR_STACK_OVERFLOW 2\r
-#define configUSE_RECURSIVE_MUTEXES 0\r
+#define configUSE_RECURSIVE_MUTEXES 1\r
#define configUSE_MALLOC_FAILED_HOOK 1\r
#define configUSE_APPLICATION_TASK_TAG 0\r
+#define configUSE_COUNTING_SEMAPHORES 1\r
\r
#ifdef __LARGE_DATA_MODEL__\r
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 80 )\r
#define configUSE_CO_ROUTINES 0\r
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )\r
\r
+/* Software timer definitions. */\r
+#define configUSE_TIMERS 1\r
+#define configTIMER_TASK_PRIORITY ( 3 )\r
+#define configTIMER_QUEUE_LENGTH 10\r
+#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )\r
+\r
/* Set the following definitions to 1 to include the API function, or zero\r
to exclude the API function. */\r
#define INCLUDE_vTaskPrioritySet 1\r
vApplicationSetupTimerInterrupt() generates the tick from timer A0, so in this\r
case configTICK_VECTOR is set to TIMER0_A0_VECTOR. */\r
#define configTICK_VECTOR TIMER0_A0_VECTOR\r
-\r
-extern void vConfigureTimerForRunTimeStats( void );\r
-extern volatile unsigned long ulStatsOverflowCount;\r
-\r
-/* Configure a 16 bit timer to generate the time base for the run time stats.\r
-The timer is configured to interrupt each time it overflows so a count of\r
-overflows can be kept - that way a 32 bit time value can be constructed from\r
-the timers current count value and the number of overflows. */\r
-#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()\r
\r
-/* Construct a 32 bit time value for use as the run time stats time base. This\r
-comes from the current value of a 16 bit timer combined with the number of times\r
-the timer has overflowed. */\r
-#define portALT_GET_RUN_TIME_COUNTER_VALUE( ulCountValue ) \\r
- { \\r
- /* Stop the counter counting temporarily. */ \\r
- TA1CTL &= ~MC__CONTINOUS; \\r
- \\r
- /* Check to see if any counter overflow interrupts are pending. */ \\r
- if( ( TA1CTL & TAIFG ) != 0 ) \\r
- { \\r
- /* An overflow has occurred but not yet been processed. */ \\r
- ulStatsOverflowCount++; \\r
- \\r
- /* Clear the interrupt. */ \\r
- TA1CTL &= ~TAIFG; \\r
- } \\r
- \\r
- /* Generate a 32 bit counter value by combinging the current peripheral \\r
- counter value with the number of overflows. */ \\r
- ulCountValue = ( ulStatsOverflowCount << 16UL ); \\r
- ulCountValue |= ( unsigned long ) TA1R; \\r
- TA1CTL |= MC__CONTINOUS; \\r
- }\r
-#endif /*0*/ \r
+#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); } \r
+ \r
+#endif /* FREERTOS_CONFIG_H */\r
\r
* provide no particular functionality but do provide good examples of how to\r
* use the FreeRTOS API.\r
*\r
- * In addition to the standard demo tasks, the following tasks, interrupts and\r
- * tests are defined and/or created within this file:\r
+ * In addition to the standard demo tasks, the following tasks, interrupts tests\r
+ * and timers are defined and/or created within this file:\r
*\r
* "LCD" task - The LCD task is a 'gatekeeper' task. It is the only task that\r
* is permitted to access the LCD and therefore ensures access to the LCD is\r
* the poll rate to ensure debouncing is not necessary and that the task does\r
* not use all the available CPU processing time.\r
*\r
- * Button Interrupt and run time stats display - The select button on the\r
- * joystick input device is configured to generate an external interrupt. The\r
- * handler for this interrupt sends a message to LCD task, which interprets the\r
- * message to mean, firstly write a message to the LCD, and secondly, generate\r
- * a table of run time statistics. The run time statistics are displayed as a\r
- * table that contains information on how much processing time each task has\r
- * been allocated since the application started to execute. This information\r
- * is provided both as an absolute time, and as a percentage of the total run\r
- * time. The information is displayed in the terminal IO window of the IAR\r
- * embedded workbench. The online documentation for this demo shows a screen\r
- * shot demonstrating where the run time stats can be viewed.\r
+ * Button Interrupt - The select button on the joystick input device is \r
+ * configured to generate an external interrupt. The handler for this interrupt \r
+ * sends a message to LCD task, which then prints out a string to say the \r
+ * joystick select button was pressed.\r
*\r
* Idle Hook - The idle hook is a function that is called on each iteration of\r
* the idle task. In this case it is used to place the processor into a low\r
* power mode. Note however that this application is implemented using standard\r
* components, and is therefore not optimised for low power operation. Lower\r
* power consumption would be achieved by converting polling tasks into event\r
- * driven tasks, and slowing the tick interrupt frequency.\r
+ * driven tasks, and slowing the tick interrupt frequency, etc.\r
*\r
- * "Check" function called from the tick hook - The tick hook is called during\r
- * each tick interrupt. It is called from an interrupt context so must execute\r
- * quickly, not attempt to block, and not call any FreeRTOS API functions that\r
- * do not end in "FromISR". In this case the tick hook executes a 'check'\r
- * function. This only executes every five seconds. Its main function is to\r
- * check that all the standard demo tasks are still operational. Each time it\r
- * executes it sends a status code to the LCD task. The LCD task interprets the\r
- * code and displays an appropriate message - which will be PASS if no tasks\r
- * have reported any errors, or a message stating which task has reported an\r
- * error.\r
+ * "Check" callback function - Called each time the 'check' timer expires. The\r
+ * check timer executes every five seconds. Its main function is to check that \r
+ * all the standard demo tasks are still operational. Each time it executes it \r
+ * sends a status code to the LCD task. The LCD task interprets the code and \r
+ * displays an appropriate message - which will be PASS if no tasks have \r
+ * reported any errors, or a message stating which task has reported an error.\r
*\r
* "Reg test" tasks - These fill the registers with known values, then check\r
* that each register still contains its expected value. Each task uses\r
* test loop. A register containing an unexpected value is indicative of an\r
* error in the context switching mechanism and will result in a branch to a\r
* null loop - which in turn will prevent the check variable from incrementing\r
- * any further and allow the check task (described a above) to determine that an\r
- * error has occurred. The nature of the reg test tasks necessitates that they\r
- * are written in assembly code.\r
+ * any further and allow the check timer callback (described a above) to \r
+ * determine that an error has occurred. The nature of the reg test tasks \r
+ * necessitates that they are written in assembly code.\r
+ *\r
+ * Tick hook function - called inside the RTOS tick function, this simple \r
+ * example does nothing but toggle an LED.\r
*\r
* *NOTE 1* vApplicationSetupTimerInterrupt() is called by the kernel to let\r
* the application set up a timer to generate the tick interrupt. In this\r
/* FreeRTOS includes. */\r
#include "FreeRTOS.h"\r
#include "task.h"\r
+#include "timers.h"\r
#include "queue.h"\r
\r
/* Hardware includes. */\r
#include "dynamic.h"\r
#include "comtest2.h"\r
#include "GenQTest.h"\r
+#include "TimerDemo.h"\r
+#include "countsem.h"\r
\r
/* Codes sent within messages to the LCD task so the LCD task can interpret\r
exactly what the message it just received was. These are sent in the\r
#define mainERROR_COM_TEST ( pdPASS + 2 )\r
#define mainERROR_GEN_QUEUE_TEST ( pdPASS + 3 )\r
#define mainERROR_REG_TEST ( pdPASS + 4 )\r
+#define mainERROR_TIMER_TEST ( pdPASS + 5 )\r
+#define mainERROR_COUNT_SEM_TEST ( pdPASS + 6 )\r
\r
/* The length of the queue (the number of items the queue can hold) that is used\r
to send messages from tasks and interrupts the the LCD task. */\r
information. */\r
#define mainCOM_TEST_LED ( 1 )\r
\r
-/* The baud rate used by the comtest tasks described at the top of this file. */\r
-#define mainCOM_TEST_BAUD_RATE ( 38400 )\r
+/* The baud rate used by the comtest tasks. */\r
+#define mainCOM_TEST_BAUD_RATE ( 115200 )\r
\r
/* The maximum number of lines of text that can be displayed on the LCD. */\r
#define mainMAX_LCD_LINES ( 8 )\r
\r
/* Just used to ensure parameters are passed into tasks correctly. */\r
#define mainTASK_PARAMETER_CHECK_VALUE ( ( void * ) 0xDEAD )\r
+\r
+/* The base period used by the timer test tasks. */\r
+#define mainTIMER_TEST_PERIOD ( 50 )\r
+\r
+/* The frequency at which the check timer (described in the comments at the top\r
+of this file) will call its callback function. */\r
+#define mainCHECK_TIMER_PERIOD ( 5000UL / ( unsigned long ) portTICK_RATE_MS )\r
+\r
+/* Misc. */\r
+#define mainDONT_BLOCK ( 0 )\r
/*-----------------------------------------------------------*/\r
\r
/*\r
* Converts a status message value into an appropriate string for display on\r
* the LCD. The string is written to pcBuffer.\r
*/\r
-static void prvGenerateStatusMessage( char *pcBuffer, long lStatusValue );\r
+static void prvGenerateStatusMessage( char *pcBuffer, unsigned long ulStatusValue );\r
+\r
+/*\r
+ * Defines the 'check' functionality as described at the top of this file. This\r
+ * function is the callback function for the 'check' timer. */\r
+static void vCheckTimerCallback( xTimerHandle xTimer );\r
\r
/*-----------------------------------------------------------*/\r
\r
the LCD task. */\r
static xQueueHandle xLCDQueue = NULL;\r
\r
+/* The 'check' timer, as described at the top of this file. */\r
+static xTimerHandle xCheckTimer = NULL;\r
+\r
/* The definition of each message sent from tasks and interrupts to the LCD\r
task. */\r
typedef struct\r
\r
/*-----------------------------------------------------------*/\r
\r
-/* The linker script tests the FreeRTOS ports use of 20bit addresses by\r
-locating all code in high memory. The following pragma ensures that main\r
-remains in low memory. */\r
-#pragma CODE_SECTION(main,".main")\r
void main( void )\r
{\r
/* Configure the peripherals used by this demo application. This includes\r
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );\r
vStartDynamicPriorityTasks();\r
vStartGenericQueueTasks( mainGENERIC_QUEUE_TEST_PRIORITY );\r
+ vStartCountingSemaphoreTasks();\r
+ \r
+ /* Note that creating the timer test/demo tasks will fill the timer\r
+ command queue. This is intentional, and forms part of the test the tasks\r
+ perform. It does mean however that, after this function is called, no\r
+ more timer commands can be sent until after the scheduler has been\r
+ started (at which point the timer daemon will drained the timer command\r
+ queue, freeing up space for more commands to be received). */\r
+ vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
\r
/* Create the LCD, button poll and register test tasks, as described at\r
the top of this file. */\r
xTaskCreate( vRegTest1Task, ( signed char * ) "Reg1", configMINIMAL_STACK_SIZE, NULL, 0, NULL );\r
xTaskCreate( vRegTest2Task, ( signed char * ) "Reg2", configMINIMAL_STACK_SIZE, NULL, 0, NULL );\r
\r
+ /* Create the 'check' timer - the timer that periodically calls the\r
+ check function as described at the top of this file. Note that, for\r
+ the reasons stated in the comments above the call to \r
+ vStartTimerDemoTask(), that the check timer is not actually started \r
+ until after the scheduler has been started. */\r
+ xCheckTimer = xTimerCreate( ( const signed char * ) "Check timer", mainCHECK_TIMER_PERIOD, pdTRUE, ( void * ) 0, vCheckTimerCallback ); \r
+\r
/* Start the scheduler. */\r
vTaskStartScheduler();\r
}\r
LCD. Note this is a static variable to prevent it being allocated on the task\r
stack, which is too small to hold such a variable. The stack size is configured\r
when the task is created. */\r
-static char cBuffer[ 512 ];\r
+static char cBuffer[ 50 ];\r
unsigned char ucLine = 1;\r
\r
+ /* Now the scheduler has been started (it must have been for this task to\r
+ be running), start the check timer too. The call to xTimerStart() will\r
+ block until the command has been accepted. */\r
+ if( xCheckTimer != NULL )\r
+ {\r
+ xTimerStart( xCheckTimer, portMAX_DELAY );\r
+ }\r
\r
- /* This function is the only function that uses printf(). If printf() is\r
- used from any other function then some sort of mutual exclusion on stdout\r
- will be necessary.\r
- \r
- This is also the only function that is permitted to access the LCD.\r
+ /* This is the only function that is permitted to access the LCD.\r
\r
First print out the number of bytes that remain in the FreeRTOS heap. This\r
- can be viewed in the terminal IO window within the IAR Embedded Workbench. */\r
- printf( "%d bytes of heap space remain unallocated\n", ( int ) xPortGetFreeHeapSize() );\r
- fflush( stdout );\r
+ is done after a short delay to ensure all the demo tasks have created all\r
+ the objects they are going to use. */\r
+ vTaskDelay( mainTIMER_TEST_PERIOD * 10 );\r
+ sprintf( cBuffer, "%d heap free", ( int ) xPortGetFreeHeapSize() );\r
+ halLcdPrintLine( cBuffer, ucLine, OVERWRITE_TEXT );\r
+ ucLine++;\r
\r
/* Just as a test of the port, and for no functional reason, check the task\r
parameter contains its expected value. */\r
if( pvParameters != mainTASK_PARAMETER_CHECK_VALUE )\r
{\r
- halLcdPrintLine( "Invalid parameter", ucLine, OVERWRITE_TEXT );\r
+ halLcdPrintLine( "Invalid parameter", ucLine, OVERWRITE_TEXT );\r
ucLine++; \r
}\r
\r
\r
case mainMESSAGE_BUTTON_SEL : /* The select button interrupt\r
just informed this task that the\r
- select button was pressed.\r
- Generate a table of task run time\r
- statistics and output this to\r
- the terminal IO window in the IAR\r
- embedded workbench. */\r
- printf( "\nTask\t Abs Time\t %%Time\n*****************************************" );\r
- fflush( stdout );\r
- vTaskGetRunTimeStats( ( signed char * ) cBuffer );\r
- printf( cBuffer );\r
- fflush( stdout );\r
- \r
- /* Also generate and output a\r
- table of task states. */\r
- printf( "\nTask\t\tState Priority\tStack\t#\n*****************************************" );\r
- fflush( stdout );\r
- vTaskList( ( signed char * ) cBuffer );\r
- printf( cBuffer );\r
- fflush( stdout );\r
- \r
- /* Finally print out a message \r
- to the LCD - in this case the\r
- pointer to the string to print\r
- is sent directly in the\r
- ulMessageValue member of the\r
- message. This just demonstrates\r
- a different communication\r
- technique. */\r
+ select button has been pressed.\r
+ In this case the pointer to the \r
+ string to print is sent directly \r
+ in the ulMessageValue member of \r
+ the message. This just \r
+ demonstrates a different \r
+ communication technique. */\r
sprintf( cBuffer, "%s", ( char * ) xReceivedMessage.ulMessageValue );\r
break;\r
\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void prvGenerateStatusMessage( char *pcBuffer, long lStatusValue )\r
+static void prvGenerateStatusMessage( char *pcBuffer, unsigned long ulStatusValue )\r
{\r
/* Just a utility function to convert a status value into a meaningful\r
string for output onto the LCD. */\r
- switch( lStatusValue )\r
+ switch( ulStatusValue )\r
{\r
case pdPASS : sprintf( pcBuffer, "Status = PASS" );\r
break;\r
break;\r
case mainERROR_REG_TEST : sprintf( pcBuffer, "Error: Reg test" );\r
break;\r
+ case mainERROR_TIMER_TEST : sprintf( pcBuffer, "Error: Tmr test" );\r
+ break;\r
+ case mainERROR_COUNT_SEM_TEST : sprintf( pcBuffer, "Error: Count sem" );\r
+ break;\r
default : sprintf( pcBuffer, "Unknown status" );\r
break;\r
}\r
}\r
/*-----------------------------------------------------------*/\r
\r
+static void vCheckTimerCallback( xTimerHandle xTimer )\r
+{\r
+static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0;\r
+\r
+/* Define the status message that is sent to the LCD task. By default the\r
+status is PASS. */\r
+static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS };\r
+\r
+ /* This is the callback function used by the 'check' timer, as described\r
+ at the top of this file. */\r
+\r
+ /* The parameter is not used. */\r
+ ( void ) xTimer;\r
+ \r
+ /* See if the standard demo tasks are executing as expected, changing\r
+ the message that is sent to the LCD task from PASS to an error code if\r
+ any tasks set reports an error. */\r
+ if( xAreComTestTasksStillRunning() != pdPASS )\r
+ {\r
+ xStatusMessage.ulMessageValue = mainERROR_COM_TEST;\r
+ }\r
+\r
+ if( xAreDynamicPriorityTasksStillRunning() != pdPASS )\r
+ {\r
+ xStatusMessage.ulMessageValue = mainERROR_DYNAMIC_TASKS;\r
+ }\r
+ \r
+ if( xAreGenericQueueTasksStillRunning() != pdPASS )\r
+ {\r
+ xStatusMessage.ulMessageValue = mainERROR_GEN_QUEUE_TEST;\r
+ } \r
+ \r
+ if( xAreCountingSemaphoreTasksStillRunning() != pdPASS )\r
+ {\r
+ xStatusMessage.ulMessageValue = mainERROR_COUNT_SEM_TEST;\r
+ }\r
+ \r
+ if( xAreTimerDemoTasksStillRunning( ( portTickType ) mainCHECK_TIMER_PERIOD ) != pdPASS )\r
+ {\r
+ xStatusMessage.ulMessageValue = mainERROR_TIMER_TEST;\r
+ }\r
+\r
+ /* Check the reg test tasks are still cycling. They will stop\r
+ incrementing their loop counters if they encounter an error. */\r
+ if( usRegTest1Counter == usLastRegTest1Counter )\r
+ {\r
+ xStatusMessage.ulMessageValue = mainERROR_REG_TEST;\r
+ }\r
+\r
+ if( usRegTest2Counter == usLastRegTest2Counter )\r
+ {\r
+ xStatusMessage.ulMessageValue = mainERROR_REG_TEST;\r
+ }\r
+\r
+ usLastRegTest1Counter = usRegTest1Counter;\r
+ usLastRegTest2Counter = usRegTest2Counter;\r
+ \r
+ /* This is called from a timer callback so must not block! */\r
+ xQueueSendToBack( xLCDQueue, &xStatusMessage, mainDONT_BLOCK );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
static void prvSetupHardware( void )\r
{\r
/* Convert a Hz value to a KHz value, as required by the Init_FLL_Settle()\r
}\r
/*-----------------------------------------------------------*/\r
\r
+\r
void vApplicationTickHook( void )\r
{\r
-static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0;\r
static unsigned long ulCounter = 0;\r
-static const unsigned long ulCheckFrequency = 5000UL / portTICK_RATE_MS;\r
-portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
-\r
-/* Define the status message that is sent to the LCD task. By default the\r
-status is PASS. */\r
-static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS };\r
-\r
- /* This is called from within the tick interrupt and performs the 'check'\r
- functionality as described in the comments at the top of this file.\r
\r
- Is it time to perform the 'check' functionality again? */\r
+ /* Is it time to toggle the LED again? */\r
ulCounter++;\r
- if( ulCounter >= ulCheckFrequency )\r
- {\r
- /* See if the standard demo tasks are executing as expected, changing\r
- the message that is sent to the LCD task from PASS to an error code if\r
- any tasks set reports an error. */\r
- if( xAreComTestTasksStillRunning() != pdPASS )\r
- {\r
- xStatusMessage.ulMessageValue = mainERROR_COM_TEST;\r
- }\r
-\r
- if( xAreDynamicPriorityTasksStillRunning() != pdPASS )\r
- {\r
- xStatusMessage.ulMessageValue = mainERROR_DYNAMIC_TASKS;\r
- }\r
- \r
- if( xAreGenericQueueTasksStillRunning() != pdPASS )\r
- {\r
- xStatusMessage.ulMessageValue = mainERROR_GEN_QUEUE_TEST;\r
- } \r
-\r
- /* Check the reg test tasks are still cycling. They will stop\r
- incrementing their loop counters if they encounter an error. */\r
- if( usRegTest1Counter == usLastRegTest1Counter )\r
- {\r
- xStatusMessage.ulMessageValue = mainERROR_REG_TEST;\r
- }\r
-\r
- if( usRegTest2Counter == usLastRegTest2Counter )\r
- {\r
- xStatusMessage.ulMessageValue = mainERROR_REG_TEST;\r
- }\r
-\r
- usLastRegTest1Counter = usRegTest1Counter;\r
- usLastRegTest2Counter = usRegTest2Counter;\r
- \r
- /* As this is the tick hook the lHigherPriorityTaskWoken parameter is not\r
- needed (a context switch is going to be performed anyway), but it must\r
- still be provided. */\r
- xQueueSendFromISR( xLCDQueue, &xStatusMessage, &xHigherPriorityTaskWoken );\r
- ulCounter = 0;\r
- }\r
\r
/* Just periodically toggle an LED to show that the tick interrupt is\r
running. Note that this access LED_PORT_OUT in a non-atomic way, so tasks\r
}\r
/*-----------------------------------------------------------*/\r
\r
+\r
--- /dev/null
+/*\r
+ Copyright 2001, 2002 Georges Menie (www.menie.org)\r
+ stdarg version contributed by Christian Ettinger\r
+\r
+ This program is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU Lesser General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ This program is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU Lesser General Public License for more details.\r
+\r
+ You should have received a copy of the GNU Lesser General Public License\r
+ along with this program; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+*/\r
+\r
+/*\r
+ putchar is the only external dependency for this file,\r
+ if you have a working putchar, leave it commented out.\r
+ If not, uncomment the define below and\r
+ replace outbyte(c) by your own function call.\r
+\r
+*/\r
+\r
+#define putchar(c) c\r
+\r
+#include <stdarg.h>\r
+\r
+static void printchar(char **str, int c)\r
+{\r
+ //extern int putchar(int c);\r
+ \r
+ if (str) {\r
+ **str = (char)c;\r
+ ++(*str);\r
+ }\r
+ else\r
+ { \r
+ (void)putchar(c);\r
+ }\r
+}\r
+\r
+#define PAD_RIGHT 1\r
+#define PAD_ZERO 2\r
+\r
+static int prints(char **out, const char *string, int width, int pad)\r
+{\r
+ register int pc = 0, padchar = ' ';\r
+\r
+ if (width > 0) {\r
+ register int len = 0;\r
+ register const char *ptr;\r
+ for (ptr = string; *ptr; ++ptr) ++len;\r
+ if (len >= width) width = 0;\r
+ else width -= len;\r
+ if (pad & PAD_ZERO) padchar = '0';\r
+ }\r
+ if (!(pad & PAD_RIGHT)) {\r
+ for ( ; width > 0; --width) {\r
+ printchar (out, padchar);\r
+ ++pc;\r
+ }\r
+ }\r
+ for ( ; *string ; ++string) {\r
+ printchar (out, *string);\r
+ ++pc;\r
+ }\r
+ for ( ; width > 0; --width) {\r
+ printchar (out, padchar);\r
+ ++pc;\r
+ }\r
+\r
+ return pc;\r
+}\r
+\r
+/* the following should be enough for 32 bit int */\r
+#define PRINT_BUF_LEN 12\r
+\r
+static int printi(char **out, int i, int b, int sg, int width, int pad, int letbase)\r
+{\r
+ char print_buf[PRINT_BUF_LEN];\r
+ register char *s;\r
+ register int t, neg = 0, pc = 0;\r
+ register unsigned int u = (unsigned int)i;\r
+\r
+ if (i == 0) {\r
+ print_buf[0] = '0';\r
+ print_buf[1] = '\0';\r
+ return prints (out, print_buf, width, pad);\r
+ }\r
+\r
+ if (sg && b == 10 && i < 0) {\r
+ neg = 1;\r
+ u = (unsigned int)-i;\r
+ }\r
+\r
+ s = print_buf + PRINT_BUF_LEN-1;\r
+ *s = '\0';\r
+\r
+ while (u) {\r
+ t = (unsigned int)u % b;\r
+ if( t >= 10 )\r
+ t += letbase - '0' - 10;\r
+ *--s = (char)(t + '0');\r
+ u /= b;\r
+ }\r
+\r
+ if (neg) {\r
+ if( width && (pad & PAD_ZERO) ) {\r
+ printchar (out, '-');\r
+ ++pc;\r
+ --width;\r
+ }\r
+ else {\r
+ *--s = '-';\r
+ }\r
+ }\r
+\r
+ return pc + prints (out, s, width, pad);\r
+}\r
+\r
+static int print( char **out, const char *format, va_list args )\r
+{\r
+ register int width, pad;\r
+ register int pc = 0;\r
+ char scr[2];\r
+\r
+ for (; *format != 0; ++format) {\r
+ if (*format == '%') {\r
+ ++format;\r
+ width = pad = 0;\r
+ if (*format == '\0') break;\r
+ if (*format == '%') goto out;\r
+ if (*format == '-') {\r
+ ++format;\r
+ pad = PAD_RIGHT;\r
+ }\r
+ while (*format == '0') {\r
+ ++format;\r
+ pad |= PAD_ZERO;\r
+ }\r
+ for ( ; *format >= '0' && *format <= '9'; ++format) {\r
+ width *= 10;\r
+ width += *format - '0';\r
+ }\r
+ if( *format == 's' ) {\r
+ register char *s = (char *)va_arg( args, int );\r
+ pc += prints (out, s?s:"(null)", width, pad);\r
+ continue;\r
+ }\r
+ if( *format == 'd' ) {\r
+ pc += printi (out, va_arg( args, int ), 10, 1, width, pad, 'a');\r
+ continue;\r
+ }\r
+ if( *format == 'x' ) {\r
+ pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'a');\r
+ continue;\r
+ }\r
+ if( *format == 'X' ) {\r
+ pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'A');\r
+ continue;\r
+ }\r
+ if( *format == 'u' ) {\r
+ pc += printi (out, va_arg( args, int ), 10, 0, width, pad, 'a');\r
+ continue;\r
+ }\r
+ if( *format == 'c' ) {\r
+ /* char are converted to int then pushed on the stack */\r
+ scr[0] = (char)va_arg( args, int );\r
+ scr[1] = '\0';\r
+ pc += prints (out, scr, width, pad);\r
+ continue;\r
+ }\r
+ }\r
+ else {\r
+ out:\r
+ printchar (out, *format);\r
+ ++pc;\r
+ }\r
+ }\r
+ if (out) **out = '\0';\r
+ va_end( args );\r
+ return pc;\r
+}\r
+\r
+int printf(const char *format, ...)\r
+{\r
+ va_list args;\r
+ \r
+ va_start( args, format );\r
+ return print( 0, format, args );\r
+}\r
+\r
+int sprintf(char *out, const char *format, ...)\r
+{\r
+ va_list args;\r
+ \r
+ va_start( args, format );\r
+ return print( &out, format, args );\r
+}\r
+\r
+\r
+int snprintf( char *buf, unsigned int count, const char *format, ... )\r
+{\r
+ va_list args;\r
+ \r
+ ( void ) count;\r
+ \r
+ va_start( args, format );\r
+ return print( &buf, format, args );\r
+}\r
+\r
+\r
+#ifdef TEST_PRINTF\r
+int main(void)\r
+{\r
+ char *ptr = "Hello world!";\r
+ char *np = 0;\r
+ int i = 5;\r
+ unsigned int bs = sizeof(int)*8;\r
+ int mi;\r
+ char buf[80];\r
+\r
+ mi = (1 << (bs-1)) + 1;\r
+ printf("%s\n", ptr);\r
+ printf("printf test\n");\r
+ printf("%s is null pointer\n", np);\r
+ printf("%d = 5\n", i);\r
+ printf("%d = - max int\n", mi);\r
+ printf("char %c = 'a'\n", 'a');\r
+ printf("hex %x = ff\n", 0xff);\r
+ printf("hex %02x = 00\n", 0);\r
+ printf("signed %d = unsigned %u = hex %x\n", -3, -3, -3);\r
+ printf("%d %s(s)%", 0, "message");\r
+ printf("\n");\r
+ printf("%d %s(s) with %%\n", 0, "message");\r
+ sprintf(buf, "justif: \"%-10s\"\n", "left"); printf("%s", buf);\r
+ sprintf(buf, "justif: \"%10s\"\n", "right"); printf("%s", buf);\r
+ sprintf(buf, " 3: %04d zero padded\n", 3); printf("%s", buf);\r
+ sprintf(buf, " 3: %-4d left justif.\n", 3); printf("%s", buf);\r
+ sprintf(buf, " 3: %4d right justif.\n", 3); printf("%s", buf);\r
+ sprintf(buf, "-3: %04d zero padded\n", -3); printf("%s", buf);\r
+ sprintf(buf, "-3: %-4d left justif.\n", -3); printf("%s", buf);\r
+ sprintf(buf, "-3: %4d right justif.\n", -3); printf("%s", buf);\r
+\r
+ return 0;\r
+}\r
+\r
+/*\r
+ * if you compile this file with\r
+ * gcc -Wall $(YOUR_C_OPTIONS) -DTEST_PRINTF -c printf.c\r
+ * you will get a normal warning:\r
+ * printf.c:214: warning: spurious trailing `%' in format\r
+ * this line is testing an invalid % at the end of the format string.\r
+ *\r
+ * this should display (on 32bit int machine) :\r
+ *\r
+ * Hello world!\r
+ * printf test\r
+ * (null) is null pointer\r
+ * 5 = 5\r
+ * -2147483647 = - max int\r
+ * char a = 'a'\r
+ * hex ff = ff\r
+ * hex 00 = 00\r
+ * signed -3 = unsigned 4294967293 = hex fffffffd\r
+ * 0 message(s)\r
+ * 0 message(s) with %\r
+ * justif: "left "\r
+ * justif: " right"\r
+ * 3: 0003 zero padded\r
+ * 3: 3 left justif.\r
+ * 3: 3 right justif.\r
+ * -3: -003 zero padded\r
+ * -3: -3 left justif.\r
+ * -3: -3 right justif.\r
+ */\r
+\r
+#endif\r
+\r
+\r
+/* To keep linker happy. */\r
+int write( int i, char* c, int n)\r
+{\r
+ (void)i;\r
+ (void)n;\r
+ (void)c;\r
+ return 0;\r
+}\r
+\r
portENTER_CRITICAL();\r
{\r
/* Create the queues used by the com test task. */\r
- xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );\r
- xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );\r
+ xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );\r
+ xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );\r
\r
/* Reset UART. */\r
UCA1CTL1 |= UCSWRST;\r
UCA1CTL1 = UCSSEL0 | UCSSEL1;\r
\r
/* Setup baud rate low byte. */\r
- UCA1BR0 = ( unsigned portCHAR ) ( ulBaudRateCount & ( unsigned portLONG ) 0xff );\r
+ UCA1BR0 = ( unsigned portCHAR ) ( ulBaudRateCount & ( unsigned long ) 0xff );\r
\r
/* Setup baud rate high byte. */\r
ulBaudRateCount >>= 8UL;\r
- UCA1BR1 = ( unsigned portCHAR ) ( ulBaudRateCount & ( unsigned portLONG ) 0xff );\r
+ UCA1BR1 = ( unsigned portCHAR ) ( ulBaudRateCount & ( unsigned long ) 0xff );\r
\r
/* UCLISTEN sets loopback mode! */\r
UCA1STAT = UCLISTEN;\r
completed and switched itself off. */\r
xReturn = xQueueSend( xCharsForTx, &cOutChar, xBlockTime );\r
UCA1IE |= UCTXIE;\r
-\r
+ \r
return xReturn;\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_A1_VECTOR\r
interrupt void prvUSCI_A1_ISR( void )\r
{\r
-signed portCHAR cChar;\r
-portBASE_TYPE xTaskWoken = pdFALSE;\r
+signed char cChar;\r
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
\r
while( ( UCA1IFG & UCRXIFG ) != 0 )\r
{\r
/* The previous character has been transmitted. See if there are any\r
further characters waiting transmission. */\r
- if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xTaskWoken ) == pdTRUE )\r
+ if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xHigherPriorityTaskWoken ) == pdTRUE )\r
{\r
/* There was another character queued - transmit it now. */\r
UCA1TXBUF = cChar;\r
UCA1IE &= ~UCTXIE;\r
}\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
/* Original line. */\r
.text : {}>> FLASH | FLASH2 /* CODE */\r
/* Modified line. */\r
-/* .text : {}>> FLASH2 */ /* CODE */\r
+/* .text : {}>> FLASH2 */ /* CODE */\r
.main : {} > FLASH\r
.text:_isr : {} > FLASH /* ISR CODE SPACE */\r
.cinit : {} > FLASH /* INITIALIZATION TABLES */\r