1 /* FreeEMS - the open source engine management system
3 * Copyright 2008-2013 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.
38 #define BLOCK_DETAILS_LOOKUP_C
39 #include "inc/freeEMS.h"
40 #include "inc/interrupts.h"
41 #include "inc/locationIDs.h"
42 #include "inc/pagedLocationBuffers.h"
43 #include "inc/blockDetailsLookup.h"
46 /** @brief Lookup memory block details.
48 * Flash only blocks leave the RAM address and page values
49 * set to zero. ID's that don't exist return an error code.
51 * @note This function is an exception to the style rule switch statement
52 * blocks of using a {} pair for each case statement. Readability is better
53 * without them in this case.
55 * @param locationID is the ID of the memory location for which details are required.
56 * @param details is a pointer to the blockDetails struct to populate with the details.
58 * @return An error code. Zero means success, anything else is a failure.
60 unsigned short lookupBlockDetails(unsigned short locationID
, blockDetails
* details
){
61 /* Initialise the four values needed for operations on memory at 0 for error checking */
63 details
->FlashPage
= 0;
64 details
->RAMAddress
= 0;
65 details
->FlashAddress
= 0;
67 /* Initialise the block size to 1024 to save code space and increase readability */
68 details
->size
= sizeof(mainTable
);
70 // No need to set parent value to zero as ignored unless flag set, done for clarity in hex stream.
73 /* Look up the locations and set non default sizes */
75 /* flash only fixed conf full blocks */
76 case FixedConfig1LocationID
:
77 details
->FlashPage
= PPAGE
;
78 details
->FlashAddress
= (void*)&fixedConfigs1
;
80 case FixedConfig2LocationID
:
81 details
->FlashPage
= PPAGE
;
82 details
->FlashAddress
= (void*)&fixedConfigs2
;
86 case IATTransferTableLocationID
:
87 details
->size
= sizeof(IATTransferTable
);
88 details
->FlashPage
= LOOKUP_PPAGE
;
89 details
->FlashAddress
= IATTransferTableLocation
;
91 case CHTTransferTableLocationID
:
92 details
->size
= sizeof(CHTTransferTable
);
93 details
->FlashPage
= LOOKUP_PPAGE
;
94 details
->FlashAddress
= CHTTransferTableLocation
;
97 case MAFTransferTableLocationID
:
98 details
->size
= sizeof(MAFTransferTable
);
99 details
->FlashPage
= LOOKUP_PPAGE
;
100 details
->FlashAddress
= MAFTransferTableLocation
;
102 case TestTransferTableLocationID
:
103 details
->size
= sizeof(TestTransferTable
);
104 details
->FlashPage
= LOOKUP_PPAGE
;
105 details
->FlashAddress
= TestTransferTableLocation
;
109 case VETableMainLocationID
:
110 details
->RAMPage
= RPAGE_FUEL_ONE
;
111 details
->FlashPage
= FUELTABLES_PPAGE
;
112 details
->RAMAddress
= (void*)&TablesA
;
113 details
->FlashAddress
= VETableMainFlashLocation
;
116 case VETableSecondaryLocationID
:
117 details
->RAMPage
= RPAGE_FUEL_ONE
;
118 details
->FlashPage
= FUELTABLES_PPAGE
;
119 details
->RAMAddress
= (void*)&TablesB
;
120 details
->FlashAddress
= VETableSecondaryFlashLocation
;
123 case AirflowTableLocationID
:
124 details
->RAMPage
= RPAGE_FUEL_ONE
;
125 details
->FlashPage
= FUELTABLES_PPAGE
;
126 details
->RAMAddress
= (void*)&TablesC
;
127 details
->FlashAddress
= AirflowTableFlashLocation
;
129 case LambdaTableLocationID
:
130 details
->RAMPage
= RPAGE_FUEL_ONE
;
131 details
->FlashPage
= FUELTABLES_PPAGE
;
132 details
->RAMAddress
= (void*)&TablesD
;
133 details
->FlashAddress
= LambdaTableFlashLocation
;
136 case VETableMain2LocationID
:
137 details
->RAMPage
= RPAGE_FUEL_TWO
;
138 details
->FlashPage
= FUELTABLES_PPAGE
;
139 details
->RAMAddress
= (void*)&TablesA
;
140 details
->FlashAddress
= VETableMainFlash2Location
;
142 case VETableSecondary2LocationID
:
143 details
->RAMPage
= RPAGE_FUEL_TWO
;
144 details
->FlashPage
= FUELTABLES_PPAGE
;
145 details
->RAMAddress
= (void*)&TablesB
;
146 details
->FlashAddress
= VETableSecondaryFlash2Location
;
148 case AirflowTable2LocationID
:
149 details
->RAMPage
= RPAGE_FUEL_TWO
;
150 details
->FlashPage
= FUELTABLES_PPAGE
;
151 details
->RAMAddress
= (void*)&TablesC
;
152 details
->FlashAddress
= AirflowTableFlash2Location
;
154 case LambdaTable2LocationID
:
155 details
->RAMPage
= RPAGE_FUEL_TWO
;
156 details
->FlashPage
= FUELTABLES_PPAGE
;
157 details
->RAMAddress
= (void*)&TablesD
;
158 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
;
170 case IgnitionAdvanceTableSecondaryLocationID
:
171 details
->RAMPage
= RPAGE_TIME_ONE
;
172 details
->FlashPage
= TIMETABLES_PPAGE
;
173 details
->RAMAddress
= (void*)&TablesB
;
174 details
->FlashAddress
= IgnitionAdvanceTableSecondaryFlashLocation
;
176 case InjectionAdvanceTableMainLocationID
:
177 details
->RAMPage
= RPAGE_TIME_ONE
;
178 details
->FlashPage
= TIMETABLES_PPAGE
;
179 details
->RAMAddress
= (void*)&TablesC
;
180 details
->FlashAddress
= InjectionAdvanceTableMainFlashLocation
;
182 case InjectionAdvanceTableSecondaryLocationID
:
183 details
->RAMPage
= RPAGE_TIME_ONE
;
184 details
->FlashPage
= TIMETABLES_PPAGE
;
185 details
->RAMAddress
= (void*)&TablesD
;
186 details
->FlashAddress
= InjectionAdvanceTableSecondaryFlashLocation
;
188 case IgnitionAdvanceTableMain2LocationID
:
189 details
->RAMPage
= RPAGE_TIME_TWO
;
190 details
->FlashPage
= TIMETABLES_PPAGE
;
191 details
->RAMAddress
= (void*)&TablesA
;
192 details
->FlashAddress
= IgnitionAdvanceTableMainFlash2Location
;
194 case IgnitionAdvanceTableSecondary2LocationID
:
195 details
->RAMPage
= RPAGE_TIME_TWO
;
196 details
->FlashPage
= TIMETABLES_PPAGE
;
197 details
->RAMAddress
= (void*)&TablesB
;
198 details
->FlashAddress
= IgnitionAdvanceTableSecondaryFlash2Location
;
200 case InjectionAdvanceTableMain2LocationID
:
201 details
->RAMPage
= RPAGE_TIME_TWO
;
202 details
->FlashPage
= TIMETABLES_PPAGE
;
203 details
->RAMAddress
= (void*)&TablesC
;
204 details
->FlashAddress
= InjectionAdvanceTableMainFlash2Location
;
206 case InjectionAdvanceTableSecondary2LocationID
:
207 details
->RAMPage
= RPAGE_TIME_TWO
;
208 details
->FlashPage
= TIMETABLES_PPAGE
;
209 details
->RAMAddress
= (void*)&TablesD
;
210 details
->FlashAddress
= InjectionAdvanceTableSecondaryFlash2Location
;
214 /* small table full blocks */
215 case SmallTablesALocationID
:
216 details
->RAMPage
= RPAGE_TUNE_ONE
;
217 details
->FlashPage
= TUNETABLES_PPAGE
;
218 details
->RAMAddress
= (void*)&TablesA
;
219 details
->FlashAddress
= SmallTablesAFlashLocation
;
221 case SmallTablesBLocationID
:
222 details
->RAMPage
= RPAGE_TUNE_ONE
;
223 details
->FlashPage
= TUNETABLES_PPAGE
;
224 details
->RAMAddress
= (void*)&TablesB
;
225 details
->FlashAddress
= SmallTablesBFlashLocation
;
228 case SmallTablesCLocationID
:
229 details
->RAMPage
= RPAGE_TUNE_ONE
;
230 details
->FlashPage
= TUNETABLES_PPAGE
;
231 details
->RAMAddress
= (void*)&TablesC
;
232 details
->FlashAddress
= SmallTablesCFlashLocation
;
234 case SmallTablesDLocationID
:
235 details
->RAMPage
= RPAGE_TUNE_ONE
;
236 details
->FlashPage
= TUNETABLES_PPAGE
;
237 details
->RAMAddress
= (void*)&TablesD
;
238 details
->FlashAddress
= SmallTablesDFlashLocation
;
240 case SmallTablesA2LocationID
:
241 details
->RAMPage
= RPAGE_TUNE_TWO
;
242 details
->FlashPage
= TUNETABLES_PPAGE
;
243 details
->RAMAddress
= (void*)&TablesA
;
244 details
->FlashAddress
= SmallTablesAFlash2Location
;
246 case SmallTablesB2LocationID
:
247 details
->RAMPage
= RPAGE_TUNE_TWO
;
248 details
->FlashPage
= TUNETABLES_PPAGE
;
249 details
->RAMAddress
= (void*)&TablesB
;
250 details
->FlashAddress
= SmallTablesBFlash2Location
;
252 case SmallTablesC2LocationID
:
253 details
->RAMPage
= RPAGE_TUNE_TWO
;
254 details
->FlashPage
= TUNETABLES_PPAGE
;
255 details
->RAMAddress
= (void*)&TablesC
;
256 details
->FlashAddress
= SmallTablesCFlash2Location
;
258 case SmallTablesD2LocationID
:
259 details
->RAMPage
= RPAGE_TUNE_TWO
;
260 details
->FlashPage
= TUNETABLES_PPAGE
;
261 details
->RAMAddress
= (void*)&TablesD
;
262 details
->FlashAddress
= SmallTablesDFlash2Location
;
266 /* TablesA small tables */
267 case dwellDesiredVersusVoltageTableLocationID
:
268 details
->size
= sizeof(twoDTableUS
);
269 details
->RAMPage
= RPAGE_TUNE_ONE
;
270 details
->FlashPage
= TUNETABLES_PPAGE
;
271 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.dwellDesiredVersusVoltageTable
;
272 details
->FlashAddress
= dwellDesiredVersusVoltageTableLocation
;
273 details
->parent
= SmallTablesALocationID
;
275 case injectorDeadTimeTableLocationID
:
276 details
->size
= sizeof(twoDTableUS
);
277 details
->RAMPage
= RPAGE_TUNE_ONE
;
278 details
->FlashPage
= TUNETABLES_PPAGE
;
279 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.injectorDeadTimeTable
;
280 details
->FlashAddress
= injectorDeadTimeTableLocation
;
281 details
->parent
= SmallTablesALocationID
;
284 case postStartEnrichmentTableLocationID
:
285 details
->size
= sizeof(twoDTableUS
);
286 details
->RAMPage
= RPAGE_TUNE_ONE
;
287 details
->FlashPage
= TUNETABLES_PPAGE
;
288 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.postStartEnrichmentTable
;
289 details
->FlashAddress
= postStartEnrichmentTableLocation
;
290 details
->parent
= SmallTablesALocationID
;
292 case engineTempEnrichmentTableFixedLocationID
:
293 details
->size
= sizeof(twoDTableUS
);
294 details
->RAMPage
= RPAGE_TUNE_ONE
;
295 details
->FlashPage
= TUNETABLES_PPAGE
;
296 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.engineTempEnrichmentTableFixed
;
297 details
->FlashAddress
= engineTempEnrichmentTableFixedLocation
;
298 details
->parent
= SmallTablesALocationID
;
301 case primingVolumeTableLocationID
:
302 details
->size
= sizeof(twoDTableUS
);
303 details
->RAMPage
= RPAGE_TUNE_ONE
;
304 details
->FlashPage
= TUNETABLES_PPAGE
;
305 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.primingVolumeTable
;
306 details
->FlashAddress
= primingVolumeTableLocation
;
307 details
->parent
= SmallTablesALocationID
;
309 case engineTempEnrichmentTablePercentLocationID
:
310 details
->size
= sizeof(twoDTableUS
);
311 details
->RAMPage
= RPAGE_TUNE_ONE
;
312 details
->FlashPage
= TUNETABLES_PPAGE
;
313 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.engineTempEnrichmentTablePercent
;
314 details
->FlashAddress
= engineTempEnrichmentTablePercentLocation
;
315 details
->parent
= SmallTablesALocationID
;
317 case dwellVersusRPMTableLocationID
:
318 details
->size
= sizeof(twoDTableUS
);
319 details
->RAMPage
= RPAGE_TUNE_ONE
;
320 details
->FlashPage
= TUNETABLES_PPAGE
;
321 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.dwellVersusRPMTable
;
322 details
->FlashAddress
= dwellVersusRPMTableLocation
;
323 details
->parent
= SmallTablesALocationID
;
325 case blendVersusRPMTableLocationID
:
326 details
->size
= sizeof(twoDTableUS
);
327 details
->RAMPage
= RPAGE_TUNE_ONE
;
328 details
->FlashPage
= TUNETABLES_PPAGE
;
329 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.blendVersusRPMTable
;
330 details
->FlashAddress
= blendVersusRPMTableLocation
;
331 details
->parent
= SmallTablesALocationID
;
335 case dwellDesiredVersusVoltageTable2LocationID
:
336 details
->size
= sizeof(twoDTableUS
);
337 details
->RAMPage
= RPAGE_TUNE_TWO
;
338 details
->FlashPage
= TUNETABLES_PPAGE
;
339 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.dwellDesiredVersusVoltageTable
;
340 details
->FlashAddress
= dwellDesiredVersusVoltageTable2Location
;
341 details
->parent
= SmallTablesA2LocationID
;
343 case injectorDeadTimeTable2LocationID
:
344 details
->size
= sizeof(twoDTableUS
);
345 details
->RAMPage
= RPAGE_TUNE_TWO
;
346 details
->FlashPage
= TUNETABLES_PPAGE
;
347 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.injectorDeadTimeTable
;
348 details
->FlashAddress
= injectorDeadTimeTable2Location
;
349 details
->parent
= SmallTablesA2LocationID
;
351 case postStartEnrichmentTable2LocationID
:
352 details
->size
= sizeof(twoDTableUS
);
353 details
->RAMPage
= RPAGE_TUNE_TWO
;
354 details
->FlashPage
= TUNETABLES_PPAGE
;
355 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.postStartEnrichmentTable
;
356 details
->FlashAddress
= postStartEnrichmentTable2Location
;
357 details
->parent
= SmallTablesA2LocationID
;
359 case engineTempEnrichmentTableFixed2LocationID
:
360 details
->size
= sizeof(twoDTableUS
);
361 details
->RAMPage
= RPAGE_TUNE_TWO
;
362 details
->FlashPage
= TUNETABLES_PPAGE
;
363 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.engineTempEnrichmentTableFixed
;
364 details
->FlashAddress
= engineTempEnrichmentTableFixed2Location
;
365 details
->parent
= SmallTablesA2LocationID
;
367 case primingVolumeTable2LocationID
:
368 details
->size
= sizeof(twoDTableUS
);
369 details
->RAMPage
= RPAGE_TUNE_TWO
;
370 details
->FlashPage
= TUNETABLES_PPAGE
;
371 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.primingVolumeTable
;
372 details
->FlashAddress
= primingVolumeTable2Location
;
373 details
->parent
= SmallTablesA2LocationID
;
375 case engineTempEnrichmentTablePercent2LocationID
:
376 details
->size
= sizeof(twoDTableUS
);
377 details
->RAMPage
= RPAGE_TUNE_TWO
;
378 details
->FlashPage
= TUNETABLES_PPAGE
;
379 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.engineTempEnrichmentTablePercent
;
380 details
->FlashAddress
= engineTempEnrichmentTablePercent2Location
;
381 details
->parent
= SmallTablesA2LocationID
;
383 case dwellVersusRPMTable2LocationID
:
384 details
->size
= sizeof(twoDTableUS
);
385 details
->RAMPage
= RPAGE_TUNE_TWO
;
386 details
->FlashPage
= TUNETABLES_PPAGE
;
387 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.dwellVersusRPMTable
;
388 details
->FlashAddress
= dwellVersusRPMTable2Location
;
389 details
->parent
= SmallTablesA2LocationID
;
391 case blendVersusRPMTable2LocationID
:
392 details
->size
= sizeof(twoDTableUS
);
393 details
->RAMPage
= RPAGE_TUNE_TWO
;
394 details
->FlashPage
= TUNETABLES_PPAGE
;
395 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.blendVersusRPMTable
;
396 details
->FlashAddress
= blendVersusRPMTable2Location
;
397 details
->parent
= SmallTablesA2LocationID
;
400 /* TablesB small tables */
401 case loggingSettingsLocationID
:
402 details
->size
= sizeof(loggingSetting
);
403 details
->RAMPage
= RPAGE_TUNE_ONE
;
404 details
->FlashPage
= TUNETABLES_PPAGE
;
405 details
->RAMAddress
= (void*)&TablesB
.SmallTablesB
.loggingSettings
;
406 details
->FlashAddress
= loggingSettingsLocation
;
407 details
->parent
= SmallTablesBLocationID
;
410 case loggingSettings2LocationID
:
411 details
->size
= sizeof(loggingSetting
);
412 details
->RAMPage
= RPAGE_TUNE_TWO
;
413 details
->FlashPage
= TUNETABLES_PPAGE
;
414 details
->RAMAddress
= (void*)&TablesB
.SmallTablesB
.loggingSettings
;
415 details
->FlashAddress
= loggingSettings2Location
;
416 details
->parent
= SmallTablesB2LocationID
;
420 /* TablesC small tables */
421 // TODO add data chunks from TablesC when some are put in
423 /* TablesD small tables */
424 // TODO add data chunks from TablesD when some are put in
427 /* filler block entries */
428 case fillerALocationID
:
429 details
->size
= SMALL_TABLES_1_FILLER_SIZE
;
430 details
->RAMPage
= RPAGE_TUNE_ONE
;
431 details
->FlashPage
= TUNETABLES_PPAGE
;
432 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.filler
;
433 details
->FlashAddress
= fillerALocation
;
434 details
->parent
= SmallTablesALocationID
;
436 case fillerA2LocationID
:
437 details
->size
= SMALL_TABLES_1_FILLER_SIZE
;
438 details
->RAMPage
= RPAGE_TUNE_TWO
;
439 details
->FlashPage
= TUNETABLES_PPAGE
;
440 details
->RAMAddress
= (void*)&TablesA
.SmallTablesA
.filler
;
441 details
->FlashAddress
= fillerA2Location
;
442 details
->parent
= SmallTablesA2LocationID
;
444 case fillerBLocationID
:
445 details
->size
= SMALL_TABLES_2_FILLER_SIZE
;
446 details
->RAMPage
= RPAGE_TUNE_ONE
;
447 details
->FlashPage
= TUNETABLES_PPAGE
;
448 details
->RAMAddress
= (void*)&TablesB
.SmallTablesB
.filler
;
449 details
->FlashAddress
= fillerBLocation
;
450 details
->parent
= SmallTablesBLocationID
;
452 case fillerB2LocationID
:
453 details
->size
= SMALL_TABLES_2_FILLER_SIZE
;
454 details
->RAMPage
= RPAGE_TUNE_TWO
;
455 details
->FlashPage
= TUNETABLES_PPAGE
;
456 details
->RAMAddress
= (void*)&TablesB
.SmallTablesB
.filler
;
457 details
->FlashAddress
= fillerB2Location
;
458 details
->parent
= SmallTablesB2LocationID
;
460 case fillerCLocationID
:
461 details
->size
= SMALL_TABLES_3_FILLER_SIZE
;
462 details
->RAMPage
= RPAGE_TUNE_ONE
;
463 details
->FlashPage
= TUNETABLES_PPAGE
;
464 details
->RAMAddress
= (void*)&TablesC
.SmallTablesC
.filler
;
465 details
->FlashAddress
= fillerCLocation
;
466 details
->parent
= SmallTablesCLocationID
;
468 case fillerC2LocationID
:
469 details
->size
= SMALL_TABLES_3_FILLER_SIZE
;
470 details
->RAMPage
= RPAGE_TUNE_TWO
;
471 details
->FlashPage
= TUNETABLES_PPAGE
;
472 details
->RAMAddress
= (void*)&TablesC
.SmallTablesC
.filler
;
473 details
->FlashAddress
= fillerC2Location
;
474 details
->parent
= SmallTablesC2LocationID
;
476 case fillerDLocationID
:
477 details
->size
= SMALL_TABLES_4_FILLER_SIZE
;
478 details
->RAMPage
= RPAGE_TUNE_ONE
;
479 details
->FlashPage
= TUNETABLES_PPAGE
;
480 details
->RAMAddress
= (void*)&TablesD
.SmallTablesD
.filler
;
481 details
->FlashAddress
= fillerDLocation
;
482 details
->parent
= SmallTablesDLocationID
;
484 case fillerD2LocationID
:
485 details
->size
= SMALL_TABLES_4_FILLER_SIZE
;
486 details
->RAMPage
= RPAGE_TUNE_TWO
;
487 details
->FlashPage
= TUNETABLES_PPAGE
;
488 details
->RAMAddress
= (void*)&TablesD
.SmallTablesD
.filler
;
489 details
->FlashAddress
= fillerD2Location
;
490 details
->parent
= SmallTablesD2LocationID
;
494 /* Fixed conf 1 small chunks */
495 case engineSettingsLocationID
:
496 details
->size
= sizeof(engineSetting
);
497 details
->FlashPage
= PPAGE
;
498 details
->FlashAddress
= (void*)&(fixedConfigs1
.engineSettings
);
499 details
->parent
= FixedConfig1LocationID
;
501 case serialSettingsLocationID
:
502 details
->size
= sizeof(serialSetting
);
503 details
->FlashPage
= PPAGE
;
504 details
->FlashAddress
= (void*)&(fixedConfigs1
.serialSettings
);
505 details
->parent
= FixedConfig1LocationID
;
507 case coarseBBSettingsLocationID
:
508 details
->size
= sizeof(coarseBitBangSetting
);
509 details
->FlashPage
= PPAGE
;
510 details
->FlashAddress
= (void*)&(fixedConfigs1
.coarseBitBangSettings
);
511 details
->parent
= FixedConfig1LocationID
;
513 case schedulingSettingsLocationID
:
514 details
->size
= sizeof(schedulingSetting
);
515 details
->FlashPage
= PPAGE
;
516 details
->FlashAddress
= (void*)&(fixedConfigs1
.schedulingSettings
);
517 details
->parent
= FixedConfig1LocationID
;
519 case cutAndLimiterSettingsLocationID
:
520 details
->size
= sizeof(cutAndLimiterSetting
);
521 details
->FlashPage
= PPAGE
;
522 details
->FlashAddress
= (void*)&(fixedConfigs1
.cutAndLimiterSettings
);
523 details
->parent
= FixedConfig1LocationID
;
525 case simpleGPIOSettingsLocationID
:
526 details
->size
= sizeof(simpleGPIOSetting
);
527 details
->FlashPage
= PPAGE
;
528 details
->FlashAddress
= (void*)&(fixedConfigs1
.simpleGPIOSettings
);
529 details
->parent
= FixedConfig1LocationID
;
531 case userTextFieldLocationID
:
532 details
->size
= userTextFieldArrayLength1
;
533 details
->FlashPage
= PPAGE
;
534 details
->FlashAddress
= (void*)&(fixedConfigs1
.userTextField
);
535 details
->parent
= FixedConfig1LocationID
;
538 /* Fixed conf 2 small chunks */
539 case sensorSourcesLocationID
:
540 details
->size
= sizeof(sensorSource
);
541 details
->FlashPage
= PPAGE
;
542 details
->FlashAddress
= (void*)&(fixedConfigs2
.sensorSources
);
543 details
->parent
= FixedConfig2LocationID
;
545 case sensorPresetsLocationID
:
546 details
->size
= sizeof(sensorPreset
);
547 details
->FlashPage
= PPAGE
;
548 details
->FlashAddress
= (void*)&(fixedConfigs2
.sensorPresets
);
549 details
->parent
= FixedConfig2LocationID
;
551 case sensorRangesLocationID
:
552 details
->size
= sizeof(sensorRange
);
553 details
->FlashPage
= PPAGE
;
554 details
->FlashAddress
= (void*)&(fixedConfigs2
.sensorRanges
);
555 details
->parent
= FixedConfig2LocationID
;
557 case sensorSettingsLocationID
:
558 details
->size
= sizeof(sensorSetting
);
559 details
->FlashPage
= PPAGE
;
560 details
->FlashAddress
= (void*)&(fixedConfigs2
.sensorSettings
);
561 details
->parent
= FixedConfig2LocationID
;
563 case algorithmSettingsLocationID
:
564 details
->size
= sizeof(algorithmSetting
);
565 details
->FlashPage
= PPAGE
;
566 details
->FlashAddress
= (void*)&(fixedConfigs2
.algorithmSettings
);
567 details
->parent
= FixedConfig2LocationID
;
569 case inputOutputSettingsLocationID
:
570 details
->size
= sizeof(inputOutputSetting
);
571 details
->FlashPage
= PPAGE
;
572 details
->FlashAddress
= (void*)&(fixedConfigs2
.inputOutputSettings
);
573 details
->parent
= FixedConfig2LocationID
;
575 case decoderSettingsLocationID
:
576 details
->size
= sizeof(decoderSetting
);
577 details
->FlashPage
= PPAGE
;
578 details
->FlashAddress
= (void*)&(fixedConfigs2
.decoderSettings
);
579 details
->parent
= FixedConfig2LocationID
;
581 case userTextField2LocationID
:
582 details
->size
= userTextFieldArrayLength2
;
583 details
->FlashPage
= PPAGE
;
584 details
->FlashAddress
= (void*)&(fixedConfigs2
.userTextField2
);
585 details
->parent
= FixedConfig2LocationID
;
588 // Internal blocks of variables that are sometimes useful to read out
589 case ADCRegistersLocationID
:
590 details
->size
= sizeof(ADCBuffer
);
591 details
->RAMPage
= RPAGE_LINEAR
;
592 details
->RAMAddress
= (void*)ADCBuffers
;
594 case coreVarsLocationID
:
595 details
->size
= sizeof(CoreVar
);
596 details
->RAMPage
= RPAGE_LINEAR
;
597 details
->RAMAddress
= (void*)CoreVars
;
599 case DerivedVarsLocationID
:
600 details
->size
= sizeof(DerivedVar
);
601 details
->RAMPage
= RPAGE_LINEAR
;
602 details
->RAMAddress
= (void*)DerivedVars
;
604 case KeyUserDebugLocationID
:
605 details
->size
= sizeof(KeyUserDebug
);
606 details
->RAMPage
= RPAGE_LINEAR
;
607 details
->RAMAddress
= &KeyUserDebugs
;
609 case CountersLocationID
:
610 details
->size
= sizeof(Counter
);
611 details
->RAMPage
= RPAGE_LINEAR
;
612 details
->RAMAddress
= &Counters
;
614 case ClocksLocationID
:
615 details
->size
= sizeof(Clock
);
616 details
->RAMPage
= RPAGE_LINEAR
;
617 details
->RAMAddress
= &Clocks
;
619 case FlaggablesLocationID
:
620 details
->size
= sizeof(Flaggable
);
621 details
->RAMPage
= RPAGE_LINEAR
;
622 details
->RAMAddress
= &Flaggables
;
624 case Flaggables2LocationID
:
625 details
->size
= sizeof(Flaggable2
);
626 details
->RAMPage
= RPAGE_LINEAR
;
627 details
->RAMAddress
= &Flaggables2
;
631 /* Return early if locationID is not valid. */
632 return locationIDNotFound
;
636 // Setup all of the flags for various groups here
637 // Setting flags above is wrong, keep it all in one place, here!
639 // Initialise the flags to having flash, everything does at the moment, and indexable, most is, negate at end for those that don't.
640 details
->flags
= block_is_in_flash
| block_is_indexable
;
642 if(locationID
< MainTable_TwoDTableUS_Border
){
643 details
->flags
|= block_is_main_table
| block_is_in_ram
| block_gets_verified
| block_for_backup_restore
;
644 }else if(locationID
< TwoDTableUS_SmallTableFullBlocks_Border
){
645 details
->flags
|= block_is_2dus_table
| block_is_in_ram
| block_has_parent
| block_gets_verified
;
646 }else if(locationID
< SmallTableFullBlocks_SmallTableFillers_Border
){
647 details
->flags
|= block_is_in_ram
| block_for_backup_restore
;
648 details
->flags
&= ~block_is_indexable
;
649 }else if(locationID
< SmallTableFillers_FlashLookupTables_Border
){
650 details
->flags
|= block_has_parent
| block_is_in_ram
;
651 details
->flags
&= ~block_is_indexable
;
652 }else if(locationID
< FlashLookupTables_SmallTableConfigs_Border
){
653 details
->flags
|= block_is_lookup_data
| block_for_backup_restore
;
654 details
->flags
&= ~block_is_indexable
;
655 }else if(locationID
< SmallTableConfigs_FixedConfigBlocks_Border
){
656 details
->flags
|= block_has_parent
| block_is_in_ram
| block_is_configuration
;
657 }else if(locationID
< FixedConfigBlocks_FixedConfigSubBlocks_Border
){
658 details
->flags
|= block_for_backup_restore
;
659 }else if(locationID
< FixedConfigSubBlocks_Border_ReadOnlyVarBlocks
){
660 details
->flags
|= block_has_parent
| block_is_configuration
;
661 }else{ // RO variable blocks exposed polling and streaming
662 details
->flags
|= block_is_read_only
| block_is_in_ram
;
663 details
->flags
&= ~block_is_in_flash
;
666 /* Fall through to not return error */