Nios PIO Interrupt Enable

Source: Internet
Author: User

As for interrupts in Nios, interrupts are used when the 16c550 needs to be tested in a nios interrupt environment.

Hardware: Add Hardware Pio in Nios, but enable interrupt function. As shown in the following:

System is listed, the connection to PIO is not said. But be aware of two places: Edge type, IRQ type.

The next step is software design:

enable the corresponding interrupt, Iowr_altera_avalon_pio_irq_mask (Intrep_base, 0xff); that is, the mask function corresponds to each bit of the 1-bit enable.

Clear Interrupt flag: Iowr_altera_avalon_pio_edge_cap (Intrep_base, 0x00);

Interrupt Registration function:

Alt_ic_isr_register (intrep_irq_interrupt_controller_id, //defined in system.h
INTREP_IRQ,//defined in system.h
INTRP_ISR,//Interrupt Service sub-function
Isr_context,//null pointer void * Isr_context
0x0//reserved bit, but to write

);

Corresponding Interrupt Service sub-function:

void Intrp_isr (void) {

printf ("have enter the ISR \ n");
Iowr_altera_avalon_pio_edge_cap (Intrep_base, 0x00); Clear Mark Bit
。。。。。。。。。。。。。。

。。。。。。。。。。。。。。。
}

To this hardware and software, the design is complete. As long as the corresponding PIO, the condition of the interruption, in the Nios will respond to interrupts, into the interrupt service sub-function.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.