1 /* 2 * Copyright 2022, 2024 NXP 3 * All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 */ 7 #ifndef __FSL_LPSPI_NOR_FLASH_H__ 8 #define __FSL_LPSPI_NOR_FLASH_H__ 9 10 #include "fsl_common.h" 11 #include "fsl_lpspi.h" 12 #include "fsl_nor_flash.h" 13 14 /*! 15 * @addtogroup lpspi_nor_flash 16 * @{ 17 */ 18 19 /******************************************************************************* 20 * Definitions 21 ******************************************************************************/ 22 typedef struct _lpspi_memory_config 23 { 24 uint32_t bytesInPageSize; /*!< Page size in byte of Serial NOR */ 25 uint32_t bytesInSectorSize; /*!< Minimun Sector size in byte supported by Serial NOR */ 26 uint32_t bytesInMemorySize; /*!< Memory size in byte of Serial NOR */ 27 } lpspi_memory_config_t; 28 /******************************************************************************* 29 * API 30 ******************************************************************************/ 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 /*! 37 * @brief Erase page. 38 * 39 * @note Not all device support to erase page. 40 41 * @param handle The NOR Flash handler. 42 * @param address The start address to be erased. 43 * @retval execution status 44 */ 45 status_t Nor_Flash_Erase_Page(nor_handle_t *handle, uint32_t address); 46 47 /*! 48 * @brief Erase 4K block. 49 * 50 * @param handle The NOR Flash handler. 51 * @param address The start address to be erased. 52 * @retval execution status 53 */ 54 status_t Nor_Flash_Erase_Block_4K(nor_handle_t *handle, uint32_t address); 55 56 /*! 57 * @brief Erase 32K block. 58 * 59 * @param handle The NOR Flash handler. 60 * @param address The start address to be erased. 61 * @retval execution status 62 */ 63 status_t Nor_Flash_Erase_Block_32K(nor_handle_t *handle, uint32_t address); 64 65 /*! 66 * @brief Erase 64K block. 67 * 68 * @param handle The NOR Flash handler. 69 * @param address The start address to be erased. 70 * @retval execution status 71 */ 72 status_t Nor_Flash_Erase_Block_64K(nor_handle_t *handle, uint32_t address); 73 74 /*! 75 * @brief Prepare the NOR flash for low power entry 76 * 77 * @param handle The NOR Flash handler. 78 * @retval status_t execution status 79 */ 80 status_t Nor_Flash_Enter_Lowpower(nor_handle_t *handle); 81 82 /*! 83 * @brief Prepare the NOR flash for low power exit 84 * 85 * @param handle The NOR Flash handler. 86 * @retval status_t execution status 87 */ 88 status_t Nor_Flash_Exit_Lowpower(nor_handle_t *handle); 89 90 #ifdef __cplusplus 91 } 92 #endif 93 94 /*! @}*/ 95 96 #endif /* __FSL_LPSPI_NOR_FLASH_H__ */ 97