/* Wait for command inhibit(CMD) and command inhibit(DAT) idle for issuing next SD/MMC command.  */
static int usdhc_wait_cmd_data_lines(uint32_t instance, int data_present)
/* Wait for command inhibit(CMD) and command inhibit(DAT) idle for issuing next SD/MMC command.  */
static int usdhc_wait_cmd_data_lines(uint32_t instance, int data_present)
{
 	int count = ZERO;
 	while (HW_USDHC_PRES_STATE(instance).B.CIHB) {
 		if (count == ESDHC_CIHB_CHK_COUNT) {
            return FAIL;
 		}
 		count++;
 		hal_delay_us(ESDHC_STATUS_CHK_TIMEOUT);
 	}
    if (data_present == DATA_PRESENT) {
        count = ZERO;
        while (HW_USDHC_PRES_STATE(instance).B.CDIHB) {
            if (count == ESDHC_CDIHB_CHK_COUNT) {
                return FAIL;
            }
            count++;
            hal_delay_us(ESDHC_STATUS_CHK_TIMEOUT);
        }
    }   	return SUCCESS;
 }