mirror of
https://github.com/wiiu-env/libfat.git
synced 2024-11-22 18:09:17 +01:00
Init aborts when it doesn't get a valid response to APP_CMD
This commit is contained in:
parent
7b4d9b8d0a
commit
fdf340791d
@ -83,17 +83,8 @@ static u32 _SCSD_relativeCardAddress = 0; // Preshifted Relative Card Address
|
|||||||
|
|
||||||
extern bool _SCSD_writeData_s (u8 *data, u16* crc);
|
extern bool _SCSD_writeData_s (u8 *data, u16* crc);
|
||||||
|
|
||||||
static bool _SCSD_unlock (void) {
|
static inline void _SCSD_unlock (void) {
|
||||||
//see if we can write to SCSD RAM
|
|
||||||
vu32 *ramPointer = (u32*)0x08000000;
|
|
||||||
_SC_changeMode (SC_MODE_RAM);
|
|
||||||
*ramPointer = 0x5555aaaa;
|
|
||||||
*ramPointer = ~*ramPointer;
|
|
||||||
if(*ramPointer != 0xaaaa5555) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_SC_changeMode (SC_MODE_MEDIA);
|
_SC_changeMode (SC_MODE_MEDIA);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _SCSD_sendCommand (u8 command, u32 argument) {
|
static bool _SCSD_sendCommand (u8 command, u32 argument) {
|
||||||
@ -273,9 +264,7 @@ static bool _SCSD_readData (void* buffer) {
|
|||||||
// Functions needed for the external interface
|
// Functions needed for the external interface
|
||||||
|
|
||||||
bool _SCSD_startUp (void) {
|
bool _SCSD_startUp (void) {
|
||||||
if (!_SCSD_unlock()) {
|
_SCSD_unlock();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return _SCSD_initCard();
|
return _SCSD_initCard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,9 @@
|
|||||||
2006-08-07 - Chishm
|
2006-08-07 - Chishm
|
||||||
* Moved the SD initialization to a common function
|
* Moved the SD initialization to a common function
|
||||||
* Increased timeouts for slower cards
|
* Increased timeouts for slower cards
|
||||||
|
|
||||||
|
2006-08-08 - Chishm
|
||||||
|
* Init aborts when it doesn't get a valid response to APP_CMD - speeds up detection when no card is inserted
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "io_sd_common.h"
|
#include "io_sd_common.h"
|
||||||
@ -146,6 +149,10 @@ bool _SD_InitCard (_SD_FN_CMD_6BYTE_RESPONSE cmd_6byte_response,
|
|||||||
|
|
||||||
for (i = 0; i < MAX_STARTUP_TRIES ; i++) {
|
for (i = 0; i < MAX_STARTUP_TRIES ; i++) {
|
||||||
cmd_6byte_response (responseBuffer, APP_CMD, 0);
|
cmd_6byte_response (responseBuffer, APP_CMD, 0);
|
||||||
|
// Check that the card gave the correct response
|
||||||
|
if (responseBuffer[0] != APP_CMD) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
cmd_6byte_response (responseBuffer, SD_APP_OP_COND, SD_OCR_VALUE) &&
|
cmd_6byte_response (responseBuffer, SD_APP_OP_COND, SD_OCR_VALUE) &&
|
||||||
((responseBuffer[1] & 0x80) != 0))
|
((responseBuffer[1] & 0x80) != 0))
|
||||||
|
Loading…
Reference in New Issue
Block a user