added some library

Fork of BSP_DISCO_F746NG by ST

Committer:
MikGa87
Date:
Thu Oct 27 10:05:07 2016 +0000
Revision:
3:fe21abc9cc66
Added header file

Who changed what in which revision?

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