Mercurial > public > ostc4
diff Discovery/Inc/externLogbookFlash.h @ 425:86fcac4cc43a ImprovmentNVM_2
Added function to analyse the sampel ringbuffer:
The function will show 0 for used sectors, 4 for the sector currently in use and 5 for empty sectors. This allows identification of log sample index position and identification of a buffer corruption (more than 2 sectors have state 4)
The repair function writes dummy bytes to the end of the active buffer with the lower sector number. This decision is based on the fact that corruption results typically in a reset of index to buffer start address. After repair the writing will be continued using the hugher buffer marked as used.
author | ideenmodellierer |
---|---|
date | Sat, 15 Feb 2020 20:50:20 +0100 |
parents | 3f7d80f37bfc |
children | 0e5341951079 |
line wrap: on
line diff
--- a/Discovery/Inc/externLogbookFlash.h Sat Feb 15 20:45:19 2020 +0100 +++ b/Discovery/Inc/externLogbookFlash.h Sat Feb 15 20:50:20 2020 +0100 @@ -59,18 +59,18 @@ */ #define SETTINGSSTART 0x00010000 #define SETTINGSSTOP 0x0001FFFF -#define VPMSTART 0x00020000 -#define VPMSTOP 0x0002FFFF +#define VPMSTART 0x00020000 +#define VPMSTOP 0x0002FFFF #define unused3START 0x00030000 #define unused3STOP 0x0007FFFF #define HEADERSTART 0x00080000 #define HEADERSTOP 0x000FFFFF #define SAMPLESTART 0x00100000 #define SAMPLESTOP 0x00CFFFFF -#define FWSTART 0x00D00000 -#define FWSTOP 0x00DFFFFF -#define FWSTART2 0x00E00000 -#define FWSTOP2 0x00FFFFFF +#define FWSTART 0x00D00000 +#define FWSTOP 0x00DFFFFF +#define FWSTART2 0x00E00000 +#define FWSTOP2 0x00FFFFFF /* 16 MB with 4 Byte addressing */ #define unused4START 0x01000000 #define unused4STOP 0x01FFFFFF @@ -78,6 +78,12 @@ #define HEADERSIZE sizeof(SLogbookHeader) #define HEADERSIZEOSTC3 sizeof(SLogbookHeaderOSTC3) +/* Sample ring buffer sector states derived from the usage at begin and end of a sector */ +#define SECTOR_CLOSED (0) +#define SECTOR_NOTUSED (1) +#define SECTOR_INUSE (4) +#define SECTOR_EMPTY (5) + /* Exported types ------------------------------------------------------------*/ typedef struct{ uint8_t byteLow; @@ -157,4 +163,7 @@ uint16_t ext_flash_repair_SPECIAL_dive_numbers_starting_count_with(uint16_t startCount); +uint32_t ext_flash_AnalyseSampleBuffer(char *pstrResult); +void ext_flash_CloseSector(void); + #endif /* EXTERN_LOGBOOK_FLASH_H */