Hi guys,

I tried to write a GPIO driver for my Beaglebone Black but I'm stuck at 
probing for interrupts. 

I have the next code for probing the interrupt:

static void 
kernel_probe_interrupt(void)
{
u8 count=0;
volatile u32 *memory_Ptr=NULL;
while(bbb_irq<0 && count<5){
unsigned long mask;
mask=probe_irq_on();
memory_Ptr=(u32*)(gpioreg_map(ioctl_buffer.gpio_group)|GPIO_IRQWAKEN_0);/*calculate
 
address of GPIO_IRQSTATUS_SET_0*/
*memory_Ptr=0xFFFFFFFF-ioctl_buffer.write_buffer;/*Enable interrupt. Value 
from write buffer will be 1<<PIN_NUMBER*/
wmb();
*memory_Ptr=ioctl_buffer.write_buffer;/*Enable interrupt. Value from write 
buffer will be 1<<PIN_NUMBER*/
wmb();
memory_Ptr=(u32*)(gpioreg_map(ioctl_buffer.gpio_group)|GPIO_IRQWAKEN_1);/*calculate
 
address of GPIO_IRQSTATUS_SET_0*/
*memory_Ptr=0xFFFFFFFF-ioctl_buffer.write_buffer;/*Enable interrupt. Value 
from write buffer will be 1<<PIN_NUMBER*/
wmb();
*memory_Ptr=ioctl_buffer.write_buffer;/*Enable interrupt. Value from write 
buffer will be 1<<PIN_NUMBER*/
wmb();
// 
memory_Ptr=(u32*)(gpioreg_map(ioctl_buffer.gpio_group)|GPIO_IRQSTATUS_SET_0);/*calculate
 
address of GPIO_IRQSTATUS_SET_0*/
// *memory_Ptr=ioctl_buffer.write_buffer;/*Enable interrupt. Value from 
write buffer will be 1<<PIN_NUMBER*/
// wmb();
// 
memory_Ptr=(u32*)(gpioreg_map(ioctl_buffer.gpio_group)|GPIO_IRQSTATUS_SET_1);/*calculate
 
address of GPIO_IRQSTATUS_SET_1*/
// *memory_Ptr=ioctl_buffer.write_buffer;/*Enable interrupt. Value from 
write buffer will be 1<<PIN_NUMBER*/
// wmb();
udelay(5);/*wait some time*/
count++;
bbb_irq = probe_irq_off(mask);
if (bbb_irq == 0) { /* none of them? */
  printk( KERN_ERR,"%s: no irq reported by probe\n",DEVICE_NAME);
  bbb_irq=-1;
  }
  
}
if(bbb_irq==-1){
printk( KERN_ERR,"%s: no irq reported by probe after %d 
attempts\n",DEVICE_NAME,count);
}
}

The problem is that always probe_irq_off returns 0. Maybe I didn't 
understand the probe_irq_off function or the registers for GPIO interrupt. 
I tried to probe by setting a bit in GPIO_IRQWAKEN_0 & GPIO_IRQWAKEN_1, I 
also tried to set a bit in GPIO_IRQSTATUS_SET_0 and GPIO_IRQSTATUS_SET_1 
but everytime, probe_irq_off returns 0. Can someone help me? I just want to 
learn something. 

Almost forgot, ioctl_buffer.gpio_group is the address of GPIO group ( 
GPIO0, GPIO1, GPIO2, GPIO3) and gpioreg_map() returns the address for each 
group. ioctl_buffer.write_buffer stores the bit that I want to set.

Thanks a lot!

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to