PiMagic777
Posts: 15
Joined: Mon Jun 05, 2017 12:48 pm

Correct irqNumber for DMA ch. 5

Thu Aug 31, 2017 7:34 pm

Not a pure bare metal question since I'm working with Raspbian. I also posted to C/C++, but maybe bare metal people have an idea how the IRQ number 21 for DMA Channel 5 might need to be modified to get the correct number needed by the linux function request_irq()...

I'm working on RPi 3, Raspbian 4.9.45-v7+. I'm using a Linux Kernel Module to create an ISR to service completed DMA transfer on DMA channel 5. In my LKM init function I try to use request_irq() to associate my ISR with DMA channel 5.
https://github.com/raspberrypi/linux/bl ... platform.h has::
#define ARM_IRQ1_BASE 0
#define INTERRUPT_dma5 (ARM_IRQ1_BASE + 21)
I use 21 for the irqNumber parameter of request_irq(), but the call to request_irq() fails when loading the LKM. I'm pretty certain that request_irq() fails because I'm giving it the wrong irqNumber. Errors in the kernel log start with my call to request_irq(). If I use a known gpio IRQ number for the irqNumber parameter I dont get errors, (but of course this would not map my ISR to the DMA channel 5 completed event).
Errors from kernel log are below. (Used sudo tail -f kern.log executed from /var/log to view kernel log).

How do I determine the correct irqNumber for DMA channel 5? Is there some kind of address mapping or offset which must be used to convert 21 to the correct value needed by request_irq()?

Thanks much for any suggestions or references

Kernel log errors:
Aug 31 18:59:36 raspberrypi kernel: [172046.185179] DMA_TEST: Initializing the DMA_TEST LKM
Aug 31 18:59:36 raspberrypi kernel: [172046.185199] DMA_TEST: button value is currently: 0
Aug 31 18:59:36 raspberrypi kernel: [172046.185205] DMA_TEST: DMA ISR mapped to IRQ: 21
Aug 31 18:59:36 raspberrypi kernel: [172046.185208] ------------[ cut here ]------------
Aug 31 18:59:36 raspberrypi kernel: [172046.185224] WARNING: CPU: 0 PID: 26398 at kernel/irq/manage.c:1666 request_threaded_irq+0x164/0x194
Aug 31 18:59:36 raspberrypi kernel: [172046.185226] Modules linked in: DMA_ISR_1(O+) binfmt_misc configs bnep hci_uart btbcm bluetooth brcmfmac brcmutil cfg80211 rfkill snd_bcm2835 snd_pcm snd_timer snd bcm2835_gpiomem evdev uio_pdrv_genirq fixed uio i2c_dev fuse ipv6 [last unloaded: gpio_test]
Aug 31 18:59:36 raspberrypi kernel: [172046.185282] CPU: 0 PID: 26398 Comm: insmod Tainted: G W O 4.9.45-v7+ #1031
Aug 31 18:59:36 raspberrypi kernel: [172046.185284] Hardware name: BCM2835
Aug 31 18:59:36 raspberrypi kernel: [172046.185301] [<8010fb3c>] (unwind_backtrace) from [<8010c058>] (show_stack+0x20/0x24)
Aug 31 18:59:36 raspberrypi kernel: [172046.185311] [<8010c058>] (show_stack) from [<80456104>] (dump_stack+0xd4/0x118)
Aug 31 18:59:36 raspberrypi kernel: [172046.185320] [<80456104>] (dump_stack) from [<8011d344>] (__warn+0xf8/0x110)
Aug 31 18:59:36 raspberrypi kernel: [172046.185328] [<8011d344>] (__warn) from [<8011d42c>] (warn_slowpath_null+0x30/0x38)
Aug 31 18:59:36 raspberrypi kernel: [172046.185335] [<8011d42c>] (warn_slowpath_null) from [<80176684>] (request_threaded_irq+0x164/0x194)
Aug 31 18:59:36 raspberrypi kernel: [172046.185349] [<80176684>] (request_threaded_irq) from [<7f09a0f4>] (erpi_dma_init+0xf4/0x114 [DMA_ISR_1])
Aug 31 18:59:36 raspberrypi kernel: [172046.185361] [<7f09a0f4>] (erpi_dma_init [DMA_ISR_1]) from [<80101bf0>] (do_one_initcall+0x50/0x184)
Aug 31 18:59:36 raspberrypi kernel: [172046.185369] [<80101bf0>] (do_one_initcall) from [<80209f68>] (do_init_module+0x74/0x1e4)
Aug 31 18:59:36 raspberrypi kernel: [172046.185381] [<80209f68>] (do_init_module) from [<801a3584>] (load_module+0x19cc/0x2108)
Aug 31 18:59:36 raspberrypi kernel: [172046.185391] [<801a3584>] (load_module) from [<801a3e9c>] (SyS_finit_module+0x9c/0xac)
Aug 31 18:59:36 raspberrypi kernel: [172046.185400] [<801a3e9c>] (SyS_finit_module) from [<801080c0>] (ret_fast_syscall+0x0/0x1c)
Aug 31 18:59:36 raspberrypi kernel: [172046.185416] ---[ end trace 8b51871527fb035d ]---
Aug 31 18:59:36 raspberrypi kernel: [172046.185419] DMA_TEST: IRQ request result is: -22

Return to “Bare metal”

Who is online

Users browsing this forum: No registered users and 3 guests