summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/dev/sdcard.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2022-09-23 20:08:02 +0200
committerUros Majstorovic <majstor@majstor.org>2022-09-23 20:08:02 +0200
commit69ed847740e3efb5c5ff6319629c93d236150959 (patch)
treea479305afd898870f2ac0e55fe04be788e768fca /fw/fe310/eos/dev/sdcard.c
parent38e19a65fda7a37688320b4b732eb1113bbcbad7 (diff)
i2s driver fixed; added uart programming;
Diffstat (limited to 'fw/fe310/eos/dev/sdcard.c')
-rw-r--r--fw/fe310/eos/dev/sdcard.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/fw/fe310/eos/dev/sdcard.c b/fw/fe310/eos/dev/sdcard.c
index 656d27a..a2ee598 100644
--- a/fw/fe310/eos/dev/sdcard.c
+++ b/fw/fe310/eos/dev/sdcard.c
@@ -170,6 +170,7 @@ static int sdc_ready(uint32_t timeout) {
uint32_t start;
if (timeout == 0) return EOS_ERR_BUSY;
+
start = eos_time_get_tick();
do {
if (eos_time_delta_ms(start) > timeout) break;
@@ -185,6 +186,7 @@ static int sdc_block_read(uint8_t *buffer, uint16_t len, uint32_t timeout) {
uint32_t start;
if (timeout == 0) return EOS_ERR_BUSY;
+
start = eos_time_get_tick();
do {
if (eos_time_delta_ms(start) > timeout) break;
@@ -254,8 +256,8 @@ static int sdc_init(uint32_t timeout) {
uint8_t _type;
uint8_t ocr[4];
uint32_t start;
- start = eos_time_get_tick();
+ start = eos_time_get_tick();
eos_time_sleep(100);
for (i=10; i--;) sdc_xchg8(0xff); /* 80 dummy cycles */
@@ -380,8 +382,9 @@ uint8_t eos_sdc_cap(void) {
int eos_sdc_get_sect_count(uint32_t timeout, uint32_t *sectors) {
int rv;
uint8_t csd[16];
- uint32_t start = eos_time_get_tick();
+ uint32_t start;
+ start = eos_time_get_tick();
sdc_select();
rv = sdc_cmd(SEND_CSD, 0, SDC_CMD_FLAG_NOCS, timeout);
if (rv == SDC_R1_READY) {
@@ -406,8 +409,9 @@ int eos_sdc_get_sect_count(uint32_t timeout, uint32_t *sectors) {
int eos_sdc_get_blk_size(uint32_t timeout, uint32_t *size) {
int rv;
uint8_t rbl[64]; /* SD Status or CSD register */
- uint32_t start = eos_time_get_tick();
-
+ uint32_t start;
+
+ start = eos_time_get_tick();
sdc_select();
if (sdc_type & EOS_SDC_TYPE_SDC2) {
rv = sdc_acmd(SD_STATUS, 0, SDC_CMD_FLAG_NOCS, timeout);