+++ /dev/null
-;-------------------------------------------------\r
-;\r
- .def vRegTestTask1\r
- .ref usRegTest1Counter\r
- .text\r
- .arm\r
-;\r
-vRegTestTask1:\r
- ; Fill each general purpose register with a known value.\r
- mov r0, #0xFF\r
- mov r1, #0x11\r
- mov r2, #0x22\r
- mov r3, #0x33\r
- mov r4, #0x44 \r
- mov r5, #0x55\r
- mov r6, #0x66\r
- mov r7, #0x77\r
- mov r8, #0x88\r
- mov r9, #0x99\r
- mov r10, #0xAA\r
- mov r11, #0xBB\r
- mov r12, #0xCC\r
- mov r14, #0xEE\r
- \r
-regTestLoop1:\r
- ; Force yeild\r
- swi #0\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 r0, #0xFF\r
- bne regTestError1 \r
- cmp r1, #0x11\r
- bne regTestError1 \r
- cmp r2, #0x22\r
- bne regTestError1 \r
- cmp r3, #0x33\r
- bne regTestError1 \r
- cmp r4, #0x44\r
- bne regTestError1 \r
- cmp r5, #0x55\r
- bne regTestError1 \r
- cmp r6, #0x66\r
- bne regTestError1 \r
- cmp r7, #0x77\r
- bne regTestError1 \r
- cmp r8, #0x88\r
- bne regTestError1 \r
- cmp r9, #0x99\r
- bne regTestError1 \r
- cmp r10, #0xAA\r
- bne regTestError1 \r
- cmp r11, #0xBB\r
- bne regTestError1 \r
- cmp r12, #0xCC\r
- bne regTestError1 \r
- cmp r14, #0xEE\r
- bne regTestError1 \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
- stmfd sp!, { r0-r1 }\r
- ldr r0, count1\r
- ldr r1, [r0]\r
- add r1, r1, #1\r
- str r1, [r0]\r
- ldmfd sp!, { r0-r1 }\r
- \r
- ; Loop again, performing the same tests.\r
- b regTestLoop1\r
-\r
-count1 .word usRegTest1Counter\r
- \r
-regTestError1:\r
- b regTestError1\r
-\r
-\r
-;-------------------------------------------------\r
-;\r
- .def vRegTestTask2\r
- .ref usRegTest2Counter\r
- .text\r
- .arm\r
-;\r
-vRegTestTask2:\r
- ; Fill each general purpose register with a known value.\r
- mov r0, #0xFF000000\r
- mov r1, #0x11000000\r
- mov r2, #0x22000000\r
- mov r3, #0x33000000\r
- mov r4, #0x44000000 \r
- mov r5, #0x55000000\r
- mov r6, #0x66000000\r
- mov r7, #0x77000000\r
- mov r8, #0x88000000\r
- mov r9, #0x99000000\r
- mov r10, #0xAA000000\r
- mov r11, #0xBB000000\r
- mov r12, #0xCC000000\r
- mov r14, #0xEE000000\r
- \r
-regTestLoop2:\r
- ; Force yeild\r
- swi #0\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 r0, #0xFF000000\r
- bne regTestError2 \r
- cmp r1, #0x11000000\r
- bne regTestError2 \r
- cmp r2, #0x22000000\r
- bne regTestError2 \r
- cmp r3, #0x33000000\r
- bne regTestError2 \r
- cmp r4, #0x44000000\r
- bne regTestError2 \r
- cmp r5, #0x55000000\r
- bne regTestError2 \r
- cmp r6, #0x66000000\r
- bne regTestError2 \r
- cmp r7, #0x77000000\r
- bne regTestError2 \r
- cmp r8, #0x88000000\r
- bne regTestError2 \r
- cmp r9, #0x99000000\r
- bne regTestError2 \r
- cmp r10, #0xAA000000\r
- bne regTestError2 \r
- cmp r11, #0xBB000000\r
- bne regTestError2 \r
- cmp r12, #0xCC000000\r
- bne regTestError2 \r
- cmp r14, #0xEE000000\r
- bne regTestError2 \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
- stmfd sp!, { r0-r1 }\r
- ldr r0, count2\r
- ldr r1, [r0]\r
- add r1, r1, #1\r
- str r1, [r0]\r
- ldmfd sp!, { r0-r1 }\r
- \r
- ; Loop again, performing the same tests.\r
- b regTestLoop2\r
-\r
-count2 .word usRegTest2Counter\r
- \r
-regTestError2:\r
- b regTestError2\r
-\r
-;-------------------------------------------------\r
- \r
- \r
- \r
-#if 1\r
/*\r
FreeRTOS V7.2.0 - Copyright (C) 2012 Real Time Engineers Ltd.\r
\r
}\r
/*-----------------------------------------------------------*/\r
\r
-\r
-\r
-\r
-\r
-\r
-\r
-#else\r
-\r
-/*\r
- FreeRTOS V7.2.0 - Copyright (C) 2012 Real Time Engineers Ltd.\r
-\r
-\r
- ***************************************************************************\r
- * *\r
- * FreeRTOS tutorial books are available in pdf and paperback. *\r
- * Complete, revised, and edited pdf reference manuals are also *\r
- * available. *\r
- * *\r
- * Purchasing FreeRTOS documentation will not only help you, by *\r
- * ensuring you get running as quickly as possible and with an *\r
- * in-depth knowledge of how to use FreeRTOS, it will also help *\r
- * the FreeRTOS project to continue with its mission of providing *\r
- * professional grade, cross platform, de facto standard solutions *\r
- * for microcontrollers - completely free of charge! *\r
- * *\r
- * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *\r
- * *\r
- * Thank you for using FreeRTOS, and thank you for your support! *\r
- * *\r
- ***************************************************************************\r
-\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
- >>>NOTE<<< The modification to the GPL is included to allow you to\r
- distribute a combined work that includes FreeRTOS without being obliged to\r
- provide the source code for proprietary components outside of the FreeRTOS\r
- kernel. FreeRTOS is distributed in the hope that it will be useful, but\r
- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
- more details. You should have received a copy of the GNU General Public\r
- License and the FreeRTOS license exception along with FreeRTOS; if not it\r
- can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
- by writing to Richard Barry, contact details for whom are available on the\r
- FreeRTOS WEB site.\r
-\r
- 1 tab == 4 spaces!\r
- \r
- ***************************************************************************\r
- * *\r
- * Having a problem? Start by reading the FAQ "My application does *\r
- * not run, what could be wrong? *\r
- * *\r
- * http://www.FreeRTOS.org/FAQHelp.html *\r
- * *\r
- ***************************************************************************\r
-\r
- \r
- http://www.FreeRTOS.org - Documentation, training, latest information, \r
- license and contact details.\r
- \r
- http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
- including FreeRTOS+Trace - an indispensable productivity tool.\r
-\r
- Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell \r
- the code with commercial support, indemnification, and middleware, under \r
- the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also\r
- provide a safety engineered and independently SIL3 certified version under \r
- the SafeRTOS brand: http://www.SafeRTOS.com.\r
-*/\r
-\r
-/* Standard includes. */\r
-#include <stdio.h>\r
-\r
-/* FreeRTOS includes. */\r
-#include "FreeRTOS.h"\r
-#include "task.h"\r
-#include "timers.h"\r
-#include "queue.h"\r
-\r
-/* Library includes. */\r
-#include "gio.h"\r
-\r
-/* Demo application includes. */\r
-#include "TimerDemo.h"\r
-#include "countsem.h"\r
-#include "GenQTest.h"\r
-#include "dynamic.h"\r
-\r
-\r
-/*\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
- * different values. The tasks run with very low priority so get preempted\r
- * very frequently. A check variable is incremented on each iteration of the\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 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
- */\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
-cMessageID member of the message structure (defined below). */\r
-#define mainERROR_DYNAMIC_TASKS ( pdPASS + 1 )\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
-/* Priorities used by the test and demo tasks. */\r
-#define mainPRINT_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
-#define mainGENERIC_QUEUE_TEST_PRIORITY ( tskIDLE_PRIORITY )\r
-#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
-#define mainSTAT_TASK_PRIORITY ( tskIDLE_PRIORITY )\r
-\r
-/* Just used to ensure parameters are passed into tasks correctly. */\r
-#define mainTASK_PARAMETER_CHECK_VALUE ( ( void * ) 0xDEADBEEF )\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 Print task. */\r
-#define mainQUEUE_LENGTH ( 5 )\r
-\r
-/* The base period used by the timer test tasks. */\r
-#define mainTIMER_TEST_PERIOD ( 50 / portTICK_RATE_MS )\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
-/* A block time of 0 simply means "don't block". */\r
-#define mainDONT_BLOCK ( 0 )\r
-\r
-/* \r
- * The register check tasks, as decribed in the comments at the top of this \r
- * file. The nature of the tasks necessitates that they are written in \r
- * assembler. \r
- */\r
-extern void vRegTestTask1(void *pvParameters); \r
-extern void vRegTestTask2(void *pvParameters); \r
-\r
-/*\r
- * Definition of the Print task described in the comments at the top of this \r
- * file.\r
- */\r
-static void prvPrintTask( void *pvParameters );\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
-extern void vLedTask( void * pvParameters );\r
-void vStatsTask(void *pvParameters);\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-/* variable incremente in the IDLE hook */\r
-volatile unsigned usIdleCounter = 0;\r
-\r
-/* Variables that are incremented on each iteration of the reg test tasks -\r
-provided the tasks have not reported any errors. The check task inspects these\r
-variables to ensure they are still incrementing as expected. If a variable\r
-stops incrementing then it is likely that its associate task has stalled. */\r
-volatile unsigned usRegTest1Counter = 0, usRegTest2Counter = 0;\r
-\r
-/* The handle of the queue used to send messages from tasks and interrupts to\r
- the Print task. */\r
-static xQueueHandle xPrintQueue = NULL;\r
-\r
-/* The 'check' timer, as described at the top of this file. */\r
-static xTimerHandle xCheckTimer = NULL;\r
-\r
-\r
-/*-----------------------------------------------------------*/\r
-\r
-void main()\r
-{\r
- /* initalise DIO ports */\r
- gioInit();\r
-\r
- /* Create the queue used by tasks and interrupts to send strings to the \r
- print task. */\r
- xPrintQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) );\r
-\r
- /* If the queue could not be created then don't create any tasks that might\r
- attempt to use the queue. */\r
- if( xPrintQueue != NULL )\r
- {\r
- /* Create STATS task, this prints out a summary of running tasks every 15s */\r
- xTaskCreate(vStatsTask, (signed char *)"STATS..", 600, NULL, mainSTAT_TASK_PRIORITY, NULL);\r
-\r
- /* Create LED task, this will flash the LEDs on the USB stick */\r
- xTaskCreate(vLedTask, (signed char *)"LEDS...", configMINIMAL_STACK_SIZE, NULL, mainLED_TASK_PRIORITY, NULL);\r
-\r
- /* Create the standard demo tasks. */\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 Print and register test tasks. */\r
- xTaskCreate(prvPrintTask, (signed char *)"Print..", 500, mainTASK_PARAMETER_CHECK_VALUE, mainPRINT_TASK_PRIORITY, NULL );\r
- xTaskCreate(vRegTestTask1, (signed char *)"REG1...", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL);\r
- xTaskCreate(vRegTestTask2, (signed char *)"REG2...", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, 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 FreeRTOS Scheduler */\r
- vTaskStartScheduler();\r
- }\r
- \r
- /* If all is well then this line will never be reached. If it is reached\r
- then it is likely that there was insufficient (FreeRTOS) heap memory space\r
- to create the idle task. This may have been trapped by the malloc() failed\r
- hook function, if one is configured. */ \r
- for (;;);\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vStatsTask(void *pvParameters)\r
-{\r
-/* Buffer used to hold the table of run time statistics. This is static so it\r
-does not overflow the task stack. */\r
-static signed char cStatsBuffer[ 1024 ];\r
-const portTickType x15Seconds = 15000 / portTICK_RATE_MS;\r
-\r
- printf("**** Task Statistics Started\n");\r
- for (;;)\r
- {\r
- vTaskDelay( x15Seconds );\r
- vTaskGetRunTimeStats( cStatsBuffer );\r
- printf("%s\n", cStatsBuffer );\r
- }\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvPrintTask( void *pvParameters )\r
-{\r
-unsigned long ulReceivedMessage;\r
-static signed char cPrintBuffer[ 50 ]; \r
-\r
- printf( "**** Print Task Started\n" );\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
- /* First print out the number of bytes that remain in the FreeRTOS heap. This\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
- printf( "**** %d heap free\n", ( int ) xPortGetFreeHeapSize() );\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
- printf("**** Invalid parameter ****\n\n");\r
- }\r
-\r
- for( ;; )\r
- {\r
- /* Wait for a message to be received. Using portMAX_DELAY as the block\r
- time will result in an indefinite wait provided INCLUDE_vTaskSuspend is\r
- set to 1 in FreeRTOSConfig.h, therefore there is no need to check the\r
- function return value and the function will only return when a value\r
- has been received. */\r
- xQueueReceive( xPrintQueue, &ulReceivedMessage, portMAX_DELAY );\r
-\r
- /* What is this message? What does it contain? */\r
- switch( ulReceivedMessage )\r
- {\r
- case pdPASS : sprintf( ( char * ) cPrintBuffer, "Status = PASS" );\r
- break;\r
- case mainERROR_DYNAMIC_TASKS : sprintf( ( char * ) cPrintBuffer, "Err: Dynamic tsks" );\r
- break;\r
- case mainERROR_GEN_QUEUE_TEST : sprintf( ( char * ) cPrintBuffer, "Error: Gen Q test" );\r
- break;\r
- case mainERROR_REG_TEST : sprintf( ( char * ) cPrintBuffer, "Error: Reg test" );\r
- break;\r
- case mainERROR_TIMER_TEST : sprintf( ( char * ) cPrintBuffer, "Error: Tmr test" );\r
- break;\r
- case mainERROR_COUNT_SEM_TEST : sprintf( ( char * ) cPrintBuffer, "Error: Count sem" );\r
- break;\r
- default : sprintf( ( char * ) cPrintBuffer, "Unknown status" );\r
- break;\r
- }\r
- /* Output the message that was placed into the cBuffer array within the\r
- switch statement above, then move onto the next line ready for the next\r
- message to arrive on the queue. */\r
- printf( "**** Message Received: %s\n", cPrintBuffer );\r
- } \r
-}\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
- unsigned long ulStatus = 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( xAreDynamicPriorityTasksStillRunning() != pdPASS )\r
- {\r
- ulStatus = mainERROR_DYNAMIC_TASKS;\r
- }\r
- \r
- if( xAreGenericQueueTasksStillRunning() != pdPASS )\r
- {\r
- ulStatus = mainERROR_GEN_QUEUE_TEST;\r
- } \r
- \r
- if( xAreCountingSemaphoreTasksStillRunning() != pdPASS )\r
- {\r
- ulStatus = mainERROR_COUNT_SEM_TEST;\r
- }\r
- \r
- if( xAreTimerDemoTasksStillRunning( ( portTickType ) mainCHECK_TIMER_PERIOD ) != pdPASS )\r
- {\r
- ulStatus = 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
- ulStatus = mainERROR_REG_TEST;\r
- }\r
-\r
- if( usRegTest2Counter == usLastRegTest2Counter )\r
- {\r
- ulStatus = 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( xPrintQueue, &ulStatus, mainDONT_BLOCK );\r
-}\r
-\r
-\r
-/* ----------------------------------------------------------------------------------------------------------- */\r
-\r
-void vApplicationTickHook( void )\r
-{\r
- static unsigned long ulCounter = 0;\r
-\r
- /* Is it time to toggle the pin again? */\r
- ulCounter++;\r
-\r
- /* Just periodically toggle a pin to show that the tick interrupt is\r
- running. */\r
- if( ( ulCounter & 0xff ) == 0 )\r
- {\r
- gioSetBit(gioPORTA, 0, 1);\r
- gioSetBit(gioPORTA, 0, 0);\r
- }\r
-}\r
-\r
-\r
-/* ----------------------------------------------------------------------------------------------------------- */\r
-\r
-void vApplicationMallocFailedHook( void )\r
-{\r
- /* Called if a call to pvPortMalloc() fails because there is insufficient\r
- free memory available in the FreeRTOS heap. pvPortMalloc() is called\r
- internally by FreeRTOS API functions that create tasks, queues or\r
- semaphores. */\r
- taskDISABLE_INTERRUPTS();\r
- for( ;; );\r
-}\r
-\r
-/* ----------------------------------------------------------------------------------------------------------- */\r
- \r
-void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )\r
-{\r
- /* Run time stack overflow checking is performed if\r
- configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook\r
- function is called if a stack overflow is detected. */\r
- taskDISABLE_INTERRUPTS();\r
- for( ;; );\r
-}\r
-\r
-/* ----------------------------------------------------------------------------------------------------------- */\r
-\r
-void vApplicationIdleHook(void)\r
-{\r
- usIdleCounter++; \r
-}\r
-\r
-\r
-/* ----------------------------------------------------------------------------------------------------------- */\r
-\r
-#endif\r
-\r
-\r
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
\r
/* Create the register test tasks, as described at the top of this file. */\r
- xTaskCreate(vRegTestTask1, ( const signed char * ) "Reg1...", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
- xTaskCreate(vRegTestTask2, ( const signed char * ) "Reg2...", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+ xTaskCreate( vRegTestTask1, ( const signed char * ) "Reg1...", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+ xTaskCreate( vRegTestTask2, ( const signed char * ) "Reg2...", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
\r
/* Create the software timer that performs the 'check' functionality,\r
as described at the top of this file. */\r
/*\r
FreeRTOS V7.2.0 - Copyright (C) 2012 Real Time Engineers Ltd.\r
- \r
+\r
\r
***************************************************************************\r
* *\r
FreeRTOS WEB site.\r
\r
1 tab == 4 spaces!\r
- \r
+\r
***************************************************************************\r
* *\r
* Having a problem? Start by reading the FAQ "My application does *\r
* *\r
***************************************************************************\r
\r
- \r
- http://www.FreeRTOS.org - Documentation, training, latest information, \r
+\r
+ http://www.FreeRTOS.org - Documentation, training, latest information,\r
license and contact details.\r
- \r
+\r
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
including FreeRTOS+Trace - an indispensable productivity tool.\r
\r
- Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell \r
- the code with commercial support, indemnification, and middleware, under \r
+ Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell\r
+ the code with commercial support, indemnification, and middleware, under\r
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also\r
- provide a safety engineered and independently SIL3 certified version under \r
+ provide a safety engineered and independently SIL3 certified version under\r
the SafeRTOS brand: http://www.SafeRTOS.com.\r
*/\r
\r
-/*----------------------------------------------------------------------------*/\r
-/* Include Files */\r
-\r
+/* FreeRTOS includes. */\r
#include "FreeRTOS.h"\r
#include "task.h"\r
\r
-/*----------------------------------------------------------------------------*/\r
-/* Global Variables */\r
+/*-----------------------------------------------------------*/\r
\r
+/* Count of the critical section nesting depth. */\r
unsigned portLONG ulCriticalNesting = 9999;\r
\r
-/*----------------------------------------------------------------------------*/\r
-/* Macros */\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Registers required to configure the RTI. */\r
+#define portRTI_GCTRL_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC00 ) )\r
+#define portRTI_TBCTRL_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC04 ) )\r
+#define portRTI_COMPCTRL_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC0C ) )\r
+#define portRTI_CNT0_FRC0_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC10 ) )\r
+#define portRTI_CNT0_UC0_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC14 ) )\r
+#define portRTI_CNT0_CPUC0_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC18 ) )\r
+#define portRTI_CNT0_COMP0_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC50 ) )\r
+#define portRTI_CNT0_UDCP0_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC54 ) )\r
+#define portRTI_SETINTENA_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC80 ) )\r
+#define portRTI_CLEARINTENA_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC84 ) )\r
+#define portRTI_INTFLAG_REG ( * ( ( volatile unsigned long * ) 0xFFFFFC88 ) )\r
+\r
\r
-#define portINITIAL_SPSR ((portSTACK_TYPE) 0x1F)\r
-#define portINITIAL_FPSCR ((portSTACK_TYPE) 0x00)\r
-#define portINSTRUCTION_SIZE ((portSTACK_TYPE) 0x04)\r
-#define portTHUMB_MODE_BIT ((portSTACK_TYPE) 0x20)\r
+/* Constants required to set up the initial stack of each task. */\r
+#define portINITIAL_SPSR ( ( portSTACK_TYPE ) 0x1F )\r
+#define portINITIAL_FPSCR ( ( portSTACK_TYPE ) 0x00 )\r
+#define portINSTRUCTION_SIZE ( ( portSTACK_TYPE ) 0x04 )\r
+#define portTHUMB_MODE_BIT ( ( portSTACK_TYPE ) 0x20 )\r
\r
-/*----------------------------------------------------------------------------*/\r
-/* pxPortInitialiseStack */\r
+/* The number of words on the stack frame between the saved Top Of Stack and\r
+R0 (in which the parameters are passed. */\r
+#define portSPACE_BETWEEN_TOS_AND_PARAMETERS ( 12 )\r
\r
-portSTACK_TYPE * pxPortInitialiseStack(portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters)\r
+/*-----------------------------------------------------------*/\r
+\r
+/* vPortStartFirstSTask() is defined in portASM.asm */\r
+extern void vPortStartFirstTask( void );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+\r
+/*\r
+ * See header file for description.\r
+ */\r
+portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )\r
{\r
- portSTACK_TYPE *pxOriginalTOS = pxTopOfStack;\r
- \r
- *pxTopOfStack-- = (portSTACK_TYPE) pxCode + portINSTRUCTION_SIZE; \r
- *pxTopOfStack-- = (portSTACK_TYPE) 0xaaaaaaaa;\r
- *pxTopOfStack-- = (portSTACK_TYPE) pxOriginalTOS;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x12121212;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x11111111;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x10101010;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x09090909;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x08080808;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x07070707;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x06060606;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x05050505;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x04040404;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x03030303;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x02020202;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x01010101;\r
- *pxTopOfStack-- = (portSTACK_TYPE) pvParameters;\r
-\r
-#if __TI_VFPV3D16_SUPPORT__\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x3F3F3F3F;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x3E3E3E3E;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x3D3D3D3D;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x3C3C3C3C;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x3B3B3B3B;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x3A3A3A3A;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x39393939;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x38383838;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x37373737;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x36363636;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x35353535;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x34343434;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x33333333;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x32323232;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x31313131;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x30303030;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x2F2F2F2F;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x2E2E2E2E;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x2D2D2D2D;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x2C2C2C2C;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x2B2B2B2B;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x2A2A2A2A;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x29292929;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x28282828;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x27272727;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x26262626;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x25252525;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x24242424;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x23232323;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x22222222;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x21212121;\r
- *pxTopOfStack-- = (portSTACK_TYPE) 0x20202020;\r
- *pxTopOfStack-- = (portSTACK_TYPE) portINITIAL_FPSCR;\r
-#endif\r
+portSTACK_TYPE *pxOriginalTOS;\r
\r
+ pxOriginalTOS = pxTopOfStack;\r
\r
- *pxTopOfStack = (portSTACK_TYPE) ((_get_CPSR() & ~0xFF) | portINITIAL_SPSR);\r
+ /* Setup the initial stack of the task. The stack is set exactly as\r
+ expected by the portRESTORE_CONTEXT() macro. */\r
\r
- if (((unsigned long) pxCode & 0x01UL) != 0x00)\r
- {\r
- *pxTopOfStack |= portTHUMB_MODE_BIT;\r
- }\r
+ /* First on the stack is the return address - which is the start of the as\r
+ the task has not executed yet. The offset is added to make the return\r
+ address appear as it would within an IRQ ISR. */\r
+ *pxTopOfStack = ( portSTACK_TYPE ) pxCode + portINSTRUCTION_SIZE;\r
+ pxTopOfStack--;\r
\r
- return pxTopOfStack;\r
-}\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; /* R14 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) pxOriginalTOS; /* Stack used when task starts goes in R13. */\r
+ pxTopOfStack--;\r
+\r
+ #ifdef portPRELOAD_TASK_REGISTERS\r
+ {\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x12121212; /* R12 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x11111111; /* R11 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x10101010; /* R10 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x09090909; /* R9 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x08080808; /* R8 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x07070707; /* R7 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x06060606; /* R6 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x05050505; /* R5 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x04040404; /* R4 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x03030303; /* R3 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x02020202; /* R2 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0x01010101; /* R1 */\r
+ pxTopOfStack--;\r
+ }\r
+ #else\r
+ {\r
+ pxTopOfStack -= portSPACE_BETWEEN_TOS_AND_PARAMETERS;\r
+ }\r
+ #endif\r
+\r
+ /* Function parameters are passed in R0. */\r
+ *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */\r
+ pxTopOfStack--;\r
+\r
+ /* The last thing onto the stack is the status register, which is set for\r
+ system mode, with interrupts enabled. */\r
+ *pxTopOfStack = ( portSTACK_TYPE ) ( ( _get_CPSR() & ~0xFF ) | portINITIAL_SPSR );\r
\r
+ if( ( ( unsigned long ) pxCode & 0x01UL ) != 0x00 )\r
+ {\r
+ /* The task will start in thumb mode. */\r
+ *pxTopOfStack |= portTHUMB_MODE_BIT;\r
+ }\r
\r
-/*----------------------------------------------------------------------------*/\r
-/* prvSetupTimerInterrupt */\r
+ return pxTopOfStack;\r
+}\r
+/*-----------------------------------------------------------*/\r
\r
static void prvSetupTimerInterrupt(void)\r
{\r
-#if (configGENERATE_RUN_TIME_STATS == 1)\r
- RTI->GCTRL &= ~0x00000001U;\r
-#else\r
- RTI->GCTRL = 0x00000000U;\r
-#endif\r
- RTI->TBCTRL = 0x00000000U;\r
- RTI->COMPCTRL = 0x00000000U;\r
- RTI->CNT[0U].UCx = 0x00000000U;\r
- RTI->CNT[0U].FRCx = 0x00000000U;\r
- RTI->CNT[0U].CPUCx = 0x00000001U;\r
- RTI->CMP[0U].COMPx = configCPU_CLOCK_HZ / 2 / configTICK_RATE_HZ;\r
- RTI->CMP[0U].UDCPx = configCPU_CLOCK_HZ / 2 / configTICK_RATE_HZ;\r
- RTI->INTFLAG = 0x0007000FU;\r
- RTI->CLEARINT = 0x00070F0FU;\r
- RTI->SETINT = 0x00000001U;\r
- RTI->GCTRL |= 0x00000001U;\r
-}\r
+ /* Disable timer 0. */\r
+ portRTI_GCTRL_REG &= 0xFFFFFFFEUL;\r
\r
+ /* Use the internal counter. */\r
+ portRTI_TBCTRL_REG = 0x00000000U;\r
\r
-/*----------------------------------------------------------------------------*/\r
-/* vPortStartFirstTask */\r
+ /* COMPSEL0 will use the RTIFRC0 counter. */\r
+ portRTI_COMPCTRL_REG = 0x00000000U;\r
\r
-/* vPortStartFirstSTask() is defined in portASM.asm */\r
-extern void vPortStartFirstTask(void);\r
+ /* Initialise the counter and the prescale counter registers. */\r
+ portRTI_CNT0_UC0_REG = 0x00000000U;\r
+ portRTI_CNT0_FRC0_REG = 0x00000000U;\r
\r
+ /* Set Prescalar for RTI clock. */\r
+ portRTI_CNT0_CPUC0_REG = 0x00000001U;\r
+ portRTI_CNT0_COMP0_REG = ( configCPU_CLOCK_HZ / 2 ) / configTICK_RATE_HZ;\r
+ portRTI_CNT0_UDCP0_REG = ( configCPU_CLOCK_HZ / 2 ) / configTICK_RATE_HZ;\r
\r
-/*----------------------------------------------------------------------------*/\r
-/* xPortStartScheduler */\r
+ /* Clear interrupts. */\r
+ portRTI_INTFLAG_REG = 0x0007000FU;\r
+ portRTI_CLEARINTENA_REG = 0x00070F0FU;\r
\r
+ /* Enable the compare 0 interrupt. */\r
+ portRTI_SETINTENA_REG = 0x00000001U;\r
+ portRTI_GCTRL_REG |= 0x00000001U;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * See header file for description.\r
+ */\r
portBASE_TYPE xPortStartScheduler(void)\r
{\r
/* Start the timer that generates the tick ISR. */\r
- prvSetupTimerInterrupt();\r
- /* Enable critical sections */\r
- ulCriticalNesting = 0;\r
+ prvSetupTimerInterrupt();\r
+\r
+ /* Reset the critical section nesting count read to execute the first task. */\r
+ ulCriticalNesting = 0;\r
+\r
/* Start the first task. This is done from portASM.asm as ARM mode must be\r
used. */\r
- vPortStartFirstTask(); \r
+ vPortStartFirstTask();\r
+\r
/* Should not get here! */\r
- return 0;\r
+ return pdFAIL;\r
}\r
+/*-----------------------------------------------------------*/\r
\r
-\r
-/*----------------------------------------------------------------------------*/\r
-/* vPortEndScheduler */\r
-\r
+/*\r
+ * See header file for description.\r
+ */\r
void vPortEndScheduler(void)\r
{\r
- /* It is unlikely that the ARM port will require this function as there\r
- is nothing to return to. If this is required - stop the tick ISR then\r
- return back to main. */\r
+ /* It is unlikely that the port will require this function as there\r
+ is nothing to return to. */\r
}\r
-\r
-\r
-/*----------------------------------------------------------------------------*/\r
-/* vNonPreemptiveTick / vPreemptiveTick */\r
+/*-----------------------------------------------------------*/\r
\r
#if configUSE_PREEMPTION == 0\r
\r
- /* The cooperative scheduler requires a normal IRQ service routine to \r
+ /* The cooperative scheduler requires a normal IRQ service routine to\r
* simply increment the system tick. */\r
- __interrupt void vNonPreemptiveTick( void ) \r
+ __interrupt void vPortNonPreemptiveTick( void )\r
{\r
- /* clear clock interrupt flag */\r
- RTI->INTFLAG = 0x00000001;\r
+ /* clear clock interrupt flag */\r
+ RTI->INTFLAG = 0x00000001;\r
\r
/* Increment the tick count - this may make a delaying task ready\r
- to run - but a context switch is not performed. */ \r
+ to run - but a context switch is not performed. */\r
vTaskIncrementTick();\r
}\r
\r
\r
/*\r
**************************************************************************\r
- * The preemptive scheduler ISR is written in assembler and can be found \r
+ * The preemptive scheduler ISR is written in assembler and can be found\r
* in the portASM.asm file. This will only get used if portUSE_PREEMPTION\r
* is set to 1 in portmacro.h\r
- ************************************************************************** \r
+ **************************************************************************\r
*/\r
- void vPreemptiveTick(void);\r
+ void vPortPreemptiveTick( void );\r
\r
#endif\r
+/*-----------------------------------------------------------*/\r
\r
\r
-\r
-/*----------------------------------------------------------------------------*/\r
-/* vPortEnterCritical */\r
-\r
-void vPortEnterCritical(void)\r
+/*\r
+ * Disable interrupts, and keep a count of the nesting depth.\r
+ */\r
+void vPortEnterCritical( void )\r
{\r
/* Disable interrupts as per portDISABLE_INTERRUPTS(); */\r
- portDISABLE_INTERRUPTS();\r
- /* Now interrupts are disabled ulCriticalNesting can be accessed \r
+ portDISABLE_INTERRUPTS();\r
+\r
+ /* Now interrupts are disabled ulCriticalNesting can be accessed\r
directly. Increment ulCriticalNesting to keep a count of how many times\r
portENTER_CRITICAL() has been called. */\r
- ulCriticalNesting++;\r
+ ulCriticalNesting++;\r
}\r
+/*-----------------------------------------------------------*/\r
\r
-\r
-/*----------------------------------------------------------------------------*/\r
-/* vPortExitCritical */\r
-\r
-void vPortExitCritical(void)\r
+/*\r
+ * Decrement the critical nesting count, and if it has reached zero, re-enable\r
+ * interrupts.\r
+ */\r
+void vPortExitCritical( void )\r
{\r
- if(ulCriticalNesting > 0)\r
- {\r
+ if( ulCriticalNesting > 0 )\r
+ {\r
/* Decrement the nesting count as we are leaving a critical section. */\r
- ulCriticalNesting--;\r
+ ulCriticalNesting--;\r
\r
- /* If the nesting level has reached zero then interrupts should be \r
- re-enabled. */\r
- if(ulCriticalNesting == 0)\r
- {\r
+ /* If the nesting level has reached zero then interrupts should be\r
+ re-enabled. */\r
+ if( ulCriticalNesting == 0 )\r
+ {\r
/* Enable interrupts as per portENABLE_INTERRUPTS(). */\r
- portENABLE_INTERRUPTS();\r
- }\r
- }\r
+ portENABLE_INTERRUPTS();\r
+ }\r
+ }\r
}\r
+/*-----------------------------------------------------------*/\r
\r
-/*----------------------------------------------------------------------------*/\r
;-------------------------------------------------------------------------------\r
; Preemptive Tick\r
\r
- .def vPreemptiveTick\r
+ .def vPortPreemptiveTick\r
.ref vTaskIncrementTick\r
\r
-vPreemptiveTick\r
+vPortPreemptiveTick\r
portSAVE_CONTEXT\r
; clear interrupt flag\r
movw r0, #0xFC88\r
the SafeRTOS brand: http://www.SafeRTOS.com.\r
*/\r
\r
-#ifndef __OS_PORTMACRO_H__\r
-#define __OS_PORTMACRO_H__\r
-\r
-\r
-/*----------------------------------------------------------------------------*/\r
-/* RTI Register Frame Definition */\r
-\r
-struct rti\r
-{\r
- unsigned GCTRL;\r
- unsigned TBCTRL;\r
- unsigned CAPCTRL;\r
- unsigned COMPCTRL;\r
- struct\r
- {\r
- unsigned FRCx;\r
- unsigned UCx;\r
- unsigned CPUCx;\r
- unsigned : 32;\r
- unsigned CAFRCx;\r
- unsigned CAUCx;\r
- unsigned : 32;\r
- unsigned : 32;\r
- } CNT[2U];\r
- struct\r
- {\r
- unsigned COMPx;\r
- unsigned UDCPx;\r
- } CMP[4U];\r
- unsigned TBLCOMP;\r
- unsigned TBHCOMP;\r
- unsigned : 32;\r
- unsigned : 32;\r
- unsigned SETINT;\r
- unsigned CLEARINT;\r
- unsigned INTFLAG;\r
- unsigned : 32;\r
- unsigned DWDCTRL;\r
- unsigned DWDPRLD;\r
- unsigned WDSTATUS;\r
- unsigned WDKEY;\r
- unsigned WDCNTR;\r
-};\r
-\r
-#define RTI ((volatile struct rti *)0xFFFFFC00U)\r
-\r
-/*----------------------------------------------------------------------------*/\r
-/* Type Definitions */\r
-\r
+#ifndef __PORTMACRO_H__\r
+#define __PORTMACRO_H__\r
+\r
+/*-----------------------------------------------------------\r
+ * Port specific definitions.\r
+ *\r
+ * The settings in this file configure FreeRTOS correctly for the\r
+ * given hardware and compiler.\r
+ *\r
+ * These settings should not be altered.\r
+ *-----------------------------------------------------------\r
+ */\r
+\r
+/* Type definitions. */\r
#define portCHAR char\r
#define portFLOAT float\r
#define portDOUBLE double\r
#endif\r
\r
\r
-/*----------------------------------------------------------------------------*/\r
-/* Architecture Definitions */\r
-\r
+/* Architecture specifics. */\r
#define portSTACK_GROWTH (-1)\r
#define portTICK_RATE_MS ((portTickType) 1000 / configTICK_RATE_HZ) \r
#define portBYTE_ALIGNMENT 8\r
\r
-/*----------------------------------------------------------------------------*/\r
-/* External Functions */\r
-\r
+/* Critical section handling. */\r
extern void vPortEnterCritical(void);\r
extern void vPortExitCritical(void);\r
-\r
-/*----------------------------------------------------------------------------*/\r
-/* Functions Macros */\r
-\r
-#define portYIELD() _call_swi(0)\r
-#define portYIELD_WITHIN_API() { *(volatile unsigned *)0xFFFFFFB0 = 0x7500; *(volatile unsigned *)0xFFFFFFB0; }\r
-#define portYIELD_FROM_ISR() { *(volatile unsigned *)0xFFFFFFB0 = 0x7500; *(volatile unsigned *)0xFFFFFFB0; }\r
-#define portENTER_CRITICAL() vPortEnterCritical()\r
-#define portEXIT_CRITICAL() vPortExitCritical()\r
-#define portDISABLE_INTERRUPTS() asm(" CPSID I")\r
-#define portENABLE_INTERRUPTS() asm(" CPSIE I")\r
-\r
+#define portENTER_CRITICAL() vPortEnterCritical()\r
+#define portEXIT_CRITICAL() vPortExitCritical()\r
+#define portDISABLE_INTERRUPTS() asm( " CPSID I" )\r
+#define portENABLE_INTERRUPTS() asm( " CPSIE I" )\r
+\r
+/* Scheduler utilities. */\r
+#define portYIELD() _call_swi( 0 )\r
+#define portSYS_SSIR1_REG ( * ( ( volatile unsigned long * ) 0xFFFFFFB0 ) )\r
+#define portSYS_SSIR1_SSKEY ( 0x7500UL )\r
+#define portYIELD_WITHIN_API() { portSYS_SSIR1_REG = portSYS_SSIR1_SSKEY; ( void ) portSYS_SSIR1_REG; }\r
+#define portYIELD_FROM_ISR() { portSYS_SSIR1_REG = portSYS_SSIR1_SSKEY; ( void ) portSYS_SSIR1_REG; }\r
+\r
+/* Task function macros as described on the FreeRTOS.org WEB site. */\r
#define portTASK_FUNCTION(vFunction, pvParameters) void vFunction(void *pvParameters)\r
#define portTASK_FUNCTION_PROTO(vFunction, pvParameters) void vFunction(void *pvParameters)\r
\r
-#if (configGENERATE_RUN_TIME_STATS == 1)\r
-#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() \\r
-{ \\r
- RTI->GCTRL = 0x00000000U; \\r
- RTI->TBCTRL = 0x00000000U; \\r
- RTI->COMPCTRL = 0x00000000U; \\r
- RTI->CNT[1U].UCx = 0x00000000U; \\r
- RTI->CNT[1U].FRCx = 0x00000000U; \\r
- RTI->CNT[1U].CPUCx = (configCPU_CLOCK_HZ / 2 / configTICK_RATE_HZ) / 16; \\r
- RTI->CMP[1U].UDCPx = (configCPU_CLOCK_HZ / 2 / configTICK_RATE_HZ) / 16; \\r
- RTI->GCTRL = 0x00000002U; \\r
-}\r
-#define portGET_RUN_TIME_COUNTER_VALUE() (RTI->CNT[1].FRCx)\r
-#endif\r
-\r
-#endif\r
+#endif /* __PORTMACRO_H__ */\r
\r
-/*----------------------------------------------------------------------------*/\r
phantomInterrupt,\r
phantomInterrupt,\r
phantomInterrupt,\r
- vPreemptiveTick, /* RTI */\r
+ vPortPreemptiveTick, /* RTI */\r
phantomInterrupt,\r
phantomInterrupt,\r
phantomInterrupt,\r
\r
extern void phantomInterrupt(void);\r
extern void esmHighLevelInterrupt(void);\r
-extern void vPreemptiveTick(void);\r
-extern void vNonPreemptiveTick(void);\r
+extern void vPortPreemptiveTick(void);\r
+extern void vPortNonPreemptiveTick(void);\r
extern void vPortYeildWithinAPI(void);\r
\r
\r