From patchwork Fri Dec 9 13:34:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Voevodin X-Patchwork-Id: 130384 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 D8C36B6F65 for ; Sat, 10 Dec 2011 01:04:27 +1100 (EST) Received: from localhost ([::1]:43373 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZ0dE-0007lb-FN for incoming@patchwork.ozlabs.org; Fri, 09 Dec 2011 08:36:56 -0500 Received: from eggs.gnu.org ([140.186.70.92]:34591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZ0by-0004tW-3A for qemu-devel@nongnu.org; Fri, 09 Dec 2011 08:35:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RZ0bm-0000aO-8r for qemu-devel@nongnu.org; Fri, 09 Dec 2011 08:35:32 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:8518) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZ0bl-0000a5-Vv for qemu-devel@nongnu.org; Fri, 09 Dec 2011 08:35:26 -0500 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: TEXT/PLAIN Received: from euspt2 ([210.118.77.13]) by mailout3.w1.samsung.com (Sun Java(tm) System Messaging Server 6.3-8.04 (built Jul 29 2009; 32bit)) with ESMTP id <0LVX005NGV307750@mailout3.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 09 Dec 2011 13:35:24 +0000 (GMT) Received: from evvoevodinPC.rnd.samsung.ru ([106.109.8.48]) by spt2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LVX00MANV28B5@spt2.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 09 Dec 2011 13:35:24 +0000 (GMT) Date: Fri, 09 Dec 2011 17:34:40 +0400 From: Evgeny Voevodin In-reply-to: <1323437682-28792-1-git-send-email-e.voevodin@samsung.com> To: qemu-devel@nongnu.org Message-id: <1323437682-28792-14-git-send-email-e.voevodin@samsung.com> X-Mailer: git-send-email 1.7.4.1 References: <1323437682-28792-1-git-send-email-e.voevodin@samsung.com> X-detected-operating-system: by eggs.gnu.org: Solaris 9.1 X-Received-From: 210.118.77.13 Cc: m.kozlov@samsung.com, Mitsyanko Igor , d.solodkiy@samsung.com, Evgeny Voevodin Subject: [Qemu-devel] [PATCH 13/15] hw/sd.c, hw/sd.h: add receive ready query routine to SD/MMC API 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 From: Mitsyanko Igor Data transfer direction between host controller and SD/MMC card is selected by host controller configuration registers, but whether we actually need or need not perform data transfer depends on type of last issued command. To avoid memorization of which type of command host controller issued the last time, we can use simple query procedures, to make sure that SD/MMC card is in the right state. The only query routine currently presented in SD/MMC card emulation is sd_data_ready(), this patch adds sd_receive_ready() routine. Signed-off-by: Evgeny Voevodin --- hw/sd.c | 5 +++++ hw/sd.h | 1 + 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/hw/sd.c b/hw/sd.c index 10e26ad..b0a8557 100644 --- a/hw/sd.c +++ b/hw/sd.c @@ -1670,3 +1670,8 @@ void sd_enable(SDState *sd, int enable) { sd->enable = enable; } + +int sd_receive_ready(SDState *sd) +{ + return sd->state == sd_receivingdata_state; +} diff --git a/hw/sd.h b/hw/sd.h index ac4b7c4..71ab781 100644 --- a/hw/sd.h +++ b/hw/sd.h @@ -75,5 +75,6 @@ uint8_t sd_read_data(SDState *sd); void sd_set_cb(SDState *sd, qemu_irq readonly, qemu_irq insert); int sd_data_ready(SDState *sd); void sd_enable(SDState *sd, int enable); +int sd_receive_ready(SDState *sd); #endif /* __hw_sd_h */