summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2008-11-28 16:08:59 +0000
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2008-11-28 16:08:59 +0000
commitb107ffe10f9c4a1c7ecd5faf4ecd72cd5d3c82c6 (patch)
tree1b2f0c975c05f41f13397fd1467a67f9a65ee65e /Source
parent84a1038c3ec95b6a8b0292901abb5743b6a44fd3 (diff)
downloadfreertos-b107ffe10f9c4a1c7ecd5faf4ecd72cd5d3c82c6.tar.gz
freertos-b107ffe10f9c4a1c7ecd5faf4ecd72cd5d3c82c6.tar.bz2
freertos-b107ffe10f9c4a1c7ecd5faf4ecd72cd5d3c82c6.tar.xz
Continued work in progress on new demo.
git-svn-id: https://freertos.svn.sourceforge.net/svnroot/freertos/trunk@591 1d2547de-c912-0410-9cb9-b8ca96c0e9e2
Diffstat (limited to 'Source')
-rw-r--r--Source/portable/IAR/AtmelSAM9XE/port.c59
-rw-r--r--Source/portable/IAR/AtmelSAM9XE/portasm.s7924
2 files changed, 24 insertions, 59 deletions
diff --git a/Source/portable/IAR/AtmelSAM9XE/port.c b/Source/portable/IAR/AtmelSAM9XE/port.c
index 0004c97b..32eef0e7 100644
--- a/Source/portable/IAR/AtmelSAM9XE/port.c
+++ b/Source/portable/IAR/AtmelSAM9XE/port.c
@@ -91,6 +91,9 @@
/* Setup the PIT to generate the tick interrupts. */
static void prvSetupTimerInterrupt( void );
+/* The PIT interrupt handler - the RTOS tick. */
+static void vPortTickISR( void );
+
/* ulCriticalNesting will get set to zero when the first task starts. It
cannot be initialised to 0 as this will cause interrupts to be enabled
during the kernel initialisation process. */
@@ -189,34 +192,27 @@ void vPortEndScheduler( void )
}
/*-----------------------------------------------------------*/
-#if configUSE_PREEMPTION == 0
-
- /* The cooperative scheduler requires a normal IRQ service routine to
- simply increment the system tick. */
- static __arm __irq void vPortNonPreemptiveTick( void );
- static __arm __irq void vPortNonPreemptiveTick( void )
- {
- unsigned portLONG ulDummy;
-
- /* Increment the tick count - which may wake some tasks but as the
- preemptive scheduler is not being used any woken task is not given
- processor time no matter what its priority. */
- vTaskIncrementTick();
-
- /* Clear the PIT interrupt. */
- ulDummy = AT91C_BASE_PITC->PITC_PIVR;
+static __arm void vPortTickISR( void )
+{
+volatile unsigned portLONG ulDummy;
+
+ /* Increment the tick count - which may wake some tasks but as the
+ preemptive scheduler is not being used any woken task is not given
+ processor time no matter what its priority. */
+ vTaskIncrementTick();
+
+ #if configUSE_PREEMPTION == 0
+ vTaskSwitchContext();
+ #endif
- /* End the interrupt in the AIC. */
- AT91C_BASE_AIC->AIC_EOICR = ulDummy;
- }
-
-#else
-
- /* Currently the IAR port requires the preemptive tick function to be
- defined in an asm file. */
-
-#endif
-
+ /* Clear the PIT interrupt. */
+ ulDummy = AT91C_BASE_PITC->PITC_PIVR;
+
+ /* To remove compiler warning. */
+ ( void ) ulDummy;
+
+ /* The AIC is cleared in the asm wrapper, outside of this function. */
+}
/*-----------------------------------------------------------*/
static void prvSetupTimerInterrupt( void )
@@ -228,14 +224,7 @@ const unsigned portLONG ulPeriodIn_uS = ( 1 / configTICK_RATE_HZ ) * port1SECOND
/* Setup the PIT interrupt. */
AIC_DisableIT( AT91C_ID_SYS );
-
- #if configUSE_PREEMPTION == 0
- AIC_ConfigureIT( AT91C_ID_SYS, AT91C_AIC_PRIOR_LOWEST, vPortNonPreemptiveTick );
- #else
- extern void ( vPortPreemptiveTick )( void );
- AIC_ConfigureIT( AT91C_ID_SYS, AT91C_AIC_PRIOR_LOWEST, vPortPreemptiveTick );
- #endif
-
+ AIC_ConfigureIT( AT91C_ID_SYS, AT91C_AIC_PRIOR_LOWEST, vPortTickISR );
AIC_EnableIT( AT91C_ID_SYS );
PIT_EnableIT();
diff --git a/Source/portable/IAR/AtmelSAM9XE/portasm.s79 b/Source/portable/IAR/AtmelSAM9XE/portasm.s79
index da118fb5..d5ac7eba 100644
--- a/Source/portable/IAR/AtmelSAM9XE/portasm.s79
+++ b/Source/portable/IAR/AtmelSAM9XE/portasm.s79
@@ -2,10 +2,8 @@
CODE32
EXTERN vTaskSwitchContext
- EXTERN vTaskIncrementTick
PUBLIC vPortYieldProcessor
- PUBLIC vPortPreemptiveTick
PUBLIC vPortStartFirstTask
#include "ISR_Support.h"
@@ -31,28 +29,6 @@ vPortYieldProcessor:
BX R0
portRESTORE_CONTEXT ; Restore the context of the selected task.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; Preemptive context switch function. This will only ever get installed if
-; portUSE_PREEMPTION is set to 1 in portmacro.h.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-vPortPreemptiveTick:
- portSAVE_CONTEXT ; Save the context of the current task.
-
- LDR R0, =vTaskIncrementTick ; Increment the tick count - this may wake a task.
- mov lr, pc
- BX R0
- LDR R0, =vTaskSwitchContext ; Select the next task to execute.
- mov lr, pc
- BX R0
-#if 0
- LDR R14, =AT91C_BASE_PITC ; Clear the PIT interrupt
- LDR R0, [R14, #PITC_PIVR ]
-
- LDR R14, =AT91C_BASE_AIC ; Mark the End of Interrupt on the AIC
- STR R14, [R14, #AIC_EOICR]
-#endif
- portRESTORE_CONTEXT ; Restore the context of the selected task.
-
END