fsl_iap.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. /*
  2. * Copyright 2018 NXP
  3. * All rights reserved.
  4. *
  5. * SPDX-License-Identifier: BSD-3-Clause
  6. *
  7. */
  8. #ifndef __FSL_IAP_H_
  9. #define __FSL_IAP_H_
  10. #include "fsl_common.h"
  11. /*!
  12. * @addtogroup iap_driver
  13. * @{
  14. */
  15. /*! @file */
  16. /*******************************************************************************
  17. * Definitions
  18. ******************************************************************************/
  19. /*!
  20. * @name Flash version
  21. * @{
  22. */
  23. /*! @brief Constructs the version number for drivers. */
  24. #if !defined(MAKE_VERSION)
  25. #define MAKE_VERSION(major, minor, bugfix) (((major) << 16) | ((minor) << 8) | (bugfix))
  26. #endif
  27. /*! @brief Flash driver version for SDK*/
  28. #define FSL_FLASH_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) /*!< Version 2.0.0. */
  29. /*! @brief Flash driver version for ROM*/
  30. enum _flash_driver_version_constants
  31. {
  32. kFLASH_DriverVersionName = 'F', /*!< Flash driver version name.*/
  33. kFLASH_DriverVersionMajor = 2, /*!< Major flash driver version.*/
  34. kFLASH_DriverVersionMinor = 0, /*!< Minor flash driver version.*/
  35. kFLASH_DriverVersionBugfix = 0 /*!< Bugfix for flash driver version.*/
  36. };
  37. /*@}*/
  38. /*!
  39. * @name Flash configuration
  40. * @{
  41. */
  42. /*! @brief Flash IP Type. */
  43. #if !defined(FSL_FEATURE_FLASH_IP_IS_C040HD_ATFC)
  44. #define FSL_FEATURE_FLASH_IP_IS_C040HD_ATFC (1)
  45. #endif
  46. #if !defined(FSL_FEATURE_FLASH_IP_IS_C040HD_FC)
  47. #define FSL_FEATURE_FLASH_IP_IS_C040HD_FC (0)
  48. #endif
  49. /*@}*/
  50. /*!
  51. * @name Flash status
  52. * @{
  53. */
  54. /*! @brief Flash driver status group. */
  55. #if defined(kStatusGroup_FlashDriver)
  56. #define kStatusGroupGeneric kStatusGroup_Generic
  57. #define kStatusGroupFlashDriver kStatusGroup_FlashDriver
  58. #elif defined(kStatusGroup_FLASHIAP)
  59. #define kStatusGroupGeneric kStatusGroup_Generic
  60. #define kStatusGroupFlashDriver kStatusGroup_FLASH
  61. #else
  62. #define kStatusGroupGeneric 0
  63. #define kStatusGroupFlashDriver 1
  64. #endif
  65. /*! @brief Constructs a status code value from a group and a code number. */
  66. #if !defined(MAKE_STATUS)
  67. #define MAKE_STATUS(group, code) ((((group)*100) + (code)))
  68. #endif
  69. /*!
  70. * @brief Flash driver status codes.
  71. */
  72. enum _flash_status
  73. {
  74. kStatus_FLASH_Success = MAKE_STATUS(kStatusGroupGeneric, 0), /*!< API is executed successfully*/
  75. kStatus_FLASH_InvalidArgument = MAKE_STATUS(kStatusGroupGeneric, 4), /*!< Invalid argument*/
  76. kStatus_FLASH_SizeError = MAKE_STATUS(kStatusGroupFlashDriver, 0), /*!< Error size*/
  77. kStatus_FLASH_AlignmentError =
  78. MAKE_STATUS(kStatusGroupFlashDriver, 1), /*!< Parameter is not aligned with the specified baseline*/
  79. kStatus_FLASH_AddressError = MAKE_STATUS(kStatusGroupFlashDriver, 2), /*!< Address is out of range */
  80. kStatus_FLASH_AccessError =
  81. MAKE_STATUS(kStatusGroupFlashDriver, 3), /*!< Invalid instruction codes and out-of bound addresses */
  82. kStatus_FLASH_ProtectionViolation = MAKE_STATUS(
  83. kStatusGroupFlashDriver, 4), /*!< The program/erase operation is requested to execute on protected areas */
  84. kStatus_FLASH_CommandFailure =
  85. MAKE_STATUS(kStatusGroupFlashDriver, 5), /*!< Run-time error during command execution. */
  86. kStatus_FLASH_UnknownProperty = MAKE_STATUS(kStatusGroupFlashDriver, 6), /*!< Unknown property.*/
  87. kStatus_FLASH_EraseKeyError = MAKE_STATUS(kStatusGroupFlashDriver, 7), /*!< API erase key is invalid.*/
  88. kStatus_FLASH_RegionExecuteOnly =
  89. MAKE_STATUS(kStatusGroupFlashDriver, 8), /*!< The current region is execute-only.*/
  90. kStatus_FLASH_ExecuteInRamFunctionNotReady =
  91. MAKE_STATUS(kStatusGroupFlashDriver, 9), /*!< Execute-in-RAM function is not available.*/
  92. kStatus_FLASH_CommandNotSupported = MAKE_STATUS(kStatusGroupFlashDriver, 11), /*!< Flash API is not supported.*/
  93. kStatus_FLASH_ReadOnlyProperty = MAKE_STATUS(kStatusGroupFlashDriver, 12), /*!< The flash property is read-only.*/
  94. kStatus_FLASH_InvalidPropertyValue =
  95. MAKE_STATUS(kStatusGroupFlashDriver, 13), /*!< The flash property value is out of range.*/
  96. kStatus_FLASH_InvalidSpeculationOption =
  97. MAKE_STATUS(kStatusGroupFlashDriver, 14), /*!< The option of flash prefetch speculation is invalid.*/
  98. kStatus_FLASH_EccError = MAKE_STATUS(kStatusGroupFlashDriver,
  99. 0x10), /*!< A correctable or uncorrectable error during command execution. */
  100. kStatus_FLASH_CompareError =
  101. MAKE_STATUS(kStatusGroupFlashDriver, 0x11), /*!< Destination and source memory contents do not match. */
  102. kStatus_FLASH_RegulationLoss = MAKE_STATUS(kStatusGroupFlashDriver, 0x12), /*!< A loss of regulation during read. */
  103. kStatus_FLASH_InvalidWaitStateCycles =
  104. MAKE_STATUS(kStatusGroupFlashDriver, 0x13), /*!< The wait state cycle set to r/w mode is invalid. */
  105. kStatus_FLASH_OutOfDateCfpaPage =
  106. MAKE_STATUS(kStatusGroupFlashDriver, 0x20), /*!< CFPA page version is out of date. */
  107. kStatus_FLASH_BlankIfrPageData = MAKE_STATUS(kStatusGroupFlashDriver, 0x21), /*!< Blank page cannnot be read. */
  108. kStatus_FLASH_EncryptedRegionsEraseNotDoneAtOnce =
  109. MAKE_STATUS(kStatusGroupFlashDriver, 0x22), /*!< Encrypted flash subregions are not erased at once. */
  110. kStatus_FLASH_ProgramVerificationNotAllowed = MAKE_STATUS(
  111. kStatusGroupFlashDriver, 0x23), /*!< Program verification is not allowed when the encryption is enabled. */
  112. kStatus_FLASH_HashCheckError =
  113. MAKE_STATUS(kStatusGroupFlashDriver, 0x24), /*!< Hash check of page data is failed. */
  114. kStatus_FLASH_SealedFfrRegion = MAKE_STATUS(kStatusGroupFlashDriver, 0x25), /*!< The FFR region is sealed. */
  115. kStatus_FLASH_FfrRegionWriteBroken = MAKE_STATUS(
  116. kStatusGroupFlashDriver, 0x26), /*!< The FFR Spec region is not allowed to be written discontinuously. */
  117. kStatus_FLASH_NmpaAccessNotAllowed =
  118. MAKE_STATUS(kStatusGroupFlashDriver, 0x27), /*!< The NMPA region is not allowed to be read/written/erased. */
  119. kStatus_FLASH_CmpaCfgDirectEraseNotAllowed =
  120. MAKE_STATUS(kStatusGroupFlashDriver, 0x28), /*!< The CMPA Cfg region is not allowed to be erased directly. */
  121. kStatus_FLASH_FfrBankIsLocked = MAKE_STATUS(kStatusGroupFlashDriver, 0x29), /*!< The FFR bank region is locked. */
  122. };
  123. /*@}*/
  124. /*!
  125. * @name Flash API key
  126. * @{
  127. */
  128. /*! @brief Constructs the four character code for the Flash driver API key. */
  129. #if !defined(FOUR_CHAR_CODE)
  130. #define FOUR_CHAR_CODE(a, b, c, d) (((d) << 24) | ((c) << 16) | ((b) << 8) | ((a)))
  131. #endif
  132. /*!
  133. * @brief Enumeration for Flash driver API keys.
  134. *
  135. * @note The resulting value is built with a byte order such that the string
  136. * being readable in expected order when viewed in a hex editor, if the value
  137. * is treated as a 32-bit little endian value.
  138. */
  139. enum _flash_driver_api_keys
  140. {
  141. kFLASH_ApiEraseKey = FOUR_CHAR_CODE('l', 'f', 'e', 'k') /*!< Key value used to validate all flash erase APIs.*/
  142. };
  143. /*@}*/
  144. /*!
  145. * @brief Enumeration for various flash properties.
  146. */
  147. typedef enum _flash_property_tag
  148. {
  149. kFLASH_PropertyPflashSectorSize = 0x00U, /*!< Pflash sector size property.*/
  150. kFLASH_PropertyPflashTotalSize = 0x01U, /*!< Pflash total size property.*/
  151. kFLASH_PropertyPflashBlockSize = 0x02U, /*!< Pflash block size property.*/
  152. kFLASH_PropertyPflashBlockCount = 0x03U, /*!< Pflash block count property.*/
  153. kFLASH_PropertyPflashBlockBaseAddr = 0x04U, /*!< Pflash block base address property.*/
  154. kFLASH_PropertyPflashPageSize = 0x30U, /*!< Pflash page size property.*/
  155. kFLASH_PropertyPflashSystemFreq = 0x31U, /*!< System Frequency System Frequency.*/
  156. kFLASH_PropertyFfrSectorSize = 0x40U, /*!< FFR sector size property.*/
  157. kFLASH_PropertyFfrTotalSize = 0x41U, /*!< FFR total size property.*/
  158. kFLASH_PropertyFfrBlockBaseAddr = 0x42U, /*!< FFR block base address property.*/
  159. kFLASH_PropertyFfrPageSize = 0x43U, /*!< FFR page size property.*/
  160. } flash_property_tag_t;
  161. /*!
  162. * @brief Enumeration for flash max pages to erase.
  163. */
  164. enum _flash_max_erase_page_value
  165. {
  166. kFLASH_MaxPagesToErase = 100U /*!< The max value in pages to erase. */
  167. };
  168. enum _flash_freq_tag
  169. {
  170. kSysToFlashFreq_lowInMHz = 12u,
  171. kSysToFlashFreq_defaultInMHz = 96u,
  172. kSysToFlashFreq_100MHz = 100u
  173. };
  174. /*!
  175. * @brief Enumeration for flash alignment property.
  176. */
  177. enum _flash_alignment_property
  178. {
  179. kFLASH_AlignementUnitVerifyErase = 4, /*!< The alignment unit in bytes used for verify erase operation.*/
  180. kFLASH_AlignementUnitProgram = 512, /*!< The alignment unit in bytes used for program operation.*/
  181. /*kFLASH_AlignementUnitVerifyProgram = 4,*/ /*!< The alignment unit in bytes used for verify program operation.*/
  182. kFLASH_AlignementUnitSingleWordRead = 16 /*!< The alignment unit in bytes used for SingleWordRead command.*/
  183. };
  184. /*!
  185. * @brief Enumeration for flash read ecc option
  186. */
  187. enum _flash_read_ecc_option
  188. {
  189. kFLASH_ReadWithEccOn = 0, /*! ECC is on */
  190. kFLASH_ReadWithEccOff = 1, /*! ECC is off */
  191. };
  192. /*!
  193. * @brief Enumeration for flash read margin option
  194. */
  195. enum _flash_read_margin_option
  196. {
  197. kFLASH_ReadMarginNormal = 0, /*!< Normal read */
  198. kFLASH_ReadMarginVsProgram = 1, /*!< Margin vs. program */
  199. kFLASH_ReadMarginVsErase = 2, /*!< Margin vs. erase */
  200. kFLASH_ReadMarginIllegalBitCombination = 3 /*!< Illegal bit combination */
  201. };
  202. /*!
  203. * @brief Enumeration for flash read dmacc option
  204. */
  205. enum _flash_read_dmacc_option
  206. {
  207. kFLASH_ReadDmaccDisabled = 0, /*!< Memory word */
  208. kFLASH_ReadDmaccEnabled = 1, /*!< DMACC word */
  209. };
  210. /*!
  211. * @brief Enumeration for flash ramp control option
  212. */
  213. enum _flash_ramp_control_option
  214. {
  215. kFLASH_RampControlDivisionFactorReserved = 0, /*!< Reserved */
  216. kFLASH_RampControlDivisionFactor256 = 1, /*!< clk48mhz / 256 = 187.5KHz */
  217. kFLASH_RampControlDivisionFactor128 = 2, /*!< clk48mhz / 128 = 375KHz */
  218. kFLASH_RampControlDivisionFactor64 = 3 /*!< clk48mhz / 64 = 750KHz */
  219. };
  220. /*! @brief Flash ECC log info. */
  221. typedef struct _flash_ecc_log
  222. {
  223. uint32_t firstEccEventAddress;
  224. uint32_t eccErrorCount;
  225. uint32_t eccCorrectionCount;
  226. uint32_t reserved;
  227. } flash_ecc_log_t;
  228. /*! @brief Flash controller paramter config. */
  229. typedef struct _flash_mode_config
  230. {
  231. uint32_t sysFreqInMHz;
  232. /* ReadSingleWord parameter. */
  233. struct
  234. {
  235. uint8_t readWithEccOff : 1;
  236. uint8_t readMarginLevel : 2;
  237. uint8_t readDmaccWord : 1;
  238. uint8_t reserved0 : 4;
  239. uint8_t reserved1[3];
  240. } readSingleWord;
  241. /* SetWriteMode parameter. */
  242. struct
  243. {
  244. uint8_t programRampControl;
  245. uint8_t eraseRampControl;
  246. uint8_t reserved[2];
  247. } setWriteMode;
  248. /* SetReadMode parameter. */
  249. struct
  250. {
  251. uint16_t readInterfaceTimingTrim;
  252. uint16_t readControllerTimingTrim;
  253. uint8_t readWaitStates;
  254. uint8_t reserved[3];
  255. } setReadMode;
  256. } flash_mode_config_t;
  257. /*! @brief Flash controller paramter config. */
  258. typedef struct _flash_ffr_config
  259. {
  260. uint32_t ffrBlockBase;
  261. uint32_t ffrTotalSize;
  262. uint32_t ffrPageSize;
  263. uint32_t cfpaPageVersion;
  264. uint32_t cfpaPageOffset;
  265. } flash_ffr_config_t;
  266. /*! @brief Flash driver state information.
  267. *
  268. * An instance of this structure is allocated by the user of the flash driver and
  269. * passed into each of the driver APIs.
  270. */
  271. typedef struct _flash_config
  272. {
  273. uint32_t PFlashBlockBase; /*!< A base address of the first PFlash block */
  274. uint32_t PFlashTotalSize; /*!< The size of the combined PFlash block. */
  275. uint32_t PFlashBlockCount; /*!< A number of PFlash blocks. */
  276. uint32_t PFlashPageSize; /*!< The size in bytes of a page of PFlash. */
  277. uint32_t PFlashSectorSize; /*!< The size in bytes of a sector of PFlash. */
  278. flash_ffr_config_t ffrConfig;
  279. flash_mode_config_t modeConfig;
  280. } flash_config_t;
  281. /*******************************************************************************
  282. * API
  283. ******************************************************************************/
  284. #if defined(__cplusplus)
  285. extern "C" {
  286. #endif
  287. /*!
  288. * @name Initialization
  289. * @{
  290. */
  291. /*!
  292. * @brief Initializes the global flash properties structure members.
  293. *
  294. * This function checks and initializes the Flash module for the other Flash APIs.
  295. *
  296. * @param config Pointer to the storage for the driver runtime state.
  297. *
  298. * @retval #kStatus_FLASH_Success API was executed successfully.
  299. * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
  300. * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
  301. * @retval #kStatus_FLASH_CommandNotSupported Flash API is not supported.
  302. * @retval #kStatus_FLASH_EccError A correctable or uncorrectable error during command execution.
  303. */
  304. status_t FLASH_Init(flash_config_t *config);
  305. /*@}*/
  306. /*!
  307. * @name Erasing
  308. * @{
  309. */
  310. /*!
  311. * @brief Erases the flash sectors encompassed by parameters passed into function.
  312. *
  313. * This function erases the appropriate number of flash sectors based on the
  314. * desired start address and length.
  315. *
  316. * @param config The pointer to the storage for the driver runtime state.
  317. * @param start The start address of the desired flash memory to be erased.
  318. * The start address does not need to be sector-aligned.
  319. * @param lengthInBytes The length, given in bytes (not words or long-words)
  320. * to be erased. Must be word-aligned.
  321. * @param key The value used to validate all flash erase APIs.
  322. *
  323. * @retval #kStatus_FLASH_Success API was executed successfully.
  324. * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
  325. * @retval #kStatus_FLASH_AlignmentError The parameter is not aligned with the specified baseline.
  326. * @retval #kStatus_FLASH_AddressError The address is out of range.
  327. * @retval #kStatus_FLASH_EraseKeyError The API erase key is invalid.
  328. * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
  329. * @retval #kStatus_FLASH_CommandNotSupported Flash API is not supported.
  330. * @retval #kStatus_FLASH_EccError A correctable or uncorrectable error during command execution.
  331. */
  332. status_t FLASH_Erase(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, uint32_t key);
  333. /*@}*/
  334. /*!
  335. * @name Programming
  336. * @{
  337. */
  338. /*!
  339. * @brief Programs flash with data at locations passed in through parameters.
  340. *
  341. * This function programs the flash memory with the desired data for a given
  342. * flash area as determined by the start address and the length.
  343. *
  344. * @param config A pointer to the storage for the driver runtime state.
  345. * @param start The start address of the desired flash memory to be programmed. Must be
  346. * word-aligned.
  347. * @param src A pointer to the source buffer of data that is to be programmed
  348. * into the flash.
  349. * @param lengthInBytes The length, given in bytes (not words or long-words),
  350. * to be programmed. Must be word-aligned.
  351. *
  352. * @retval #kStatus_FLASH_Success API was executed successfully.
  353. * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
  354. * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with the specified baseline.
  355. * @retval #kStatus_FLASH_AddressError Address is out of range.
  356. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
  357. * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
  358. * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
  359. * @retval #kStatus_FLASH_CommandNotSupported Flash API is not supported.
  360. * @retval #kStatus_FLASH_EccError A correctable or uncorrectable error during command execution.
  361. */
  362. status_t FLASH_Program(flash_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes);
  363. /*@}*/
  364. /*!
  365. * @name Verification
  366. * @{
  367. */
  368. /*!
  369. * @brief Verifies an erasure of the desired flash area at a specified margin level.
  370. *
  371. * This function checks the appropriate number of flash sectors based on
  372. * the desired start address and length to check whether the flash is erased
  373. * to the specified read margin level.
  374. *
  375. * @param config A pointer to the storage for the driver runtime state.
  376. * @param start The start address of the desired flash memory to be verified.
  377. * The start address does not need to be sector-aligned but must be word-aligned.
  378. * @param lengthInBytes The length, given in bytes (not words or long-words),
  379. * to be verified. Must be word-aligned.
  380. * @param margin Read margin choice.
  381. *
  382. * @retval #kStatus_FLASH_Success API was executed successfully.
  383. * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
  384. * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline.
  385. * @retval #kStatus_FLASH_AddressError Address is out of range.
  386. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
  387. * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
  388. * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
  389. * @retval #kStatus_FLASH_CommandNotSupported Flash API is not supported.
  390. * @retval #kStatus_FLASH_EccError A correctable or uncorrectable error during command execution.
  391. */
  392. status_t FLASH_VerifyErase(flash_config_t *config, uint32_t start, uint32_t lengthInBytes);
  393. /*!
  394. * @brief Verifies programming of the desired flash area at a specified margin level.
  395. *
  396. * This function verifies the data programed in the flash memory using the
  397. * Flash Program Check Command and compares it to the expected data for a given
  398. * flash area as determined by the start address and length.
  399. *
  400. * @param config A pointer to the storage for the driver runtime state.
  401. * @param start The start address of the desired flash memory to be verified. Must be word-aligned.
  402. * @param lengthInBytes The length, given in bytes (not words or long-words),
  403. * to be verified. Must be word-aligned.
  404. * @param expectedData A pointer to the expected data that is to be
  405. * verified against.
  406. * @param margin Read margin choice.
  407. * @param failedAddress A pointer to the returned failing address.
  408. * @param failedData A pointer to the returned failing data. Some derivatives do
  409. * not include failed data as part of the FCCOBx registers. In this
  410. * case, zeros are returned upon failure.
  411. *
  412. * @retval #kStatus_FLASH_Success API was executed successfully.
  413. * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
  414. * @retval #kStatus_FLASH_AlignmentError Parameter is not aligned with specified baseline.
  415. * @retval #kStatus_FLASH_AddressError Address is out of range.
  416. * @retval #kStatus_FLASH_AccessError Invalid instruction codes and out-of bounds addresses.
  417. * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
  418. * @retval #kStatus_FLASH_CommandFailure Run-time error during the command execution.
  419. * @retval #kStatus_FLASH_CommandNotSupported Flash API is not supported.
  420. * @retval #kStatus_FLASH_EccError A correctable or uncorrectable error during command execution.
  421. */
  422. status_t FLASH_VerifyProgram(flash_config_t *config,
  423. uint32_t start,
  424. uint32_t lengthInBytes,
  425. const uint8_t *expectedData,
  426. uint32_t *failedAddress,
  427. uint32_t *failedData);
  428. /*@}*/
  429. /*!
  430. * @name Properties
  431. * @{
  432. */
  433. /*!
  434. * @brief Returns the desired flash property.
  435. *
  436. * @param config A pointer to the storage for the driver runtime state.
  437. * @param whichProperty The desired property from the list of properties in
  438. * enum flash_property_tag_t
  439. * @param value A pointer to the value returned for the desired flash property.
  440. *
  441. * @retval #kStatus_FLASH_Success API was executed successfully.
  442. * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
  443. * @retval #kStatus_FLASH_UnknownProperty An unknown property tag.
  444. */
  445. status_t FLASH_GetProperty(flash_config_t *config, flash_property_tag_t whichProperty, uint32_t *value);
  446. /*!
  447. * @brief Sets the desired flash property.
  448. *
  449. * @param config A pointer to the storage for the driver runtime state.
  450. * @param whichProperty The desired property from the list of properties in
  451. * enum flash_property_tag_t
  452. * @param value A to set for the desired flash property.
  453. *
  454. * @retval #kStatus_FLASH_Success API was executed successfully.
  455. * @retval #kStatus_FLASH_InvalidArgument An invalid argument is provided.
  456. * @retval #kStatus_FLASH_UnknownProperty An unknown property tag.
  457. * @retval #kStatus_FLASH_ReadOnlyProperty An read-only property tag.
  458. */
  459. status_t FLASH_SetProperty(flash_config_t *config, flash_property_tag_t whichProperty, uint32_t value);
  460. /*@}*/
  461. #ifdef __cplusplus
  462. }
  463. #endif
  464. /*@}*/
  465. #endif /* __FLASH_FLASH_H_ */