Skip to content

Commit

Permalink
Misc diskio.c / start.s improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
d0k3 committed May 1, 2016
1 parent 3aada17 commit 6bd1cac
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
6 changes: 3 additions & 3 deletions source/abstraction/a9-start.s
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ _start:
mcr p15, 0, r5, c7, c10, 4 @ drain write buffer

@ Fixes mounting of SDMC
ldr r0, =0x10000020
mov r1, #0x340
str r1, [r0]
ldr r0, =0x10000020
mov r1, #0x340
str r1, [r0]

bl main

Expand Down
12 changes: 6 additions & 6 deletions source/abstraction/gw-start.s
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ _start:
mcr p15, 0, r5, c7, c10, 4 @ drain write buffer

@ Fixes mounting of SDMC
ldr r0, =0x10000020
mov r1, #0x340
str r1, [r0]
ldr sp,=0x22160000
ldr r3, =main
ldr r0, =0x10000020
mov r1, #0x340
str r1, [r0]

ldr sp, =0x22160000
ldr r3, =main
blx r3
.pool

Expand Down
15 changes: 7 additions & 8 deletions source/fatfs/diskio.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,17 @@ DSTATUS disk_initialize (
)
{
if (pdrv == 0) { // a mounted SD card is the preriquisite for everything else
if (!sdmmc_sdcard_init())
return RES_PARERR;
if (!sdmmc_sdcard_init()) return STA_NODISK;
} else if (pdrv < 4) {
nand_type_sys = CheckNandType(NAND_SYSNAND);
if (!nand_type_sys) return RES_PARERR;
if (!nand_type_sys) return STA_NODISK;
} else if (pdrv < 7) {
nand_type_emu = CheckNandType(NAND_EMUNAND);
if (!nand_type_emu) return RES_PARERR;
if (!nand_type_emu) return STA_NODISK;
} else if (pdrv < 10) {
if (!GetMountState()) return RES_PARERR;
if (!GetMountState()) return STA_NODISK;
nand_type_img = CheckNandType(NAND_IMGNAND);
if (!nand_type_img) return RES_PARERR;
if ((!nand_type_img) && (pdrv != 7)) return STA_NODISK;
}
return RES_OK;
}
Expand Down Expand Up @@ -246,13 +245,13 @@ DRESULT disk_ioctl (
if (type == TYPE_SDCARD) { // SD card
*((DWORD*) buff) = getMMCDevice(1)->total_size;
} else if (type == TYPE_IMAGE) { // FAT image
*((DWORD*) buff) = GetMountSize();
*((DWORD*) buff) = GetMountSize() / 0x200;
} else if (type != TYPE_NONE) { // NAND
*((DWORD*) buff) = get_subtype_desc(pdrv)->size;
}
return RES_OK;
case GET_BLOCK_SIZE:
*((DWORD*) buff) = 0x2000;
*((DWORD*) buff) = (type == TYPE_IMAGE) ? 0x1 : 0x2000;
return RES_OK;
case CTRL_SYNC:
if ((type == TYPE_IMAGE) || (type == TYPE_IMGNAND))
Expand Down

0 comments on commit 6bd1cac

Please sign in to comment.