Files
aqhomecontrol/avr/modules/network/msg/sendstats-w.asm
Martin Preuss bb14dd4c22 introduce macros bigjmp and bigcall for intermodule calls/jmps
translates to rjmp/rcall on MCUs with up to 8K flash and to jmp/call
on others.
2025-06-01 19:18:25 +02:00

42 lines
1.6 KiB
NASM

; ***************************************************************************
; 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_SendStats_Write @global
;
; @param Y pointer to device to write msg for and to
; @param X pointer to buffer to write to
; @clobbers R16, R18 (R17, R19, R20, R21, Z)
NETMSG_SendStats_Write:
ldi r16, 0xff
st X+, r16 ; dest address
ldi r16, 12 ; msg code+src address+10 payload bytes
st X+, r16 ; msg len
ldi r16, NETMSG_CMD_SENDSTATS
st X+, r16 ; msg code
ldd r16, Y+NET_IFACE_OFFS_ADDRESS
st X+, r16 ; src address
rcall NETMSG_Common_AddUidToBuffer ; (R16, R18, R19, R20, R21)
adiw yh:yl, NET_IFACE_OFFS_PACKETSOUT_LOW
ldi r18, 6
bigcall Utils_Copy_SDRAM ; (R17, R18, X, Y)
sbiw yh:yl, NET_IFACE_OFFS_PACKETSOUT_LOW+6
sbiw xh:xl, 14 ; go back to beginning of message (1 byte dst addr, 1 byte length, 12 bytes payload)
rcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
sbiw xh:xl, 15 ; go back to beginning of message (1 byte dst addr, 1 byte length, 12 bytes payload, 1 byte crc)
ret
; @end