Skip to content

Commit f95c2c1

Browse files
committed
fix: STM32L1xx support
Signed-off-by: Frederic Pillon <[email protected]>
1 parent 9a06a9c commit f95c2c1

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

src/drivers/sd_diskio.c

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,7 @@ static DSTATUS SD_CheckStatus(BYTE lun)
108108
(void)lun;
109109
Stat = STA_NOINIT;
110110

111-
#ifndef STM32L1xx
112111
if(BSP_SD_GetCardState() == MSD_OK)
113-
#else /* STM32L1xx */
114-
if(BSP_SD_GetStatus() == MSD_OK)
115-
#endif
116112
{
117113
Stat &= ~STA_NOINIT;
118114
}
@@ -129,7 +125,6 @@ DSTATUS SD_initialize(BYTE lun)
129125
{
130126
Stat = STA_NOINIT;
131127
#if !defined(DISABLE_SD_INIT)
132-
133128
if(BSP_SD_Init() == MSD_OK)
134129
{
135130
Stat = SD_CheckStatus(lun);
@@ -162,7 +157,6 @@ DSTATUS SD_status(BYTE lun)
162157
DRESULT SD_read(BYTE lun, BYTE *buff, DWORD sector, UINT count)
163158
{
164159
(void)lun;
165-
#ifndef STM32L1xx
166160
DRESULT res = RES_ERROR;
167161

168162
if(BSP_SD_ReadBlocks((uint32_t*)buff,
@@ -175,17 +169,6 @@ DRESULT SD_read(BYTE lun, BYTE *buff, DWORD sector, UINT count)
175169
}
176170
res = RES_OK;
177171
}
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
189172
return res;
190173
}
191174

@@ -201,7 +184,6 @@ DRESULT SD_read(BYTE lun, BYTE *buff, DWORD sector, UINT count)
201184
DRESULT SD_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count)
202185
{
203186
(void)lun;
204-
#ifndef STM32L1xx
205187
DRESULT res = RES_ERROR;
206188

207189
if(BSP_SD_WriteBlocks((uint32_t*)buff,
@@ -214,16 +196,6 @@ DRESULT SD_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count)
214196
}
215197
res = RES_OK;
216198
}
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
227199
return res;
228200
}
229201
#endif /* _USE_WRITE == 1 */
@@ -240,11 +212,7 @@ DRESULT SD_ioctl(BYTE lun, BYTE cmd, void *buff)
240212
{
241213
(void)lun;
242214
DRESULT res = RES_ERROR;
243-
#ifndef STM32L1xx
244-
BSP_SD_CardInfo CardInfo;
245-
#else /* STM32L1xx */
246215
SD_CardInfo CardInfo;
247-
#endif
248216
if (Stat & STA_NOINIT) return RES_NOTRDY;
249217

250218
switch (cmd)
@@ -257,33 +225,21 @@ DRESULT SD_ioctl(BYTE lun, BYTE cmd, void *buff)
257225
/* Get number of sectors on the disk (DWORD) */
258226
case GET_SECTOR_COUNT :
259227
BSP_SD_GetCardInfo(&CardInfo);
260-
#ifndef STM32L1xx
261228
*(DWORD*)buff = CardInfo.LogBlockNbr;
262-
#else /* STM32L1xx */
263-
*(DWORD*)buff = CardInfo.CardCapacity / SD_DEFAULT_BLOCK_SIZE;
264-
#endif
265229
res = RES_OK;
266230
break;
267231

268232
/* Get R/W sector size (WORD) */
269233
case GET_SECTOR_SIZE :
270-
#ifndef STM32L1xx
271234
BSP_SD_GetCardInfo(&CardInfo);
272235
*(WORD*)buff = CardInfo.LogBlockSize;
273-
#else /* STM32L1xx */
274-
*(WORD*)buff = SD_DEFAULT_BLOCK_SIZE;
275-
#endif
276236
res = RES_OK;
277237
break;
278238

279239
/* Get erase block size in unit of sector (DWORD) */
280240
case GET_BLOCK_SIZE :
281-
#ifndef STM32L1xx
282241
BSP_SD_GetCardInfo(&CardInfo);
283242
*(DWORD*)buff = CardInfo.LogBlockSize / SD_DEFAULT_BLOCK_SIZE;
284-
#else /* STM32L1xx */
285-
*(DWORD*)buff = SD_DEFAULT_BLOCK_SIZE;
286-
#endif
287243
res = RES_OK;
288244
break;
289245

0 commit comments

Comments
 (0)