Projet

Dependents:   DISCO-F746NG_Scope_copy

Fork of BSP_DISCO_F746NG by ST

Committer:
bcostm
Date:
Mon Jan 04 15:19:15 2016 +0000
Revision:
1:ee089790cdbb
Add missing files

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_sd.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_sd.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 /* Define to prevent recursive inclusion -------------------------------------*/
bcostm 1:ee089790cdbb 40 #ifndef __STM32746G_DISCOVERY_SD_H
bcostm 1:ee089790cdbb 41 #define __STM32746G_DISCOVERY_SD_H
bcostm 1:ee089790cdbb 42
bcostm 1:ee089790cdbb 43 #ifdef __cplusplus
bcostm 1:ee089790cdbb 44 extern "C" {
bcostm 1:ee089790cdbb 45 #endif
bcostm 1:ee089790cdbb 46
bcostm 1:ee089790cdbb 47 /* Includes ------------------------------------------------------------------*/
bcostm 1:ee089790cdbb 48 #include "stm32746g_discovery.h"
bcostm 1:ee089790cdbb 49
bcostm 1:ee089790cdbb 50 /** @addtogroup BSP
bcostm 1:ee089790cdbb 51 * @{
bcostm 1:ee089790cdbb 52 */
bcostm 1:ee089790cdbb 53
bcostm 1:ee089790cdbb 54 /** @addtogroup STM32746G_DISCOVERY
bcostm 1:ee089790cdbb 55 * @{
bcostm 1:ee089790cdbb 56 */
bcostm 1:ee089790cdbb 57
bcostm 1:ee089790cdbb 58 /** @addtogroup STM32746G_DISCOVERY_SD
bcostm 1:ee089790cdbb 59 * @{
bcostm 1:ee089790cdbb 60 */
bcostm 1:ee089790cdbb 61
bcostm 1:ee089790cdbb 62 /** @defgroup STM32746G_DISCOVERY_SD_Exported_Types STM32746G_DISCOVERY_SD Exported Types
bcostm 1:ee089790cdbb 63 * @{
bcostm 1:ee089790cdbb 64 */
bcostm 1:ee089790cdbb 65
bcostm 1:ee089790cdbb 66 /**
bcostm 1:ee089790cdbb 67 * @brief SD Card information structure
bcostm 1:ee089790cdbb 68 */
bcostm 1:ee089790cdbb 69 #define SD_CardInfo HAL_SD_CardInfoTypedef
bcostm 1:ee089790cdbb 70 /**
bcostm 1:ee089790cdbb 71 * @}
bcostm 1:ee089790cdbb 72 */
bcostm 1:ee089790cdbb 73
bcostm 1:ee089790cdbb 74 /**
bcostm 1:ee089790cdbb 75 * @brief SD status structure definition
bcostm 1:ee089790cdbb 76 */
bcostm 1:ee089790cdbb 77 #define MSD_OK ((uint8_t)0x00)
bcostm 1:ee089790cdbb 78 #define MSD_ERROR ((uint8_t)0x01)
bcostm 1:ee089790cdbb 79 #define MSD_ERROR_SD_NOT_PRESENT ((uint8_t)0x02)
bcostm 1:ee089790cdbb 80
bcostm 1:ee089790cdbb 81 /** @defgroup STM32746G_DISCOVERY_SD_Exported_Constants STM32746G_DISCOVERY_SD Exported Constants
bcostm 1:ee089790cdbb 82 * @{
bcostm 1:ee089790cdbb 83 */
bcostm 1:ee089790cdbb 84 #define SD_PRESENT ((uint8_t)0x01)
bcostm 1:ee089790cdbb 85 #define SD_NOT_PRESENT ((uint8_t)0x00)
bcostm 1:ee089790cdbb 86
bcostm 1:ee089790cdbb 87 #define SD_DATATIMEOUT ((uint32_t)100000000)
bcostm 1:ee089790cdbb 88
bcostm 1:ee089790cdbb 89 /* DMA definitions for SD DMA transfer */
bcostm 1:ee089790cdbb 90 #define __DMAx_TxRx_CLK_ENABLE __HAL_RCC_DMA2_CLK_ENABLE
bcostm 1:ee089790cdbb 91 #define SD_DMAx_Tx_CHANNEL DMA_CHANNEL_4
bcostm 1:ee089790cdbb 92 #define SD_DMAx_Rx_CHANNEL DMA_CHANNEL_4
bcostm 1:ee089790cdbb 93 #define SD_DMAx_Tx_STREAM DMA2_Stream6
bcostm 1:ee089790cdbb 94 #define SD_DMAx_Rx_STREAM DMA2_Stream3
bcostm 1:ee089790cdbb 95 #define SD_DMAx_Tx_IRQn DMA2_Stream6_IRQn
bcostm 1:ee089790cdbb 96 #define SD_DMAx_Rx_IRQn DMA2_Stream3_IRQn
bcostm 1:ee089790cdbb 97 #define SD_DMAx_Tx_IRQHandler DMA2_Stream6_IRQHandler
bcostm 1:ee089790cdbb 98 #define SD_DMAx_Rx_IRQHandler DMA2_Stream3_IRQHandler
bcostm 1:ee089790cdbb 99 #define SD_DetectIRQHandler() HAL_GPIO_EXTI_IRQHandler(SD_DETECT_PIN)
bcostm 1:ee089790cdbb 100 /**
bcostm 1:ee089790cdbb 101 * @}
bcostm 1:ee089790cdbb 102 */
bcostm 1:ee089790cdbb 103
bcostm 1:ee089790cdbb 104 /** @defgroup STM32746G_DISCOVERY_SD_Exported_Macro STM32746G_DISCOVERY_SD Exported Macro
bcostm 1:ee089790cdbb 105 * @{
bcostm 1:ee089790cdbb 106 */
bcostm 1:ee089790cdbb 107 /**
bcostm 1:ee089790cdbb 108 * @}
bcostm 1:ee089790cdbb 109 */
bcostm 1:ee089790cdbb 110
bcostm 1:ee089790cdbb 111 /** @addtogroup STM32746G_DISCOVERY_SD_Exported_Functions
bcostm 1:ee089790cdbb 112 * @{
bcostm 1:ee089790cdbb 113 */
bcostm 1:ee089790cdbb 114 uint8_t BSP_SD_Init(void);
bcostm 1:ee089790cdbb 115 uint8_t BSP_SD_DeInit(void);
bcostm 1:ee089790cdbb 116 uint8_t BSP_SD_ITConfig(void);
bcostm 1:ee089790cdbb 117 void BSP_SD_DetectIT(void);
bcostm 1:ee089790cdbb 118 void BSP_SD_DetectCallback(void);
bcostm 1:ee089790cdbb 119 uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint64_t ReadAddr, uint32_t BlockSize, uint32_t NumOfBlocks);
bcostm 1:ee089790cdbb 120 uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint64_t WriteAddr, uint32_t BlockSize, uint32_t NumOfBlocks);
bcostm 1:ee089790cdbb 121 uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint64_t ReadAddr, uint32_t BlockSize, uint32_t NumOfBlocks);
bcostm 1:ee089790cdbb 122 uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint64_t WriteAddr, uint32_t BlockSize, uint32_t NumOfBlocks);
bcostm 1:ee089790cdbb 123 uint8_t BSP_SD_Erase(uint64_t StartAddr, uint64_t EndAddr);
bcostm 1:ee089790cdbb 124 void BSP_SD_IRQHandler(void);
bcostm 1:ee089790cdbb 125 void BSP_SD_DMA_Tx_IRQHandler(void);
bcostm 1:ee089790cdbb 126 void BSP_SD_DMA_Rx_IRQHandler(void);
bcostm 1:ee089790cdbb 127 HAL_SD_TransferStateTypedef BSP_SD_GetStatus(void);
bcostm 1:ee089790cdbb 128 void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypedef *CardInfo);
bcostm 1:ee089790cdbb 129 uint8_t BSP_SD_IsDetected(void);
bcostm 1:ee089790cdbb 130
bcostm 1:ee089790cdbb 131 /* These functions can be modified in case the current settings (e.g. DMA stream)
bcostm 1:ee089790cdbb 132 need to be changed for specific application needs */
bcostm 1:ee089790cdbb 133 void BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params);
bcostm 1:ee089790cdbb 134 void BSP_SD_Detect_MspInit(SD_HandleTypeDef *hsd, void *Params);
bcostm 1:ee089790cdbb 135 void BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params);
bcostm 1:ee089790cdbb 136
bcostm 1:ee089790cdbb 137 /**
bcostm 1:ee089790cdbb 138 * @}
bcostm 1:ee089790cdbb 139 */
bcostm 1:ee089790cdbb 140
bcostm 1:ee089790cdbb 141 /**
bcostm 1:ee089790cdbb 142 * @}
bcostm 1:ee089790cdbb 143 */
bcostm 1:ee089790cdbb 144
bcostm 1:ee089790cdbb 145 /**
bcostm 1:ee089790cdbb 146 * @}
bcostm 1:ee089790cdbb 147 */
bcostm 1:ee089790cdbb 148
bcostm 1:ee089790cdbb 149 /**
bcostm 1:ee089790cdbb 150 * @}
bcostm 1:ee089790cdbb 151 */
bcostm 1:ee089790cdbb 152
bcostm 1:ee089790cdbb 153 #ifdef __cplusplus
bcostm 1:ee089790cdbb 154 }
bcostm 1:ee089790cdbb 155 #endif
bcostm 1:ee089790cdbb 156
bcostm 1:ee089790cdbb 157 #endif /* __STM32746G_DISCOVERY_SD_H */
bcostm 1:ee089790cdbb 158
bcostm 1:ee089790cdbb 159 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/