Prusa-Firmware/Firmware/asm.h

22 lines
311 B
C
Raw Normal View History

#pragma once
#include <stdint.h>
2022-02-02 20:06:58 +00:00
#include "macros.h"
#ifdef __AVR_ATmega2560__
// return the current PC (on AVRs with 22bit PC)
2022-02-02 20:06:58 +00:00
FORCE_INLINE __uint24 GETPC(void)
{
2022-02-02 20:06:58 +00:00
__uint24 ret;
asm (
"rcall .\n"
2022-02-02 20:06:58 +00:00
"pop %A0\n"
"pop %B0\n"
"pop %C0\n"
: "=&r" (ret)
);
2022-02-02 20:06:58 +00:00
return ret;
}
#endif