ST / BSP_DISCO_H747I

Dependents:   DISCO_H747I_LCD_demo DISCO_H747I_AUDIO_demo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stm32h747i_discovery_qspi.h Source File

stm32h747i_discovery_qspi.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32h747i_discovery_qspi.h
00004   * @author  MCD Application Team
00005   * @brief   This file contains the common defines and functions prototypes for
00006   *          the stm32h747i_discovery_qspi.c driver.
00007   ******************************************************************************
00008   * @attention
00009   *
00010   * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
00011   * All rights reserved.</center></h2>
00012   *
00013   * This software component is licensed by ST under BSD 3-Clause license,
00014   * the "License"; You may not use this file except in compliance with the
00015   * License. You may obtain a copy of the License at:
00016   *                        opensource.org/licenses/BSD-3-Clause
00017   *
00018   ******************************************************************************
00019   */
00020 
00021 /** @addtogroup BSP
00022   * @{
00023   */
00024 
00025 /** @addtogroup STM32H747I_DISCOVERY
00026   * @{
00027   */
00028 
00029 /* Define to prevent recursive inclusion -------------------------------------*/
00030 #ifndef __STM32H747I_DISCOVERY_QSPI_H
00031 #define __STM32H747I_DISCOVERY_QSPI_H
00032 
00033 #ifdef __cplusplus
00034  extern "C" {
00035 #endif
00036 
00037 /* Includes ------------------------------------------------------------------*/
00038 #include "stm32h7xx_hal.h"
00039 #include "../Components/mt25tl01g/mt25tl01g.h"
00040 
00041 /** @addtogroup STM32H747I_DISCOVERY_QSPI
00042   * @{
00043   */
00044 
00045 /* Exported constants --------------------------------------------------------*/
00046 /** @defgroup STM32H747I_DISCOVERY_QSPI_Exported_Constants Exported Constants
00047   * @{
00048   */
00049 /* QSPI Error codes */
00050 #define QSPI_OK            ((uint8_t)0x00)
00051 #define QSPI_ERROR         ((uint8_t)0x01)
00052 #define QSPI_BUSY          ((uint8_t)0x02)
00053 #define QSPI_NOT_SUPPORTED ((uint8_t)0x04)
00054 #define QSPI_SUSPENDED     ((uint8_t)0x08)
00055 #define QSPI_PROTECTED     ((uint8_t)0x10)
00056 
00057 /* Definition for QSPI clock resources */
00058 #define QSPI_CLK_ENABLE()              __HAL_RCC_QSPI_CLK_ENABLE()
00059 #define QSPI_CLK_DISABLE()             __HAL_RCC_QSPI_CLK_DISABLE()
00060 #define QSPI_CLK_GPIO_CLK_ENABLE()     __HAL_RCC_GPIOB_CLK_ENABLE()
00061 #define QSPI_BK1_CS_GPIO_CLK_ENABLE()  __HAL_RCC_GPIOG_CLK_ENABLE()
00062 #define QSPI_BK1_D0_GPIO_CLK_ENABLE()  __HAL_RCC_GPIOD_CLK_ENABLE()
00063 #define QSPI_BK1_D1_GPIO_CLK_ENABLE()  __HAL_RCC_GPIOF_CLK_ENABLE()
00064 #define QSPI_BK1_D2_GPIO_CLK_ENABLE()  __HAL_RCC_GPIOF_CLK_ENABLE()
00065 #define QSPI_BK1_D3_GPIO_CLK_ENABLE()  __HAL_RCC_GPIOF_CLK_ENABLE()
00066 #define QSPI_BK2_CS_GPIO_CLK_ENABLE()  __HAL_RCC_GPIOG_CLK_ENABLE()
00067 #define QSPI_BK2_D0_GPIO_CLK_ENABLE()  __HAL_RCC_GPIOH_CLK_ENABLE()
00068 #define QSPI_BK2_D1_GPIO_CLK_ENABLE()  __HAL_RCC_GPIOH_CLK_ENABLE()
00069 #define QSPI_BK2_D2_GPIO_CLK_ENABLE()  __HAL_RCC_GPIOG_CLK_ENABLE()
00070 #define QSPI_BK2_D3_GPIO_CLK_ENABLE()  __HAL_RCC_GPIOG_CLK_ENABLE()
00071 
00072 
00073 #define QSPI_FORCE_RESET()         __HAL_RCC_QSPI_FORCE_RESET()
00074 #define QSPI_RELEASE_RESET()       __HAL_RCC_QSPI_RELEASE_RESET()
00075 
00076 /* Definition for QSPI Pins */
00077 #define QSPI_CLK_PIN               GPIO_PIN_2
00078 #define QSPI_CLK_GPIO_PORT         GPIOB
00079 /* Bank 1 */
00080 #define QSPI_BK1_CS_PIN            GPIO_PIN_6
00081 #define QSPI_BK1_CS_GPIO_PORT      GPIOG
00082 #define QSPI_BK1_D0_PIN            GPIO_PIN_11
00083 #define QSPI_BK1_D0_GPIO_PORT      GPIOD
00084 #define QSPI_BK1_D1_PIN            GPIO_PIN_9
00085 #define QSPI_BK1_D1_GPIO_PORT      GPIOF
00086 #define QSPI_BK1_D2_PIN            GPIO_PIN_7
00087 #define QSPI_BK1_D2_GPIO_PORT      GPIOF
00088 #define QSPI_BK1_D3_PIN            GPIO_PIN_6
00089 #define QSPI_BK1_D3_GPIO_PORT      GPIOF
00090 
00091 /* Bank 2 */
00092 #define QSPI_BK2_CS_PIN            GPIO_PIN_6
00093 #define QSPI_BK2_CS_GPIO_PORT      GPIOG
00094 #define QSPI_BK2_D0_PIN            GPIO_PIN_2
00095 #define QSPI_BK2_D0_GPIO_PORT      GPIOH
00096 #define QSPI_BK2_D1_PIN            GPIO_PIN_3
00097 #define QSPI_BK2_D1_GPIO_PORT      GPIOH
00098 #define QSPI_BK2_D2_PIN            GPIO_PIN_9
00099 #define QSPI_BK2_D2_GPIO_PORT      GPIOG
00100 #define QSPI_BK2_D3_PIN            GPIO_PIN_14
00101 #define QSPI_BK2_D3_GPIO_PORT      GPIOG
00102 
00103 
00104 /* MT25TL01G Micron memory */
00105 /* Size of the flash */
00106 #define QSPI_FLASH_SIZE            26     /* Address bus width to access whole memory space */
00107 #define QSPI_PAGE_SIZE             256
00108 
00109 /* QSPI Base Address */
00110 #define QSPI_BASE_ADDRESS          0x90000000
00111 
00112 /**
00113   * @}
00114   */
00115 
00116 /* Exported types ------------------------------------------------------------*/
00117 /** @defgroup STM32H747I_DISCOVERY_QSPI_Exported_Types Exported Types
00118   * @{
00119   */
00120 /* QSPI Info */
00121 typedef struct {
00122   uint32_t FlashSize;          /*!< Size of the flash */
00123   uint32_t EraseSectorSize;    /*!< Size of sectors for the erase operation */
00124   uint32_t EraseSectorsNumber; /*!< Number of sectors for the erase operation */
00125   uint32_t ProgPageSize;       /*!< Size of pages for the program operation */
00126   uint32_t ProgPagesNumber;    /*!< Number of pages for the program operation */
00127 } QSPI_Info;
00128 
00129 /**
00130   * @}
00131   */
00132 
00133 
00134 /* Exported functions --------------------------------------------------------*/
00135 /** @addtogroup STM32H747I_DISCOVERY_QSPI_Exported_Functions
00136   * @{
00137   */
00138 uint8_t BSP_QSPI_Init       (void);
00139 uint8_t BSP_QSPI_DeInit     (void);
00140 uint8_t BSP_QSPI_Read       (uint8_t* pData, uint32_t ReadAddr, uint32_t Size);
00141 uint8_t BSP_QSPI_Write      (uint8_t* pData, uint32_t WriteAddr, uint32_t Size);
00142 uint8_t BSP_QSPI_Erase_Block(uint32_t BlockAddress);
00143 uint8_t BSP_QSPI_Erase_Chip (void);
00144 uint8_t BSP_QSPI_GetStatus  (void);
00145 uint8_t BSP_QSPI_GetInfo    (QSPI_Info* pInfo);
00146 uint8_t BSP_QSPI_EnableMemoryMappedMode(void);
00147 
00148 /* These functions can be modified in case the current settings
00149    need to be changed for specific application needs */
00150 void BSP_QSPI_MspInit(QSPI_HandleTypeDef *hqspi, void *Params);
00151 void BSP_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi, void *Params);
00152 
00153 /**
00154   * @}
00155   */
00156 
00157 /**
00158   * @}
00159   */
00160 
00161 #ifdef __cplusplus
00162 }
00163 #endif
00164 
00165 #endif /* __STM32H747I_DISCOVERY_QSPI_H */
00166 /**
00167   * @}
00168   */
00169 
00170 /**
00171   * @}
00172   */
00173 
00174 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/