1 /** 2 * @file sfe.h 3 * @brief Serial Flash Emulator function prototypes and data types. 4 */ 5 6 /****************************************************************************** 7 * 8 * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by 9 * Analog Devices, Inc.), 10 * Copyright (C) 2023-2024 Analog Devices, Inc. 11 * 12 * Licensed under the Apache License, Version 2.0 (the "License"); 13 * you may not use this file except in compliance with the License. 14 * You may obtain a copy of the License at 15 * 16 * http://www.apache.org/licenses/LICENSE-2.0 17 * 18 * Unless required by applicable law or agreed to in writing, software 19 * distributed under the License is distributed on an "AS IS" BASIS, 20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 * See the License for the specific language governing permissions and 22 * limitations under the License. 23 * 24 ******************************************************************************/ 25 26 #ifndef LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32520_SFE_H_ 27 #define LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32520_SFE_H_ 28 29 /* **** Includes **** */ 30 #include "sfe_regs.h" 31 #include "spi_regs.h" 32 #include "mxc_sys.h" 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 /** 39 * @defgroup sfe Serial Flash Emulator (SFE) 40 * @ingroup periphlibs 41 * @{ 42 */ 43 44 /* **** Function Prototypes **** */ 45 46 /** 47 * @brief Initialize serial flash emulator 48 * 49 * @return Success/Fail, see \ref MXC_Error_Codes for a list of return codes 50 */ 51 int MXC_SFE_Init(void); 52 53 /** 54 * @brief Shutdown serial flash emulator 55 * 56 * @return Success/Fail, see \ref MXC_Error_Codes for a list of return codes 57 */ 58 int MXC_SFE_Shutdown(void); 59 60 /** 61 * @brief Enable Flash Read 62 * 63 * @return Success/Fail, see \ref MXC_Error_Codes for a list of return codes 64 */ 65 int MXC_SFE_ReadEnable(void); 66 67 /** 68 * @brief Enable Flash Write 69 * 70 * @return Success/Fail, see \ref MXC_Error_Codes for a list of return codes 71 */ 72 int MXC_SFE_WriteEnable(void); 73 74 /** 75 * @brief Set Flash Base and Top address 76 * 77 * @param baseAdd Base address of Flash region 78 * @param topAdd Top address of Flash region 79 * @return Success/Fail, see \ref MXC_Error_Codes for a list of return codes 80 */ 81 int MXC_SFE_SetFlashAddress(uint32_t baseAdd, uint32_t topAdd); 82 83 /** 84 * @brief Set RAM Base and Top address 85 * 86 * @param baseAdd Base address of RAM region 87 * @param topAdd Top address of RAM region 88 * @return Success/Fail, see \ref MXC_Error_Codes for a list of return codes 89 */ 90 int MXC_SFE_SetRAMAddress(uint32_t baseAdd, uint32_t topAdd); 91 92 /** 93 * @brief Set RAM and Flash base address for Host 94 * 95 * @param RAMAdd Base address of RAM for Host device 96 * @param FLASHAdd Base address of Flash for Host device 97 * @return Success/Fail, see \ref MXC_Error_Codes for a list of return codes 98 */ 99 int MXC_SFE_SetHostAddress(uint32_t RAMAdd, uint32_t FLASHAdd); 100 101 //------------------------------------------------------------------------------------------- 102 /**@} end of group sfe */ 103 104 #ifdef __cplusplus 105 } 106 #endif 107 108 #endif // LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32520_SFE_H_ 109