avr/modules/network: added messages.
This commit is contained in:
42
avr/modules/network/msg/simplemsg-w.asm
Normal file
42
avr/modules/network/msg/simplemsg-w.asm
Normal file
@@ -0,0 +1,42 @@
|
||||
; ***************************************************************************
|
||||
; 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_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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user