Skip to content

Commit

Permalink
Merge pull request #1 from d0k3/master
Browse files Browse the repository at this point in the history
Fix SD writes without breaking SDless boot
  • Loading branch information
RShadowhand authored Jun 23, 2016
2 parents 3fcd257 + 97c8106 commit 3abfbfb
Show file tree
Hide file tree
Showing 5 changed files with 733 additions and 432 deletions.
11 changes: 6 additions & 5 deletions payload_stage2/source/fatfs/diskio.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,16 @@ DRESULT disk_read (
DRESULT disk_write (
__attribute__((unused))
BYTE pdrv, /* Physical drive nmuber to identify the drive */
__attribute__((unused))
const BYTE *buff, /* Data to be written */
__attribute__((unused))
const BYTE *buff, /* Data to be written */
DWORD sector, /* Sector address in LBA */
__attribute__((unused))
UINT count /* Number of sectors to write */
)
{
return RES_OK;
if (sdmmc_sdcard_writesectors(sector, count, (BYTE *)buff)) {
return RES_PARERR;
}

return RES_OK;
}
#endif

Expand Down
9 changes: 0 additions & 9 deletions payload_stage2/source/fatfs/sdmmc/delay.h

This file was deleted.

28 changes: 13 additions & 15 deletions payload_stage2/source/fatfs/sdmmc/delay.s
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
// Copyright 2014 Normmatt
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

.arm
.global ioDelay
.type ioDelay STT_FUNC
.global waitcycles
.type waitcycles STT_FUNC

@ioDelay ( u32 us )
ioDelay:
ldr r1, =0x18000000 @ VRAM
1:
@ Loop doing uncached reads from VRAM to make loop timing more reliable
ldr r2, [r1]
subs r0, #1
bgt 1b
bx lr
@waitcycles ( u32 us )
waitcycles:
PUSH {R0-R2,LR}
STR R0, [SP,#4]
waitcycles_loop:
LDR R3, [SP,#4]
SUBS R2, R3, #1
STR R2, [SP,#4]
CMP R3, #0
BNE waitcycles_loop
POP {R0-R2,PC}
Loading

0 comments on commit 3abfbfb

Please sign in to comment.