avr: split code in multiple files and routines.

This commit is contained in:
Martin Preuss
2023-04-22 11:54:09 +02:00
parent 3e6501c834
commit 3b44fb9c5b
12 changed files with 656 additions and 498 deletions

View File

@@ -0,0 +1,62 @@
; ***************************************************************************
; 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. *
; ***************************************************************************
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; wait indefinately until ATTN line is high, send packet over wire, retry until successfull
;
; IN:
; - x : ptr to buffer to send
; OUT:
; - nothing
; REGS: (R16, R17, R18, R21, R22, R24, R25, X)
flashSendPacketUntilSuccess:
push xl
push xh
rcall COM2_SendPacketWithAttn ; (R16, R17, R21, R22, X)
pop xh
pop xl
brcc flashSendPacket_error
ret
flashSendPacket_error:
rcall flashWaitForAttnHigh ; (R16, R17, R18, R22, R24, R25, X)
rjmp flashSendPacketUntilSuccess
; ---------------------------------------------------------------------------
; wait indefinately for free ATTN line
;
; IN:
; - nothing
; OUT:
; - nothing
; REGS: (R16, R17, R18, R22, R24, R25, X)
flashWaitForAttnHigh:
rcall com2WaitForAttnHigh ; (r17, r22, X)
brcc flashWaitForAttnHigh_stillLow
ret
flashWaitForAttnHigh_stillLow:
rcall flashWaitDependingOnUid ; (R16, R18, R22, R24, R25)
rjmp flashWaitForAttnHigh