Forum Discussion
Altera_Forum
Honored Contributor
10 years agoDE0-Nano-SoC: How HPS(ARM) recognizes f2h_irq0 or f2h_irq1 interrupts from FPGA
I designed a block in Verilog. When data processing is finished, this FPGA block sends an interrupt signal to HPS using one of dedicated interrupt line: f2h_irq0 or f2h_irq1. The question is how HPS can recognize that this interrupt is active? Could anybody give an example of C code where HPS reads the interrupt (or decode interrupt vector) from FPGA?
15 Replies
- Altera_Forum
Honored Contributor
Dear Nachodizz990,
Thanks for the tips. My status is the following:- I set up Eclipse for DS-5- v5.22.0.
- Remote Systems is set up, so the target’s files are accessible via SFTP and I have contact with my target via Terminal.
- Debug Configuration let me run a simple hello example directly on the target with an access to his registers values using the breakpoints.
- Altera_Forum
Honored Contributor
C:\altera\15.1\embedded\embeddedsw\socfpga\prebuilt_images\kernel_headers\include\linux
All these files and all you need is inside the EDS suite. The nano soc manual shows you how cross compile with the shell but i work and program in ds5 eclipse because you can acces the linux terminal, explore the filesystem and debug the programs This pic illustrates how i work. http://s28.postimg.org/g9ussmjml/2016_01_17_10h40_29.png I can guide you to configure the workspace if you want!! - Altera_Forum
Honored Contributor
Hello Nachodizz990,
Thank you very much for the prompt reply with very concrete code example, which would be very useful in my case. Regarding the system on HPS, there is original Linux version 3.13.0-00298-g3c7cbb9-dirty (root@matthew) (gcc version 4.6.3 (Sourcery CodeBench Lite 2012.03-57) ). Since I am beginner in Cyclone V SoC, nothing was changed on my DE0-Nano-SoC board, I use orginal SW on my board and PC. Therefore, I have additional maybe a silly question to you:confused: about header files used in your C code: # include <linux/module.h> # include <linux/irq.h> # include <linux/interrupt.h> # include <linux/kernel.h> # include <linux/gpio.h> I have complete installation of: 1) Altera 15.1.0.185 Standard Edition, including Quartus Prime and SoC Embedded Design Suite (EDS) 15.1.0.185 under Win7 2) ARM DS-5 v5.22.0 under Win7, However, I cannot find above files: module.h, irq.h, interrupt.h, kernel.h, gpio.h. Where I can find them to install on my PC in order to compile succesfully your C code? - Altera_Forum
Honored Contributor
#include <linux/module.h>
# include <linux/irq.h> # include <linux/interrupt.h> # include <linux/kernel.h> # include <linux/gpio.h> static int gpio_number = -1; irqreturn_t gpio_isr(int this_irq, void *dev_id) { printk("Interrupt happened at gpio:%d\n", gpio_number); return IRQ_HANDLED; } static void __exit gpio_interrupt_exit (void) { free_irq(gpio_to_irq(gpio_number), 0); return; } static int __init gpio_interrupt_init (void) { int r; if (gpio_number < 0) { printk("Please specify a valid gpio_number\n"); return -1; } int irq_number = gpio_to_irq(gpio_number); r = request_irq(irq_number, gpio_isr, IRQF_DISABLED, 0, 0); if (r) { printk("failure requesting irq %i\n", irq_number); return r; } return 0; } MODULE_LICENSE("GPL"); module_param(gpio_number, int, 0); module_init(gpio_interrupt_init); module_exit(gpio_interrupt_exit); This example code it´s in the SoC EDS installation folder C:\altera\15.1\embedded\examples\software (For Linux ) - Altera_Forum
Honored Contributor
Hi Sebar,What sofware are you running on your HPS ? Bare metal,RTOS or Linux ?