From nobody Thu Oct 30 15:22:16 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1525450527886367.01301170736906; Fri, 4 May 2018 09:15:27 -0700 (PDT) Received: from localhost ([::1]:35171 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEdMl-0007R7-1M for importer@patchew.org; Fri, 04 May 2018 12:15:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55151) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEd7z-00037T-FC for qemu-devel@nongnu.org; Fri, 04 May 2018 12:00:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEd7u-0001hW-KS for qemu-devel@nongnu.org; Fri, 04 May 2018 12:00:11 -0400 Received: from mail-qt0-x241.google.com ([2607:f8b0:400d:c0d::241]:40082) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fEd7u-0001hK-Gi for qemu-devel@nongnu.org; Fri, 04 May 2018 12:00:06 -0400 Received: by mail-qt0-x241.google.com with SMTP id h2-v6so27974637qtp.7 for ; Fri, 04 May 2018 09:00:06 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id a83sm8587066qkb.22.2018.05.04.09.00.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 May 2018 09:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tgJcJtLk0Kk0DGQF7S/kkrOPgNKZx4vSZwzrXdAecn4=; b=oZC73GFN3ISOtLExBp8MWhYM1567Dix2rI56PmM+7DOBfArSjKChsICp6VTOagZDjR IVuJ8eE68BSCOmbwtB/OPQxNMptLXdO0ex12fGmoloTfDMDJIuONMiG1tR4Dd8eUvQTq U6GSQJXpyi1QNiNLyEtTU5sSnoyPpG65hbx13fMSlAmQ73ryW+FiUrfx2J+Q27kqxhep eGzD/O+CBn8vzmW/wd/RhuqygFsf3RVgFQSJFNb22UaKhI+7Dcl2aka0NUV5QNrIY3PL LPfbZ/RciSuuY4LsXisUz3aYlS2fLZ912q56MXPnraOECwNp+QJxR0EquiYHWlaxtOE8 I0zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=tgJcJtLk0Kk0DGQF7S/kkrOPgNKZx4vSZwzrXdAecn4=; b=msPSuFKZrnMMb6INieG+eyc191B0v+5BJwgW0ID8f9c9RnkBwbbl+RS21wlCsBpKi9 I2P8nqyxWmXxncpamsF1Swal8ssJW9SVHInKdXoGfufo+XBXB3jCe0xqNQ8KmMgdUo6c Xs4GGTbTOnPvnRU7LcGwtJshSxapddZlFfMMleLWULfufrY5Xk4+QBMmI/qsv3g4FJJc bUKawi+13E2LBRBXIR+sGvWjQ4RIgY8QKljckfRTHQISSghqvxputopmNV55euZ418nV SNg59CFGSaqHlXmlJU8SP0G1+0SFsqkmEsL9ZgI9U/J/x7Noud7RjRF1q1c8WWG91kwQ EEww== X-Gm-Message-State: ALQs6tBsV5MpU+ohbLiZ7cd02ks49BVcFtz8hQeNoFHbuh1cdL0c0Cij nCF+HBoGbLfxmyp2BDMf6RM= X-Google-Smtp-Source: AB8JxZrKdvJKLtI8Dza1AwZJ0Y1jqaEexAIH+Zc6a6hhmichBqJ1UHPNyQuJxxmFpwl2Uz4ANNimvQ== X-Received: by 2002:ac8:3868:: with SMTP id r37-v6mr25508398qtb.125.1525449605983; Fri, 04 May 2018 09:00:05 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Peter Maydell , "Edgar E . Iglesias" Date: Fri, 4 May 2018 12:59:11 -0300 Message-Id: <20180504155918.21287-14-f4bug@amsat.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180504155918.21287-1-f4bug@amsat.org> References: <20180504155918.21287-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::241 Subject: [Qemu-devel] [PATCH 13/20] sdcard: Expose sd_prepare_frame48() for QTest use X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/sd/sd.h | 16 ++++++++++++++++ hw/sd/sdmmc-internal.c | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h index b1f865fe20..13de1b30c3 100644 --- a/include/hw/sd/sd.h +++ b/include/hw/sd/sd.h @@ -168,6 +168,22 @@ void sd_prepare_request(SDRequest *req, uint8_t cmd, u= int32_t arg, void sd_prepare_request_with_crc(SDRequest *req, uint8_t cmd, uint32_t arg, uint8_t crc); =20 +/** + * sd_prepare_response48: Initialize a SD response buffer + * + * If @gen_crc the frame checksum will be calculated + * and filled in the request buffer. + * + * @req: the #SDRequest to be filled + * @cmd: the SD command + * @arg: the SD command argument + * @is_response: whether the frame is a command request or response + * @gen_crc: generates the frame CRC7 if true, else fill with zeroes + */ + +void sd_prepare_frame48(SDFrame48 *frame, uint8_t cmd, uint32_t arg, + bool is_response, bool gen_crc); + /** * sd_update_frame48_checksum: * @frame: the #SDFrame48 to verify diff --git a/hw/sd/sdmmc-internal.c b/hw/sd/sdmmc-internal.c index 04da81e665..c990cc9e8e 100644 --- a/hw/sd/sdmmc-internal.c +++ b/hw/sd/sdmmc-internal.c @@ -129,8 +129,8 @@ void sd_update_frame48_checksum(SDFrame48 *frame, bool = is_response) frame->crc =3D sd_calc_frame48_crc7(frame->cmd, frame->arg, is_respons= e); } =20 -static void sd_prepare_frame48(SDFrame48 *frame, uint8_t cmd, uint32_t arg, - bool is_response, bool gen_crc) +void sd_prepare_frame48(SDFrame48 *frame, uint8_t cmd, uint32_t arg, + bool is_response, bool gen_crc) { frame->cmd =3D cmd; frame->arg =3D arg; --=20 2.17.0