[Xiao Meige SoC] How to view the number of GPIO added on the FPGA side of the SoC FPGA system and use interrupts[Copy link]
Xiao Mei has been working hard to systematically organize the development methods of Intel SoC FPGA. (YY self-entertainment). Problem Description: I was stuck for several years because of the interrupt number problem. For the GPIO on the ARM side, there is a calculation formula to calculate the GPIO number corresponding to each pin. For the PIO added to the ARM on the FPGA side, the number of the PIO after adding it has always been a problem that bothered me. Because I am very new to Linux, I have never known how to solve it. Today, I finally found the answer on the official website. The following is the original content, I will not translate it. Finally, attach the source code of the key interrupt that can be directly experimented in our AC501-SoC system. It is pure English, you will understand it after translating it. Yes, you guessed it right. This is copied and pasted from my official website, not written by me. Application to register interrupt and write simple interrupt service routine ---------------------------------------------------------------------------- Detect user input from push button / DIP switch: modprobe gpio_interrupt gpio_number=
When user presses the button or flips the dip switch, a message will be printed to kernel console. 1. If the user connects to the console on board using serial connection, the message "Interrupt happened at gpio:" will be printed on the console. 2. If the user connects to the console on board using ssh, the message can be viewed from kernel log via "dmesg" command. Note: User will need to do "rmmod gpio_interrupt" prior in order to change gpio_number by calling "modprobe gpio_interrupt gpio_number=" again User will need to get the GPIO number from /sys/class/gpio/ by using command 'ls'. Eg root@socfpga~:# ls /sys/class/gpio/ gpiochip150 gpiochip152 gpiochip156 gpiochip160 gpiochip192 gpiochip224 From the listing, n can be obtained. The GPIO number may vary for different design with different device tree entries; this is due to the GPIO numbers are auto-assign by the kernel. To confirm the n is associated to which peripheral, user needs to match the label of the GPIO chip to the address of push button and DIP switch in device tree. eg root@socfpga~:# cat /sys/class/gpio/gpiochip150/label /sopc@0/bridge@0xc0000000/gpio@0x1000100C0 In this reference design, DIP switch is at As for how to compile the driver and use it, please refer to Xiao Meige's " Based on SoC FPGA =宋体]Embedded Design and Development Tutorial" corresponds to the content in the book.