EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

interrupt handling using mmap

Started by prashant sangal July 8, 2009
Hello,
I am trying to use PIO IRQs of AT91SAM9260. I want to use mmap for this purpose. but i am getting seg fault while initializing the AIC.
Have anybody used this process?

With Thanks and Regards,
Prashant

Yahoo! recommends that you upgrade to the new and safer Internet Explorer 8. http://downloads.yahoo.com/in/internetexplorer/
On Wed, 8 Jul 2009 23:14:10 +0530 (IST)
prashant sangal wrote:
> I am trying to use PIO IRQs of AT91SAM9260. I want to use mmap for
> this purpose. but i am getting seg fault while initializing the AIC.
> Have anybody used this process?

I've accessed GPIO using mmap, haven't set up the interrupt controller
that way though. Can you verify that your mmap is allowing you to
access the registers for GPIO, or do some other benign access to the
registers in order to make sure that the mmap is working correctly?

If that works, then I'd guess that there are issues with how you're
mapping your interrupt routine. I haven't dug too much into how Linux
allocates program space on the ARM, but I'd think that with Linux
running on the machine as well it's not going to be as simple as
handing the address of a function off to the interrupt controller, and
you'll probably want to be writing a device driver.

Dan
Hello,
I've been using following code for GPIO access..

----
----
#define AT_BASE 0xFFFFF000
--
---
static void *piobase;
static unsigned int* base;
---
---
int main()
{
static int fd, pagesize;
int pattern;
pagesize = getpagesize();
fd = open("/dev/mem", O_RDWR);
piobase = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, AT_BASE);
base = (unsigned int *) piobase + 0x100;
--------
---------

}

I've collected it from some forum, and used it in my code. This is working well while i try to blink LEDs. but I don't understand why to use the these numbers (highlighted in pink). The first one (AT_BASE) is given as AIC address in memory map.
I understand that , if i get 0xFFFFF000 mapped to some location in RAM and add 0x100 to this then i'll get a link to 0xFFFFF400 ( that is 0XFFFFF000 + 4*0x100), but then i shud've got accesss to AIC without adding anything. but this is not the case.

This is becoming a riddle for me. Plzz help to solve it .

Regards,
Prashant
Love Cricket? Check out live scores, photos, video highlights and more. Click here http://cricket.yahoo.com

The 2024 Embedded Online Conference