PLIC programming guidance for U54mc

(John Burke) #1

Hi SiFive Forums,

Hoping somebody here can help me understand some stuff to program with the plic properly on a u54mc. I feel like I have a lot of the pieces but need help putting it all together.

1st – I know that I have something that can raise an interrupt on a certain pin coming into the PLIC. The plic also has id 0 as “no interrupt”. Does this mean that the id for this particular interrupt source will be pin_number+1 basically?

2nd – I think I can initialize and enable things here with code like this

struct metal_interrupt *plic = metal_interrupt_get_controller(METAL_PLIC_CONTROLLER, 0);
metal_interrupt_enable(plic, pin_number+1);
metal_interrupt_set_priority(plic, pin_number+1, 7);

Am I missing a step for initializing this on a give core?

3rd – I think at this point I need to set up an isr with metal_interrupt_register_handler() correct?

4th – I’ve looked around a fair deal, but haven’t seen too much example code for this aside from this small bit. However, it only seems to get the plic handle and just leaves it there. Is there any more involved code that I might be able to look to?

Sorry if I’m way off course, been trying to put things together on my own, but I know I’m getting a bit lost in the weeds, so reaching out for some help