sim-card
/
qemu
Archived
10
0
Fork 0

i8259: Move pic_set_irq1 after pic_update_irq

We are about to call the latter from the former. No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Jan Kiszka 2011-10-07 09:19:40 +02:00 committed by Blue Swirl
parent ef5e1ae2c1
commit 620260174a
1 changed files with 29 additions and 26 deletions

View File

@ -79,32 +79,6 @@ static uint64_t irq_count[16];
#endif
PicState2 *isa_pic;
/* set irq level. If an edge is detected, then the IRR is set to 1 */
static void pic_set_irq1(PicState *s, int irq, int level)
{
int mask;
mask = 1 << irq;
if (s->elcr & mask) {
/* level triggered */
if (level) {
s->irr |= mask;
s->last_irr |= mask;
} else {
s->irr &= ~mask;
s->last_irr &= ~mask;
}
} else {
/* edge triggered */
if (level) {
if ((s->last_irr & mask) == 0)
s->irr |= mask;
s->last_irr |= mask;
} else {
s->last_irr &= ~mask;
}
}
}
/* return the highest priority found in mask (highest = smallest
number). Return 8 if no irq */
static int get_priority(PicState *s, int mask)
@ -144,6 +118,8 @@ static int pic_get_irq(PicState *s)
}
}
static void pic_set_irq1(PicState *s, int irq, int level);
/* raise irq to CPU if necessary. must be called every time the active
irq may change */
static void pic_update_irq(PicState2 *s)
@ -178,6 +154,33 @@ static void pic_update_irq(PicState2 *s)
}
}
/* set irq level. If an edge is detected, then the IRR is set to 1 */
static void pic_set_irq1(PicState *s, int irq, int level)
{
int mask;
mask = 1 << irq;
if (s->elcr & mask) {
/* level triggered */
if (level) {
s->irr |= mask;
s->last_irr |= mask;
} else {
s->irr &= ~mask;
s->last_irr &= ~mask;
}
} else {
/* edge triggered */
if (level) {
if ((s->last_irr & mask) == 0) {
s->irr |= mask;
}
s->last_irr |= mask;
} else {
s->last_irr &= ~mask;
}
}
}
#ifdef DEBUG_IRQ_LATENCY
int64_t irq_time[16];
#endif