@@ -108,11 +108,7 @@ static DSTATUS SD_CheckStatus(BYTE lun)
108
108
(void )lun ;
109
109
Stat = STA_NOINIT ;
110
110
111
- #ifndef STM32L1xx
112
111
if (BSP_SD_GetCardState () == MSD_OK )
113
- #else /* STM32L1xx */
114
- if (BSP_SD_GetStatus () == MSD_OK )
115
- #endif
116
112
{
117
113
Stat &= ~STA_NOINIT ;
118
114
}
@@ -129,7 +125,6 @@ DSTATUS SD_initialize(BYTE lun)
129
125
{
130
126
Stat = STA_NOINIT ;
131
127
#if !defined(DISABLE_SD_INIT )
132
-
133
128
if (BSP_SD_Init () == MSD_OK )
134
129
{
135
130
Stat = SD_CheckStatus (lun );
@@ -162,7 +157,6 @@ DSTATUS SD_status(BYTE lun)
162
157
DRESULT SD_read (BYTE lun , BYTE * buff , DWORD sector , UINT count )
163
158
{
164
159
(void )lun ;
165
- #ifndef STM32L1xx
166
160
DRESULT res = RES_ERROR ;
167
161
168
162
if (BSP_SD_ReadBlocks ((uint32_t * )buff ,
@@ -175,17 +169,6 @@ DRESULT SD_read(BYTE lun, BYTE *buff, DWORD sector, UINT count)
175
169
}
176
170
res = RES_OK ;
177
171
}
178
- #else /* STM32L1xx */
179
- DRESULT res = RES_OK ;
180
-
181
- if (BSP_SD_ReadBlocks ((uint32_t * )buff ,
182
- (uint64_t ) (sector * SD_DEFAULT_BLOCK_SIZE ),
183
- SD_DEFAULT_BLOCK_SIZE ,
184
- count ) != MSD_OK )
185
- {
186
- res = RES_ERROR ;
187
- }
188
- #endif
189
172
return res ;
190
173
}
191
174
@@ -201,7 +184,6 @@ DRESULT SD_read(BYTE lun, BYTE *buff, DWORD sector, UINT count)
201
184
DRESULT SD_write (BYTE lun , const BYTE * buff , DWORD sector , UINT count )
202
185
{
203
186
(void )lun ;
204
- #ifndef STM32L1xx
205
187
DRESULT res = RES_ERROR ;
206
188
207
189
if (BSP_SD_WriteBlocks ((uint32_t * )buff ,
@@ -214,16 +196,6 @@ DRESULT SD_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count)
214
196
}
215
197
res = RES_OK ;
216
198
}
217
- #else /* STM32L1xx */
218
- DRESULT res = RES_OK ;
219
-
220
- if (BSP_SD_WriteBlocks ((uint32_t * )buff ,
221
- (uint64_t )(sector * SD_DEFAULT_BLOCK_SIZE ),
222
- SD_DEFAULT_BLOCK_SIZE , count ) != MSD_OK )
223
- {
224
- res = RES_ERROR ;
225
- }
226
- #endif
227
199
return res ;
228
200
}
229
201
#endif /* _USE_WRITE == 1 */
@@ -240,11 +212,7 @@ DRESULT SD_ioctl(BYTE lun, BYTE cmd, void *buff)
240
212
{
241
213
(void )lun ;
242
214
DRESULT res = RES_ERROR ;
243
- #ifndef STM32L1xx
244
- BSP_SD_CardInfo CardInfo ;
245
- #else /* STM32L1xx */
246
215
SD_CardInfo CardInfo ;
247
- #endif
248
216
if (Stat & STA_NOINIT ) return RES_NOTRDY ;
249
217
250
218
switch (cmd )
@@ -257,33 +225,21 @@ DRESULT SD_ioctl(BYTE lun, BYTE cmd, void *buff)
257
225
/* Get number of sectors on the disk (DWORD) */
258
226
case GET_SECTOR_COUNT :
259
227
BSP_SD_GetCardInfo (& CardInfo );
260
- #ifndef STM32L1xx
261
228
* (DWORD * )buff = CardInfo .LogBlockNbr ;
262
- #else /* STM32L1xx */
263
- * (DWORD * )buff = CardInfo .CardCapacity / SD_DEFAULT_BLOCK_SIZE ;
264
- #endif
265
229
res = RES_OK ;
266
230
break ;
267
231
268
232
/* Get R/W sector size (WORD) */
269
233
case GET_SECTOR_SIZE :
270
- #ifndef STM32L1xx
271
234
BSP_SD_GetCardInfo (& CardInfo );
272
235
* (WORD * )buff = CardInfo .LogBlockSize ;
273
- #else /* STM32L1xx */
274
- * (WORD * )buff = SD_DEFAULT_BLOCK_SIZE ;
275
- #endif
276
236
res = RES_OK ;
277
237
break ;
278
238
279
239
/* Get erase block size in unit of sector (DWORD) */
280
240
case GET_BLOCK_SIZE :
281
- #ifndef STM32L1xx
282
241
BSP_SD_GetCardInfo (& CardInfo );
283
242
* (DWORD * )buff = CardInfo .LogBlockSize / SD_DEFAULT_BLOCK_SIZE ;
284
- #else /* STM32L1xx */
285
- * (DWORD * )buff = SD_DEFAULT_BLOCK_SIZE ;
286
- #endif
287
243
res = RES_OK ;
288
244
break ;
289
245
0 commit comments