annotate Discovery/Inc/externLogbookFlash.h @ 138:cc9c18075e00 FlipDisplay

Removed no longer supported scooter code
author Ideenmodellierer
date Sat, 23 Feb 2019 21:10:51 +0100
parents 5f11787b4f42
children 1b9847d40e81
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 /// -*- coding: UTF-8 -*-
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 /// \file Discovery/Inc/externLogbookFlash.h
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Header File to access the new 1.8 Volt Spansion S25FS256S 256 Mbit (32 Mbyte)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 07-Aug-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 /// $Id$
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 /// This program is free software: you can redistribute it and/or modify
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 /// it under the terms of the GNU General Public License as published by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 /// the Free Software Foundation, either version 3 of the License, or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /// (at your option) any later version.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 /// This program is distributed in the hope that it will be useful,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 /// GNU General Public License for more details.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 /// You should have received a copy of the GNU General Public License
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 //////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 /* Define to prevent recursive inclusion -------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 #ifndef EXTERN_LOGBOOK_FLASH_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 #define EXTERN_LOGBOOK_FLASH_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 #include "logbook.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 /* Exported variables --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 /* 4 KB
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 * one for the basics like min./max. temperature, max. depth, charge cycles
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 * after that two or more 0for settings (less than one necessary as of 26. March 2015)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 #define DDSTART 0x00000000
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 #define DDSTOP 0x00000FFF
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 #define unused1START 0x00001000
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 #define unused1STOP 0x00007FFF
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 /* 32 KB */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 #define unused2START 0x00008000
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 #define unused2STOP 0x0000FFFF
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 /* 64 KB
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 * 001x used for settings
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 * 001x used for VPM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 * 005x unused
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 * 008x for header (0.5 MB)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 * 192x for samples (12 MB)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 * 016x for firmware ( 1 MB)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 * 032x for firmware2 ( 2 MB)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 #define SETTINGSSTART 0x00010000
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 #define SETTINGSSTOP 0x0001FFFF
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 #define VPMSTART 0x00020000
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 #define VPMSTOP 0x0002FFFF
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 #define unused3START 0x00030000
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 #define unused3STOP 0x0007FFFF
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 #define HEADERSTART 0x00080000
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 #define HEADERSTOP 0x000FFFFF
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 #define SAMPLESTART 0x00100000
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 #define SAMPLESTOP 0x00CFFFFF
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 #define FWSTART 0x00D00000
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 #define FWSTOP 0x00DFFFFF
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 #define FWSTART2 0x00E00000
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 #define FWSTOP2 0x00FFFFFF
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 /* 16 MB with 4 Byte addressing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 #define unused4START 0x01000000
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 #define unused4STOP 0x01FFFFFF
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 #define HEADERSIZE sizeof(SLogbookHeader)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 #define HEADERSIZEOSTC3 sizeof(SLogbookHeaderOSTC3)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 /* Exported types ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 typedef struct{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 uint8_t byteLow;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 uint8_t byteMidLow;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 uint8_t byteMidHigh;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 uint8_t byteHigh;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 } addressToByte_t;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 typedef struct{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 uint8_t byteLow;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 uint8_t byteHigh;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 } WordToByte_t;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 typedef union{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 addressToByte_t u8bit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 uint32_t u32bit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 } convert_Type;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 typedef union{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 WordToByte_t u8bit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 uint16_t u16bit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 } convert16_Type;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 void ext_flash_write_settings(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 uint8_t ext_flash_read_settings(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 void ext_flash_write_devicedata(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 uint16_t ext_flash_read_devicedata(uint8_t *buffer, uint16_t max_length);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 void ext_flash_read_fixed_16_devicedata_blocks_formated_128byte_total(uint8_t *buffer);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 #ifndef BOOTLOADER_STANDALONE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 void ext_flash_write_vpm(SVpm *vpmInput);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 int ext_flash_read_vpm(SVpm *vpmOutput);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 void ext_flash_start_new_dive_log_and_set_actualPointerSample(uint8_t *pHeaderPreDive);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 void ext_flash_create_new_dive_log(uint8_t *pHeaderPreDive);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 void ext_flash_close_new_dive_log(uint8_t *pHeaderPostDive);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 void ext_flash_write_sample(uint8_t *pSample, uint16_t length);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 uint8_t ext_flash_count_dive_headers(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 void ext_flash_read_dive_header(uint8_t *pHeaderToFill, uint8_t StepBackwards);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 void ext_flash_read_dive_header2(uint8_t *pHeaderToFill, uint8_t id, _Bool bOffset);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 void ext_flash_open_read_sample(uint8_t StepBackwards, uint32_t *totalNumberOfBytes);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 void ext_flash_read_next_sample_part(uint8_t *pSample, uint8_t length);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 void ext_flash_close_read_sample(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 void ext_flash_set_entry_point(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 void ext_flash_reopen_read_sample_at_entry_point(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 void ext_flash_write_dive_raw_with_double_header_1K(uint8_t *data, uint32_t length);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 uint32_t ext_flash_read_dive_raw_with_double_header_1K(uint8_t *data, uint32_t max_size, uint8_t StepBackwards);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 void ext_flash_read_header_memory(uint8_t *data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 void ext_flash_write_header_memory(uint8_t *data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 void ext_flash_erase_logbook(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 void ext_flash_erase_chip(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 void ext_flash_erase_firmware(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 void ext_flash_erase_firmware2(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 void ext_flash_disable_protection_for_logbook(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 void ext_flash_enable_protection(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 void ext_flash_read_block_start(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 void ext_flash_repair_dive_log(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 void ext_flash_find_start(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 uint8_t ext_flash_erase_firmware_if_not_empty(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 uint8_t ext_flash_erase_firmware2_if_not_empty(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 void ext_flash_write_firmware(uint8_t *pSample1, uint32_t length1);//,uint8_t *pSample2, uint32_t length2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 uint32_t ext_flash_read_firmware(uint8_t *pSample1, uint32_t max_length, uint8_t *magicByte);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 uint8_t ext_flash_read_firmware_version(char *text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 void ext_flash_write_firmware2(uint32_t offset, uint8_t *pSample1, uint32_t length1,uint8_t *pSample2, uint32_t length2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 uint32_t ext_flash_read_firmware2(uint32_t *offset, uint8_t *pSample1, uint32_t max_length1, uint8_t *pSample2, uint32_t max_length2);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 uint16_t ext_flash_repair_SPECIAL_dive_numbers_starting_count_with(uint16_t startCount);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 #endif /* EXTERN_LOGBOOK_FLASH_H */