Init core register e200z7

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Init core register e200z7

Jump to solution
1,178 Views
mauriziogreco
Contributor III

Hi , 

has someone an example for the complete init of internal register e200z7?

I found in the AN4939.pdf initializzation for e200z4 core, but we are working on e200z7.

This is the sample for ez200z4 found into AN:


e_li r11, 0
e_li r12, 0
e_li r13, 0
e_li r14, 0
e_li r15, 0
e_li r16, 0
e_li r17, 0
e_li r18, 0
e_li r19, 0
e_li r20, 0
e_li r21, 0
e_li r22, 0
e_li r23, 0
e_li r24, 0
e_li r25, 0
e_li r26, 0
e_li r27, 0
e_li r28, 0
e_li r29, 0
e_li r30, 0
e_li r31, 0
# Init any other CPU register which might be stacked (before being used).
mtspr 1, r1 # XER
mtcrf 0xFF, r1
mtspr CTR, r1
mtspr SPRG0, r1
mtspr SPRG1, r1
mtspr SPRG2, r1
mtspr SPRG3, r1
mtspr SRR0, r1
mtspr SRR1, r1
mtspr CSRR0, r1
mtspr CSRR1, r1
mtspr MCSRR0, r1
mtspr MCSRR1, r1
mtspr DEAR, r1
mtspr IVPR, r1

mtspr USPRG0, r1
mtspr 62, r1 # ESR
mtspr 8,r31

but in the e200z7 there are many other register. I'm not expert about assembly set and I dont' find how init also SPRG4-SPRG9.

The simple extension 

mtspr SPRG4, r1
mtspr SPRG5, r1
mtspr SPRG6, r1
mtspr SPRG7, r1

mtspr SPRG8, r1

mtspr SPRG9, r1

doesn't works!!

Can you help me?

Thanks in advance for support.

Regards.

Tags (1)
1 Solution
956 Views
EAlepins
Contributor V

Hi,

All registers are listed in e200z7 Core Reference Manual. Taking for example e200z759n3 RM Rev 2 (Jan 2015), "Figure 1. e200z759n3 supervisor mode programmer’s model SPRs" at page 28 shows a nice list of all registers. Note that some of them are not accessible in User mode (User registers are listed 2 pages after).

Most of these registers are SPR (Special Purpose Registers) which can be written with:

mtspr YOUR_SPR_ID, r1

where YOUR_SPR_ID is either the SPR number (e.g. 272 for SPRG0) or a define/.equ assigned to the SPR number. The code you tried probably doesn't work simply because you haven't declared the SPRG4/5/etc. defines.

Etienne

View solution in original post

2 Replies
956 Views
mauriziogreco
Contributor III

Hi  Etienne, many thanks.

Now is all clear for me.

I'm using this code:

e_li r0, 0
e_li r1, 0
e_li r2, 0
e_li r3, 0
e_li r4, 0
e_li r5, 0
e_li r6, 0
e_li r7, 0
e_li r8, 0
e_li r9, 0
e_li r10, 0
e_li r11, 0
e_li r12, 0
e_li r13, 0
e_li r14, 0
e_li r15, 0
e_li r16, 0
e_li r17, 0
e_li r18, 0
e_li r19, 0
e_li r20, 0
e_li r21, 0
e_li r22, 0
e_li r23, 0
e_li r24, 0
e_li r25, 0
e_li r26, 0
e_li r27, 0
e_li r28, 0
e_li r29, 0
e_li r30, 0
e_li r31, 0

mtspr USPRG0, r1 # USPRG0
mtspr 284, r1 # TBL
mtspr 285, r1 # TBU
mtspr 1, r1 # XER
mtspr 8,r31 # LR
mtcrf 0xFF, r1
mtspr CTR, r1 # CTR


mtspr 272, r1 #SPRG0
mtspr 273, r1 #SPRG1
mtspr 274, r1 #SPRG2
mtspr 275, r1 #SPRG3
mtspr 276, r1 #SPRG4
mtspr 277, r1 #SPRG5
mtspr 278, r1 #SPRG6
mtspr 279, r1 #SPRG7
mtspr 604, r1 #SPRG8
mtspr 605, r1 #SPRG9

mtspr SRR0, r1
mtspr SRR1, r1

mtspr CSRR0, r1
mtspr CSRR1, r1

mtspr MCSRR0, r1
mtspr MCSRR1, r1

mtspr IVPR, r1
mtspr DEAR, r1
mtspr 62, r1 # ESR
mtspr 572, r1 # MCSR
mtspr 573, r1 # MSR
mtspr 22, r1 # DEC
mtspr 54, r1 # DECAR
mtspr 340, r1 # TCR
mtspr 336, r1 # TSR

and it works very well.

Thank you very much.

Maurizio

957 Views
EAlepins
Contributor V

Hi,

All registers are listed in e200z7 Core Reference Manual. Taking for example e200z759n3 RM Rev 2 (Jan 2015), "Figure 1. e200z759n3 supervisor mode programmer’s model SPRs" at page 28 shows a nice list of all registers. Note that some of them are not accessible in User mode (User registers are listed 2 pages after).

Most of these registers are SPR (Special Purpose Registers) which can be written with:

mtspr YOUR_SPR_ID, r1

where YOUR_SPR_ID is either the SPR number (e.g. 272 for SPRG0) or a define/.equ assigned to the SPR number. The code you tried probably doesn't work simply because you haven't declared the SPRG4/5/etc. defines.

Etienne