Merge pull request #885 from paulusmack/master

software/liblitesdcard: Tell the controller when to wait while the card is busy
This commit is contained in:
enjoy-digital 2021-04-20 14:30:08 +02:00 committed by GitHub
commit b29515bd1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -164,7 +164,7 @@ int sdcard_app_send_op_cond(int hcs) {
#ifdef SDCARD_DEBUG
printf("ACMD41: APP_SEND_OP_COND, arg: %08x\n", arg);
#endif
return sdcard_send_command(arg, 41, SDCARD_CTRL_RESPONSE_SHORT);
return sdcard_send_command(arg, 41, SDCARD_CTRL_RESPONSE_SHORT_BUSY);
}
int sdcard_all_send_cid(void) {
@ -199,7 +199,7 @@ int sdcard_select_card(uint16_t rca) {
#ifdef SDCARD_DEBUG
printf("CMD7: SELECT_CARD\n");
#endif
return sdcard_send_command(rca << 16, 7, SDCARD_CTRL_RESPONSE_SHORT);
return sdcard_send_command(rca << 16, 7, SDCARD_CTRL_RESPONSE_SHORT_BUSY);
}
int sdcard_app_set_bus_width(void) {
@ -296,7 +296,7 @@ int sdcard_stop_transmission(void) {
#ifdef SDCARD_DEBUG
printf("CMD12: STOP_TRANSMISSION\n");
#endif
return sdcard_send_command(0, 12, SDCARD_CTRL_RESPONSE_SHORT);
return sdcard_send_command(0, 12, SDCARD_CTRL_RESPONSE_SHORT_BUSY);
}
int sdcard_send_status(uint16_t rca) {

View File

@ -52,6 +52,11 @@
#define SDCARD_CTRL_RESPONSE_SHORT 1
#define SDCARD_CTRL_RESPONSE_LONG 2
#define SDCARD_CTRL_RESPONSE_BUSY 4
#define SDCARD_CTRL_RESPONSE_SHORT_BUSY (SDCARD_CTRL_RESPONSE_SHORT | \
SDCARD_CTRL_RESPONSE_BUSY)
/*-----------------------------------------------------------------------*/
/* SDCard command helpers */
/*-----------------------------------------------------------------------*/