Get E2END from pins, fix Linux buffer

This commit is contained in:
Scott Lahteine
2019-07-09 21:26:35 -05:00
parent 01e8813286
commit 3ae3bf5d33
13 changed files with 21 additions and 23 deletions

View File

@ -29,7 +29,7 @@
#include "../../inc/MarlinConfig.h"
#include "../shared/persistent_store_api.h"
#if NONE(I2C_EEPROM, SPI_EEPROM)
#if !defined(E2END) && NONE(I2C_EEPROM, SPI_EEPROM)
#define E2END 0xFFF // Default to Flash emulated EEPROM size (EepromEmulation_Due.cpp)
#endif

View File

@ -43,8 +43,6 @@
#define FALLING 0x03
#define RISING 0x04
#define E2END 0xFFF // EEPROM end address
typedef uint8_t byte;
#define PROGMEM
#define PSTR(v) (v)

View File

@ -29,7 +29,8 @@
#include "../shared/persistent_store_api.h"
#include <stdio.h>
uint8_t buffer[E2END];
#define LINUX_EEPROM_SIZE (E2END + 1)
uint8_t buffer[LINUX_EEPROM_SIZE];
char filename[] = "eeprom.dat";
bool PersistentStore::access_start() {
@ -40,8 +41,8 @@ bool PersistentStore::access_start() {
fseek(eeprom_file, 0L, SEEK_END);
std::size_t file_size = ftell(eeprom_file);
if (file_size < E2END) {
memset(buffer + file_size, eeprom_erase_value, E2END - file_size);
if (file_size < LINUX_EEPROM_SIZE) {
memset(buffer + file_size, eeprom_erase_value, LINUX_EEPROM_SIZE - file_size);
}
else {
fseek(eeprom_file, 0L, SEEK_SET);

View File

@ -33,7 +33,7 @@
#include "../shared/persistent_store_api.h"
#ifndef E2END
#define E2END 4095
#define E2END 0xFFF // 4KB
#endif
#define HAL_STM32F1_EEPROM_SIZE (E2END + 1)

View File

@ -71,11 +71,11 @@
/* Pages 0 and 1 base and end addresses */
#define PAGE0_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x0000))
#define PAGE0_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (PAGE_SIZE - 1)))
#define PAGE0_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + PAGE_SIZE - 1))
#define PAGE0_ID FLASH_SECTOR_1
#define PAGE1_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x4000))
#define PAGE1_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (2 * PAGE_SIZE - 1)))
#define PAGE1_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 2 * (PAGE_SIZE) - 1))
#define PAGE1_ID FLASH_SECTOR_2
/* Used Flash pages for EEPROM emulation */