STM32746G-Discovery board drivers V1.0.0

Dependents:   F746_SD_GraphicEqualizer_ren0620

Fork of BSP_DISCO_F746NG by ST

Committer:
edamame22
Date:
Wed Jun 22 03:48:49 2016 +0000
Revision:
3:286943c42d38
Parent:
1:ee089790cdbb
timeout is shortened.; play will not stop.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 1:ee089790cdbb 1 /**
bcostm 1:ee089790cdbb 2 ******************************************************************************
bcostm 1:ee089790cdbb 3 * @file stm32746g_discovery_qspi.h
bcostm 1:ee089790cdbb 4 * @author MCD Application Team
bcostm 1:ee089790cdbb 5 * @version V1.0.0
bcostm 1:ee089790cdbb 6 * @date 25-June-2015
bcostm 1:ee089790cdbb 7 * @brief This file contains the common defines and functions prototypes for
bcostm 1:ee089790cdbb 8 * the stm32746g_discovery_qspi.c driver.
bcostm 1:ee089790cdbb 9 ******************************************************************************
bcostm 1:ee089790cdbb 10 * @attention
bcostm 1:ee089790cdbb 11 *
bcostm 1:ee089790cdbb 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
bcostm 1:ee089790cdbb 13 *
bcostm 1:ee089790cdbb 14 * Redistribution and use in source and binary forms, with or without modification,
bcostm 1:ee089790cdbb 15 * are permitted provided that the following conditions are met:
bcostm 1:ee089790cdbb 16 * 1. Redistributions of source code must retain the above copyright notice,
bcostm 1:ee089790cdbb 17 * this list of conditions and the following disclaimer.
bcostm 1:ee089790cdbb 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
bcostm 1:ee089790cdbb 19 * this list of conditions and the following disclaimer in the documentation
bcostm 1:ee089790cdbb 20 * and/or other materials provided with the distribution.
bcostm 1:ee089790cdbb 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bcostm 1:ee089790cdbb 22 * may be used to endorse or promote products derived from this software
bcostm 1:ee089790cdbb 23 * without specific prior written permission.
bcostm 1:ee089790cdbb 24 *
bcostm 1:ee089790cdbb 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bcostm 1:ee089790cdbb 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bcostm 1:ee089790cdbb 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bcostm 1:ee089790cdbb 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bcostm 1:ee089790cdbb 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bcostm 1:ee089790cdbb 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bcostm 1:ee089790cdbb 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bcostm 1:ee089790cdbb 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bcostm 1:ee089790cdbb 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bcostm 1:ee089790cdbb 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bcostm 1:ee089790cdbb 35 *
bcostm 1:ee089790cdbb 36 ******************************************************************************
bcostm 1:ee089790cdbb 37 */
bcostm 1:ee089790cdbb 38
bcostm 1:ee089790cdbb 39 /** @addtogroup BSP
bcostm 1:ee089790cdbb 40 * @{
bcostm 1:ee089790cdbb 41 */
bcostm 1:ee089790cdbb 42
bcostm 1:ee089790cdbb 43 /** @addtogroup STM32746G_DISCOVERY
bcostm 1:ee089790cdbb 44 * @{
bcostm 1:ee089790cdbb 45 */
bcostm 1:ee089790cdbb 46
bcostm 1:ee089790cdbb 47 /* Define to prevent recursive inclusion -------------------------------------*/
bcostm 1:ee089790cdbb 48 #ifndef __STM32746G_DISCOVERY_QSPI_H
bcostm 1:ee089790cdbb 49 #define __STM32746G_DISCOVERY_QSPI_H
bcostm 1:ee089790cdbb 50
bcostm 1:ee089790cdbb 51 #ifdef __cplusplus
bcostm 1:ee089790cdbb 52 extern "C" {
bcostm 1:ee089790cdbb 53 #endif
bcostm 1:ee089790cdbb 54
bcostm 1:ee089790cdbb 55 /* Includes ------------------------------------------------------------------*/
bcostm 1:ee089790cdbb 56 #include "stm32f7xx_hal.h"
bcostm 1:ee089790cdbb 57 #include "n25q128a.h"
bcostm 1:ee089790cdbb 58
bcostm 1:ee089790cdbb 59 /** @addtogroup STM32746G_DISCOVERY_QSPI
bcostm 1:ee089790cdbb 60 * @{
bcostm 1:ee089790cdbb 61 */
bcostm 1:ee089790cdbb 62
bcostm 1:ee089790cdbb 63
bcostm 1:ee089790cdbb 64 /* Exported constants --------------------------------------------------------*/
bcostm 1:ee089790cdbb 65 /** @defgroup STM32746G_DISCOVERY_QSPI_Exported_Constants STM32746G_DISCOVERY_QSPI Exported Constants
bcostm 1:ee089790cdbb 66 * @{
bcostm 1:ee089790cdbb 67 */
bcostm 1:ee089790cdbb 68 /* QSPI Error codes */
bcostm 1:ee089790cdbb 69 #define QSPI_OK ((uint8_t)0x00)
bcostm 1:ee089790cdbb 70 #define QSPI_ERROR ((uint8_t)0x01)
bcostm 1:ee089790cdbb 71 #define QSPI_BUSY ((uint8_t)0x02)
bcostm 1:ee089790cdbb 72 #define QSPI_NOT_SUPPORTED ((uint8_t)0x04)
bcostm 1:ee089790cdbb 73 #define QSPI_SUSPENDED ((uint8_t)0x08)
bcostm 1:ee089790cdbb 74
bcostm 1:ee089790cdbb 75
bcostm 1:ee089790cdbb 76 /* Definition for QSPI clock resources */
bcostm 1:ee089790cdbb 77 #define QSPI_CLK_ENABLE() __HAL_RCC_QSPI_CLK_ENABLE()
bcostm 1:ee089790cdbb 78 #define QSPI_CLK_DISABLE() __HAL_RCC_QSPI_CLK_DISABLE()
bcostm 1:ee089790cdbb 79 #define QSPI_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
bcostm 1:ee089790cdbb 80 #define QSPI_CLK_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
bcostm 1:ee089790cdbb 81 #define QSPI_D0_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
bcostm 1:ee089790cdbb 82 #define QSPI_D1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
bcostm 1:ee089790cdbb 83 #define QSPI_D2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
bcostm 1:ee089790cdbb 84 #define QSPI_D3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
bcostm 1:ee089790cdbb 85
bcostm 1:ee089790cdbb 86 #define QSPI_FORCE_RESET() __HAL_RCC_QSPI_FORCE_RESET()
bcostm 1:ee089790cdbb 87 #define QSPI_RELEASE_RESET() __HAL_RCC_QSPI_RELEASE_RESET()
bcostm 1:ee089790cdbb 88
bcostm 1:ee089790cdbb 89 /* Definition for QSPI Pins */
bcostm 1:ee089790cdbb 90 #define QSPI_CS_PIN GPIO_PIN_6
bcostm 1:ee089790cdbb 91 #define QSPI_CS_GPIO_PORT GPIOB
bcostm 1:ee089790cdbb 92 #define QSPI_CLK_PIN GPIO_PIN_2
bcostm 1:ee089790cdbb 93 #define QSPI_CLK_GPIO_PORT GPIOB
bcostm 1:ee089790cdbb 94 #define QSPI_D0_PIN GPIO_PIN_11
bcostm 1:ee089790cdbb 95 #define QSPI_D0_GPIO_PORT GPIOD
bcostm 1:ee089790cdbb 96 #define QSPI_D1_PIN GPIO_PIN_12
bcostm 1:ee089790cdbb 97 #define QSPI_D1_GPIO_PORT GPIOD
bcostm 1:ee089790cdbb 98 #define QSPI_D2_PIN GPIO_PIN_2
bcostm 1:ee089790cdbb 99 #define QSPI_D2_GPIO_PORT GPIOE
bcostm 1:ee089790cdbb 100 #define QSPI_D3_PIN GPIO_PIN_13
bcostm 1:ee089790cdbb 101 #define QSPI_D3_GPIO_PORT GPIOD
bcostm 1:ee089790cdbb 102
bcostm 1:ee089790cdbb 103 /* N25Q128A13EF840E Micron memory */
bcostm 1:ee089790cdbb 104 /* Size of the flash */
bcostm 1:ee089790cdbb 105 #define QSPI_FLASH_SIZE 23 /* Address bus width to access whole memory space */
bcostm 1:ee089790cdbb 106 #define QSPI_PAGE_SIZE 256
bcostm 1:ee089790cdbb 107
bcostm 1:ee089790cdbb 108 /**
bcostm 1:ee089790cdbb 109 * @}
bcostm 1:ee089790cdbb 110 */
bcostm 1:ee089790cdbb 111
bcostm 1:ee089790cdbb 112 /* Exported types ------------------------------------------------------------*/
bcostm 1:ee089790cdbb 113 /** @defgroup STM32746G_DISCOVERY_QSPI_Exported_Types STM32746G_DISCOVERY_QSPI Exported Types
bcostm 1:ee089790cdbb 114 * @{
bcostm 1:ee089790cdbb 115 */
bcostm 1:ee089790cdbb 116 /* QSPI Info */
bcostm 1:ee089790cdbb 117 typedef struct {
bcostm 1:ee089790cdbb 118 uint32_t FlashSize; /*!< Size of the flash */
bcostm 1:ee089790cdbb 119 uint32_t EraseSectorSize; /*!< Size of sectors for the erase operation */
bcostm 1:ee089790cdbb 120 uint32_t EraseSectorsNumber; /*!< Number of sectors for the erase operation */
bcostm 1:ee089790cdbb 121 uint32_t ProgPageSize; /*!< Size of pages for the program operation */
bcostm 1:ee089790cdbb 122 uint32_t ProgPagesNumber; /*!< Number of pages for the program operation */
bcostm 1:ee089790cdbb 123 } QSPI_Info;
bcostm 1:ee089790cdbb 124
bcostm 1:ee089790cdbb 125 /**
bcostm 1:ee089790cdbb 126 * @}
bcostm 1:ee089790cdbb 127 */
bcostm 1:ee089790cdbb 128
bcostm 1:ee089790cdbb 129
bcostm 1:ee089790cdbb 130 /* Exported functions --------------------------------------------------------*/
bcostm 1:ee089790cdbb 131 /** @addtogroup STM32746G_DISCOVERY_QSPI_Exported_Functions
bcostm 1:ee089790cdbb 132 * @{
bcostm 1:ee089790cdbb 133 */
bcostm 1:ee089790cdbb 134 uint8_t BSP_QSPI_Init (void);
bcostm 1:ee089790cdbb 135 uint8_t BSP_QSPI_DeInit (void);
bcostm 1:ee089790cdbb 136 uint8_t BSP_QSPI_Read (uint8_t* pData, uint32_t ReadAddr, uint32_t Size);
bcostm 1:ee089790cdbb 137 uint8_t BSP_QSPI_Write (uint8_t* pData, uint32_t WriteAddr, uint32_t Size);
bcostm 1:ee089790cdbb 138 uint8_t BSP_QSPI_Erase_Block(uint32_t BlockAddress);
bcostm 1:ee089790cdbb 139 uint8_t BSP_QSPI_Erase_Chip (void);
bcostm 1:ee089790cdbb 140 uint8_t BSP_QSPI_GetStatus (void);
bcostm 1:ee089790cdbb 141 uint8_t BSP_QSPI_GetInfo (QSPI_Info* pInfo);
bcostm 1:ee089790cdbb 142 uint8_t BSP_QSPI_MemoryMappedMode(void);
bcostm 1:ee089790cdbb 143
bcostm 1:ee089790cdbb 144 /* These functions can be modified in case the current settings
bcostm 1:ee089790cdbb 145 need to be changed for specific application needs */
bcostm 1:ee089790cdbb 146 void BSP_QSPI_MspInit(QSPI_HandleTypeDef *hqspi, void *Params);
bcostm 1:ee089790cdbb 147 void BSP_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi, void *Params);
bcostm 1:ee089790cdbb 148
bcostm 1:ee089790cdbb 149 /**
bcostm 1:ee089790cdbb 150 * @}
bcostm 1:ee089790cdbb 151 */
bcostm 1:ee089790cdbb 152
bcostm 1:ee089790cdbb 153 /**
bcostm 1:ee089790cdbb 154 * @}
bcostm 1:ee089790cdbb 155 */
bcostm 1:ee089790cdbb 156
bcostm 1:ee089790cdbb 157 #ifdef __cplusplus
bcostm 1:ee089790cdbb 158 }
bcostm 1:ee089790cdbb 159 #endif
bcostm 1:ee089790cdbb 160
bcostm 1:ee089790cdbb 161 #endif /* __STM32746G_DISCOVERY_QSPI_H */
bcostm 1:ee089790cdbb 162 /**
bcostm 1:ee089790cdbb 163 * @}
bcostm 1:ee089790cdbb 164 */
bcostm 1:ee089790cdbb 165
bcostm 1:ee089790cdbb 166 /**
bcostm 1:ee089790cdbb 167 * @}
bcostm 1:ee089790cdbb 168 */
bcostm 1:ee089790cdbb 169
bcostm 1:ee089790cdbb 170 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/