com2w: check COM_ACCEPT_ALL_DEST

This commit is contained in:
Martin Preuss
2025-09-06 00:40:42 +02:00
parent 80ca6e0ac5
commit 808a7c4258

View File

@@ -162,7 +162,6 @@ com2wReceiveNextPkg:
mov xl, yl
mov xh, yh
adiw xh:xl, COM2W_IFACE_OFFS_BUFFER
ldd r18, Y+NET_IFACE_OFFS_ADDRESS
ldi r19, COM2W_BUFFER_SIZE
rcall com2wRecvMsg ; (r16, r17, r18, r19, r20, r22, r24, r25, X)
brcc com2wReceiveNextPkg_end
@@ -173,6 +172,25 @@ com2wReceiveNextPkg:
rcall NETMSG_CheckMessageInBuffer ; (R16, R17, R18, R19, R20, X)
brcc com2wReceiveNextPkg_eCrc
#ifndef COM_ACCEPT_ALL_DEST
; check destination addr
mov xl, yl
mov xh, yh
adiw xh:xl, COM2W_IFACE_OFFS_BUFFER
adiw xh:xl, NETMSG_OFFS_DESTADDR
ld r16, X ; read destination address
cpi r16, 0xff
breq com2wReceiveNextPkg_forMe
ldd r17, Y+NET_IFACE_OFFS_ADDRESS
cp r16, r17
breq com2wReceiveNextPkg_forMe
; packet not for me, but correctly received, inc counter, but don't light LED
ldi r16, NET_IFACE_OFFS_PACKETSIN_LOW
rcall NET_Interface_IncCounter16 ; (R24, R25)
rjmp com2wReceiveNextPkg_end
#endif
com2wReceiveNextPkg_forMe:
; msg received, alloc buffer for it
rcall NET_Buffer_Alloc ; R16=buffer num (R16, R17, X)
brcs com2wReceiveNextPkg_gotBuffer