Beispiel #1
0
void ftape_detach_drive(void)
{
	TRACE_FUN(8, "ftape_detach_drive");

	TRACE(5, "disabling tape drive and fdc");
	ftape_put_drive_to_sleep(drive_type);
	fdc_catch_stray_interrupts(1);	/* one always comes */
	fdc_disable();
	fdc_release_irq_and_dma();
	TRACE_EXIT;
}
Beispiel #2
0
void ftape_detach_drive(void)
{
	TRACE_FUN(ft_t_any);

	TRACE(ft_t_flow, "disabling tape drive and fdc");
	ftape_put_drive_to_sleep(ft_drive_type.wake_up);
	fdc_catch_stray_interrupts(1);	/* one always comes */
	fdc_disable();
	fdc_release_irq_and_dma();
	fdc_release_regions();
	TRACE_EXIT;
}
Beispiel #3
0
/*      OPEN routine called by kernel-interface code
 */
int _ftape_open(void)
{
	TRACE_FUN(8, "_ftape_open");
	int result;
	static int new_tape = 1;

	result = fdc_init();
	if (result >= 0) {
		result = ftape_activate_drive(&drive_type);
		if (result < 0) {
			fdc_disable();
			fdc_release_irq_and_dma();

		} else {
			result = ftape_get_drive_status(&new_tape, &no_tape, &write_protected);
			if (result < 0) {
				ftape_detach_drive();
			} else {
				if (drive_type.vendor_id == UNKNOWN_VENDOR) {
					ftape_log_vendor_id();
				}
				if (no_tape) {
					ftape_offline = 1;
				} else if (new_tape) {
					ftape_offline = 0;
					init_drive_needed = 1;
					read_only = 0;	/* enable writes again */
				}
				if (!ftape_offline && init_drive_needed) {
					result = ftape_init_drive(&formatted);
					if (result >= 0) {
						new_tape = 0;
					} else {
						ftape_detach_drive();
					}
				}
				if (result >= 0) {
					clear_history();
				}
			}
		}
	}
	TRACE_EXIT;
	return result;
}