Skip to content

Commit

Permalink
tests: gen_isr_table: account for riscv32 architecture
Browse files Browse the repository at this point in the history
Account for riscv32 SOCs supporting the riscv privileged architecture.

Change-Id: I8c26a2bcc2baded5db252896abe6e1b5ab052113
Signed-off-by: Jean-Paul Etienne <[email protected]>
  • Loading branch information
fractalclone authored and Anas Nashif committed Feb 22, 2017
1 parent f62e681 commit 9acda0f
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions tests/kernel/gen_isr_table/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,26 @@ extern uint32_t _irq_vector_table[];

#define ISR1_OFFSET 0
#define ISR2_OFFSET 1

#if defined(CONFIG_RISCV32) && !defined(CONFIG_SOC_RISCV32_PULPINO)
#define ISR3_OFFSET 1
#define ISR4_OFFSET 5

#define IRQ_LINE(offset) offset
#define TABLE_INDEX(offset) offset
#define TRIG_CHECK_SIZE 6
#else
#define ISR3_OFFSET 2
#define ISR4_OFFSET 3

#define IRQ_LINE(offset) (CONFIG_NUM_IRQS - ((offset) + 1))
#define TABLE_INDEX(offset) (IRQ_TABLE_SIZE - ((offset) + 1))
#define TRIG_CHECK_SIZE 4
#endif

#define ISR3_ARG 0xb01dface
#define ISR4_ARG 0xca55e77e
static volatile int trigger_check[4];
static volatile int trigger_check[TRIG_CHECK_SIZE];

#if defined(CONFIG_ARM)
#include <arch/arm/cortex_m/cmsis.h>
Expand All @@ -39,8 +50,17 @@ void trigger_irq(int irq)
NVIC->STIR = irq;
#endif
}
#elif defined(CONFIG_RISCV32) && !defined(CONFIG_SOC_RISCV32_PULPINO)
void trigger_irq(int irq)
{
uint32_t mip;

__asm__ volatile ("csrrs %0, mip, %1\n"
: "=r" (mip)
: "r" (1 << irq));
}
#else
/* So far, Nios II and Risc V do not support this */
/* So far, Nios II does not support this */
#define NO_TRIGGER_FROM_SW
#endif

Expand Down Expand Up @@ -202,5 +222,3 @@ void main(void)
TC_END_RESULT(rv);
TC_END_REPORT(rv);
}


0 comments on commit 9acda0f

Please sign in to comment.