Add in the configMAX_SYSCALL_INTERRUPT_PRIORITY test tasks.

pull/4/head
Richard Barry 17 years ago
parent 8b02e015ba
commit 512c86194f

@ -73,6 +73,7 @@
#define configIDLE_SHOULD_YIELD 0 #define configIDLE_SHOULD_YIELD 0
#define configUSE_CO_ROUTINES 0 #define configUSE_CO_ROUTINES 0
#define configUSE_MUTEXES 1 #define configUSE_MUTEXES 1
#define configUSE_RECURSIVE_MUTEXES 1
#define configCHECK_FOR_STACK_OVERFLOW 2 #define configCHECK_FOR_STACK_OVERFLOW 2
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) #define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )
@ -88,9 +89,10 @@ to exclude the API function. */
#define INCLUDE_vTaskSuspend 1 #define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1 #define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1 #define INCLUDE_vTaskDelay 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define configKERNEL_INTERRUPT_PRIORITY 255 #define configKERNEL_INTERRUPT_PRIORITY 255
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 191 /* equivalent to 0xa0, or priority 5. */
#endif /* FREERTOS_CONFIG_H */ #endif /* FREERTOS_CONFIG_H */

@ -0,0 +1,117 @@
/*
FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution.
FreeRTOS.org is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
FreeRTOS.org is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FreeRTOS.org; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
A special exception to the GPL can be applied should you wish to distribute
a combined work that includes FreeRTOS.org, without being obliged to provide
the source code for any proprietary components. See the licensing section
of http://www.FreeRTOS.org for full details of how and when the exception
can be applied.
***************************************************************************
***************************************************************************
* *
* SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *
* and even write all or part of your application on your behalf. *
* See http://www.OpenRTOS.com for details of the services we provide to *
* expedite your project. *
* *
***************************************************************************
***************************************************************************
Please ensure to read the configuration and relevant port sections of the
online documentation.
http://www.FreeRTOS.org - Documentation, latest information, license and
contact details.
http://www.SafeRTOS.com - A version that is certified for use in safety
critical systems.
http://www.OpenRTOS.com - Commercial support, development, porting,
licensing and training services.
*/
/* Scheduler includes. */
#include "FreeRTOS.h"
/* Demo includes. */
#include "IntQueueTimer.h"
#include "IntQueue.h"
/* Library includes. */
#include "hw_ints.h"
#include "hw_memmap.h"
#include "hw_types.h"
#include "interrupt.h"
#include "sysctl.h"
#include "lmi_timer.h"
#define tmrTIMER_2_FREQUENCY ( 2000UL )
#define tmrTIMER_3_FREQUENCY ( 2001UL )
void vInitialiseTimerForIntQueueTest( void )
{
unsigned long ulFrequency;
/* Timer 2 and 3 are utilised for this test. */
SysCtlPeripheralEnable( SYSCTL_PERIPH_TIMER2 );
SysCtlPeripheralEnable( SYSCTL_PERIPH_TIMER3 );
TimerConfigure( TIMER2_BASE, TIMER_CFG_32_BIT_PER );
TimerConfigure( TIMER3_BASE, TIMER_CFG_32_BIT_PER );
/* Set the timer interrupts to be above the kernel. The interrupts are
assigned different priorities so they nest with each other. */
IntPrioritySet( INT_TIMER2A, configMAX_SYSCALL_INTERRUPT_PRIORITY - 1 );
IntPrioritySet( INT_TIMER3A, configMAX_SYSCALL_INTERRUPT_PRIORITY );
/* Ensure interrupts do not start until the scheduler is running. */
portDISABLE_INTERRUPTS();
/* The rate at which the timers will interrupt. */
ulFrequency = configCPU_CLOCK_HZ / tmrTIMER_2_FREQUENCY;
TimerLoadSet( TIMER2_BASE, TIMER_A, ulFrequency );
IntEnable( INT_TIMER2A );
TimerIntEnable( TIMER2_BASE, TIMER_TIMA_TIMEOUT );
/* The rate at which the timers will interrupt. */
ulFrequency = configCPU_CLOCK_HZ / tmrTIMER_3_FREQUENCY;
TimerLoadSet( TIMER3_BASE, TIMER_A, ulFrequency );
IntEnable( INT_TIMER3A );
TimerIntEnable( TIMER3_BASE, TIMER_TIMA_TIMEOUT );
/* Enable both timers. */
TimerEnable( TIMER2_BASE, TIMER_A );
TimerEnable( TIMER3_BASE, TIMER_A );
}
/*-----------------------------------------------------------*/
void vT2InterruptHandler( void )
{
TimerIntClear( TIMER2_BASE, TIMER_TIMA_TIMEOUT );
portEND_SWITCHING_ISR( xFirstTimerHandler() );
}
/*-----------------------------------------------------------*/
void vT3InterruptHandler( void )
{
TimerIntClear( TIMER3_BASE, TIMER_TIMA_TIMEOUT );
portEND_SWITCHING_ISR( xSecondTimerHandler() );
}

@ -0,0 +1,58 @@
/*
FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution.
FreeRTOS.org is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
FreeRTOS.org is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FreeRTOS.org; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
A special exception to the GPL can be applied should you wish to distribute
a combined work that includes FreeRTOS.org, without being obliged to provide
the source code for any proprietary components. See the licensing section
of http://www.FreeRTOS.org for full details of how and when the exception
can be applied.
***************************************************************************
***************************************************************************
* *
* SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *
* and even write all or part of your application on your behalf. *
* See http://www.OpenRTOS.com for details of the services we provide to *
* expedite your project. *
* *
***************************************************************************
***************************************************************************
Please ensure to read the configuration and relevant port sections of the
online documentation.
http://www.FreeRTOS.org - Documentation, latest information, license and
contact details.
http://www.SafeRTOS.com - A version that is certified for use in safety
critical systems.
http://www.OpenRTOS.com - Commercial support, development, porting,
licensing and training services.
*/
#ifndef INT_QUEUE_TIMER_H
#define INT_QUEUE_TIMER_H
void vInitialiseTimerForIntQueueTest( void );
portBASE_TYPE xTimer0Handler( void );
portBASE_TYPE xTimer1Handler( void );
#endif

@ -306,7 +306,7 @@
<option> <option>
<name>CCOptStrategy</name> <name>CCOptStrategy</name>
<version>0</version> <version>0</version>
<state>0</state> <state>1</state>
</option> </option>
<option> <option>
<name>CCOptLevelSlave</name> <name>CCOptLevelSlave</name>
@ -588,7 +588,7 @@
</option> </option>
<option> <option>
<name>IlinkMapFile</name> <name>IlinkMapFile</name>
<state>0</state> <state>1</state>
</option> </option>
<option> <option>
<name>IlinkLogFile</name> <name>IlinkLogFile</name>
@ -791,6 +791,12 @@
<file> <file>
<name>$PROJ_DIR$\..\Common\Minimal\integer.c</name> <name>$PROJ_DIR$\..\Common\Minimal\integer.c</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\IntQueue.c</name>
</file>
<file>
<name>$PROJ_DIR$\IntQueueTimer.c</name>
</file>
<file> <file>
<name>$PROJ_DIR$\main.c</name> <name>$PROJ_DIR$\main.c</name>
</file> </file>
@ -803,6 +809,9 @@
<file> <file>
<name>$PROJ_DIR$\..\Common\Minimal\QPeek.c</name> <name>$PROJ_DIR$\..\Common\Minimal\QPeek.c</name>
</file> </file>
<file>
<name>$PROJ_DIR$\..\Common\Minimal\recmutex.c</name>
</file>
<file> <file>
<name>$PROJ_DIR$\..\Common\Minimal\semtest.c</name> <name>$PROJ_DIR$\..\Common\Minimal\semtest.c</name>
</file> </file>

@ -89,7 +89,12 @@
* various Luminary Micro EKs. * various Luminary Micro EKs.
*************************************************************************/ *************************************************************************/
/* Set the following option to 1 to include the WEB server in the build. By
default the WEB server is excluded to keep the compiled code size under the 32K
limit imposed by the KickStart version of the IAR compiler. The graphics
libraries take up a lot of ROM space, hence including the graphics libraries
and the TCP/IP stack together cannot be accommodated with the 32K size limit. */
#define mainINCLUDE_WEB_SERVER 0
/* Standard includes. */ /* Standard includes. */
@ -125,6 +130,8 @@
#include "bitmap.h" #include "bitmap.h"
#include "GenQTest.h" #include "GenQTest.h"
#include "QPeek.h" #include "QPeek.h"
#include "recmutex.h"
#include "IntQueue.h"
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -191,7 +198,7 @@ static void prvSetupHardware( void );
* Configures the high frequency timers - those used to measure the timing * Configures the high frequency timers - those used to measure the timing
* jitter while the real time kernel is executing. * jitter while the real time kernel is executing.
*/ */
extern void vSetupTimer( void ); extern void vSetupHighFrequencyTimer( void );
/* /*
* Hook functions that can get called by the kernel. * Hook functions that can get called by the kernel.
@ -224,21 +231,31 @@ int main( void )
are received via this queue. */ are received via this queue. */
xOLEDQueue = xQueueCreate( mainOLED_QUEUE_SIZE, sizeof( xOLEDMessage ) ); xOLEDQueue = xQueueCreate( mainOLED_QUEUE_SIZE, sizeof( xOLEDMessage ) );
/* Start the standard demo tasks. */
vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
vStartInterruptQueueTasks();
vStartRecursiveMutexTasks();
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
vCreateBlockTimeTasks();
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
vStartQueuePeekTasks();
/* Exclude some tasks if using the kickstart version to ensure we stay within
the 32K code size limit. */
#if mainINCLUDE_WEB_SERVER != 0
{
/* Create the uIP task if running on a processor that includes a MAC and /* Create the uIP task if running on a processor that includes a MAC and
PHY. */ PHY. */
if( SysCtlPeripheralPresent( SYSCTL_PERIPH_ETH ) ) if( SysCtlPeripheralPresent( SYSCTL_PERIPH_ETH ) )
{ {
xTaskCreate( vuIP_Task, ( signed portCHAR * ) "uIP", mainBASIC_WEB_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL ); xTaskCreate( vuIP_Task, ( signed portCHAR * ) "uIP", mainBASIC_WEB_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );
} }
}
#endif
/* Start the standard demo tasks. */
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
vCreateBlockTimeTasks();
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
vStartQueuePeekTasks();
/* Start the tasks defined within this file/specific to this demo. */ /* Start the tasks defined within this file/specific to this demo. */
xTaskCreate( vOLEDTask, ( signed portCHAR * ) "OLED", mainOLED_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); xTaskCreate( vOLEDTask, ( signed portCHAR * ) "OLED", mainOLED_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
@ -249,9 +266,8 @@ int main( void )
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
/* Configure the high frequency interrupt used to measure the interrupt /* Configure the high frequency interrupt used to measure the interrupt
jitter time. The Keil port does not yet include the jitter time. */
configKERNEL_INTERRUPT_PRIORITY functionality so cannot perform this test. */ vSetupHighFrequencyTimer();
vSetupTimer();
/* Start the scheduler. */ /* Start the scheduler. */
vTaskStartScheduler(); vTaskStartScheduler();
@ -303,9 +319,17 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
{ {
xMessage.pcMessage = "ERROR IN GEN Q"; xMessage.pcMessage = "ERROR IN GEN Q";
} }
else if( xAreQueuePeekTasksStillRunning() != pdTRUE ) else if( xIsCreateTaskStillRunning() != pdTRUE )
{ {
xMessage.pcMessage = "ERROR IN PEEK Q"; xMessage.pcMessage = "ERROR IN CREATE";
}
else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
{
xMessage.pcMessage = "ERROR IN MATH";
}
else if( xAreIntQueueTasksStillRunning() != pdTRUE )
{
xMessage.pcMessage = "ERROR IN INT QUEUE";
} }
else if( xAreBlockingQueuesStillRunning() != pdTRUE ) else if( xAreBlockingQueuesStillRunning() != pdTRUE )
{ {
@ -323,13 +347,13 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
{ {
xMessage.pcMessage = "ERROR IN POLL Q"; xMessage.pcMessage = "ERROR IN POLL Q";
} }
else if( xIsCreateTaskStillRunning() != pdTRUE ) else if( xAreQueuePeekTasksStillRunning() != pdTRUE )
{ {
xMessage.pcMessage = "ERROR IN CREATE"; xMessage.pcMessage = "ERROR IN PEEK Q";
} }
else if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
{ {
xMessage.pcMessage = "ERROR IN MATH"; xMessage.pcMessage = "ERROR IN REC MUTEX";
} }
/* Send the message to the OLED gatekeeper for display. */ /* Send the message to the OLED gatekeeper for display. */
@ -345,7 +369,8 @@ xOLEDMessage xMessage;
unsigned portLONG ulY, ulMaxY; unsigned portLONG ulY, ulMaxY;
static portCHAR cMessage[ mainMAX_MSG_LEN ]; static portCHAR cMessage[ mainMAX_MSG_LEN ];
extern volatile unsigned portLONG ulMaxJitter; extern volatile unsigned portLONG ulMaxJitter;
const unsigned portCHAR *pucImage; unsigned portBASE_TYPE uxUnusedStackOnEntry, uxUnusedStackNow;
const unsigned portCHAR *pucImage = NULL;
/* Functions to access the OLED. The one used depends on the dev kit /* Functions to access the OLED. The one used depends on the dev kit
being used. */ being used. */
@ -354,6 +379,9 @@ void ( *vOLEDStringDraw )( const portCHAR *, unsigned portLONG, unsigned portLON
void ( *vOLEDImageDraw )( const unsigned portCHAR *, unsigned portLONG, unsigned portLONG, unsigned portLONG, unsigned portLONG ) = NULL; void ( *vOLEDImageDraw )( const unsigned portCHAR *, unsigned portLONG, unsigned portLONG, unsigned portLONG, unsigned portLONG ) = NULL;
void ( *vOLEDClear )( void ) = NULL; void ( *vOLEDClear )( void ) = NULL;
/* Just for demo purposes. */
uxUnusedStackOnEntry = uxTaskGetStackHighWaterMark( NULL );
/* Map the OLED access functions to the driver functions that are appropriate /* Map the OLED access functions to the driver functions that are appropriate
for the evaluation kit being used. */ for the evaluation kit being used. */
switch( HWREG( SYSCTL_DID1 ) & SYSCTL_DID1_PRTNO_MASK ) switch( HWREG( SYSCTL_DID1 ) & SYSCTL_DID1_PRTNO_MASK )
@ -364,7 +392,6 @@ void ( *vOLEDClear )( void ) = NULL;
vOLEDImageDraw = OSRAM128x64x4ImageDraw; vOLEDImageDraw = OSRAM128x64x4ImageDraw;
vOLEDClear = OSRAM128x64x4Clear; vOLEDClear = OSRAM128x64x4Clear;
ulMaxY = mainMAX_ROWS_64; ulMaxY = mainMAX_ROWS_64;
pucImage = pucBasicBitmap;
break; break;
case SYSCTL_DID1_PRTNO_1968 : case SYSCTL_DID1_PRTNO_1968 :
@ -373,7 +400,6 @@ void ( *vOLEDClear )( void ) = NULL;
vOLEDImageDraw = RIT128x96x4ImageDraw; vOLEDImageDraw = RIT128x96x4ImageDraw;
vOLEDClear = RIT128x96x4Clear; vOLEDClear = RIT128x96x4Clear;
ulMaxY = mainMAX_ROWS_96; ulMaxY = mainMAX_ROWS_96;
pucImage = pucBasicBitmap;
break; break;
default : vOLEDInit = vFormike128x128x16Init; default : vOLEDInit = vFormike128x128x16Init;
@ -381,9 +407,7 @@ void ( *vOLEDClear )( void ) = NULL;
vOLEDImageDraw = vFormike128x128x16ImageDraw; vOLEDImageDraw = vFormike128x128x16ImageDraw;
vOLEDClear = vFormike128x128x16Clear; vOLEDClear = vFormike128x128x16Clear;
ulMaxY = mainMAX_ROWS_128; ulMaxY = mainMAX_ROWS_128;
pucImage = pucGrLibBitmap;
break; break;
} }
ulY = ulMaxY; ulY = ulMaxY;
@ -391,6 +415,19 @@ void ( *vOLEDClear )( void ) = NULL;
/* Initialise the OLED and display a startup message. */ /* Initialise the OLED and display a startup message. */
vOLEDInit( ulSSI_FREQUENCY ); vOLEDInit( ulSSI_FREQUENCY );
vOLEDStringDraw( "POWERED BY FreeRTOS", 0, 0, mainFULL_SCALE ); vOLEDStringDraw( "POWERED BY FreeRTOS", 0, 0, mainFULL_SCALE );
switch( HWREG( SYSCTL_DID1 ) & SYSCTL_DID1_PRTNO_MASK )
{
case SYSCTL_DID1_PRTNO_6965 :
case SYSCTL_DID1_PRTNO_2965 :
case SYSCTL_DID1_PRTNO_1968 :
case SYSCTL_DID1_PRTNO_8962 : pucImage = pucBasicBitmap;
break;
default : pucImage = pucGrLibBitmap;
break;
}
vOLEDImageDraw( pucImage, 0, mainCHARACTER_HEIGHT + 1, bmpBITMAP_WIDTH, bmpBITMAP_HEIGHT ); vOLEDImageDraw( pucImage, 0, mainCHARACTER_HEIGHT + 1, bmpBITMAP_WIDTH, bmpBITMAP_HEIGHT );
for( ;; ) for( ;; )

@ -58,6 +58,8 @@ extern void __iar_program_start(void);
extern void xPortPendSVHandler(void); extern void xPortPendSVHandler(void);
extern void xPortSysTickHandler(void); extern void xPortSysTickHandler(void);
extern void vPortSVCHandler(void); extern void vPortSVCHandler(void);
extern void vT2InterruptHandler( void );
extern void vT3InterruptHandler( void );
extern void vEMAC_ISR( void ); extern void vEMAC_ISR( void );
extern Timer0IntHandler( void ); extern Timer0IntHandler( void );
@ -67,7 +69,7 @@ extern Timer0IntHandler( void );
// //
//***************************************************************************** //*****************************************************************************
#ifndef STACK_SIZE #ifndef STACK_SIZE
#define STACK_SIZE 64 #define STACK_SIZE 120
#endif #endif
static unsigned long pulStack[STACK_SIZE] @ ".noinit"; static unsigned long pulStack[STACK_SIZE] @ ".noinit";
@ -134,7 +136,7 @@ __root const uVectorEntry __vector_table[] @ ".intvec" =
IntDefaultHandler, // Timer 0 subtimer B IntDefaultHandler, // Timer 0 subtimer B
IntDefaultHandler, // Timer 1 subtimer A IntDefaultHandler, // Timer 1 subtimer A
IntDefaultHandler, // Timer 1 subtimer B IntDefaultHandler, // Timer 1 subtimer B
IntDefaultHandler, // Timer 2 subtimer A vT2InterruptHandler, // Timer 2 subtimer A
IntDefaultHandler, // Timer 2 subtimer B IntDefaultHandler, // Timer 2 subtimer B
IntDefaultHandler, // Analog Comparator 0 IntDefaultHandler, // Analog Comparator 0
IntDefaultHandler, // Analog Comparator 1 IntDefaultHandler, // Analog Comparator 1
@ -146,7 +148,7 @@ __root const uVectorEntry __vector_table[] @ ".intvec" =
IntDefaultHandler, // GPIO Port H IntDefaultHandler, // GPIO Port H
IntDefaultHandler, // UART2 Rx and Tx IntDefaultHandler, // UART2 Rx and Tx
IntDefaultHandler, // SSI1 Rx and Tx IntDefaultHandler, // SSI1 Rx and Tx
IntDefaultHandler, // Timer 3 subtimer A vT3InterruptHandler, // Timer 3 subtimer A
IntDefaultHandler, // Timer 3 subtimer B IntDefaultHandler, // Timer 3 subtimer B
IntDefaultHandler, // I2C1 Master and Slave IntDefaultHandler, // I2C1 Master and Slave
IntDefaultHandler, // Quadrature Encoder 1 IntDefaultHandler, // Quadrature Encoder 1

@ -86,7 +86,7 @@ volatile unsigned portLONG ulMaxJitter = 0;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void vSetupTimer( void ) void vSetupHighFrequencyTimer( void )
{ {
unsigned long ulFrequency; unsigned long ulFrequency;
@ -120,7 +120,8 @@ unsigned long ulFrequency;
void Timer0IntHandler( void ) void Timer0IntHandler( void )
{ {
unsigned portLONG ulDifference, ulCurrentCount; unsigned portLONG ulDifference;
volatile unsigned portLONG ulCurrentCount;
static unsigned portLONG ulMaxDifference = 0, ulLastCount = 0; static unsigned portLONG ulMaxDifference = 0, ulLastCount = 0;
/* We use the timer 1 counter value to measure the clock cycles between /* We use the timer 1 counter value to measure the clock cycles between

Loading…
Cancel
Save