Monthly Archives: August 2015

VoCore OpenWrt Interrupts

We can get current activated interrupt list by cat /proc/interrupts

root@OpenWrt:/# cat /proc/interrupts
  5:        220      MIPS 5  10100000.ethernet
  6:     101471      MIPS 6  rt2800_wmac
  7:     117075      MIPS 7  timer
  9:          0      INTC 1  10000100.timer
 20:         30      INTC 12 serial
 25:          1      INTC 17 esw
 26:          1      INTC 18 ehci_hcd:usb1, ohci_hcd:usb2
ERR:          0

It is IRQ id/Count/Type/hardware IRQ id/dev_name(request_irq) from left to right. (Old linux version do not have IRQ hardware id)
From datasheet, we need IRQ10 for I2S. From the list, it is free, that is a good news, that means if we call request_irq, it will success.(I will try this in next blog, looks like openwrt is not using same way mapping interrupts as ralink sdk, have to read more openwrt base code)
If IRQ10 already be taken by other driver, that is a terrible IRQ conflict…

In path_to_linux/linux/include/interrupts.h, we can get request_irq define(might not same file in different linux version):
static inline int __must_check
request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
const char *name, void *dev)
return request_threaded_irq(irq, handler, NULL, flags, name, dev);

request_irq is easy to use, that means once the interrupt happens, the function in handle will be called.
So once we get data from I2S buffer or the data in I2S buffer is used out, the interrupt will be called and notify us to fill the buffer. We do not have to check the register in a loop, that makes the CPU relax.

In DMA mode, GDMA gets data from memory to I2S buffer once the interrupt is trigged, CPU does not have to deal the interrupt anymore, it has more free time to do other work, in another word, IO speed is great improved.

For more information, just search online about DMA and IRQ, there are many blogs explain how they work.

What next?
Request IRQ10 from system, and make a demo check if the interrupt are able to trigger once the I2S buffer is out.

PS: This blog is a challenge to my English. 😀