Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
QSPI_DISCO_L476VG.h
00001 /* Copyright (c) 2010-2011 mbed.org, MIT License 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00004 * and associated documentation files (the "Software"), to deal in the Software without 00005 * restriction, including without limitation the rights to use, copy, modify, merge, publish, 00006 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 00007 * Software is furnished to do so, subject to the following conditions: 00008 * 00009 * The above copyright notice and this permission notice shall be included in all copies or 00010 * substantial portions of the Software. 00011 * 00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00013 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00014 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00015 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00017 */ 00018 00019 #ifndef __QSPI_DISCO_L476VG_H 00020 #define __QSPI_DISCO_L476VG_H 00021 00022 #ifdef TARGET_DISCO_L476VG 00023 00024 #include "mbed.h" 00025 #include "stm32l476g_discovery_qspi.h" 00026 00027 /* 00028 Class to drive the QSPI external memory (N25Q128A device) 00029 present on DISCO_L476VG board. 00030 00031 Usage: 00032 00033 */ 00034 class QSPI_DISCO_L476VG 00035 { 00036 00037 public: 00038 //! Constructor 00039 QSPI_DISCO_L476VG(); 00040 00041 //! Destructor 00042 ~QSPI_DISCO_L476VG(); 00043 00044 /** 00045 * @brief Initializes the QSPI interface. 00046 * @retval QSPI memory status 00047 */ 00048 uint8_t Init(void); 00049 00050 /** 00051 * @brief De-Initializes the QSPI interface. 00052 * @retval QSPI memory status 00053 */ 00054 uint8_t DeInit(void); 00055 00056 /** 00057 * @brief Reads an amount of data from the QSPI memory. 00058 * @param pData: Pointer to data to be read 00059 * @param ReadAddr: Read start address 00060 * @param Size: Size of data to read 00061 * @retval QSPI memory status 00062 */ 00063 uint8_t Read(uint8_t* pData, uint32_t ReadAddr, uint32_t Size); 00064 00065 /** 00066 * @brief Writes an amount of data to the QSPI memory. 00067 * @param pData: Pointer to data to be written 00068 * @param WriteAddr: Write start address 00069 * @param Size: Size of data to write 00070 * @retval QSPI memory status 00071 */ 00072 uint8_t Write(uint8_t* pData, uint32_t WriteAddr, uint32_t Size); 00073 00074 /** 00075 * @brief Erases the specified block of the QSPI memory. 00076 * @param BlockAddress: Block address to erase 00077 * @retval QSPI memory status 00078 */ 00079 uint8_t Erase_Block(uint32_t BlockAddress); 00080 00081 /** 00082 * @brief Erases the specified sector of the QSPI memory. 00083 * @param Sector: Sector address to erase (0 to 255); 00084 * @retval QSPI memory status 00085 * @note This function is non blocking meaning that sector erase 00086 * operation is started but not completed when the function 00087 * returns. Application has to call GetStatus(); 00088 * to know when the device is available again (i.e. erase operation 00089 * completed);. 00090 */ 00091 uint8_t Erase_Sector(uint32_t Sector); 00092 00093 /** 00094 * @brief Erases the entire QSPI memory. 00095 * @retval QSPI memory status 00096 */ 00097 uint8_t Erase_Chip(void); 00098 00099 /** 00100 * @brief Reads current status of the QSPI memory. 00101 * @retval QSPI memory status 00102 */ 00103 uint8_t GetStatus(void); 00104 00105 /** 00106 * @brief Return the configuration of the QSPI memory. 00107 * @param pInfo: pointer on the configuration structure 00108 * @retval QSPI memory status 00109 */ 00110 uint8_t GetInfo(QSPI_Info* pInfo); 00111 00112 /** 00113 * @brief Configure the QSPI in memory-mapped mode 00114 * @retval QSPI memory status 00115 */ 00116 uint8_t EnableMemoryMappedMode(void); 00117 00118 /** 00119 * @brief This function suspends an ongoing erase command. 00120 * @retval QSPI memory status 00121 */ 00122 uint8_t SuspendErase(void); 00123 00124 /** 00125 * @brief This function resumes a paused erase command. 00126 * @retval QSPI memory status 00127 */ 00128 uint8_t ResumeErase(void); 00129 00130 private: 00131 00132 }; 00133 00134 #else 00135 #error "This class must be used with DISCO_L476VG board only." 00136 #endif // TARGET_DISCO_L476VG 00137 00138 #endif
Generated on Tue Jul 12 2022 21:03:24 by
1.7.2