Texas Instruments TMS320C3x User Manual

Page 730

Advertising
background image

Boot-Loader Source Code Listing

C-7

TMS320C32 Boot Loader Source Code

label4 SUBI 2,AR6
CMPI 0,AR6 ; set flags
BN strobes ;*******; total # of mem reads = 32/R5
label5 CALLU read_m ; read memory once
DBU AR6,label5 ;****;

*================================================================================*
* Read and save IOSTRB, STRB0 & STRB1 (to be loaded at end of boot load)
*================================================================================*

strobes CALLU AR0
STI R1,*+AR7(4) ; IOSTRB ––> (DMA src)
CALLU AR0
STI R1,*+AR7(6) ; STRB0 ––> (DMA dst)
CALLU AR0
STI R1,*+AR7(8) ; STRB1 ––> (DMA cnt)

*================================================================================
* Process block size (# of bytes, half–words, or words after STRB cntrl)
*================================================================================*

block CALLU AR0 ; read boot memory cntrl word
LDI R1,R1 ; is this the last block ?
BNZ label2 ;*******; no, go around

LDI *+AR7(4),R0 ; (DMA src)
STI R0,*+AR7(60h) ; restore IOSTRB
LDI *+AR7(6),R0 ; (DMA dst)
STI R0,*+AR7(64h) ; restore STRB0
LDI *+AR7(8),R0 ; (DMA cnt)
STI R0,*+AR7(68h) ; restore STRB1
BU IR1 ;*******; branch to start of program

label2 LDI R1,RC ; setup transfer loop
SUBI 1,RC ; RC – 1 ––> RC

*================================================================================*
* Process block destination address, save start address of first block
*================================================================================*

CALLU AR0 ; read boot memory cntrl word
LDI R1,AR5 ; set dest addr ––> AR5
CMPI 0,IR0 ; look at EXEC start addr flag
LDINZ AR5,IR1 ; if –1, EXEC start addr ––> IR1
LDINZ 0,IR0 ; set EXEC start addr flag

*================================================================================*
* (For internal destination, this word should be 0 or 60h. The first case will
* result in 0 ––> DMA cntrl reg, in second case 0 ––> IOSTRB reg).
* Process block destination strobe control (sss...sss 0110 xx00)
*======================================== strb value ==== 00 – IOSTRB
* 01 – STRB0

Advertising