aboutsummaryrefslogtreecommitdiff
path: root/quantum/nvm/eeprom/nvm_eeprom_via_internal.h
diff options
context:
space:
mode:
authorNick Brassel <[email protected]>2025-03-21 23:38:34 +1100
committerGitHub <[email protected]>2025-03-21 23:38:34 +1100
commit2b00b846dce1d1267dfdb2a3c2972a367cc0dd44 (patch)
tree6d801a8d83c58ee646b789bfa9ab912857ee7d8c /quantum/nvm/eeprom/nvm_eeprom_via_internal.h
parentc9d62ddc78e879053241202b288d0129073b07dc (diff)
downloadqmk_firmware-2b00b846dce1d1267dfdb2a3c2972a367cc0dd44.tar.gz
qmk_firmware-2b00b846dce1d1267dfdb2a3c2972a367cc0dd44.zip
Non-volatile memory data repository pattern (#24356)
* First batch of eeconfig conversions. * Offset and length for datablocks. * `via`, `dynamic_keymap`. * Fix filename. * Commentary. * wilba leds * satisfaction75 * satisfaction75 * more keyboard whack-a-mole * satisfaction75 * omnikeyish * more whack-a-mole * `generic_features.mk` to automatically pick up nvm repositories * thievery * deferred variable resolve * whitespace * convert api to structs/unions * convert api to structs/unions * convert api to structs/unions * fixups * code-side docs * code size fix * rollback * nvm_xxxxx_erase * Updated location of eeconfig magic numbers so non-EEPROM nvm drivers can use them too. * Fixup build. * Fixup compilation error with encoders. * Build fixes. * Add `via_ci` keymap to onekey to exercise VIA bindings (and thus dynamic keymap et.al.), fixup compilation errors based on preprocessor+sizeof. * Build failure rectification.
Diffstat (limited to 'quantum/nvm/eeprom/nvm_eeprom_via_internal.h')
-rw-r--r--quantum/nvm/eeprom/nvm_eeprom_via_internal.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/quantum/nvm/eeprom/nvm_eeprom_via_internal.h b/quantum/nvm/eeprom/nvm_eeprom_via_internal.h
new file mode 100644
index 0000000000..bf0d38e2ac
--- /dev/null
+++ b/quantum/nvm/eeprom/nvm_eeprom_via_internal.h
@@ -0,0 +1,22 @@
+// Copyright 2024 Nick Brassel (@tzarc)
+// SPDX-License-Identifier: GPL-2.0-or-later
+#pragma once
+
+// Keyboard level code can change where VIA stores the magic.
+// The magic is the build date YYMMDD encoded as BCD in 3 bytes,
+// thus installing firmware built on a different date to the one
+// already installed can be detected and the EEPROM data is reset.
+// The only reason this is important is in case EEPROM usage changes
+// and the EEPROM was not explicitly reset by bootmagic lite.
+#ifndef VIA_EEPROM_MAGIC_ADDR
+# define VIA_EEPROM_MAGIC_ADDR (EECONFIG_SIZE)
+#endif
+
+#define VIA_EEPROM_LAYOUT_OPTIONS_ADDR (VIA_EEPROM_MAGIC_ADDR + 3)
+
+// The end of the EEPROM memory used by VIA
+// By default, dynamic keymaps will start at this if there is no
+// custom config
+#define VIA_EEPROM_CUSTOM_CONFIG_ADDR (VIA_EEPROM_LAYOUT_OPTIONS_ADDR + VIA_EEPROM_LAYOUT_OPTIONS_SIZE)
+
+#define VIA_EEPROM_CONFIG_END (VIA_EEPROM_CUSTOM_CONFIG_ADDR + VIA_EEPROM_CUSTOM_CONFIG_SIZE)