8.12 Initialization Code Example
The following initialization code illustrates the steps that should be taken to initialize the processor
before an operating system
or
user programs begin execution. The example is presented in pseudo-
code; function calls are named similarly to PPC405GP mnemonics where appropriate.
~
~
1*
PPC405GP Initialization Pseudo Code */
~
~
@OxFFFFFFFC:'
1*
initial instruction fetch from OxFFFFFFFC */
ba(iniCcode);
1*
branch to initialization code */
@iniCcode:
1*------------------------------------------------------
1*
Configure guarded attribute for performance.
1*------------------------------------------------------
mtspr(SGR, guarded_attribute);
1*------------------------------------------------------
1*
Configure endianness and compression.
1*------------------------------------------------------
mtspr(SLER, endianness);
mtspr(SUOR, compression_attribute);
~
~
1*
Invalidate the instruction cache and enable cachability
*1
~
~
iccci;
1*
invalidate i-cache */
*1
*/
*1
*1
*/
*1
mtspr(lCCR, Lcache_cachability);
1*
enable I-cache*/
isync;
~
~
1*
Invalidate the data cache and enable cachability */
~ ~
address = 0;
for (line =
0;
line <m_lines; line++)
{
}
dccci(address);
address += 32;
mtspr(CCRO, store-miss_line-fill);
mtspr(DCWR, copy-back_write-thru);
mtspr(DCCR, d_cache_cachability);
isync;
/*
start
at
first line
1*
D-cache has m_lines congruence classes
1*
invalidate congruence class
/*
pOint to the next congruence class
1*
enable D-cache
1*------------------------------------------------------
1*
Prepare system for synchronous interrupts.
1*------------------------------------------------------
mtspr(EVPR, prefix_addr);
1*
initialize exception vector prefix
8-16
PPC405GP User's Manual
Preliminary
*/
*/
*/
*/
*/
*1
*/
*1
*/