All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] rt_misc_get_io_region()
@ 2006-12-12  7:38 Niklaus Burren
  2006-12-12 19:16 ` Niklaus Giger
  0 siblings, 1 reply; 2+ messages in thread
From: Niklaus Burren @ 2006-12-12  7:38 UTC (permalink / raw)
  To: xenomai

We want to write a Xenomai application that can access the
GPIO pins of our ARM-Prozessor (PXA-270). To get the memory
region I found the function rt_misc_get_io_region(). Unfortunately
there is no discription of this function in the API documentation.
Does this function work like request_mem_region()?

After the call of the rt_misc_get_io_region() fuction it is also 
necessary to call the ioremap() function?

Please can you give me a little example, how you can map and access 
memory in Xenomai?

I think that is a topic that is interessting for a lot of people.

Regards

Niklaus Burren


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Xenomai-help] rt_misc_get_io_region()
  2006-12-12  7:38 [Xenomai-help] rt_misc_get_io_region() Niklaus Burren
@ 2006-12-12 19:16 ` Niklaus Giger
  0 siblings, 0 replies; 2+ messages in thread
From: Niklaus Giger @ 2006-12-12 19:16 UTC (permalink / raw)
  To: xenomai

Am Dienstag, 12. Dezember 2006 08:38 schrieb Niklaus Burren:
> We want to write a Xenomai application that can access the
> GPIO pins of our ARM-Prozessor (PXA-270). To get the memory
> region I found the function rt_misc_get_io_region(). Unfortunately
> there is no discription of this function in the API documentation.
> Does this function work like request_mem_region()?
>
> After the call of the rt_misc_get_io_region() fuction it is also
> necessary to call the ioremap() function?
>
> Please can you give me a little example, how you can map and access
> memory in Xenomai?
I don't think that mapping memory very different for RT tasks. 

Here are the snippets from my code which I used (today!) to turn on and off 
LEDs connected to the GPIO-pins of my PPC405 based board.

#include <sys/mman.h>

#define MAP_SIZE 4096UL
void  *mapDirectIoRegister(char *addr, int nSize)
{
    void *map_base;
    off_t target = ((unsigned int) addr) & ~MAP_MASK;
    int fd;

    if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) {
        printf("/dev/mem could not be opened.\n");
        exit(1);
    }

  // Map one page
    map_base = mmap((void *)target, nSize, PROT_READ | PROT_WRITE, MAP_SHARED,
		 fd, target);
   <.. error handling>
   return map_base;
}
static uint32 *ledRegister;

<init proc>
    ledRegister = (uint32 *)mapDirectIoRegister((char *)GPIO_OR, 4);
    ledRegister[1] = 0x7ffe0000; /* Three State Control  (GPIO_TCR) */

void   sysLedSet(uint8 value)
{
    ledRegister[0] =  ((uint32) value)) << 23;
}

>
> I think that is a topic that is interessting for a lot of people.
>
> Regards
>
> Niklaus Burren
Best regards from another Swiss Chlaus.

-- 
Niklaus Giger
Wieshoschet 6
CH-8753 Mollis


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-12-12 19:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-12  7:38 [Xenomai-help] rt_misc_get_io_region() Niklaus Burren
2006-12-12 19:16 ` Niklaus Giger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.