fdc_test: update media_change test
After rewrite DSKCHG bit handling the test has to be updated. Now is needed to seek to different track to clear DSKCHG bit. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
2fee00885a
commit
59240c349c
@ -156,19 +156,16 @@ static uint8_t send_read_command(void)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void send_step_pulse(void)
|
static void send_step_pulse(int cyl)
|
||||||
{
|
{
|
||||||
int drive = 0;
|
int drive = 0;
|
||||||
int head = 0;
|
int head = 0;
|
||||||
static int cyl = 0;
|
|
||||||
|
|
||||||
floppy_send(CMD_SEEK);
|
floppy_send(CMD_SEEK);
|
||||||
floppy_send(head << 2 | drive);
|
floppy_send(head << 2 | drive);
|
||||||
g_assert(!get_irq(FLOPPY_IRQ));
|
g_assert(!get_irq(FLOPPY_IRQ));
|
||||||
floppy_send(cyl);
|
floppy_send(cyl);
|
||||||
ack_irq();
|
ack_irq();
|
||||||
|
|
||||||
cyl = (cyl + 1) % 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t cmos_read(uint8_t reg)
|
static uint8_t cmos_read(uint8_t reg)
|
||||||
@ -195,8 +192,7 @@ static void test_no_media_on_start(void)
|
|||||||
assert_bit_set(dir, DSKCHG);
|
assert_bit_set(dir, DSKCHG);
|
||||||
dir = inb(FLOPPY_BASE + reg_dir);
|
dir = inb(FLOPPY_BASE + reg_dir);
|
||||||
assert_bit_set(dir, DSKCHG);
|
assert_bit_set(dir, DSKCHG);
|
||||||
send_step_pulse();
|
send_step_pulse(1);
|
||||||
send_step_pulse();
|
|
||||||
dir = inb(FLOPPY_BASE + reg_dir);
|
dir = inb(FLOPPY_BASE + reg_dir);
|
||||||
assert_bit_set(dir, DSKCHG);
|
assert_bit_set(dir, DSKCHG);
|
||||||
dir = inb(FLOPPY_BASE + reg_dir);
|
dir = inb(FLOPPY_BASE + reg_dir);
|
||||||
@ -227,7 +223,14 @@ static void test_media_change(void)
|
|||||||
dir = inb(FLOPPY_BASE + reg_dir);
|
dir = inb(FLOPPY_BASE + reg_dir);
|
||||||
assert_bit_set(dir, DSKCHG);
|
assert_bit_set(dir, DSKCHG);
|
||||||
|
|
||||||
send_step_pulse();
|
send_step_pulse(0);
|
||||||
|
dir = inb(FLOPPY_BASE + reg_dir);
|
||||||
|
assert_bit_set(dir, DSKCHG);
|
||||||
|
dir = inb(FLOPPY_BASE + reg_dir);
|
||||||
|
assert_bit_set(dir, DSKCHG);
|
||||||
|
|
||||||
|
/* Step to next track should clear DSKCHG bit. */
|
||||||
|
send_step_pulse(1);
|
||||||
dir = inb(FLOPPY_BASE + reg_dir);
|
dir = inb(FLOPPY_BASE + reg_dir);
|
||||||
assert_bit_clear(dir, DSKCHG);
|
assert_bit_clear(dir, DSKCHG);
|
||||||
dir = inb(FLOPPY_BASE + reg_dir);
|
dir = inb(FLOPPY_BASE + reg_dir);
|
||||||
@ -243,7 +246,13 @@ static void test_media_change(void)
|
|||||||
dir = inb(FLOPPY_BASE + reg_dir);
|
dir = inb(FLOPPY_BASE + reg_dir);
|
||||||
assert_bit_set(dir, DSKCHG);
|
assert_bit_set(dir, DSKCHG);
|
||||||
|
|
||||||
send_step_pulse();
|
send_step_pulse(0);
|
||||||
|
dir = inb(FLOPPY_BASE + reg_dir);
|
||||||
|
assert_bit_set(dir, DSKCHG);
|
||||||
|
dir = inb(FLOPPY_BASE + reg_dir);
|
||||||
|
assert_bit_set(dir, DSKCHG);
|
||||||
|
|
||||||
|
send_step_pulse(1);
|
||||||
dir = inb(FLOPPY_BASE + reg_dir);
|
dir = inb(FLOPPY_BASE + reg_dir);
|
||||||
assert_bit_set(dir, DSKCHG);
|
assert_bit_set(dir, DSKCHG);
|
||||||
dir = inb(FLOPPY_BASE + reg_dir);
|
dir = inb(FLOPPY_BASE + reg_dir);
|
||||||
|
Loading…
Reference in New Issue
Block a user