Skip to content

Instantly share code, notes, and snippets.

@kmcallister
Created December 26, 2018 21:25
Show Gist options
  • Select an option

  • Save kmcallister/526035afc10bef35512537c10efd876e to your computer and use it in GitHub Desktop.

Select an option

Save kmcallister/526035afc10bef35512537c10efd876e to your computer and use it in GitHub Desktop.
ATOMIC_BLOCK
#include <util/atomic.h>
void blahblah();
void foo() {
ATOMIC_BLOCK(ATOMIC_FORCEON) {
blahblah();
}
}
// avr-gcc -c foo.c -std=c99 -Os && avr-objdump -dr foo.o
Disassembly of section .text:
00000000 <foo>:
0: f8 94 cli
2: 00 d0 rcall .+0 ; 0x4 <foo+0x4>
2: R_AVR_13_PCREL blahblah
4: 78 94 sei
6: 08 95 ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment