From 5872c16cbf5c67af8ad6ca582454130311c23d1c Mon Sep 17 00:00:00 2001 From: richardbarry Date: Fri, 25 Jul 2008 02:43:50 +0000 Subject: [PATCH] Add in the configMAX_SYSCALL_INTERRUPT_PRIORITY test tasks. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@420 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../RTOSDemo/.cproject | 8 +- .../CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/.project | 42 +++---- .../RTOSDemo/FreeRTOSConfig.h | 5 +- .../RTOSDemo/IntQueueTimer.c | 117 ++++++++++++++++++ .../RTOSDemo/IntQueueTimer.h | 58 +++++++++ .../CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/Makefile | 2 + Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/main.c | 70 ++++++----- .../RTOSDemo/startup.c | 8 +- .../RTOSDemo/timertest.c | 8 +- 9 files changed, 252 insertions(+), 66 deletions(-) create mode 100644 Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/IntQueueTimer.c create mode 100644 Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/IntQueueTimer.h diff --git a/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/.cproject b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/.cproject index f0306170d..83a1bf615 100644 --- a/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/.cproject +++ b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/.cproject @@ -27,22 +27,21 @@ - - - - @@ -220,6 +219,7 @@ + diff --git a/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/.project b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/.project index e635b964b..fc195c95e 100644 --- a/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/.project +++ b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/.project @@ -10,12 +10,8 @@ clean,full,incremental, - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.enableCleanBuild - true + ?children? + ?name?=outputEntries\|?children?=?name?=entry\\\\\\\\\\\\\\\|\\\\\\\|\|| ?name? @@ -26,48 +22,52 @@ true - org.eclipse.cdt.make.core.stopOnError - true + org.eclipse.cdt.make.core.autoBuildTarget + all - org.eclipse.cdt.make.core.buildCommand - cs-make + org.eclipse.cdt.make.core.buildArguments + - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings + org.eclipse.cdt.make.core.buildCommand + cs-make org.eclipse.cdt.make.core.buildLocation ${workspace_loc:/RTOSDemo} - org.eclipse.cdt.make.core.useDefaultBuildCmd - false + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings org.eclipse.cdt.make.core.enableAutoBuild false - org.eclipse.cdt.make.core.enableFullBuild + org.eclipse.cdt.make.core.enableCleanBuild true - org.eclipse.cdt.make.core.buildArguments - + org.eclipse.cdt.make.core.enableFullBuild + true org.eclipse.cdt.make.core.fullBuildTarget all - ?children? - ?name?=outputEntries\|?children?=?name?=entry\\\\\\\\\\\\\\\|\\\\\\\|\|| + org.eclipse.cdt.make.core.stopOnError + true - org.eclipse.cdt.make.core.autoBuildTarget - all + org.eclipse.cdt.make.core.useDefaultBuildCmd + false diff --git a/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/FreeRTOSConfig.h b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/FreeRTOSConfig.h index 5cca37256..190b7341c 100644 --- a/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/FreeRTOSConfig.h +++ b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/FreeRTOSConfig.h @@ -65,7 +65,7 @@ #define configUSE_TICK_HOOK 1 #define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 50000000 ) #define configTICK_RATE_HZ ( ( portTickType ) 1000 ) -#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 70 ) +#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 60 ) #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 24000 ) ) #define configMAX_TASK_NAME_LEN ( 12 ) #define configUSE_TRACE_FACILITY 1 @@ -94,7 +94,8 @@ to exclude the API function. */ -#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 */ diff --git a/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/IntQueueTimer.c b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/IntQueueTimer.c new file mode 100644 index 000000000..6c39bcd10 --- /dev/null +++ b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/IntQueueTimer.c @@ -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() ); +} + + diff --git a/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/IntQueueTimer.h b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/IntQueueTimer.h new file mode 100644 index 000000000..797e63030 --- /dev/null +++ b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/IntQueueTimer.h @@ -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 + diff --git a/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/Makefile b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/Makefile index bc37f9d1b..84c98d9e3 100644 --- a/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/Makefile +++ b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/Makefile @@ -73,6 +73,8 @@ SOURCE= main.c \ $(DEMO_COMMON_DIR)/GenQTest.c \ $(DEMO_COMMON_DIR)/QPeek.c \ $(DEMO_COMMON_DIR)/recmutex.c \ + $(DEMO_COMMON_DIR)/IntQueue.c \ + ./IntQueueTimer.c \ ./webserver/uIP_Task.c \ ./webserver/emac.c \ ./webserver/httpd.c \ diff --git a/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/main.c b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/main.c index bc4ae506d..acdc92f7e 100644 --- a/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/main.c +++ b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/main.c @@ -37,13 +37,13 @@ Please ensure to read the configuration and relevant port sections of the online documentation. - http://www.FreeRTOS.org - Documentation, latest information, license and + http://www.FreeRTOS.org - Documentation, latest information, license and contact details. - http://www.SafeRTOS.com - A version that is certified for use in safety + http://www.SafeRTOS.com - A version that is certified for use in safety critical systems. - http://www.OpenRTOS.com - Commercial support, development, porting, + http://www.OpenRTOS.com - Commercial support, development, porting, licensing and training services. */ @@ -70,10 +70,10 @@ * for messages - waking and displaying the messages as they arrive. * * "Check" hook - This only executes every five seconds from the tick hook. - * Its main function is to check that all the standard demo tasks are still - * operational. Should any unexpected behaviour within a demo task be discovered - * the tick hook will write an error to the OLED (via the OLED task). If all the - * demo tasks are executing with their expected behaviour then the check task + * Its main function is to check that all the standard demo tasks are still + * operational. Should any unexpected behaviour within a demo task be discovered + * the tick hook will write an error to the OLED (via the OLED task). If all the + * demo tasks are executing with their expected behaviour then the check task * writes PASS to the OLED (again via the OLED task), as described above. * * "uIP" task - This is the task that handles the uIP stack. All TCP/IP @@ -83,7 +83,7 @@ -/************************************************************************* +/************************************************************************* * Please ensure to read http://www.freertos.org/portLM3Sxxxx_Eclipse.html * which provides information on configuring and running this demo for the * various Luminary Micro EKs. @@ -126,7 +126,7 @@ #include "GenQTest.h" #include "QPeek.h" #include "recmutex.h" - +#include "IntQueue.h" /*-----------------------------------------------------------*/ @@ -193,7 +193,7 @@ static void prvSetupHardware( void ); * Configures the high frequency timers - those used to measure the timing * jitter while the real time kernel is executing. */ -extern void vSetupTimer( void ); +extern void vSetupHighFrequencyTimer( void ); /* * The idle hook is used to run a test of the scheduler context switch @@ -213,7 +213,7 @@ unsigned portLONG ulIdleError = pdFALSE; /*-----------------------------------------------------------*/ -/************************************************************************* +/************************************************************************* * Please ensure to read http://www.freertos.org/portLM3Sxxxx_Eclipse.html * which provides information on configuring and running this demo for the * various Luminary Micro EKs. @@ -226,7 +226,7 @@ int main( void ) are received via this queue. */ xOLEDQueue = xQueueCreate( mainOLED_QUEUE_SIZE, sizeof( xOLEDMessage ) ); - /* 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. */ if( SysCtlPeripheralPresent( SYSCTL_PERIPH_ETH ) ) { @@ -242,6 +242,7 @@ int main( void ) vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); vStartQueuePeekTasks(); vStartRecursiveMutexTasks(); + vStartInterruptQueueTasks(); /* Start the tasks defined within this file/specific to this demo. */ xTaskCreate( vOLEDTask, ( signed portCHAR * ) "OLED", mainOLED_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); @@ -253,8 +254,8 @@ int main( void ) /* Configure the high frequency interrupt used to measure the interrupt jitter time. */ - vSetupTimer(); - + vSetupHighFrequencyTimer(); + /* Start the scheduler. */ vTaskStartScheduler(); @@ -272,17 +273,17 @@ void prvSetupHardware( void ) { SysCtlLDOSet( SYSCTL_LDO_2_75V ); } - + /* Set the clocking to run from the PLL at 50 MHz */ SysCtlClockSet( SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ ); - + /* Enable Port F for Ethernet LEDs LED0 Bit 3 Output LED1 Bit 2 Output */ SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOF ); GPIODirModeSet( GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3), GPIO_DIR_MODE_HW ); - GPIOPadConfigSet( GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3 ), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD ); - + GPIOPadConfigSet( GPIO_PORTF_BASE, (GPIO_PIN_2 | GPIO_PIN_3 ), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD ); + vParTestInitialise(); } /*-----------------------------------------------------------*/ @@ -291,7 +292,7 @@ void vApplicationTickHook( void ) { static xOLEDMessage xMessage = { "PASS" }; static unsigned portLONG ulTicksSinceLastDisplay = 0; -static portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; +portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; /* Called from every tick interrupt. Have enough ticks passed to make it time to perform our health status check again? */ @@ -299,7 +300,7 @@ static portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; if( ulTicksSinceLastDisplay >= mainCHECK_DELAY ) { ulTicksSinceLastDisplay = 0; - + /* Has an error been found in any task? */ if( xAreGenericQueueTasksStillRunning() != pdTRUE ) { @@ -341,6 +342,11 @@ static portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; { xMessage.pcMessage = "ERROR IN HOOK"; } + else if( xAreIntQueueTasksStillRunning() != pdTRUE ) + { + xMessage.pcMessage = "ERROR IN INT QUEUE"; + } + /* Send the message to the OLED gatekeeper for display. */ xHigherPriorityTaskWoken = pdFALSE; @@ -354,7 +360,7 @@ void vOLEDTask( void *pvParameters ) xOLEDMessage xMessage; unsigned portLONG ulY, ulMaxY; static portCHAR cMessage[ mainMAX_MSG_LEN ]; -extern unsigned portLONG ulMaxJitter; +extern volatile unsigned portLONG ulMaxJitter; unsigned portBASE_TYPE uxUnusedStackOnEntry, uxUnusedStackNow; const unsigned portCHAR *pucImage; @@ -369,10 +375,10 @@ void ( *vOLEDClear )( void ) = NULL; uxUnusedStackOnEntry = uxTaskGetStackHighWaterMark( NULL ); /* 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 ) { - case SYSCTL_DID1_PRTNO_6965 : + case SYSCTL_DID1_PRTNO_6965 : case SYSCTL_DID1_PRTNO_2965 : vOLEDInit = OSRAM128x64x4Init; vOLEDStringDraw = OSRAM128x64x4StringDraw; vOLEDImageDraw = OSRAM128x64x4ImageDraw; @@ -380,8 +386,8 @@ void ( *vOLEDClear )( void ) = NULL; ulMaxY = mainMAX_ROWS_64; pucImage = pucBasicBitmap; break; - - case SYSCTL_DID1_PRTNO_1968 : + + case SYSCTL_DID1_PRTNO_1968 : case SYSCTL_DID1_PRTNO_8962 : vOLEDInit = RIT128x96x4Init; vOLEDStringDraw = RIT128x96x4StringDraw; vOLEDImageDraw = RIT128x96x4ImageDraw; @@ -389,7 +395,7 @@ void ( *vOLEDClear )( void ) = NULL; ulMaxY = mainMAX_ROWS_96; pucImage = pucBasicBitmap; break; - + default : vOLEDInit = vFormike128x128x16Init; vOLEDStringDraw = vFormike128x128x16StringDraw; vOLEDImageDraw = vFormike128x128x16ImageDraw; @@ -400,27 +406,27 @@ void ( *vOLEDClear )( void ) = NULL; } ulY = ulMaxY; - + /* Initialise the OLED and display a startup message. */ - vOLEDInit( ulSSI_FREQUENCY ); + vOLEDInit( ulSSI_FREQUENCY ); vOLEDStringDraw( "POWERED BY FreeRTOS", 0, 0, mainFULL_SCALE ); vOLEDImageDraw( pucImage, 0, mainCHARACTER_HEIGHT + 1, bmpBITMAP_WIDTH, bmpBITMAP_HEIGHT ); - + for( ;; ) { /* Wait for a message to arrive that requires displaying. */ xQueueReceive( xOLEDQueue, &xMessage, portMAX_DELAY ); - + /* Write the message on the next available row. */ ulY += mainCHARACTER_HEIGHT; if( ulY >= ulMaxY ) { ulY = mainCHARACTER_HEIGHT; vOLEDClear(); - vOLEDStringDraw( pcWelcomeMessage, 0, 0, mainFULL_SCALE ); + vOLEDStringDraw( pcWelcomeMessage, 0, 0, mainFULL_SCALE ); } - /* Display the message along with the maximum jitter time from the + /* Display the message along with the maximum jitter time from the high priority time test. */ sprintf( cMessage, "%s [%uns]", xMessage.pcMessage, ulMaxJitter * mainNS_PER_CLOCK ); vOLEDStringDraw( cMessage, 0, ulY, mainFULL_SCALE ); diff --git a/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/startup.c b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/startup.c index c01ae4d88..3a7420c8e 100644 --- a/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/startup.c +++ b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/startup.c @@ -45,6 +45,8 @@ extern void xPortPendSVHandler(void); extern void xPortSysTickHandler(void); extern void vPortSVCHandler( void ); extern void Timer0IntHandler( void ); +extern void vT2InterruptHandler( void ); +extern void vT3InterruptHandler( void ); extern void vEMAC_ISR(void); //***************************************************************************** @@ -53,7 +55,7 @@ extern void vEMAC_ISR(void); // //***************************************************************************** #ifndef STACK_SIZE -#define STACK_SIZE 64 +#define STACK_SIZE 120 #endif static unsigned long pulStack[STACK_SIZE]; @@ -107,7 +109,7 @@ void (* const g_pfnVectors[])(void) = IntDefaultHandler, // Timer 0 subtimer B IntDefaultHandler, // Timer 1 subtimer A IntDefaultHandler, // Timer 1 subtimer B - IntDefaultHandler, // Timer 2 subtimer A + vT2InterruptHandler, // Timer 2 subtimer A IntDefaultHandler, // Timer 2 subtimer B IntDefaultHandler, // Analog Comparator 0 IntDefaultHandler, // Analog Comparator 1 @@ -119,7 +121,7 @@ void (* const g_pfnVectors[])(void) = IntDefaultHandler, // GPIO Port H IntDefaultHandler, // UART2 Rx and Tx IntDefaultHandler, // SSI1 Rx and Tx - IntDefaultHandler, // Timer 3 subtimer A + vT3InterruptHandler, // Timer 3 subtimer A IntDefaultHandler, // Timer 3 subtimer B IntDefaultHandler, // I2C1 Master and Slave IntDefaultHandler, // Quadrature Encoder 1 diff --git a/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/timertest.c b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/timertest.c index 2f3a68b83..df636b7cf 100644 --- a/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/timertest.c +++ b/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/timertest.c @@ -85,7 +85,7 @@ volatile unsigned portLONG ulMaxJitter = 0; /*-----------------------------------------------------------*/ -void vSetupTimer( void ) +void vSetupHighFrequencyTimer( void ) { unsigned long ulFrequency; @@ -121,12 +121,14 @@ void Timer0IntHandler( void ) { unsigned portLONG ulDifference; volatile unsigned portLONG ulCurrentCount; -static 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 the timer 0 interrupts. */ ulCurrentCount = timerTIMER_1_COUNT_VALUE; + TimerIntClear( TIMER0_BASE, TIMER_TIMA_TIMEOUT ); + if( ulCurrentCount < ulLastCount ) { /* How many times has timer 1 counted since the last interrupt? */ @@ -141,8 +143,6 @@ static portLONG ulMaxDifference = 0, ulLastCount = 0; } ulLastCount = ulCurrentCount; - - TimerIntClear( TIMER0_BASE, TIMER_TIMA_TIMEOUT ); } -- 2.39.5