OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [sw/] [example/] [demo_xirq/] [main.c] - Diff between revs 61 and 62

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 61 Rev 62
Line 34... Line 34...
 
 
 
 
/**********************************************************************//**
/**********************************************************************//**
 * @file demo_xirq/main.c
 * @file demo_xirq/main.c
 * @author Stephan Nolting
 * @author Stephan Nolting
 * @brief External interrupt controller (XIRQ) demo program.
 * @brief External interrupt controller (XIRQ) demo program (using hardware-assisted prioritization).
 **************************************************************************/
 **************************************************************************/
 
 
#include <neorv32.h>
#include <neorv32.h>
 
 
 
 
Line 137... Line 137...
    neorv32_gpio_port_set(0xF); // set output pins 3:0 -> trigger XIRQ 3:0
    neorv32_gpio_port_set(0xF); // set output pins 3:0 -> trigger XIRQ 3:0
    neorv32_gpio_port_set(0x0);
    neorv32_gpio_port_set(0x0);
  }
  }
 
 
 
 
  // wait for interrupts
  // --- wait for interrupts ---
 
  // All incoming XIRQ interrupt requests are "prioritized" in this example. The XIRQ FIRQ handler
 
  // reads the ID of the interrupt with the highest priority from the XIRQ controller ("source" register) and calls the according
 
  // handler function.
 
  // Non-prioritized handling of interrupts (or custom prioritization) can be implemented by manually reading the
 
  // XIRQ controller's "pending" register. It is up to the software to define which pending IRQ should be served.
  while(1);
  while(1);
 
 
 
 
  // just as an example: to disable certain XIRQ interrupt channels, we can
  // just as an example: to disable certain XIRQ interrupt channels, we can
  // uninstall the according handler. this will also clear a pending interrupt for that channel
  // un-install the according handler. this will also clear a pending interrupt for that channel
  neorv32_xirq_uninstall(0); // disable XIRQ channel 0 and remove associated handler
  neorv32_xirq_uninstall(0); // disable XIRQ channel 0 and remove associated handler
  neorv32_xirq_uninstall(1); // disable XIRQ channel 1 and remove associated handler
  neorv32_xirq_uninstall(1); // disable XIRQ channel 1 and remove associated handler
  neorv32_xirq_uninstall(2); // disable XIRQ channel 2 and remove associated handler
  neorv32_xirq_uninstall(2); // disable XIRQ channel 2 and remove associated handler
  neorv32_xirq_uninstall(3); // disable XIRQ channel 3 and remove associated handler
  neorv32_xirq_uninstall(3); // disable XIRQ channel 3 and remove associated handler
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.