/* Check if SDIOH bus switch to a specified state in some time.  */
u32 SDIOH_CheckBusState(u8 status, u32 timeout_us)
/* Check if SDIOH bus switch to a specified state in some time.  */
u32 SDIOH_CheckBusState(u8 status, u32 timeout_us)
{
	SDIOH_TypeDef *psdioh = SDIOH_BASE;
	u8 idle_level = sdioh_init_para.SDIOH_idle_level;
	u32 tmp;
	do {
		tmp = psdioh->SD_BUS_STATUS & idle_level;
		if(status) {
			if(tmp == idle_level)
				return HAL_OK;
		} else {
			if(tmp == 0)
				return HAL_OK;
		}
		DelayUs(1);
	} while (timeout_us-- != 0);
	return HAL_TIMEOUT;
}