1 /* 2 * Copyright 2020-2023 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef QSPI_IP_HYPERFLASH_H 8 #define QSPI_IP_HYPERFLASH_H 9 10 /** 11 * @file Qspi_Ip_Hyperflash.h 12 * 13 * @addtogroup FLS 14 * @{ 15 */ 16 17 #ifdef __cplusplus 18 extern "C"{ 19 #endif 20 21 22 23 /*================================================================================================== 24 * INCLUDE FILES 25 ==================================================================================================*/ 26 #include "Qspi_Ip_Types.h" 27 28 29 /*================================================================================================== 30 * SOURCE FILE VERSION INFORMATION 31 ==================================================================================================*/ 32 #define QSPI_IP_HYPERFLASH_VENDOR_ID_H 43 33 #define QSPI_IP_HYPERFLASH_AR_RELEASE_MAJOR_VERSION_H 4 34 #define QSPI_IP_HYPERFLASH_AR_RELEASE_MINOR_VERSION_H 7 35 #define QSPI_IP_HYPERFLASH_AR_RELEASE_REVISION_VERSION_H 0 36 #define QSPI_IP_HYPERFLASH_SW_MAJOR_VERSION_H 3 37 #define QSPI_IP_HYPERFLASH_SW_MINOR_VERSION_H 0 38 #define QSPI_IP_HYPERFLASH_SW_PATCH_VERSION_H 0 39 40 #if (QSPI_IP_MEM_INSTANCE_COUNT > 0) 41 42 /*================================================================================================== 43 * FILE VERSION CHECKS 44 ==================================================================================================*/ 45 /* Check if current file and Qspi_Ip_Types header file are of the same vendor */ 46 #if (QSPI_IP_HYPERFLASH_VENDOR_ID_H != FLS_QSPI_TYPES_VENDOR_ID) 47 #error "Qspi_Ip_Hyperflash.h and Qspi_Ip_Types.h have different vendor ids" 48 #endif 49 /* Check if current file and Qspi_Ip_Types header file are of the same Autosar version */ 50 #if ((QSPI_IP_HYPERFLASH_AR_RELEASE_MAJOR_VERSION_H != FLS_QSPI_TYPES_AR_RELEASE_MAJOR_VERSION) || \ 51 (QSPI_IP_HYPERFLASH_AR_RELEASE_MINOR_VERSION_H != FLS_QSPI_TYPES_AR_RELEASE_MINOR_VERSION) || \ 52 (QSPI_IP_HYPERFLASH_AR_RELEASE_REVISION_VERSION_H != FLS_QSPI_TYPES_AR_RELEASE_REVISION_VERSION) \ 53 ) 54 #error "AutoSar Version Numbers of Qspi_Ip_Hyperflash.h and Qspi_Ip_Types.h are different" 55 #endif 56 /* Check if current file and Qspi_Ip_Types header file are of the same Software version */ 57 #if ((QSPI_IP_HYPERFLASH_SW_MAJOR_VERSION_H != FLS_QSPI_TYPES_SW_MAJOR_VERSION) || \ 58 (QSPI_IP_HYPERFLASH_SW_MINOR_VERSION_H != FLS_QSPI_TYPES_SW_MINOR_VERSION) || \ 59 (QSPI_IP_HYPERFLASH_SW_PATCH_VERSION_H != FLS_QSPI_TYPES_SW_PATCH_VERSION) \ 60 ) 61 #error "Software Version Numbers of Qspi_Ip_Hyperflash.h and Qspi_Ip_Types.h are different" 62 #endif 63 64 65 /******************************************************************************* 66 * API 67 ******************************************************************************/ 68 69 #define FLS_START_SEC_CODE 70 #include "Fls_MemMap.h" 71 72 73 /*! 74 * @brief Initializes the hyper flash memory device 75 */ 76 Qspi_Ip_StatusType Qspi_Ip_HyperflashInit(uint32 instance); 77 78 79 /*! 80 * @brief Erases a specific sector. 81 * 82 */ 83 Qspi_Ip_StatusType Qspi_Ip_HyperflashSectorErase(uint32 instance, 84 uint32 sectorAddress 85 ); 86 87 88 /*! 89 * @brief Chip erase 90 */ 91 Qspi_Ip_StatusType Qspi_Ip_HyperflashChipErase(uint32 instance); 92 93 94 /*! 95 * @brief Writes between 1 and 512 bytes to write buffer. Addresses should be on the same line of data buffer. 96 */ 97 Qspi_Ip_StatusType Qspi_Ip_HyperflashProgram(uint32 instance, 98 uint32 address, 99 const uint8 * data, 100 uint32 size 101 ); 102 103 104 /*! 105 * @brief Read manufacturer ID from hyper flash. 106 */ 107 Qspi_Ip_StatusType Qspi_Ip_HyperflashReadId(uint32 instance, 108 uint32 wordAddress, 109 uint8 * data, 110 uint32 size 111 ); 112 113 114 /*! 115 * @brief Checks if the chip or a specific sector is erased 116 */ 117 Qspi_Ip_StatusType Qspi_Ip_HyperflashSectorBlankCheck(uint32 instance, 118 uint32 sectorAddress 119 ); 120 121 122 /*! 123 * @brief Returns the status of the last command 124 */ 125 Qspi_Ip_StatusType Qspi_Ip_HyperflashGetMemoryStatus(uint32 instance); 126 127 128 /*! 129 * @brief Patch a read command with the configured dummy cycles count 130 */ 131 void Qspi_Ip_HyperflashPatchReadCommand(uint32 instance, 132 uint16 lut 133 ); 134 135 136 #define FLS_STOP_SEC_CODE 137 #include "Fls_MemMap.h" 138 139 140 #endif /* QSPI_IP_MEM_INSTANCE_COUNT */ 141 142 #ifdef __cplusplus 143 } 144 #endif 145 146 /** @} */ 147 #endif /* QSPI_IP_HYPERFLASH_H */ 148 149 /******************************************************************************* 150 * EOF 151 ******************************************************************************/ 152