From patchwork Thu Dec 1 18:43:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 128784 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CD713B6F69 for ; Fri, 2 Dec 2011 12:10:21 +1100 (EST) Received: from localhost ([::1]:54728 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWHdr-0000h6-1a for incoming@patchwork.ozlabs.org; Thu, 01 Dec 2011 20:10:19 -0500 Received: from eggs.gnu.org ([140.186.70.92]:46751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWHdk-0000gs-LL for qemu-devel@nongnu.org; Thu, 01 Dec 2011 20:10:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RWHdj-0003I6-Rp for qemu-devel@nongnu.org; Thu, 01 Dec 2011 20:10:12 -0500 Received: from cpe-70-123-132-139.austin.res.rr.com ([70.123.132.139]:51178 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWHdY-0003Cy-Rp for qemu-devel@nongnu.org; Thu, 01 Dec 2011 20:10:11 -0500 Received: from localhost6.localdomain6 (localhost.localdomain [127.0.0.1]) by localhost6.localdomain6 (8.14.4/8.14.4/Debian-2ubuntu1) with ESMTP id pB1IhZNI003220; Thu, 1 Dec 2011 12:43:35 -0600 Received: (from anthony@localhost) by localhost6.localdomain6 (8.14.4/8.14.4/Submit) id pB1IhZAo003219; Thu, 1 Dec 2011 12:43:35 -0600 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Thu, 1 Dec 2011 12:43:30 -0600 Message-Id: <1322765012-3164-5-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1322765012-3164-1-git-send-email-aliguori@us.ibm.com> References: <1322765012-3164-1-git-send-email-aliguori@us.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 70.123.132.139 Cc: Anthony Liguori Subject: [Qemu-devel] [RFC v2 4/6] Add uart test case X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org --- serial-test.py | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) create mode 100644 serial-test.py diff --git a/serial-test.py b/serial-test.py new file mode 100644 index 0000000..7aed0cb --- /dev/null +++ b/serial-test.py @@ -0,0 +1,24 @@ +from qtest import outb, inb +import qtest, sys + +def main(args): + if len(args) != 1: + raise Exception('Missing argument') + + qtest.init(args[0]) + + base = 0x3f8 + + # disable THRE and RDA interrupt + outb(base + 1, 0x00) + + for ch in "Hello, World!\r\n": + # wait for THRE + while (inb(base + 5) & 0x20) == 0: + pass + + outb(base + 0, ord(ch)) + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:]))