[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Simulavr-devel] two things
From: |
John Regehr |
Subject: |
Re: [Simulavr-devel] two things |
Date: |
Thu, 20 Nov 2003 12:25:47 -0700 (MST) |
What would you think of code like this in intvecs.h? The idea is that
each interrupt vector is associated with two bits: a flag bit and an
enable bit.
typedef struct _IntBit IntBit;
struct _IntBit {
int addr;
int bit;
};
typedef struct _IntVect IntVect;
struct _IntVect {
char *name; /* The name of the interrupt. */
int addr; /* Where to vector to when interrupt occurs. */
uint32_t can_wake; /* If the interrupt occurs while in sleep
mode, can it wake the processor? Each bit
represents a different sleep mode which the
processor might be in. */
IntBit enable;
IntBit flag;
};
The semantics, as I understand things, are these:
There are two kinds of interrupts (I get this from ATmega128(L) docs page
14).
The first has a flag bit, which becomes set when the interrupt is
triggered (or it can be set programmatically -- who sets the bit is
irrelevant). The interrupt fires any time the flag bit is set && the
enable bit is set && the global enable bit is set.
The second kind of interrupt does not necessarily have a flag bit and if
the condition disappears before the CPU has a chance to handle the
interrupt, then the interrupt is lost.
John
--
John Regehr, address@hidden
Assistant Professor, School of Computing, University of Utah