qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v6 6/6] fdc_test: introduce test_sense_interrupt


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH v6 6/6] fdc_test: introduce test_sense_interrupt
Date: Mon, 25 Jun 2012 13:52:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

Am 22.06.2012 12:33, schrieb Pavel Hrdina:
> Calling sense interrupt status while there is no interrupt should
> return invalid command (0x80).
> 
> Read command should always returns in st0 seek_end bit set to 1.
> 
> Signed-off-by: Pavel Hrdina <address@hidden>
> ---
>  tests/fdc-test.c |   25 ++++++++++++++++++++++++-
>  1 files changed, 24 insertions(+), 1 deletions(-)
> 
> diff --git a/tests/fdc-test.c b/tests/fdc-test.c
> index 5280eff..be14d83 100644
> --- a/tests/fdc-test.c
> +++ b/tests/fdc-test.c
> @@ -142,7 +142,7 @@ static uint8_t send_read_command(void)
>      }
>  
>      st0 = floppy_recv();
> -    if (st0 != 0x40) {
> +    if (st0 != 0x60) {
>          ret = 1;
>      }
>  
> @@ -263,6 +263,28 @@ static void test_media_change(void)
>      assert_bit_set(dir, DSKCHG);
>  }
>  
> +static void test_sense_interrupt(void)
> +{
> +    int drive = 0;
> +    int head = 0;
> +    int cyl = 0;
> +    int ret = 0;
> +
> +    floppy_send(CMD_SENSE_INT);
> +    ret = floppy_recv();
> +    g_assert(ret == 0x80);

If I'm not mistakes, CMD_SENSE_INT returns two bytes (not just one), the
first of which is ST0 and the second one the Present Cylinder Number.

0x80 for ST0 would mean "invalid command", which is the right return
value if there is no active interrupt condition. So you seem to check
the right value and just miss a second floppy_recv().

> +
> +    floppy_send(CMD_SEEK);
> +    floppy_send(head << 2 | drive);
> +    g_assert(!get_irq(FLOPPY_IRQ));
> +    floppy_send(cyl);

Maybe add another assertion here that the IRQ is now active?

> +
> +    floppy_send(CMD_SENSE_INT);
> +    ret = floppy_recv();
> +    g_assert(ret != 0x80);

I think we can do better and tell the exact value that should result. I
believe g_assert(ret == 0x20); would be right.

Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]