Skip to content
Snippets Groups Projects
Commit 4c4244a0 authored by Fang Lu's avatar Fang Lu
Browse files

sdcard - adapt for nios2/f

parent 33858f9e
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,7 @@ int main() {
}
}
/*
// Test sdcard
osu_init_device();
osu_meta o_meta;
......@@ -62,6 +62,7 @@ int main() {
printf("Sdcard mount success!\n");
printf("magic:%c%c%c%c\n",o_meta.magic[0],o_meta.magic[1],o_meta.magic[2],o_meta.magic[3]);
printf("Song Count:%d\n", o_meta.songs);
break;
}else{
printf("Failed to mount the SDCARD!\r\nPlease retry!\r\n");
usleep(1000000);
......@@ -69,7 +70,7 @@ int main() {
}
} // while
*/
uint16_t dim=0;
while (1) {
......
......@@ -54,11 +54,7 @@ volatile uint32_t* SDData = SD_BASE;*/
bool SDHAL_IsSupport4Bits(void){
bool bYes = FALSE;
#ifdef SD_4BIT_MODE
bYes = TRUE;
#endif
return bYes;
return TRUE;
}
void SDHAL_Init(void){
......@@ -78,6 +74,7 @@ void SDHAL_SendCmd(alt_u8 szCommand[6], int nCmdLen){
}
//*InterfaceCmd = 1;
IOWR_32DIRECT(InterfaceCmd,0,1);
while (!(IORD_32DIRECT(InterfaceStatus,0)));
}
......@@ -108,6 +105,7 @@ bool SDHAL_GetResponse(alt_u8 szResponse[], int nLen){
//*InterfaceCmd = 4;
IOWR_32DIRECT(InterfaceCmd,0,4);
while (!(IORD_32DIRECT(InterfaceStatus,0)));
return 1;
}
......@@ -130,6 +128,7 @@ bool SDHAL_ReadData(alt_u8 szBuf[], int nBufLen){
IOWR_32DIRECT(InterfaceCmd,0,5);
//*InterfaceCmd = 4;
//Jump 16 + 1 + 8 = 25 cycles
while (!(IORD_32DIRECT(InterfaceStatus,0)));
return 1;
}
......@@ -143,6 +142,7 @@ bool SDHAL_WriteData(alt_u8 szDataWrite[], int nDataLen){
void SDHAL_DummyClock(int nClockCnt){
//*InterfaceCmd = 4;
IOWR_32DIRECT(InterfaceCmd,0,4);
while (!(IORD_32DIRECT(InterfaceStatus,0)));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment