Tidy up the port layer for the MSP430X IAR port - still a work in progress.

This commit is contained in:
Richard Barry 2010-12-29 18:46:02 +00:00
parent 0a31276719
commit c7a110a853
2 changed files with 8 additions and 42 deletions

View file

@ -97,8 +97,6 @@ void vPortSetupTimerInterrupt( void );
*/
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
{
unsigned short usNibble;
unsigned long ulSP_PC_Combined;
unsigned short *pusTopOfStack;
/*
@ -113,30 +111,13 @@ unsigned short *pusTopOfStack;
pxTopOfStack--;
*/
/* The msp430x automatically pushes the PC then SR onto the stack before
executing an ISR. We want the stack to look just as if this has happened
so place a pointer to the start of the task on the stack first - followed
by the flags we want the task to use when it starts up. */
/* When placed on the stack, the top four bits of the status register
contain bits 19:16 of the 20 bit return address (pxCode). */
#ifdef GENERATE_ISR_STACK_FRAME
usNibble = ( unsigned short ) ( ( ( unsigned long ) pxCode >> 15UL ) & 0x0fUL );
ulSP_PC_Combined = ( unsigned long ) pxCode;
ulSP_PC_Combined <<= 16;
ulSP_PC_Combined |= ( usNibble << 12 );
ulSP_PC_Combined |= portFLAGS_INT_ENABLED;
*pxTopOfStack = ulSP_PC_Combined;
pxTopOfStack--;
#else
*pxTopOfStack = ( portSTACK_TYPE ) pxCode;
pusTopOfStack = ( unsigned short * ) pxTopOfStack;
pusTopOfStack--;
*pusTopOfStack = portFLAGS_INT_ENABLED;
pusTopOfStack -= 2;
pxTopOfStack = ( portSTACK_TYPE * ) pusTopOfStack;
#endif
/* Next the general purpose registers. */
*pxTopOfStack = ( portSTACK_TYPE ) 0xffffff;
pxTopOfStack--;
@ -154,12 +135,8 @@ unsigned short *pusTopOfStack;
pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x888888;
pxTopOfStack--;
/* When the task starts is will expect to find the function parameter in
R15. */
*pxTopOfStack = ( portSTACK_TYPE ) 0x555555;
pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x666666;
pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0x555555;