ts-7000
[Top] [All Lists]

[ts-7000] Re: TS-7400 DIO from kernel space

To:
Subject: [ts-7000] Re: TS-7400 DIO from kernel space
From: "basement_mobile2004" <>
Date: Fri, 14 Mar 2008 16:02:57 -0000
Hi Alexander,

   Digging books and tutorials I finally did it.
   0x1200_0000 is a reserved memory space and can't be accessed
directly. We have to remap that region to a random memory space area
via kernel functions to do so. I'll post the snippet of the code to do
that below:

#define GPIOCR 0x12000000UL

function()
{
        unsigned long gpiocr = 0, gpiocr1, gpiocr2, gpiocr3;

        volatile char *ptr;

        printk("DUMB: modulo adicionando\n");

        if(check_mem_region(GPIOCR, 4)) {
                printk("DUMB: espaco de memoria em uso: GPIOCR\n");
                return -EBUSY;
        }

        request_mem_region(GPIOCR, 4, "dumb_driver");
        ptr = __ioremap(GPIOCR, 4, 0);

        printk("dumb: ptr remap = %p\n", ptr);

#define GPIOCREG0       ((volatile char *)(ptr))
#define GPIOCREG1       ((volatile char *)(ptr+1))
#define GPIOCREG2       ((volatile char *)(ptr+2))
#define GPIOCREG3       ((volatile char *)(ptr+3))

        gpiocr = readb(GPIOCREG0);
        gpiocr1 = readb(GPIOCREG1);
        gpiocr2 = readb(GPIOCREG2);
        gpiocr3 = readb(GPIOCREG3);
        release_mem_region(GPIOCR, 4);
        printk("DUMB: lido CR 0x%lx 0x%lx 0x%lx 0x%lx\n", gpiocr,
gpiocr1, gpiocr2, gpiocr3);
...
}

       Hope that helps you.




--- In  Alexander Clouter <> wrote:
>
> Hi,
> 
> basement_mobile2004 <> [20080313 13:41:06 -0000]:
> >
> > I'm trying to access DIO registers from kernel space but it
> > redirects the address to upper addresses.
> >
> > [snipped]
> > 
> > Result:
> > Unable to handle kernel paging request at virtual address 72000000
> > pgd = c511c000
> > [72000000] *pgd=00000000, *pmd = 00000000
> >
> don't get excited, I'm curious about the answer to this too.  I have
no idea 
> about physical and virtual memory; however I would have expected the
macros
> __phys_to_virt() and __virt_to_phys() to have helped me.
> 
> Once I know this secret, the regular rtc-m48t86.c driver in the
linux kernel 
> will work along with (hopefully) the orion_nand.c MTD driver.
> 
> A plea to the Clued(tm) out there....pointers please.  :)
> 
> Cheers
> 
> Alex
> 
> -- 
>  ________________________________________
> / To err is human. To blame someone else \
> \ for your mistakes is even more human.  /
>  ----------------------------------------
>         \   ^__^
>          \  (oo)\_______
>             (__)\       )\/\
>                 ||----w |
>                 ||     ||
>



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU