2021-06-16 21:58:00 +00:00
|
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
2022-02-02 20:06:58 +00:00
|
|
|
#include "macros.h"
|
2021-06-16 21:58:00 +00:00
|
|
|
|
|
|
|
#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)
|
2021-06-16 21:58:00 +00:00
|
|
|
{
|
2022-02-02 20:06:58 +00:00
|
|
|
__uint24 ret;
|
|
|
|
asm (
|
2021-06-16 21:58:00 +00:00
|
|
|
"rcall .\n"
|
2022-02-02 20:06:58 +00:00
|
|
|
"pop %A0\n"
|
|
|
|
"pop %B0\n"
|
|
|
|
"pop %C0\n"
|
|
|
|
: "=&r" (ret)
|
2021-06-16 21:58:00 +00:00
|
|
|
);
|
2022-02-02 20:06:58 +00:00
|
|
|
return ret;
|
2021-06-16 21:58:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|