ST / BSP_DISCO_F769NI

Dependents:   mbed-os-example-blinky-5 DISCO-F769NI_TOUCHSCREEN_demo_custom_1 Datarecorder2 DISCO-F769NI_TOUCHSCREEN_demo ... more

Committer:
Jerome Coutant
Date:
Fri Nov 15 14:50:16 2019 +0100
Revision:
8:d13d7c447539
Parent:
4:72a949940ad6
Correct warning

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jerome Coutant 0:c0f3bbab73d2 1 /**
Jerome Coutant 0:c0f3bbab73d2 2 ******************************************************************************
Jerome Coutant 0:c0f3bbab73d2 3 * @file stm32f769i_discovery_sd.h
Jerome Coutant 0:c0f3bbab73d2 4 * @author MCD Application Team
Jerome Coutant 0:c0f3bbab73d2 5 * @brief This file contains the common defines and functions prototypes for
Jerome Coutant 0:c0f3bbab73d2 6 * the stm32f769i_discovery_sd.c driver.
Jerome Coutant 0:c0f3bbab73d2 7 ******************************************************************************
Jerome Coutant 0:c0f3bbab73d2 8 * @attention
Jerome Coutant 0:c0f3bbab73d2 9 *
Jerome Coutant 0:c0f3bbab73d2 10 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
Jerome Coutant 0:c0f3bbab73d2 11 *
Jerome Coutant 0:c0f3bbab73d2 12 * Redistribution and use in source and binary forms, with or without modification,
Jerome Coutant 0:c0f3bbab73d2 13 * are permitted provided that the following conditions are met:
Jerome Coutant 0:c0f3bbab73d2 14 * 1. Redistributions of source code must retain the above copyright notice,
Jerome Coutant 0:c0f3bbab73d2 15 * this list of conditions and the following disclaimer.
Jerome Coutant 0:c0f3bbab73d2 16 * 2. Redistributions in binary form must reproduce the above copyright notice,
Jerome Coutant 0:c0f3bbab73d2 17 * this list of conditions and the following disclaimer in the documentation
Jerome Coutant 0:c0f3bbab73d2 18 * and/or other materials provided with the distribution.
Jerome Coutant 0:c0f3bbab73d2 19 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Jerome Coutant 0:c0f3bbab73d2 20 * may be used to endorse or promote products derived from this software
Jerome Coutant 0:c0f3bbab73d2 21 * without specific prior written permission.
Jerome Coutant 0:c0f3bbab73d2 22 *
Jerome Coutant 0:c0f3bbab73d2 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Jerome Coutant 0:c0f3bbab73d2 24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Jerome Coutant 0:c0f3bbab73d2 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Jerome Coutant 0:c0f3bbab73d2 26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Jerome Coutant 0:c0f3bbab73d2 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Jerome Coutant 0:c0f3bbab73d2 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Jerome Coutant 0:c0f3bbab73d2 29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Jerome Coutant 0:c0f3bbab73d2 30 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Jerome Coutant 0:c0f3bbab73d2 31 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Jerome Coutant 0:c0f3bbab73d2 32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Jerome Coutant 0:c0f3bbab73d2 33 *
Jerome Coutant 0:c0f3bbab73d2 34 ******************************************************************************
Jerome Coutant 0:c0f3bbab73d2 35 */
Jerome Coutant 0:c0f3bbab73d2 36
Jerome Coutant 0:c0f3bbab73d2 37 /* Define to prevent recursive inclusion -------------------------------------*/
Jerome Coutant 0:c0f3bbab73d2 38 #ifndef __STM32F769I_DISCOVERY_SD_H
Jerome Coutant 0:c0f3bbab73d2 39 #define __STM32F769I_DISCOVERY_SD_H
Jerome Coutant 0:c0f3bbab73d2 40
Jerome Coutant 0:c0f3bbab73d2 41 #ifdef __cplusplus
Jerome Coutant 0:c0f3bbab73d2 42 extern "C" {
Jerome Coutant 0:c0f3bbab73d2 43 #endif
Jerome Coutant 0:c0f3bbab73d2 44
Jerome Coutant 0:c0f3bbab73d2 45 /* Includes ------------------------------------------------------------------*/
Jerome Coutant 0:c0f3bbab73d2 46 #include "stm32f769i_discovery.h"
Jerome Coutant 0:c0f3bbab73d2 47
Jerome Coutant 0:c0f3bbab73d2 48 /** @addtogroup BSP
Jerome Coutant 0:c0f3bbab73d2 49 * @{
Jerome Coutant 0:c0f3bbab73d2 50 */
Jerome Coutant 0:c0f3bbab73d2 51
Jerome Coutant 1:3e58f8a39705 52 /** @addtogroup STM32F769I_DISCOVERY
Jerome Coutant 0:c0f3bbab73d2 53 * @{
Jerome Coutant 0:c0f3bbab73d2 54 */
Jerome Coutant 0:c0f3bbab73d2 55
Jerome Coutant 1:3e58f8a39705 56 /** @addtogroup STM32F769I_DISCOVERY_SD STM32F769I_DISCOVERY SD
Jerome Coutant 0:c0f3bbab73d2 57 * @{
Jerome Coutant 0:c0f3bbab73d2 58 */
Jerome Coutant 0:c0f3bbab73d2 59
Jerome Coutant 1:3e58f8a39705 60 /** @defgroup STM32F769I_DISCOVERY_SD_Exported_Types SD Exported Types
Jerome Coutant 0:c0f3bbab73d2 61 * @{
Jerome Coutant 0:c0f3bbab73d2 62 */
Jerome Coutant 0:c0f3bbab73d2 63
Jerome Coutant 0:c0f3bbab73d2 64 /**
Jerome Coutant 0:c0f3bbab73d2 65 * @brief SD Card information structure
Jerome Coutant 0:c0f3bbab73d2 66 */
Jerome Coutant 1:3e58f8a39705 67 #define BSP_SD_CardInfo HAL_SD_CardInfoTypeDef
Jerome Coutant 0:c0f3bbab73d2 68 /**
Jerome Coutant 0:c0f3bbab73d2 69 * @}
Jerome Coutant 0:c0f3bbab73d2 70 */
Jerome Coutant 0:c0f3bbab73d2 71
Jerome Coutant 0:c0f3bbab73d2 72 /**
Jerome Coutant 0:c0f3bbab73d2 73 * @brief SD status structure definition
Jerome Coutant 0:c0f3bbab73d2 74 */
Jerome Coutant 0:c0f3bbab73d2 75 #define MSD_OK ((uint8_t)0x00)
Jerome Coutant 0:c0f3bbab73d2 76 #define MSD_ERROR ((uint8_t)0x01)
Jerome Coutant 0:c0f3bbab73d2 77 #define MSD_ERROR_SD_NOT_PRESENT ((uint8_t)0x02)
Jerome Coutant 0:c0f3bbab73d2 78
Jerome Coutant 1:3e58f8a39705 79 /**
Jerome Coutant 1:3e58f8a39705 80 * @brief SD transfer state definition
Jerome Coutant 1:3e58f8a39705 81 */
Jerome Coutant 1:3e58f8a39705 82 #define SD_TRANSFER_OK ((uint8_t)0x00)
Jerome Coutant 1:3e58f8a39705 83 #define SD_TRANSFER_BUSY ((uint8_t)0x01)
Jerome Coutant 1:3e58f8a39705 84
Jerome Coutant 1:3e58f8a39705 85 /** @defgroup STM32F769I_DISCOVERY_SD_Exported_Constants SD Exported Constants
Jerome Coutant 0:c0f3bbab73d2 86 * @{
Jerome Coutant 0:c0f3bbab73d2 87 */
Jerome Coutant 0:c0f3bbab73d2 88 #define SD_PRESENT ((uint8_t)0x01)
Jerome Coutant 0:c0f3bbab73d2 89 #define SD_NOT_PRESENT ((uint8_t)0x00)
Jerome Coutant 0:c0f3bbab73d2 90
Jerome Coutant 0:c0f3bbab73d2 91 #define SD_DATATIMEOUT ((uint32_t)100000000)
Jerome Coutant 0:c0f3bbab73d2 92
Jerome Coutant 0:c0f3bbab73d2 93 /* DMA definitions for SD DMA transfer */
Jerome Coutant 0:c0f3bbab73d2 94 #define __DMAx_TxRx_CLK_ENABLE __HAL_RCC_DMA2_CLK_ENABLE
Jerome Coutant 0:c0f3bbab73d2 95 #define SD_DMAx_Tx_CHANNEL DMA_CHANNEL_11
Jerome Coutant 0:c0f3bbab73d2 96 #define SD_DMAx_Rx_CHANNEL DMA_CHANNEL_11
Jerome Coutant 0:c0f3bbab73d2 97 #define SD_DMAx_Tx_STREAM DMA2_Stream5
Jerome Coutant 0:c0f3bbab73d2 98 #define SD_DMAx_Rx_STREAM DMA2_Stream0
Jerome Coutant 0:c0f3bbab73d2 99 #define SD_DMAx_Tx_IRQn DMA2_Stream5_IRQn
Jerome Coutant 0:c0f3bbab73d2 100 #define SD_DMAx_Rx_IRQn DMA2_Stream0_IRQn
Jerome Coutant 0:c0f3bbab73d2 101 #define BSP_SDMMC_IRQHandler SDMMC2_IRQHandler
Jerome Coutant 0:c0f3bbab73d2 102 #define BSP_SDMMC_DMA_Tx_IRQHandler DMA2_Stream5_IRQHandler
Jerome Coutant 0:c0f3bbab73d2 103 #define BSP_SDMMC_DMA_Rx_IRQHandler DMA2_Stream0_IRQHandler
Jerome Coutant 0:c0f3bbab73d2 104 #define SD_DetectIRQHandler() HAL_GPIO_EXTI_IRQHandler(SD_DETECT_PIN)
Jerome Coutant 0:c0f3bbab73d2 105
Jerome Coutant 0:c0f3bbab73d2 106
Jerome Coutant 0:c0f3bbab73d2 107 /**
Jerome Coutant 0:c0f3bbab73d2 108 * @}
Jerome Coutant 0:c0f3bbab73d2 109 */
Jerome Coutant 0:c0f3bbab73d2 110
Jerome Coutant 1:3e58f8a39705 111 /** @defgroup STM32F769I_DISCOVERY_SD_Exported_Macro STM32F769I Discovery SD Exported Macro
Jerome Coutant 0:c0f3bbab73d2 112 * @{
Jerome Coutant 0:c0f3bbab73d2 113 */
Jerome Coutant 0:c0f3bbab73d2 114 /**
Jerome Coutant 0:c0f3bbab73d2 115 * @}
Jerome Coutant 0:c0f3bbab73d2 116 */
Jerome Coutant 0:c0f3bbab73d2 117
Jerome Coutant 1:3e58f8a39705 118 /** @defgroup STM32F769I_DISCOVERY_SD_Exported_Functions STM32F769I Discovery SD Exported Functions
Jerome Coutant 0:c0f3bbab73d2 119 * @{
Jerome Coutant 0:c0f3bbab73d2 120 */
Jerome Coutant 0:c0f3bbab73d2 121 uint8_t BSP_SD_Init(void);
Jerome Coutant 0:c0f3bbab73d2 122 uint8_t BSP_SD_DeInit(void);
Jerome Coutant 0:c0f3bbab73d2 123 uint8_t BSP_SD_ITConfig(void);
Jerome Coutant 1:3e58f8a39705 124 uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout);
Jerome Coutant 1:3e58f8a39705 125 uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout);
Jerome Coutant 1:3e58f8a39705 126 uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks);
Jerome Coutant 1:3e58f8a39705 127 uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks);
Jerome Coutant 1:3e58f8a39705 128 uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr);
Jerome Coutant 1:3e58f8a39705 129 uint8_t BSP_SD_GetCardState(void);
Jerome Coutant 1:3e58f8a39705 130 void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo);
Jerome Coutant 0:c0f3bbab73d2 131 uint8_t BSP_SD_IsDetected(void);
Jerome Coutant 0:c0f3bbab73d2 132
Jerome Coutant 1:3e58f8a39705 133 /* These functions can be modified in case the current settings (e.g. DMA stream)
Jerome Coutant 1:3e58f8a39705 134 need to be changed for specific application needs */
Jerome Coutant 0:c0f3bbab73d2 135 void BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params);
Jerome Coutant 0:c0f3bbab73d2 136 void BSP_SD_Detect_MspInit(SD_HandleTypeDef *hsd, void *Params);
Jerome Coutant 0:c0f3bbab73d2 137 void BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params);
Jerome Coutant 1:3e58f8a39705 138 void BSP_SD_AbortCallback(void);
Jerome Coutant 1:3e58f8a39705 139 void BSP_SD_WriteCpltCallback(void);
Jerome Coutant 1:3e58f8a39705 140 void BSP_SD_ReadCpltCallback(void);
Jerome Coutant 0:c0f3bbab73d2 141
Jerome Coutant 0:c0f3bbab73d2 142 /**
Jerome Coutant 0:c0f3bbab73d2 143 * @}
Jerome Coutant 0:c0f3bbab73d2 144 */
Jerome Coutant 0:c0f3bbab73d2 145
Jerome Coutant 0:c0f3bbab73d2 146 /**
Jerome Coutant 0:c0f3bbab73d2 147 * @}
Jerome Coutant 0:c0f3bbab73d2 148 */
Jerome Coutant 0:c0f3bbab73d2 149
Jerome Coutant 0:c0f3bbab73d2 150 /**
Jerome Coutant 0:c0f3bbab73d2 151 * @}
Jerome Coutant 0:c0f3bbab73d2 152 */
Jerome Coutant 0:c0f3bbab73d2 153
Jerome Coutant 0:c0f3bbab73d2 154 /**
Jerome Coutant 0:c0f3bbab73d2 155 * @}
Jerome Coutant 0:c0f3bbab73d2 156 */
Jerome Coutant 0:c0f3bbab73d2 157
Jerome Coutant 0:c0f3bbab73d2 158 #ifdef __cplusplus
Jerome Coutant 0:c0f3bbab73d2 159 }
Jerome Coutant 0:c0f3bbab73d2 160 #endif
Jerome Coutant 0:c0f3bbab73d2 161
Jerome Coutant 0:c0f3bbab73d2 162 #endif /* __STM32F769I_DISCOVERY_SD_H */
Jerome Coutant 0:c0f3bbab73d2 163
Jerome Coutant 0:c0f3bbab73d2 164 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/