[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [uracoli-devel] Re: Regarding the hif_put_blk() function
From: |
Charles Goyard |
Subject: |
Re: [uracoli-devel] Re: Regarding the hif_put_blk() function |
Date: |
Fri, 18 Jun 2010 09:19:59 +0200 |
Hi,
2010/6/17 rifo rifo <address@hidden>:
> I have checked an uracoli example that calls the hif_put_blk() function
> (namely, xmpl_hif.c) and I couldn't see any mechanism to restore the
> interrupts after hif_put_blk() function returns.
Here's what you are missing: SREG is the register for global
interrupts. Basically, sei "does" SREG=1, and cli "does" SREG=0.
Doing:
k=SREG;
...stuff...
SREG=k;
if a more efficient way to do that:
k=SREG;
...stuff...
if(k == 1)
sei();
}
So the conclusion is : interrupts are re-enabled at the end of
hif_put_blk() ONLY IF they where at the beginning.
In avr libc there's a straightforward relationship between
instructions and hardware, so have a look at the libc source code and
the datasheet of your mcu, it should help a lot.
see ya,
--
Charles