@@ -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
119
#define SD_TRANSFER_OK ((uint8_t)0x00)
122
120
#define SD_TRANSFER_BUSY ((uint8_t)0x01)
123
- #else /* STM32L1xx */
124
- static SD_CardInfo uSdCardInfo ;
125
- #endif
126
121
127
122
128
123
/**
@@ -165,19 +160,15 @@ 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
163
+ if (HAL_SD_Init (& uSdHandle ) != HAL_OK )
173
164
{
174
165
sd_state = MSD_ERROR ;
175
166
}
176
167
177
168
/* Configure SD Bus width */
178
169
if (sd_state == MSD_OK ) {
179
170
/* Enable wide operation */
180
- if (HAL_SD_WideBusOperation_Config (& uSdHandle , SD_BUS_WIDE ) != SD_OK ) {
171
+ if (HAL_SD_ConfigWideBusOperation (& uSdHandle , SD_BUS_WIDE ) != HAL_OK ) {
181
172
sd_state = MSD_ERROR ;
182
173
} else {
183
174
sd_state = MSD_OK ;
@@ -328,7 +319,6 @@ uint8_t BSP_SD_IsDetected(void)
328
319
return status ;
329
320
}
330
321
331
- #ifndef STM32L1xx
332
322
/**
333
323
* @brief Reads block(s) from a specified address in an SD card, in polling mode.
334
324
* @param pData: Pointer to the buffer that will contain the data to transmit
@@ -362,41 +352,6 @@ uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBl
362
352
return MSD_OK ;
363
353
}
364
354
}
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
355
401
356
/**
402
357
* @brief Erases the specified memory area of the given SD card.
@@ -406,7 +361,7 @@ uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint64_t WriteAddr, uint32_t BlockSi
406
361
*/
407
362
uint8_t BSP_SD_Erase (uint64_t StartAddr , uint64_t EndAddr )
408
363
{
409
- if (HAL_SD_Erase (& uSdHandle , StartAddr , EndAddr ) != SD_OK ) {
364
+ if (HAL_SD_Erase (& uSdHandle , StartAddr , EndAddr ) != HAL_OK ) {
410
365
return MSD_ERROR ;
411
366
} else {
412
367
return MSD_OK ;
@@ -532,7 +487,6 @@ __weak void BSP_SD_Transceiver_MspInit(SD_HandleTypeDef *hsd, void *Params)
532
487
}
533
488
#endif /* USE_SD_TRANSCEIVER && (USE_SD_TRANSCEIVER != 0U) */
534
489
535
- #ifndef STM32L1xx
536
490
/**
537
491
* @brief Gets the current SD card data status.
538
492
* @retval Data transfer state.
@@ -544,20 +498,6 @@ uint8_t BSP_SD_GetCardState(void)
544
498
{
545
499
return ((HAL_SD_GetCardState (& uSdHandle ) == HAL_SD_CARD_TRANSFER ) ? SD_TRANSFER_OK : SD_TRANSFER_BUSY );
546
500
}
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
501
562
502
/**
563
503
* @brief Get SD information about specific SD card.
@@ -566,7 +506,7 @@ HAL_SD_TransferStateTypedef BSP_SD_GetStatus(void)
566
506
void BSP_SD_GetCardInfo (HAL_SD_CardInfoTypeDef * CardInfo )
567
507
{
568
508
/* Get SD card Information */
569
- HAL_SD_Get_CardInfo (& uSdHandle , CardInfo );
509
+ HAL_SD_GetCardInfo (& uSdHandle , CardInfo );
570
510
}
571
511
572
512
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
0 commit comments