mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Define and utilize memory region backup_ram.
This commit is contained in:
parent
682c87e3ff
commit
fd3f962e40
@ -69,6 +69,8 @@ constexpr region_t ahb_ram_0 { 0x20000000, 32_KiB };
|
|||||||
constexpr region_t ahb_ram_1 { 0x20008000, 16_KiB };
|
constexpr region_t ahb_ram_1 { 0x20008000, 16_KiB };
|
||||||
constexpr region_t ahb_ram_2 { 0x2000c000, 16_KiB };
|
constexpr region_t ahb_ram_2 { 0x2000c000, 16_KiB };
|
||||||
|
|
||||||
|
constexpr region_t backup_ram { LPC_BACKUP_REG_BASE, 256 };
|
||||||
|
|
||||||
constexpr region_t spifi_uncached { LPC_SPIFI_DATA_BASE, 1_MiB };
|
constexpr region_t spifi_uncached { LPC_SPIFI_DATA_BASE, 1_MiB };
|
||||||
constexpr region_t spifi_cached { LPC_SPIFI_DATA_CACHED_BASE, spifi_uncached.size() };
|
constexpr region_t spifi_cached { LPC_SPIFI_DATA_CACHED_BASE, spifi_uncached.size() };
|
||||||
|
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
|
|
||||||
#include "utility.hpp"
|
#include "utility.hpp"
|
||||||
|
|
||||||
|
#include "memory_map.hpp"
|
||||||
|
using portapack::memory::map::backup_ram;
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@ -43,9 +46,9 @@ struct data_t {
|
|||||||
int32_t correction_ppb;
|
int32_t correction_ppb;
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(data_t) <= 0x100, "Persistent memory structure too large for VBAT-maintained region");
|
static_assert(sizeof(data_t) <= backup_ram.size(), "Persistent memory structure too large for VBAT-maintained region");
|
||||||
|
|
||||||
static data_t* const data = reinterpret_cast<data_t*>(LPC_BACKUP_REG_BASE);
|
static data_t* const data = reinterpret_cast<data_t*>(backup_ram.base());
|
||||||
|
|
||||||
rf::Frequency tuned_frequency() {
|
rf::Frequency tuned_frequency() {
|
||||||
rf::tuning_range.reset_if_outside(data->tuned_frequency, tuned_frequency_reset_value);
|
rf::tuning_range.reset_if_outside(data->tuned_frequency, tuned_frequency_reset_value);
|
||||||
|
Loading…
Reference in New Issue
Block a user