소스 검색

sdcard: reinitialize on system (soft) reset

When the software is reinitialized, make sure we reset the sdcard
status; otherwise it will hang after reset.
H. Peter Anvin 3 년 전
부모
커밋
2e544bb970
8개의 변경된 파일6989개의 추가작업 그리고 6980개의 파일을 삭제
  1. BIN
      fpga/output_files/max80.jbc
  2. BIN
      fpga/output_files/max80.jic
  3. BIN
      fpga/output_files/max80.pof
  4. BIN
      fpga/output_files/max80.sof
  5. 6980 6980
      rv32/boot.mif
  6. 6 0
      rv32/sdcard.c
  7. 1 0
      rv32/sdcard.h
  8. 2 0
      rv32/system.c

BIN
fpga/output_files/max80.jbc


BIN
fpga/output_files/max80.jic


BIN
fpga/output_files/max80.pof


BIN
fpga/output_files/max80.sof


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 6980 - 6980
rv32/boot.mif


+ 6 - 0
rv32/sdcard.c

@@ -655,6 +655,12 @@ DSTATUS sdcard_present_poll(void)
 
 #define SDCARD_RETRY (TIMER_HZ*2)		/* Retry max every 2 s */
 
+void sdcard_reset(void)
+{
+    memset(&sdc, 0, sizeof sdc);
+    sdc.status = sdc.fsstatus = STA_NOINIT;
+}
+
 DSTATUS sdcard_init(void)
 {
     uint16_t  status;

+ 1 - 0
rv32/sdcard.h

@@ -35,6 +35,7 @@ typedef unsigned int sector_t;
 
 extern int sdcard_read_sectors(void *, sector_t, int);
 extern int sdcard_write_sectors(const void *, sector_t, int);
+extern void sdcard_reset(void);
 extern DSTATUS sdcard_init(void);
 extern DSTATUS sdcard_present_poll(void);
 

+ 2 - 0
rv32/system.c

@@ -1,5 +1,6 @@
 #include "fw.h"
 #include "io.h"
+#include "sdcard.h"
 #include "abcio.h"
 #include "sys.h"
 #include "console.h"
@@ -117,6 +118,7 @@ void init(void)
 
     set_leds(3);
 
+    sdcard_reset();
     disk_cache_init();
     abcdisk_init();
 

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.