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:
@@ -165,10 +165,11 @@ Offset Length Meaning
|
||||
2 1 command code
|
||||
3 1 source address
|
||||
---------------------------------------------------------
|
||||
4 4 UID of the sending node
|
||||
8 2 packets out
|
||||
10 2 collisions
|
||||
12 2 line busy errors
|
||||
4 1 Interface number
|
||||
5 4 UID of the sending node
|
||||
9 2 packets out
|
||||
11 2 collisions
|
||||
13 2 line busy errors
|
||||
---------------------------------------------------------
|
||||
14 1 CRC8 byte
|
||||
|
||||
@@ -185,15 +186,16 @@ Offset Length Meaning
|
||||
2 1 command code
|
||||
3 1 source address
|
||||
---------------------------------------------------------
|
||||
4 4 UID of the sending node
|
||||
8 2 packets in
|
||||
10 2 content errors (invalid msg length, CRC errors)
|
||||
12 2 io errors
|
||||
14 2 no buffer errors
|
||||
16 2 handled packets
|
||||
18 2 missed packets
|
||||
4 1 Interface number
|
||||
5 4 UID of the sending node
|
||||
9 2 packets in
|
||||
11 2 content errors (invalid msg length, CRC errors)
|
||||
13 2 io errors
|
||||
15 2 no buffer errors
|
||||
17 2 handled packets
|
||||
19 2 missed packets
|
||||
---------------------------------------------------------
|
||||
20 1 CRC8 byte
|
||||
21 1 CRC8 byte
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
.equ NETMSG_CMD_PING = 10
|
||||
.equ NETMSG_CMD_PONG = 11
|
||||
.equ NETMSG_CMD_SENDSTATS = 20
|
||||
.equ NETMSG_CMD_RECVSTATS = 21
|
||||
.equ NETMSG_CMD_SENDSTATS = 22
|
||||
.equ NETMSG_CMD_RECVSTATS = 23
|
||||
.equ NETMSG_CMD_TWIBUSMEMBER = 30
|
||||
.equ NETMSG_CMD_DEBUG = 40
|
||||
|
||||
|
||||
@@ -51,14 +51,10 @@ NETMSG_MemStats_Write:
|
||||
st X+, r21
|
||||
.endif
|
||||
; current buffers used
|
||||
push xl
|
||||
push xh
|
||||
bigcall NET_Buffer_CountUsed ; (r16, r17, r18, X)
|
||||
pop xh
|
||||
pop xl
|
||||
lds r16, netBuffersUsed
|
||||
st X+, r16
|
||||
; max buffers used
|
||||
clr r16
|
||||
lds r16, netBuffersMaxUsed
|
||||
st X+, r16
|
||||
; no buffer errors
|
||||
ldd r16, Y+NET_IFACE_OFFS_ERR_NOBUF_LOW
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -12,28 +12,44 @@
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine NETMSG_SendStats_Write @global
|
||||
;
|
||||
; @param Y pointer to device to write msg for and to
|
||||
; @param Y pointer to device to write msg for
|
||||
; @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
|
||||
ldi r16, 13 ; msg code+src address+11 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
|
||||
bigcall 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)
|
||||
; UID
|
||||
bigcall NETMSG_Common_AddUidToBuffer ; (R16, R18, R19, R20, R21)
|
||||
; interface number
|
||||
ldd r16, Y+NET_IFACE_OFFS_IFACENUM
|
||||
st X+, r16
|
||||
; packets out
|
||||
ldd r16, Y+NET_IFACE_OFFS_PACKETSOUT_LOW
|
||||
st X+, r16
|
||||
ldd r16, Y+NET_IFACE_OFFS_PACKETSOUT_HIGH
|
||||
st X+, r16
|
||||
; collisions
|
||||
ldd r16, Y+NET_IFACE_OFFS_ERR_COLLISIONS_LOW
|
||||
st X+, r16
|
||||
ldd r16, Y+NET_IFACE_OFFS_ERR_COLLISIONS_HIGH
|
||||
st X+, r16
|
||||
; busy
|
||||
ldd r16, Y+NET_IFACE_OFFS_ERR_BUSY_LOW
|
||||
st X+, r16
|
||||
ldd r16, Y+NET_IFACE_OFFS_ERR_BUSY_HIGH
|
||||
st X+, r16
|
||||
|
||||
sbiw xh:xl, 15 ; go back to beginning of message (1 byte dst addr, 1 byte length, 13 bytes payload)
|
||||
bigcall 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)
|
||||
sbiw xh:xl, 16 ; go back to beginning of message (1 byte dst addr, 1 byte length, 12 bytes payload, 1 byte crc)
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user