From 425c26cfbb1269a9299b11cb532959f7fc37553d Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Thu, 5 Sep 2024 03:15:51 +0200 Subject: [PATCH] avr: added common code. --- avr/common/utils_copy_from_flash.asm | 35 ++++++++++++++++++++++++++++ avr/common/utils_copy_sdram.asm | 34 +++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 avr/common/utils_copy_from_flash.asm create mode 100644 avr/common/utils_copy_sdram.asm diff --git a/avr/common/utils_copy_from_flash.asm b/avr/common/utils_copy_from_flash.asm new file mode 100644 index 0000000..5624fb5 --- /dev/null +++ b/avr/common/utils_copy_from_flash.asm @@ -0,0 +1,35 @@ +; *************************************************************************** +; 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 + +; --------------------------------------------------------------------------- +; Utils_CopyFromFlash +; +; IN: +; - X: dest in RAM +; - Z: src in FLASH +; - R18: number of bytes to copy +; OUT: +; - nothing +; USED: R17, R18, X, Z + +Utils_CopyFromFlash: + lpm r16, Z+ + st X+, r16 + dec r18 + brne Utils_CopyFromFlash + ret + + diff --git a/avr/common/utils_copy_sdram.asm b/avr/common/utils_copy_sdram.asm new file mode 100644 index 0000000..5a35681 --- /dev/null +++ b/avr/common/utils_copy_sdram.asm @@ -0,0 +1,34 @@ +; *************************************************************************** +; 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 + +; --------------------------------------------------------------------------- +; Utils_Copy_SDRAM +; +; IN: +; - X: dest in RAM +; - Y: src in RAM +; - R18: number of bytes to copy +; OUT: +; - nothing +; USED: R17, R18, X, Y +Utils_Copy_SDRAM: + ld r17, Y+ + st X+, r17 + dec r18 + brne Utils_Copy_SDRAM + ret + +