Download Bootloaders - Pearsoncmg

Transcript
hall_150015_ch07.qxd
8/25/06
3:16 PM
Page 178
Chapter 7 • Bootloaders
178
/* 0x9C40 cycles
*/
/*--------------------------------------------------- */
addis
ori
mtctr
..spinlp:
bdnz
r3,0,0x0
r3,r3,0xA000 /* ensure 200usec have passed t */
r3
..spinlp
/* spin loop
*/
/*----------------------------------------------------*/
/* Now do the real work of this function
*/
/* Memory Bank 0 (Flash and SRAM) initialization
*/
/*----------------------------------------------------*/
addi
mtdcr
addis
ori
mtdcr
r4,0,pb0ap
ebccfga,r4
r4,0,EBC0_B0AP@h
r4,r4,EBC0_B0AP@l
ebccfgd,r4
addi
mtdcr
addis
ori
mtdcr
r4,0,pb0cr
ebccfga,r4
r4,0,EBC0_B0CR@h
r4,r4,EBC0_B0CR@l
ebccfgd,r4
/* *ebccfga = pb0ap;
/* *ebccfgd = EBC0_B0AP;
/* *ebccfga = pb0cr;
/* *ebccfgd = EBC0_B0CR;
*/
*/
*/
*/
/*----------------------------------------------------*/
/* Memory Bank 4 (NVRAM & BCSR) initialization
*/
/*----------------------------------------------------*/
addi
mtdcr
addis
ori
mtdcr
r4,0,pb4ap
ebccfga,r4
r4,0,EBC0_B4AP@h
r4,r4,EBC0_B4AP@l
ebccfgd,r4
addi
mtdcr
addis
ori
mtdcr
r4,0,pb4cr
ebccfga,r4
r4,0,EBC0_B4CR@h
r4,r4,EBC0_B4CR@l
ebccfgd,r4
blr
/* *ebccfga = pb4ap;
/* *ebccfgd = EBC0_B4AP;
/* *ebccfga = pb4cr;
/* *ebccfgd = EBC0_B4CR;
/* return
*/
*/
*/
*/
*/
The example in Listing 7-7 was chosen because it is typical of the subtle complexities involved in low-level processor initialization. It is important to realize the
context in which this code is running. It is executing from Flash, before any DRAM
is available. There is no stack. This code is preparing to make fundamental changes