Welcome! Log In Create A New Profile


Accessing physical memory from module code

Posted by kernel_matze 
Accessing physical memory from module code
September 07, 2009 09:52AM
Hey there!

I have a PowerPC board which has status registers at location 0xF800 0000.

I need to read out and change these registers from my kernel module and wonder how to achive this.

I tried something like this:

    my_mem_reg = request_mem_region(BCSR_START, sizeof(struct bcsr), "blafasel"winking smiley;
    my_mem_map = ioremap(BCSR_START, sizeof(struct bcsr));

    int m;
    for (m=0; m<10; m++)
        printk(KERN_ALERT "%X: %02X\n",((unsigned int)my_mem_map)+m,ioread8(my_mem_map+m));


the code compiles and runs without error but does not bring the desired effect on the board, so maybe I am messing something up.

The board's registers are 8 bit in size and I especially need the one at 0xF800 0005 where some status LEDs can be set.

The thing is, I am totally new to this I want to try something where at first I can see the success: LED on or off :-)
Re: Accessing physical memory from module code
September 08, 2009 04:17AM
Ah, OK, forget it. It works as expected just the fu%&&$% bit order was wrong... arrgghh

Your Email:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 10 plus 15?