Skip to content

Instantly share code, notes, and snippets.

Created October 15, 2016 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/c5e98fb24701b0539b8192db694dc541 to your computer and use it in GitHub Desktop.
Save anonymous/c5e98fb24701b0539b8192db694dc541 to your computer and use it in GitHub Desktop.
diff --git a/firmware/target/arm/pp/ata-sd-pp.c b/firmware/target/arm/pp/ata-sd-pp.c
index 2a11b40..18fc4a1 100644
--- a/firmware/target/arm/pp/ata-sd-pp.c
+++ b/firmware/target/arm/pp/ata-sd-pp.c
@@ -35,6 +35,8 @@
#include "usb.h"
#include "sd.h"
#include "storage.h"
+#define LOGF_ENABLE
+#include "logf.h"
#define SECTOR_SIZE 512
#define BLOCKS_PER_BANK 0x7a7800
@@ -235,6 +237,7 @@ static int sd_command(unsigned int cmd, unsigned long arg1,
int i, words; /* Number of 16 bit words to read from MMC_RES */
unsigned int data[9];
+ logf("sd_command(%x,%x,%x)", cmd, arg1, cmddat);
MMC_CMD = cmd;
MMC_ARGH = (unsigned int)((arg1 & 0xffff0000) >> 16);
MMC_ARGL = (unsigned int)((arg1 & 0xffff));
@@ -244,8 +247,11 @@ static int sd_command(unsigned int cmd, unsigned long arg1,
return -EC_COMMAND;
if ((MMC_STAT & STAT_ERROR_BITS) != 0)
+ {
+ logf("err %x", MMC_STAT & STAT_ERROR_BITS);
/* Error sending command */
return -EC_COMMAND - (MMC_STAT & STAT_ERROR_BITS)*100;
+ }
if (cmd == SD_GO_IDLE_STATE)
return 0; /* no response here */
@@ -272,6 +278,7 @@ static int sd_command(unsigned int cmd, unsigned long arg1,
response[2] = (data[2]<<24) + (data[3]<<8) + (data[4]>>8);
response[1] = (data[4]<<24) + (data[5]<<8) + (data[6]>>8);
response[0] = (data[6]<<24) + (data[7]<<8) + (data[8]>>8);
+ logf("resp = %x %x %x %x", response[0], response[1], response[2], response[3]);
}
else
{
@@ -304,6 +311,7 @@ static int sd_command(unsigned int cmd, unsigned long arg1,
* [0] End Bit - '1'
*/
response[0] = (data[0]<<24) + (data[1]<<8) + (data[2]>>8);
+ logf("resp = %x", response[0]);
}
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment