Continue development of MSP430X port.

pull/4/head
Richard Barry 14 years ago
parent b20be831b7
commit e7e623f853

@ -143,7 +143,7 @@ unsigned long ulSP_PC_Combined;
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0xdddddd; *pxTopOfStack = ( portSTACK_TYPE ) 0xdddddd;
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0xcccccc; *pxTopOfStack = ( portSTACK_TYPE ) pvParameters;
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) 0xbbbbbb; *pxTopOfStack = ( portSTACK_TYPE ) 0xbbbbbb;
pxTopOfStack--; pxTopOfStack--;

@ -54,34 +54,24 @@
#ifndef PORTASM_H #ifndef PORTASM_H
#define PORTASM_H #define PORTASM_H
portSAVE_CONTEXT macro
IMPORT pxCurrentTCB IMPORT pxCurrentTCB
IMPORT usCriticalNesting IMPORT usCriticalNesting
portSAVE_CONTEXT macro
/* Save the remaining registers. */ /* Save the remaining registers. */
push r4 pushm.a #12, r15
push r5 movx.w &usCriticalNesting, r14
push r6 pushx.a r14
push r7 movx.a &pxCurrentTCB, r12
push r8 movx.a sp, 0( r12 )
push r9
push r10
push r11
push r12
push r13
push r14
push r15
mov.w &usCriticalNesting, r14
push r14
mov.w &pxCurrentTCB, r12
mov.w r1, 0(r12)
endm endm
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
portRESTORE_CONTEXT macro portRESTORE_CONTEXT macro
movx.a &pxCurrentTCB, r12 movx.a &pxCurrentTCB, r12
movx.a @r12, r1 movx.a @r12, sp
popx.a r15 popx.a r15
movx.w r15, &usCriticalNesting movx.w r15, &usCriticalNesting
popm.a #12, r15 popm.a #12, r15

@ -90,16 +90,23 @@ vTickISR:
*/ */
vPortYield: vPortYield:
/* Mimic an interrupt by pushing the SR. */ /* Mimic an interrupt by combining the SR and the PC, the latter having
push SR already been pushed onto the stack. R14 is a scratch registers. */
popx.a r14 /* r14 will hold the 20 bit PC. */
push.w r14 /* Push just 16 bits of the 20bit PC back onto the stack. */
rram.a #4, r14 /* Move the top 4 bits of the PC down ready to be combined with the SP. */
and.w #0xf000, r14/* Ensure other bits are clear. */
add.w sr, r14 /* Combine the top 4 bits of the PC with the SR. */
push.w r14 /* Push the generated combined value onto the stack. */
/* Now the SR is stacked we can disable interrupts. */ /* Now the SR is stacked we can disable interrupts. */
dint dint
nop
/* Save the context of the current task. */ /* Save the context of the current task. */
portSAVE_CONTEXT portSAVE_CONTEXT
/* Switch to the highest priority task that is ready to run. */ /* Select the next task to run. */
calla #vTaskSwitchContext calla #vTaskSwitchContext
/* Restore the context of the new task. */ /* Restore the context of the new task. */

Loading…
Cancel
Save