Register reading for MCF 5282

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

Register reading for MCF 5282

926 Views
CHRamesh
Contributor I
hi,
 
Can anyone tell me, How to read the CPU space registers data(for e.g. VBR, FLASHBAR, RAMBAR, SR,....) of MCF5282.
I want to copy the register data to a variable.
I need the sample piece of code in C language for any one CPU Space registers
Labels (1)
0 Kudos
1 Reply

289 Views
RichTestardi
Senior Contributor II
I was under the impression CPU space was write-only.  The movec instruction says:
 
Description: Moves the contents of the general-purpose register to the specified control register. This transfer is always 32 bits even though the control register may be implemented with fewer bits. Note that the control registers are write only. The on-chip debug module can be used to read control registers. Note that this instruction synchronizes the pipeline.
 
You can remember every time you update a CPU space register (by shadowing the update to a static variable) and you can do that in C with a routine like this (which is resilient to whatever selected calling convention you are using):
 
static int
setvbr(uint32 x)
{
    asm {
        move  x,d0
        movec d0,vbr
    }
}
0 Kudos