[fpc-devel] [fpc-pascal] ENC28J60 Ethernet Controller AVR/ARM Driver
Christo Crause
christo.crause at gmail.com
Wed Jun 5 12:41:01 CEST 2019
On Wed, Jun 5, 2019 at 8:21 AM Dimitrios Chr. Ioannidis via fpc-devel <
fpc-devel at lists.freepascal.org> wrote:
>
> Στις 2/6/2019 5:46 μ.μ., ο Jeppe Johansen έγραψε:
> > On 6/1/19 3:37 PM, Dimitrios Chr. Ioannidis via fpc-pascal wrote:
> > procedure AtomicWnrite(var value: word; new_value: word); inline;
> > var
> > b: Byte;
> > begin
> > b:=avr_save;
> > value:=new_value;
> > avr_restore(b);
> > end;
> >
> > function AtomicRead(var value: word): word; inline;
> > var
> > b: Byte;
> > begin
> > b:=avr_save;
> > AtomicRead:=value;
> > avr_restore(b);
> > end;
>
> Can I use those inside an interrupt handler ? What about nested interrupts
> ?
>
In my opinion not required for a normal ISR, since the global interrupt
flag is disabled anyway. Obviously if you enable the global interrupt flag
inside an ISR tor nesting interrupts then you would need the above
functions for atomic access to variables.
For new architectures such as tinyAVR1 or megaAVR0 series the interrupt
systems are a bit more involved (not sure how one would ensure atomic
access if a normal ISR is interrupted by a non-maskable interrupt).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190605/f3016f3d/attachment.html>
More information about the fpc-devel
mailing list