target-xtensa: implement external interrupt mapping

Xtensa cores may have different mapping of external interrupt pins to
internal IRQ numers. Implement API to acquire core IRQ by its external
interrupt number.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Max Filippov 2011-10-16 02:56:03 +04:00 committed by Blue Swirl
parent 63f95e4c65
commit b8929a549f
2 changed files with 15 additions and 0 deletions

View File

@ -157,3 +157,15 @@ void xtensa_irq_init(CPUState *env)
qemu_new_timer_ns(vm_clock, &xtensa_ccompare_cb, env);
}
}
void *xtensa_get_extint(CPUState *env, unsigned extint)
{
if (extint < env->config->nextint) {
unsigned irq = env->config->extint[extint];
return env->irq_inputs[irq];
} else {
qemu_log("%s: trying to acquire invalid external interrupt %d\n",
__func__, extint);
return NULL;
}
}

View File

@ -277,6 +277,8 @@ typedef struct XtensaConfig {
} interrupt[MAX_NINTERRUPT];
unsigned nccompare;
uint32_t timerint[MAX_NCCOMPARE];
unsigned nextint;
unsigned extint[MAX_NINTERRUPT];
uint32_t clock_freq_khz;
xtensa_tlb itlb;
@ -318,6 +320,7 @@ int cpu_xtensa_exec(CPUXtensaState *s);
void do_interrupt(CPUXtensaState *s);
void check_interrupts(CPUXtensaState *s);
void xtensa_irq_init(CPUState *env);
void *xtensa_get_extint(CPUState *env, unsigned extint);
void xtensa_advance_ccount(CPUState *env, uint32_t d);
void xtensa_timer_irq(CPUState *env, uint32_t id, uint32_t active);
void xtensa_rearm_ccompare_timer(CPUState *env);