123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466 |
- /*==================================================================================================
- * Project : RTD AUTOSAR 4.4
- * Platform : CORTEXM
- * Peripheral : FTFC_FLS_IP IPV_QSPI
- * Dependencies : none
- *
- * Autosar Version : 4.4.0
- * Autosar Revision : ASR_REL_4_4_REV_0000
- * Autosar Conf.Variant :
- * SW Version : 1.0.0
- * Build Version : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
- *
- * (c) Copyright 2020-2021 NXP Semiconductors
- * All Rights Reserved.
- *
- * NXP Confidential. This software is owned or controlled by NXP and may only be
- * used strictly in accordance with the applicable license terms. By expressly
- * accepting such terms or by downloading, installing, activating and/or otherwise
- * using the software, you are agreeing that you have read, and that you agree to
- * comply with and are bound by, such license terms. If you do not agree to be
- * bound by the applicable license terms, then you may not retain, install,
- * activate or otherwise use the software.
- ==================================================================================================*/
- #ifndef QSPI_IP_H
- #define QSPI_IP_H
- /**
- * @file Qspi_Ip.h
- *
- * @addtogroup IPV_QSPI QSPI IPV Driver
- * @{
- */
- /* implements Qspi_Ip.h_Artifact */
- #ifdef __cplusplus
- extern "C"{
- #endif
- #include "StandardTypes.h"
- #include "Qspi_Ip_Types.h"
- #include "Qspi_Ip_Features.h"
- /*==================================================================================================
- * SOURCE FILE VERSION INFORMATION
- ==================================================================================================*/
- #define QSPI_IP_VENDOR_ID_H 43
- #define QSPI_IP_AR_RELEASE_MAJOR_VERSION_H 4
- #define QSPI_IP_AR_RELEASE_MINOR_VERSION_H 4
- #define QSPI_IP_AR_RELEASE_REVISION_VERSION_H 0
- #define QSPI_IP_SW_MAJOR_VERSION_H 1
- #define QSPI_IP_SW_MINOR_VERSION_H 0
- #define QSPI_IP_SW_PATCH_VERSION_H 0
- /*==================================================================================================
- * FILE VERSION CHECKS
- ==================================================================================================*/
- #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
- /* Check if Qspi_Ip header file and StandardTypes.h header file are of the same Autosar version */
- #if ((QSPI_IP_AR_RELEASE_MAJOR_VERSION_H != STD_AR_RELEASE_MAJOR_VERSION) || \
- (QSPI_IP_AR_RELEASE_MINOR_VERSION_H != STD_AR_RELEASE_MINOR_VERSION) \
- )
- #error "Autosar Version Numbers of Qspi_Ip.h and StandardTypes.h are different"
- #endif
- #endif
- /* Check if current file and Qspi_Ip_Types header file are of the same vendor */
- #if (FLS_QSPI_TYPES_VENDOR_ID != QSPI_IP_VENDOR_ID_H)
- #error "Qspi_Ip.h and Qspi_Ip_Types.h have different vendor ids"
- #endif
- /* Check if current file and Qspi_Ip_Types header file are of the same Autosar version */
- #if ((FLS_QSPI_TYPES_AR_RELEASE_MAJOR_VERSION != QSPI_IP_AR_RELEASE_MAJOR_VERSION_H) || \
- (FLS_QSPI_TYPES_AR_RELEASE_MINOR_VERSION != QSPI_IP_AR_RELEASE_MINOR_VERSION_H) || \
- (FLS_QSPI_TYPES_AR_RELEASE_REVISION_VERSION != QSPI_IP_AR_RELEASE_REVISION_VERSION_H) \
- )
- #error "AutoSar Version Numbers of Qspi_Ip.h and Qspi_Ip_Types.h are different"
- #endif
- /* Check if current file and Qspi_Ip_Types header file are of the same Software version */
- #if ((FLS_QSPI_TYPES_SW_MAJOR_VERSION != QSPI_IP_SW_MAJOR_VERSION_H) || \
- (FLS_QSPI_TYPES_SW_MINOR_VERSION != QSPI_IP_SW_MINOR_VERSION_H) || \
- (FLS_QSPI_TYPES_SW_PATCH_VERSION != QSPI_IP_SW_PATCH_VERSION_H) \
- )
- #error "Software Version Numbers of Qspi_Ip.h and Qspi_Ip_Types.h are different"
- #endif
- /* Check if current file and Qspi_Ip_Features header file are of the same vendor */
- #if (QSPI_IP_FEATURES_VENDOR_ID_CFG != QSPI_IP_VENDOR_ID_H)
- #error "Qspi_Ip.h and Qspi_Ip_Features.h have different vendor ids"
- #endif
- /* Check if current file and Qspi_Ip_Features header file are of the same Autosar version */
- #if ((QSPI_IP_FEATURES_AR_RELEASE_MAJOR_VERSION_CFG != QSPI_IP_AR_RELEASE_MAJOR_VERSION_H) || \
- (QSPI_IP_FEATURES_AR_RELEASE_MINOR_VERSION_CFG != QSPI_IP_AR_RELEASE_MINOR_VERSION_H) || \
- (QSPI_IP_FEATURES_AR_RELEASE_REVISION_VERSION_CFG != QSPI_IP_AR_RELEASE_REVISION_VERSION_H) \
- )
- #error "AutoSar Version Numbers of Qspi_Ip.h and Qspi_Ip_Features.h are different"
- #endif
- /* Check if current file and Qspi_Ip_Features header file are of the same Software version */
- #if ((QSPI_IP_FEATURES_SW_MAJOR_VERSION_CFG != QSPI_IP_SW_MAJOR_VERSION_H) || \
- (QSPI_IP_FEATURES_SW_MINOR_VERSION_CFG != QSPI_IP_SW_MINOR_VERSION_H) || \
- (QSPI_IP_FEATURES_SW_PATCH_VERSION_CFG != QSPI_IP_SW_PATCH_VERSION_H) \
- )
- #error "Software Version Numbers of Qspi_Ip.h and Qspi_Ip_Features.h are different"
- #endif
- /*******************************************************************************
- * Definitions.
- ******************************************************************************/
- /*! Maximum number of bytes then can be read in one operation */
- #define QSPI_IP_MAX_READ_SIZE (FEATURE_QSPI_RX_BUF_SIZE)
- /*! Maximum number of bytes then can be written in one operation */
- #define QSPI_IP_MAX_WRITE_SIZE (FEATURE_QSPI_TX_BUF_SIZE)
- /*******************************************************************************
- * API
- ******************************************************************************/
- #define FLS_START_SEC_CODE
- #include "Fls_MemMap.h"
- /*!
- * @brief Initializes the serial flash memory driver
- *
- * This function initializes the external flash driver and prepares it for operation.
- *
- * @param instance External flash instance number
- * @param pConfig Pointer to the driver configuration structure.
- * @param pConnect Pointer to the flash device connection structure.
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_Init(uint32 instance,
- const Qspi_Ip_MemoryConfigType * pConfig,
- const Qspi_Ip_MemoryConnectionType * pConnect
- );
- /*!
- * @brief De-initializes the serial flash memory driver
- *
- * This function de-initializes the qspi driver. The driver can't be used
- * again until reinitialized. The state structure is no longer needed by the driver and
- * may be freed after calling this function.
- *
- * @param instance External flash instance number
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_Deinit(uint32 instance);
- /*!
- * @brief Erase a sector in the serial flash.
- *
- * This function performs one erase sector (block) operation on the external flash. The erase size must match one of
- * the device's erase types.
- *
- * @param instance External flash instance number
- * @param address Address of sector to be erased
- * @param size Size of the sector to be erase. The sector size must match one of the supported erase sizes of the device.
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_EraseBlock(uint32 instance,
- uint32 address,
- uint32 size
- );
- /*!
- * @brief Erase the entire serial flash
- *
- * @param instance External flash instance number
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_EraseChip(uint32 instance);
- /*!
- * @brief Check the status of the flash device
- *
- * @param instance External flash instance number
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_GetMemoryStatus(uint32 instance);
- /*!
- * @brief Sets the protection bits to the requested value.
- *
- * @param instance External flash instance number
- * @param value New value for the protection bits
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_SetProtection(uint32 instance,
- uint8 value
- );
- /*!
- * @brief Returns the current value of the protection bits
- *
- * @param instance External flash instance number
- * @param value Current value of the protection bits
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_GetProtection(uint32 instance,
- uint8 *value
- );
- /*!
- * @brief Resets the flash device
- *
- * @param instance External flash instance number
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_Reset(uint32 instance);
- /*!
- * @brief Enters 0-X-X (no command) mode. This mode assumes only reads are performed.
- *
- * @param instance External flash instance number
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_Enter0XX(uint32 instance);
- /*!
- * @brief Exits 0-X-X (no command) mode. This allows operations other than reads to be performed.
- *
- * @param instance External flash instance number
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_Exit0XX(uint32 instance);
- /*!
- * @brief Suspends a program operation.
- *
- * @param instance External flash instance number
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_ProgramSuspend(uint32 instance);
- /*!
- * @brief Resumes a program operation.
- *
- * @param instance External flash instance number
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_ProgramResume(uint32 instance);
- /*!
- * @brief Suspends an erase operation.
- *
- * @param instance External flash instance number
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_EraseSuspend(uint32 instance);
- /*!
- * @brief Resumes an erase operation.
- *
- * @param instance External flash instance number
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_EraseResume(uint32 instance);
- /*!
- * @brief Read data from serial flash
- *
- * @param instance External flash instance number
- * @param address Start address for read operation
- * @param data Buffer where to store read data
- * @param size Size of data buffer
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_Read(uint32 instance,
- uint32 address,
- uint8 * data,
- uint32 size
- );
- /*!
- * @brief Read manufacturer ID/device ID from serial flash
- *
- * @param instance External flash instance number
- * @param data Buffer where to store read data. Buffer size must match ReadId initialization settings.
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_ReadId(uint32 instance,
- uint8 * data
- );
- /*!
- * @brief Verifies the correctness of the programmed data
- *
- * @param instance External flash instance number
- * @param address Start address of area to be verified
- * @param data Data to be verified
- * @param size Size of area to be verified
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_ProgramVerify(uint32 instance,
- uint32 address,
- const uint8 * data,
- uint32 size
- );
- /*!
- * @brief Checks whether or not an area in the serial flash is erased
- *
- * @param instance External flash instance number
- * @param address Start address of area to be verified
- * @param size Size of area to be verified
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_EraseVerify(uint32 instance,
- uint32 address,
- uint32 size
- );
- /*!
- * @brief Writes data in serial flash
- *
- * @param instance External flash instance number
- * @param address Start address of area to be programmed
- * @param data Data to be programmed in flash
- * @param size Size of data buffer
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_Program(uint32 instance,
- uint32 address,
- const uint8 * data,
- uint32 size
- );
- /*!
- * @brief Launches a simple command for the serial flash.
- *
- * @param instance External flash instance number
- * @param lut Index of command in virtual LUT
- * @param addr Address used in the command, or base address of the target serial flash
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_RunCommand(uint32 instance,
- uint16 lut,
- uint32 addr
- );
- /*!
- * @brief Launches a read command for the serial flash
- *
- * This function can launch a read command in 3 modes:
- * - normal read (dataRead != NULL_PTR): Data is read from serial flash and placed in the buffer
- * - verify (dataRead == NULL_PTR, dataCmp != NULL_PTR): Data is read from serial flash and compared to the reference buffer
- * - blank check (dataRead == NULL_PTR, dataCmp == NULL_PTR): Data is read from serial flash and compared to 0xFF
- * Only normal read mode can use DMA.
- *
- * @param instance External flash instance number
- * @param lut Index of LUT register
- * @param addr Start address for read operation in serial flash
- * @param dataRead Buffer where to store read data
- * @param dataCmp Buffer to be compared to read data
- * @param size Size of data buffer
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_RunReadCommand(uint32 instance,
- uint16 lut,
- uint32 addr,
- uint8 * dataRead,
- const uint8 * dataCmp,
- uint32 size
- );
- /*!
- * @brief Launches a write command for the serial flash
- *
- * @param instance External flash instance number
- * @param lut Index of LUT register
- * @param addr Start address for write operation in serial flash
- * @param data Data to be programmed in flash
- * @param size Size of data buffer
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_RunWriteCommand(uint32 instance,
- uint16 lut,
- uint32 addr,
- const uint8 * data,
- uint32 size
- );
- /*!
- * @brief Sets up AHB reads to the serial flash
- *
- * @param instance External flash instance number
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_AhbReadEnable(uint32 instance);
- /*!
- * @brief Check the status of the QSPI controller
- *
- * @param instance QSPI peripheral instance number
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_ControllerGetStatus(uint32 instance);
- /*!
- * @brief Initializes the qspi driver
- *
- * This function initializes the qspi driver and prepares it for operation.
- *
- * @param instance QSPI peripheral instance number
- * @param userConfigPtr Pointer to the qspi configuration structure.
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_ControllerInit(uint32 instance,
- const Qspi_Ip_ControllerConfigType * userConfigPtr
- );
- /*!
- * @brief De-initialize the qspi driver
- *
- * This function de-initializes the qspi driver. The driver can't be used
- * again until reinitialized. The context structure is no longer needed by the driver and
- * can be freed after calling this function.
- *
- * @param instance QSPI peripheral instance number
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_ControllerDeinit(uint32 instance);
- /*!
- * @brief Initializes the serial flash memory configuration from SFDP table
- *
- * This function uses the information in the SFDP table to auto-fill the memory configuration structure.
- *
- * @param pConfig Pointer to the driver configuration structure.
- * @param pConnect Pointer to the flash device connection structure.
- * @return Error or success status returned by API
- */
- Qspi_Ip_StatusType Qspi_Ip_ReadSfdp(Qspi_Ip_MemoryConfigType * pConfig,
- const Qspi_Ip_MemoryConnectionType * pConnect
- );
- #define FLS_STOP_SEC_CODE
- #include "Fls_MemMap.h"
- #if defined(__cplusplus)
- }
- #endif
- /** @} */
- #endif /* QSPI_IP_H */
|