1 /* FreeEMS - the open source engine management system
3 * Copyright 2008-2012 Fred Cooke
5 * This file is part of the FreeEMS project.
7 * FreeEMS software is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * FreeEMS software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with any FreeEMS software. If not, see http://www.gnu.org/licenses/
20 * We ask that if you make any changes to this file you email them upstream to
21 * us at admin(at)diyefi(dot)org or, even better, fork the code on github.com!
23 * Thank you for choosing FreeEMS to run your engine!
29 * @ingroup communicationsFiles
31 * @brief Memory block details lookup
33 * This file holds the single function lookupBlockDetails() which
34 * functions as a sort of address book for logical blocks of memory.
40 #define BLOCK_DETAILS_LOOKUP_C
41 #include "inc/freeEMS.h"
42 #include "inc/interrupts.h"
43 #include "inc/locationIDs.h"
44 #include "inc/pagedLocationBuffers.h"
45 #include "inc/blockDetailsLookup.h"
48 /** @brief Lookup memory block details.
50 * Flash only blocks leave the RAM address and page values
51 * set to zero. ID's that don't exist leave all set to zero.
52 * Error handling is to be done externally based on that.
56 * @note This function is an exception to the style rule switch statement
57 * blocks of using a {} pair for each case statement. Readability is better
58 * without them in this case.
60 * @param locationID is the ID of the memory location for which details are required.
61 * @param details is a pointer to the blockDetails struct to populate with the details.
63 * @return An error code. Zero means success, anything else is a failure.
65 unsigned short lookupBlockDetails(unsigned short locationID
, blockDetails
* details
){
66 /* Initialise the four values needed for operations on memory at 0 for error checking */
68 details
->FlashPage
= 0;
69 details
->RAMAddress
= 0;
70 details
->FlashAddress
= 0;
72 /* Initialise the block size to 1024 to save code space and increase readability */
73 details
->size
= sizeof(mainTable
);
75 // No need to set parent value to zero as ignored unless flag set, done for clarity in hex stream.
78 /* Look up the locations and set non default sizes */
80 /* flash only fixed conf full blocks */
81 case FixedConfig1LocationID
:
82 details
->FlashPage
= PPAGE
;
83 details
->FlashAddress
= (void*)&fixedConfigs1
;
85 case FixedConfig2LocationID
:
86 details
->FlashPage
= PPAGE
;
87 details
->FlashAddress
= (void*)&fixedConfigs2
;
91 case IATTransferTableLocationID
:
92 details
->size
= sizeof(IATTransferTable
);
93 details
->FlashPage
= LOOKUP_PPAGE
;
94 details
->FlashAddress
= IATTransferTableLocation
;
96 case CHTTransferTableLocationID
:
97 details
->size
= sizeof(CHTTransferTable
);
98 details
->FlashPage
= LOOKUP_PPAGE
;
99 details
->FlashAddress
= CHTTransferTableLocation
;
101 case MAFTransferTableLocationID
:
102 details
->size
= sizeof(MAFTransferTable
);
103 details
->FlashPage
= LOOKUP_PPAGE
;
104 details
->FlashAddress
= MAFTransferTableLocation
;
106 case TestTransferTableLocationID
:
107 details
->size
= sizeof(TestTransferTable
);
108 details
->FlashPage
= LOOKUP_PPAGE
;
109 details
->FlashAddress
= TestTransferTableLocation
;
113 case VETableMainLocationID
:
114 details
->RAMPage
= RPAGE_FUEL_ONE
;
115 details
->FlashPage
= FUELTABLES_PPAGE
;
116 details
->RAMAddress
= (void*)&TablesA
;
117 details
->FlashAddress
= VETableMainFlashLocation
;
119 case VETableMain2LocationID
:
120 details
->RAMPage
= RPAGE_FUEL_TWO
;
121 details
->FlashPage
= FUELTABLES_PPAGE
;
122 details
->RAMAddress
= (void*)&TablesA
;
123 details
->FlashAddress
= VETableMainFlash2Location
;
125 case VETableSecondaryLocationID
:
126 details
->RAMPage
= RPAGE_FUEL_ONE
;
127 details
->FlashPage
= FUELTABLES_PPAGE
;
128 details
->RAMAddress
= (void*)&TablesB
;
129 details
->FlashAddress
= VETableSecondaryFlashLocation
;
131 case VETableSecondary2LocationID
:
132 details
->RAMPage
= RPAGE_FUEL_TWO
;
133 details
->FlashPage
= FUELTABLES_PPAGE
;
134 details
->RAMAddress
= (void*)&TablesB
;
135 details
->FlashAddress
= VETableSecondaryFlash2Location
;
137 case VETableTertiaryLocationID
:
138 details
->RAMPage
= RPAGE_FUEL_ONE
;
139 details
->FlashPage
= FUELTABLES_PPAGE
;
140 details
->RAMAddress
= (void*)&TablesC
;
141 details
->FlashAddress
= VETableTertiaryFlashLocation
;
143 case VETableTertiary2LocationID
:
144 details
->RAMPage
= RPAGE_FUEL_TWO
;
145 details
->FlashPage
= FUELTABLES_PPAGE
;
146 details
->RAMAddress
= (void*)&TablesC
;
147 details
->FlashAddress
= VETableTertiaryFlash2Location
;
149 case LambdaTableLocationID
:
150 details
->RAMPage
= RPAGE_FUEL_ONE
;
151 details
->FlashPage
= FUELTABLES_PPAGE
;
152 details
->RAMAddress
= (void*)&TablesD
;
153 details
->FlashAddress
= LambdaTableFlashLocation
;
155 case LambdaTable2LocationID
:
156 details
->RAMPage
= RPAGE_FUEL_TWO
;
157 details
->FlashPage
= FUELTABLES_PPAGE
;
158 details
->RAMAddress
= (void*)&TablesD
;
159 details
->FlashAddress
= LambdaTableFlash2Location
;
163 case IgnitionAdvanceTableMainLocationID
:
164 details
->RAMPage
= RPAGE_TIME_ONE
;
165 details
->FlashPage
= TIMETABLES_PPAGE
;
166 details
->RAMAddress
= (void*)&TablesA
;
167 details
->FlashAddress
= IgnitionAdvanceTableMainFlashLocation
;
169 case IgnitionAdvanceTableMain2LocationID
:
170 details
->RAMPage
= RPAGE_TIME_TWO
;
171 details
->FlashPage
= TIMETABLES_PPAGE
;
172 details
->RAMAddress
= (void*)&TablesA
;
173 details
->FlashAddress
= IgnitionAdvanceTableMainFlash2Location
;
175 case IgnitionAdvanceTableSecondaryLocationID
:
176 details
->RAMPage
= RPAGE_TIME_ONE
;
177 details
->FlashPage
= TIMETABLES_PPAGE
;
178 details
->RAMAddress
= (void*)&TablesB
;
179 details
->FlashAddress
= IgnitionAdvanceTableSecondaryFlashLocation
;
181 case IgnitionAdvanceTableSecondary2LocationID
:
182 details
->RAMPage
= RPAGE_TIME_TWO
;
183 details
->FlashPage
= TIMETABLES_PPAGE
;
184 details
->RAMAddress
= (void*)&TablesB
;
185 details
->FlashAddress
= IgnitionAdvanceTableSecondaryFlash2Location
;
187 case InjectionAdvanceTableMainLocationID
:
188 details
->RAMPage
= RPAGE_TIME_ONE
;
189 details
->FlashPage
= TIMETABLES_PPAGE
;
190 details
->RAMAddress
= (void*)&TablesC
;
191 details
->FlashAddress
= InjectionAdvanceTableMainFlashLocation
;
193 case InjectionAdvanceTableMain2LocationID
:
194 details
->RAMPage
= RPAGE_TIME_TWO
;
195 details
->FlashPage
= TIMETABLES_PPAGE
;
196 details
->RAMAddress
= (void*)&TablesC
;
197 details
->FlashAddress
= InjectionAdvanceTableMainFlash2Location
;
199 case InjectionAdvanceTableSecondaryLocationID
:
200 details
->RAMPage
= RPAGE_TIME_ONE
;
201 details
->FlashPage
= TIMETABLES_PPAGE
;
202 details
->RAMAddress
= (void*)&TablesD
;
203 details
->FlashAddress
= InjectionAdvanceTableSecondaryFlashLocation
;
205 case InjectionAdvanceTableSecondary2LocationID
:
206 details
->RAMPage
= RPAGE_TIME_TWO
;
207 details
->FlashPage
= TIMETABLES_PPAGE
;
208 details
->RAMAddress
= (void*)&TablesD
;
209 details
->FlashAddress
= InjectionAdvanceTableSecondaryFlash2Location
;
212 /* small table full blocks */
213 case SmallTablesALocationID
:
214 details
->RAMPage
= RPAGE_TUNE_ONE
;
215 details
->FlashPage
= TUNETABLES_PPAGE
;
216 details
->RAMAddress
= (void*)&TablesA
;
217 details
->FlashAddress
= SmallTablesAFlashLocation
;
219 case SmallTablesA2LocationID
:
220 details
->RAMPage
= RPAGE_TUNE_TWO
;
221 details
->FlashPage
= TUNETABLES_PPAGE
;
222 details
->RAMAddress
= (void*)&TablesA
;
223 details
->FlashAddress
= SmallTablesAFlash2Location
;
225 case SmallTablesBLocationID
:
226 details
->RAMPage
= RPAGE_TUNE_ONE
;
227 details
->FlashPage
= TUNETABLES_PPAGE
;
228 details
->RAMAddress
= (void*)&TablesB
;
229 details
->FlashAddress
= SmallTablesBFlashLocation
;
231 case SmallTablesB2LocationID
:
232 details
->RAMPage
= RPAGE_TUNE_TWO
;
233 details
->FlashPage
= TUNETABLES_PPAGE
;
234 details
->RAMAddress
= (void*)&TablesB
;
235 details
->FlashAddress
= SmallTablesBFlash2Location
;
237 case SmallTablesCLocationID
:
238 details
->RAMPage
= RPAGE_TUNE_ONE
;
239 details
->FlashPage
= TUNETABLES_PPAGE
;
240 details
->RAMAddress
= (void*)&TablesC
;
241 details
->FlashAddress
= SmallTablesCFlashLocation
;
243 case SmallTablesC2LocationID
:
244 details
->RAMPage
= RPAGE_TUNE_TWO
;
245 details
->FlashPage
= TUNETABLES_PPAGE
;
246 details
->RAMAddress
= (void*)&TablesC
;
247 details
->FlashAddress
= SmallTablesCFlash2Location
;
249 case SmallTablesDLocationID
:
250 details
->RAMPage
= RPAGE_TUNE_ONE
;
251 details
->FlashPage
= TUNETABLES_PPAGE
;
252 details
->RAMAddress
= (void*)&TablesD
;
253 details
->FlashAddress
= SmallTablesDFlashLocation
;
255 case SmallTablesD2LocationID
:
256 details
->RAMPage
= RPAGE_TUNE_TWO
;
257 details
->FlashPage
= TUNETABLES_PPAGE
;
258 details
->RAMAddress
= (void*)&TablesD
;
259 details
->FlashAddress
= SmallTablesDFlash2Location
;
262 /* TablesA small tables */
263 case dwellDesiredVersusVoltageTableLocationID
:
264 details
->size
= sizeof(twoDTableUS
);
265 details
->RAMPage
= RPAGE_TUNE_ONE
;
266 details
->FlashPage
= TUNETABLES_PPAGE
;
267 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.dwellDesiredVersusVoltageTable
;
268 details
->FlashAddress
= dwellDesiredVersusVoltageTableLocation
;
269 details
->parent
= SmallTablesALocationID
;
271 case dwellDesiredVersusVoltageTable2LocationID
:
272 details
->size
= sizeof(twoDTableUS
);
273 details
->RAMPage
= RPAGE_TUNE_TWO
;
274 details
->FlashPage
= TUNETABLES_PPAGE
;
275 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.dwellDesiredVersusVoltageTable
;
276 details
->FlashAddress
= dwellDesiredVersusVoltageTable2Location
;
277 details
->parent
= SmallTablesA2LocationID
;
279 case injectorDeadTimeTableLocationID
:
280 details
->size
= sizeof(twoDTableUS
);
281 details
->RAMPage
= RPAGE_TUNE_ONE
;
282 details
->FlashPage
= TUNETABLES_PPAGE
;
283 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.injectorDeadTimeTable
;
284 details
->FlashAddress
= injectorDeadTimeTableLocation
;
285 details
->parent
= SmallTablesALocationID
;
287 case injectorDeadTimeTable2LocationID
:
288 details
->size
= sizeof(twoDTableUS
);
289 details
->RAMPage
= RPAGE_TUNE_TWO
;
290 details
->FlashPage
= TUNETABLES_PPAGE
;
291 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.injectorDeadTimeTable
;
292 details
->FlashAddress
= injectorDeadTimeTable2Location
;
293 details
->parent
= SmallTablesA2LocationID
;
295 case postStartEnrichmentTableLocationID
:
296 details
->size
= sizeof(twoDTableUS
);
297 details
->RAMPage
= RPAGE_TUNE_ONE
;
298 details
->FlashPage
= TUNETABLES_PPAGE
;
299 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.postStartEnrichmentTable
;
300 details
->FlashAddress
= postStartEnrichmentTableLocation
;
301 details
->parent
= SmallTablesALocationID
;
303 case postStartEnrichmentTable2LocationID
:
304 details
->size
= sizeof(twoDTableUS
);
305 details
->RAMPage
= RPAGE_TUNE_TWO
;
306 details
->FlashPage
= TUNETABLES_PPAGE
;
307 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.postStartEnrichmentTable
;
308 details
->FlashAddress
= postStartEnrichmentTable2Location
;
309 details
->parent
= SmallTablesA2LocationID
;
311 case engineTempEnrichmentTableFixedLocationID
:
312 details
->size
= sizeof(twoDTableUS
);
313 details
->RAMPage
= RPAGE_TUNE_ONE
;
314 details
->FlashPage
= TUNETABLES_PPAGE
;
315 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.engineTempEnrichmentTableFixed
;
316 details
->FlashAddress
= engineTempEnrichmentTableFixedLocation
;
317 details
->parent
= SmallTablesALocationID
;
319 case engineTempEnrichmentTableFixed2LocationID
:
320 details
->size
= sizeof(twoDTableUS
);
321 details
->RAMPage
= RPAGE_TUNE_TWO
;
322 details
->FlashPage
= TUNETABLES_PPAGE
;
323 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.engineTempEnrichmentTableFixed
;
324 details
->FlashAddress
= engineTempEnrichmentTableFixed2Location
;
325 details
->parent
= SmallTablesA2LocationID
;
327 case primingVolumeTableLocationID
:
328 details
->size
= sizeof(twoDTableUS
);
329 details
->RAMPage
= RPAGE_TUNE_ONE
;
330 details
->FlashPage
= TUNETABLES_PPAGE
;
331 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.primingVolumeTable
;
332 details
->FlashAddress
= primingVolumeTableLocation
;
333 details
->parent
= SmallTablesALocationID
;
335 case primingVolumeTable2LocationID
:
336 details
->size
= sizeof(twoDTableUS
);
337 details
->RAMPage
= RPAGE_TUNE_TWO
;
338 details
->FlashPage
= TUNETABLES_PPAGE
;
339 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.primingVolumeTable
;
340 details
->FlashAddress
= primingVolumeTable2Location
;
341 details
->parent
= SmallTablesA2LocationID
;
343 case engineTempEnrichmentTablePercentLocationID
:
344 details
->size
= sizeof(twoDTableUS
);
345 details
->RAMPage
= RPAGE_TUNE_ONE
;
346 details
->FlashPage
= TUNETABLES_PPAGE
;
347 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.engineTempEnrichmentTablePercent
;
348 details
->FlashAddress
= engineTempEnrichmentTablePercentLocation
;
349 details
->parent
= SmallTablesALocationID
;
351 case engineTempEnrichmentTablePercent2LocationID
:
352 details
->size
= sizeof(twoDTableUS
);
353 details
->RAMPage
= RPAGE_TUNE_TWO
;
354 details
->FlashPage
= TUNETABLES_PPAGE
;
355 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.engineTempEnrichmentTablePercent
;
356 details
->FlashAddress
= engineTempEnrichmentTablePercent2Location
;
357 details
->parent
= SmallTablesA2LocationID
;
359 case dwellMaxVersusRPMTableLocationID
:
360 details
->size
= sizeof(twoDTableUS
);
361 details
->RAMPage
= RPAGE_TUNE_ONE
;
362 details
->FlashPage
= TUNETABLES_PPAGE
;
363 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.dwellMaxVersusRPMTable
;
364 details
->FlashAddress
= dwellMaxVersusRPMTableLocation
;
365 details
->parent
= SmallTablesALocationID
;
367 case dwellMaxVersusRPMTable2LocationID
:
368 details
->size
= sizeof(twoDTableUS
);
369 details
->RAMPage
= RPAGE_TUNE_TWO
;
370 details
->FlashPage
= TUNETABLES_PPAGE
;
371 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.dwellMaxVersusRPMTable
;
372 details
->FlashAddress
= dwellMaxVersusRPMTable2Location
;
373 details
->parent
= SmallTablesA2LocationID
;
376 /* TablesB small tables */
377 case loggingSettingsLocationID
:
378 details
->size
= sizeof(loggingSetting
);
379 details
->RAMPage
= RPAGE_TUNE_ONE
;
380 details
->FlashPage
= TUNETABLES_PPAGE
;
381 details
->RAMAddress
= (void*)&TablesB
.SmallTablesB
.loggingSettings
;
382 details
->FlashAddress
= loggingSettingsLocation
;
383 details
->parent
= SmallTablesBLocationID
;
385 case loggingSettings2LocationID
:
386 details
->size
= sizeof(loggingSetting
);
387 details
->RAMPage
= RPAGE_TUNE_TWO
;
388 details
->FlashPage
= TUNETABLES_PPAGE
;
389 details
->RAMAddress
= (void*)&TablesB
.SmallTablesB
.loggingSettings
;
390 details
->FlashAddress
= loggingSettings2Location
;
391 details
->parent
= SmallTablesB2LocationID
;
394 /* TablesC small tables */
395 // TODO add data chunks from TablesC when some are put in
397 /* TablesD small tables */
398 // TODO add data chunks from TablesD when some are put in
400 /* filler block entries */
401 case fillerALocationID
:
402 details
->size
= SMALL_TABLES_1_FILLER_SIZE
;
403 details
->RAMPage
= RPAGE_TUNE_ONE
;
404 details
->FlashPage
= TUNETABLES_PPAGE
;
405 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.filler
;
406 details
->FlashAddress
= fillerALocation
;
407 details
->parent
= SmallTablesALocationID
;
409 case fillerA2LocationID
:
410 details
->size
= SMALL_TABLES_1_FILLER_SIZE
;
411 details
->RAMPage
= RPAGE_TUNE_TWO
;
412 details
->FlashPage
= TUNETABLES_PPAGE
;
413 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.filler
;
414 details
->FlashAddress
= fillerA2Location
;
415 details
->parent
= SmallTablesA2LocationID
;
417 case fillerBLocationID
:
418 details
->size
= SMALL_TABLES_2_FILLER_SIZE
;
419 details
->RAMPage
= RPAGE_TUNE_ONE
;
420 details
->FlashPage
= TUNETABLES_PPAGE
;
421 details
->RAMAddress
= (void*)&TablesB
.SmallTablesB
.filler
;
422 details
->FlashAddress
= fillerBLocation
;
423 details
->parent
= SmallTablesBLocationID
;
425 case fillerB2LocationID
:
426 details
->size
= SMALL_TABLES_2_FILLER_SIZE
;
427 details
->RAMPage
= RPAGE_TUNE_TWO
;
428 details
->FlashPage
= TUNETABLES_PPAGE
;
429 details
->RAMAddress
= (void*)&TablesB
.SmallTablesB
.filler
;
430 details
->FlashAddress
= fillerB2Location
;
431 details
->parent
= SmallTablesB2LocationID
;
433 case fillerCLocationID
:
434 details
->size
= SMALL_TABLES_3_FILLER_SIZE
;
435 details
->RAMPage
= RPAGE_TUNE_ONE
;
436 details
->FlashPage
= TUNETABLES_PPAGE
;
437 details
->RAMAddress
= (void*)&TablesC
.SmallTablesC
.filler
;
438 details
->FlashAddress
= fillerCLocation
;
439 details
->parent
= SmallTablesCLocationID
;
441 case fillerC2LocationID
:
442 details
->size
= SMALL_TABLES_3_FILLER_SIZE
;
443 details
->RAMPage
= RPAGE_TUNE_TWO
;
444 details
->FlashPage
= TUNETABLES_PPAGE
;
445 details
->RAMAddress
= (void*)&TablesC
.SmallTablesC
.filler
;
446 details
->FlashAddress
= fillerC2Location
;
447 details
->parent
= SmallTablesC2LocationID
;
449 case fillerDLocationID
:
450 details
->size
= SMALL_TABLES_4_FILLER_SIZE
;
451 details
->RAMPage
= RPAGE_TUNE_ONE
;
452 details
->FlashPage
= TUNETABLES_PPAGE
;
453 details
->RAMAddress
= (void*)&TablesD
.SmallTablesD
.filler
;
454 details
->FlashAddress
= fillerDLocation
;
455 details
->parent
= SmallTablesDLocationID
;
457 case fillerD2LocationID
:
458 details
->size
= SMALL_TABLES_4_FILLER_SIZE
;
459 details
->RAMPage
= RPAGE_TUNE_TWO
;
460 details
->FlashPage
= TUNETABLES_PPAGE
;
461 details
->RAMAddress
= (void*)&TablesD
.SmallTablesD
.filler
;
462 details
->FlashAddress
= fillerD2Location
;
463 details
->parent
= SmallTablesD2LocationID
;
466 /* Fixed conf 1 small chunks */
467 case engineSettingsLocationID
:
468 details
->size
= sizeof(engineSetting
);
469 details
->FlashPage
= PPAGE
;
470 details
->FlashAddress
= (void*)&(fixedConfigs1
.engineSettings
);
471 details
->parent
= FixedConfig1LocationID
;
473 case serialSettingsLocationID
:
474 details
->size
= sizeof(serialSetting
);
475 details
->FlashPage
= PPAGE
;
476 details
->FlashAddress
= (void*)&(fixedConfigs1
.serialSettings
);
477 details
->parent
= FixedConfig1LocationID
;
479 case coarseBBSettingsLocationID
:
480 details
->size
= sizeof(coarseBitBangSetting
);
481 details
->FlashPage
= PPAGE
;
482 details
->FlashAddress
= (void*)&(fixedConfigs1
.coarseBitBangSettings
);
483 details
->parent
= FixedConfig1LocationID
;
485 case schedulingSettingsLocationID
:
486 details
->size
= sizeof(schedulingSetting
);
487 details
->FlashPage
= PPAGE
;
488 details
->FlashAddress
= (void*)&(fixedConfigs1
.schedulingSettings
);
489 details
->parent
= FixedConfig1LocationID
;
491 case cutAndLimiterSettingsLocationID
:
492 details
->size
= sizeof(cutAndLimiterSetting
);
493 details
->FlashPage
= PPAGE
;
494 details
->FlashAddress
= (void*)&(fixedConfigs1
.cutAndLimiterSettings
);
495 details
->parent
= FixedConfig1LocationID
;
497 case simpleGPIOSettingsLocationID
:
498 details
->size
= sizeof(simpleGPIOSetting
);
499 details
->FlashPage
= PPAGE
;
500 details
->FlashAddress
= (void*)&(fixedConfigs1
.simpleGPIOSettings
);
501 details
->parent
= FixedConfig1LocationID
;
503 case userTextFieldLocationID
:
504 details
->size
= userTextFieldArrayLength1
;
505 details
->FlashPage
= PPAGE
;
506 details
->FlashAddress
= (void*)&(fixedConfigs1
.userTextField
);
507 details
->parent
= FixedConfig1LocationID
;
510 /* Fixed conf 2 small chunks */
511 case sensorSourcesLocationID
:
512 details
->size
= sizeof(sensorSource
);
513 details
->FlashPage
= PPAGE
;
514 details
->FlashAddress
= (void*)&(fixedConfigs2
.sensorSources
);
515 details
->parent
= FixedConfig2LocationID
;
517 case sensorPresetsLocationID
:
518 details
->size
= sizeof(sensorPreset
);
519 details
->FlashPage
= PPAGE
;
520 details
->FlashAddress
= (void*)&(fixedConfigs2
.sensorPresets
);
521 details
->parent
= FixedConfig2LocationID
;
523 case sensorRangesLocationID
:
524 details
->size
= sizeof(sensorRange
);
525 details
->FlashPage
= PPAGE
;
526 details
->FlashAddress
= (void*)&(fixedConfigs2
.sensorRanges
);
527 details
->parent
= FixedConfig2LocationID
;
529 case sensorSettingsLocationID
:
530 details
->size
= sizeof(sensorSetting
);
531 details
->FlashPage
= PPAGE
;
532 details
->FlashAddress
= (void*)&(fixedConfigs2
.sensorSettings
);
533 details
->parent
= FixedConfig2LocationID
;
535 case algorithmSettingsLocationID
:
536 details
->size
= sizeof(algorithmSetting
);
537 details
->FlashPage
= PPAGE
;
538 details
->FlashAddress
= (void*)&(fixedConfigs2
.algorithmSettings
);
539 details
->parent
= FixedConfig2LocationID
;
541 case userTextField2LocationID
:
542 details
->size
= userTextFieldArrayLength2
;
543 details
->FlashPage
= PPAGE
;
544 details
->FlashAddress
= (void*)&(fixedConfigs2
.userTextField2
);
545 details
->parent
= FixedConfig2LocationID
;
548 // Internal blocks of variables that are sometimes useful to read out
549 case ADCRegistersLocationID
:
550 details
->size
= sizeof(ADCBuffer
);
551 details
->RAMPage
= RPAGE_LINEAR
;
552 details
->RAMAddress
= (void*)ADCBuffers
;
554 case coreVarsLocationID
:
555 details
->size
= sizeof(CoreVar
);
556 details
->RAMPage
= RPAGE_LINEAR
;
557 details
->RAMAddress
= (void*)CoreVars
;
559 case DerivedVarsLocationID
:
560 details
->size
= sizeof(DerivedVar
);
561 details
->RAMPage
= RPAGE_LINEAR
;
562 details
->RAMAddress
= (void*)DerivedVars
;
564 case KeyUserDebugLocationID
:
565 details
->size
= sizeof(KeyUserDebug
);
566 details
->RAMPage
= RPAGE_LINEAR
;
567 details
->RAMAddress
= &KeyUserDebugs
;
569 case CountersLocationID
:
570 details
->size
= sizeof(Counter
);
571 details
->RAMPage
= RPAGE_LINEAR
;
572 details
->RAMAddress
= &Counters
;
574 case ClocksLocationID
:
575 details
->size
= sizeof(Clock
);
576 details
->RAMPage
= RPAGE_LINEAR
;
577 details
->RAMAddress
= &Clocks
;
579 case FlaggablesLocationID
:
580 details
->size
= sizeof(Flaggable
);
581 details
->RAMPage
= RPAGE_LINEAR
;
582 details
->RAMAddress
= &Flaggables
;
586 /* Return early if locationID is not valid. */
587 return locationIDNotFound
;
591 // Setup all of the flags for various groups here
592 // Setting flags above is wrong, keep it all in one place, here!
594 // Initialise the flags to having flash, everything does at the moment, and indexable, most is, negate at end for those that don't.
595 details
->flags
= block_is_in_flash
| block_is_indexable
;
597 if(locationID
< MainTable_TwoDTableUS_Border
){
598 details
->flags
|= block_is_main_table
| block_is_in_ram
| block_gets_verified
| block_for_backup_restore
;
599 }else if(locationID
< TwoDTableUS_SmallTableFullBlocks_Border
){
600 details
->flags
|= block_is_2dus_table
| block_is_in_ram
| block_has_parent
| block_gets_verified
;
601 }else if(locationID
< SmallTableFullBlocks_SmallTableFillers_Border
){
602 details
->flags
|= block_is_in_ram
| block_for_backup_restore
;
603 details
->flags
&= ~block_is_indexable
;
604 }else if(locationID
< SmallTableFillers_FlashLookupTables_Border
){
605 details
->flags
|= block_has_parent
| block_is_in_ram
;
606 details
->flags
&= ~block_is_indexable
;
607 }else if(locationID
< FlashLookupTables_SmallTableConfigs_Border
){
608 details
->flags
|= block_is_lookup_data
| block_for_backup_restore
;
609 details
->flags
&= ~block_is_indexable
;
610 }else if(locationID
< SmallTableConfigs_FixedConfigBlocks_Border
){
611 details
->flags
|= block_has_parent
| block_is_in_ram
| block_is_configuration
;
612 }else if(locationID
< FixedConfigBlocks_FixedConfigSubBlocks_Border
){
613 details
->flags
|= block_for_backup_restore
;
614 }else if(locationID
< FixedConfigSubBlocks_Border_ReadOnlyVarBlocks
){
615 details
->flags
|= block_has_parent
| block_is_configuration
;
616 }else{ // RO variable blocks exposed polling and streaming
617 details
->flags
|= block_is_read_only
| block_is_in_ram
;
618 details
->flags
&= ~block_is_in_flash
;
621 /* Fall through to not return error */