avr: fully implemented router functionality in network and router app.
This commit is contained in:
@@ -13,6 +13,9 @@
|
||||
device-w.asm
|
||||
memstats-w.asm
|
||||
pong-w.asm
|
||||
range-d.asm
|
||||
range-r.asm
|
||||
range-w.asm
|
||||
reboot-d.asm
|
||||
reboot-r.asm
|
||||
recvstats-w.asm
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
.equ NETMSG_CMD_CLAIM_ADDRESS = 62
|
||||
.equ NETMSG_CMD_DENY_ADDRESS = 63
|
||||
.equ NETMSG_CMD_ADDRESS_RANGE = 64
|
||||
.equ NETMSG_CMD_REENUM = 65
|
||||
|
||||
.equ NETMSG_CMD_FLASH_START = 70
|
||||
.equ NETMSG_CMD_FLASH_END = 71
|
||||
|
||||
18
avr/modules/network/msg/range-d.asm
Normal file
18
avr/modules/network/msg/range-d.asm
Normal file
@@ -0,0 +1,18 @@
|
||||
; ***************************************************************************
|
||||
; 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. *
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
|
||||
.equ NETMSG_RANGE_OFFS_UID = 4
|
||||
.equ NETMSG_RANGE_OFFS_FROM = 8
|
||||
.equ NETMSG_RANGE_OFFS_TO = 9
|
||||
|
||||
|
||||
|
||||
|
||||
38
avr/modules/network/msg/range-r.asm
Normal file
38
avr/modules/network/msg/range-r.asm
Normal file
@@ -0,0 +1,38 @@
|
||||
; ***************************************************************************
|
||||
; 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. *
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine NETMSG_RangeRead @global
|
||||
; Read a RANGE message.
|
||||
;
|
||||
; @param X buffer to read from
|
||||
; @return R18 command
|
||||
; @return R20 range begin
|
||||
; @return R21 range end
|
||||
; @clobbers none
|
||||
|
||||
NETMSG_Range_Read:
|
||||
adiw xh:xl, NETMSG_OFFS_CMD
|
||||
ld r18, X ; command
|
||||
adiw xh:xl, NETMSG_RANGE_OFFS_FROM-NETMSG_OFFS_CMD ; skip src addr and uid
|
||||
ld r20, X+ ; range from
|
||||
ld r21, X ; range to
|
||||
sbiw xh:xl, NETMSG_RANGE_OFFS_TO ; back to msg begin
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
44
avr/modules/network/msg/range-w.asm
Normal file
44
avr/modules/network/msg/range-w.asm
Normal 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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user