Example #1
0
void cf_power_on(void)
{
	ata_delay_ms(cf_power_delay+1);

	if(card_share_ins_pwr_flag[CARD_MODULE_CF])
		card_power_off_flag[CARD_COMPACT_FLASH] = 1;

#ifdef CF_POWER_CONTROL
	if(ata_cf_info->ata_cf_power)
	{
		if(cf_check_insert())
		{
			ata_cf_info->ata_cf_power(1);
		}
	}
	else
	{
		if(cf_check_insert())
		{
			cf_set_enable();
		}
	}
#endif
}
int ata_wait_status_bits(unsigned char bits_mask, unsigned char bits_value, unsigned long timeout)
{
	unsigned long cnt = 0;
	unsigned char status;

	while(cnt++ < timeout)
	{
		status = ata_read_reg(ATA_STATUS_REG);
		if((status & bits_mask) == bits_value)
			return ATA_NO_ERROR;
		else
		{
#ifdef CONFIG_CF
		    if(!cf_check_insert())
		        return ATA_ERROR_NO_DEVICE;
#endif
			ata_delay_ms(1);		
		}
	}
	
	return ATA_ERROR_TIMEOUT;
}