mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
Merge branch 'thelsing:master' into master
This commit is contained in:
commit
b403480f0c
@ -127,7 +127,7 @@ void Memory::readMemory()
|
|||||||
void Memory::writeMemory()
|
void Memory::writeMemory()
|
||||||
{
|
{
|
||||||
// first get the necessary size of the writeBuffer
|
// first get the necessary size of the writeBuffer
|
||||||
size_t writeBufferSize = _metadataSize;
|
uint16_t writeBufferSize = _metadataSize;
|
||||||
for (int i = 0; i < _saveCount; i++)
|
for (int i = 0; i < _saveCount; i++)
|
||||||
writeBufferSize = MAX(writeBufferSize, _saveRestores[i]->saveSize());
|
writeBufferSize = MAX(writeBufferSize, _saveRestores[i]->saveSize());
|
||||||
|
|
||||||
|
@ -181,8 +181,8 @@ uint32_t Platform::writeNonVolatileMemory(uint32_t relativeAddress, uint8_t* buf
|
|||||||
uint32_t start = _bufferedEraseblockNumber * (flashEraseBlockSize() * flashPageSize());
|
uint32_t start = _bufferedEraseblockNumber * (flashEraseBlockSize() * flashPageSize());
|
||||||
uint32_t end = start + (flashEraseBlockSize() * flashPageSize());
|
uint32_t end = start + (flashEraseBlockSize() * flashPageSize());
|
||||||
|
|
||||||
ptrdiff_t offset = relativeAddress - start;
|
uint32_t offset = relativeAddress - start;
|
||||||
ptrdiff_t length = end - relativeAddress;
|
uint32_t length = end - relativeAddress;
|
||||||
if(length > size)
|
if(length > size)
|
||||||
length = size;
|
length = size;
|
||||||
memcpy(_eraseblockBuffer + offset, buffer, length);
|
memcpy(_eraseblockBuffer + offset, buffer, length);
|
||||||
@ -227,7 +227,7 @@ void Platform::writeBufferedEraseBlock()
|
|||||||
if(_bufferedEraseblockNumber > -1 && _bufferedEraseblockDirty)
|
if(_bufferedEraseblockNumber > -1 && _bufferedEraseblockDirty)
|
||||||
{
|
{
|
||||||
flashErase(_bufferedEraseblockNumber);
|
flashErase(_bufferedEraseblockNumber);
|
||||||
for(int i = 0; i < flashEraseBlockSize(); i++)
|
for(uint32_t i = 0; i < flashEraseBlockSize(); i++)
|
||||||
{
|
{
|
||||||
int32_t pageNumber = _bufferedEraseblockNumber * flashEraseBlockSize() + i;
|
int32_t pageNumber = _bufferedEraseblockNumber * flashEraseBlockSize() + i;
|
||||||
uint8_t *data = _eraseblockBuffer + flashPageSize() * i;
|
uint8_t *data = _eraseblockBuffer + flashPageSize() * i;
|
||||||
@ -238,7 +238,7 @@ void Platform::writeBufferedEraseBlock()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Platform::bufferEraseBlock(uint32_t eraseBlockNumber)
|
void Platform::bufferEraseBlock(int32_t eraseBlockNumber)
|
||||||
{
|
{
|
||||||
if(_bufferedEraseblockNumber == eraseBlockNumber)
|
if(_bufferedEraseblockNumber == eraseBlockNumber)
|
||||||
return;
|
return;
|
||||||
|
@ -104,7 +104,7 @@ class Platform
|
|||||||
// writes _eraseblockBuffer to flash
|
// writes _eraseblockBuffer to flash
|
||||||
virtual void writeBufferedEraseBlock();
|
virtual void writeBufferedEraseBlock();
|
||||||
// copies a EraseBlock into the _eraseblockBuffer
|
// copies a EraseBlock into the _eraseblockBuffer
|
||||||
void bufferEraseBlock(uint32_t eraseBlockNumber);
|
void bufferEraseBlock(int32_t eraseBlockNumber);
|
||||||
|
|
||||||
// in theory we would have to use this buffer for memory reads too,
|
// in theory we would have to use this buffer for memory reads too,
|
||||||
// but because ets always restarts the device after programming it
|
// but because ets always restarts the device after programming it
|
||||||
|
@ -110,7 +110,7 @@ bool TableObject::allocTable(uint32_t size, bool doFill, uint8_t fillByte)
|
|||||||
if (doFill)
|
if (doFill)
|
||||||
{
|
{
|
||||||
uint32_t addr = _memory.toRelative(_data);
|
uint32_t addr = _memory.toRelative(_data);
|
||||||
for(int i = 0; i< size;i++)
|
for(uint32_t i = 0; i < size;i++)
|
||||||
_memory.writeMemory(addr+i, 1, &fillByte);
|
_memory.writeMemory(addr+i, 1, &fillByte);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ A RAM-buffered Flash can be use by defining USE_RP2040_LARGE_EEPROM_EMULATION
|
|||||||
|
|
||||||
#define FLASHPTR ((uint8_t*)XIP_BASE + KNX_FLASH_OFFSET)
|
#define FLASHPTR ((uint8_t*)XIP_BASE + KNX_FLASH_OFFSET)
|
||||||
|
|
||||||
|
#ifndef USE_RP2040_EEPROM_EMULATION
|
||||||
#if KNX_FLASH_SIZE%4096
|
#if KNX_FLASH_SIZE%4096
|
||||||
#error "KNX_FLASH_SIZE must be multiple of 4096"
|
#error "KNX_FLASH_SIZE must be multiple of 4096"
|
||||||
#endif
|
#endif
|
||||||
@ -42,6 +43,7 @@ A RAM-buffered Flash can be use by defining USE_RP2040_LARGE_EEPROM_EMULATION
|
|||||||
#if KNX_FLASH_OFFSET%4096
|
#if KNX_FLASH_OFFSET%4096
|
||||||
#error "KNX_FLASH_OFFSET must be multiple of 4096"
|
#error "KNX_FLASH_OFFSET must be multiple of 4096"
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef KNX_SERIAL
|
#ifndef KNX_SERIAL
|
||||||
#define KNX_SERIAL Serial1
|
#define KNX_SERIAL Serial1
|
||||||
|
@ -4,10 +4,12 @@
|
|||||||
|
|
||||||
#ifdef ARDUINO_ARCH_RP2040
|
#ifdef ARDUINO_ARCH_RP2040
|
||||||
|
|
||||||
|
#ifndef USE_RP2040_EEPROM_EMULATION
|
||||||
#ifndef KNX_FLASH_OFFSET
|
#ifndef KNX_FLASH_OFFSET
|
||||||
#define KNX_FLASH_OFFSET 0x180000 // 1.5MiB
|
#define KNX_FLASH_OFFSET 0x180000 // 1.5MiB
|
||||||
#pragma warning "KNX_FLASH_OFFSET not defined, using 0x180000"
|
#pragma warning "KNX_FLASH_OFFSET not defined, using 0x180000"
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_RP2040_LARGE_EEPROM_EMULATION
|
#ifdef USE_RP2040_LARGE_EEPROM_EMULATION
|
||||||
#define USE_RP2040_EEPROM_EMULATION
|
#define USE_RP2040_EEPROM_EMULATION
|
||||||
|
Loading…
Reference in New Issue
Block a user