Minor fixes.
[bertos.git] / bertos / cpu / cortex-m3 / drv / hsmci_sam3.c
index a4960fb51fb5a1fce6d88adcaad3071839f60ec9..b0c0ad0af522693a3afc08a548ee997352e4298d 100644 (file)
@@ -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;
 }