interrupt_controller: plic: use shared symbol for DT_*
miv already had it defined, but let's shorten the names and use them in the driver. This also adds it for sifive-freedom. Signed-off-by: Olof Johansson <olof@lixom.net>
This commit is contained in:
parent
a6b3b616f5
commit
3b733b5282
3 changed files with 21 additions and 24 deletions
|
@ -42,8 +42,7 @@ static int save_irq;
|
|||
void riscv_plic_irq_enable(u32_t irq)
|
||||
{
|
||||
u32_t key;
|
||||
volatile u32_t *en =
|
||||
(volatile u32_t *)DT_INST_0_SIFIVE_PLIC_1_0_0_IRQ_EN_BASE_ADDRESS;
|
||||
volatile u32_t *en = (volatile u32_t *)DT_PLIC_IRQ_EN;
|
||||
|
||||
key = irq_lock();
|
||||
en += (irq >> 5);
|
||||
|
@ -66,8 +65,7 @@ void riscv_plic_irq_enable(u32_t irq)
|
|||
void riscv_plic_irq_disable(u32_t irq)
|
||||
{
|
||||
u32_t key;
|
||||
volatile u32_t *en =
|
||||
(volatile u32_t *)DT_INST_0_SIFIVE_PLIC_1_0_0_IRQ_EN_BASE_ADDRESS;
|
||||
volatile u32_t *en = (volatile u32_t *)DT_PLIC_IRQ_EN;
|
||||
|
||||
key = irq_lock();
|
||||
en += (irq >> 5);
|
||||
|
@ -86,8 +84,7 @@ void riscv_plic_irq_disable(u32_t irq)
|
|||
*/
|
||||
int riscv_plic_irq_is_enabled(u32_t irq)
|
||||
{
|
||||
volatile u32_t *en =
|
||||
(volatile u32_t *)DT_INST_0_SIFIVE_PLIC_1_0_0_IRQ_EN_BASE_ADDRESS;
|
||||
volatile u32_t *en = (volatile u32_t *)DT_PLIC_IRQ_EN;
|
||||
|
||||
en += (irq >> 5);
|
||||
return !!(*en & (1 << (irq & 31)));
|
||||
|
@ -106,11 +103,10 @@ int riscv_plic_irq_is_enabled(u32_t irq)
|
|||
*/
|
||||
void riscv_plic_set_priority(u32_t irq, u32_t priority)
|
||||
{
|
||||
volatile u32_t *prio =
|
||||
(volatile u32_t *)DT_INST_0_SIFIVE_PLIC_1_0_0_PRIO_BASE_ADDRESS;
|
||||
volatile u32_t *prio = (volatile u32_t *)DT_PLIC_PRIO;
|
||||
|
||||
if (priority > DT_INST_0_SIFIVE_PLIC_1_0_0_RISCV_MAX_PRIORITY)
|
||||
priority = DT_INST_0_SIFIVE_PLIC_1_0_0_RISCV_MAX_PRIORITY;
|
||||
if (priority > DT_PLIC_MAX_PRIO)
|
||||
priority = DT_PLIC_MAX_PRIO;
|
||||
|
||||
prio += irq;
|
||||
*prio = priority;
|
||||
|
@ -134,7 +130,7 @@ int riscv_plic_get_irq(void)
|
|||
static void plic_irq_handler(void *arg)
|
||||
{
|
||||
volatile struct plic_regs_t *regs =
|
||||
(volatile struct plic_regs_t *) DT_INST_0_SIFIVE_PLIC_1_0_0_REG_BASE_ADDRESS;
|
||||
(volatile struct plic_regs_t *) DT_PLIC_REG;
|
||||
|
||||
u32_t irq;
|
||||
struct _isr_table_entry *ite;
|
||||
|
@ -179,12 +175,10 @@ static int plic_init(struct device *dev)
|
|||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
volatile u32_t *en =
|
||||
(volatile u32_t *)DT_INST_0_SIFIVE_PLIC_1_0_0_IRQ_EN_BASE_ADDRESS;
|
||||
volatile u32_t *prio =
|
||||
(volatile u32_t *)DT_INST_0_SIFIVE_PLIC_1_0_0_PRIO_BASE_ADDRESS;
|
||||
volatile u32_t *en = (volatile u32_t *)DT_PLIC_IRQ_EN;
|
||||
volatile u32_t *prio = (volatile u32_t *)DT_PLIC_PRIO;
|
||||
volatile struct plic_regs_t *regs =
|
||||
(volatile struct plic_regs_t *)DT_INST_0_SIFIVE_PLIC_1_0_0_REG_BASE_ADDRESS;
|
||||
(volatile struct plic_regs_t *)DT_PLIC_REG;
|
||||
int i;
|
||||
|
||||
/* Ensure that all interrupts are disabled initially */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue