Continue development of MSP430X port.

This commit is contained in:
Richard Barry 2010-12-28 18:40:12 +00:00
parent b20be831b7
commit e7e623f853
3 changed files with 21 additions and 24 deletions

View File

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

View File

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

View File

@ -90,16 +90,23 @@ vTickISR:
*/
vPortYield:
/* Mimic an interrupt by pushing the SR. */
push SR
/* Mimic an interrupt by combining the SR and the PC, the latter having
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. */
dint
dint
nop
/* Save the context of the current task. */
portSAVE_CONTEXT
/* Switch to the highest priority task that is ready to run. */
/* Select the next task to run. */
calla #vTaskSwitchContext
/* Restore the context of the new task. */