Texas Instruments TMS320C3x User Manual

Page 731

Advertising
background image

Boot-Loader Source Code Listing

C-8

CALLU AR0 ; 10 – STRB1
LDI R1,R4
AND 6Ch,R1 ; dest mem strb pntr ––> AR4
OR3 AR7,R1,AR4

LSH –8,R4 ; dest memory strobe ––> R4

LDI R4,R3
LSH –16,R3
AND 3,R3 ; dest data size ––> R3
TSTB 0Ch,R1 ; (IOSTRB case)
LDIZ 3,R3

*================================================================================*
* Look at R5 and choose serial or memory read for block data/program
*================================================================================*

CMPI 0,R5
LDIEQ read_s0,AR1 ; read serial port0
LDINE read_mb,AR1 ; read memory

*================================================================================*
* Transfer one block of data or program
*================================================================================*

RPTB loop4
CALLU AR1 ; read data/prg
STI R4,*AR4 ; set write strobe
NOP ; pipeline
loop4 STI R1,*AR5++ ; write data/prg!!!!!!!!!!
BU block ;*******; process next block

*================================================================================*
* Load R5 with 0, load read_s0 to AR0 and initialize serial port_0
*================================================================================*

serial LDI read_s0,AR0 ; use serial to read cntrl words
LDI 0,R5 ; memory WIDTH = serial
LDI 0,R ; dummy
LDI AR7,AR2 ; dummy

LDI 111h,R0 ; 0000111h ––> R0
STI R0,*+AR7(43h) ; set CLKR,DR,FSR as serial
LDI 0A30h,R7 ; port pins
LSH 16,R7 ; A300000h ––> R7
STI R7,*+AR7(40h) ; set serial global cntrl reg
BU strobes ;*******; process first block

*================================================================================*
* Read a single value from serial or boot memory. The number of
* memory reads depends on mem WIDTH and data SIZE. R1 returns the
* read value. (Serial sim: NOP ––> BZ read_s0 & LDI @4000H,R1 ––> LDI
* *+AR7(4Ch),R1)
*================================================================================*

Advertising