; *************************************************************************** ; 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_NETWORK_MSG_SIMPLEMSG_W_ASM #define AQH_AVR_NETWORK_MSG_SIMPLEMSG_W_ASM ; *************************************************************************** ; code .cseg ; --------------------------------------------------------------------------- ; @routine NETMSG_SimpleMsgWrite ; Write a simple msg (only code and src address). ; ; @param R16 dest addr ; @param R18 msg code ; @param X buffer to write to ; @param Y pointer to network interface data ; @clobbers R18 (R16, R17, R19, R20, X) NETMSG_SimpleMsgWrite: st X+, r16 ; dest address ldi r16, 2 ; msg code+src address+0 payload bytes st X+, r16 ; msg len st X+, r18 ; msg code ldd r16, Y+NET_IFACE_OFFS_ADDRESS st X+, r16 ; src address sbiw xh:xl, 4 ; go back to beginning of message (1 byte dst addr, 1 byte length, 2 bytes payload) rcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X) sbiw xh:xl, 5 ; go back to beginning of message (1 byte dst addr, 1 byte length, 2 bytes payload, 1 byte crc) ret ; @end #endif