Project

General

Profile

« Previous | Next » 

Revision 107

Added by markw about 11 years ago

Fixed alternative version of sd card access. Taken from petit fatfs. Supports > 1GB cards.

View differences:

mmc2.c
#include "pff.h"
#include "diskio.h"
//#include "printf.h"
/*-------------------------------------------------------------------------*/
/* Platform dependent macros and functions needed to be modified */
/*-------------------------------------------------------------------------*/
......
unsigned char mmc_sector_buffer[512];
extern u32 n_actual_mmc_sector;
/*--------------------------------------------------------------------------
Module Private Functions
......
BYTE CardType;
extern int debug_pos;
void disk_debug()
{
/* {
char buffer[512];
set_pause_6502(1);
freeze();
debug_pos = 0;
printf("Hello world 5");
debug_pos = 40;
printf("Di");
debug_pos = 80;
disk_initialize();
printf("Did:%02x",CardType);
debug_pos = 120;
n_actual_mmc_sector = -1;
printf(" PP");
disk_readp(&buffer[0],0,0,512);
printf(" DD");
hexdump_pure(&buffer[0],512);
wait_us(10000000);
restore();
}
*/
}
/*-----------------------------------------------------------------------*/
/* Send a command packet to the SDC/MMC */
/*-----------------------------------------------------------------------*/
......
BYTE rc;
UINT bc;
//printf("mr:%x",sector);
if (!(CardType & CT_BLOCK)) sector *= 512; /* Convert to byte address if needed */
if (send_cmd(CMD17, sector) == 0) { /* READ_SINGLE_BLOCK */
......
DESELECT();
spiTransferFF();
return 0;
}
......
DESELECT();
spiTransferFF();
}
return 0;
}

Also available in: Unified diff