Updated memory storage functionality

- cachedStorage is functional
- Presets can be loaded from FLASH
- CRC32 added and applied
- Presets with corrputed data will be replaced by default preset

Next: Preset update functionality from menu 

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@269 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-11-02 12:58:27 +00:00
parent 76783a6061
commit 4901cb1a09
27 changed files with 894 additions and 144 deletions

View File

@@ -33,7 +33,11 @@
#include "stm32f10x.h"
#include "RepairPreset.h"
#include "RepairPresets.h"
#include "gpio.h"
#include "InternalFlash.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
@@ -67,6 +71,32 @@
#define HSB_DAC_TESLA_MAX_VOLTAGE (6200)
// FLASH ADDRESSES FOR DATA STORAGE
// Define storage for presets, which is the biggest storage part
// Each set of presets is written/saved on a dedicated page. This reduces
// cache size when erasing page prior to write
#define APP_FLASH_PRESET_ANODE_PAGE (122)
#define APP_FLASH_PRESET_CATHODE_PAGE (123)
#define APP_FLASH_PRESET_MCP_PAGE (124)
#define APP_FLASH_PRESET_TESLA_PAGE (125)
#define APP_FLASH_STORAGE_PRESET_SIZE (sizeof(struct RepairPreset) * REPAIR_PRESETS_NUMBER_OF_PRESETS)
#define APP_FLASH_STORAGE_PRESET_ANODE (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_PRESET_ANODE_PAGE)
#define APP_FLASH_STORAGE_PRESET_CATHODE (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_PRESET_CATHODE_PAGE)
#define APP_FLASH_STORAGE_PRESET_MCP (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_PRESET_MCP_PAGE)
#define APP_FLASH_STORAGE_PRESET_TESLA (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_PRESET_TESLA_PAGE)
// Define storage for device parameters like PID constants and others
#define APP_FLASH_PARAMETERS_PAGE (126)
#define APP_FLASH_STORAGE_PARAMETERS (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_PARAMETERS_PAGE)
// Define storage for power-down detection flag
#define APP_FLASH_POWERDOWN_PAGE (127)
#define APP_FLASH_STORAGE_POWERDOWN (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_POWERDOWN_PAGE)
// Exports of objects on application level
extern struct Display* const mainDisplay;
// -----------------------------------------------------------------------------