Update port layers to make better use of the xTaskIncrementTick() return value.

This commit is contained in:
Richard Barry 2013-06-08 18:36:25 +00:00
parent c75c01ffdf
commit 62c0ae0926
9 changed files with 124 additions and 102 deletions

View file

@ -56,19 +56,19 @@
***************************************************************************
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
license and Real Time Engineers Ltd. contact details.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, and our new
fully thread aware and reentrant UDP/IP stack.
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
Integrity Systems, who sell the code with commercial support,
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
Integrity Systems, who sell the code with commercial support,
indemnification and middleware, under the OpenRTOS brand.
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability.
*/
@ -97,6 +97,12 @@ FreeRTOS.org V4.3.0. */
#define configKERNEL_INTERRUPT_PRIORITY 1
#endif
/* Use _T1Interrupt as the interrupt handler name if the application writer has
not provided their own. */
#ifndef configTICK_INTERRUPT_HANDLER
#define configTICK_INTERRUPT_HANDLER _T1Interrupt
#endif /* configTICK_INTERRUPT_HANDLER */
/* The program counter is only 23 bits. */
#define portUNUSED_PR_BITS 0x7f
@ -107,7 +113,7 @@ unsigned portBASE_TYPE uxCriticalNesting = 0xef;
#error If configKERNEL_INTERRUPT_PRIORITY is not 1 then the #32 in the following macros needs changing to equal the portINTERRUPT_BITS value, which is ( configKERNEL_INTERRUPT_PRIORITY << 5 )
#endif
#ifdef MPLAB_PIC24_PORT
#if defined( __PIC24E__ ) || defined ( __PIC24F__ ) || defined( __PIC24FK__ ) || defined( __PIC24H__ )
#ifdef __HAS_EDS__
#define portRESTORE_CONTEXT() \
@ -151,7 +157,7 @@ unsigned portBASE_TYPE uxCriticalNesting = 0xef;
#endif /* __HAS_EDS__ */
#endif /* MPLAB_PIC24_PORT */
#ifdef MPLAB_DSPIC_PORT
#if defined( __dsPIC30F__ ) || defined ( __dsPIC33E__ ) || defined( __dsPIC33F__ )
#define portRESTORE_CONTEXT() \
asm volatile( "MOV _pxCurrentTCB, W0 \n" /* Restore the stack pointer for the task. */ \
@ -185,10 +191,14 @@ unsigned portBASE_TYPE uxCriticalNesting = 0xef;
#endif /* MPLAB_DSPIC_PORT */
#ifndef portRESTORE_CONTEXT
#error Unrecognised device selected
#endif
/*
* Setup the timer used to generate the tick interrupt.
*/
static void prvSetupTimerInterrupt( void );
void vApplicationSetupTickTimerInterrupt( void );
/*
* See header file for description.
@ -196,7 +206,7 @@ static void prvSetupTimerInterrupt( void );
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
{
unsigned short usCode;
portBASE_TYPE i;
unsigned portBASE_TYPE i;
const portSTACK_TYPE xInitialStack[] =
{
@ -284,7 +294,7 @@ const portSTACK_TYPE xInitialStack[] =
portBASE_TYPE xPortStartScheduler( void )
{
/* Setup a timer for the tick ISR. */
prvSetupTimerInterrupt();
vApplicationSetupTickTimerInterrupt();
/* Restore the context of the first task to run. */
portRESTORE_CONTEXT();
@ -308,7 +318,7 @@ void vPortEndScheduler( void )
/*
* Setup a timer for a regular tick.
*/
static void prvSetupTimerInterrupt( void )
__attribute__(( weak )) void vApplicationSetupTickTimerInterrupt( void )
{
const unsigned long ulCompareMatch = ( ( configCPU_CLOCK_HZ / portTIMER_PRESCALE ) / configTICK_RATE_HZ ) - 1;
@ -353,7 +363,7 @@ void vPortExitCritical( void )
}
/*-----------------------------------------------------------*/
void __attribute__((__interrupt__, auto_psv)) _T1Interrupt( void )
void __attribute__((__interrupt__, auto_psv)) configTICK_INTERRUPT_HANDLER( void )
{
/* Clear the timer interrupt. */
IFS0bits.T1IF = 0;