started connecting FatFS to sd_card.c

This commit is contained in:
Markus Fröschle
2012-12-04 10:54:35 +00:00
parent 880951b07a
commit dc269327be
2 changed files with 6 additions and 23 deletions

View File

@@ -59,7 +59,9 @@ CSRCS= \
$(SRCDIR)/bas_printf.c \
$(SRCDIR)/BaS.c \
$(SRCDIR)/cache.c \
$(SRCDIR)/sd_card.c
$(SRCDIR)/sd_card.c \
$(SRCDIR)/ff.c \
$(SRCDIR)/mmcbb.c
ASRCS= \
$(SRCDIR)/startcf.S \

View File

@@ -31,10 +31,10 @@
/* Platform dependent macros and functions needed to be modified */
/*-------------------------------------------------------------------------*/
#include <device.h> /* Include device specific declareation file here */
#include <sd_card.h> /* Include device specific declareation file here */
#define INIT_PORT() init_port() /* Initialize MMC control port (CS=H, CLK=L, DI=H, DO=in) */
#define DLY_US(n) dly_us(n) /* Delay n microseconds */
#define DLY_US(n) wait(n) /* Delay n microseconds */
#define CS_H() PORT |= 0x01 /* Set MMC CS "high" */
#define CS_L() PORT &= 0xFE /* Set MMC CS "low" */
@@ -99,27 +99,8 @@ void xmit_mmc (
UINT bc /* Number of bytes to send */
)
{
BYTE d;
do {
d = *buff++; /* Get a byte to be sent */
if (d & 0x80) DI_H(); else DI_L(); /* bit7 */
CK_H(); CK_L();
if (d & 0x40) DI_H(); else DI_L(); /* bit6 */
CK_H(); CK_L();
if (d & 0x20) DI_H(); else DI_L(); /* bit5 */
CK_H(); CK_L();
if (d & 0x10) DI_H(); else DI_L(); /* bit4 */
CK_H(); CK_L();
if (d & 0x08) DI_H(); else DI_L(); /* bit3 */
CK_H(); CK_L();
if (d & 0x04) DI_H(); else DI_L(); /* bit2 */
CK_H(); CK_L();
if (d & 0x02) DI_H(); else DI_L(); /* bit1 */
CK_H(); CK_L();
if (d & 0x01) DI_H(); else DI_L(); /* bit0 */
CK_H(); CK_L();
spi_send_byte(*buff++);
} while (--bc);
}