From e19b0ef8ac7040deaacb850344843b163ff15bfa Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Sun, 9 Apr 2023 18:49:50 +0200 Subject: [PATCH] avr: added memstat message. --- avr/att84_temp1.asm | 1 + avr/comproto.asm | 1 + avr/comproto_memstats.asm | 70 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 avr/comproto_memstats.asm diff --git a/avr/att84_temp1.asm b/avr/att84_temp1.asm index dc964a5..1e1ac34 100644 --- a/avr/att84_temp1.asm +++ b/avr/att84_temp1.asm @@ -227,6 +227,7 @@ .include "comproto_addr.asm" .include "comproto_stats.asm" .include "comproto_device.asm" +.include "comproto_memstats.asm" .include "comproto_values.asm" ;.include "comproto_debug.asm" ;.include "comproto_twi.asm" diff --git a/avr/comproto.asm b/avr/comproto.asm index 4509e51..fa73d10 100644 --- a/avr/comproto.asm +++ b/avr/comproto.asm @@ -36,6 +36,7 @@ .equ CPRO_CMD_FLASH_RSP = 74 .equ CPRO_CMD_DEVICE = 80 +.equ CPRO_CMD_MEMSTATS = 81 ; flags for variable payload enqueue function diff --git a/avr/comproto_memstats.asm b/avr/comproto_memstats.asm new file mode 100644 index 0000000..c6b0ec9 --- /dev/null +++ b/avr/comproto_memstats.asm @@ -0,0 +1,70 @@ +; *************************************************************************** +; 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 + + +; --------------------------------------------------------------------------- +; Enqueue a MEMSTATS packet. +; +; IN: +; - R16: destination address +; OUT: +; - CFLAG: set if okay, clear otherwise +; MODIFIED REGS: R6, R16, R17, R18, R20 (R3, R4, R15, R19, R21, X) + +CPRO_EnqueueMemStats: + mov r6, r16 + + rcall COM_AllocBufferAndGetXY ; (r16, r17, r21) + brcc CPRO_EnqueueMemStats_error + + push xh + push xl + mov r16, r6 + ldi r17, CPRO_PAYLOAD_FLAGS_UID | CPRO_PAYLOAD_FLAGS_SECONDS | (7<