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.
Revision 0:9fc24a384319, committed 2016-01-04
- Comitter:
- bcostm
- Date:
- Mon Jan 04 14:32:34 2016 +0000
- Commit message:
- First version
Changed in this revision
QSPI_DISCO_F469NI.cpp | Show annotated file Show diff for this revision Revisions of this file |
QSPI_DISCO_F469NI.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 9fc24a384319 QSPI_DISCO_F469NI.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QSPI_DISCO_F469NI.cpp Mon Jan 04 14:32:34 2016 +0000 @@ -0,0 +1,84 @@ +/* Copyright (c) 2010-2011 mbed.org, MIT License +* +* Permission is hereby granted, free of charge, to any person obtaining a copy of this software +* and associated documentation files (the "Software"), to deal in the Software without +* restriction, including without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all copies or +* substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include "QSPI_DISCO_F469NI.h" + +// Constructor +QSPI_DISCO_F469NI::QSPI_DISCO_F469NI() +{ + BSP_QSPI_Init(); +} + +// Destructor +QSPI_DISCO_F469NI::~QSPI_DISCO_F469NI() +{ + BSP_QSPI_DeInit(); +} + +//================================================================================================================= +// Public methods +//================================================================================================================= + +uint8_t QSPI_DISCO_F469NI::Init(void) +{ + return BSP_QSPI_Init(); +} + +uint8_t QSPI_DISCO_F469NI::DeInit(void) +{ + return BSP_QSPI_DeInit(); +} + +uint8_t QSPI_DISCO_F469NI::Read(uint8_t* pData, uint32_t ReadAddr, uint32_t Size) +{ + return BSP_QSPI_Read(pData, ReadAddr, Size); +} + +uint8_t QSPI_DISCO_F469NI::Write(uint8_t* pData, uint32_t WriteAddr, uint32_t Size) +{ + return BSP_QSPI_Write(pData, WriteAddr, Size); +} + +uint8_t QSPI_DISCO_F469NI::Erase_Block(uint32_t BlockAddress) +{ + return BSP_QSPI_Erase_Block(BlockAddress); +} + +uint8_t QSPI_DISCO_F469NI::Erase_Chip(void) +{ + return BSP_QSPI_Erase_Chip(); +} + +uint8_t QSPI_DISCO_F469NI::GetStatus(void) +{ + return BSP_QSPI_GetStatus(); +} + +uint8_t QSPI_DISCO_F469NI::GetInfo(QSPI_InfoTypeDef* pInfo) +{ + return BSP_QSPI_GetInfo(pInfo); +} + +uint8_t QSPI_DISCO_F469NI::EnableMemoryMappedMode(void) +{ + return BSP_QSPI_MemoryMappedMode(); +} + +//================================================================================================================= +// Private methods +//=================================================================================================================
diff -r 000000000000 -r 9fc24a384319 QSPI_DISCO_F469NI.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QSPI_DISCO_F469NI.h Mon Jan 04 14:32:34 2016 +0000 @@ -0,0 +1,142 @@ +/* Copyright (c) 2010-2011 mbed.org, MIT License +* +* Permission is hereby granted, free of charge, to any person obtaining a copy of this software +* and associated documentation files (the "Software"), to deal in the Software without +* restriction, including without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all copies or +* substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef __QSPI_DISCO_F469NI_H +#define __QSPI_DISCO_F469NI_H + +#ifdef TARGET_DISCO_F469NI + +#include "mbed.h" +#include "stm32469i_discovery_qspi.h" + +/* + Class to drive the QSPI external memory (N25Q128A device) + present on DISCO_F469NI board. + + Usage: + +#include "mbed.h" +#include "QSPI_DISCO_F469NI.h" + +QSPI_DISCO_F469NI qspi; + +#define BUFFER_SIZE ((uint32_t)32) +#define WRITE_READ_ADDR ((uint32_t)0x0050) + +int main() +{ + uint8_t WriteBuffer[BUFFER_SIZE] = "Hello World"; + uint8_t ReadBuffer[BUFFER_SIZE]; + + qspi.Init(); + + // Erase memory + qspi.Erase_Block(WRITE_READ_ADDR); + + // Write memory + qspi.Write(WriteBuffer, WRITE_READ_ADDR, 11); + + // Read memory + qspi.Read(ReadBuffer, WRITE_READ_ADDR, 11); + ReadBuffer[11] = '\0'; + printf("Buffer read [%s]\n", ReadBuffer); +} + +*/ +class QSPI_DISCO_F469NI +{ + +public: + //! Constructor + QSPI_DISCO_F469NI(); + + //! Destructor + ~QSPI_DISCO_F469NI(); + + /** + * @brief Initializes the QSPI interface. + * @retval QSPI memory status + */ + uint8_t Init(void); + + /** + * @brief De-Initializes the QSPI interface. + * @retval QSPI memory status + */ + uint8_t DeInit(void); + + /** + * @brief Reads an amount of data from the QSPI memory. + * @param pData: Pointer to data to be read + * @param ReadAddr: Read start address + * @param Size: Size of data to read + * @retval QSPI memory status + */ + uint8_t Read(uint8_t* pData, uint32_t ReadAddr, uint32_t Size); + + /** + * @brief Writes an amount of data to the QSPI memory. + * @param pData: Pointer to data to be written + * @param WriteAddr: Write start address + * @param Size: Size of data to write + * @retval QSPI memory status + */ + uint8_t Write(uint8_t* pData, uint32_t WriteAddr, uint32_t Size); + + /** + * @brief Erases the specified block of the QSPI memory. + * @param BlockAddress: Block address to erase + * @retval QSPI memory status + */ + uint8_t Erase_Block(uint32_t BlockAddress); + + /** + * @brief Erases the entire QSPI memory. + * @retval QSPI memory status + */ + uint8_t Erase_Chip(void); + + /** + * @brief Reads current status of the QSPI memory. + * @retval QSPI memory status + */ + uint8_t GetStatus(void); + + /** + * @brief Reads the configuration of the memory and fills QspiInfo struct + * @param pInfo pointer to Info structure + * @retval QSPI memory status + */ + uint8_t GetInfo(QSPI_InfoTypeDef* pInfo); + + /** + * @brief Configure the QSPI in memory-mapped mode + * @param None + * @retval QSPI memory status + */ + uint8_t EnableMemoryMappedMode(void); + + private: + +}; + +#else +#error "This class must be used with DISCO_F469NI board only." +#endif // TARGET_DISCO_F469NI + +#endif