Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of Hibernus by
hibernus.h
00001 /** Hibernus Library 00002 * University of Southampton 2017 00003 * 00004 * Open-source liberary that enable any of your Mbed project work with transient enegy sources. 00005 * In order to use this library include the "hibernus.h" header file, and use the "Hibernus()" method at the beginning of you main funtion. 00006 * For more details and example see the "main.cpp" exampe file, and the attached documnetation 00007 * 00008 * 00009 * Released under the MIT License: http://mbed.org/license/mit 00010 */ 00011 #ifndef HIBERNUS_H_ 00012 #define HIBERNUS_H_ 00013 00014 #define Fixed_Add_Vars_Offset 0x40 //the Offset added to the first address of RAM, in order to compute the address of first fixed Add variable 00015 #define Fixed_Add_Vars_Size 0x28 //size of the all fixed address variables (0x28 = 44(dec) = 4Bytes*(4 flags+3CoreReg+4LoopVar)) 00016 #define flash_end (FLASH_Start + flash_Size) 00017 #define ramToFlash_sectors_number (RAM_Size / sector_Size) //how many flash sectors do we have to erase, before saving the RAM content to flash 00018 #define flash_ramSection_start (flash_end - RAM_Size-SaveFlagsInFlash *sector_Size) 00019 00020 // Declare register integers for the SP, LR, and PC 00021 register volatile unsigned int _SP __asm("r13"); 00022 register volatile unsigned int _LR __asm("r14"); 00023 register volatile unsigned int _PC __asm("r15"); 00024 00025 // Value written to non-volatile flags to indicate that they are set or not 00026 #define Flag_set 0xFFFF0000 00027 #define Flag_erase 0xFFFFFFFF 00028 00029 // Declare external assembly language function (in a *.s file) 00030 extern "C" void asm_restore(void); 00031 extern "C" volatile unsigned int* getFlag_1(void); 00032 extern "C" volatile unsigned int* getFlag_2(void); 00033 extern "C" volatile unsigned int* getFlag_3(void); 00034 extern "C" volatile unsigned int* getFlag_4(void); 00035 00036 void Hibernus(void); 00037 void Save_RAM_Regs(void); 00038 void Restore_Regs(void); 00039 void restore(void); 00040 void hibernate(volatile unsigned int sp, volatile unsigned int lr, volatile unsigned int pc); 00041 void recovery_no_power_loss(void); 00042 00043 #endif
Generated on Sat Jul 16 2022 02:11:32 by
1.7.2
