[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Simulavr-devel] two things
From: |
Theodore A. Roth |
Subject: |
Re: [Simulavr-devel] two things |
Date: |
Thu, 20 Nov 2003 11:49:08 -0800 (PST) |
On Thu, 20 Nov 2003, John Regehr wrote:
> 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;
> };
I'd change that to look like this:
struct _IntBit {
int addr;
uint8_t 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.
That sounds logical to me. The naming of enable and flag adds a bit of
confusion to your description though, but that can be cleaned up a bit.
Ted Roth