Rev 379 | Rev 384 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 379 | Rev 380 | ||
---|---|---|---|
Line 174... | Line 174... | ||
174 | timestamp = SetDelay(timeout); |
174 | timestamp = SetDelay(timeout); |
175 | do |
175 | do |
176 | { |
176 | { |
177 | rsp = SSC_GetChar(); |
177 | rsp = SSC_GetChar(); |
178 | if(CheckDelay(timestamp)) break; |
178 | if(CheckDelay(timestamp)) break; |
179 | }while(rsp != 0xFF && (SD_WatchDog)); // wait while card is busy (data out low) |
179 | }while(rsp != 0xFF); // wait while card is busy (data out low) |
180 | return(rsp); |
180 | return(rsp); |
181 | } |
181 | } |
Line 217... | Line 217... | ||
217 | 217 | ||
218 | do |
218 | do |
219 | { |
219 | { |
220 | r1 = SSC_GetChar(); // get byte from sd-card |
220 | r1 = SSC_GetChar(); // get byte from sd-card |
221 | if (timeout++ >500) break; |
221 | if (timeout++ >500) break; |
222 | }while(r1 == 0xFF && (SD_WatchDog)); // wait for the response byte from sd-card. |
222 | }while(r1 == 0xFF); // wait for the response byte from sd-card. |
223 | return(r1); |
223 | return(r1); |
Line 224... | Line 224... | ||
224 | } |
224 | } |
Line 273... | Line 273... | ||
273 | if( ( (rsp & 0xF0) == 0x00 ) || CheckDelay(timeout) ) // data error token or timeout |
273 | if( ( (rsp & 0xF0) == 0x00 ) || CheckDelay(timeout) ) // data error token or timeout |
274 | { |
274 | { |
275 | result = SD_ERROR_READ_DATA; |
275 | result = SD_ERROR_READ_DATA; |
276 | goto end; |
276 | goto end; |
277 | } |
277 | } |
278 | }while(rsp != DATA_START_TOKEN && (SD_WatchDog)); |
278 | }while(rsp != DATA_START_TOKEN); |
279 | // data start token received |
279 | // data start token received |
280 | for (a = 0; a < len; a++) // read the block from the SSC |
280 | for (a = 0; a < len; a++) // read the block from the SSC |
281 | { |
281 | { |
282 | Buffer[a] = SSC_GetChar(); |
282 | Buffer[a] = SSC_GetChar(); |
283 | } |
283 | } |