reapplying mmc cmd changes

master
Nidan 14 years ago
parent 700c3e0bff
commit b9f1446f08

43
mmc.c

@ -122,11 +122,13 @@ unsigned char mmc_write_command (unsigned char *cmd)
//set MMC_Chip_Select to low (MMC/SD-Karte Aktiv)
MMC_Enable();
//sendet 6 Byte Commando
for (unsigned char a = 0;a<0x06;a++) //sendet 6 Byte Commando zur MMC/SD-Karte
//sendet 5 Byte Commando
for (unsigned char a = 0;a < 5; a++) //sendet 6 Byte Commando zur MMC/SD-Karte
{
mmc_write_byte(*cmd++);
}
//send 6th command byte / CRC
mmc_write_byte(0xFF);
//Wartet auf ein gültige Antwort von der MMC/SD-Karte
while (tmp == 0xff)
@ -157,11 +159,13 @@ unsigned char mmc_write_command_slow(unsigned char *cmd)
//set MMC_Chip_Select to low (MMC/SD-Karte Aktiv)
MMC_Enable();
//sendet 6 Byte Commando
for (unsigned char a = 0;a<0x06;a++) //sendet 6 Byte Commando zur MMC/SD-Karte
//sendet 5 Byte Commando
for (unsigned char a = 0; a < 5; a++) //sendet 6 Byte Commando zur MMC/SD-Karte
{
mmc_write_byte_slow(*cmd++);
}
//send 6th command byte / CRC
mmc_write_byte_slow(0xFF);
//Wartet auf ein gültige Antwort von der MMC/SD-Karte
while (tmp == 0xff)
@ -299,8 +303,9 @@ unsigned char mmc_write_sector (unsigned long addr,unsigned char *Buffer)
{
unsigned char tmp;
//Commando 24 zum schreiben eines Blocks auf die MMC/SD - Karte
unsigned char cmd[] = {0x58,0x00,0x00,0x00,0x00,0xFF};
unsigned char cmd[5];// = {0x58,0x00,0x00,0x00,0x00,0xFF};
cmd[0] = 0x58;
cmd[4] = 0;
/*Die Adressierung der MMC/SD-Karte wird in Bytes angegeben,
addr wird von Blocks zu Bytes umgerechnet danach werden
diese in das Commando eingefügt*/
@ -386,7 +391,9 @@ unsigned char mmc_read_sector (unsigned long addr,unsigned char *Buffer)
//############################################################################
{
//Commando 16 zum lesen eines Blocks von der MMC/SD - Karte
unsigned char cmd[] = {0x51,0x00,0x00,0x00,0x00,0xFF};
unsigned char cmd[5];// = {0x51,0x00,0x00,0x00,0x00,0xFF};
cmd[0] = 0x51;
cmd[4] = 0;
/*Die Adressierung der MMC/SD-Karte wird in Bytes angegeben,
addr wird von Blocks zu Bytes umgerechnet danach werden
@ -440,7 +447,9 @@ uint8_t mmc_read_part(unsigned long addr,unsigned char *Buffer, uint16_t count)
//############################################################################
{
//Commando 16 zum lesen eines Blocks von der MMC/SD - Karte
unsigned char cmd[] = {0x51,0x00,0x00,0x00,0x00,0xFF};
unsigned char cmd[5];// = {0x51,0x00,0x00,0x00,0x00,0xFF};
cmd[0] = 0x51;
cmd[4] = 0;
/*Die Adressierung der MMC/SD-Karte wird in Bytes angegeben,
addr wird von Blocks zu Bytes umgerechnet danach werden
@ -493,7 +502,9 @@ void mmc_read_to_ringbuffer(unsigned long addr, ringbuf_t *buffer)
//############################################################################
{
//Commando 16 zum lesen eines Blocks von der MMC/SD - Karte
unsigned char cmd[] = {0x51,0x00,0x00,0x00,0x00,0xFF};
unsigned char cmd[5];// = {0x51,0x00,0x00,0x00,0x00,0xFF};
cmd[0] = 0x51;
cmd[4] = 0;
/*Die Adressierung der MMC/SD-Karte wird in Bytes angegeben,
addr wird von Blocks zu Bytes umgerechnet danach werden
@ -514,7 +525,12 @@ unsigned char mmc_read_cid (unsigned char *Buffer)
//############################################################################
{
//Commando zum lesen des CID Registers
unsigned char cmd[] = {0x4A,0x00,0x00,0x00,0x00,0xFF};
unsigned char cmd[5];// = {0x4A,0x00,0x00,0x00,0x00,0xFF};
cmd[0] = 0x4a;
cmd[1] = 0;
cmd[2] = 0;
cmd[3] = 0;
cmd[4] = 0;
mmc_read_block(cmd,Buffer,16);
@ -527,7 +543,12 @@ unsigned char mmc_read_csd (unsigned char *Buffer)
//############################################################################
{
//Commando zum lesen des CSD Registers
unsigned char cmd[] = {0x49,0x00,0x00,0x00,0x00,0xFF};
unsigned char cmd[5];// = {0x49,0x00,0x00,0x00,0x00,0xFF};
cmd[0] = 0x49;
cmd[1] = 0;
cmd[2] = 0;
cmd[3] = 0;
cmd[4] = 0;
mmc_read_block(cmd,Buffer,16);

Loading…
Cancel
Save