mirror of
https://github.com/qemu/qemu.git
synced 2024-11-28 14:24:02 +08:00
fdc-test: Check READ ID
ST0 shouldn't include 0x20 (FD_SR0_SEEK) after READ ID. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Tested-by: Hervé Poussineau <hpoussin@reactos.org>
This commit is contained in:
parent
075f5532f1
commit
67f194bd81
@ -48,6 +48,7 @@ enum {
|
||||
|
||||
enum {
|
||||
CMD_SENSE_INT = 0x08,
|
||||
CMD_READ_ID = 0x0a,
|
||||
CMD_SEEK = 0x0f,
|
||||
CMD_READ = 0xe6,
|
||||
CMD_RELATIVE_SEEK_OUT = 0x8f,
|
||||
@ -392,6 +393,70 @@ static void test_relative_seek(void)
|
||||
g_assert(pcn == 0);
|
||||
}
|
||||
|
||||
static void test_read_id(void)
|
||||
{
|
||||
uint8_t drive = 0;
|
||||
uint8_t head = 0;
|
||||
uint8_t cyl;
|
||||
uint8_t st0;
|
||||
|
||||
/* Seek to track 0 and check with READ ID */
|
||||
send_seek(0);
|
||||
|
||||
floppy_send(CMD_READ_ID);
|
||||
g_assert(!get_irq(FLOPPY_IRQ));
|
||||
floppy_send(head << 2 | drive);
|
||||
|
||||
while (!get_irq(FLOPPY_IRQ)) {
|
||||
/* qemu involves a timer with READ ID... */
|
||||
clock_step(1000000000LL / 50);
|
||||
}
|
||||
|
||||
st0 = floppy_recv();
|
||||
floppy_recv();
|
||||
floppy_recv();
|
||||
cyl = floppy_recv();
|
||||
head = floppy_recv();
|
||||
floppy_recv();
|
||||
floppy_recv();
|
||||
|
||||
g_assert_cmpint(cyl, ==, 0);
|
||||
g_assert_cmpint(head, ==, 0);
|
||||
g_assert_cmpint(st0, ==, head << 2);
|
||||
|
||||
/* Seek to track 8 on head 1 and check with READ ID */
|
||||
head = 1;
|
||||
cyl = 8;
|
||||
|
||||
floppy_send(CMD_SEEK);
|
||||
floppy_send(head << 2 | drive);
|
||||
g_assert(!get_irq(FLOPPY_IRQ));
|
||||
floppy_send(cyl);
|
||||
g_assert(get_irq(FLOPPY_IRQ));
|
||||
ack_irq(NULL);
|
||||
|
||||
floppy_send(CMD_READ_ID);
|
||||
g_assert(!get_irq(FLOPPY_IRQ));
|
||||
floppy_send(head << 2 | drive);
|
||||
|
||||
while (!get_irq(FLOPPY_IRQ)) {
|
||||
/* qemu involves a timer with READ ID... */
|
||||
clock_step(1000000000LL / 50);
|
||||
}
|
||||
|
||||
st0 = floppy_recv();
|
||||
floppy_recv();
|
||||
floppy_recv();
|
||||
cyl = floppy_recv();
|
||||
head = floppy_recv();
|
||||
floppy_recv();
|
||||
floppy_recv();
|
||||
|
||||
g_assert_cmpint(cyl, ==, 8);
|
||||
g_assert_cmpint(head, ==, 1);
|
||||
g_assert_cmpint(st0, ==, head << 2);
|
||||
}
|
||||
|
||||
static void test_read_no_dma_1(void)
|
||||
{
|
||||
uint8_t ret;
|
||||
@ -471,6 +536,7 @@ int main(int argc, char **argv)
|
||||
qtest_add_func("/fdc/media_change", test_media_change);
|
||||
qtest_add_func("/fdc/sense_interrupt", test_sense_interrupt);
|
||||
qtest_add_func("/fdc/relative_seek", test_relative_seek);
|
||||
qtest_add_func("/fdc/read_id", test_read_id);
|
||||
qtest_add_func("/fdc/media_insert", test_media_insert);
|
||||
qtest_add_func("/fdc/read_no_dma_1", test_read_no_dma_1);
|
||||
qtest_add_func("/fdc/read_no_dma_18", test_read_no_dma_18);
|
||||
|
Loading…
Reference in New Issue
Block a user