asm.h 311 B

123456789101112131415161718192021
  1. #pragma once
  2. #include <stdint.h>
  3. #include "macros.h"
  4. #ifdef __AVR_ATmega2560__
  5. // return the current PC (on AVRs with 22bit PC)
  6. FORCE_INLINE __uint24 GETPC(void)
  7. {
  8. __uint24 ret;
  9. asm (
  10. "rcall .\n"
  11. "pop %A0\n"
  12. "pop %B0\n"
  13. "pop %C0\n"
  14. : "=&r" (ret)
  15. );
  16. return ret;
  17. }
  18. #endif