Mercurial > public > ostc4
annotate Discovery/Inc/externLogbookFlash.h @ 831:da632300e7d4 Evo_2_23
Activated work gas for (p)scr mode:
In previous version setting of change depth for work (travel) gases was not possible. For (p)scr operation this is not possible. Work gases will not be considered for deco calculation. In addition the first gas will be handled as "deco" gas. This allows switching back to the first gas in case the current gas becomes no longer breathable (ppo2 low).
author | Ideenmodellierer |
---|---|
date | Thu, 16 Nov 2023 20:36:35 +0100 |
parents | eb2060caca7d |
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 | |
44 #define unused1START 0x00001000 | |
45 #define unused1STOP 0x00007FFF | |
46 | |
47 /* 32 KB */ | |
48 #define unused2START 0x00008000 | |
49 #define unused2STOP 0x0000FFFF | |
50 | |
51 /* 64 KB | |
52 * 001x used for settings | |
53 * 001x used for VPM | |
54 * 005x unused | |
55 * 008x for header (0.5 MB) | |
56 * 192x for samples (12 MB) | |
57 * 016x for firmware ( 1 MB) | |
58 * 032x for firmware2 ( 2 MB) | |
59 */ | |
60 #define SETTINGSSTART 0x00010000 | |
61 #define SETTINGSSTOP 0x0001FFFF | |
425
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
62 #define VPMSTART 0x00020000 |
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
63 #define VPMSTOP 0x0002FFFF |
38 | 64 #define unused3START 0x00030000 |
65 #define unused3STOP 0x0007FFFF | |
66 #define HEADERSTART 0x00080000 | |
67 #define HEADERSTOP 0x000FFFFF | |
68 #define SAMPLESTART 0x00100000 | |
69 #define SAMPLESTOP 0x00CFFFFF | |
425
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
70 #define FWSTART 0x00D00000 |
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
71 #define FWSTOP 0x00DFFFFF |
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
72 #define FWSTART2 0x00E00000 |
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
73 #define FWSTOP2 0x00FFFFFF |
38 | 74 /* 16 MB with 4 Byte addressing */ |
75 #define unused4START 0x01000000 | |
76 #define unused4STOP 0x01FFFFFF | |
77 | |
78 #define HEADERSIZE sizeof(SLogbookHeader) | |
79 #define HEADERSIZEOSTC3 sizeof(SLogbookHeaderOSTC3) | |
80 | |
425
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
81 /* 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
|
82 #define SECTOR_CLOSED (0) |
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
83 #define SECTOR_NOTUSED (1) |
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
84 #define SECTOR_INUSE (4) |
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
85 #define SECTOR_EMPTY (5) |
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
86 |
38 | 87 /* Exported types ------------------------------------------------------------*/ |
88 typedef struct{ | |
89 uint8_t byteLow; | |
90 uint8_t byteMidLow; | |
91 uint8_t byteMidHigh; | |
92 uint8_t byteHigh; | |
93 } addressToByte_t; | |
94 | |
95 typedef struct{ | |
96 uint8_t byteLow; | |
97 uint8_t byteHigh; | |
98 } WordToByte_t; | |
99 | |
100 typedef union{ | |
101 addressToByte_t u8bit; | |
102 uint32_t u32bit; | |
103 } convert_Type; | |
104 | |
105 typedef union{ | |
106 WordToByte_t u8bit; | |
107 uint16_t u16bit; | |
108 } convert16_Type; | |
109 | |
110 /* Exported functions --------------------------------------------------------*/ | |
428 | 111 void ext_flash_write_settings(uint8_t resetRing); |
38 | 112 uint8_t ext_flash_read_settings(void); |
113 | |
421
3f7d80f37bfc
Enable sequentionel writing of device data:
ideenmodellierer
parents:
268
diff
changeset
|
114 void ext_flash_write_devicedata(uint8_t resetRing); |
38 | 115 uint16_t ext_flash_read_devicedata(uint8_t *buffer, uint16_t max_length); |
116 void ext_flash_read_fixed_16_devicedata_blocks_formated_128byte_total(uint8_t *buffer); | |
117 | |
118 #ifndef BOOTLOADER_STANDALONE | |
119 void ext_flash_write_vpm(SVpm *vpmInput); | |
120 int ext_flash_read_vpm(SVpm *vpmOutput); | |
121 #endif | |
122 | |
123 void ext_flash_start_new_dive_log_and_set_actualPointerSample(uint8_t *pHeaderPreDive); | |
124 void ext_flash_create_new_dive_log(uint8_t *pHeaderPreDive); | |
125 void ext_flash_close_new_dive_log(uint8_t *pHeaderPostDive); | |
126 | |
127 void ext_flash_write_sample(uint8_t *pSample, uint16_t length); | |
128 | |
129 uint8_t ext_flash_count_dive_headers(void); | |
130 void ext_flash_read_dive_header(uint8_t *pHeaderToFill, uint8_t StepBackwards); | |
131 void ext_flash_read_dive_header2(uint8_t *pHeaderToFill, uint8_t id, _Bool bOffset); | |
132 void ext_flash_open_read_sample(uint8_t StepBackwards, uint32_t *totalNumberOfBytes); | |
133 void ext_flash_read_next_sample_part(uint8_t *pSample, uint8_t length); | |
134 void ext_flash_close_read_sample(void); | |
135 void ext_flash_set_entry_point(void); | |
136 void ext_flash_reopen_read_sample_at_entry_point(void); | |
137 | |
138 void ext_flash_write_dive_raw_with_double_header_1K(uint8_t *data, uint32_t length); | |
139 uint32_t ext_flash_read_dive_raw_with_double_header_1K(uint8_t *data, uint32_t max_size, uint8_t StepBackwards); | |
140 | |
141 void ext_flash_read_header_memory(uint8_t *data); | |
142 void ext_flash_write_header_memory(uint8_t *data); | |
143 | |
463 | 144 void ext_flash_read_sample_memory(uint8_t *data,uint16_t blockId); |
145 void ext_flash_write_sample_memory(uint8_t *data,uint16_t blockId); | |
146 | |
38 | 147 void ext_flash_erase_logbook(void); |
148 void ext_flash_erase_chip(void); | |
149 void ext_flash_erase_firmware(void); | |
150 void ext_flash_erase_firmware2(void); | |
151 void ext_flash_disable_protection_for_logbook(void); | |
152 void ext_flash_enable_protection(void); | |
153 | |
154 void ext_flash_read_block_start(void); | |
453
1c0b911c367f
Added compile variant enabling the reset of profile sample information:
ideenmodellierer
parents:
428
diff
changeset
|
155 uint8_t ext_dive_log_consistent(void); |
38 | 156 void ext_flash_repair_dive_log(void); |
157 | |
158 uint8_t ext_flash_erase_firmware_if_not_empty(void); | |
159 uint8_t ext_flash_erase_firmware2_if_not_empty(void); | |
160 void ext_flash_write_firmware(uint8_t *pSample1, uint32_t length1);//,uint8_t *pSample2, uint32_t length2); | |
161 uint32_t ext_flash_read_firmware(uint8_t *pSample1, uint32_t max_length, uint8_t *magicByte); | |
162 uint8_t ext_flash_read_firmware_version(char *text); | |
163 | |
164 void ext_flash_write_firmware2(uint32_t offset, uint8_t *pSample1, uint32_t length1,uint8_t *pSample2, uint32_t length2); | |
165 uint32_t ext_flash_read_firmware2(uint32_t *offset, uint8_t *pSample1, uint32_t max_length1, uint8_t *pSample2, uint32_t max_length2); | |
166 | |
167 uint16_t ext_flash_repair_SPECIAL_dive_numbers_starting_count_with(uint16_t startCount); | |
168 | |
556
eb2060caca7d
Switch source of o2 sensor data depending on availability of external ADC:
Ideenmodellierer
parents:
466
diff
changeset
|
169 uint32_t ext_flash_AnalyseSampleBuffer(void); |
425
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
170 void ext_flash_CloseSector(void); |
466
538eb1c976e9
Removed invalidate header function because it is no lonnger needed
ideenmodellierer
parents:
463
diff
changeset
|
171 |
538eb1c976e9
Removed invalidate header function because it is no lonnger needed
ideenmodellierer
parents:
463
diff
changeset
|
172 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
|
173 uint8_t ext_flash_SampleOverrunValid(void); |
538eb1c976e9
Removed invalidate header function because it is no lonnger needed
ideenmodellierer
parents:
463
diff
changeset
|
174 |
425
86fcac4cc43a
Added function to analyse the sampel ringbuffer:
ideenmodellierer
parents:
421
diff
changeset
|
175 |
38 | 176 #endif /* EXTERN_LOGBOOK_FLASH_H */ |