1 /***********************************************************************************************//** 2 * \file cybsp_smif_init.h 3 * 4 * \brief 5 * Basic API for setting up boards containing a Cypress MCU. 6 * 7 *************************************************************************************************** 8 * \copyright 9 * Copyright 2018-2022 Cypress Semiconductor Corporation (an Infineon company) or 10 * an affiliate of Cypress Semiconductor Corporation 11 * 12 * SPDX-License-Identifier: Apache-2.0 13 * 14 * Licensed under the Apache License, Version 2.0 (the "License"); 15 * you may not use this file except in compliance with the License. 16 * You may obtain a copy of the License at 17 * 18 * http://www.apache.org/licenses/LICENSE-2.0 19 * 20 * Unless required by applicable law or agreed to in writing, software 21 * distributed under the License is distributed on an "AS IS" BASIS, 22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 * See the License for the specific language governing permissions and 24 * limitations under the License. 25 **************************************************************************************************/ 26 27 #ifndef CYBSP_SMIF_INIT_H 28 #define CYBSP_SMIF_INIT_H 29 #include "cy_smif_memslot.h" 30 #include "cycfg_qspi_memslot.h" 31 32 #define SMIF_HW SMIF0 33 #define SMIF_DESELECT_DELAY 7 34 #define TIMEOUT_1_MS (1000ul) /* 1 ms timeout for all blocking functions */ 35 #define MEMORY_BUSY_CHECK_RETRIES (750ul) /* Set it high enough for the sector erase operation to 36 complete */ 37 38 /** 39 * \brief Initialize the smif IP. 40 * 41 * \returns CY_SMIF_SUCCESS if the SMIF is successfully initialized, if there is 42 * a problem initializing any hardware it returns an error code specific 43 * to the problem. 44 */ 45 cy_en_smif_status_t cybsp_smif_init(void); 46 47 /** 48 * \brief Polls memory device until it is ready to receive new commands, or retry limit is exceeded 49 * 50 * \param memConfig Memory Device Configuration 51 * \returns Status of the operation. 52 * CY_SMIF_SUCCESS - Memory is ready to accept new commands. 53 * CY_SMIF_EXCEED_TIMEOUT - Memory is busy. 54 */ 55 cy_en_smif_status_t cybsp_is_memory_ready(cy_stc_smif_mem_config_t const* memConfig); 56 57 /** 58 * \brief Disables the SMIF IO. 59 * 60 */ 61 void cybsp_smif_disable(); 62 63 /** 64 * \brief Enables the SMIF IO. 65 * 66 */ 67 void cybsp_smif_enable(); 68 69 #endif /*CYBSP_SMIF_INIT_H*/ 70