@@ -116,13 +116,8 @@ static GPIO_TypeDef *SD_detect_gpio_port = GPIOA;
116
116
static uint32_t SD_trans_sel_ll_gpio_pin = LL_GPIO_PIN_ALL ;
117
117
static GPIO_TypeDef * SD_trans_sel_gpio_port = GPIOA ;
118
118
#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)
126
121
127
122
128
123
/**
@@ -165,19 +160,14 @@ uint8_t BSP_SD_Init(void)
165
160
BSP_SD_MspInit (& uSdHandle , NULL );
166
161
167
162
/* 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 ) {
174
164
sd_state = MSD_ERROR ;
175
165
}
176
166
177
167
/* Configure SD Bus width */
178
168
if (sd_state == MSD_OK ) {
179
169
/* 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 ) {
181
171
sd_state = MSD_ERROR ;
182
172
} else {
183
173
sd_state = MSD_OK ;
@@ -328,7 +318,6 @@ uint8_t BSP_SD_IsDetected(void)
328
318
return status ;
329
319
}
330
320
331
- #ifndef STM32L1xx
332
321
/**
333
322
* @brief Reads block(s) from a specified address in an SD card, in polling mode.
334
323
* @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
362
351
return MSD_OK ;
363
352
}
364
353
}
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 */
400
354
401
355
/**
402
356
* @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
406
360
*/
407
361
uint8_t BSP_SD_Erase (uint64_t StartAddr , uint64_t EndAddr )
408
362
{
409
- if (HAL_SD_Erase (& uSdHandle , StartAddr , EndAddr ) != SD_OK ) {
363
+ if (HAL_SD_Erase (& uSdHandle , StartAddr , EndAddr ) != HAL_OK ) {
410
364
return MSD_ERROR ;
411
365
} else {
412
366
return MSD_OK ;
@@ -532,7 +486,6 @@ __weak void BSP_SD_Transceiver_MspInit(SD_HandleTypeDef *hsd, void *Params)
532
486
}
533
487
#endif /* USE_SD_TRANSCEIVER && (USE_SD_TRANSCEIVER != 0U) */
534
488
535
- #ifndef STM32L1xx
536
489
/**
537
490
* @brief Gets the current SD card data status.
538
491
* @retval Data transfer state.
@@ -544,20 +497,6 @@ uint8_t BSP_SD_GetCardState(void)
544
497
{
545
498
return ((HAL_SD_GetCardState (& uSdHandle ) == HAL_SD_CARD_TRANSFER ) ? SD_TRANSFER_OK : SD_TRANSFER_BUSY );
546
499
}
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
561
500
562
501
/**
563
502
* @brief Get SD information about specific SD card.
@@ -566,7 +505,7 @@ HAL_SD_TransferStateTypedef BSP_SD_GetStatus(void)
566
505
void BSP_SD_GetCardInfo (HAL_SD_CardInfoTypeDef * CardInfo )
567
506
{
568
507
/* Get SD card Information */
569
- HAL_SD_Get_CardInfo (& uSdHandle , CardInfo );
508
+ HAL_SD_GetCardInfo (& uSdHandle , CardInfo );
570
509
}
571
510
572
511
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
0 commit comments