From 75b602811cc46c409dd17904484d80382805cfb1 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Sat, 17 May 2025 14:22:49 +0200 Subject: [PATCH] added XRAM module. Module for external SRAM with AtMega8515. --- avr/devices/all/includes.asm | 5 ++ avr/devices/all/modules.asm | 4 ++ avr/modules/0BUILD | 1 + avr/modules/xram/0BUILD | 11 ++++ avr/modules/xram/main.asm | 106 +++++++++++++++++++++++++++++++++++ 5 files changed, 127 insertions(+) create mode 100644 avr/modules/xram/0BUILD create mode 100644 avr/modules/xram/main.asm diff --git a/avr/devices/all/includes.asm b/avr/devices/all/includes.asm index 55160d6..b0cfb68 100644 --- a/avr/devices/all/includes.asm +++ b/avr/devices/all/includes.asm @@ -24,6 +24,10 @@ .include "modules/basetimer/main.asm" +#ifdef MODULES_XRAM +.include "modules/xram/main.asm" +#endif + #ifdef MODULES_NETWORK .include "common/crc8.asm" .include "common/m_fixedbuffers.asm" @@ -169,6 +173,7 @@ .include "apps/network/stats.asm" .include "modules/network/msg/sendstats-w.asm" .include "modules/network/msg/recvstats-w.asm" +.include "modules/network/msg/memstats-w.asm" .include "modules/network/msg/device-w.asm" #endif diff --git a/avr/devices/all/modules.asm b/avr/devices/all/modules.asm index 90a41f6..571a5f5 100644 --- a/avr/devices/all/modules.asm +++ b/avr/devices/all/modules.asm @@ -32,6 +32,10 @@ initModules: rcall Timer_Init #endif +#ifdef MODULES_XRAM + rcall XRAM_Init +#endif + #ifdef MODULES_LED ldi zl, LOW(ledA3Flash) ldi zh, HIGH(ledA3Flash) diff --git a/avr/modules/0BUILD b/avr/modules/0BUILD index 16da38b..dc51511 100644 --- a/avr/modules/0BUILD +++ b/avr/modules/0BUILD @@ -35,6 +35,7 @@ bootloader f_keepup valsched + xram diff --git a/avr/modules/xram/0BUILD b/avr/modules/xram/0BUILD new file mode 100644 index 0000000..febd367 --- /dev/null +++ b/avr/modules/xram/0BUILD @@ -0,0 +1,11 @@ + + + + + + main.asm + + + + + diff --git a/avr/modules/xram/main.asm b/avr/modules/xram/main.asm new file mode 100644 index 0000000..44cd65e --- /dev/null +++ b/avr/modules/xram/main.asm @@ -0,0 +1,106 @@ +; *************************************************************************** +; copyright : (C) 2025 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. * +; *************************************************************************** + + +; *************************************************************************** +; defines + + + +; *************************************************************************** +; data + +.dseg + +xramLastAddress: .byte 2 + + + + + +; *************************************************************************** +; code + +.cseg + + + +; --------------------------------------------------------------------------- +; @routine XRAM_Init @global +; + +XRAM_Init: + clr r16 + sts xramLastAddress, r16 + sts xramLastAddress+1, r16 + + M_IO_READ r16, MCUCR + sbr r16, (1<