Newbie question about accessing memory in kernel space

Roger Larsson roger.larsson at norran.net
Wed May 25 09:58:33 EST 2005


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)

>
> 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).

/RogerL



More information about the Linuxppc-embedded mailing list