From a54ad9edce697133a024aff096e50f7e4f389d5b Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Sun, 18 Mar 2012 12:22:02 +0100 Subject: digital/beacon: import Zigbit stack (bitcloud) & avr sources --- .../HAL/drivers/OFD/src/ofdIntFlashRead.s | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 digital/beacon/src/Bitcloud_stack/Components/HAL/drivers/OFD/src/ofdIntFlashRead.s (limited to 'digital/beacon/src/Bitcloud_stack/Components/HAL/drivers/OFD/src/ofdIntFlashRead.s') diff --git a/digital/beacon/src/Bitcloud_stack/Components/HAL/drivers/OFD/src/ofdIntFlashRead.s b/digital/beacon/src/Bitcloud_stack/Components/HAL/drivers/OFD/src/ofdIntFlashRead.s new file mode 100644 index 00000000..b3267377 --- /dev/null +++ b/digital/beacon/src/Bitcloud_stack/Components/HAL/drivers/OFD/src/ofdIntFlashRead.s @@ -0,0 +1,40 @@ +/**************************************************************************//** + \file ofdIntFlashRead.s + + \brief Implementation of internal flash reading. + + \author + Atmel Corporation: http://www.atmel.com \n + Support email: avr@atmel.com + + Copyright (c) 2008-2011, Atmel Corporation. All rights reserved. + Licensed under Atmel's Limited License Agreement (BitCloudTM). + + \internal + History: + 13/08/09 A. Khromykh - Created +*******************************************************************************/ + +/******************************************************************************* +Reads byte from internal flash +Parameters: + R25:R24:R23:R22 - Byte address into flash. +Returns: + R24 - read byte from flash. +*******************************************************************************/ +.section .text +.global ofdReadInternalFlash +ofdReadInternalFlash: + push r31 ; Store Z to stack + push r30 ; Store Z to stack + in r25, 0x3B ; Save RAMPZ. + out 0x3B, r24 ; Load RAMPZ with the MSB of the address. + movw r30, r22 ; Move low bytes of address to ZH:ZL from R23:R22 + elpm r24, Z ; Extended load program memory from Z address + out 0x3B, r25 ; Restore RAMPZ register. + pop r30 ; Restore Z + pop r31 ; Restore Z + ret ; return from function + +; eof ofdIntFlashRead.s + -- cgit v1.2.3