[an error occurred while processing this directive]
|
//
unsigned char mmc_write_block(unsigned long address)
{
unsigned long i = 0;
unsigned char rvalue = MMC_SUCCESS;mmc_send_cmd(24, address * 512, 0xFF);
mmc_spi_write_read_byte(0xff);
// send the data token to signify the start of the data
mmc_spi_write_read_byte(0xfe);
// clock the actual data transfer and transmitt the bytes
for(i = 0; i < 512; i++)
mmc_spi_write_read_byte(mmc_buffer[i]); // mmc_buffer[i];
// put CRC bytes (not really needed by us, but required by MMC)
mmc_spi_write_read_byte(0xff);
mmc_spi_write_read_byte(0xff);
while(mmc_spi_write_read_byte(0xff) != 0xFF);
mmc_spi_write_read_byte(0xff);
return rvalue;
}