Beispiel #1
0
int ftape_init_drive(int *formatted)
{
	TRACE_FUN(5, "ftape_init_drive");
	int result = 0;
	int status;

	result = ftape_report_raw_drive_status(&status);
	if (result >= 0 && (status & QIC_STATUS_CARTRIDGE_PRESENT)) {
		if (!(status & QIC_STATUS_AT_BOT)) {
			/*  Antique drives will get here after a soft reset,
			 *  modern ones only if the driver is loaded when the
			 *  tape wasn't rewound properly.
			 */
			ftape_seek_to_bot();
		}
		if (!(status & QIC_STATUS_REFERENCED)) {
			TRACE(5, "starting seek_load_point");
			result = ftape_command_wait(QIC_SEEK_LOAD_POINT,
						 timeout.reset, &status);
			if (result < 0) {
				TRACE(1, "seek_load_point failed (command)");
			}
		}
	}
	if (result >= 0) {
		int rate;

		*formatted = (status & QIC_STATUS_REFERENCED);
		if (!*formatted) {
			TRACE(1, "Warning: tape is not formatted !");
		}
		/*  Select highest rate supported by both fdc and drive.
		 *  Start with highest rate supported by the fdc.
		 */
		if (fdc.type >= i82078_1)
			rate = 0;
		else if (fdc.type >= i82077)
			rate = 1;
		else
			rate = 2;
		do {
			result = ftape_set_data_rate(rate);
			if (result >= 0) {
				ftape_calc_timeouts();
				break;
			}
			++rate;
		} while (rate < 4);
		if (result < 0) {
			result = -EIO;
		}
	}
	if (result >= 0) {
		/* Tape should be at bot if new cartridge ! */
		ftape_new_cartridge();
	}
	init_drive_needed = 0;
	TRACE_EXIT;
	return result;
}
Beispiel #2
0
int ftape_half_data_rate(void)
{
	if (ft_data_rate < 500) {
		return -1;
	}
	if (ftape_set_data_rate(ft_data_rate / 2, ft_qic_std) < 0) {
		return -EIO;
	}
	ftape_calc_timeouts(ft_qic_std, ft_data_rate, ftape_tape_len);
	return 0;
}