avr: fully implemented router functionality in network and router app.

This commit is contained in:
Martin Preuss
2025-07-07 16:05:53 +02:00
parent 691ee3c71b
commit cbd498150f
21 changed files with 769 additions and 66 deletions

View File

@@ -0,0 +1,44 @@
; ***************************************************************************
; copyright : (C) 2025 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. *
; ***************************************************************************
; ---------------------------------------------------------------------------
; @routine NETMSG_Range_Write
;
; @param Y pointer to device to write msg for
; @param X pointer to buffer to write to
; @param R18 command
; @param R20 range begin
; @param R21 range end
; @clobbers R16, R18 (R17, R19, R20, R21, Z)
NETMSG_Range_Write:
ldi r16, 0xff
st X+, r16 ; dest address
ldi r16, 8 ; msg code+src address+6 payload bytes
st X+, r16 ; msg len
st X+, r18 ; msg code
ldd r16, Y+NET_IFACE_OFFS_ADDRESS
st X+, r16 ; src address
push r20
push r21
rcall NETMSG_Common_AddUidToBuffer ; (R16, R18, R19, R20, R21)
pop r21
pop r20
st X+, r20 ; range begin
st X+, r21 ; range end
sbiw xh:xl, 10 ; go back to beginning of message (1 byte dst addr, 1 byte length, 8 bytes payload)
rcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
sbiw xh:xl, 11 ; go back to beginning of message (1 byte dst addr, 1 byte length, 8 bytes payload, 1 byte crc)
ret
; @end