finished incorporating sd_card routines
This commit is contained in:
1
Makefile
1
Makefile
@@ -45,6 +45,7 @@ CSRCS= \
|
|||||||
|
|
||||||
ASRCS= \
|
ASRCS= \
|
||||||
$(SRCDIR)/mmu.S \
|
$(SRCDIR)/mmu.S \
|
||||||
|
$(SRCDIR)/sd_card_asm.S \
|
||||||
$(SRCDIR)/exceptions.S \
|
$(SRCDIR)/exceptions.S \
|
||||||
$(SRCDIR)/supervisor.S \
|
$(SRCDIR)/supervisor.S \
|
||||||
$(SRCDIR)/ewf.S \
|
$(SRCDIR)/ewf.S \
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ SECTIONS {
|
|||||||
{
|
{
|
||||||
objs/BaS.o(.text)
|
objs/BaS.o(.text)
|
||||||
/* put other routines into the same segment (RAM) as BaS.o */
|
/* put other routines into the same segment (RAM) as BaS.o */
|
||||||
|
objs/sd_card_asm.o(.text)
|
||||||
objs/sd_card.o(.text)
|
objs/sd_card.o(.text)
|
||||||
objs/mmu.o(.text)
|
objs/mmu.o(.text)
|
||||||
objs/exceptions.o(.text)
|
objs/exceptions.o(.text)
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ void sd_card_idle(void)
|
|||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
".extern sd_idle\n\t"
|
".extern sd_idle\n\t"
|
||||||
"bsr sd_idle\n\t"
|
"bsr sd_idle\n\t"
|
||||||
/* input */ :
|
|
||||||
/* output */:
|
/* output */:
|
||||||
|
/* input */ :
|
||||||
/* clobber */: "a0","a1","a2","a3","a4","a5","a6",
|
/* clobber */: "a0","a1","a2","a3","a4","a5","a6",
|
||||||
"d0","d1","d2","d3","d4","d5","d6","d7","memory"
|
"d0","d1","d2","d3","d4","d5","d6","d7","memory"
|
||||||
);
|
);
|
||||||
@@ -21,6 +21,17 @@ void sd_card_idle(void)
|
|||||||
|
|
||||||
int sd_card_init(void)
|
int sd_card_init(void)
|
||||||
{
|
{
|
||||||
|
register int ret __asm__("d0");
|
||||||
|
|
||||||
|
__asm__ __volatile__ (
|
||||||
|
".extern sd_init\n\t"
|
||||||
|
"bsr.l sd_init\n\t"
|
||||||
|
/* output */: "=r" (ret)
|
||||||
|
/* input */ :
|
||||||
|
/* clobber */: "a0","a1","a2","a3","a4","a5","a6",
|
||||||
|
"d1","d2","d3","d4","d5","d6","d7","memory"
|
||||||
|
);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,16 +11,38 @@
|
|||||||
#define MCF_PAD_PAR_DSPI (__MBAR+0xA50)
|
#define MCF_PAD_PAR_DSPI (__MBAR+0xA50)
|
||||||
#define MCF_PSC0_PSCTB_8BIT (__MBAR+0x860C)
|
#define MCF_PSC0_PSCTB_8BIT (__MBAR+0x860C)
|
||||||
#define MCF_DSPI_DMCR (__MBAR+0x8A00)
|
#define MCF_DSPI_DMCR (__MBAR+0x8A00)
|
||||||
|
#define MCF_SLT0_SCNT (__MBAR + 0x908)
|
||||||
|
|
||||||
|
warte_10ms:
|
||||||
|
move.l d0,-(sp)
|
||||||
|
move.l MCF_SLT0_SCNT,d0
|
||||||
|
sub.l #1320000,d0
|
||||||
|
warte_d6:
|
||||||
|
cmp.l MCF_SLT0_SCNT,d0
|
||||||
|
bcs warte_d6
|
||||||
|
move.l (sp)+,d0
|
||||||
|
rts
|
||||||
|
|
||||||
|
warte_1ms:
|
||||||
|
move.l d0,-(sp)
|
||||||
|
move.l MCF_SLT0_SCNT,d0
|
||||||
|
sub.l #132000,d0
|
||||||
|
warte_d5:
|
||||||
|
cmp.l MCF_SLT0_SCNT,d0
|
||||||
|
bcs warte_d5
|
||||||
|
move.l (sp)+,d0
|
||||||
|
rts
|
||||||
.text
|
.text
|
||||||
|
|
||||||
.global sd_idle
|
.global sd_idle
|
||||||
|
.global sd_init
|
||||||
|
|
||||||
sd_test:
|
sd_init:
|
||||||
lea MCF_PSC0_PSCTB_8BIT,a6
|
lea MCF_PSC0_PSCTB_8BIT,a6
|
||||||
move.l #LONGASC('S', 'D', '-', 'A'),(a6)
|
move.l #LONGASC('S', 'D', '-', 'A'),(a6)
|
||||||
move.l #LONGASC('a', 'r', 'd', ' '),(a6)
|
move.l #LONGASC('a', 'r', 'd', ' '),(a6)
|
||||||
|
|
||||||
move.l #_Bas_base,a5 // basis addresse (diesen bereich brauchen wir nicht mehr!)
|
move.l buffer,a5 // basis addresse (diesen bereich brauchen wir nicht mehr!)
|
||||||
move.l #0x1fffffff,d0 // normal dspi
|
move.l #0x1fffffff,d0 // normal dspi
|
||||||
move.l d0,MCF_PAD_PAR_DSPI
|
move.l d0,MCF_PAD_PAR_DSPI
|
||||||
lea MCF_DSPI_DMCR,a0
|
lea MCF_DSPI_DMCR,a0
|
||||||
@@ -30,9 +52,9 @@ sd_test:
|
|||||||
move.l #0x082000ff,d4 // tx vorbesetzen
|
move.l #0x082000ff,d4 // tx vorbesetzen
|
||||||
mov3q.l #-1,dspi_dsr(a0)
|
mov3q.l #-1,dspi_dsr(a0)
|
||||||
|
|
||||||
bsr.l _wait_1ms
|
bsr.l warte_1ms
|
||||||
move.l #0xc00d3c00,(a0) // 8 bit 4MHz clocken cs off
|
move.l #0xc00d3c00,(a0) // 8 bit 4MHz clocken cs off
|
||||||
bsr.l _wait_10ms
|
bsr.l warte_10ms
|
||||||
move.l #0x800d3c00,(a0) // 8 bit 4MHz normal cs on
|
move.l #0x800d3c00,(a0) // 8 bit 4MHz normal cs on
|
||||||
bsr sd_com
|
bsr sd_com
|
||||||
bsr sd_com
|
bsr sd_com
|
||||||
@@ -53,7 +75,7 @@ sd_test:
|
|||||||
bsr sd_com
|
bsr sd_com
|
||||||
bsr sd_com
|
bsr sd_com
|
||||||
move.l #0x802d3c00,(a0) // 8 bit 4MHz normal cs off
|
move.l #0x802d3c00,(a0) // 8 bit 4MHz normal cs off
|
||||||
bsr.l _wait_10ms
|
bsr.l warte_10ms
|
||||||
|
|
||||||
// sd idle
|
// sd idle
|
||||||
move.l #100,d6 // 100 versuche
|
move.l #100,d6 // 100 versuche
|
||||||
@@ -411,3 +433,6 @@ sd_rcv_rd_rb:
|
|||||||
bne sd_rcv_rd_rb
|
bne sd_rcv_rd_rb
|
||||||
rts
|
rts
|
||||||
/******************************************/
|
/******************************************/
|
||||||
|
|
||||||
|
.data
|
||||||
|
buffer: dc.l 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
|
|||||||
Reference in New Issue
Block a user