add macros for reading/writing IO regs regardless of their position (i.e. < or >=0x40).

This commit is contained in:
Martin Preuss
2025-05-17 10:46:46 +02:00
parent bb4e16cae7
commit 930229b969
2 changed files with 30 additions and 0 deletions

View File

@@ -17,6 +17,7 @@
utils_copy_from_flash.asm
utils_copy_sdram.asm
utils_initial_wait.asm
utils_io.asm
utils_wait.asm
utils_wait_fixed.asm
utils_wait_pin.asm

29
avr/common/utils_io.asm Normal file
View File

@@ -0,0 +1,29 @@
; ***************************************************************************
; copyright : (C) 2023 by Martin Preuss
; email : martin@libchipcard.de
;
; ***************************************************************************
; * This file is part of the project "AqHome". *
; * Please see toplevel file COPYING of that project for license details. *
; ***************************************************************************
; M_IO_READ DEST, SRC
.macro M_IO_READ
.if @1 < 64
in @0, @1
.else
lds @0, @1
.endif
.endmacro
; M_IO_WRITE DEST, SRC
.macro M_IO_WRITE
.if @0 < 64
out @0, @1
.else
sts @0, @1
.endif
.endmacro