avr: reorganized common code.

This commit is contained in:
Martin Preuss
2026-04-20 23:56:52 +02:00
parent 2d2105ae00
commit abe218e7b0
12 changed files with 281 additions and 155 deletions

View File

@@ -0,0 +1,47 @@
; ***************************************************************************
; copyright : (C) 2026 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. *
; ***************************************************************************
#ifndef AQH_AVR_COMMON_INCCOUNTER16_ASM
#define AQH_AVR_COMMON_INCCOUNTER16_ASM
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; @routine Utils_IncrementCounter16 @global
;
; Increment a 16 bit counter at the address given by X.
;
; @param X Address of the 2 byte counter (1. byte is LSB)
; @clobbers r18, r19, r22
Utils_IncrementCounter16:
ld r18, x+
ld r19, x
ldi r22, 1
add r18, r22
clr r22 ; doesn't affect carry flag
adc r19, r22
st x, r19
st -x, r18
ret
; @end
#endif