浏览代码

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. 二进制
      fpga/output_files/max80.jbc
  2. 二进制
      fpga/output_files/max80.jic
  3. 二进制
      fpga/output_files/max80.pof
  4. 二进制
      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

二进制
fpga/output_files/max80.jbc


二进制
fpga/output_files/max80.jic


二进制
fpga/output_files/max80.pof


二进制
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();
 

部分文件因为文件数量过多而无法显示