portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )\r
{\r
unsigned short usNibble;\r
-unsigned short *pus16BitPointer;\r
unsigned long ulSP_PC_Combined;\r
+unsigned short *pusTopOfStack;\r
\r
/*\r
Place a few bytes of known values on the bottom of the stack.\r
executing an ISR. We want the stack to look just as if this has happened\r
so place a pointer to the start of the task on the stack first - followed\r
by the flags we want the task to use when it starts up. */\r
-// pus16BitPointer = ( unsigned short * ) pxTopOfStack;\r
-// *pus16BitPointer = ( unsigned short ) pxCode;\r
-// pus16BitPointer--;\r
\r
/* When placed on the stack, the top four bits of the status register\r
contain bits 19:16 of the 20 bit return address (pxCode). */\r
+#ifdef GENERATE_ISR_STACK_FRAME\r
usNibble = ( unsigned short ) ( ( ( unsigned long ) pxCode >> 15UL ) & 0x0fUL );\r
-// *pus16BitPointer = ( usNibble | portFLAGS_INT_ENABLED );\r
-// pus16BitPointer--;\r
-\r
-// pxTopOfStack = ( portSTACK_TYPE * ) pus16BitPointer;\r
\r
ulSP_PC_Combined = ( unsigned long ) pxCode;\r
ulSP_PC_Combined <<= 16;\r
ulSP_PC_Combined |= portFLAGS_INT_ENABLED;\r
*pxTopOfStack = ulSP_PC_Combined;\r
pxTopOfStack--;\r
-\r
+#else\r
+ *pxTopOfStack = ( portSTACK_TYPE ) pxCode;\r
+ pusTopOfStack = ( unsigned short * ) pxTopOfStack;\r
+ pusTopOfStack--;\r
+ *pusTopOfStack = portFLAGS_INT_ENABLED;\r
+ pusTopOfStack -= 2;\r
+ pxTopOfStack = ( portSTACK_TYPE * ) pusTopOfStack;\r
+#endif\r
/* Next the general purpose registers. */\r
*pxTopOfStack = ( portSTACK_TYPE ) 0xffffff;\r
pxTopOfStack--;\r
}\r
/*-----------------------------------------------------------*/\r
\r
+#pragma vector=configTICK_INTERRUPT_VECTOR\r
+__interrupt void vISR( void )\r
+{\r
+extern void vTickISR( void );\r
+\r
+ vTickISR();\r
+}\r
\r
\r
/* The last thing on the stack will be the status register.\r
Ensure the power down bits are clear ready for the next\r
time this power down register is popped from the stack. */\r
- bic.w #0xf0, 0( SP )\r
-\r
- reti\r
+ bic.w #0xf0, 0( sp )\r
+ \r
+ pop.w sr\r
+ reta\r
endm\r
/*-----------------------------------------------------------*/\r
\r
EXPORT vTickISR\r
EXPORT vPortYield\r
EXPORT xPortStartScheduler\r
- \r
- RSEG CODE\r
+\r
\r
/*\r
* The RTOS tick ISR.\r
*\r
* If the preemptive scheduler is in use a context switch can also occur.\r
*/\r
+ RSEG ISR_CODE\r
vTickISR:\r
+ push.w sr\r
portSAVE_CONTEXT\r
\r
calla #vTaskIncrementTick\r
portRESTORE_CONTEXT\r
/*-----------------------------------------------------------*/\r
\r
+ RSEG CODE\r
\r
/*\r
* Manual context switch called by the portYIELD() macro.\r
\r
/* Mimic an interrupt by combining the SR and the PC, the latter having\r
already been pushed onto the stack. R14 is a scratch registers. */\r
- popx.a r14 /* r14 will hold the 20 bit PC. */\r
- push.w r14 /* Push just 16 bits of the 20bit PC back onto the stack. */\r
- rram.a #4, r14 /* Move the top 4 bits of the PC down ready to be combined with the SP. */\r
- and.w #0xf000, r14/* Ensure other bits are clear. */\r
- add.w sr, r14 /* Combine the top 4 bits of the PC with the SR. */\r
- push.w r14 /* Push the generated combined value onto the stack. */\r
-\r
+// popx.a r14 /* r14 will hold the 20 bit PC. */\r
+// push.w r14 /* Push just 16 bits of the 20bit PC back onto the stack. */\r
+// rram.a #4, r14 /* Move the top 4 bits of the PC down ready to be combined with the SP. */\r
+// and.w #0xf000, r14/* Ensure other bits are clear. */\r
+// add.w sr, r14 /* Combine the top 4 bits of the PC with the SR. */\r
+// push.w r14 /* Push the generated combined value onto the stack. */\r
+ push.w sr\r
/* Now the SR is stacked we can disable interrupts. */\r
dint \r
nop\r
/*-----------------------------------------------------------*/\r
\r
\r
- /* Install vTickISR as the timer A0 interrupt. */\r
- ASEG\r
- ORG 0xFFE0 + configTICK_INTERRUPT_VECTOR\r
+ /* Install vTickISR as the interrupt on the vector specified by the\r
+ application code. */\r
+ /*COMMON INTVEC *./\r
+ /*ORG 0xFF80 + configTICK_INTERRUPT_VECTOR\r
+ ORG 0xFFEC\r
\r
- _vTickISR_: DC16 vTickISR\r
+ __vTickISR__: DC16 0xabcd*/\r
\r
\r
END\r