comparison 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
comparison
equal deleted inserted replaced
424:2b31cf1ebbcc 425:86fcac4cc43a
57 * 016x for firmware ( 1 MB) 57 * 016x for firmware ( 1 MB)
58 * 032x for firmware2 ( 2 MB) 58 * 032x for firmware2 ( 2 MB)
59 */ 59 */
60 #define SETTINGSSTART 0x00010000 60 #define SETTINGSSTART 0x00010000
61 #define SETTINGSSTOP 0x0001FFFF 61 #define SETTINGSSTOP 0x0001FFFF
62 #define VPMSTART 0x00020000 62 #define VPMSTART 0x00020000
63 #define VPMSTOP 0x0002FFFF 63 #define VPMSTOP 0x0002FFFF
64 #define unused3START 0x00030000 64 #define unused3START 0x00030000
65 #define unused3STOP 0x0007FFFF 65 #define unused3STOP 0x0007FFFF
66 #define HEADERSTART 0x00080000 66 #define HEADERSTART 0x00080000
67 #define HEADERSTOP 0x000FFFFF 67 #define HEADERSTOP 0x000FFFFF
68 #define SAMPLESTART 0x00100000 68 #define SAMPLESTART 0x00100000
69 #define SAMPLESTOP 0x00CFFFFF 69 #define SAMPLESTOP 0x00CFFFFF
70 #define FWSTART 0x00D00000 70 #define FWSTART 0x00D00000
71 #define FWSTOP 0x00DFFFFF 71 #define FWSTOP 0x00DFFFFF
72 #define FWSTART2 0x00E00000 72 #define FWSTART2 0x00E00000
73 #define FWSTOP2 0x00FFFFFF 73 #define FWSTOP2 0x00FFFFFF
74 /* 16 MB with 4 Byte addressing */ 74 /* 16 MB with 4 Byte addressing */
75 #define unused4START 0x01000000 75 #define unused4START 0x01000000
76 #define unused4STOP 0x01FFFFFF 76 #define unused4STOP 0x01FFFFFF
77 77
78 #define HEADERSIZE sizeof(SLogbookHeader) 78 #define HEADERSIZE sizeof(SLogbookHeader)
79 #define HEADERSIZEOSTC3 sizeof(SLogbookHeaderOSTC3) 79 #define HEADERSIZEOSTC3 sizeof(SLogbookHeaderOSTC3)
80
81 /* Sample ring buffer sector states derived from the usage at begin and end of a sector */
82 #define SECTOR_CLOSED (0)
83 #define SECTOR_NOTUSED (1)
84 #define SECTOR_INUSE (4)
85 #define SECTOR_EMPTY (5)
80 86
81 /* Exported types ------------------------------------------------------------*/ 87 /* Exported types ------------------------------------------------------------*/
82 typedef struct{ 88 typedef struct{
83 uint8_t byteLow; 89 uint8_t byteLow;
84 uint8_t byteMidLow; 90 uint8_t byteMidLow;
155 void ext_flash_write_firmware2(uint32_t offset, uint8_t *pSample1, uint32_t length1,uint8_t *pSample2, uint32_t length2); 161 void ext_flash_write_firmware2(uint32_t offset, uint8_t *pSample1, uint32_t length1,uint8_t *pSample2, uint32_t length2);
156 uint32_t ext_flash_read_firmware2(uint32_t *offset, uint8_t *pSample1, uint32_t max_length1, uint8_t *pSample2, uint32_t max_length2); 162 uint32_t ext_flash_read_firmware2(uint32_t *offset, uint8_t *pSample1, uint32_t max_length1, uint8_t *pSample2, uint32_t max_length2);
157 163
158 uint16_t ext_flash_repair_SPECIAL_dive_numbers_starting_count_with(uint16_t startCount); 164 uint16_t ext_flash_repair_SPECIAL_dive_numbers_starting_count_with(uint16_t startCount);
159 165
166 uint32_t ext_flash_AnalyseSampleBuffer(char *pstrResult);
167 void ext_flash_CloseSector(void);
168
160 #endif /* EXTERN_LOGBOOK_FLASH_H */ 169 #endif /* EXTERN_LOGBOOK_FLASH_H */