rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
fsl_ftfx_flexnvm.h
Go to the documentation of this file.
1/*
2* The Clear BSD License
3* Copyright 2013-2016 Freescale Semiconductor, Inc.
4* Copyright 2016-2018 NXP
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted (subject to the limitations in the
9* disclaimer below) provided that the following conditions are met:
10*
11* * Redistributions of source code must retain the above copyright
12* notice, this list of conditions and the following disclaimer.
13*
14* * Redistributions in binary form must reproduce the above copyright
15* notice, this list of conditions and the following disclaimer in the
16* documentation and/or other materials provided with the distribution.
17*
18* * Neither the name of the copyright holder nor the names of its
19* contributors may be used to endorse or promote products derived from
20* this software without specific prior written permission.
21*
22* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
23* GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
24* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
25* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
28* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
31* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
33* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
34* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35*
36*/
37
38#ifndef _FSL_FTFX_FLEXNVM_H_
39#define _FSL_FTFX_FLEXNVM_H_
40
41#include "fsl_ftfx_controller.h"
42
43/*!
44 * @addtogroup ftfx_flexnvm_driver
45 * @{
46 */
47/*******************************************************************************
48 * Definitions
49 ******************************************************************************/
50
51/*!
52 * @name Flexnvm version
53 * @{
54 */
55/*! @brief Flexnvm driver version for SDK*/
56#define FSL_FLEXNVM_DRIVER_VERSION (MAKE_VERSION(3, 0, 0)) /*!< Version 1.0.0. */
57/*@}*/
58
59/*!
60 * @brief Enumeration for various flexnvm properties.
61 */
63{
64 kFLEXNVM_PropertyDflashSectorSize = 0x00U, /*!< Dflash sector size property.*/
65 kFLEXNVM_PropertyDflashTotalSize = 0x01U, /*!< Dflash total size property.*/
66 kFLEXNVM_PropertyDflashBlockSize = 0x02U, /*!< Dflash block size property.*/
67 kFLEXNVM_PropertyDflashBlockCount = 0x03U, /*!< Dflash block count property.*/
68 kFLEXNVM_PropertyDflashBlockBaseAddr = 0x04U, /*!< Dflash block base address property.*/
69 kFLEXNVM_PropertyFlexRamBlockBaseAddr = 0x05U, /*!< FlexRam block base address property.*/
70 kFLEXNVM_PropertyFlexRamTotalSize = 0x06U, /*!< FlexRam total size property.*/
71 kFLEXNVM_PropertyEepromTotalSize = 0x07U, /*!< EEPROM total size property.*/
73
74/*! @brief Flexnvm driver state information.
75 *
76 * An instance of this structure is allocated by the user of the Flexnvm driver and
77 * passed into each of the driver APIs.
78 */
83
84/*******************************************************************************
85 * API
86 ******************************************************************************/
87
88#if defined(__cplusplus)
89extern "C" {
90#endif
91
92/*!
93 * @name Initialization
94 * @{
95 */
96
97/*!
98 * @brief Initializes the global flash properties structure members.
99 *
100 * This function checks and initializes the Flash module for the other Flash APIs.
101 *
102 * @param config Pointer to the storage for the driver runtime state.
103 *
104 * @retval #kStatus_FTFx_Success API was executed successfully.
105 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
106 * @retval #kStatus_FTFx_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
107 * @retval #kStatus_FTFx_PartitionStatusUpdateFailure Failed to update the partition status.
108 */
110
111/*@}*/
112
113/*!
114 * @name Erasing
115 * @{
116 */
117
118/*!
119 * @brief Erases the Dflash sectors encompassed by parameters passed into function.
120 *
121 * This function erases the appropriate number of flash sectors based on the
122 * desired start address and length.
123 *
124 * @param config The pointer to the storage for the driver runtime state.
125 * @param start The start address of the desired flash memory to be erased.
126 * The start address does not need to be sector-aligned but must be word-aligned.
127 * @param lengthInBytes The length, given in bytes (not words or long-words)
128 * to be erased. Must be word-aligned.
129 * @param key The value used to validate all flash erase APIs.
130 *
131 * @retval #kStatus_FTFx_Success API was executed successfully.
132 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
133 * @retval #kStatus_FTFx_AlignmentError The parameter is not aligned with the specified baseline.
134 * @retval #kStatus_FTFx_AddressError The address is out of range.
135 * @retval #kStatus_FTFx_EraseKeyError The API erase key is invalid.
136 * @retval #kStatus_FTFx_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
137 * @retval #kStatus_FTFx_AccessError Invalid instruction codes and out-of bounds addresses.
138 * @retval #kStatus_FTFx_ProtectionViolation The program/erase operation is requested to execute on protected areas.
139 * @retval #kStatus_FTFx_CommandFailure Run-time error during the command execution.
140 */
142 uint32_t start,
143 uint32_t lengthInBytes,
144 uint32_t key);
145
146/*!
147 * @brief Erases entire flexnvm
148 *
149 * @param config Pointer to the storage for the driver runtime state.
150 * @param key A value used to validate all flash erase APIs.
151 *
152 * @retval #kStatus_FTFx_Success API was executed successfully.
153 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
154 * @retval #kStatus_FTFx_EraseKeyError API erase key is invalid.
155 * @retval #kStatus_FTFx_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
156 * @retval #kStatus_FTFx_AccessError Invalid instruction codes and out-of bounds addresses.
157 * @retval #kStatus_FTFx_ProtectionViolation The program/erase operation is requested to execute on protected areas.
158 * @retval #kStatus_FTFx_CommandFailure Run-time error during command execution.
159 * @retval #kStatus_FTFx_PartitionStatusUpdateFailure Failed to update the partition status.
160 */
162
163/*!
164 * @brief Erases the entire flexnvm, including protected sectors.
165 *
166 * @param config Pointer to the storage for the driver runtime state.
167 * @param key A value used to validate all flash erase APIs.
168 *
169 * @retval #kStatus_FTFx_Success API was executed successfully.
170 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
171 * @retval #kStatus_FTFx_EraseKeyError API erase key is invalid.
172 * @retval #kStatus_FTFx_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
173 * @retval #kStatus_FTFx_AccessError Invalid instruction codes and out-of bounds addresses.
174 * @retval #kStatus_FTFx_ProtectionViolation The program/erase operation is requested to execute on protected areas.
175 * @retval #kStatus_FTFx_CommandFailure Run-time error during command execution.
176 * @retval #kStatus_FTFx_PartitionStatusUpdateFailure Failed to update the partition status.
177 */
178#if defined(FSL_FEATURE_FLASH_HAS_ERASE_ALL_BLOCKS_UNSECURE_CMD) && FSL_FEATURE_FLASH_HAS_ERASE_ALL_BLOCKS_UNSECURE_CMD
180#endif
181
182/*@}*/
183
184/*!
185 * @name Programming
186 * @{
187 */
188
189/*!
190 * @brief Programs flash with data at locations passed in through parameters.
191 *
192 * This function programs the flash memory with the desired data for a given
193 * flash area as determined by the start address and the length.
194 *
195 * @param config A pointer to the storage for the driver runtime state.
196 * @param start The start address of the desired flash memory to be programmed. Must be
197 * word-aligned.
198 * @param src A pointer to the source buffer of data that is to be programmed
199 * into the flash.
200 * @param lengthInBytes The length, given in bytes (not words or long-words),
201 * to be programmed. Must be word-aligned.
202 *
203 * @retval #kStatus_FTFx_Success API was executed successfully.
204 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
205 * @retval #kStatus_FTFx_AlignmentError Parameter is not aligned with the specified baseline.
206 * @retval #kStatus_FTFx_AddressError Address is out of range.
207 * @retval #kStatus_FTFx_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
208 * @retval #kStatus_FTFx_AccessError Invalid instruction codes and out-of bounds addresses.
209 * @retval #kStatus_FTFx_ProtectionViolation The program/erase operation is requested to execute on protected areas.
210 * @retval #kStatus_FTFx_CommandFailure Run-time error during the command execution.
211 */
213 uint32_t start,
214 uint8_t *src,
215 uint32_t lengthInBytes);
216
217/*!
218 * @brief Programs flash with data at locations passed in through parameters via the Program Section command.
219 *
220 * This function programs the flash memory with the desired data for a given
221 * flash area as determined by the start address and length.
222 *
223 * @param config A pointer to the storage for the driver runtime state.
224 * @param start The start address of the desired flash memory to be programmed. Must be
225 * word-aligned.
226 * @param src A pointer to the source buffer of data that is to be programmed
227 * into the flash.
228 * @param lengthInBytes The length, given in bytes (not words or long-words),
229 * to be programmed. Must be word-aligned.
230 *
231 * @retval #kStatus_FTFx_Success API was executed successfully.
232 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
233 * @retval #kStatus_FTFx_AlignmentError Parameter is not aligned with specified baseline.
234 * @retval #kStatus_FTFx_AddressError Address is out of range.
235 * @retval #kStatus_FTFx_SetFlexramAsRamError Failed to set flexram as RAM.
236 * @retval #kStatus_FTFx_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
237 * @retval #kStatus_FTFx_AccessError Invalid instruction codes and out-of bounds addresses.
238 * @retval #kStatus_FTFx_ProtectionViolation The program/erase operation is requested to execute on protected areas.
239 * @retval #kStatus_FTFx_CommandFailure Run-time error during command execution.
240 * @retval #kStatus_FTFx_RecoverFlexramAsEepromError Failed to recover FlexRAM as EEPROM.
241 */
242#if defined(FSL_FEATURE_FLASH_HAS_PROGRAM_SECTION_CMD) && FSL_FEATURE_FLASH_HAS_PROGRAM_SECTION_CMD
244 uint32_t start,
245 uint8_t *src,
246 uint32_t lengthInBytes);
247#endif
248
249/*!
250 * @brief Prepares the FlexNVM block for use as data flash, EEPROM backup, or a combination of both and initializes the
251 * FlexRAM.
252 *
253 * @param config Pointer to storage for the driver runtime state.
254 * @param option The option used to set FlexRAM load behavior during reset.
255 * @param eepromDataSizeCode Determines the amount of FlexRAM used in each of the available EEPROM subsystems.
256 * @param flexnvmPartitionCode Specifies how to split the FlexNVM block between data flash memory and EEPROM backup
257 * memory supporting EEPROM functions.
258 *
259 * @retval #kStatus_FTFx_Success API was executed successfully.
260 * @retval #kStatus_FTFx_InvalidArgument Invalid argument is provided.
261 * @retval #kStatus_FTFx_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
262 * @retval #kStatus_FTFx_AccessError Invalid instruction codes and out-of bounds addresses.
263 * @retval #kStatus_FTFx_ProtectionViolation The program/erase operation is requested to execute on protected areas.
264 * @retval #kStatus_FTFx_CommandFailure Run-time error during command execution.
265 */
268 uint32_t eepromDataSizeCode,
269 uint32_t flexnvmPartitionCode);
270
271/*@}*/
272
273/*!
274 * @name Reading
275 * @{
276 */
277
278/*!
279 * @brief Reads the resource with data at locations passed in through parameters.
280 *
281 * This function reads the flash memory with the desired location for a given
282 * flash area as determined by the start address and length.
283 *
284 * @param config A pointer to the storage for the driver runtime state.
285 * @param start The start address of the desired flash memory to be programmed. Must be
286 * word-aligned.
287 * @param dst A pointer to the destination buffer of data that is used to store
288 * data to be read.
289 * @param lengthInBytes The length, given in bytes (not words or long-words),
290 * to be read. Must be word-aligned.
291 * @param option The resource option which indicates which area should be read back.
292 *
293 * @retval #kStatus_FTFx_Success API was executed successfully.
294 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
295 * @retval #kStatus_FTFx_AlignmentError Parameter is not aligned with the specified baseline.
296 * @retval #kStatus_FTFx_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
297 * @retval #kStatus_FTFx_AccessError Invalid instruction codes and out-of bounds addresses.
298 * @retval #kStatus_FTFx_ProtectionViolation The program/erase operation is requested to execute on protected areas.
299 * @retval #kStatus_FTFx_CommandFailure Run-time error during the command execution.
300 */
301#if defined(FSL_FEATURE_FLASH_HAS_READ_RESOURCE_CMD) && FSL_FEATURE_FLASH_HAS_READ_RESOURCE_CMD
303 uint32_t start,
304 uint8_t *dst,
305 uint32_t lengthInBytes,
307#endif
308
309/*@}*/
310
311/*!
312 * @name Verification
313 * @{
314 */
315
316/*!
317 * @brief Verifies an erasure of the desired flash area at a specified margin level.
318 *
319 * This function checks the appropriate number of flash sectors based on
320 * the desired start address and length to check whether the flash is erased
321 * to the specified read margin level.
322 *
323 * @param config A pointer to the storage for the driver runtime state.
324 * @param start The start address of the desired flash memory to be verified.
325 * The start address does not need to be sector-aligned but must be word-aligned.
326 * @param lengthInBytes The length, given in bytes (not words or long-words),
327 * to be verified. Must be word-aligned.
328 * @param margin Read margin choice.
329 *
330 * @retval #kStatus_FTFx_Success API was executed successfully.
331 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
332 * @retval #kStatus_FTFx_AlignmentError Parameter is not aligned with specified baseline.
333 * @retval #kStatus_FTFx_AddressError Address is out of range.
334 * @retval #kStatus_FTFx_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
335 * @retval #kStatus_FTFx_AccessError Invalid instruction codes and out-of bounds addresses.
336 * @retval #kStatus_FTFx_ProtectionViolation The program/erase operation is requested to execute on protected areas.
337 * @retval #kStatus_FTFx_CommandFailure Run-time error during the command execution.
338 */
340 uint32_t start,
341 uint32_t lengthInBytes,
342 ftfx_margin_value_t margin);
343
344/*!
345 * @brief Verifies erasure of the entire flash at a specified margin level.
346 *
347 * This function checks whether the flash is erased to the
348 * specified read margin level.
349 *
350 * @param config A pointer to the storage for the driver runtime state.
351 * @param margin Read margin choice.
352 *
353 * @retval #kStatus_FTFx_Success API was executed successfully.
354 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
355 * @retval #kStatus_FTFx_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
356 * @retval #kStatus_FTFx_AccessError Invalid instruction codes and out-of bounds addresses.
357 * @retval #kStatus_FTFx_ProtectionViolation The program/erase operation is requested to execute on protected areas.
358 * @retval #kStatus_FTFx_CommandFailure Run-time error during the command execution.
359 */
361
362/*!
363 * @brief Verifies programming of the desired flash area at a specified margin level.
364 *
365 * This function verifies the data programed in the flash memory using the
366 * Flash Program Check Command and compares it to the expected data for a given
367 * flash area as determined by the start address and length.
368 *
369 * @param config A pointer to the storage for the driver runtime state.
370 * @param start The start address of the desired flash memory to be verified. Must be word-aligned.
371 * @param lengthInBytes The length, given in bytes (not words or long-words),
372 * to be verified. Must be word-aligned.
373 * @param expectedData A pointer to the expected data that is to be
374 * verified against.
375 * @param margin Read margin choice.
376 * @param failedAddress A pointer to the returned failing address.
377 * @param failedData A pointer to the returned failing data. Some derivatives do
378 * not include failed data as part of the FCCOBx registers. In this
379 * case, zeros are returned upon failure.
380 *
381 * @retval #kStatus_FTFx_Success API was executed successfully.
382 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
383 * @retval #kStatus_FTFx_AlignmentError Parameter is not aligned with specified baseline.
384 * @retval #kStatus_FTFx_AddressError Address is out of range.
385 * @retval #kStatus_FTFx_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
386 * @retval #kStatus_FTFx_AccessError Invalid instruction codes and out-of bounds addresses.
387 * @retval #kStatus_FTFx_ProtectionViolation The program/erase operation is requested to execute on protected areas.
388 * @retval #kStatus_FTFx_CommandFailure Run-time error during the command execution.
389 */
391 uint32_t start,
392 uint32_t lengthInBytes,
393 const uint8_t *expectedData,
394 ftfx_margin_value_t margin,
395 uint32_t *failedAddress,
396 uint32_t *failedData);
397
398/*@}*/
399
400/*!
401 * @name Security
402 * @{
403 */
404
405/*!
406 * @brief Returns the security state via the pointer passed into the function.
407 *
408 * This function retrieves the current flash security status, including the
409 * security enabling state and the backdoor key enabling state.
410 *
411 * @param config A pointer to storage for the driver runtime state.
412 * @param state A pointer to the value returned for the current security status code:
413 *
414 * @retval #kStatus_FTFx_Success API was executed successfully.
415 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
416 */
418
419/*!
420 * @brief Allows users to bypass security with a backdoor key.
421 *
422 * If the MCU is in secured state, this function unsecures the MCU by
423 * comparing the provided backdoor key with ones in the flash configuration
424 * field.
425 *
426 * @param config A pointer to the storage for the driver runtime state.
427 * @param backdoorKey A pointer to the user buffer containing the backdoor key.
428 *
429 * @retval #kStatus_FTFx_Success API was executed successfully.
430 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
431 * @retval #kStatus_FTFx_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
432 * @retval #kStatus_FTFx_AccessError Invalid instruction codes and out-of bounds addresses.
433 * @retval #kStatus_FTFx_ProtectionViolation The program/erase operation is requested to execute on protected areas.
434 * @retval #kStatus_FTFx_CommandFailure Run-time error during the command execution.
435 */
436status_t FLEXNVM_SecurityBypass(flexnvm_config_t *config, const uint8_t *backdoorKey);
437
438/*@}*/
439
440/*!
441 * @name FlexRAM
442 * @{
443 */
444
445/*!
446 * @brief Sets the FlexRAM function command.
447 *
448 * @param config A pointer to the storage for the driver runtime state.
449 * @param option The option used to set the work mode of FlexRAM.
450 *
451 * @retval #kStatus_FTFx_Success API was executed successfully.
452 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
453 * @retval #kStatus_FTFx_ExecuteInRamFunctionNotReady Execute-in-RAM function is not available.
454 * @retval #kStatus_FTFx_AccessError Invalid instruction codes and out-of bounds addresses.
455 * @retval #kStatus_FTFx_ProtectionViolation The program/erase operation is requested to execute on protected areas.
456 * @retval #kStatus_FTFx_CommandFailure Run-time error during the command execution.
457 */
458#if defined(FSL_FEATURE_FLASH_HAS_SET_FLEXRAM_FUNCTION_CMD) && FSL_FEATURE_FLASH_HAS_SET_FLEXRAM_FUNCTION_CMD
460#endif
461
462/*@}*/
463
464/*!
465 * @brief Programs the EEPROM with data at locations passed in through parameters.
466 *
467 * This function programs the emulated EEPROM with the desired data for a given
468 * flash area as determined by the start address and length.
469 *
470 * @param config A pointer to the storage for the driver runtime state.
471 * @param start The start address of the desired flash memory to be programmed. Must be
472 * word-aligned.
473 * @param src A pointer to the source buffer of data that is to be programmed
474 * into the flash.
475 * @param lengthInBytes The length, given in bytes (not words or long-words),
476 * to be programmed. Must be word-aligned.
477 *
478 * @retval #kStatus_FTFx_Success API was executed successfully.
479 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
480 * @retval #kStatus_FTFx_AddressError Address is out of range.
481 * @retval #kStatus_FTFx_SetFlexramAsEepromError Failed to set flexram as eeprom.
482 * @retval #kStatus_FTFx_ProtectionViolation The program/erase operation is requested to execute on protected areas.
483 * @retval #kStatus_FTFx_RecoverFlexramAsRamError Failed to recover the FlexRAM as RAM.
484 */
485status_t FLEXNVM_EepromWrite(flexnvm_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes);
486
487/*!
488* @name Flash Protection Utilities
489* @{
490*/
491
492/*!
493 * @brief Sets the DFlash protection to the intended protection status.
494 *
495 * @param config A pointer to the storage for the driver runtime state.
496 * @param protectStatus The expected protect status to set to the DFlash protection register. Each bit
497 * corresponds to the protection of the 1/8 of the total DFlash. The least significant bit corresponds to the lowest
498 * address area of the DFlash. The most significant bit corresponds to the highest address area of the DFlash. There
499 * are
500 * two possible cases as shown below:
501 * 0: this area is protected.
502 * 1: this area is unprotected.
503 *
504 * @retval #kStatus_FTFx_Success API was executed successfully.
505 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
506 * @retval #kStatus_FTFx_CommandNotSupported Flash API is not supported.
507 * @retval #kStatus_FTFx_CommandFailure Run-time error during command execution.
508 */
510
511/*!
512 * @brief Gets the DFlash protection status.
513 *
514 * @param config A pointer to the storage for the driver runtime state.
515 * @param protectStatus DFlash Protect status returned by the PFlash IP. Each bit corresponds to the protection of the
516 * 1/8 of
517 * the total DFlash. The least significant bit corresponds to the lowest address area of the DFlash. The most
518 * significant bit corresponds to the highest address area of the DFlash, and so on. There are two possible cases as
519 * below:
520 * 0: this area is protected.
521 * 1: this area is unprotected.
522 *
523 * @retval #kStatus_FTFx_Success API was executed successfully.
524 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
525 * @retval #kStatus_FTFx_CommandNotSupported Flash API is not supported.
526 */
528
529/*!
530 * @brief Sets the EEPROM protection to the intended protection status.
531 *
532 * @param config A pointer to the storage for the driver runtime state.
533 * @param protectStatus The expected protect status to set to the EEPROM protection register. Each bit
534 * corresponds to the protection of the 1/8 of the total EEPROM. The least significant bit corresponds to the lowest
535 * address area of the EEPROM. The most significant bit corresponds to the highest address area of EEPROM, and so on.
536 * There are two possible cases as shown below:
537 * 0: this area is protected.
538 * 1: this area is unprotected.
539 *
540 * @retval #kStatus_FTFx_Success API was executed successfully.
541 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
542 * @retval #kStatus_FTFx_CommandNotSupported Flash API is not supported.
543 * @retval #kStatus_FTFx_CommandFailure Run-time error during command execution.
544 */
546
547/*!
548 * @brief Gets the EEPROM protection status.
549 *
550 * @param config A pointer to the storage for the driver runtime state.
551 * @param protectStatus DFlash Protect status returned by the PFlash IP. Each bit corresponds to the protection of the
552 * 1/8 of
553 * the total EEPROM. The least significant bit corresponds to the lowest address area of the EEPROM. The most
554 * significant bit corresponds to the highest address area of the EEPROM. There are two possible cases as below:
555 * 0: this area is protected.
556 * 1: this area is unprotected.
557 *
558 * @retval #kStatus_FTFx_Success API was executed successfully.
559 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
560 * @retval #kStatus_FTFx_CommandNotSupported Flash API is not supported.
561 */
563
564/*@}*/
565
566/*!
567 * @name Properties
568 * @{
569 */
570
571/*!
572 * @brief Returns the desired flexnvm property.
573 *
574 * @param config A pointer to the storage for the driver runtime state.
575 * @param whichProperty The desired property from the list of properties in
576 * enum flexnvm_property_tag_t
577 * @param value A pointer to the value returned for the desired flexnvm property.
578 *
579 * @retval #kStatus_FTFx_Success API was executed successfully.
580 * @retval #kStatus_FTFx_InvalidArgument An invalid argument is provided.
581 * @retval #kStatus_FTFx_UnknownProperty An unknown property tag.
582 */
584
585
586#if defined(__cplusplus)
587}
588#endif
589
590/*! @}*/
591
592#endif /* _FSL_FTFX_FLEXNVM_H_ */
static constexpr persistent_config_s * config
enum _ftfx_read_resource_opt ftfx_read_resource_opt_t
Enumeration for the two possible options of flash read resource command.
enum _ftfx_margin_value ftfx_margin_value_t
Enumeration for supported FTFx margin levels.
enum _ftfx_flexram_function_option ftfx_flexram_func_opt_t
Enumeration for the two possilbe options of set FlexRAM function command.
enum _ftfx_security_state ftfx_security_state_t
Enumeration for the three possible FTFx security states.
enum _ftfx_partition_flexram_load_option ftfx_partition_flexram_load_opt_t
Enumeration for the FlexRAM load during reset option.
status_t FLEXNVM_EraseAllUnsecure(flexnvm_config_t *config, uint32_t key)
Erases the entire flexnvm, including protected sectors.
status_t FLEXNVM_SecurityBypass(flexnvm_config_t *config, const uint8_t *backdoorKey)
Allows users to bypass security with a backdoor key.
status_t FLEXNVM_DflashSetProtection(flexnvm_config_t *config, uint8_t protectStatus)
Sets the DFlash protection to the intended protection status.
enum _flexnvm_property_tag flexnvm_property_tag_t
Enumeration for various flexnvm properties.
status_t FLEXNVM_DflashVerifyProgram(flexnvm_config_t *config, uint32_t start, uint32_t lengthInBytes, const uint8_t *expectedData, ftfx_margin_value_t margin, uint32_t *failedAddress, uint32_t *failedData)
Verifies programming of the desired flash area at a specified margin level.
status_t FLEXNVM_EepromWrite(flexnvm_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes)
Programs the EEPROM with data at locations passed in through parameters.
status_t FLEXNVM_VerifyEraseAll(flexnvm_config_t *config, ftfx_margin_value_t margin)
Verifies erasure of the entire flash at a specified margin level.
ftfx_config_t ftfxConfig
_flexnvm_property_tag
Enumeration for various flexnvm properties.
status_t FLEXNVM_GetSecurityState(flexnvm_config_t *config, ftfx_security_state_t *state)
Returns the security state via the pointer passed into the function.
status_t FLEXNVM_DflashErase(flexnvm_config_t *config, uint32_t start, uint32_t lengthInBytes, uint32_t key)
Erases the Dflash sectors encompassed by parameters passed into function.
status_t FLEXNVM_EepromSetProtection(flexnvm_config_t *config, uint8_t protectStatus)
Sets the EEPROM protection to the intended protection status.
status_t FLEXNVM_DflashProgram(flexnvm_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes)
Programs flash with data at locations passed in through parameters.
status_t FLEXNVM_EraseAll(flexnvm_config_t *config, uint32_t key)
Erases entire flexnvm.
status_t FLEXNVM_DflashProgramSection(flexnvm_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes)
Programs flash with data at locations passed in through parameters via the Program Section command.
status_t FLEXNVM_ProgramPartition(flexnvm_config_t *config, ftfx_partition_flexram_load_opt_t option, uint32_t eepromDataSizeCode, uint32_t flexnvmPartitionCode)
Prepares the FlexNVM block for use as data flash, EEPROM backup, or a combination of both and initial...
struct _flexnvm_config flexnvm_config_t
Flexnvm driver state information.
status_t FLEXNVM_Init(flexnvm_config_t *config)
Initializes the global flash properties structure members.
status_t FLEXNVM_ReadResource(flexnvm_config_t *config, uint32_t start, uint8_t *dst, uint32_t lengthInBytes, ftfx_read_resource_opt_t option)
Reads the resource with data at locations passed in through parameters.
status_t FLEXNVM_GetProperty(flexnvm_config_t *config, flexnvm_property_tag_t whichProperty, uint32_t *value)
Returns the desired flexnvm property.
status_t FLEXNVM_DflashVerifyErase(flexnvm_config_t *config, uint32_t start, uint32_t lengthInBytes, ftfx_margin_value_t margin)
Verifies an erasure of the desired flash area at a specified margin level.
status_t FLEXNVM_EepromGetProtection(flexnvm_config_t *config, uint8_t *protectStatus)
Gets the EEPROM protection status.
status_t FLEXNVM_DflashGetProtection(flexnvm_config_t *config, uint8_t *protectStatus)
Gets the DFlash protection status.
status_t FLEXNVM_SetFlexramFunction(flexnvm_config_t *config, ftfx_flexram_func_opt_t option)
Sets the FlexRAM function command.
@ kFLEXNVM_PropertyDflashBlockSize
@ kFLEXNVM_PropertyDflashBlockCount
@ kFLEXNVM_PropertyEepromTotalSize
@ kFLEXNVM_PropertyFlexRamBlockBaseAddr
@ kFLEXNVM_PropertyDflashSectorSize
@ kFLEXNVM_PropertyFlexRamTotalSize
@ kFLEXNVM_PropertyDflashTotalSize
@ kFLEXNVM_PropertyDflashBlockBaseAddr
int32_t status_t
Type used for all status and error return values.
Definition fsl_common.h:169
static status_t protectStatus
Definition flash_int.cpp:27
state("state", SensorCategory.SENSOR_INPUTS, FieldType.INT8, 1871, 1.0, -1.0, -1.0, "")
Flexnvm driver state information.
Flash driver state information.