From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmLYK-0004RY-Dr for qemu-devel@nongnu.org; Wed, 04 Jul 2012 05:07:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SmLYF-00062C-KA for qemu-devel@nongnu.org; Wed, 04 Jul 2012 05:07:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SmLYF-00061s-CZ for qemu-devel@nongnu.org; Wed, 04 Jul 2012 05:07:11 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6497A2l017907 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 4 Jul 2012 05:07:10 -0400 From: Pavel Hrdina Date: Wed, 4 Jul 2012 11:07:05 +0200 Message-Id: <633a6fdb6c3fd85a6837a79e1b4be706c29f55ad.1340811068.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: <3359847e9dbdf4531ed17e86ef55be8b8676e329.1340360906.git.phrdina@redhat.com> References: <3359847e9dbdf4531ed17e86ef55be8b8676e329.1340360906.git.phrdina@redhat.com> Subject: [Qemu-devel] [PATCH v7 5/6] fdc_test: update media_change test List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, Pavel Hrdina 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 --- tests/fdc-test.c | 30 ++++++++++++++++++++++-------- 1 files changed, 22 insertions(+), 8 deletions(-) diff --git a/tests/fdc-test.c b/tests/fdc-test.c index 610e2f1..f865576 100644 --- a/tests/fdc-test.c +++ b/tests/fdc-test.c @@ -156,19 +156,21 @@ static uint8_t send_read_command(void) return ret; } -static void send_step_pulse(void) +static void send_step_pulse(bool chg_cyl) { int drive = 0; int head = 0; - static int cyl = 0; + int cyl = 0; + + if (chg_cyl) { + cyl = 1; + } floppy_send(CMD_SEEK); floppy_send(head << 2 | drive); g_assert(!get_irq(FLOPPY_IRQ)); floppy_send(cyl); ack_irq(); - - cyl = (cyl + 1) % 4; } static uint8_t cmos_read(uint8_t reg) @@ -195,8 +197,7 @@ static void test_no_media_on_start(void) assert_bit_set(dir, DSKCHG); dir = inb(FLOPPY_BASE + reg_dir); assert_bit_set(dir, DSKCHG); - send_step_pulse(); - send_step_pulse(); + send_step_pulse(true); dir = inb(FLOPPY_BASE + reg_dir); assert_bit_set(dir, DSKCHG); dir = inb(FLOPPY_BASE + reg_dir); @@ -227,7 +228,14 @@ static void test_media_change(void) dir = inb(FLOPPY_BASE + reg_dir); assert_bit_set(dir, DSKCHG); - send_step_pulse(); + send_step_pulse(false); + 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(true); dir = inb(FLOPPY_BASE + reg_dir); assert_bit_clear(dir, DSKCHG); dir = inb(FLOPPY_BASE + reg_dir); @@ -243,7 +251,13 @@ static void test_media_change(void) dir = inb(FLOPPY_BASE + reg_dir); assert_bit_set(dir, DSKCHG); - send_step_pulse(); + send_step_pulse(false); + 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(true); dir = inb(FLOPPY_BASE + reg_dir); assert_bit_set(dir, DSKCHG); dir = inb(FLOPPY_BASE + reg_dir); -- 1.7.7.6