Class to drive the QSPI external memory (N25Q128A device) present on DISCO_L476VG board.
QSPI_DISCO_L476VG.cpp@0:ea63cbd848a3, 2015-09-24 (annotated)
- Committer:
- bcostm
- Date:
- Thu Sep 24 07:04:36 2015 +0000
- Revision:
- 0:ea63cbd848a3
Initial version.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bcostm | 0:ea63cbd848a3 | 1 | /* Copyright (c) 2010-2011 mbed.org, MIT License |
bcostm | 0:ea63cbd848a3 | 2 | * |
bcostm | 0:ea63cbd848a3 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
bcostm | 0:ea63cbd848a3 | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
bcostm | 0:ea63cbd848a3 | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
bcostm | 0:ea63cbd848a3 | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
bcostm | 0:ea63cbd848a3 | 7 | * Software is furnished to do so, subject to the following conditions: |
bcostm | 0:ea63cbd848a3 | 8 | * |
bcostm | 0:ea63cbd848a3 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
bcostm | 0:ea63cbd848a3 | 10 | * substantial portions of the Software. |
bcostm | 0:ea63cbd848a3 | 11 | * |
bcostm | 0:ea63cbd848a3 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
bcostm | 0:ea63cbd848a3 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
bcostm | 0:ea63cbd848a3 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
bcostm | 0:ea63cbd848a3 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
bcostm | 0:ea63cbd848a3 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
bcostm | 0:ea63cbd848a3 | 17 | */ |
bcostm | 0:ea63cbd848a3 | 18 | |
bcostm | 0:ea63cbd848a3 | 19 | #include "QSPI_DISCO_L476VG.h" |
bcostm | 0:ea63cbd848a3 | 20 | |
bcostm | 0:ea63cbd848a3 | 21 | // Constructor |
bcostm | 0:ea63cbd848a3 | 22 | QSPI_DISCO_L476VG::QSPI_DISCO_L476VG() |
bcostm | 0:ea63cbd848a3 | 23 | { |
bcostm | 0:ea63cbd848a3 | 24 | BSP_QSPI_Init(); |
bcostm | 0:ea63cbd848a3 | 25 | } |
bcostm | 0:ea63cbd848a3 | 26 | |
bcostm | 0:ea63cbd848a3 | 27 | // Destructor |
bcostm | 0:ea63cbd848a3 | 28 | QSPI_DISCO_L476VG::~QSPI_DISCO_L476VG() |
bcostm | 0:ea63cbd848a3 | 29 | { |
bcostm | 0:ea63cbd848a3 | 30 | BSP_QSPI_DeInit(); |
bcostm | 0:ea63cbd848a3 | 31 | } |
bcostm | 0:ea63cbd848a3 | 32 | |
bcostm | 0:ea63cbd848a3 | 33 | //================================================================================================================= |
bcostm | 0:ea63cbd848a3 | 34 | // Public methods |
bcostm | 0:ea63cbd848a3 | 35 | //================================================================================================================= |
bcostm | 0:ea63cbd848a3 | 36 | |
bcostm | 0:ea63cbd848a3 | 37 | uint8_t QSPI_DISCO_L476VG::Init(void) |
bcostm | 0:ea63cbd848a3 | 38 | { |
bcostm | 0:ea63cbd848a3 | 39 | return BSP_QSPI_Init(); |
bcostm | 0:ea63cbd848a3 | 40 | } |
bcostm | 0:ea63cbd848a3 | 41 | |
bcostm | 0:ea63cbd848a3 | 42 | uint8_t QSPI_DISCO_L476VG::DeInit(void) |
bcostm | 0:ea63cbd848a3 | 43 | { |
bcostm | 0:ea63cbd848a3 | 44 | return BSP_QSPI_DeInit(); |
bcostm | 0:ea63cbd848a3 | 45 | } |
bcostm | 0:ea63cbd848a3 | 46 | |
bcostm | 0:ea63cbd848a3 | 47 | uint8_t QSPI_DISCO_L476VG::Read(uint8_t* pData, uint32_t ReadAddr, uint32_t Size) |
bcostm | 0:ea63cbd848a3 | 48 | { |
bcostm | 0:ea63cbd848a3 | 49 | return BSP_QSPI_Read(pData, ReadAddr, Size); |
bcostm | 0:ea63cbd848a3 | 50 | } |
bcostm | 0:ea63cbd848a3 | 51 | |
bcostm | 0:ea63cbd848a3 | 52 | uint8_t QSPI_DISCO_L476VG::Write(uint8_t* pData, uint32_t WriteAddr, uint32_t Size) |
bcostm | 0:ea63cbd848a3 | 53 | { |
bcostm | 0:ea63cbd848a3 | 54 | return BSP_QSPI_Write(pData, WriteAddr, Size); |
bcostm | 0:ea63cbd848a3 | 55 | } |
bcostm | 0:ea63cbd848a3 | 56 | |
bcostm | 0:ea63cbd848a3 | 57 | uint8_t QSPI_DISCO_L476VG::Erase_Block(uint32_t BlockAddress) |
bcostm | 0:ea63cbd848a3 | 58 | { |
bcostm | 0:ea63cbd848a3 | 59 | return BSP_QSPI_Erase_Block(BlockAddress); |
bcostm | 0:ea63cbd848a3 | 60 | } |
bcostm | 0:ea63cbd848a3 | 61 | |
bcostm | 0:ea63cbd848a3 | 62 | uint8_t QSPI_DISCO_L476VG::Erase_Sector(uint32_t Sector) |
bcostm | 0:ea63cbd848a3 | 63 | { |
bcostm | 0:ea63cbd848a3 | 64 | return BSP_QSPI_Erase_Sector(Sector); |
bcostm | 0:ea63cbd848a3 | 65 | } |
bcostm | 0:ea63cbd848a3 | 66 | |
bcostm | 0:ea63cbd848a3 | 67 | uint8_t QSPI_DISCO_L476VG::Erase_Chip(void) |
bcostm | 0:ea63cbd848a3 | 68 | { |
bcostm | 0:ea63cbd848a3 | 69 | return BSP_QSPI_Erase_Chip(); |
bcostm | 0:ea63cbd848a3 | 70 | } |
bcostm | 0:ea63cbd848a3 | 71 | |
bcostm | 0:ea63cbd848a3 | 72 | uint8_t QSPI_DISCO_L476VG::GetStatus(void) |
bcostm | 0:ea63cbd848a3 | 73 | { |
bcostm | 0:ea63cbd848a3 | 74 | return BSP_QSPI_GetStatus(); |
bcostm | 0:ea63cbd848a3 | 75 | } |
bcostm | 0:ea63cbd848a3 | 76 | |
bcostm | 0:ea63cbd848a3 | 77 | uint8_t QSPI_DISCO_L476VG::GetInfo(QSPI_Info* pInfo) |
bcostm | 0:ea63cbd848a3 | 78 | { |
bcostm | 0:ea63cbd848a3 | 79 | return BSP_QSPI_GetInfo(pInfo); |
bcostm | 0:ea63cbd848a3 | 80 | } |
bcostm | 0:ea63cbd848a3 | 81 | |
bcostm | 0:ea63cbd848a3 | 82 | uint8_t QSPI_DISCO_L476VG::EnableMemoryMappedMode(void) |
bcostm | 0:ea63cbd848a3 | 83 | { |
bcostm | 0:ea63cbd848a3 | 84 | return BSP_QSPI_EnableMemoryMappedMode(); |
bcostm | 0:ea63cbd848a3 | 85 | } |
bcostm | 0:ea63cbd848a3 | 86 | |
bcostm | 0:ea63cbd848a3 | 87 | uint8_t QSPI_DISCO_L476VG::SuspendErase(void) |
bcostm | 0:ea63cbd848a3 | 88 | { |
bcostm | 0:ea63cbd848a3 | 89 | return BSP_QSPI_SuspendErase(); |
bcostm | 0:ea63cbd848a3 | 90 | } |
bcostm | 0:ea63cbd848a3 | 91 | |
bcostm | 0:ea63cbd848a3 | 92 | uint8_t QSPI_DISCO_L476VG::ResumeErase(void) |
bcostm | 0:ea63cbd848a3 | 93 | { |
bcostm | 0:ea63cbd848a3 | 94 | return BSP_QSPI_ResumeErase(); |
bcostm | 0:ea63cbd848a3 | 95 | } |
bcostm | 0:ea63cbd848a3 | 96 | |
bcostm | 0:ea63cbd848a3 | 97 | //================================================================================================================= |
bcostm | 0:ea63cbd848a3 | 98 | // Private methods |
bcostm | 0:ea63cbd848a3 | 99 | //================================================================================================================= |