X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fcpu%2Fcortex-m3%2Fdrv%2Fhsmci_sam3.c;h=b0c0ad0af522693a3afc08a548ee997352e4298d;hb=5bf8282a6c67268fd97cb7e8f6a1a6a52ddcc532;hp=a4960fb51fb5a1fce6d88adcaad3071839f60ec9;hpb=8a5cb391f6130a8e8de0ae5323ce7004054327f2;p=bertos.git diff --git a/bertos/cpu/cortex-m3/drv/hsmci_sam3.c b/bertos/cpu/cortex-m3/drv/hsmci_sam3.c index a4960fb5..b0c0ad0a 100644 --- a/bertos/cpu/cortex-m3/drv/hsmci_sam3.c +++ b/bertos/cpu/cortex-m3/drv/hsmci_sam3.c @@ -88,16 +88,16 @@ bool hsmci_sendCmd(uint8_t index, uint32_t argument, uint32_t reply_type) HSMCI_ARGR = argument; HSMCI_CMDR = index | reply_type | BV(HSMCI_CMDR_MAXLAT); - uint32_t status = HSMCI_SR; - while (!(status & BV(HSMCI_SR_CMDRDY))) - { + uint32_t status; + do { + status = HSMCI_SR; + if (status & HSMCI_RESP_ERROR_MASK) return status; cpu_relax(); - status = HSMCI_SR; - } + } while (!(status & BV(HSMCI_SR_CMDRDY))); return 0; }