Newbie question about accessing memory in kernel space
Niklaus Giger
niklaus.giger at member.fsf.org
Wed May 25 21:35:23 EST 2005
Am Mittwoch, 25. Mai 2005 01.58 schrieb Roger Larsson:
> On Tuesday 24 May 2005 21.19, Niklaus Giger wrote:
> > Hi
> >
> > I am working on a custom PPC405 board where I have a 2.6.10 kernel with
> > RTAI patches (fusion) running.
> >
> > I am trying to access some custom CPLD chip hanging at 0x7D000000. In my
> > intial board (hcu3_map_io) I added a corresponding io_block_mapping.
> >
> > I can see the CPLD when I access the address via my Abatron BDI debugger.
> >
> > In a user space test program I did a
> > map_base = mmap((void *)target, nSize, PROT_READ | PROT_WRITE,
> > MAP_SHARED, fd, target);
> > and was able to access the CPLD, too.
>
> Via 'map_base' I guess?
>
> For kernel try
> virt_base=ioremap(target, nSize)
Thanks this fixed my problem.
> > In user and kernel space the procedure looks like this:
> > void sys_set_tick_control_register_value(uint16 value)
> > {
> > static uint16 *tickControlRegister = (uint16*)
> > HCU_TICK_CONTROL_REGISTER_ADDRESS;
>
> This indicates that you tries to read directly from an adress (no
> virt_base?) You might want to use __raw_readl instead (depending on bus
> endianess).
__raw_readl was not necessary.
Thanks for your help.
Best regards
Niklaus
More information about the Linuxppc-embedded
mailing list