51 lines
1.5 KiB
NASM
51 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 COM reception stats packet.
|
|
;
|
|
; IN:
|
|
; - R16: destination address
|
|
; - X : buffer to write to
|
|
; OUT:
|
|
; - nothing
|
|
; REGS: R3, R4, R16, R17, R18, X (R19, R20, R21)
|
|
|
|
CPRO_WriteComRecvStats:
|
|
ldi r17, COM2_PAYLOAD_FLAGS_UID | ((com2RecvStatsEnd-com2RecvStatsBegin)<<COM2_PAYLOAD_FLAGS_SHIFT_NUM) ; uid + payload
|
|
ldi r18, CPRO_CMD_COMRECVSTATS
|
|
push xh
|
|
push xl
|
|
rcall COM2_BeginMsgWithVariablePayload ; (R3, R4, R16, R17, R18, R19, R20, R21, X)
|
|
push yh
|
|
push yl
|
|
ldi yh, HIGH(com2RecvStatsBegin)
|
|
ldi yl, LOW(com2RecvStatsBegin)
|
|
ldi r18, com2RecvStatsEnd-com2RecvStatsBegin
|
|
rcall Utils_Copy_SDRAM ; (R17, R18, X, Y)
|
|
pop yl
|
|
pop yh
|
|
pop xl
|
|
pop xh
|
|
rcall com2CalcAndAddChecksumByte ; (R16, R17, R18, R19, X)
|
|
ret
|
|
|
|
|
|
|
|
|