BSP files for STM32H747I-Discovery Copy from ST Cube delivery
Dependents: DISCO_H747I_LCD_demo DISCO_H747I_AUDIO_demo
STM32H747I-Discovery/stm32h747i_discovery_sd.h@3:bc403474b366, 2019-11-06 (annotated)
- Committer:
- Jerome Coutant
- Date:
- Wed Nov 06 11:32:01 2019 +0100
- Revision:
- 3:bc403474b366
- Parent:
- 0:146cf26a9bbb
Add PDM lib
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jerome Coutant
0:146cf26a9bbb
|
1
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
2
|
******************************************************************************
|
|
Jerome Coutant
0:146cf26a9bbb
|
3
|
* @file stm32h747i_discovery_sd.h
|
|
Jerome Coutant
0:146cf26a9bbb
|
4
|
* @author MCD Application Team
|
|
Jerome Coutant
0:146cf26a9bbb
|
5
|
* @brief This file contains the common defines and functions prototypes for
|
|
Jerome Coutant
0:146cf26a9bbb
|
6
|
* the stm32h747i_discovery_sd.c driver.
|
|
Jerome Coutant
0:146cf26a9bbb
|
7
|
******************************************************************************
|
|
Jerome Coutant
0:146cf26a9bbb
|
8
|
* @attention
|
|
Jerome Coutant
0:146cf26a9bbb
|
9
|
*
|
|
Jerome Coutant
0:146cf26a9bbb
|
10
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
|
Jerome Coutant
0:146cf26a9bbb
|
11
|
* All rights reserved.</center></h2>
|
|
Jerome Coutant
0:146cf26a9bbb
|
12
|
*
|
|
Jerome Coutant
0:146cf26a9bbb
|
13
|
* This software component is licensed by ST under BSD 3-Clause license,
|
|
Jerome Coutant
0:146cf26a9bbb
|
14
|
* the "License"; You may not use this file except in compliance with the
|
|
Jerome Coutant
0:146cf26a9bbb
|
15
|
* License. You may obtain a copy of the License at:
|
|
Jerome Coutant
0:146cf26a9bbb
|
16
|
* opensource.org/licenses/BSD-3-Clause
|
|
Jerome Coutant
0:146cf26a9bbb
|
17
|
*
|
|
Jerome Coutant
0:146cf26a9bbb
|
18
|
******************************************************************************
|
|
Jerome Coutant
0:146cf26a9bbb
|
19
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
20
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
21
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
22
|
#ifndef __STM32H747I_DISCOVERY_SD_H
|
|
Jerome Coutant
0:146cf26a9bbb
|
23
|
#define __STM32H747I_DISCOVERY_SD_H
|
|
Jerome Coutant
0:146cf26a9bbb
|
24
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
25
|
#ifdef __cplusplus
|
|
Jerome Coutant
0:146cf26a9bbb
|
26
|
extern "C" {
|
|
Jerome Coutant
0:146cf26a9bbb
|
27
|
#endif
|
|
Jerome Coutant
0:146cf26a9bbb
|
28
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
29
|
/* Includes ------------------------------------------------------------------*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
30
|
#include "stm32h7xx_hal.h"
|
|
Jerome Coutant
0:146cf26a9bbb
|
31
|
#include "stm32h747i_discovery.h"
|
|
Jerome Coutant
0:146cf26a9bbb
|
32
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
33
|
/** @addtogroup BSP
|
|
Jerome Coutant
0:146cf26a9bbb
|
34
|
* @{
|
|
Jerome Coutant
0:146cf26a9bbb
|
35
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
36
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
37
|
/** @addtogroup STM32H747I_DISCOVERY
|
|
Jerome Coutant
0:146cf26a9bbb
|
38
|
* @{
|
|
Jerome Coutant
0:146cf26a9bbb
|
39
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
40
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
41
|
/** @addtogroup STM32H747I_DISCOVERY_SD
|
|
Jerome Coutant
0:146cf26a9bbb
|
42
|
* @{
|
|
Jerome Coutant
0:146cf26a9bbb
|
43
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
44
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
45
|
/** @defgroup STM32H747I_DISCOVERY_SD_Exported_Types Exported Types
|
|
Jerome Coutant
0:146cf26a9bbb
|
46
|
* @{
|
|
Jerome Coutant
0:146cf26a9bbb
|
47
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
48
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
49
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
50
|
* @brief SD Card information structure
|
|
Jerome Coutant
0:146cf26a9bbb
|
51
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
52
|
#define BSP_SD_CardInfo HAL_SD_CardInfoTypeDef
|
|
Jerome Coutant
0:146cf26a9bbb
|
53
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
54
|
* @}
|
|
Jerome Coutant
0:146cf26a9bbb
|
55
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
56
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
57
|
/** @defgroup STM32H747I_DISCOVERY_SD_ Exported_Constants Exported Constants
|
|
Jerome Coutant
0:146cf26a9bbb
|
58
|
* @{
|
|
Jerome Coutant
0:146cf26a9bbb
|
59
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
60
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
61
|
* @brief SD status structure definition
|
|
Jerome Coutant
0:146cf26a9bbb
|
62
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
63
|
#define MSD_OK ((uint8_t)0x00)
|
|
Jerome Coutant
0:146cf26a9bbb
|
64
|
#define MSD_ERROR ((uint8_t)0x01)
|
|
Jerome Coutant
0:146cf26a9bbb
|
65
|
#define MSD_ERROR_SD_NOT_PRESENT ((uint8_t)0x02)
|
|
Jerome Coutant
0:146cf26a9bbb
|
66
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
67
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
68
|
* @brief SD transfer state definition
|
|
Jerome Coutant
0:146cf26a9bbb
|
69
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
70
|
#define SD_TRANSFER_OK ((uint8_t)0x00)
|
|
Jerome Coutant
0:146cf26a9bbb
|
71
|
#define SD_TRANSFER_BUSY ((uint8_t)0x01)
|
|
Jerome Coutant
0:146cf26a9bbb
|
72
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
73
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
74
|
#define SD_PRESENT ((uint8_t)0x01)
|
|
Jerome Coutant
0:146cf26a9bbb
|
75
|
#define SD_NOT_PRESENT ((uint8_t)0x00)
|
|
Jerome Coutant
0:146cf26a9bbb
|
76
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
77
|
#define SD_DATATIMEOUT ((uint32_t)100000000)
|
|
Jerome Coutant
0:146cf26a9bbb
|
78
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
79
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
80
|
* @}
|
|
Jerome Coutant
0:146cf26a9bbb
|
81
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
82
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
83
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
84
|
/** @addtogroup STM32H747I_DISCOVERY_SD_Exported_Functions
|
|
Jerome Coutant
0:146cf26a9bbb
|
85
|
* @{
|
|
Jerome Coutant
0:146cf26a9bbb
|
86
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
87
|
uint8_t BSP_SD_Init(void);
|
|
Jerome Coutant
0:146cf26a9bbb
|
88
|
uint8_t BSP_SD_DeInit(void);
|
|
Jerome Coutant
0:146cf26a9bbb
|
89
|
uint8_t BSP_SD_ITConfig(void);
|
|
Jerome Coutant
0:146cf26a9bbb
|
90
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
91
|
uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout);
|
|
Jerome Coutant
0:146cf26a9bbb
|
92
|
uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout);
|
|
Jerome Coutant
0:146cf26a9bbb
|
93
|
uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks);
|
|
Jerome Coutant
0:146cf26a9bbb
|
94
|
uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks);
|
|
Jerome Coutant
0:146cf26a9bbb
|
95
|
uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr);
|
|
Jerome Coutant
0:146cf26a9bbb
|
96
|
uint8_t BSP_SD_GetCardState(void);
|
|
Jerome Coutant
0:146cf26a9bbb
|
97
|
void BSP_SD_GetCardInfo(BSP_SD_CardInfo *CardInfo);
|
|
Jerome Coutant
0:146cf26a9bbb
|
98
|
uint8_t BSP_SD_IsDetected(void);
|
|
Jerome Coutant
0:146cf26a9bbb
|
99
|
void BSP_SD_IRQHandler(void);
|
|
Jerome Coutant
0:146cf26a9bbb
|
100
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
101
|
/* These functions can be modified in case the current settings (e.g. DMA stream)
|
|
Jerome Coutant
0:146cf26a9bbb
|
102
|
need to be changed for specific application needs */
|
|
Jerome Coutant
0:146cf26a9bbb
|
103
|
void BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params);
|
|
Jerome Coutant
0:146cf26a9bbb
|
104
|
void BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params);
|
|
Jerome Coutant
0:146cf26a9bbb
|
105
|
void BSP_SD_AbortCallback(void);
|
|
Jerome Coutant
0:146cf26a9bbb
|
106
|
void BSP_SD_WriteCpltCallback(void);
|
|
Jerome Coutant
0:146cf26a9bbb
|
107
|
void BSP_SD_ReadCpltCallback(void);
|
|
Jerome Coutant
0:146cf26a9bbb
|
108
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
109
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
110
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
111
|
* @}
|
|
Jerome Coutant
0:146cf26a9bbb
|
112
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
113
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
114
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
115
|
* @}
|
|
Jerome Coutant
0:146cf26a9bbb
|
116
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
117
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
118
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
119
|
* @}
|
|
Jerome Coutant
0:146cf26a9bbb
|
120
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
121
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
122
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
123
|
* @}
|
|
Jerome Coutant
0:146cf26a9bbb
|
124
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
125
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
126
|
#ifdef __cplusplus
|
|
Jerome Coutant
0:146cf26a9bbb
|
127
|
}
|
|
Jerome Coutant
0:146cf26a9bbb
|
128
|
#endif
|
|
Jerome Coutant
0:146cf26a9bbb
|
129
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
130
|
#endif /* __STM32H747I_DISCOVERY_SD_H */
|
|
Jerome Coutant
0:146cf26a9bbb
|
131
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
132
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|