mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Make the timer used for the PIC32 port layer user configurable.
This commit is contained in:
parent
dbe0ae2bff
commit
f446f77fd4
|
@ -83,6 +83,10 @@
|
|||
the first task is being restored. */
|
||||
#define portINITIAL_SR ( portIE_BIT | portEXL_BIT )
|
||||
|
||||
#ifndef configTICK_INTERRUPT_VECTOR
|
||||
#define configTICK_INTERRUPT_VECTOR _TIMER_1_VECTOR
|
||||
#endif
|
||||
|
||||
/* Records the interrupt nesting depth. This starts at one as it will be
|
||||
decremented to 0 when the first task starts. */
|
||||
volatile unsigned portBASE_TYPE uxInterruptNesting = 0x01;
|
||||
|
@ -101,9 +105,9 @@ const portSTACK_TYPE * const xISRStackTop = &( xISRStack[ configISR_STACK_SIZE -
|
|||
* Place the prototype here to ensure the interrupt vector is correctly installed.
|
||||
* Note that because the interrupt is written in assembly, the IPL setting in the
|
||||
* following line of code has no effect. The interrupt priority is set by the
|
||||
* call to ConfigIntTimer1() in prvSetupTimerInterrupt().
|
||||
* call to ConfigIntTimer1() in vApplicationSetupTickTimerInterrupt().
|
||||
*/
|
||||
extern void __attribute__( (interrupt(ipl1), vector(_TIMER_1_VECTOR))) vT1InterruptHandler( void );
|
||||
extern void __attribute__( (interrupt(ipl1), vector( configTICK_INTERRUPT_VECTOR ))) vPortTickInterruptHandler( void );
|
||||
|
||||
/*
|
||||
* The software interrupt handler that performs the yield. Note that, because
|
||||
|
@ -152,9 +156,15 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Setup a timer for a regular tick.
|
||||
* Setup a timer for a regular tick. This function uses peripheral timer 1.
|
||||
* The function is declared weak so an application writer can use a different
|
||||
* timer by redefining this implementation. If a different timer is used then
|
||||
* configTICK_INTERRUPT_VECTOR must also be defined in FreeRTOSConfig.h to
|
||||
* ensure the RTOS provided tick interrupt handler is installed on the correct
|
||||
* vector number. When Timer 1 is used the vector number is defined as
|
||||
* _TIMER_1_VECTOR.
|
||||
*/
|
||||
void prvSetupTimerInterrupt( void )
|
||||
__attribute__(( weak )) void vApplicationSetupTickTimerInterrupt( void )
|
||||
{
|
||||
const unsigned long ulCompareMatch = ( (configPERIPHERAL_CLOCK_HZ / portTIMER_PRESCALE) / configTICK_RATE_HZ ) - 1;
|
||||
|
||||
|
@ -182,7 +192,7 @@ extern void *pxCurrentTCB;
|
|||
|
||||
/* Setup the timer to generate the tick. Interrupts will have been
|
||||
disabled by the time we get here. */
|
||||
prvSetupTimerInterrupt();
|
||||
vApplicationSetupTickTimerInterrupt();
|
||||
|
||||
/* Kick off the highest priority task that has been created so far.
|
||||
Its stack location is loaded into uxSavedTaskStackPointer. */
|
||||
|
|
|
@ -79,16 +79,16 @@
|
|||
|
||||
.global vPortStartFirstTask
|
||||
.global vPortYieldISR
|
||||
.global vT1InterruptHandler
|
||||
.global vPortTickInterruptHandler
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
.set noreorder
|
||||
.set noat
|
||||
.ent vT1InterruptHandler
|
||||
.ent vPortTickInterruptHandler
|
||||
|
||||
vT1InterruptHandler:
|
||||
vPortTickInterruptHandler:
|
||||
|
||||
portSAVE_CONTEXT
|
||||
|
||||
|
@ -97,7 +97,7 @@ vT1InterruptHandler:
|
|||
|
||||
portRESTORE_CONTEXT
|
||||
|
||||
.end vT1InterruptHandler
|
||||
.end vPortTickInterruptHandler
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
|
|
Loading…
Reference in a new issue