ASYNC_WRITE changed to EEPROM_ASYNC_WRITE

This commit is contained in:
bsongis
2011-09-17 09:29:04 +00:00
parent 446ea4deab
commit 3d27fed72f
7 changed files with 29 additions and 29 deletions
+1 -1
View File
@@ -23,7 +23,7 @@
#ifndef SIMU
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
uint16_t eeprom_pointer;
const char* eeprom_buffer_data;
+13 -13
View File
@@ -24,7 +24,7 @@
#include "string.h"
uint8_t s_write_err = 0; // error reasons
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
uint8_t s_sync_write = false;
#endif
@@ -90,7 +90,7 @@ uint16_t EeFsGetFree()
return ret;
}
// #ifndef ASYNC_WRITE TODO because duplicate code
// #ifndef EEPROM_ASYNC_WRITE TODO because duplicate code
static void EeFsFree(uint8_t blk){///free one or more blocks
uint8_t i = blk;
while( EeFsGetLink(i)) i = EeFsGetLink(i);
@@ -100,7 +100,7 @@ static void EeFsFree(uint8_t blk){///free one or more blocks
}
// #endif
#ifndef ASYNC_WRITE
#ifndef EEPROM_ASYNC_WRITE
static uint8_t EeFsAlloc(){ ///alloc one block from freelist
uint8_t ret=eeFs.freeList;
if(ret){
@@ -114,7 +114,7 @@ static uint8_t EeFsAlloc(){ ///alloc one block from freelist
int8_t EeFsck()
{
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
s_sync_write = true;
#endif
@@ -156,7 +156,7 @@ int8_t EeFsck()
}
}
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
s_sync_write = false;
#endif
return ret;
@@ -164,7 +164,7 @@ int8_t EeFsck()
void EeFsFormat()
{
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
s_sync_write = true;
#endif
if(sizeof(eeFs) != RESV){
@@ -180,7 +180,7 @@ void EeFsFormat()
EeFsSetLink(BLOCKS-1, 0);
eeFs.freeList = FIRSTBLK;
EeFsFlush();
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
s_sync_write = false;
#endif
}
@@ -211,7 +211,7 @@ void EFile::swap(uint8_t i_fileId1, uint8_t i_fileId2)
void EFile::rm(uint8_t i_fileId)
{
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
s_sync_write = true;
#endif
uint8_t i = eeFs.files[i_fileId].startBlk;
@@ -219,7 +219,7 @@ void EFile::rm(uint8_t i_fileId)
EeFsFlush(); //chained out
if(i) EeFsFree( i ); //chain in
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
s_sync_write = false;
#endif
}
@@ -312,7 +312,7 @@ uint16_t RlcFile::readRlc(uint8_t*buf,uint16_t i_len)
return i;
}
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
void RlcFile::write1(uint8_t b)
{
@@ -452,7 +452,7 @@ uint8_t RlcFile::write(uint8_t*buf, uint8_t i_len)
#endif
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
void RlcFile::create(uint8_t i_fileId, uint8_t typ, uint8_t sync_write)
{
@@ -663,7 +663,7 @@ void RlcFile::close()
if(m_currBlk && ( fri = EeFsGetLink(m_currBlk))) EeFsSetLink(m_currBlk, 0);
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
eeFs.files[FILE_TMP].size = m_pos;
EFile::swap(m_fileId, FILE_TMP);
#else
@@ -673,7 +673,7 @@ void RlcFile::close()
if(fri) EeFsFree( fri ); //chain in
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
m_write_step = 0;
s_sync_write = false;
#endif
+4 -4
View File
@@ -47,7 +47,7 @@ int8_t EeFsck();
void EeFsFormat();
uint16_t EeFsGetFree();
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
extern volatile size_t eeprom_buffer_size;
#endif
@@ -82,7 +82,7 @@ class EFile
#define ERR_NONE 0
#define ERR_FULL 1
#ifndef ASYNC_WRITE
#ifndef EEPROM_ASYNC_WRITE
#define ERR_TMO 2
#endif
extern uint8_t s_write_err; // error reasons
@@ -96,7 +96,7 @@ class RlcFile: public EFile
uint8_t m_bRlc; // control byte for run length decoder
uint8_t m_zeroes;
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
uint8_t m_flags;
#define WRITE_FIRST_LINK 0x01
#define WRITE_NEXT_LINK_1 0x02
@@ -123,7 +123,7 @@ public:
void openRlc(uint8_t i_fileId);
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
void create(uint8_t i_fileId, uint8_t typ, uint8_t sync_write);
inline bool isWriting() { return m_write_step != 0; }
void write(uint8_t*buf, uint8_t i_len);
+2 -2
View File
@@ -1519,7 +1519,7 @@ void perMain()
}
sei();
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
if (!eeprom_buffer_size) {
if (theFile.isWriting())
theFile.nextWriteStep();
@@ -1548,7 +1548,7 @@ void perMain()
if (trimsCheckTimer > 0)
trimsCheckTimer -= 1;
#ifndef ASYNC_WRITE
#ifndef EEPROM_ASYNC_WRITE
eeCheck();
#endif
+1 -1
View File
@@ -25,7 +25,7 @@
#define VERS 1
#define SUB_VERS 2
#define ASYNC_WRITE
#define EEPROM_ASYNC_WRITE
#include <inttypes.h>
#include <string.h>
+2 -2
View File
@@ -156,11 +156,11 @@ void menuProcModelSelect(uint8_t event) // TODO lignes sur tout du long
break;
}
if(sel_editMode && subOld!=sub){
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
s_sync_write = true;
#endif
EFile::swap(FILE_MODEL(subOld),FILE_MODEL(sub));
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
s_sync_write = false;
#endif
}
+6 -6
View File
@@ -302,7 +302,7 @@ bool eeDuplicateModel(uint8_t id)
EFile theFile2;
theFile2.openRd(FILE_MODEL(id));
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
theFile.create(FILE_MODEL(i), FILE_TYP_MODEL, true);
#else
theFile.create(FILE_MODEL(i), FILE_TYP_MODEL, 600);
@@ -334,7 +334,7 @@ void eeReadAll()
generalDefault();
//alert(PSTR("default ok"));
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
theFile.writeRlc(FILE_GENERAL, FILE_TYP_GENERAL,(uint8_t*)&g_eeGeneral,sizeof(EEGeneral), true);
#else
uint16_t sz = theFile.writeRlc(FILE_GENERAL,FILE_TYP_GENERAL,(uint8_t*)&g_eeGeneral,sizeof(EEGeneral), 200);
@@ -343,7 +343,7 @@ void eeReadAll()
modelDefault(0);
//alert(PSTR("modef ok"));
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
theFile.writeRlc(FILE_MODEL(0), FILE_TYP_MODEL, (uint8_t*)&g_model, sizeof(g_model), true);
#else
theFile.writeRlc(FILE_MODEL(0), FILE_TYP_MODEL, (uint8_t*)&g_model, sizeof(g_model),200);
@@ -356,14 +356,14 @@ void eeReadAll()
uint8_t s_eeDirtyMsk;
#ifndef ASYNC_WRITE
#ifndef EEPROM_ASYNC_WRITE
static uint16_t s_eeDirtyTime10ms;
#define WRITE_DELAY_10MS 100
#endif
void eeDirty(uint8_t msk)
{
s_eeDirtyMsk |= msk;
#ifndef ASYNC_WRITE
#ifndef EEPROM_ASYNC_WRITE
if (msk)
s_eeDirtyTime10ms = get_tmr10ms();
#endif
@@ -371,7 +371,7 @@ void eeDirty(uint8_t msk)
void eeCheck(bool immediately)
{
#ifdef ASYNC_WRITE
#ifdef EEPROM_ASYNC_WRITE
if (immediately) {
theFile.flush();
}