| ||||||||
Technical Support Support Resources Product Information | RTX51 TINY: SAVING AND RESTORING XDATA BANKING INFORMATIONInformation in this article applies to:
QUESTIONI am using the Keil PK51, RTX51 Tiny Version 2, and far memory to access 4 banks of SRAM. The XDATA Banking is configured in the XBANKING.A51 file. I need to save and restore the XDATA banking information when RTX51 Tiny performs a task switch. I'm using code banking (configured via L51_BANK.A51) and that works just fine with RTX51 Tiny. The XDATA Banking information should be just as easily saved. Can you point me in the right direction so that I can modify CONF_TNY.A51 myself? ANSWERYes. It is easy to add code to save and restore the XDATA banking details. You must modify the CONF_TNY.A51 and OS_CREATE.A51 files. You should add the XDATA banking save/restore code at the same location where the CODE_BANKING support is introduced via the IF (CODE_BANKING <> 0) directives. CONF_TNY.A51There are 2 occurrances of the code sequence that saves the bank information in CONF_TNY.A51. You should add the XDATA banking save/restore code to both. For example:
IF (CODE_BANKING <> 0)
PUSH ?B_CURRENTBANK
ENDIF
; *** Add code here to save the
; *** XDATA banking port value to the stack
The code to restore the XDATA banking port must be inserted in the following code sequence:
NoEvent: CLR ACC.B_RUN ; Clear RUN bit
XCH A,@R0
SETB EA
ANL A,#K_RUN
ORL AR7,A
; *** Add code here to restore the
; *** XDATA banking port value from the stack
IF (TIMESHARING <> 0)
IF (CODE_BANKING)
POP ACC
CALL ?B_RESTORE_BANK
ENDIF
CLR ?RTX_TS_DELAY
RET
OS_CREATE.A51You must modify the OS_CREATE.A51 source file to adjust the stack layout. There are several places where the stack is adjusted as shown below:
$IF (CODE_BANKING)
DEC R1
; *** Add a DEC R1 for each byte
; *** you save on the stack
$ENDIF
and
$IF (CODE_BANKING)
INC @R0
; *** Add an INC R1 for each byte
; *** you save on the stack
$ENDIF
You must add code to the following to select the default XDATA bank that is selected when the task starts.
$IF (CODE_BANKING)
EXTRN DATA (?B_CURRENTBANK)
INC R0
MOV A,?B_CURRENTBANK ; Set the initial code bank
MOV @R0,A
; *** Add code for each byte restored
; *** that selects the XDATA banking port
; INC R0
; MOV A,#0 ; default XDATA banking port
; MOV @R0,A
Last Reviewed: Tuesday, November 05, 2002 | |||||||
| ||||||||