improve stats reporting

now again use three messages to transmit stats (much more efficient than
sending single values, also more acurate).
This commit is contained in:
Martin Preuss
2025-08-25 10:22:05 +02:00
parent 7efaf720cc
commit 6e062d3f60
13 changed files with 234 additions and 186 deletions

View File

@@ -19,21 +19,52 @@
NETMSG_RecvStats_Write:
ldi r16, 0xff
st X+, r16 ; dest address
ldi r16, 18 ; msg code+src address+10 payload bytes
ldi r16, 19 ; msg code+src address+10 payload bytes
st X+, r16 ; msg len
ldi r16, NETMSG_CMD_RECVSTATS
st X+, r16 ; msg code
ldd r16, Y+NET_IFACE_OFFS_ADDRESS
st X+, r16 ; src address
bigcall NETMSG_Common_AddUidToBuffer ; (R16, R18, R19, R20, R21)
adiw yh:yl, NET_IFACE_OFFS_PACKETSIN_LOW
ldi r18, 12
bigcall Utils_Copy_SDRAM ; (R17, R18, X, Y)
sbiw yh:yl, NET_IFACE_OFFS_PACKETSIN_LOW+12
sbiw xh:xl, 20 ; go back to beginning of message (1 byte dst addr, 1 byte length, 18 bytes payload)
; UID
bigcall NETMSG_Common_AddUidToBuffer ; (R16, R18, R19, R20, R21)
; interface number
ldd r16, Y+NET_IFACE_OFFS_IFACENUM
st X+, r16
; packets in
ldd r16, Y+NET_IFACE_OFFS_PACKETSIN_LOW
st X+, r16
ldd r16, Y+NET_IFACE_OFFS_PACKETSIN_HIGH
st X+, r16
; content error
ldd r16, Y+NET_IFACE_OFFS_ERR_CONTENT_LOW
st X+, r16
ldd r16, Y+NET_IFACE_OFFS_ERR_CONTENT_HIGH
st X+, r16
; io error
ldd r16, Y+NET_IFACE_OFFS_ERR_IO_LOW
st X+, r16
ldd r16, Y+NET_IFACE_OFFS_ERR_IO_HIGH
st X+, r16
; nobuf error
ldd r16, Y+NET_IFACE_OFFS_ERR_NOBUF_LOW
st X+, r16
ldd r16, Y+NET_IFACE_OFFS_ERR_NOBUF_HIGH
st X+, r16
; msgsize error
ldd r16, Y+NET_IFACE_OFFS_ERR_MSGSIZE_LOW
st X+, r16
ldd r16, Y+NET_IFACE_OFFS_ERR_MSGSIZE_HIGH
st X+, r16
; missed error
ldd r16, Y+NET_IFACE_OFFS_ERR_MISSED_LOW
st X+, r16
ldd r16, Y+NET_IFACE_OFFS_ERR_MISSED_HIGH
st X+, r16
sbiw xh:xl, 21 ; go back to beginning of message (1 byte dst addr, 1 byte length, 18 bytes payload)
bigcall NETMSG_CalcAndAddChecksumByte ; (R16, R17, R18, R19, R20, X)
sbiw xh:xl, 21 ; go back to beginning of message (1 byte dst addr, 1 byte length, 18 bytes payload, 1 byte crc)
sbiw xh:xl, 22 ; go back to beginning of message (1 byte dst addr, 1 byte length, 18 bytes payload, 1 byte crc)
ret
; @end