Mercurial > public > ostc4
annotate Discovery/Inc/externLogbookFlash.h @ 1043:52fd91414b6c GasConsumption
Improvments scrubber timer:
The scrubbertime in the CCR sumary view was not right aligned. This has been changed => the line matches the layout of the other lines. In addition the scrubber display mode was not visible after opening the scrubber menu because its drawing was depending on a function parameter which was not set by the open function.
| author | Ideenmodellierer |
|---|---|
| date | Mon, 27 Oct 2025 20:09:23 +0100 |
| parents | 158100a84ebd |
| children |
| rev | line source |
|---|---|
| 38 | 1 /////////////////////////////////////////////////////////////////////////////// |
| 2 /// -*- coding: UTF-8 -*- | |
| 3 /// | |
| 4 /// \file Discovery/Inc/externLogbookFlash.h | |
| 5 /// \brief Header File to access the new 1.8 Volt Spansion S25FS256S 256 Mbit (32 Mbyte) | |
| 6 /// \author heinrichs weikamp gmbh | |
| 7 /// \date 07-Aug-2014 | |
| 8 /// | |
| 9 /// $Id$ | |
| 10 /////////////////////////////////////////////////////////////////////////////// | |
| 11 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
| 12 /// | |
| 13 /// This program is free software: you can redistribute it and/or modify | |
| 14 /// it under the terms of the GNU General Public License as published by | |
| 15 /// the Free Software Foundation, either version 3 of the License, or | |
| 16 /// (at your option) any later version. | |
| 17 /// | |
| 18 /// This program is distributed in the hope that it will be useful, | |
| 19 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 20 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 21 /// GNU General Public License for more details. | |
| 22 /// | |
| 23 /// You should have received a copy of the GNU General Public License | |
| 24 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 25 ////////////////////////////////////////////////////////////////////////////// | |
| 26 | |
| 27 /* Define to prevent recursive inclusion -------------------------------------*/ | |
| 28 #ifndef EXTERN_LOGBOOK_FLASH_H | |
| 29 #define EXTERN_LOGBOOK_FLASH_H | |
| 30 | |
| 31 /* Includes ------------------------------------------------------------------*/ | |
| 32 #include "stm32f4xx_hal.h" | |
| 33 #include "logbook.h" | |
| 34 | |
| 35 /* Exported variables --------------------------------------------------------*/ | |
| 36 | |
| 37 /* 4 KB | |
| 38 * one for the basics like min./max. temperature, max. depth, charge cycles | |
| 39 * after that two or more 0for settings (less than one necessary as of 26. March 2015) | |
| 40 * | |
| 41 */ | |
| 42 #define DDSTART 0x00000000 | |
| 43 #define DDSTOP 0x00000FFF | |
| 1027 | 44 |
| 45 #define PROFILE0_START 0x00001000 /* store profiles within one 4k sector because they are always read / written as one block */ | |
| 46 #define PROFILE0_STOP 0x000013FF /* no ring functionality is implemented because changes are not expected very often */ | |
| 47 #define PROFILE1_START 0x00001400 | |
| 48 #define PROFILE1_STOP 0x000017FF | |
| 49 #define PROFILE2_START 0x00001800 | |
| 50 #define PROFILE2_STOP 0x00001BFF | |
| 51 #define PROFILE3_START 0x00001C00 | |
| 52 #define PROFILE3_STOP 0x00001FFF | |
| 53 | |
| 54 #define unused1START 0x00002000 | |
| 38 | 55 #define unused1STOP 0x00007FFF |
| 56 | |
| 57 /* 32 KB */ | |
| 58 #define unused2START 0x00008000 | |
| 59 #define unused2STOP 0x0000FFFF | |
| 60 | |
| 61 /* 64 KB | |
| 62 * 001x used for settings | |
| 63 * 001x used for VPM | |
| 64 * 005x unused | |
| 65 * 008x for header (0.5 MB) | |
| 66 * 192x for samples (12 MB) | |
| 67 * 016x for firmware ( 1 MB) | |
| 68 * 032x for firmware2 ( 2 MB) | |
| 69 */ | |
| 70 #define SETTINGSSTART 0x00010000 | |
| 71 #define SETTINGSSTOP 0x0001FFFF | |
|
425
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
72 #define VPMSTART 0x00020000 |
|
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
73 #define VPMSTOP 0x0002FFFF |
| 38 | 74 #define unused3START 0x00030000 |
| 75 #define unused3STOP 0x0007FFFF | |
| 76 #define HEADERSTART 0x00080000 | |
| 77 #define HEADERSTOP 0x000FFFFF | |
| 78 #define SAMPLESTART 0x00100000 | |
| 79 #define SAMPLESTOP 0x00CFFFFF | |
|
425
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
80 #define FWSTART 0x00D00000 |
|
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
81 #define FWSTOP 0x00DFFFFF |
|
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
82 #define FWSTART2 0x00E00000 |
|
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
83 #define FWSTOP2 0x00FFFFFF |
| 38 | 84 /* 16 MB with 4 Byte addressing */ |
| 85 #define unused4START 0x01000000 | |
| 86 #define unused4STOP 0x01FFFFFF | |
| 87 | |
| 88 #define HEADERSIZE sizeof(SLogbookHeader) | |
| 89 #define HEADERSIZEOSTC3 sizeof(SLogbookHeaderOSTC3) | |
| 90 | |
|
425
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
91 /* Sample ring buffer sector states derived from the usage at begin and end of a sector */ |
|
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
92 #define SECTOR_CLOSED (0) |
|
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
93 #define SECTOR_NOTUSED (1) |
|
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
94 #define SECTOR_INUSE (4) |
|
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
95 #define SECTOR_EMPTY (5) |
|
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
96 |
| 1027 | 97 |
| 98 typedef enum{ | |
| 99 EF_HEADER, | |
| 100 EF_SAMPLE, | |
| 101 EF_DEVICEDATA, | |
| 102 EF_VPMDATA, | |
| 103 EF_SETTINGS, | |
| 104 EF_FIRMWARE, | |
| 105 EF_FIRMWARE2, | |
| 106 EF_PROFILE0, | |
| 107 EF_PROFILE1, | |
| 108 EF_PROFILE2, | |
| 109 EF_PROFILE3, | |
| 110 }which_ring_enum; | |
| 111 | |
| 112 | |
| 38 | 113 /* Exported types ------------------------------------------------------------*/ |
| 114 typedef struct{ | |
| 115 uint8_t byteLow; | |
| 116 uint8_t byteMidLow; | |
| 117 uint8_t byteMidHigh; | |
| 118 uint8_t byteHigh; | |
| 119 } addressToByte_t; | |
| 120 | |
| 121 typedef struct{ | |
| 122 uint8_t byteLow; | |
| 123 uint8_t byteHigh; | |
| 124 } WordToByte_t; | |
| 125 | |
| 126 typedef union{ | |
| 127 addressToByte_t u8bit; | |
| 128 uint32_t u32bit; | |
| 129 } convert_Type; | |
| 130 | |
| 131 typedef union{ | |
| 132 WordToByte_t u8bit; | |
| 133 uint16_t u16bit; | |
| 134 } convert16_Type; | |
| 135 | |
| 136 /* Exported functions --------------------------------------------------------*/ | |
| 1027 | 137 void ext_flash_write_settings(uint8_t whichSettings, uint8_t resetRing); |
| 138 uint8_t ext_flash_read_settings(uint8_t whichSettings); | |
| 38 | 139 |
|
421
3f7d80f37bfc
Enable sequentionel writing of device data:
ideenmodellierer
parents:
268
diff
changeset
|
140 void ext_flash_write_devicedata(uint8_t resetRing); |
| 38 | 141 uint16_t ext_flash_read_devicedata(uint8_t *buffer, uint16_t max_length); |
| 142 void ext_flash_read_fixed_16_devicedata_blocks_formated_128byte_total(uint8_t *buffer); | |
| 143 | |
| 144 #ifndef BOOTLOADER_STANDALONE | |
| 145 void ext_flash_write_vpm(SVpm *vpmInput); | |
| 146 int ext_flash_read_vpm(SVpm *vpmOutput); | |
| 147 #endif | |
| 148 | |
| 149 void ext_flash_start_new_dive_log_and_set_actualPointerSample(uint8_t *pHeaderPreDive); | |
| 150 void ext_flash_create_new_dive_log(uint8_t *pHeaderPreDive); | |
| 151 void ext_flash_close_new_dive_log(uint8_t *pHeaderPostDive); | |
| 152 | |
| 153 void ext_flash_write_sample(uint8_t *pSample, uint16_t length); | |
| 154 | |
| 155 uint8_t ext_flash_count_dive_headers(void); | |
| 156 void ext_flash_read_dive_header(uint8_t *pHeaderToFill, uint8_t StepBackwards); | |
| 157 void ext_flash_read_dive_header2(uint8_t *pHeaderToFill, uint8_t id, _Bool bOffset); | |
| 158 void ext_flash_open_read_sample(uint8_t StepBackwards, uint32_t *totalNumberOfBytes); | |
| 159 void ext_flash_read_next_sample_part(uint8_t *pSample, uint8_t length); | |
| 160 void ext_flash_close_read_sample(void); | |
| 161 void ext_flash_set_entry_point(void); | |
| 162 void ext_flash_reopen_read_sample_at_entry_point(void); | |
| 163 | |
| 164 void ext_flash_write_dive_raw_with_double_header_1K(uint8_t *data, uint32_t length); | |
| 165 uint32_t ext_flash_read_dive_raw_with_double_header_1K(uint8_t *data, uint32_t max_size, uint8_t StepBackwards); | |
| 166 | |
| 167 void ext_flash_read_header_memory(uint8_t *data); | |
| 168 void ext_flash_write_header_memory(uint8_t *data); | |
| 169 | |
| 463 | 170 void ext_flash_read_sample_memory(uint8_t *data,uint16_t blockId); |
| 171 void ext_flash_write_sample_memory(uint8_t *data,uint16_t blockId); | |
| 172 | |
| 38 | 173 void ext_flash_erase_logbook(void); |
| 174 void ext_flash_erase_chip(void); | |
| 175 void ext_flash_erase_firmware(void); | |
| 176 void ext_flash_erase_firmware2(void); | |
| 177 void ext_flash_disable_protection_for_logbook(void); | |
| 178 void ext_flash_enable_protection(void); | |
| 179 | |
| 180 void ext_flash_read_block_start(void); | |
|
453
1c0b911c367f
Added compile variant enabling the reset of profile sample information:
ideenmodellierer
parents:
428
diff
changeset
|
181 uint8_t ext_dive_log_consistent(void); |
| 38 | 182 void ext_flash_repair_dive_log(void); |
| 183 | |
| 184 uint8_t ext_flash_erase_firmware_if_not_empty(void); | |
| 185 uint8_t ext_flash_erase_firmware2_if_not_empty(void); | |
| 186 void ext_flash_write_firmware(uint8_t *pSample1, uint32_t length1);//,uint8_t *pSample2, uint32_t length2); | |
| 187 uint32_t ext_flash_read_firmware(uint8_t *pSample1, uint32_t max_length, uint8_t *magicByte); | |
| 188 uint8_t ext_flash_read_firmware_version(char *text); | |
| 189 | |
| 190 void ext_flash_write_firmware2(uint32_t offset, uint8_t *pSample1, uint32_t length1,uint8_t *pSample2, uint32_t length2); | |
| 191 uint32_t ext_flash_read_firmware2(uint32_t *offset, uint8_t *pSample1, uint32_t max_length1, uint8_t *pSample2, uint32_t max_length2); | |
| 192 | |
| 193 uint16_t ext_flash_repair_SPECIAL_dive_numbers_starting_count_with(uint16_t startCount); | |
| 194 | |
|
556
eb2060caca7d
Switch source of o2 sensor data depending on availability of external ADC:
Ideenmodellierer
parents:
466
diff
changeset
|
195 uint32_t ext_flash_AnalyseSampleBuffer(void); |
|
425
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
196 void ext_flash_CloseSector(void); |
|
466
538eb1c976e9
Removed invalidate header function because it is no lonnger needed
ideenmodellierer
parents:
463
diff
changeset
|
197 |
|
538eb1c976e9
Removed invalidate header function because it is no lonnger needed
ideenmodellierer
parents:
463
diff
changeset
|
198 uint32_t ext_flash_read_profilelength_small_header(uint32_t smallHeaderAddr); |
|
538eb1c976e9
Removed invalidate header function because it is no lonnger needed
ideenmodellierer
parents:
463
diff
changeset
|
199 uint8_t ext_flash_SampleOverrunValid(void); |
|
538eb1c976e9
Removed invalidate header function because it is no lonnger needed
ideenmodellierer
parents:
463
diff
changeset
|
200 |
|
425
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
201 |
| 38 | 202 #endif /* EXTERN_LOGBOOK_FLASH_H */ |
