BSP library for DISCO-STM32F746NG board. Added support for on-board QSPI Flash memory MICRO N25Q128A. Ported from library BSP_DISCO_L476VG.
Fork of BSP_DISCO_F746NG by
stm32f746g_discovery_qspi.h@1:6c23a7cf204c, 2015-11-15 (annotated)
- Committer:
- capsavon
- Date:
- Sun Nov 15 11:37:54 2015 +0000
- Revision:
- 1:6c23a7cf204c
Added support for quad SPI and Flash SPI IC.; Ported from the DISCO-STM32L476VG library.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
capsavon | 1:6c23a7cf204c | 1 | /** |
capsavon | 1:6c23a7cf204c | 2 | ****************************************************************************** |
capsavon | 1:6c23a7cf204c | 3 | * @file stm32f746g_discovery_qspi.h |
capsavon | 1:6c23a7cf204c | 4 | * @author MCD Application Team |
capsavon | 1:6c23a7cf204c | 5 | * @version V1.0.0 |
capsavon | 1:6c23a7cf204c | 6 | * @date 15-november-2015 |
capsavon | 1:6c23a7cf204c | 7 | * @brief This file contains the common defines and functions prototypes for |
capsavon | 1:6c23a7cf204c | 8 | * the stm32f746g_discovery_qspi.c driver. |
capsavon | 1:6c23a7cf204c | 9 | ****************************************************************************** |
capsavon | 1:6c23a7cf204c | 10 | * @attention |
capsavon | 1:6c23a7cf204c | 11 | * |
capsavon | 1:6c23a7cf204c | 12 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
capsavon | 1:6c23a7cf204c | 13 | * |
capsavon | 1:6c23a7cf204c | 14 | * Redistribution and use in source and binary forms, with or without modification, |
capsavon | 1:6c23a7cf204c | 15 | * are permitted provided that the following conditions are met: |
capsavon | 1:6c23a7cf204c | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
capsavon | 1:6c23a7cf204c | 17 | * this list of conditions and the following disclaimer. |
capsavon | 1:6c23a7cf204c | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
capsavon | 1:6c23a7cf204c | 19 | * this list of conditions and the following disclaimer in the documentation |
capsavon | 1:6c23a7cf204c | 20 | * and/or other materials provided with the distribution. |
capsavon | 1:6c23a7cf204c | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
capsavon | 1:6c23a7cf204c | 22 | * may be used to endorse or promote products derived from this software |
capsavon | 1:6c23a7cf204c | 23 | * without specific prior written permission. |
capsavon | 1:6c23a7cf204c | 24 | * |
capsavon | 1:6c23a7cf204c | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
capsavon | 1:6c23a7cf204c | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
capsavon | 1:6c23a7cf204c | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
capsavon | 1:6c23a7cf204c | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
capsavon | 1:6c23a7cf204c | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
capsavon | 1:6c23a7cf204c | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
capsavon | 1:6c23a7cf204c | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
capsavon | 1:6c23a7cf204c | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
capsavon | 1:6c23a7cf204c | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
capsavon | 1:6c23a7cf204c | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
capsavon | 1:6c23a7cf204c | 35 | * |
capsavon | 1:6c23a7cf204c | 36 | ****************************************************************************** |
capsavon | 1:6c23a7cf204c | 37 | */ |
capsavon | 1:6c23a7cf204c | 38 | |
capsavon | 1:6c23a7cf204c | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ |
capsavon | 1:6c23a7cf204c | 40 | #ifndef __STM32F746G_DISCOVERY_QSPI_H |
capsavon | 1:6c23a7cf204c | 41 | #define __STM32F746G_DISCOVERY_QSPI_H |
capsavon | 1:6c23a7cf204c | 42 | |
capsavon | 1:6c23a7cf204c | 43 | #ifdef __cplusplus |
capsavon | 1:6c23a7cf204c | 44 | extern "C" { |
capsavon | 1:6c23a7cf204c | 45 | #endif |
capsavon | 1:6c23a7cf204c | 46 | |
capsavon | 1:6c23a7cf204c | 47 | /* Includes ------------------------------------------------------------------*/ |
capsavon | 1:6c23a7cf204c | 48 | #include "stm32f7xx_hal.h" |
capsavon | 1:6c23a7cf204c | 49 | #include "n25q128a.h" |
capsavon | 1:6c23a7cf204c | 50 | |
capsavon | 1:6c23a7cf204c | 51 | /** @addtogroup BSP |
capsavon | 1:6c23a7cf204c | 52 | * @{ |
capsavon | 1:6c23a7cf204c | 53 | */ |
capsavon | 1:6c23a7cf204c | 54 | |
capsavon | 1:6c23a7cf204c | 55 | /** @addtogroup STM32746G_DISCOVERY |
capsavon | 1:6c23a7cf204c | 56 | * @{ |
capsavon | 1:6c23a7cf204c | 57 | */ |
capsavon | 1:6c23a7cf204c | 58 | |
capsavon | 1:6c23a7cf204c | 59 | /** @addtogroup STM32L476G_DISCOVERY_QSPI |
capsavon | 1:6c23a7cf204c | 60 | * @{ |
capsavon | 1:6c23a7cf204c | 61 | */ |
capsavon | 1:6c23a7cf204c | 62 | |
capsavon | 1:6c23a7cf204c | 63 | /* Exported constants --------------------------------------------------------*/ |
capsavon | 1:6c23a7cf204c | 64 | /** @defgroup STM32F746G_DISCOVERY_QSPI_Exported_Constants Exported Constants |
capsavon | 1:6c23a7cf204c | 65 | * @{ |
capsavon | 1:6c23a7cf204c | 66 | */ |
capsavon | 1:6c23a7cf204c | 67 | /* QSPI Error codes */ |
capsavon | 1:6c23a7cf204c | 68 | #define QSPI_OK ((uint8_t)0x00) |
capsavon | 1:6c23a7cf204c | 69 | #define QSPI_ERROR ((uint8_t)0x01) |
capsavon | 1:6c23a7cf204c | 70 | #define QSPI_BUSY ((uint8_t)0x02) |
capsavon | 1:6c23a7cf204c | 71 | #define QSPI_NOT_SUPPORTED ((uint8_t)0x04) |
capsavon | 1:6c23a7cf204c | 72 | #define QSPI_SUSPENDED ((uint8_t)0x08) |
capsavon | 1:6c23a7cf204c | 73 | |
capsavon | 1:6c23a7cf204c | 74 | /** |
capsavon | 1:6c23a7cf204c | 75 | * @} |
capsavon | 1:6c23a7cf204c | 76 | */ |
capsavon | 1:6c23a7cf204c | 77 | |
capsavon | 1:6c23a7cf204c | 78 | /* Exported types ------------------------------------------------------------*/ |
capsavon | 1:6c23a7cf204c | 79 | /** @defgroup STM32F746G_DISCOVERY_QSPI_Exported_Types Exported Types |
capsavon | 1:6c23a7cf204c | 80 | * @{ |
capsavon | 1:6c23a7cf204c | 81 | */ |
capsavon | 1:6c23a7cf204c | 82 | /* QSPI Info */ |
capsavon | 1:6c23a7cf204c | 83 | typedef struct { |
capsavon | 1:6c23a7cf204c | 84 | uint32_t FlashSize; /*!< Size of the flash */ |
capsavon | 1:6c23a7cf204c | 85 | uint32_t EraseSectorSize; /*!< Size of sectors for the erase operation */ |
capsavon | 1:6c23a7cf204c | 86 | uint32_t EraseSectorsNumber; /*!< Number of sectors for the erase operation */ |
capsavon | 1:6c23a7cf204c | 87 | uint32_t ProgPageSize; /*!< Size of pages for the program operation */ |
capsavon | 1:6c23a7cf204c | 88 | uint32_t ProgPagesNumber; /*!< Number of pages for the program operation */ |
capsavon | 1:6c23a7cf204c | 89 | } QSPI_Info; |
capsavon | 1:6c23a7cf204c | 90 | |
capsavon | 1:6c23a7cf204c | 91 | /** |
capsavon | 1:6c23a7cf204c | 92 | * @} |
capsavon | 1:6c23a7cf204c | 93 | */ |
capsavon | 1:6c23a7cf204c | 94 | |
capsavon | 1:6c23a7cf204c | 95 | /* Exported functions --------------------------------------------------------*/ |
capsavon | 1:6c23a7cf204c | 96 | /** @defgroup STM32F746G_DISCOVERY_QSPI_Exported_Functions Exported Functions |
capsavon | 1:6c23a7cf204c | 97 | * @{ |
capsavon | 1:6c23a7cf204c | 98 | */ |
capsavon | 1:6c23a7cf204c | 99 | uint8_t BSP_QSPI_Init (void); |
capsavon | 1:6c23a7cf204c | 100 | uint8_t BSP_QSPI_DeInit (void); |
capsavon | 1:6c23a7cf204c | 101 | uint8_t BSP_QSPI_Read (uint8_t* pData, uint32_t ReadAddr, uint32_t Size); |
capsavon | 1:6c23a7cf204c | 102 | uint8_t BSP_QSPI_Write (uint8_t* pData, uint32_t WriteAddr, uint32_t Size); |
capsavon | 1:6c23a7cf204c | 103 | uint8_t BSP_QSPI_Erase_Block (uint32_t BlockAddress); |
capsavon | 1:6c23a7cf204c | 104 | uint8_t BSP_QSPI_Erase_Sector(uint32_t Sector); |
capsavon | 1:6c23a7cf204c | 105 | uint8_t BSP_QSPI_Erase_Chip (void); |
capsavon | 1:6c23a7cf204c | 106 | uint8_t BSP_QSPI_GetStatus (void); |
capsavon | 1:6c23a7cf204c | 107 | uint8_t BSP_QSPI_GetInfo (QSPI_Info* pInfo); |
capsavon | 1:6c23a7cf204c | 108 | uint8_t BSP_QSPI_EnableMemoryMappedMode(void); |
capsavon | 1:6c23a7cf204c | 109 | uint8_t BSP_QSPI_SuspendErase(void); |
capsavon | 1:6c23a7cf204c | 110 | uint8_t BSP_QSPI_ResumeErase (void); |
capsavon | 1:6c23a7cf204c | 111 | |
capsavon | 1:6c23a7cf204c | 112 | /** |
capsavon | 1:6c23a7cf204c | 113 | * @} |
capsavon | 1:6c23a7cf204c | 114 | */ |
capsavon | 1:6c23a7cf204c | 115 | |
capsavon | 1:6c23a7cf204c | 116 | /** |
capsavon | 1:6c23a7cf204c | 117 | * @} |
capsavon | 1:6c23a7cf204c | 118 | */ |
capsavon | 1:6c23a7cf204c | 119 | |
capsavon | 1:6c23a7cf204c | 120 | /** |
capsavon | 1:6c23a7cf204c | 121 | * @} |
capsavon | 1:6c23a7cf204c | 122 | */ |
capsavon | 1:6c23a7cf204c | 123 | |
capsavon | 1:6c23a7cf204c | 124 | /** |
capsavon | 1:6c23a7cf204c | 125 | * @} |
capsavon | 1:6c23a7cf204c | 126 | */ |
capsavon | 1:6c23a7cf204c | 127 | |
capsavon | 1:6c23a7cf204c | 128 | #ifdef __cplusplus |
capsavon | 1:6c23a7cf204c | 129 | } |
capsavon | 1:6c23a7cf204c | 130 | #endif |
capsavon | 1:6c23a7cf204c | 131 | |
capsavon | 1:6c23a7cf204c | 132 | #endif /* __STM32F746G_DISCOVERY_QSPI_H */ |
capsavon | 1:6c23a7cf204c | 133 | |
capsavon | 1:6c23a7cf204c | 134 | /* Modified by Florian SAVARD - 2015 11 15 */ |
capsavon | 1:6c23a7cf204c | 135 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |