54 lines
1.5 KiB
NASM
54 lines
1.5 KiB
NASM
; ***************************************************************************
|
|
; copyright : (C) 2023 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
|
|
|
|
|
|
; ---------------------------------------------------------------------------
|
|
; Write a ComSendStats packet.
|
|
;
|
|
; IN:
|
|
; - R16: destination address
|
|
; - X : buffer to write to
|
|
; OUT:
|
|
; - nothing
|
|
; REGS: R3, R4, R16, R17, R18, X (R19, R20, R21)
|
|
|
|
CPRO_WriteComSendStats:
|
|
ldi r17, COM2_PAYLOAD_FLAGS_UID | (6<<COM2_PAYLOAD_FLAGS_SHIFT_NUM) ; UID + 6 bytes payload
|
|
ldi r18, CPRO_CMD_COMSENDSTATS
|
|
push xh
|
|
push xl
|
|
rcall COM2_BeginMsgWithVariablePayload ; (R3, R4, R16, R17, R18, R19, R20, R21, X)
|
|
lds r16, com2StatsPacketsOut ; packets out
|
|
st X+, r16
|
|
lds r16, com2StatsPacketsOut+1
|
|
st X+, r16
|
|
lds r16, com2StatsCollisions ; collisions
|
|
st X+, r16
|
|
lds r16, com2StatsCollisions+1
|
|
st X+, r16
|
|
lds r16, com2StatsBusyError ; busy
|
|
st X+, r16
|
|
lds r16, com2StatsBusyError+1
|
|
st X+, r16
|
|
pop xl
|
|
pop xh
|
|
rcall com2CalcAndAddChecksumByte ; (R16, R17, R18, R19, X)
|
|
ret
|
|
|
|
|
|
|