2021-07-22 01:40:26 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "../../bsp/include/rvic.h"
|
|
|
|
|
|
|
|
|
2021-08-14 06:05:08 +00:00
|
|
|
void rvic_irq_enable(rvic_int_id_e id)
|
2021-07-22 01:40:26 +00:00
|
|
|
{
|
2021-08-14 06:05:08 +00:00
|
|
|
RVIC_REG(RVIC_ENABLE_REG_OFFSET) |= 1 << id;
|
2021-07-22 01:40:26 +00:00
|
|
|
}
|
|
|
|
|
2021-08-14 06:05:08 +00:00
|
|
|
void rvic_irq_disable(rvic_int_id_e id)
|
2021-07-22 01:40:26 +00:00
|
|
|
{
|
2021-08-14 06:05:08 +00:00
|
|
|
RVIC_REG(RVIC_ENABLE_REG_OFFSET) &= ~(1 << id);
|
2021-07-22 01:40:26 +00:00
|
|
|
}
|
|
|
|
|
2021-08-14 06:05:08 +00:00
|
|
|
void rvic_clear_irq_pending(rvic_int_id_e id)
|
2021-07-22 01:40:26 +00:00
|
|
|
{
|
2021-08-14 06:05:08 +00:00
|
|
|
RVIC_REG(RVIC_PENDING_REG_OFFSET) |= 1 << id;
|
2021-07-22 01:40:26 +00:00
|
|
|
}
|
|
|
|
|
2021-08-14 06:05:08 +00:00
|
|
|
void rvic_set_irq_prio_level(rvic_int_id_e id, uint8_t level)
|
2021-07-22 01:40:26 +00:00
|
|
|
{
|
|
|
|
uint8_t reg;
|
|
|
|
uint8_t index;
|
|
|
|
|
|
|
|
reg = id >> 2;
|
|
|
|
index = id % 4;
|
|
|
|
|
|
|
|
RVIC_PRIO->prio[reg] &= ~(0xff << (index << 3));
|
|
|
|
RVIC_PRIO->prio[reg] |= (level << (index << 3));
|
|
|
|
}
|