Please ensure to read the configuration and relevant port sections of the\r
online documentation.\r
\r
- http://www.FreeRTOS.org - Documentation, latest information, license and \r
+ http://www.FreeRTOS.org - Documentation, latest information, license and\r
contact details.\r
\r
- http://www.SafeRTOS.com - A version that is certified for use in safety \r
+ http://www.SafeRTOS.com - A version that is certified for use in safety\r
critical systems.\r
\r
- http://www.OpenRTOS.com - Commercial support, development, porting, \r
+ http://www.OpenRTOS.com - Commercial support, development, porting,\r
licensing and training services.\r
*/\r
\r
#define configIDLE_SHOULD_YIELD 0\r
#define configUSE_CO_ROUTINES 0\r
#define configUSE_MUTEXES 1\r
+#define configUSE_RECURSIVE_MUTEXES 1\r
#define configCHECK_FOR_STACK_OVERFLOW 2\r
\r
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )\r
/* Set the following definitions to 1 to include the API function, or zero\r
to exclude the API function. */\r
\r
-#define INCLUDE_vTaskPrioritySet 1\r
-#define INCLUDE_uxTaskPriorityGet 1\r
-#define INCLUDE_vTaskDelete 1\r
-#define INCLUDE_vTaskCleanUpResources 0\r
-#define INCLUDE_vTaskSuspend 1\r
-#define INCLUDE_vTaskDelayUntil 1\r
-#define INCLUDE_vTaskDelay 1\r
-\r
-\r
-#define configKERNEL_INTERRUPT_PRIORITY 255\r
+#define INCLUDE_vTaskPrioritySet 1\r
+#define INCLUDE_uxTaskPriorityGet 1\r
+#define INCLUDE_vTaskDelete 1\r
+#define INCLUDE_vTaskCleanUpResources 0\r
+#define INCLUDE_vTaskSuspend 1\r
+#define INCLUDE_vTaskDelayUntil 1\r
+#define INCLUDE_vTaskDelay 1\r
+#define INCLUDE_uxTaskGetStackHighWaterMark 1\r
+\r
+#define configKERNEL_INTERRUPT_PRIORITY 255\r
+#define configMAX_SYSCALL_INTERRUPT_PRIORITY 191 /* equivalent to 0xa0, or priority 5. */\r
\r
\r
#endif /* FREERTOS_CONFIG_H */\r
--- /dev/null
+/*\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
+\r
+ This file is part of the FreeRTOS.org distribution.\r
+\r
+ FreeRTOS.org is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU 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
+ FreeRTOS.org 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 General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with FreeRTOS.org; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+ A special exception to the GPL can be applied should you wish to distribute\r
+ a combined work that includes FreeRTOS.org, without being obliged to provide\r
+ the source code for any proprietary components. See the licensing section\r
+ of http://www.FreeRTOS.org for full details of how and when the exception\r
+ can be applied.\r
+\r
+ ***************************************************************************\r
+ ***************************************************************************\r
+ * *\r
+ * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *\r
+ * and even write all or part of your application on your behalf. *\r
+ * See http://www.OpenRTOS.com for details of the services we provide to *\r
+ * expedite your project. *\r
+ * *\r
+ ***************************************************************************\r
+ ***************************************************************************\r
+\r
+ Please ensure to read the configuration and relevant port sections of the\r
+ online documentation.\r
+\r
+ http://www.FreeRTOS.org - Documentation, latest information, license and \r
+ contact details.\r
+\r
+ http://www.SafeRTOS.com - A version that is certified for use in safety \r
+ critical systems.\r
+\r
+ http://www.OpenRTOS.com - Commercial support, development, porting, \r
+ licensing and training services.\r
+*/\r
+\r
+/* Scheduler includes. */\r
+#include "FreeRTOS.h"\r
+\r
+/* Demo includes. */\r
+#include "IntQueueTimer.h"\r
+#include "IntQueue.h"\r
+\r
+/* Library includes. */\r
+#include "hw_ints.h"\r
+#include "hw_memmap.h"\r
+#include "hw_types.h"\r
+#include "interrupt.h"\r
+#include "sysctl.h"\r
+#include "lmi_timer.h"\r
+\r
+#define tmrTIMER_2_FREQUENCY ( 2000UL )\r
+#define tmrTIMER_3_FREQUENCY ( 2001UL )\r
+\r
+void vInitialiseTimerForIntQueueTest( void )\r
+{\r
+unsigned long ulFrequency;\r
+\r
+ /* Timer 2 and 3 are utilised for this test. */\r
+ SysCtlPeripheralEnable( SYSCTL_PERIPH_TIMER2 );\r
+ SysCtlPeripheralEnable( SYSCTL_PERIPH_TIMER3 );\r
+ TimerConfigure( TIMER2_BASE, TIMER_CFG_32_BIT_PER );\r
+ TimerConfigure( TIMER3_BASE, TIMER_CFG_32_BIT_PER );\r
+ \r
+ /* Set the timer interrupts to be above the kernel. The interrupts are\r
+ assigned different priorities so they nest with each other. */\r
+ IntPrioritySet( INT_TIMER2A, configMAX_SYSCALL_INTERRUPT_PRIORITY - 1 );\r
+ IntPrioritySet( INT_TIMER3A, configMAX_SYSCALL_INTERRUPT_PRIORITY );\r
+\r
+ /* Ensure interrupts do not start until the scheduler is running. */\r
+ portDISABLE_INTERRUPTS();\r
+ \r
+ /* The rate at which the timers will interrupt. */\r
+ ulFrequency = configCPU_CLOCK_HZ / tmrTIMER_2_FREQUENCY; \r
+ TimerLoadSet( TIMER2_BASE, TIMER_A, ulFrequency );\r
+ IntEnable( INT_TIMER2A );\r
+ TimerIntEnable( TIMER2_BASE, TIMER_TIMA_TIMEOUT );\r
+\r
+ /* The rate at which the timers will interrupt. */\r
+ ulFrequency = configCPU_CLOCK_HZ / tmrTIMER_3_FREQUENCY; \r
+ TimerLoadSet( TIMER3_BASE, TIMER_A, ulFrequency );\r
+ IntEnable( INT_TIMER3A );\r
+ TimerIntEnable( TIMER3_BASE, TIMER_TIMA_TIMEOUT );\r
+\r
+ /* Enable both timers. */ \r
+ TimerEnable( TIMER2_BASE, TIMER_A );\r
+ TimerEnable( TIMER3_BASE, TIMER_A );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vT2InterruptHandler( void )\r
+{\r
+ TimerIntClear( TIMER2_BASE, TIMER_TIMA_TIMEOUT ); \r
+ portEND_SWITCHING_ISR( xFirstTimerHandler() );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vT3InterruptHandler( void )\r
+{\r
+ TimerIntClear( TIMER3_BASE, TIMER_TIMA_TIMEOUT );\r
+ portEND_SWITCHING_ISR( xSecondTimerHandler() );\r
+}\r
+\r
+\r
--- /dev/null
+/*\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
+\r
+ This file is part of the FreeRTOS.org distribution.\r
+\r
+ FreeRTOS.org is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU 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
+ FreeRTOS.org 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 General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with FreeRTOS.org; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+ A special exception to the GPL can be applied should you wish to distribute\r
+ a combined work that includes FreeRTOS.org, without being obliged to provide\r
+ the source code for any proprietary components. See the licensing section\r
+ of http://www.FreeRTOS.org for full details of how and when the exception\r
+ can be applied.\r
+\r
+ ***************************************************************************\r
+ ***************************************************************************\r
+ * *\r
+ * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *\r
+ * and even write all or part of your application on your behalf. *\r
+ * See http://www.OpenRTOS.com for details of the services we provide to *\r
+ * expedite your project. *\r
+ * *\r
+ ***************************************************************************\r
+ ***************************************************************************\r
+\r
+ Please ensure to read the configuration and relevant port sections of the\r
+ online documentation.\r
+\r
+ http://www.FreeRTOS.org - Documentation, latest information, license and \r
+ contact details.\r
+\r
+ http://www.SafeRTOS.com - A version that is certified for use in safety \r
+ critical systems.\r
+\r
+ http://www.OpenRTOS.com - Commercial support, development, porting, \r
+ licensing and training services.\r
+*/\r
+\r
+#ifndef INT_QUEUE_TIMER_H\r
+#define INT_QUEUE_TIMER_H\r
+\r
+void vInitialiseTimerForIntQueueTest( void );\r
+portBASE_TYPE xTimer0Handler( void );\r
+portBASE_TYPE xTimer1Handler( void );\r
+\r
+#endif\r
+\r
<option>\r
<name>CCOptStrategy</name>\r
<version>0</version>\r
- <state>0</state>\r
+ <state>1</state>\r
</option>\r
<option>\r
<name>CCOptLevelSlave</name>\r
</option>\r
<option>\r
<name>IlinkMapFile</name>\r
- <state>0</state>\r
+ <state>1</state>\r
</option>\r
<option>\r
<name>IlinkLogFile</name>\r
<file>\r
<name>$PROJ_DIR$\..\Common\Minimal\integer.c</name>\r
</file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\IntQueue.c</name>\r
+ </file>\r
+ <file>\r
+ <name>$PROJ_DIR$\IntQueueTimer.c</name>\r
+ </file>\r
<file>\r
<name>$PROJ_DIR$\main.c</name>\r
</file>\r
<file>\r
<name>$PROJ_DIR$\..\Common\Minimal\QPeek.c</name>\r
</file>\r
+ <file>\r
+ <name>$PROJ_DIR$\..\Common\Minimal\recmutex.c</name>\r
+ </file>\r
<file>\r
<name>$PROJ_DIR$\..\Common\Minimal\semtest.c</name>\r
</file>\r
Please ensure to read the configuration and relevant port sections of the\r
online documentation.\r
\r
- http://www.FreeRTOS.org - Documentation, latest information, license and \r
+ http://www.FreeRTOS.org - Documentation, latest information, license and\r
contact details.\r
\r
- http://www.SafeRTOS.com - A version that is certified for use in safety \r
+ http://www.SafeRTOS.com - A version that is certified for use in safety\r
critical systems.\r
\r
- http://www.OpenRTOS.com - Commercial support, development, porting, \r
+ http://www.OpenRTOS.com - Commercial support, development, porting,\r
licensing and training services.\r
*/\r
\r
\r
\r
\r
-/************************************************************************* \r
+/*************************************************************************\r
* Please ensure to read http://www.freertos.org/portlm3sx965.html\r
* which provides information on configuring and running this demo for the\r
* various Luminary Micro EKs.\r
*************************************************************************/\r
\r
-\r
+/* Set the following option to 1 to include the WEB server in the build. By\r
+default the WEB server is excluded to keep the compiled code size under the 32K\r
+limit imposed by the KickStart version of the IAR compiler. The graphics\r
+libraries take up a lot of ROM space, hence including the graphics libraries\r
+and the TCP/IP stack together cannot be accommodated with the 32K size limit. */\r
+#define mainINCLUDE_WEB_SERVER 0\r
\r
\r
/* Standard includes. */\r
#include "bitmap.h"\r
#include "GenQTest.h"\r
#include "QPeek.h"\r
+#include "recmutex.h"\r
+#include "IntQueue.h"\r
\r
/*-----------------------------------------------------------*/\r
\r
* Configures the high frequency timers - those used to measure the timing\r
* jitter while the real time kernel is executing.\r
*/\r
-extern void vSetupTimer( void );\r
+extern void vSetupHighFrequencyTimer( void );\r
\r
-/* \r
+/*\r
* Hook functions that can get called by the kernel.\r
*/\r
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed portCHAR *pcTaskName );\r
/*-----------------------------------------------------------*/\r
\r
\r
-/************************************************************************* \r
+/*************************************************************************\r
* Please ensure to read http://www.freertos.org/portlm3sx965.html\r
* which provides information on configuring and running this demo for the\r
* various Luminary Micro EKs.\r
are received via this queue. */\r
xOLEDQueue = xQueueCreate( mainOLED_QUEUE_SIZE, sizeof( xOLEDMessage ) );\r
\r
- /* Create the uIP task if running on a processor that includes a MAC and\r
- PHY. */\r
- if( SysCtlPeripheralPresent( SYSCTL_PERIPH_ETH ) )\r
- {\r
- xTaskCreate( vuIP_Task, ( signed portCHAR * ) "uIP", mainBASIC_WEB_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );\r
- }\r
-\r
/* Start the standard demo tasks. */\r
- vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
- vCreateBlockTimeTasks();\r
- vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
- vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );\r
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
- vStartQueuePeekTasks();\r
-\r
+ vStartInterruptQueueTasks();\r
+ vStartRecursiveMutexTasks(); \r
+ vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
+ vCreateBlockTimeTasks();\r
+ vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
+ vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
+ vStartQueuePeekTasks(); \r
+\r
+ /* Exclude some tasks if using the kickstart version to ensure we stay within\r
+ the 32K code size limit. */\r
+ #if mainINCLUDE_WEB_SERVER != 0\r
+ {\r
+ /* Create the uIP task if running on a processor that includes a MAC and\r
+ PHY. */\r
+ if( SysCtlPeripheralPresent( SYSCTL_PERIPH_ETH ) )\r
+ {\r
+ xTaskCreate( vuIP_Task, ( signed portCHAR * ) "uIP", mainBASIC_WEB_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );\r
+ }\r
+ }\r
+ #endif\r
+ \r
+ \r
+ \r
/* Start the tasks defined within this file/specific to this demo. */\r
xTaskCreate( vOLEDTask, ( signed portCHAR * ) "OLED", mainOLED_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
\r
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
\r
/* Configure the high frequency interrupt used to measure the interrupt\r
- jitter time. The Keil port does not yet include the\r
- configKERNEL_INTERRUPT_PRIORITY functionality so cannot perform this test. */\r
- vSetupTimer();\r
- \r
+ jitter time. */\r
+ vSetupHighFrequencyTimer();\r
+\r
/* Start the scheduler. */\r
vTaskStartScheduler();\r
\r
{\r
xMessage.pcMessage = "ERROR IN GEN Q";\r
}\r
- else if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
+ else if( xIsCreateTaskStillRunning() != pdTRUE )\r
+ {\r
+ xMessage.pcMessage = "ERROR IN CREATE";\r
+ }\r
+ else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
+ {\r
+ xMessage.pcMessage = "ERROR IN MATH";\r
+ }\r
+ else if( xAreIntQueueTasksStillRunning() != pdTRUE )\r
{\r
- xMessage.pcMessage = "ERROR IN PEEK Q";\r
+ xMessage.pcMessage = "ERROR IN INT QUEUE";\r
}\r
else if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
{\r
{\r
xMessage.pcMessage = "ERROR IN BLOCK TIME";\r
}\r
- else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
- {\r
- xMessage.pcMessage = "ERROR IN SEMAPHORE";\r
- }\r
- else if( xArePollingQueuesStillRunning() != pdTRUE )\r
- {\r
- xMessage.pcMessage = "ERROR IN POLL Q";\r
- }\r
- else if( xIsCreateTaskStillRunning() != pdTRUE )\r
- {\r
- xMessage.pcMessage = "ERROR IN CREATE";\r
- }\r
- else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
- {\r
- xMessage.pcMessage = "ERROR IN MATH";\r
- }\r
- \r
+ else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
+ {\r
+ xMessage.pcMessage = "ERROR IN SEMAPHORE";\r
+ }\r
+ else if( xArePollingQueuesStillRunning() != pdTRUE )\r
+ {\r
+ xMessage.pcMessage = "ERROR IN POLL Q";\r
+ }\r
+ else if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
+ {\r
+ xMessage.pcMessage = "ERROR IN PEEK Q";\r
+ } \r
+ else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
+ {\r
+ xMessage.pcMessage = "ERROR IN REC MUTEX";\r
+ } \r
+ \r
/* Send the message to the OLED gatekeeper for display. */\r
xHigherPriorityTaskWoken = pdFALSE;\r
xQueueSendFromISR( xOLEDQueue, &xMessage, &xHigherPriorityTaskWoken );\r
unsigned portLONG ulY, ulMaxY;\r
static portCHAR cMessage[ mainMAX_MSG_LEN ];\r
extern volatile unsigned portLONG ulMaxJitter;\r
-const unsigned portCHAR *pucImage;\r
+unsigned portBASE_TYPE uxUnusedStackOnEntry, uxUnusedStackNow;\r
+const unsigned portCHAR *pucImage = NULL;\r
\r
/* Functions to access the OLED. The one used depends on the dev kit\r
being used. */\r
void ( *vOLEDImageDraw )( const unsigned portCHAR *, unsigned portLONG, unsigned portLONG, unsigned portLONG, unsigned portLONG ) = NULL;\r
void ( *vOLEDClear )( void ) = NULL;\r
\r
+ /* Just for demo purposes. */\r
+ uxUnusedStackOnEntry = uxTaskGetStackHighWaterMark( NULL );\r
+\r
/* Map the OLED access functions to the driver functions that are appropriate\r
for the evaluation kit being used. */ \r
switch( HWREG( SYSCTL_DID1 ) & SYSCTL_DID1_PRTNO_MASK )\r
vOLEDImageDraw = OSRAM128x64x4ImageDraw;\r
vOLEDClear = OSRAM128x64x4Clear;\r
ulMaxY = mainMAX_ROWS_64;\r
- pucImage = pucBasicBitmap;\r
break;\r
\r
case SYSCTL_DID1_PRTNO_1968 : \r
vOLEDImageDraw = RIT128x96x4ImageDraw;\r
vOLEDClear = RIT128x96x4Clear;\r
ulMaxY = mainMAX_ROWS_96;\r
- pucImage = pucBasicBitmap;\r
break;\r
\r
default : vOLEDInit = vFormike128x128x16Init;\r
vOLEDImageDraw = vFormike128x128x16ImageDraw;\r
vOLEDClear = vFormike128x128x16Clear;\r
ulMaxY = mainMAX_ROWS_128;\r
- pucImage = pucGrLibBitmap;\r
- break;\r
- \r
+ break; \r
}\r
\r
ulY = ulMaxY;\r
/* Initialise the OLED and display a startup message. */\r
vOLEDInit( ulSSI_FREQUENCY ); \r
vOLEDStringDraw( "POWERED BY FreeRTOS", 0, 0, mainFULL_SCALE );\r
+\r
+ switch( HWREG( SYSCTL_DID1 ) & SYSCTL_DID1_PRTNO_MASK )\r
+ {\r
+ case SYSCTL_DID1_PRTNO_6965 : \r
+ case SYSCTL_DID1_PRTNO_2965 : \r
+ case SYSCTL_DID1_PRTNO_1968 : \r
+ case SYSCTL_DID1_PRTNO_8962 : pucImage = pucBasicBitmap;\r
+ break;\r
+ \r
+ default : pucImage = pucGrLibBitmap;\r
+ break; \r
+ }\r
+\r
vOLEDImageDraw( pucImage, 0, mainCHARACTER_HEIGHT + 1, bmpBITMAP_WIDTH, bmpBITMAP_HEIGHT );\r
\r
for( ;; )\r
extern void xPortPendSVHandler(void);\r
extern void xPortSysTickHandler(void);\r
extern void vPortSVCHandler(void);\r
+extern void vT2InterruptHandler( void );\r
+extern void vT3InterruptHandler( void );\r
extern void vEMAC_ISR( void );\r
extern Timer0IntHandler( void );\r
\r
//\r
//*****************************************************************************\r
#ifndef STACK_SIZE\r
-#define STACK_SIZE 64\r
+#define STACK_SIZE 120\r
#endif\r
static unsigned long pulStack[STACK_SIZE] @ ".noinit";\r
\r
IntDefaultHandler, // Timer 0 subtimer B\r
IntDefaultHandler, // Timer 1 subtimer A\r
IntDefaultHandler, // Timer 1 subtimer B\r
- IntDefaultHandler, // Timer 2 subtimer A\r
+ vT2InterruptHandler, // Timer 2 subtimer A\r
IntDefaultHandler, // Timer 2 subtimer B\r
IntDefaultHandler, // Analog Comparator 0\r
IntDefaultHandler, // Analog Comparator 1\r
IntDefaultHandler, // GPIO Port H\r
IntDefaultHandler, // UART2 Rx and Tx\r
IntDefaultHandler, // SSI1 Rx and Tx\r
- IntDefaultHandler, // Timer 3 subtimer A\r
+ vT3InterruptHandler, // Timer 3 subtimer A\r
IntDefaultHandler, // Timer 3 subtimer B\r
IntDefaultHandler, // I2C1 Master and Slave\r
IntDefaultHandler, // Quadrature Encoder 1\r
\r
/*-----------------------------------------------------------*/\r
\r
-void vSetupTimer( void )\r
+void vSetupHighFrequencyTimer( void )\r
{\r
unsigned long ulFrequency;\r
\r
\r
void Timer0IntHandler( void )\r
{\r
-unsigned portLONG ulDifference, ulCurrentCount;\r
+unsigned portLONG ulDifference;\r
+volatile unsigned portLONG ulCurrentCount;\r
static unsigned portLONG ulMaxDifference = 0, ulLastCount = 0;\r
\r
/* We use the timer 1 counter value to measure the clock cycles between\r