PULP Community

Full Version: Interrupt Service Routine for Pulpissimo
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
Are there any documents or codes available to write Interrupt Service Routine for Pulpissimo in C language?
Hi RiscV,

I don't know of any documents but here is a C snippet that illustrates how to do it with the pulp-runtime (https://github.com/pulp-platform/pulp-runtime):

#include "pulp.h"

void handle_soc_event_interrupts(void ) __attribute((interrupt));
void handle_soc_event_interrupts(void) {
  // normal C code here. Do something useful, call other functions etc.
}

int main() {
   // some other initialization
   
  // Set interrupt handle for SoC events (IRQ 26)
  rt_irq_set_handler(26, handle_soc_event_interrupts);
  // Enable soc_event interrupts (IRQ 26)
  hal_itc_enable_set(1<<26);

  while (1)
           hal_itc_wait_for_interrupt(); // Calls _WFI instruction and stalls the core until an interrupt arrives

}
Thank you meggiman...hope it helps