/* Set priority of a riscv PLIC-specific interrupt line. 
This routine set the priority of a RISCV PLIC-specific interrupt line. riscv_plic_irq_set_prio is called by riscv arch_irq_priority_set to set the priority of an interrupt whenever CONFIG_RISCV_HAS_PLIC variable is set. */
void riscv_plic_set_priority(uint32_t irq, uint32_t priority)
/* Set priority of a riscv PLIC-specific interrupt line. 
This routine set the priority of a RISCV PLIC-specific interrupt line. riscv_plic_irq_set_prio is called by riscv arch_irq_priority_set to set the priority of an interrupt whenever CONFIG_RISCV_HAS_PLIC variable is set. */
void riscv_plic_set_priority(uint32_t irq, uint32_t priority)
{
	const struct device *dev = get_plic_dev_from_irq(irq);
	const struct plic_config *config = dev->config;
	const uint32_t local_irq = irq_from_level_2(irq);
	mem_addr_t prio_addr = config->prio + (local_irq * sizeof(uint32_t));
	if (priority > config->max_prio)
		priority = config->max_prio;
	sys_write32(priority, prio_addr);
}