Re: How to prevent databse from being overwritten in xmem after a power cycle?

"[email protected] [rabbit-semi]" <[email protected]> 07 Aug 2015 10:55:58 -0700
Newsgroups gmane.comp.hardware.rabbit-semiconductor
Message-ID <[email protected]>
Hi Peter,

Thanks for the information.  If understand you correctly, are you saying I could allocated array struct in xmem that are back-up battery by simply using 'bbram far'?  For example: 

bbram far TL_DATA_REC Logs[TL_DEFAULT_LOGS]

assuming that I redefine FAT file system buffer such as: 

#define FAT_MAXBUFS 0

And If I want to write values to the struct, I could use:
xsetlong(Logs + sizeof(TL_DATA_REC) * index + offsetof(TL_DATA_REC, long_variable), long_value);
xsetchar(...)
xsetint(...)


To read:
long_variable = xgetlong(Logs + sizeof(TL_DATA_REC) * index + offsetof(TL_DATA_REC, long_value));
char_variable = xgetchar(....)
int_variable = xgetint(...)
float_variable = xgetlong(...)