@@ -116,13 +116,8 @@ static GPIO_TypeDef *SD_detect_gpio_port = GPIOA;
116116 static uint32_t SD_trans_sel_ll_gpio_pin = LL_GPIO_PIN_ALL ;
117117 static GPIO_TypeDef * SD_trans_sel_gpio_port = GPIOA ;
118118#endif
119- #ifndef STM32L1xx
120- #define SD_OK HAL_OK
121- #define SD_TRANSFER_OK ((uint8_t)0x00)
122- #define SD_TRANSFER_BUSY ((uint8_t)0x01)
123- #else /* STM32L1xx */
124- static SD_CardInfo uSdCardInfo ;
125- #endif
119+ #define SD_TRANSFER_OK ((uint8_t)0x00)
120+ #define SD_TRANSFER_BUSY ((uint8_t)0x01)
126121
127122
128123/**
@@ -165,19 +160,14 @@ uint8_t BSP_SD_Init(void)
165160 BSP_SD_MspInit (& uSdHandle , NULL );
166161
167162 /* HAL SD initialization */
168- #ifndef STM32L1xx
169- if (HAL_SD_Init (& uSdHandle ) != SD_OK )
170- #else /* STM32L1xx */
171- if (HAL_SD_Init (& uSdHandle , & uSdCardInfo ) != SD_OK )
172- #endif
173- {
163+ if (HAL_SD_Init (& uSdHandle ) != HAL_OK ) {
174164 sd_state = MSD_ERROR ;
175165 }
176166
177167 /* Configure SD Bus width */
178168 if (sd_state == MSD_OK ) {
179169 /* Enable wide operation */
180- if (HAL_SD_WideBusOperation_Config (& uSdHandle , SD_BUS_WIDE ) != SD_OK ) {
170+ if (HAL_SD_ConfigWideBusOperation (& uSdHandle , SD_BUS_WIDE ) != HAL_OK ) {
181171 sd_state = MSD_ERROR ;
182172 } else {
183173 sd_state = MSD_OK ;
@@ -328,7 +318,6 @@ uint8_t BSP_SD_IsDetected(void)
328318 return status ;
329319}
330320
331- #ifndef STM32L1xx
332321/**
333322 * @brief Reads block(s) from a specified address in an SD card, in polling mode.
334323 * @param pData: Pointer to the buffer that will contain the data to transmit
@@ -362,41 +351,6 @@ uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBl
362351 return MSD_OK ;
363352 }
364353}
365- #else /* STM32L1xx */
366- /**
367- * @brief Reads block(s) from a specified address in an SD card, in polling mode.
368- * @param pData: Pointer to the buffer that will contain the data to transmit
369- * @param ReadAddr: Address from where data is to be read
370- * @param BlockSize: SD card data block size, that should be 512
371- * @param NumOfBlocks: Number of SD blocks to read
372- * @retval SD status
373- */
374- uint8_t BSP_SD_ReadBlocks (uint32_t * pData , uint64_t ReadAddr , uint32_t BlockSize , uint32_t NumOfBlocks )
375- {
376- if (HAL_SD_ReadBlocks (& uSdHandle , (uint8_t * )pData , ReadAddr , BlockSize , NumOfBlocks ) != SD_OK ) {
377- return MSD_ERROR ;
378- } else {
379- return MSD_OK ;
380- }
381- }
382-
383- /**
384- * @brief Writes block(s) to a specified address in an SD card, in polling mode.
385- * @param pData: Pointer to the buffer that will contain the data to transmit
386- * @param WriteAddr: Address from where data is to be written
387- * @param BlockSize: SD card data block size, that should be 512
388- * @param NumOfBlocks: Number of SD blocks to write
389- * @retval SD status
390- */
391- uint8_t BSP_SD_WriteBlocks (uint32_t * pData , uint64_t WriteAddr , uint32_t BlockSize , uint32_t NumOfBlocks )
392- {
393- if (HAL_SD_WriteBlocks (& uSdHandle , (uint8_t * )pData , WriteAddr , BlockSize , NumOfBlocks ) != SD_OK ) {
394- return MSD_ERROR ;
395- } else {
396- return MSD_OK ;
397- }
398- }
399- #endif /* !STM32L1xx */
400354
401355/**
402356 * @brief Erases the specified memory area of the given SD card.
@@ -406,7 +360,7 @@ uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint64_t WriteAddr, uint32_t BlockSi
406360 */
407361uint8_t BSP_SD_Erase (uint64_t StartAddr , uint64_t EndAddr )
408362{
409- if (HAL_SD_Erase (& uSdHandle , StartAddr , EndAddr ) != SD_OK ) {
363+ if (HAL_SD_Erase (& uSdHandle , StartAddr , EndAddr ) != HAL_OK ) {
410364 return MSD_ERROR ;
411365 } else {
412366 return MSD_OK ;
@@ -532,7 +486,6 @@ __weak void BSP_SD_Transceiver_MspInit(SD_HandleTypeDef *hsd, void *Params)
532486}
533487#endif /* USE_SD_TRANSCEIVER && (USE_SD_TRANSCEIVER != 0U) */
534488
535- #ifndef STM32L1xx
536489/**
537490 * @brief Gets the current SD card data status.
538491 * @retval Data transfer state.
@@ -544,20 +497,6 @@ uint8_t BSP_SD_GetCardState(void)
544497{
545498 return ((HAL_SD_GetCardState (& uSdHandle ) == HAL_SD_CARD_TRANSFER ) ? SD_TRANSFER_OK : SD_TRANSFER_BUSY );
546499}
547- #else /* STM32L1xx */
548- /**
549- * @brief Gets the current SD card data status.
550- * @retval Data transfer state.
551- * This value can be one of the following values:
552- * @arg SD_TRANSFER_OK: No data transfer is acting
553- * @arg SD_TRANSFER_BUSY: Data transfer is acting
554- * @arg SD_TRANSFER_ERROR: Data transfer error
555- */
556- HAL_SD_TransferStateTypedef BSP_SD_GetStatus (void )
557- {
558- return (HAL_SD_GetStatus (& uSdHandle ));
559- }
560- #endif
561500
562501/**
563502 * @brief Get SD information about specific SD card.
@@ -566,7 +505,7 @@ HAL_SD_TransferStateTypedef BSP_SD_GetStatus(void)
566505void BSP_SD_GetCardInfo (HAL_SD_CardInfoTypeDef * CardInfo )
567506{
568507 /* Get SD card Information */
569- HAL_SD_Get_CardInfo (& uSdHandle , CardInfo );
508+ HAL_SD_GetCardInfo (& uSdHandle , CardInfo );
570509}
571510
572511/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
0 commit comments