PULP Community
Interrupt Service Routine for Pulpissimo - Printable Version

+- PULP Community (https://pulp-platform.org/community)
+-- Forum: PULP's Community forum (https://pulp-platform.org/community/forumdisplay.php?fid=1)
+--- Forum: PULP General questions (https://pulp-platform.org/community/forumdisplay.php?fid=2)
+--- Thread: Interrupt Service Routine for Pulpissimo (/showthread.php?tid=240)



Interrupt Service Routine for Pulpissimo - RiscV - 02-22-2021

Hi,
Are there any documents or codes available to write Interrupt Service Routine for Pulpissimo in C language?


RE: Interrupt Service Routine for Pulpissimo - meggiman - 02-23-2021

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

}


RE: Interrupt Service Routine for Pulpissimo - RiscV - 02-24-2021

Thank you meggiman...hope it helps