stm32f769i_discovery_sd.c
Go to the documentation of this file.
1 
37 /* File Info : -----------------------------------------------------------------
38  User NOTES
39 1. How To use this driver:
40 --------------------------
41  - This driver is used to drive the micro SD external card mounted on STM32F769I-Discovery
42  board.
43  - This driver does not need a specific component driver for the micro SD device
44  to be included with.
45 
46 2. Driver description:
47 ---------------------
48  + Initialization steps:
49  o Initialize the micro SD card using the BSP_SD_Init() function. This
50  function includes the MSP layer hardware resources initialization and the
51  SDIO interface configuration to interface with the external micro SD. It
52  also includes the micro SD initialization sequence.
53  o To check the SD card presence you can use the function BSP_SD_IsDetected() which
54  returns the detection status
55  o If SD presence detection interrupt mode is desired, you must configure the
56  SD detection interrupt mode by calling the function BSP_SD_ITConfig(). The interrupt
57  is generated as an external interrupt whenever the micro SD card is
58  plugged/unplugged in/from the discovery board.
59  o The function BSP_SD_GetCardInfo() is used to get the micro SD card information
60  which is stored in the structure "HAL_SD_CardInfoTypedef".
61 
62  + Micro SD card operations
63  o The micro SD card can be accessed with read/write block(s) operations once
64  it is reay for access. The access cand be performed whether using the polling
65  mode by calling the functions BSP_SD_ReadBlocks()/BSP_SD_WriteBlocks(), or by DMA
66  transfer using the functions BSP_SD_ReadBlocks_DMA()/BSP_SD_WriteBlocks_DMA()
67  o The DMA transfer complete is used with interrupt mode. Once the SD transfer
68  is complete, the SD interrupt is handeled using the function BSP_SD_IRQHandler(),
69  the DMA Tx/Rx transfer complete are handeled using the functions
70  BSP_SD_DMA_Tx_IRQHandler()/BSP_SD_DMA_Rx_IRQHandler(). The corresponding user callbacks
71  are implemented by the user at application level.
72  o The SD erase block(s) is performed using the function BSP_SD_Erase() with specifying
73  the number of blocks to erase.
74  o The SD runtime status is returned when calling the function BSP_SD_GetCardState().
75 
76 ------------------------------------------------------------------------------*/
77 
78 /* Dependencies
79 - stm32f7xx_hal_sd.c
80 - stm32f7xx_ll_sdmmc.c
81 - stm32f7xx_hal_dma.c
82 - stm32f7xx_hal_gpio.c
83 - stm32f7xx_hal_cortex.c
84 - stm32f7xx_hal_rcc_ex.h
85 EndDependencies */
86 
87 /* Includes ------------------------------------------------------------------*/
89 
127 SD_HandleTypeDef uSdHandle;
128 
148 uint8_t BSP_SD_Init(void)
149 {
150  uint8_t sd_state = MSD_OK;
151 
152  /* PLLSAI is dedicated to LCD periph. Do not use it to get 48MHz*/
153 
154  /* uSD device interface configuration */
155  uSdHandle.Instance = SDMMC2;
156  uSdHandle.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING;
157  uSdHandle.Init.ClockBypass = SDMMC_CLOCK_BYPASS_DISABLE;
158  uSdHandle.Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE;
159  uSdHandle.Init.BusWide = SDMMC_BUS_WIDE_1B;
160  uSdHandle.Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_DISABLE;
161  uSdHandle.Init.ClockDiv = SDMMC_TRANSFER_CLK_DIV;
162 
163  /* Msp SD Detect pin initialization */
165  if(BSP_SD_IsDetected() != SD_PRESENT) /* Check if SD card is present */
166  {
168  }
169 
170  /* Msp SD initialization */
172 
173  /* HAL SD initialization */
174  if(HAL_SD_Init(&uSdHandle) != HAL_OK)
175  {
176  sd_state = MSD_ERROR;
177  }
178 
179  /* Configure SD Bus width */
180  if(sd_state == MSD_OK)
181  {
182  /* Enable wide operation */
183  if(HAL_SD_ConfigWideBusOperation(&uSdHandle, SDMMC_BUS_WIDE_4B) != HAL_OK)
184  {
185  sd_state = MSD_ERROR;
186  }
187  else
188  {
189  sd_state = MSD_OK;
190  }
191  }
192  return sd_state;
193 }
194 
199 uint8_t BSP_SD_DeInit(void)
200 {
201  uint8_t sd_state = MSD_OK;
202 
203  uSdHandle.Instance = SDMMC2;
204 
205  /* HAL SD deinitialization */
206  if(HAL_SD_DeInit(&uSdHandle) != HAL_OK)
207  {
208  sd_state = MSD_ERROR;
209  }
210 
211  /* Msp SD deinitialization */
212  uSdHandle.Instance = SDMMC2;
214 
215  return sd_state;
216 }
217 
222 uint8_t BSP_SD_ITConfig(void)
223 {
224  GPIO_InitTypeDef gpio_init_structure;
225 
226  /* Configure Interrupt mode for SD detection pin */
227  gpio_init_structure.Pin = SD_DETECT_PIN;
228  gpio_init_structure.Pull = GPIO_PULLUP;
229  gpio_init_structure.Speed = GPIO_SPEED_FAST;
230  gpio_init_structure.Mode = GPIO_MODE_IT_RISING_FALLING;
231  HAL_GPIO_Init(SD_DETECT_GPIO_PORT, &gpio_init_structure);
232 
233  /* Enable and set SD detect EXTI Interrupt to the lowest priority */
236 
237  return MSD_OK;
238 }
239 
244 uint8_t BSP_SD_IsDetected(void)
245 {
246  __IO uint8_t status = SD_PRESENT;
247 
248  /* Check SD card detect pin */
250  {
251  status = SD_NOT_PRESENT;
252  }
253 
254  return status;
255 }
256 
265 uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout)
266 {
267  if(HAL_SD_ReadBlocks(&uSdHandle, (uint8_t *)pData, ReadAddr, NumOfBlocks, Timeout) != HAL_OK)
268  {
269  return MSD_ERROR;
270  }
271  else
272  {
273  return MSD_OK;
274  }
275 }
276 
285 uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout)
286 {
287  if(HAL_SD_WriteBlocks(&uSdHandle, (uint8_t *)pData, WriteAddr, NumOfBlocks, Timeout) != HAL_OK)
288  {
289  return MSD_ERROR;
290  }
291  else
292  {
293  return MSD_OK;
294  }
295 }
296 
304 uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks)
305 {
306  /* Read block(s) in DMA transfer mode */
307  if(HAL_SD_ReadBlocks_DMA(&uSdHandle, (uint8_t *)pData, ReadAddr, NumOfBlocks) != HAL_OK)
308  {
309  return MSD_ERROR;
310  }
311  else
312  {
313  return MSD_OK;
314  }
315 }
316 
324 uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks)
325 {
326  /* Write block(s) in DMA transfer mode */
327  if(HAL_SD_WriteBlocks_DMA(&uSdHandle, (uint8_t *)pData, WriteAddr, NumOfBlocks) != HAL_OK)
328  {
329  return MSD_ERROR;
330  }
331  else
332  {
333  return MSD_OK;
334  }
335 }
336 
343 uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr)
344 {
345  if(HAL_SD_Erase(&uSdHandle, StartAddr, EndAddr) != HAL_OK)
346  {
347  return MSD_ERROR;
348  }
349  else
350  {
351  return MSD_OK;
352  }
353 }
354 
360 __weak void BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params)
361 {
362  static DMA_HandleTypeDef dma_rx_handle;
363  static DMA_HandleTypeDef dma_tx_handle;
364  GPIO_InitTypeDef gpio_init_structure;
365 
366  /* Enable SDMMC2 clock */
368 
369  /* Enable DMA2 clocks */
371 
372  /* Enable GPIOs clock */
376 
377  /* Common GPIO configuration */
378  gpio_init_structure.Mode = GPIO_MODE_AF_PP;
379  gpio_init_structure.Pull = GPIO_PULLUP;
380  gpio_init_structure.Speed = GPIO_SPEED_HIGH;
381 
382  /* GPIOB configuration */
383  gpio_init_structure.Alternate = GPIO_AF10_SDMMC2;
384  gpio_init_structure.Pin = GPIO_PIN_3 | GPIO_PIN_4;
385  HAL_GPIO_Init(GPIOB, &gpio_init_structure);
386 
387  /* GPIOD configuration */
388  gpio_init_structure.Alternate = GPIO_AF11_SDMMC2;
389  gpio_init_structure.Pin = GPIO_PIN_6 | GPIO_PIN_7;
390  HAL_GPIO_Init(GPIOD, &gpio_init_structure);
391 
392  /* GPIOG configuration */
393  gpio_init_structure.Pin = GPIO_PIN_9 | GPIO_PIN_10;
394  HAL_GPIO_Init(GPIOG, &gpio_init_structure);
395 
396  /* NVIC configuration for SDMMC2 interrupts */
399 
400  /* Configure DMA Rx parameters */
401  dma_rx_handle.Init.Channel = SD_DMAx_Rx_CHANNEL;
402  dma_rx_handle.Init.Direction = DMA_PERIPH_TO_MEMORY;
403  dma_rx_handle.Init.PeriphInc = DMA_PINC_DISABLE;
404  dma_rx_handle.Init.MemInc = DMA_MINC_ENABLE;
406  dma_rx_handle.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
407  dma_rx_handle.Init.Mode = DMA_PFCTRL;
408  dma_rx_handle.Init.Priority = DMA_PRIORITY_VERY_HIGH;
409  dma_rx_handle.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
411  dma_rx_handle.Init.MemBurst = DMA_MBURST_INC4;
412  dma_rx_handle.Init.PeriphBurst = DMA_PBURST_INC4;
413 
414  dma_rx_handle.Instance = SD_DMAx_Rx_STREAM;
415 
416  /* Associate the DMA handle */
417  __HAL_LINKDMA(hsd, hdmarx, dma_rx_handle);
418 
419  /* Deinitialize the stream for new transfer */
420  HAL_DMA_DeInit(&dma_rx_handle);
421 
422  /* Configure the DMA stream */
423  HAL_DMA_Init(&dma_rx_handle);
424 
425  /* Configure DMA Tx parameters */
426  dma_tx_handle.Init.Channel = SD_DMAx_Tx_CHANNEL;
427  dma_tx_handle.Init.Direction = DMA_MEMORY_TO_PERIPH;
428  dma_tx_handle.Init.PeriphInc = DMA_PINC_DISABLE;
429  dma_tx_handle.Init.MemInc = DMA_MINC_ENABLE;
431  dma_tx_handle.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
432  dma_tx_handle.Init.Mode = DMA_PFCTRL;
433  dma_tx_handle.Init.Priority = DMA_PRIORITY_VERY_HIGH;
434  dma_tx_handle.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
436  dma_tx_handle.Init.MemBurst = DMA_MBURST_INC4;
437  dma_tx_handle.Init.PeriphBurst = DMA_PBURST_INC4;
438 
439  dma_tx_handle.Instance = SD_DMAx_Tx_STREAM;
440 
441  /* Associate the DMA handle */
442  __HAL_LINKDMA(hsd, hdmatx, dma_tx_handle);
443 
444  /* Deinitialize the stream for new transfer */
445  HAL_DMA_DeInit(&dma_tx_handle);
446 
447  /* Configure the DMA stream */
448  HAL_DMA_Init(&dma_tx_handle);
449 
450  /* NVIC configuration for DMA transfer complete interrupt */
453 
454  /* NVIC configuration for DMA transfer complete interrupt */
457 }
458 
465 __weak void BSP_SD_Detect_MspInit(SD_HandleTypeDef *hsd, void *Params)
466 {
467  GPIO_InitTypeDef gpio_init_structure;
468 
470 
471  /* GPIO configuration in input for uSD_Detect signal */
472  gpio_init_structure.Pin = SD_DETECT_PIN;
473  gpio_init_structure.Mode = GPIO_MODE_INPUT;
474  gpio_init_structure.Pull = GPIO_PULLUP;
475  gpio_init_structure.Speed = GPIO_SPEED_HIGH;
476  HAL_GPIO_Init(SD_DETECT_GPIO_PORT, &gpio_init_structure);
477 }
478 
484 __weak void BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params)
485 {
486  static DMA_HandleTypeDef dma_rx_handle;
487  static DMA_HandleTypeDef dma_tx_handle;
488 
489  /* Disable NVIC for DMA transfer complete interrupts */
492 
493  /* Deinitialize the stream for new transfer */
494  dma_rx_handle.Instance = SD_DMAx_Rx_STREAM;
495  HAL_DMA_DeInit(&dma_rx_handle);
496 
497  /* Deinitialize the stream for new transfer */
498  dma_tx_handle.Instance = SD_DMAx_Tx_STREAM;
499  HAL_DMA_DeInit(&dma_tx_handle);
500 
501  /* Disable NVIC for SDIO interrupts */
503 
504  /* DeInit GPIO pins can be done in the application
505  (by surcharging this __weak function) */
506 
507  /* Disable SDIO clock */
508  __HAL_RCC_SDIO_CLK_DISABLE();
509 
510  /* GPOI pins clock and DMA cloks can be shut down in the applic
511  by surcgarging this __weak function */
512 }
513 
521 uint8_t BSP_SD_GetCardState(void)
522 {
523  return((HAL_SD_GetCardState(&uSdHandle) == HAL_SD_CARD_TRANSFER ) ? SD_TRANSFER_OK : SD_TRANSFER_BUSY);
524 }
525 
526 
532 void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo)
533 {
534  /* Get SD card Information */
535  HAL_SD_GetCardInfo(&uSdHandle, CardInfo);
536 }
537 
543 void HAL_SD_AbortCallback(SD_HandleTypeDef *hsd)
544 {
546 }
547 
553 void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)
554 {
556 }
557 
563 void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd)
564 {
566 }
567 
572 __weak void BSP_SD_AbortCallback(void)
573 {
574 
575 }
576 
581 __weak void BSP_SD_WriteCpltCallback(void)
582 {
583 
584 }
585 
590 __weak void BSP_SD_ReadCpltCallback(void)
591 {
592 
593 }
594 
611 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
DMA_InitTypeDef::Channel
uint32_t Channel
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:51
SD_DETECT_EXTI_IRQn
#define SD_DETECT_EXTI_IRQn
Definition: stm32469i_discovery.h:214
__HAL_LINKDMA
#define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:66
__IO
#define __IO
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:237
GPIO_MODE_AF_PP
#define GPIO_MODE_AF_PP
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:122
SDIO_IRQn
@ SDIO_IRQn
Definition: stm32f407xx.h:127
DMA_PINC_DISABLE
#define DMA_PINC_DISABLE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:240
HAL_NVIC_EnableIRQ
void HAL_NVIC_EnableIRQ(IRQn_Type IRQn)
BSP_SD_AbortCallback
__weak void BSP_SD_AbortCallback(void)
BSP SD Abort callbacks.
Definition: stm32f769i_discovery_sd.c:572
BSP_SD_Init
uint8_t BSP_SD_Init(void)
Initializes the SD card device.
Definition: stm32f769i_discovery_sd.c:148
__DMA_HandleTypeDef
DMA handle Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:139
NULL
#define NULL
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:92
MSD_ERROR
#define MSD_ERROR
Definition: stm32f769i_discovery_sd.h:76
GPIO_InitTypeDef
GPIO Init structure definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:47
DMA_PDATAALIGN_WORD
#define DMA_PDATAALIGN_WORD
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:261
DMA_InitTypeDef::Priority
uint32_t Priority
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:75
DMA_InitTypeDef::PeriphInc
uint32_t PeriphInc
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:58
BSP_SD_ReadCpltCallback
__weak void BSP_SD_ReadCpltCallback(void)
BSP Rx Transfer completed callbacks.
Definition: stm32f769i_discovery_sd.c:590
__DMAx_TxRx_CLK_ENABLE
#define __DMAx_TxRx_CLK_ENABLE
Definition: stm32f769i_discovery_sd.h:94
DMA_MBURST_INC4
#define DMA_MBURST_INC4
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:327
GPIO_InitTypeDef::Alternate
uint32_t Alternate
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:61
HAL_NVIC_DisableIRQ
void HAL_NVIC_DisableIRQ(IRQn_Type IRQn)
SD_TRANSFER_OK
#define SD_TRANSFER_OK
SD transfer state definition
Definition: stm32f769i_discovery_sd.h:82
GPIO_PIN_SET
@ GPIO_PIN_SET
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:71
GPIO_PIN_10
#define GPIO_PIN_10
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:96
DMA_PFCTRL
#define DMA_PFCTRL
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:283
__DMA_HandleTypeDef::Init
DMA_InitTypeDef Init
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:143
BSP_SD_ReadBlocks
uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout)
Reads block(s) from a specified address in an SD card, in polling mode.
Definition: stm32f769i_discovery_sd.c:265
SD_NOT_PRESENT
#define SD_NOT_PRESENT
Definition: stm32f769i_discovery_sd.h:89
BSP_SD_GetCardState
uint8_t BSP_SD_GetCardState(void)
Gets the current SD card data status.
Definition: stm32f769i_discovery_sd.c:521
DMA_InitTypeDef::FIFOThreshold
uint32_t FIFOThreshold
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:83
DMA_InitTypeDef::PeriphDataAlignment
uint32_t PeriphDataAlignment
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:64
__HAL_RCC_GPIOB_CLK_ENABLE
#define __HAL_RCC_GPIOB_CLK_ENABLE()
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h:393
BSP_SD_DeInit
uint8_t BSP_SD_DeInit(void)
DeInitializes the SD card device.
Definition: stm32f769i_discovery_sd.c:199
__HAL_RCC_SDMMC2_CLK_ENABLE
#define __HAL_RCC_SDMMC2_CLK_ENABLE()
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_rcc.h:1199
HAL_GPIO_ReadPin
GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
__HAL_RCC_GPIOD_CLK_ENABLE
#define __HAL_RCC_GPIOD_CLK_ENABLE()
Definition: stm32f7xx_hal_rcc_ex.h:653
HAL_OK
@ HAL_OK
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:42
BSP_SD_MspDeInit
__weak void BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params)
DeInitializes the SD MSP.
Definition: stm32f769i_discovery_sd.c:484
DMA_PERIPH_TO_MEMORY
#define DMA_PERIPH_TO_MEMORY
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:228
HAL_GPIO_Init
void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init)
GPIO_InitTypeDef::Mode
uint32_t Mode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:52
DMA_InitTypeDef::MemInc
uint32_t MemInc
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:61
SD_DMAx_Tx_STREAM
#define SD_DMAx_Tx_STREAM
Definition: stm32f769i_discovery_sd.h:97
SDMMC2
#define SDMMC2
Definition: stm32f769xx.h:1661
GPIO_InitTypeDef::Pull
uint32_t Pull
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:55
GPIO_PIN_6
#define GPIO_PIN_6
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:92
GPIO_PIN_9
#define GPIO_PIN_9
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:95
GPIO_MODE_IT_RISING_FALLING
#define GPIO_MODE_IT_RISING_FALLING
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:129
DMA_InitTypeDef::PeriphBurst
uint32_t PeriphBurst
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:92
__UART_HandleTypeDef::hdmatx
DMA_HandleTypeDef * hdmatx
Definition: stm32f4xx_hal_uart.h:159
SD_DMAx_Rx_IRQn
#define SD_DMAx_Rx_IRQn
Definition: stm32f769i_discovery_sd.h:100
SD_DMAx_Tx_CHANNEL
#define SD_DMAx_Tx_CHANNEL
Definition: stm32f769i_discovery_sd.h:95
__DMA_HandleTypeDef::Instance
DMA_Stream_TypeDef * Instance
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:141
BSP_SD_WriteBlocks_DMA
uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks)
Writes block(s) to a specified address in an SD card, in DMA mode.
Definition: stm32f769i_discovery_sd.c:324
DMA_InitTypeDef::MemDataAlignment
uint32_t MemDataAlignment
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:67
IRQn_Type
IRQn_Type
STM32F4XX Interrupt Number Definition, according to the selected device in Library_configuration_sect...
Definition: stm32f407xx.h:66
GPIO_InitTypeDef::Speed
uint32_t Speed
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:58
BSP_SD_WriteCpltCallback
__weak void BSP_SD_WriteCpltCallback(void)
BSP Tx Transfer completed callbacks.
Definition: stm32f769i_discovery_sd.c:581
HAL_SD_AbortCallback
void HAL_SD_AbortCallback(SD_HandleTypeDef *hsd)
SD Abort callbacks.
Definition: stm32f769i_discovery_sd.c:543
GPIO_PULLUP
#define GPIO_PULLUP
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:155
MSD_OK
#define MSD_OK
SD status structure definition.
Definition: stm32f769i_discovery_sd.h:75
SD_DETECT_GPIO_CLK_ENABLE
#define SD_DETECT_GPIO_CLK_ENABLE()
Definition: stm32469i_discovery.h:212
SD_DETECT_GPIO_PORT
#define SD_DETECT_GPIO_PORT
Definition: stm32469i_discovery.h:211
GPIOB
#define GPIOB
Definition: stm32f407xx.h:1104
DMA_MINC_ENABLE
#define DMA_MINC_ENABLE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:249
__UART_HandleTypeDef::hdmarx
DMA_HandleTypeDef * hdmarx
Definition: stm32f4xx_hal_uart.h:161
BSP_SD_Detect_MspInit
__weak void BSP_SD_Detect_MspInit(SD_HandleTypeDef *hsd, void *Params)
Initializes the SD Detect pin MSP.
Definition: stm32f769i_discovery_sd.c:465
DMA_InitTypeDef::MemBurst
uint32_t MemBurst
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:86
DMA_FIFOMODE_ENABLE
#define DMA_FIFOMODE_ENABLE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:305
DMA_InitTypeDef::FIFOMode
uint32_t FIFOMode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:78
SDMMC2_IRQn
@ SDMMC2_IRQn
Definition: stm32f769xx.h:163
DMA_MEMORY_TO_PERIPH
#define DMA_MEMORY_TO_PERIPH
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:229
HAL_DMA_Init
HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *hdma)
uSdHandle
SD_HandleTypeDef uSdHandle
Definition: stm32f769i_discovery_sd.c:127
__HAL_RCC_GPIOG_CLK_ENABLE
#define __HAL_RCC_GPIOG_CLK_ENABLE()
Definition: stm32f7xx_hal_rcc_ex.h:677
DMA_InitTypeDef::Direction
uint32_t Direction
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:54
HAL_DMA_DeInit
HAL_StatusTypeDef HAL_DMA_DeInit(DMA_HandleTypeDef *hdma)
MSD_ERROR_SD_NOT_PRESENT
#define MSD_ERROR_SD_NOT_PRESENT
Definition: stm32f769i_discovery_sd.h:77
DMA_PBURST_INC4
#define DMA_PBURST_INC4
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:339
GPIOG
#define GPIOG
Definition: stm32f407xx.h:1109
DMA_PRIORITY_VERY_HIGH
#define DMA_PRIORITY_VERY_HIGH
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:295
HAL_NVIC_SetPriority
void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
GPIO_AF11_SDMMC2
#define GPIO_AF11_SDMMC2
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_gpio_ex.h:276
stm32f769i_discovery_sd.h
This file contains the common defines and functions prototypes for the stm32f769i_discovery_sd....
GPIOD
#define GPIOD
Definition: stm32f407xx.h:1106
DMA_InitTypeDef::Mode
uint32_t Mode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:70
SD_DMAx_Tx_IRQn
#define SD_DMAx_Tx_IRQn
Definition: stm32f769i_discovery_sd.h:99
BSP_SD_WriteBlocks
uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout)
Writes block(s) to a specified address in an SD card, in polling mode.
Definition: stm32f769i_discovery_sd.c:285
GPIO_PIN_7
#define GPIO_PIN_7
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:93
BSP_SD_Erase
uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr)
Erases the specified memory area of the given SD card.
Definition: stm32f769i_discovery_sd.c:343
GPIO_PIN_4
#define GPIO_PIN_4
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:90
SD_TRANSFER_BUSY
#define SD_TRANSFER_BUSY
Definition: stm32f769i_discovery_sd.h:83
SD_DETECT_PIN
#define SD_DETECT_PIN
SD-detect signal.
Definition: stm32469i_discovery.h:210
DMA_FIFO_THRESHOLD_FULL
#define DMA_FIFO_THRESHOLD_FULL
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:317
BSP_SD_IsDetected
uint8_t BSP_SD_IsDetected(void)
Detects if SD card is correctly plugged in the memory slot or not.
Definition: stm32f769i_discovery_sd.c:244
SD_DMAx_Rx_STREAM
#define SD_DMAx_Rx_STREAM
Definition: stm32f769i_discovery_sd.h:98
GPIO_PIN_3
#define GPIO_PIN_3
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:89
BSP_SD_GetCardInfo
void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo)
Get SD information about specific SD card.
Definition: stm32f769i_discovery_sd.c:532
GPIO_MODE_INPUT
#define GPIO_MODE_INPUT
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:119
SD_DMAx_Rx_CHANNEL
#define SD_DMAx_Rx_CHANNEL
Definition: stm32f769i_discovery_sd.h:96
SD_PRESENT
#define SD_PRESENT
Definition: stm32f769i_discovery_sd.h:88
BSP_SD_ITConfig
uint8_t BSP_SD_ITConfig(void)
Configures Interrupt mode for SD detection pin.
Definition: stm32f769i_discovery_sd.c:222
BSP_SD_ReadBlocks_DMA
uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks)
Reads block(s) from a specified address in an SD card, in DMA mode.
Definition: stm32f769i_discovery_sd.c:304
HAL_SD_TxCpltCallback
void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)
Tx Transfer completed callbacks.
Definition: stm32f769i_discovery_sd.c:553
DMA_MDATAALIGN_WORD
#define DMA_MDATAALIGN_WORD
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:272
GPIO_AF10_SDMMC2
#define GPIO_AF10_SDMMC2
AF 10 selection.
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_gpio_ex.h:244
HAL_SD_RxCpltCallback
void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd)
Rx Transfer completed callbacks.
Definition: stm32f769i_discovery_sd.c:563
GPIO_InitTypeDef::Pin
uint32_t Pin
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:49
BSP_SD_MspInit
__weak void BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params)
Initializes the SD MSP.
Definition: stm32f769i_discovery_sd.c:360


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:53