Nam

Dependencies:   mbed

Dependents:   uSD LCD

Committer:
bcostm
Date:
Thu Nov 10 09:57:11 2016 +0100
Revision:
6:e1d9da7fe856
Child:
8:56384bddaba5
Update all files present in STM32CubeF7 V1.5.1. Keep original folders structure.

Who changed what in which revision?

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