rem: bool ide_wait( ide_device_info *device, int mask, int not_mask, bool check_err, bigtime_t timeout )
add: ide_wait(ide_device_info *device, int mask, int not_mask, bool check_err, bigtime_t timeout)
context: bool ide_wait( ide_device_info *device, int mask, int not_mask, 	bool check_err, bigtime_t timeout ){	ide_bus_info *bus = device->bus;	bigtime_t start_time = system_time();	while( 1 ) {		bigtime_t elapsed_time;		int status;		// do spin before test as the device needs 400 ns 		// to update its status register		spin( 1 );				status = bus->controller->get_altstatus( bus->channel );				if( (status & mask) == mask &&			(status & not_mask) == 0 )			return true;				if( check_err && (status & ide_status_err) != 0 ) {			set_sense( device, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_INTERNAL_FAILURE );			return false;		}				elapsed_time = system_time() - start_time;				if( elapsed_time > timeout ) {			set_sense( device, SCSIS_KEY_HARDWARE_ERROR, SCSIS_ASC_LUN_TIMEOUT );			return false;		}		// if we've waited more then 5ms, we start passive waiting		// to reduce system load		if( elapsed_time > 5000 )			snooze( elapsed_time / 10 );	}}