Ejemplo n.º 1
0
static void check_change(unsigned long dummy)
{
	static int drive = 0;

	unsigned long flags;
	int stat;

	if (fdc_busy)
		return;		/* Don't start poking about if the fdc is busy */

	return;			/* let's just forget it for the mo DAG */

	if (++drive > 1 || !unit[drive].connected)
		drive = 0;

	save_flags(flags);
	cli();

	if (!stdma_islocked()) {
		stat = !!(FDC1772_READ(FDC1772REG_STATUS) & FDC1772STAT_WPROT);

		/* The idea here is that if the write protect line has changed then
		the disc must have changed */
		if (stat != unit[drive].wpstat) {
			DPRINT(("wpstat[%d] = %d\n", drive, stat));
			unit[drive].wpstat = stat;
			set_bit(drive, &changed_floppies);
		}
	}
	restore_flags(flags);

	START_CHECK_CHANGE_TIMER(CHECK_CHANGE_DELAY);
}
Ejemplo n.º 2
0
static void fd_rwsec(void)
{
	unsigned long paddr, flags;
	unsigned int rwflag, old_motoron;
	unsigned int track;

	DPRINT(("fd_rwsec(), Sec=%d, Access=%c\n", ReqSector, ReqCmd == WRITE ? 'w' : 'r'));
	if (ReqCmd == WRITE) {
		/*cache_push( (unsigned long)ReqData, 512 ); */
		paddr = (unsigned long) ReqData;
		rwflag = 0x100;
	} else {
#ifdef TRACKBUFFER
    if (read_track)
      paddr = (unsigned long)PhysTrackBuffer;
    else
      paddr =(unsigned long)PhysDMABuffer;
#else
    paddr = (unsigned long)PhysDMABuffer;
#endif
		rwflag = 0;
	}

	DPRINT(("fd_rwsec() before sidesel rwflag=%d sec=%d trk=%d\n", rwflag,
		ReqSector, FDC1772_READ(FDC1772REG_TRACK)));
	fd_select_side(ReqSide);

	/*DPRINT(("fd_rwsec() before start sector \n")); */
	/* Start sector of this operation */
#ifdef TRACKBUFFER
  FDC1772_WRITE( FDC1772REG_SECTOR, !read_track ? ReqSector : 1 );
#else
  FDC1772_WRITE( FDC1772REG_SECTOR, ReqSector );
#endif

	/* Cheat for track if stretch != 0 */
	if (unit[SelectedDrive].disktype->stretch) {
		track = FDC1772_READ(FDC1772REG_TRACK);
		FDC1772_WRITE(FDC1772REG_TRACK, track >>
			      unit[SelectedDrive].disktype->stretch);
	}
Ejemplo n.º 3
0
static void fd_motor_off_timer(unsigned long dummy)
{
	unsigned long flags;
	unsigned char status;
	int delay;

	del_timer(&motor_off_timer);

	if (SelectedDrive < 0)
		/* no drive selected, needn't deselect anyone */
		return;

	save_flags(flags);
	cli();

	if (fdc_busy)		/* was stdma_islocked */
		goto retry;

	status = FDC1772_READ(FDC1772REG_STATUS);

	if (!(status & 0x80)) {
		/*
		 * motor already turned off by FDC1772 -> deselect drives
		 * In actual fact its this deselection which turns the motor
		 * off on the Arc, since the motor control is actually on
		 * Latch A
		 */
		DPRINT(("fdc1772: deselecting in fd_motor_off_timer\n"));
		fd_deselect();
		MotorOn = 0;
		restore_flags(flags);
		return;
	}
	/* not yet off, try again */

retry:
	restore_flags(flags);
	/* Test again later; if tested too often, it seems there is no disk
	 * in the drive and the FDC1772 will leave the motor on forever (or,
	 * at least until a disk is inserted). So we'll test only twice
	 * per second from then on...
	 */
	delay = (MotorOffTrys < FD_MOTOR_OFF_MAXTRY) ?
	    (++MotorOffTrys, HZ / 20) : HZ / 2;
	START_MOTOR_OFF_TIMER(delay);
}