From patchwork Fri Aug 21 07:30:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 251350 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 900BCC433E1 for ; Fri, 21 Aug 2020 07:33:20 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CEC7F2078D for ; Fri, 21 Aug 2020 07:33:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="rWka5ocs"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="KWvlgt7J"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="fSD4AdCr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CEC7F2078D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 6BAC81682; Fri, 21 Aug 2020 09:32:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6BAC81682 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1597995197; bh=wgSXPWKNzGOVjQhBiyRxQYH1nHH0oZ0HenK+5ldt92w=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rWka5ocs+4HCVwTPX8zt2tyfa6KVYLnx5gSYlK/gnFIZWtylq6/Z+a6S+FWc3pw4O OBcRuemH29zFV6GK3XzgQVfMGWk463CUCEw7s4Fc2m40Nc9Yv0FaAqw9gnvwPFrLfL kitihDvuPi6cHE0MXTmh3FIvcfz020Oz0QtxsXLc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 10E2EF802D2; Fri, 21 Aug 2020 09:31:36 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A54C9F800C0; Fri, 21 Aug 2020 09:31:32 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C90E4F800C0 for ; Fri, 21 Aug 2020 09:31:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C90E4F800C0 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="KWvlgt7J"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="fSD4AdCr" Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 40703858; Fri, 21 Aug 2020 03:31:18 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 21 Aug 2020 03:31:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=PGTn8Twnbgmak s1cI0Z2hVd3EW77C7E3ceN7E2KcjHQ=; b=KWvlgt7JMA83jEDIaVeaGY2g04llj TGljeKH7NnuXct8Xz/S65txSA3TEJckgsD8HYPGsXO6UxfXP4iKVoEO5nsn0BDrz wPPGBwrT8GlIb/wR7b9A78FmFUoujpMFBVFhSDJvbK93tlLnPTPVQQ82Kpg6HWWe 2atiQQaH/mgTk2KMdO9JGYokiU9yWrd/Kbv7VFuP48A/TmoNG22mTkh+GKQhiNtv Ln+kA8k/a0MKmENwaccB9ZUvzdnje3j+ZFI0EanNN13fRLZBpIRDszr0UcueocER Vy4laEz31IXsv1KvIEfd9jzOlLcz8QXvU7WYF/NVEt0mO+zHTRMTrkJqQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=PGTn8Twnbgmaks1cI0Z2hVd3EW77C7E3ceN7E2KcjHQ=; b=fSD4AdCr G12uCJvv7Aqru+hOoH9nKEdaPkDIQlz5T+8EAHhqrbMeiLfSzYb0QXccqik//0qf FaqxBKWQqElyRZrLztBycBgx77AmjR3VHbPOTTg3peBepVmEQJWlY8h6GX1A4wFl 3F4Vcu9j26GKofKNah5m7J8NYTHdhxpeYI7jWaSQ5cvBmZiRYb3NJSeFWHN+emVC dKRtQf0A0qMUL0RLGJF/jBDpt4YwSiuUuH46Gj8HXaTAUNCPz/+mMhISq62mz1Xd u59+dcp3eQlIgDdywOvHusXX2DGatw5G85nmkYa/N8QE7WNHMW3RxMTwDnmH8Uf3 yoYrb9+k8Y6zcg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudduuddgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpefhjefhud eujeekueelgffhtdejhfelueelhfehhfdttddvfeejieevfeelfffhvdenucffohhmrghi nhepfhhsfhdrohhrghdpghhnuhdrohhrghenucfkphepudektddrvdefhedrfedrheegne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepohdqthgr khgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ad003054.dynamic.ppp.asahi-net.or.jp [180.235.3.54]) by mail.messagingengine.com (Postfix) with ESMTPA id 4541630600A6; Fri, 21 Aug 2020 03:31:16 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de, perex@perex.cz Subject: [PATCH 01/25] efw-downloader: start a new project to operate on-board flash memory for Fireworks board module Date: Fri, 21 Aug 2020 16:30:47 +0900 Message-Id: <20200821073111.134857-2-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821073111.134857-1-o-takashi@sakamocchi.jp> References: <20200821073111.134857-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: ffado-devel@lists.sourceforge.net, alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Fireworks board module was designed by Echo Digital Audio corporation. The board module has on-board flash memory to store firmware blob and session data. The contents of flash memory can be operated by software by a pair of asynchronous transactions defined by Echo Digital Audio corporation. The firmware blob is used by below ICs: * Texus Instruments TSB43Cx43A (IceLynx Micro) * Texus Instruments TMS320C6713B (DSP) * Xilinx Spartan XC35250E (FPGA) All of Fireworks models use the IceLynx Micro for packet processing on IEEE 1394 bus. On the other hand, a part of the models use the DSP and the others use FPGA. The vendors of models ships several versions of a set of firmware. This project produces a command-line tool named as 'efw-downloader' to operate contents of on-board flash memory for firmware of the above ICs. This software is licensed under the GNU public license v3.0 or later. Meson build system is used to build the tool. Signed-off-by: Takashi Sakamoto --- efw-downloader/COPYING | 674 +++++++++++++++++++++++++++++++++ efw-downloader/meson.build | 10 + efw-downloader/src/main.c | 8 + efw-downloader/src/meson.build | 11 + 4 files changed, 703 insertions(+) create mode 100644 efw-downloader/COPYING create mode 100644 efw-downloader/meson.build create mode 100644 efw-downloader/src/main.c create mode 100644 efw-downloader/src/meson.build diff --git a/efw-downloader/COPYING b/efw-downloader/COPYING new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/efw-downloader/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/efw-downloader/meson.build b/efw-downloader/meson.build new file mode 100644 index 0000000..9664100 --- /dev/null +++ b/efw-downloader/meson.build @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright (c) 2020 Takashi Sakamoto + +project('efw-downloader', 'c', + version: '0.1.0', + license: 'GPL-3.0+', + meson_version: '>= 0.46.0', +) + +subdir('src') diff --git a/efw-downloader/src/main.c b/efw-downloader/src/main.c new file mode 100644 index 0000000..31ac349 --- /dev/null +++ b/efw-downloader/src/main.c @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Copyright (c) 2020 Takashi Sakamoto +#include + +int main(int argc, char **argv) +{ + return EXIT_SUCCESS; +} diff --git a/efw-downloader/src/meson.build b/efw-downloader/src/meson.build new file mode 100644 index 0000000..b837e92 --- /dev/null +++ b/efw-downloader/src/meson.build @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright (c) 2020 Takashi Sakamoto + +sources = [ + 'main.c', +] + +executable('efw-downloader', + sources: sources, + install: true, +) From patchwork Fri Aug 21 07:30:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 251348 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9CD7C433E1 for ; Fri, 21 Aug 2020 07:35:48 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 470062078D for ; Fri, 21 Aug 2020 07:35:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="UZi4J4no"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="GW+E40S7"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="oo1CzkwM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 470062078D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C2BF3846; Fri, 21 Aug 2020 09:34:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C2BF3846 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1597995346; bh=DXaP1tpGX1zKV+YxWs4LTpnx3JDNKUF7BR1fuoD633o=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=UZi4J4noCgkBTUvRJUhvAvYA7X2Hav5ngl51K2eC71EqMV8lXy/EdB40BQrt5TqtU Fk3r6ixskjGq9D4W1hHmMfE4294hecKRpBMPLdXrqEmw1mygUhTflnzKu2t0jkU9bi /ffWCqZLz+sIQezo86m6rhAL4FVo+62M7yLsuS+s= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id ACD9FF802FF; Fri, 21 Aug 2020 09:31:51 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6D412F8025A; Fri, 21 Aug 2020 09:31:41 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 68A44F80253 for ; Fri, 21 Aug 2020 09:31:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 68A44F80253 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="GW+E40S7"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="oo1CzkwM" Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 590ED310; Fri, 21 Aug 2020 03:31:24 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 21 Aug 2020 03:31:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=/XqfIqyu18uSn jcHyC2m9YLXcfLh7soh6af9AtUQNBo=; b=GW+E40S7AYviY+khl9tkkW6U/POe6 s7Y8Bn4ZjnGZb783QcfiFtyQs1NXXwcuwlsbJm9Hj3Mkst3CHdNFypP8MvHbD8I9 ZXPBJNWMoDdo1yDtPlFirHPabMfVOPBOsHQwBIrJ+RGLIkf6XFGLR2PCMg3P6b3T SJaGIvonUu5Wc8jDFcW8CPdEWOBnBRKWGoZHPJWCERT6QeFXQTxVJN28ewUcj3gv OKc69Pmpm1JdoW+eRwbnfQ5PhET7GI7R5iH2QwjnNK3tuNXN3a3zh+lR1Xi1kF2j H+LTjFz/rzIdyr3BSHidfLlTwzBkIqYn62FrRk3LoD2DsiHl3ZKiBr8Hg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=/XqfIqyu18uSnjcHyC2m9YLXcfLh7soh6af9AtUQNBo=; b=oo1CzkwM EbdFzUcSf2urR1K4WB8epIV7QVU8tEUh/39hASdKh3INQtPGvowbPrw/Ip6+MV54 /468h8g/5D6lHUvC06QsLXV9JLs/Hh9gmWuyICwVIG41IZ7k5HxTMSYEOf9Slsjr KwJ/PK+7+tSy8lWMfOUgWscWIR2B46+dMG4iWwiIp++muVdb4Ji5mW6oTduZsWjx FWDqnsFQYfhotiece5diB1wPU+5oyXNp2b7ifFUbaXxHMwjAUcJuNfHbFRTbT1Df w5DaufgKMZO/wpeJevHPj5v+uARnIQoc6OiidPd26HQ5l5iYtnXWyB8LO5vL/TNv OT4X2hL1ceQimg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudduuddgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucfkphepudek tddrvdefhedrfedrheegnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrg hilhhfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ad003054.dynamic.ppp.asahi-net.or.jp [180.235.3.54]) by mail.messagingengine.com (Postfix) with ESMTPA id A171530600DC; Fri, 21 Aug 2020 03:31:22 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de, perex@perex.cz Subject: [PATCH 05/25] efw-downloader: efw-proto: add class virtual method to handle responded signal Date: Fri, 21 Aug 2020 16:30:51 +0900 Message-Id: <20200821073111.134857-6-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821073111.134857-1-o-takashi@sakamocchi.jp> References: <20200821073111.134857-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: ffado-devel@lists.sourceforge.net, alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" GObject allows applications to override class virtual method with own method implementation in inheritance. This commit adds the class virtual method to handle 'responded' signal added in the former commit. Signed-off-by: Takashi Sakamoto --- efw-downloader/src/efw-proto.c | 2 +- efw-downloader/src/efw-proto.h | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/efw-downloader/src/efw-proto.c b/efw-downloader/src/efw-proto.c index 6502957..72b7655 100644 --- a/efw-downloader/src/efw-proto.c +++ b/efw-downloader/src/efw-proto.c @@ -60,7 +60,7 @@ static void efw_proto_class_init(EfwProtoClass *klass) g_signal_new("responded", G_OBJECT_CLASS_TYPE(klass), G_SIGNAL_RUN_LAST, - 0, + G_STRUCT_OFFSET(EfwProtoClass, responded), NULL, NULL, efw_proto_sigs_marshal_VOID__ENUM_UINT_UINT_UINT_POINTER_UINT, G_TYPE_NONE, diff --git a/efw-downloader/src/efw-proto.h b/efw-downloader/src/efw-proto.h index fbd4366..fdbcbc8 100644 --- a/efw-downloader/src/efw-proto.h +++ b/efw-downloader/src/efw-proto.h @@ -34,6 +34,24 @@ struct _EfwProto { struct _EfwProtoClass { HinawaFwRespClass parent_class; + + /** + * EfwProtoClass::responded: + * @self: A #EfwProto. + * @status: One of #HinawaSndEfwStatus. + * @seqnum: The sequence number of response. + * @category: The value of category field in the response. + * @command: The value of command field in the response. + * @frame: (array length=frame_size)(element-type guint32): The array with elements for + * quadlet data of response for Echo Fireworks protocol. + * @frame_size: The number of elements of the array. + * + * When the unit transfers asynchronous packet as response for Fireworks protocol, and the + * process successfully reads the content of response from ALSA Fireworks driver, the + * #EfwProto::responded signal handler is called with parameters of the response. + */ + void (*responded)(EfwProto *self, HinawaSndEfwStatus status, guint seqnum, + guint category, guint command, const guint32 *frame, guint frame_size); }; EfwProto *efw_proto_new(); From patchwork Fri Aug 21 07:30:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 251349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6EE1C433E1 for ; Fri, 21 Aug 2020 07:34:50 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2CA9F207DF for ; Fri, 21 Aug 2020 07:34:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="r7o0OIdz"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="NvyF0vRd"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="j0kiJ2uT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2CA9F207DF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 96DE91684; Fri, 21 Aug 2020 09:33:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 96DE91684 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1597995288; bh=eZaL1CatvTHWznqV742+LRhjRj4c5Mbt5WbqdEvo2Ck=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=r7o0OIdzMxGatkdJdguCrA/lvx61ZvJltW3rmKNKKhOat8RCa49fEQ+3gCET8nrWZ b+rUi1SnTi5RPP54LXTnz42ksxph8NoSXthBiyCVBri/UYeEl3jRByMzyPpyDFIQcM YdNRkU6nHjl/0hTxj2lpwVNIOOzvG709fj+aYRBg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D4753F802EA; Fri, 21 Aug 2020 09:31:44 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 199E1F802E9; Fri, 21 Aug 2020 09:31:41 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 72F36F80255 for ; Fri, 21 Aug 2020 09:31:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 72F36F80255 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="NvyF0vRd"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="j0kiJ2uT" Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 1D2BB338; Fri, 21 Aug 2020 03:31:26 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 21 Aug 2020 03:31:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=fA4cTsRV7fXvW LR7nLE/higt9EkmbireVuRQmBQEbV4=; b=NvyF0vRdyXSuFEmPsGN11VdEKQ2NB IGG31bfxGTP3iMtQxdfjlsrA6hcYk1IW+zWWetE5MdV+zN3yHTZ/bwX+4bFR/hzQ QRLu3maGFi+nJKn49lM7Chwu7w7UYrd082nIGzwV+6D0eakvmSaDhSS7xsV5KEIl GwO0llumUe7lC65Q/xbgvone0oRoJlQ6MwvcorRtym8DcOIFo+s5h2XqbjIIRVyG CzADA7q5uuZVe+L/5diKeFxxieBNzK+dor3xlqx6JJesvzCNSADLCIChoSQI3Oys PjP25kJl560IjjI0ptd60Tz70WwqF1xS6Y81CH0oxpziJRU+xCvZh9DDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=fA4cTsRV7fXvWLR7nLE/higt9EkmbireVuRQmBQEbV4=; b=j0kiJ2uT xNyfTfcJMfMBp9qm4S2K+nTufOKzpEeqEuVfgMwe0nDnq11p9QhQesY4p99EsjrY 0BvahsEZJ6+M15P8KRBzD7O8Jfg9NK/L2H2mWXJwJDpWBdB3RnyI8lcQoO+dq3S3 U3Jp92SnJaWjZNzD6chQP10QrM+utnLasHFImrUvyxeIRzeRmFVnV36SON6Y/CNx Nml/33CwKmjGOoZUrCXlC7P+I9Tqtuez+lcR++dc6yU6+hWXatdmR6paIoFqBWyF gsPsAt0x8n/uYY+oUt1dnYIGTZtTjeEpW3WbSjEiSBJDVAkeJ9rveVGwvXAU7JRu ffGCw420rto63A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudduuddgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucfkphepudek tddrvdefhedrfedrheegnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrg hilhhfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ad003054.dynamic.ppp.asahi-net.or.jp [180.235.3.54]) by mail.messagingengine.com (Postfix) with ESMTPA id 3BF2330600B4; Fri, 21 Aug 2020 03:31:23 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de, perex@perex.cz Subject: [PATCH 06/25] efw-downloader: efw-proto: add instance private structure Date: Fri, 21 Aug 2020 16:30:52 +0900 Message-Id: <20200821073111.134857-7-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821073111.134857-1-o-takashi@sakamocchi.jp> References: <20200821073111.134857-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: ffado-devel@lists.sourceforge.net, alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" GObject allows instance to have private data. This commit adds private structure to EfwProto instance. Signed-off-by: Takashi Sakamoto --- efw-downloader/src/efw-proto.c | 17 ++++++++++++++++- efw-downloader/src/efw-proto.h | 3 +++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/efw-downloader/src/efw-proto.c b/efw-downloader/src/efw-proto.c index 72b7655..72959ac 100644 --- a/efw-downloader/src/efw-proto.c +++ b/efw-downloader/src/efw-proto.c @@ -15,7 +15,10 @@ * command to a certain address region on 1394 OHCI controller. The instance of #EfwProto reserves * the address region at call of #efw_proto_bind(), releases at call of #efw_proto_unbind(). */ -G_DEFINE_TYPE(EfwProto, efw_proto, HINAWA_TYPE_FW_RESP) +struct _EfwProtoPrivate { + guint32 *buf; +}; +G_DEFINE_TYPE_WITH_PRIVATE(EfwProto, efw_proto, HINAWA_TYPE_FW_RESP) #define EFW_RESP_ADDR 0xecc080000000ull #define EFW_MAX_FRAME_SIZE 0x200u @@ -94,9 +97,16 @@ EfwProto *efw_proto_new() */ void efw_proto_bind(EfwProto *self, HinawaFwNode *node, GError **error) { + EfwProtoPrivate *priv; + g_return_if_fail(EFW_IS_PROTO(self)); + priv = efw_proto_get_instance_private(self); hinawa_fw_resp_reserve(HINAWA_FW_RESP(self), node, EFW_RESP_ADDR, EFW_MAX_FRAME_SIZE, error); + if (*error != NULL) + return; + + priv->buf = g_malloc0(EFW_MAX_FRAME_SIZE); } /** @@ -107,7 +117,12 @@ void efw_proto_bind(EfwProto *self, HinawaFwNode *node, GError **error) */ void efw_proto_unbind(EfwProto *self) { + EfwProtoPrivate *priv; + g_return_if_fail(EFW_IS_PROTO(self)); + priv = efw_proto_get_instance_private(self); hinawa_fw_resp_release(HINAWA_FW_RESP(self)); + + g_free(priv->buf); } diff --git a/efw-downloader/src/efw-proto.h b/efw-downloader/src/efw-proto.h index fdbcbc8..bc179dc 100644 --- a/efw-downloader/src/efw-proto.h +++ b/efw-downloader/src/efw-proto.h @@ -27,9 +27,12 @@ G_BEGIN_DECLS typedef struct _EfwProto EfwProto; typedef struct _EfwProtoClass EfwProtoClass; +typedef struct _EfwProtoPrivate EfwProtoPrivate; struct _EfwProto { HinawaFwResp parent_instance; + + EfwProtoPrivate *priv; }; struct _EfwProtoClass { From patchwork Fri Aug 21 07:30:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 251347 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1BB4C433DF for ; Fri, 21 Aug 2020 07:36:43 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6BBF22087D for ; Fri, 21 Aug 2020 07:36:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="X4dmVD3M"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="B8wYT3eY"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="nRY9f26B" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6BBF22087D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id D517D844; Fri, 21 Aug 2020 09:35:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D517D844 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1597995401; bh=1FNxYcdaZ2MqbmSfb6XXlvjUmLr5I0McuKwPUpDAQ68=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=X4dmVD3My4y+KfE8ftZcJC2EU03qxdDR/si45ZFn0hrehGWC8RO/+F9PFuoEtOuDf MHNIjZOrGyalxew2Hzh8eXnVGo8Z+oaX2e2wlB0A0glnI8n8D+W58CjG71uBdJdkk7 yV44n+vojr0wg8ABFdJKZ/1KiUv//l01H5s3YZKE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 31974F80315; Fri, 21 Aug 2020 09:31:56 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BEB30F802F9; Fri, 21 Aug 2020 09:31:45 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 65FBBF80260 for ; Fri, 21 Aug 2020 09:31:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 65FBBF80260 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="B8wYT3eY"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="nRY9f26B" Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id A29B22E3; Fri, 21 Aug 2020 03:31:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 21 Aug 2020 03:31:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=CO1en39JIi6Uz AIoH2m+sP93P2k6nrsw1RLmt6kL1wY=; b=B8wYT3eYpaxIukigq8St4HKqRL/qM Ie1+EwmgzTbvejof6UdtHHDdLxpeHaziBfUM6WHvsDZMrf1bGgmwtZ09AYxnsTG4 NdziSwLkiyQEEjPuLIDT8THtBUvbpq4Y+Cl92O1fGUfHow3kRS/oJhAP/aRlw6HP iZ3nr1AjAnGL58+vFg0+sFEpVllyg9Ej/BnVjOzu2ZcBg+r057fSucT1ywEm/k51 M5J0ldcd/J3xQsdX/HQ2w8LTEsVEllk9/qqxLYOyTcJdSImFhxCO6KWE/0cJDlyJ ZUQ4S6nZ3WZ/x7ALhoVX1ZL1nCLefhJb3pz4WwdKY6ZXZBNhce+YsZ4ug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=CO1en39JIi6UzAIoH2m+sP93P2k6nrsw1RLmt6kL1wY=; b=nRY9f26B 3KrbdBHdoxGZNc3ZZC7cXW7sAlrzBptzYZl6/p3QIFoBC4btwxzV4G3lICSt1bl2 FpiOkg/Rw8b+mgXtR7ZTUV+gpKoOMLY8FjB76xDR4fVmrexagKBvyQ7NPmN391Vd Dh2/6VtXHD2zhpaTOSl8ZTZp6jao10mSLodbtMoZZT3DfgDuIJb/hCx1glGvk5bu l+2BUlsSng/f5U2/qm9iRc1lOxOruSjcfw4Fx33cj7UK2QT79SxbTWH3vw0vqqpZ NI7t/HEEukdSL8PtTwNrJfCpcxEOvEwBUc+xbJt2Lu8aZyM/acx2AeJV1X16lhkn +4WaCXLhyFVdQQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudduuddgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucfkphepudek tddrvdefhedrfedrheegnecuvehluhhsthgvrhfuihiivgepheenucfrrghrrghmpehmrg hilhhfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ad003054.dynamic.ppp.asahi-net.or.jp [180.235.3.54]) by mail.messagingengine.com (Postfix) with ESMTPA id EAAA830600B1; Fri, 21 Aug 2020 03:31:25 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de, perex@perex.cz Subject: [PATCH 07/25] efw-downloader: efw-proto: emit responded signal at receiving response Date: Fri, 21 Aug 2020 16:30:53 +0900 Message-Id: <20200821073111.134857-8-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821073111.134857-1-o-takashi@sakamocchi.jp> References: <20200821073111.134857-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: ffado-devel@lists.sourceforge.net, alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" HinawaFwResp has class virtual method for applications to handle received frame on 1394 OHCI controller by overriding the method with own function implementation. This commit overrides the class virtual method and emits 'responded' signal with the data of received response frame. The content of frame is aligned to host-endianness, then passed to signal handlers. Signed-off-by: Takashi Sakamoto --- efw-downloader/src/efw-proto.c | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/efw-downloader/src/efw-proto.c b/efw-downloader/src/efw-proto.c index 72959ac..bef81b3 100644 --- a/efw-downloader/src/efw-proto.c +++ b/efw-downloader/src/efw-proto.c @@ -3,6 +3,8 @@ #include "efw-proto.h" #include "efw-proto-sigs-marshal.h" +#include + /** * SECTION:efw_proto * @Title: EfwProto @@ -38,12 +40,16 @@ static void proto_finalize(GObject *obj) G_OBJECT_CLASS(efw_proto_parent_class)->finalize(obj); } +static HinawaFwRcode proto_handle_response(HinawaFwResp *resp, HinawaFwTcode tcode); + static void efw_proto_class_init(EfwProtoClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS(klass); gobject_class->finalize = proto_finalize; + HINAWA_FW_RESP_CLASS(klass)->requested = proto_handle_response; + /** * EfwProto::responded: * @self: A #EfwProto. @@ -126,3 +132,40 @@ void efw_proto_unbind(EfwProto *self) g_free(priv->buf); } + +static HinawaFwRcode proto_handle_response(HinawaFwResp *resp, HinawaFwTcode tcode) +{ + EfwProto *self = EFW_PROTO(resp); + EfwProtoPrivate *priv = efw_proto_get_instance_private(self); + const guint8 *req_frame = NULL; + gsize length = 0; + const struct snd_efw_transaction *frame; + guint status; + guint seqnum; + guint category; + guint command; + guint param_count; + int i; + + hinawa_fw_resp_get_req_frame(resp, &req_frame, &length); + if (length < sizeof(*frame)) + return HINAWA_FW_RCODE_DATA_ERROR; + frame = (const struct snd_efw_transaction *)req_frame; + + status = GUINT32_FROM_BE(frame->status); + if (status > HINAWA_SND_EFW_STATUS_BAD_PARAMETER) + status = HINAWA_SND_EFW_STATUS_BAD; + + seqnum = GUINT32_FROM_BE(frame->seqnum); + category = GUINT32_FROM_BE(frame->category); + command = GUINT32_FROM_BE(frame->command); + param_count = GUINT32_FROM_BE(frame->length) - sizeof(*frame) / sizeof(guint32); + + for (i = 0; i < param_count; ++i) + priv->buf[i] = GUINT32_FROM_BE(frame->params[i]); + + g_signal_emit(self, efw_proto_sigs[EFW_PROTO_SIG_TYPE_RESPONDED], 0, + status, seqnum, category, command, priv->buf, param_count); + + return HINAWA_FW_RCODE_COMPLETE; +} From patchwork Fri Aug 21 07:30:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 251345 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1899C433DF for ; Fri, 21 Aug 2020 07:39:04 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 74E7F2078D for ; Fri, 21 Aug 2020 07:39:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="cOcdt9re"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="FcD/Hq7E"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="aWbF0+gK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74E7F2078D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E0CF81670; Fri, 21 Aug 2020 09:38:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E0CF81670 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1597995543; bh=epR7CdKBZXBADdEE9REyiu7QqwCEY2gX6F329SgrVwM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=cOcdt9ret7X4uZpYdn+BM6ybeQkY82Rlsfgq4EAEnBi9P1rdyAdAW49oJhOdSrBgS Liqg2+U+pIYbsYMoDE4i/XohvXY6pm9oU6VtSWgPB+LSESWihpn5JT0zkts9gmD3rn cMbc0TpoE5jaye/XapR3DRvgFGS0IC9TEq+MhFYc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AA102F80338; Fri, 21 Aug 2020 09:32:05 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DC862F802DD; Fri, 21 Aug 2020 09:31:49 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9A3C1F802C2 for ; Fri, 21 Aug 2020 09:31:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9A3C1F802C2 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="FcD/Hq7E"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="aWbF0+gK" Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id B246B880; Fri, 21 Aug 2020 03:31:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 21 Aug 2020 03:31:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=k7p0I/ezfZWct IEf1zoQCaRp1KXbmMCKv61+Y5rS6fc=; b=FcD/Hq7Ee75//GOkmL+Up0Yc+pdsv rXVFBrH81I+oGDOpvB4IYwA9bxhMkMcDNLSQ71iaxrnMeGD/kWrbkmWruz+PnlcF yxKNOFXFozbw4cTCM6kH7GVzI/Xhn/aZTSiRnomvu0A+Sok/CbI4pRbQEwv33hVI IvBmwN45e9xmdLaqyAGjwqzt0IZiRTtMF7aSskjWn014H0kL7ni9DfDDGaRIvtra /ISqVMahrD6enMj0azOGmGHpOrsxImfDAyI6wCOT2cCOfW+6eEn+6V835p9pGv1M UmHorCDu6HD2oVjO6mPG+weAPvcN2FZgKish05Z23QI2zshUOxm9KLEtg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=k7p0I/ezfZWctIEf1zoQCaRp1KXbmMCKv61+Y5rS6fc=; b=aWbF0+gK w6Csdq7E/2Sv44fENXkRpzDI8mFiZxUAnfmWvfdIsLB2IYxPFQfHKOP5sOqb+fqa cmxsn6XUxGoOXFsvvhOH+1vkdMl8oNj6IwoCkpa3JhRfycYe+hCF1E/vYQRKMUBb B5M3JiVqlRTSZ11xDhbViNQsqCHyfJDsXJchkJMGmtq5rvzrFHUOjTYpXc6O/Rm9 9OjHLJ2/RPbPzZL1giBTynjTQgNcbyWmQ+grBNLMuuuH5FcNWMDncabfC7oS1MNu 0ZoVeWnrzdVruTfSz6qy4FrxxaTCYiy+bA5djc+n3k8q+UIf5jOUPN/lbfK40Hon fEuEGQmYIbVjZQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudduuddgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucfkphepudek tddrvdefhedrfedrheegnecuvehluhhsthgvrhfuihiivgepheenucfrrghrrghmpehmrg hilhhfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ad003054.dynamic.ppp.asahi-net.or.jp [180.235.3.54]) by mail.messagingengine.com (Postfix) with ESMTPA id 2D2D630600B7; Fri, 21 Aug 2020 03:31:28 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de, perex@perex.cz Subject: [PATCH 09/25] efw-downloader: efw-proto: add function to finish a pair of transactions Date: Fri, 21 Aug 2020 16:30:55 +0900 Message-Id: <20200821073111.134857-10-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821073111.134857-1-o-takashi@sakamocchi.jp> References: <20200821073111.134857-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: ffado-devel@lists.sourceforge.net, alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" In Fireworks protocol, the target device increments sequence number in command frame transferred by software, then transfers response frame with the number so that software can correspond the response frame to the command frame. This commit adds function to finish the pair of transactions for command and response frames. The frames are matched according to sequence number. Signed-off-by: Takashi Sakamoto --- efw-downloader/src/efw-proto.c | 146 +++++++++++++++++++++++++++++++++ efw-downloader/src/efw-proto.h | 9 ++ 2 files changed, 155 insertions(+) diff --git a/efw-downloader/src/efw-proto.c b/efw-downloader/src/efw-proto.c index cb8dad1..f8c1d88 100644 --- a/efw-downloader/src/efw-proto.c +++ b/efw-downloader/src/efw-proto.c @@ -27,6 +27,15 @@ struct _EfwProtoPrivate { }; G_DEFINE_TYPE_WITH_PRIVATE(EfwProto, efw_proto, HINAWA_TYPE_FW_RESP) +/** + * efw_proto_error_quark: + * + * Return the GQuark for error domain of GError which has code in #HinawaSndEfwStatus. + * + * Returns: A #GQuark. + */ +G_DEFINE_QUARK(efw-proto-error-quark, efw_proto_error) + #define EFW_CMD_ADDR 0xecc000000000ull #define EFW_RESP_ADDR 0xecc080000000ull #define EFW_MAX_FRAME_SIZE 0x200u @@ -217,6 +226,143 @@ void efw_proto_command(EfwProto *self, guint category, guint command, g_free(frame); } +struct waiter { + guint32 seqnum; + + guint32 category; + guint32 command; + HinawaSndEfwStatus status; + guint32 *params; + gsize param_count; + + GCond cond; + GMutex mutex; +}; + +static void handle_responded_signal(EfwProto *self, HinawaSndEfwStatus status, guint32 seqnum, + guint category, guint command, + const guint32 *params, guint32 param_count, gpointer user_data) +{ + struct waiter *w = (struct waiter *)user_data; + + if (seqnum == w->seqnum) { + g_mutex_lock(&w->mutex); + + if (category != w->category || command != w->command) + status = HINAWA_SND_EFW_STATUS_BAD; + w->status = status; + + if (param_count > 0 && param_count <= w->param_count) + memcpy(w->params, params, param_count * sizeof(*params)); + w->param_count = param_count; + + g_cond_signal(&w->cond); + + g_mutex_unlock(&w->mutex); + } +} + +static const char *const err_msgs[] = { + [HINAWA_SND_EFW_STATUS_OK] = "The transaction finishes successfully", + [HINAWA_SND_EFW_STATUS_BAD] = "The request or response includes invalid header", + [HINAWA_SND_EFW_STATUS_BAD_COMMAND] = "The request includes invalid category or command", + [HINAWA_SND_EFW_STATUS_COMM_ERR] = "The transaction fails due to communication error", + [HINAWA_SND_EFW_STATUS_BAD_QUAD_COUNT] = "The number of quadlets in transaction is invalid", + [HINAWA_SND_EFW_STATUS_UNSUPPORTED] = "The request is not supported", + [HINAWA_SND_EFW_STATUS_TIMEOUT] = "The transaction is canceled due to response timeout", + [HINAWA_SND_EFW_STATUS_DSP_TIMEOUT] = "The operation for DSP did not finish within timeout", + [HINAWA_SND_EFW_STATUS_BAD_RATE] = "The request includes invalid value for sampling frequency", + [HINAWA_SND_EFW_STATUS_BAD_CLOCK] = "The request includes invalid value for source of clock", + [HINAWA_SND_EFW_STATUS_BAD_CHANNEL] = "The request includes invalid value for the number of channel", + [HINAWA_SND_EFW_STATUS_BAD_PAN] = "The request includes invalid value for panning", + [HINAWA_SND_EFW_STATUS_FLASH_BUSY] = "The on-board flash is busy and not operable", + [HINAWA_SND_EFW_STATUS_BAD_MIRROR] = "The request includes invalid value for mirroring channel", + [HINAWA_SND_EFW_STATUS_BAD_LED] = "The request includes invalid value for LED", + [HINAWA_SND_EFW_STATUS_BAD_PARAMETER] = "The request includes invalid value of parameter", + [HINAWA_SND_EFW_STATUS_LARGE_RESP] = "The size of response is larger than expected", +}; + +#define generate_error(error, code) \ + g_set_error_literal(error, EFW_PROTO_ERROR, code, err_msgs[code]) + +/** + * efw_proto_transaction: + * @self: A #EfwProto. + * @category: One of category for the transaction. + * @command: One of category for the transaction. + * @args: (array length=arg_count)(nullable): An array with elements for quadlet data as arguments + * for command. + * @arg_count: The number of quadlets in the args array. + * @params: (array length=param_count)(inout)(nullable): An array with elements for quadlet data to + * save parameters in response frame. + * @param_count: The number of quadlets in the params array. + * @timeout_ms: The timeout to wait for response of the transaction since request is initiated, in + * milliseconds. + * @error: A #GError. Error can be generated with two domains of #hinawa_fw_node_error_quark(), + * #hinawa_fw_req_error_quark(), and #efw_proto_error_quark(). + * + * Transfer asynchronous transaction for command frame of Fireworks protocol. When receiving + * asynchronous transaction for response frame, #EfwProto::responded GObject signal is emitted. + */ +void efw_proto_transaction(EfwProto *self, guint category, guint command, + const guint32 *args, gsize arg_count, + guint32 *const *params, gsize *param_count, + guint timeout_ms, GError **error) +{ + gulong handler_id; + struct waiter w; + guint64 expiration; + + g_return_if_fail(EFW_IS_PROTO(self)); + g_return_if_fail(param_count != NULL); + g_return_if_fail(error == NULL || *error == NULL); + + // This predicates against suprious wakeup. + w.status = 0xffffffff; + w.category = category; + w.command = command; + if (*param_count > 0) + w.params = *params; + else + w.params = NULL; + w.param_count = *param_count; + g_cond_init(&w.cond); + g_mutex_init(&w.mutex); + + handler_id = g_signal_connect(self, "responded", (GCallback)handle_responded_signal, &w); + + // Timeout is set in advance as a parameter of this object. + expiration = g_get_monotonic_time() + timeout_ms * G_TIME_SPAN_MILLISECOND; + + efw_proto_command(self, category, command, args, arg_count, &w.seqnum, error); + if (*error != NULL) { + g_signal_handler_disconnect(self, handler_id); + goto end; + } + + g_mutex_lock(&w.mutex); + while (w.status == 0xffffffff) { + // Wait for a response with timeout, waken by the response handler. + if (!g_cond_wait_until(&w.cond, &w.mutex, expiration)) + break; + } + g_signal_handler_disconnect(self, handler_id); + g_mutex_unlock(&w.mutex); + + if (w.status == 0xffffffff) + generate_error(error, HINAWA_SND_EFW_STATUS_TIMEOUT); + else if (w.status != HINAWA_SND_EFW_STATUS_OK) + generate_error(error, w.status); + else if (w.param_count > *param_count) + generate_error(error, HINAWA_SND_EFW_STATUS_LARGE_RESP); + else + *param_count = w.param_count; +end: + g_cond_clear(&w.cond); + g_mutex_clear(&w.mutex); +} + + static HinawaFwRcode proto_handle_response(HinawaFwResp *resp, HinawaFwTcode tcode) { EfwProto *self = EFW_PROTO(resp); diff --git a/efw-downloader/src/efw-proto.h b/efw-downloader/src/efw-proto.h index 94f4a94..0b700a8 100644 --- a/efw-downloader/src/efw-proto.h +++ b/efw-downloader/src/efw-proto.h @@ -57,6 +57,10 @@ struct _EfwProtoClass { guint category, guint command, const guint32 *frame, guint frame_size); }; +#define EFW_PROTO_ERROR efw_proto_error_quark() + +GQuark efw_proto_error_quark(); + EfwProto *efw_proto_new(); void efw_proto_bind(EfwProto *self, HinawaFwNode *node, GError **error); @@ -66,6 +70,11 @@ void efw_proto_command(EfwProto *self, guint category, guint command, const guint32 *args, gsize arg_count, guint32 *resp_seqnum, GError **exception); +void efw_proto_transaction(EfwProto *self, guint category, guint command, + const guint32 *args, gsize arg_count, + guint32 *const *params, gsize *param_count, + guint timeout_ms, GError **error); + G_END_DECLS #endif From patchwork Fri Aug 21 07:30:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 251346 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB206C433DF for ; Fri, 21 Aug 2020 07:38:06 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4157F207DF for ; Fri, 21 Aug 2020 07:38:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="pJBqli02"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="ArKOieeD"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="M+HstCdl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4157F207DF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C01A9166F; Fri, 21 Aug 2020 09:37:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C01A9166F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1597995484; bh=JvandNNP245hzJHkq7tZRYkB6WPc6xjhvjL517RrU9g=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=pJBqli02rj8pbcwwlG0slGMdvWrEmxk6W6WBlkTd6otCL92TXTz3KVc1v4myDySIq nWyJgn5643e+pXODIdo+SRBuKGLZLLn72sdE8ZPxvqvuV3p7Up4aGKM7wdccx5KGtY le3iRqO4Y0vlMG0VvL9qhOdUycdLQp0CCWaRHVYw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D061BF8032A; Fri, 21 Aug 2020 09:32:01 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3415BF802DD; Fri, 21 Aug 2020 09:31:49 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 569AEF802DD for ; Fri, 21 Aug 2020 09:31:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 569AEF802DD Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="ArKOieeD"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="M+HstCdl" Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 87F0E89D; Fri, 21 Aug 2020 03:31:35 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 21 Aug 2020 03:31:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=nCeOuln1DQD8W hM5ui/6o3n/TLutmQMHIgbn/AwpBX8=; b=ArKOieeDXhGrykTrk76UZR9P//hbU S5lOJIfoKX7aNC0T9nwnNSx44d3NN6BP+33/ZN+jQkAD0AhK/XKX48sdrIC8Dv0V g2NN6C9Rs6qsv2klnf+JfMoOEKCrn6nzHyM1dF/Sh5z2dBcoIGXAC2JYCJXgnVUd zqEXDrlJbA2ewJcpeatIfHtqkZC2ovV1mu8uuk8PD2XrLCsqhTdmW5fIjE0yGXM0 SrLV5z2Ayx7sscNvIVERxOmEZFv5bB/3iym6acRVxyl4fsu/R5kI9HYvvyDHB+bk iEltHmDVzxgGr/2UioTMH2r+36NFUHCOGZsFh2yXUcLUlLc+R1E+yAZuQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=nCeOuln1DQD8WhM5ui/6o3n/TLutmQMHIgbn/AwpBX8=; b=M+HstCdl 529xK2yDkX3AAnH0Td6I5X1YnHVS6u6axj5JO5MK67Qnt8lXj5OjT49zZXi02i7r wP9He2RM6l43TJglCibW+1S2p9AeuJaE7/xcnddkp+39VvkgZwL4na+uSkEr7QdD M0jvLwqOjgCQhdrQDZdp2P3mJnP+Lt5x77kZ9LAxRpJfcAeHtd0Kz4JPtpUPH0fH QoM2+iueGuDKEXNHdmtrhX1Z2ZkH9B0L8pg98wwwvvbE1QePUfm4lc5L+pJBm4BU BnI07RfL9RfDi79QI/7btuD4JGMXrHB5RrErXkTO791LawRWwFTI54+jnWQkBJfl dR6WpewIBIR6tQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudduuddgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucfkphepudek tddrvdefhedrfedrheegnecuvehluhhsthgvrhfuihiivgepkeenucfrrghrrghmpehmrg hilhhfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ad003054.dynamic.ppp.asahi-net.or.jp [180.235.3.54]) by mail.messagingengine.com (Postfix) with ESMTPA id A42653060272; Fri, 21 Aug 2020 03:31:33 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de, perex@perex.cz Subject: [PATCH 11/25] efw-downloader: subcmd-device: implement 'device' sub command to operate actual device Date: Fri, 21 Aug 2020 16:30:57 +0900 Message-Id: <20200821073111.134857-12-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821073111.134857-1-o-takashi@sakamocchi.jp> References: <20200821073111.134857-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: ffado-devel@lists.sourceforge.net, alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This commit implements 'device' sub command to operate the target device. This sub command consists of several operations and parser for the operation will be implemented in future commits. Signed-off-by: Takashi Sakamoto --- efw-downloader/src/main.c | 4 ++ efw-downloader/src/meson.build | 2 + efw-downloader/src/subcmd-device.c | 77 ++++++++++++++++++++++++++++++ efw-downloader/src/subcmds.h | 8 ++++ 4 files changed, 91 insertions(+) create mode 100644 efw-downloader/src/subcmd-device.c create mode 100644 efw-downloader/src/subcmds.h diff --git a/efw-downloader/src/main.c b/efw-downloader/src/main.c index 499e67e..e150cc8 100644 --- a/efw-downloader/src/main.c +++ b/efw-downloader/src/main.c @@ -4,6 +4,8 @@ #include #include +#include "subcmds.h" + static void print_help() { printf("Usage\n" @@ -11,6 +13,7 @@ static void print_help() "\n" "where:\n" " SUBCOMMAND:\n" + " device: operate for device for unit on IEEE 1394 bus\n" " help: print help\n" " OPTIONS: optional arguments dependent on the subcommand\n"); } @@ -22,6 +25,7 @@ int main(int argc, char **argv) size_t size; int (*op)(int argc, char **argv); } *entry, entries[] = { + { "device", sizeof("device"), subcmd_device }, }; const char *subcmd; int i; diff --git a/efw-downloader/src/meson.build b/efw-downloader/src/meson.build index ca894d9..07a6182 100644 --- a/efw-downloader/src/meson.build +++ b/efw-downloader/src/meson.build @@ -14,10 +14,12 @@ hinawa = dependency('hinawa', sources = [ 'main.c', 'efw-proto.c', + 'subcmd-device.c', ] headers = [ 'efw-proto.h', + 'subcmds.h', ] gnome = import('gnome') diff --git a/efw-downloader/src/subcmd-device.c b/efw-downloader/src/subcmd-device.c new file mode 100644 index 0000000..739944e --- /dev/null +++ b/efw-downloader/src/subcmd-device.c @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Copyright (c) 2020 Takashi Sakamoto +#include +#include +#include +#include + +#include "efw-proto.h" + +static int print_help() +{ + printf("Usage\n" + " efw-downloader device CDEV OPERATION ARGUMENTS\n" + "\n" + "where:\n" + " CDEV: The firewire character device corresponding to the node for transaction\n" + " OPERATION:\n" + " help: print this help message\n" + " ARGUMENTS:\n" + " depending on OPERATION\n" + "\n"); + return EXIT_FAILURE; +} + +static int parse_args(int argc, char **argv, const char **path, const char **op_name) +{ + if (argc < 2) + return -EINVAL; + assert(strncmp(argv[1], "device", sizeof("device")) == 0); + + if (argc < 3) + return -EINVAL; + *path = argv[2]; + + if (argc < 4) + return -EINVAL; + *op_name = argv[3]; + + return 0; +} + +int subcmd_device(int argc, char **argv) +{ + struct { + const char *name; + size_t size; + void (*op)(int argc, char **argv, EfwProto *proto, GError **error); + } *entry, entries[] = { + }; + GError *error = NULL; + const char *path; + const char *op_name; + EfwProto *proto; + int err; + int i; + + err = parse_args(argc, argv, &path, &op_name); + if (err < 0) + return print_help(0, NULL, NULL, NULL); + + for (i = 0; i < G_N_ELEMENTS(entries); ++i) { + entry = entries + i; + if (strncmp(op_name, entry->name, entry->size) == 0) + break; + } + if (i == G_N_ELEMENTS(entries)) + return print_help(); + + entry->op(argc, argv, proto, &error); + + if (error != NULL) { + g_clear_error(&error); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/efw-downloader/src/subcmds.h b/efw-downloader/src/subcmds.h new file mode 100644 index 0000000..f10c420 --- /dev/null +++ b/efw-downloader/src/subcmds.h @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Copyright (c) 2020 Takashi Sakamoto +#ifndef __SUBCMDS_H__ +#define __SUBCMDS_H__ + +int subcmd_device(int argc, char **argv); + +#endif From patchwork Fri Aug 21 07:31:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 251343 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F5DDC433DF for ; Fri, 21 Aug 2020 07:41:33 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 140302078D for ; Fri, 21 Aug 2020 07:41:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="QXx8Wq8S"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="OUlZJHhi"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="IkHv2Ous" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 140302078D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A08191698; Fri, 21 Aug 2020 09:40:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A08191698 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1597995691; bh=iLpf9j3bHT8tVO3YogU0k313skhdEyHAAGgtsoCaLYU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QXx8Wq8SFxfOov1u1mxOb++rfH7SEYJ4RiLwUerWdaZ9PElPaj2h1LofuKEAcbcdV PC/VdQC/esdMJMFjfb79FQWildfShvyI6Tw8cU5rv/T37rGoMGSoSW3tGKX8ODudVr 7kTMwVnVkn4u7H9rzGNIkmPNKoQWErOjpPrbZaZg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id EB32BF8034E; Fri, 21 Aug 2020 09:32:19 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C792FF80317; Fri, 21 Aug 2020 09:31:56 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id CA5CFF80218 for ; Fri, 21 Aug 2020 09:31:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CA5CFF80218 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="OUlZJHhi"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="IkHv2Ous" Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 129F48D5; Fri, 21 Aug 2020 03:31:40 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 21 Aug 2020 03:31:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=0Do/PKfM1uNzR ZmES9ekz1wc/pZqDt02aIEOkzvwxjg=; b=OUlZJHhiOt06Cjimyu6yDfmR27HR/ 2SnQEODovz+fqj/scoHTD+FeH/mP9+om+1MTyByUjszbXOisilw2iO3vWkeGfRMp JBSSbTkv2Mxr4uDE4BB5LE2ZgMZQ1hHLX1lERejAMCWNPRSWK4aKP+7GcDKiDgQ/ 6sM+N+LecrkWUdTQoH7OgpBzSwAOUgxtQJC1qACk/aWYDRbS/hfxFuEATdHz3nqS 2iZj/SlJOY5cCVQxt8M4EiK93txB7YWEAgjRord6n/L2gFCyIBj1v4bMWSIvtpma ArKaAhQAQMJ4cxMd52DMtBhvL3uKZ/sC6mp8YerP7OsZkrjlcDrk0mOpw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=0Do/PKfM1uNzRZmES9ekz1wc/pZqDt02aIEOkzvwxjg=; b=IkHv2Ous dKN93r5EgY3j1rYwZRB+u4Ax++2WiBWgW+4vV4h/vERqSTCoMG3c76TfFWj1FnLz zmuMrG3X9aZMGCSS3AUIF5vcwdHhwhM2b3xpRoC9kJFCpI42UyQ4cnmuUALaHMzA UKTMtwmscIjeF7287Lpf6uqpCATI9NnBel9boStYyFaHEV3D3RalwAu/tkGye8oW UilvPWP1pB5yFn6dUSz5u8Ik9KV7PfqWEkfj/DN4K9K96Gxk/L2XbHKszn8eHw5B Q/BT24UEEm/cJ/gr087IDvNtkpj7krzMhphxaVDG3DHN1PNiNMz0DJKJWXShjdB5 ZgAIo53ifCSbCg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudduuddgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucfkphepudek tddrvdefhedrfedrheegnecuvehluhhsthgvrhfuihiivgepuddvnecurfgrrhgrmhepmh grihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: from workstation.flets-east.jp (ad003054.dynamic.ppp.asahi-net.or.jp [180.235.3.54]) by mail.messagingengine.com (Postfix) with ESMTPA id 656EC30600B4; Fri, 21 Aug 2020 03:31:38 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de, perex@perex.cz Subject: [PATCH 14/25] efw-downloader: subcmd-device: check supported models or not Date: Fri, 21 Aug 2020 16:31:00 +0900 Message-Id: <20200821073111.134857-15-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821073111.134857-1-o-takashi@sakamocchi.jp> References: <20200821073111.134857-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: ffado-devel@lists.sourceforge.net, alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This commit checks whether the device for node is supported models or not. When it's unsupported, the runtime exits with EXIT_FAILURE. Signed-off-by: Takashi Sakamoto --- efw-downloader/src/subcmd-device.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/efw-downloader/src/subcmd-device.c b/efw-downloader/src/subcmd-device.c index e1be025..b93d62d 100644 --- a/efw-downloader/src/subcmd-device.c +++ b/efw-downloader/src/subcmd-device.c @@ -6,6 +6,7 @@ #include #include "efw-proto.h" +#include "config-rom.h" #define report_error(error, msg) \ fprintf(stderr, "Fail to %s: %s %d %s\n", \ @@ -55,6 +56,9 @@ int subcmd_device(int argc, char **argv) const char *path; const char *op_name; HinawaFwNode *node; + const guint8 *rom; + gsize length; + guint32 vendor_id, model_id; EfwProto *proto; int err; int i; @@ -83,8 +87,21 @@ int subcmd_device(int argc, char **argv) goto err; } - entry->op(argc, argv, proto, &error); + hinawa_fw_node_get_config_rom(node, &rom, &length, &error); + if (error != NULL) { + report_error(error, "get config rom"); + goto err_node; + } + if (!config_rom_detect_vendor_and_model(rom, &vendor_id, &model_id)) { + fprintf(stderr, "The node is not for Fireworks device: %s\n", path); + g_set_error_literal(&error, G_FILE_ERROR, g_file_error_from_errno(ENXIO), + "The node is not for Fireworks device"); + goto err_node; + } + + entry->op(argc, argv, proto, &error); +err_node: g_object_unref(node); err: if (error != NULL) { From patchwork Fri Aug 21 07:31:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 251344 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E40F7C433E1 for ; Fri, 21 Aug 2020 07:40:16 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 631DB2078D for ; Fri, 21 Aug 2020 07:40:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="a6KHlWQK"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="VQ9PkG0Y"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="AW759oA+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 631DB2078D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id DE8BD16A0; Fri, 21 Aug 2020 09:39:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DE8BD16A0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1597995615; bh=Vl9s7JAgREnsqVor5Vpph2X9bS0EiKI1WbybFzrMQhk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=a6KHlWQKcXJZU3CYBqdXO7a18yEtO03Kr4mU8Az4GupVFPFn6Vj9FW3c3sXyz85Fh l5AYwLHcodC0/O234WMgEi+BIqv+dhTi2Pc7QZluBYol7+KOxufErtLMo1qB0xrktf gqGVipB9Q+TocIQRPpGlfMUT9uRdtt36Mzs5vWzM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 893BBF80347; Fri, 21 Aug 2020 09:32:17 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 584D9F80321; Fri, 21 Aug 2020 09:31:56 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5F5F9F802E9 for ; Fri, 21 Aug 2020 09:31:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5F5F9F802E9 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="VQ9PkG0Y"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="AW759oA+" Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 92F2C8F5; Fri, 21 Aug 2020 03:31:41 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 21 Aug 2020 03:31:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=LA6eHpvSCwcym rcvvVEvgAPxk6WC1hJ7d//CaT5mpN4=; b=VQ9PkG0YbMJ44JNWNwcma+xisAhUB k588B92rzQYvSeXiFt8c4GiWXa+U2UiXZELlqZNgJ6wFW+Zf9eNnU61LGS3ueYIO GsAn9vwNtB6okJQYyiGrzFVPh4l/4iFJfWqRAzoBLh0E9ZBJ5wXRsO5Bpk5ai2Vj gn9VvSvZN7YtSNvKOmSj+aNeX8yprN2WSCDe0QE0/Heu/SVi+PVt+0Zc0U1fa6vp F0IQ8kBH634EwmVEpWWQxLxPLnpnjyKNuevNqnJSaBNY8Ai/YPewj9jg4yUXRmuD 6yV1ihQbzR9oPBszqce1riUkmO+gX10Kfvzz0kg1T0WuL19pG8z2Da30A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=LA6eHpvSCwcymrcvvVEvgAPxk6WC1hJ7d//CaT5mpN4=; b=AW759oA+ fCXmkKK8x1qdq8iZnlUX24cN5QDIpP1rzDvnuWcOpB0HusmL5qeIEXRKDnF/tn+b vMVCBnaiZhs+ZfoyvfEUblACHj3AqcxlLJwd7Ksd+oEFrOJ9xOp1ajERFMSRFTRb WTlV5e+AL8SNU5Ti8FoDzKIreQj9mcfOXFHc+rXEgfPiYAWjigOsYH8wG2KmazrZ R3XXbzPjtpj/2zAKzHzIpHWIOYGWIVCEbW3WgsebuwFR5F1COJz5SRE0RJgEXBHy RVuvbwB0SBZOJ+aUQk3EZt/6+sWb6j9M5v08OTJaqbIcbj556BfiZedhOm09B9Ng 6+oPan8bZAUN5w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudduuddgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucfkphepudek tddrvdefhedrfedrheegnecuvehluhhsthgvrhfuihiivgepuddvnecurfgrrhgrmhepmh grihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: from workstation.flets-east.jp (ad003054.dynamic.ppp.asahi-net.or.jp [180.235.3.54]) by mail.messagingengine.com (Postfix) with ESMTPA id E6E5430600A6; Fri, 21 Aug 2020 03:31:39 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de, perex@perex.cz Subject: [PATCH 15/25] efw-downloader: subcmd-device: bind Fireworks protocol Date: Fri, 21 Aug 2020 16:31:01 +0900 Message-Id: <20200821073111.134857-16-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821073111.134857-1-o-takashi@sakamocchi.jp> References: <20200821073111.134857-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: ffado-devel@lists.sourceforge.net, alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This commit binds Fireworks protocol for the given node. Signed-off-by: Takashi Sakamoto --- efw-downloader/src/subcmd-device.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/efw-downloader/src/subcmd-device.c b/efw-downloader/src/subcmd-device.c index b93d62d..1bfa1f2 100644 --- a/efw-downloader/src/subcmd-device.c +++ b/efw-downloader/src/subcmd-device.c @@ -100,7 +100,26 @@ int subcmd_device(int argc, char **argv) goto err_node; } + proto = efw_proto_new(); + efw_proto_bind(proto, node, &error); + if (error != NULL) { + if (g_error_matches(error, HINAWA_FW_NODE_ERROR, HINAWA_FW_NODE_ERROR_FAILED)) { + if (strstr(error->message, "16") != NULL) { + fprintf(stderr, "The range of address on 1394 OHCI controller already used by " + "ALSA fireworks driver.\n"); + } else { + report_error(error, "bind protocol"); + } + } else { + report_error(error, "bind protocol"); + } + goto err_node; + } + entry->op(argc, argv, proto, &error); + + efw_proto_unbind(proto); + g_object_unref(proto); err_node: g_object_unref(node); err: From patchwork Fri Aug 21 07:31:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 251342 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C88EC433DF for ; Fri, 21 Aug 2020 07:42:37 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B40F8207DF for ; Fri, 21 Aug 2020 07:42:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="N11aFCxw"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="bhGu4L7i"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="b6ryquQq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B40F8207DF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 4340A1698; Fri, 21 Aug 2020 09:41:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4340A1698 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1597995755; bh=MQtjZaIVZyTzc9dyMPygL4g1QsFUr2tmc+xmbd1ksUA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=N11aFCxwngpUpOTTVGfrSr0Ac6Gc24Y+hicXX9aok1dPQdXTMuiochojbNlrSjx2n drkznUMDQQCDV6Udss+17RZosIpGQqiwZRi6o+dbz2MHsl7UZxZpXLcRw4+TQXW1K8 cfZHLEUkN6TY8JSu5p1W+iqvjhhZ+NTwqRfx6C8s= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D3902F8036C; Fri, 21 Aug 2020 09:32:22 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 22CFEF80317; Fri, 21 Aug 2020 09:31:59 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AD62FF802EC for ; Fri, 21 Aug 2020 09:31:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AD62FF802EC Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="bhGu4L7i"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="b6ryquQq" Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id DD32790F; Fri, 21 Aug 2020 03:31:44 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 21 Aug 2020 03:31:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=Y/8SJwzWWXRjh 6+YEEYfAEplJzDhuvEcF6U2dQH01G8=; b=bhGu4L7i6ELzlRlNHD/6umionDFH2 /fqMv305MiHDyS43jwjszJ94P9Om0M5SW9PotZTUofAnkgTzRXKscWvr2OmwFZeS qTLgjIMPJKcoTkD/XlIclK3raV9SyzSG54Vf4ClOVHLAvK73zRPAF8jz7b35Rrda Gv1PsyOWAs128wZsr/f50k62IxZBH1AenD4RPYUK0HHp8mWjUALo4Re1jkT7Sjm/ PxCshHARsBnf0Tma+GFanL9zhrmH1Zjjk2apT3ogVZm1YITb+jw5bI4lM5ms8Cb+ pOK34haauAWtkuOLprwRBdIGlPfITOIOUu1nSBSImAOOPhBQAV9AYoFMw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=Y/8SJwzWWXRjh6+YEEYfAEplJzDhuvEcF6U2dQH01G8=; b=b6ryquQq /pCc2RaoDq0ZR8KofYLOUoEBP5ymIYp9tUrunC4xHHPHq6fDgMa7+NcuursSX5n6 Hqfpiv1PPJrdRK97a9jHVO1sBNIG0PTpbSz4UAReJcneuwVjtyaZUsT/FykAPsKv +WZBlEbtArItdIjlhZfqQ581oghbJdB3jaJimuchstaSJLUXeISliPvuD1GCDxFY W1SfYrHZjoJHIlqKudJIM+Ls6yXS5MiJ0UrYpFrclbTDvHkDCjX/bcC0V1JkCF0Q ZJSGnnHEYOfWiyGtptv+yVZrlbCzNUHRhWJwL3APFNDeSXf/NjJcxyGyebCIPSI2 FfOWYU/vnNVCrA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudduuddgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucfkphepudek tddrvdefhedrfedrheegnecuvehluhhsthgvrhfuihiivgepuddvnecurfgrrhgrmhepmh grihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: from workstation.flets-east.jp (ad003054.dynamic.ppp.asahi-net.or.jp [180.235.3.54]) by mail.messagingengine.com (Postfix) with ESMTPA id EA93030600A6; Fri, 21 Aug 2020 03:31:42 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de, perex@perex.cz Subject: [PATCH 17/25] efw-downloader: subcmd-device: support debug output for response of Fireworks protocol Date: Fri, 21 Aug 2020 16:31:03 +0900 Message-Id: <20200821073111.134857-18-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821073111.134857-1-o-takashi@sakamocchi.jp> References: <20200821073111.134857-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: ffado-devel@lists.sourceforge.net, alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" It's helpful to dump communication result optionally. This commit adds debug option for the purpose. Signed-off-by: Takashi Sakamoto --- efw-downloader/src/subcmd-device.c | 40 ++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/efw-downloader/src/subcmd-device.c b/efw-downloader/src/subcmd-device.c index 5ac0ac6..329eef0 100644 --- a/efw-downloader/src/subcmd-device.c +++ b/efw-downloader/src/subcmd-device.c @@ -28,8 +28,31 @@ static int print_help() return EXIT_FAILURE; } -static int parse_args(int argc, char **argv, const char **path, const char **op_name) +static void handle_responded_signal(EfwProto *proto, HinawaSndEfwStatus status, guint seqnum, + guint category, guint command, const guint32 *frame, guint frame_size) { + gchar *label = g_enum_to_string(HINAWA_TYPE_SND_EFW_STATUS, status); + int i; + + printf("responded:\n"); + printf(" status: %s\n", label); + printf(" seqnum: %d\n", seqnum); + printf(" category; %d\n", category); + printf(" command: %d\n", command); + + if (frame_size > 0) { + printf(" frame:\n"); + for (i = 0; i < frame_size; ++i) + printf(" [%3x]: %08x\n", i, frame[i]); + } + + g_free(label); +} + +static int parse_args(int argc, char **argv, const char **path, const char **op_name, gboolean *debug) +{ + int i; + if (argc < 2) return -EINVAL; assert(strncmp(argv[1], "device", sizeof("device")) == 0); @@ -42,6 +65,15 @@ static int parse_args(int argc, char **argv, const char **path, const char **op_ return -EINVAL; *op_name = argv[3]; + *debug = FALSE; + for (i = 0; i < argc; ++i) { + if (strncmp(argv[i], "--debug", sizeof(--debug)) == 0 || + strncmp(argv[i], "-d", sizeof(--debug)) == 0) { + *debug = TRUE; + break; + } + } + return 0; } @@ -54,6 +86,7 @@ int subcmd_device(int argc, char **argv) } *entry, entries[] = { }; GError *error = NULL; + gboolean debug; const char *path; const char *op_name; HinawaFwNode *node; @@ -65,7 +98,7 @@ int subcmd_device(int argc, char **argv) int err; int i; - err = parse_args(argc, argv, &path, &op_name); + err = parse_args(argc, argv, &path, &op_name, &debug); if (err < 0) return print_help(0, NULL, NULL, NULL); @@ -103,6 +136,9 @@ int subcmd_device(int argc, char **argv) } proto = efw_proto_new(); + if (debug) + g_signal_connect(proto, "responded", (GCallback)handle_responded_signal, NULL); + efw_proto_bind(proto, node, &error); if (error != NULL) { if (g_error_matches(error, HINAWA_FW_NODE_ERROR, HINAWA_FW_NODE_ERROR_FAILED)) { From patchwork Fri Aug 21 07:31:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 251341 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CFB3C433DF for ; Fri, 21 Aug 2020 07:43:45 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D971B2078D for ; Fri, 21 Aug 2020 07:43:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="a6729hMK"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="iKLa+juy"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="OFfFdeCf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D971B2078D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 6FF3916A3; Fri, 21 Aug 2020 09:42:53 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6FF3916A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1597995823; bh=UZPTzWLbxzFaYWGHqrpSCOVA+RqV9BHgddJXLt0YuLA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=a6729hMKI6qElAcnivENyX9vraR2cuv+Dd3UZxjH+PYIOB7t+LXvlW4+FFf3kqcC/ L5BKvVVBK7gCNEIcjPWM9lAo+bk6gQl42c5TuF7uuv1tmhnoGYxqfMkkGXqRDVHLwt EmAfZjjJPJVRLY9YiRBIWJZbofq2sHapPSRi9EU4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 02658F80377; Fri, 21 Aug 2020 09:32:25 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AF74BF8033E; Fri, 21 Aug 2020 09:32:08 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 47515F80303 for ; Fri, 21 Aug 2020 09:31:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 47515F80303 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="iKLa+juy"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="OFfFdeCf" Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 7AFF48B9; Fri, 21 Aug 2020 03:31:50 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 21 Aug 2020 03:31:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=KPYyZhrP1cWcK m0GXDuzOYq7JBYXxkQkitzqKvC+u38=; b=iKLa+juyy5TsCh0novAg2MenJkWZh yg/htRi1oGOUmc9u6FwYa0ir2J+heKp9hyy7LDXv09U5x1u5FOsyuVN1xnB6hFZK FdasippRwfS+/rj2MJwfjGSuFVKsJp4TEqUOZpdTdvpkzBaXYd+RCqKySpmaty/Z wMLO73DWnSzj2z8dukvUi/ZxlseIRDB9iIovvq6dYev4ZtkYIKPmZJqI+Kru1vID bcT5akrsN1pGN5AoCf171MvXqK+kI0o9s77jaoipibfjR58vxMoYqeo54UKNtgwR QSjLWcfBb6wZ/9h5KvkLGRE08KOlxZr1n2AgJTA3h+l54KcypF/pR3R8w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=KPYyZhrP1cWcKm0GXDuzOYq7JBYXxkQkitzqKvC+u38=; b=OFfFdeCf Ln+2joZcIIK+Fx60rqLiXfDPan3DMhpIe52bG+EzKR8wPvCNf0pQHe4UbNelLzzQ INDm/wxFkU/3fjaXgy612R8Td7dz4d+zGllETiJrKuMuh+2YbJIQeyccMkEaYFu8 QH0zcjC94hw/plZ1ckAl96jHvM/0WvURs1X/oaYAYURqrXLFwzy/+rct/gmP6a1t x/UOREXecVp1GXnANG5VTA8dN7D3WD2/Cc1yY82TFHtJmGAP9KEHyjvS85TNN8pG mo9KUTXMAFPNrll5UO5haMo3Vx053bTuH7VEbV0w4IHjJooBfTcPDsDUIZ12b3tC netI6rIOl3ha/Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudduuddgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucfkphepudek tddrvdefhedrfedrheegnecuvehluhhsthgvrhfuihiivgepudeinecurfgrrhgrmhepmh grihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: from workstation.flets-east.jp (ad003054.dynamic.ppp.asahi-net.or.jp [180.235.3.54]) by mail.messagingengine.com (Postfix) with ESMTPA id B338E30600B1; Fri, 21 Aug 2020 03:31:48 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de, perex@perex.cz Subject: [PATCH 20/25] efw-downloader: subcmd-device: add read operation Date: Fri, 21 Aug 2020 16:31:06 +0900 Message-Id: <20200821073111.134857-21-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821073111.134857-1-o-takashi@sakamocchi.jp> References: <20200821073111.134857-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: ffado-devel@lists.sourceforge.net, alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This commit add read operation in device sub command. The arbitrary range of address in on-board flash memory is read and the content is dump in stdout. Signed-off-by: Takashi Sakamoto --- efw-downloader/src/meson.build | 1 + efw-downloader/src/op-device-read.c | 104 ++++++++++++++++++++++++++++ efw-downloader/src/subcmd-device.c | 4 ++ efw-downloader/src/subcmds.h | 4 ++ 4 files changed, 113 insertions(+) create mode 100644 efw-downloader/src/op-device-read.c diff --git a/efw-downloader/src/meson.build b/efw-downloader/src/meson.build index 73a0f36..8738d76 100644 --- a/efw-downloader/src/meson.build +++ b/efw-downloader/src/meson.build @@ -18,6 +18,7 @@ sources = [ 'node-dispatcher.c', 'efw-commands.c', 'subcmd-device.c', + 'op-device-read.c', ] headers = [ diff --git a/efw-downloader/src/op-device-read.c b/efw-downloader/src/op-device-read.c new file mode 100644 index 0000000..a1fa0cf --- /dev/null +++ b/efw-downloader/src/op-device-read.c @@ -0,0 +1,104 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Copyright (c) 2020 Takashi Sakamoto +#include +#include +#include +#include +#include + +#include "efw-commands.h" + +static void print_help() +{ + printf("Usage\n" + " efw-downloader device CDEV read OFFSET LENGTH [OPTIONS]\n" + "\n" + "where:\n" + " CDEV: The firewire character device corresponding to the node for proto\n" + " OFFSET: The hexadecimal offset address in on-board flash memory\n" + " LENGTH: The hexadecimal number to read. The value is finally aligned to quadlet.\n" + " OPTIONS:\n" + " --help, -h: Print this help message and exit.\n" + " --debug: Output debug message to stderr\n"); +} + +static int parse_args(int argc, char **argv, size_t *offset, size_t *quads, gboolean *help) +{ + unsigned long val; + char *end; + int i; + + if (argc < 4) + return -EINVAL; + assert(strncmp(argv[3], "read", sizeof("read")) == 0); + + if (argc < 5) + return -EINVAL; + val = strtol(argv[4], &end, 16); + if (*end != '\0') { + printf("Invalid argument for offset address.\n"); + return -EINVAL; + } + *offset = (size_t)val; + + if (argc < 6) + return -EINVAL; + val = strtol(argv[5], &end, 16); + if (*end != '\0') { + printf("Invalid argument for quadlet count.\n"); + return -EINVAL; + } + *quads = (size_t)(val + 3) / 4; + + *help = FALSE; + for (i = 0; i < argc; ++i) { + if (strncmp(argv[i], "--help", sizeof("--help")) == 0 || + strncmp(argv[i], "-h", sizeof("-h")) == 0) { + *help = TRUE; + } + } + + return 0; +} + +void op_device_read(int argc, char **argv, EfwProto *proto, GError **error) +{ + size_t offset; + size_t quads; + guint32 *buf; + gboolean help; + int err; + int i; + + err = parse_args(argc, argv, &offset, &quads, &help); + if (err < 0) { + print_help(); + g_set_error_literal(error, G_FILE_ERROR, G_FILE_ERROR_INVAL, "Invalid arguments"); + return; + } + + if (help) { + print_help(); + return; + } + + buf = g_try_malloc0_n(quads, sizeof(*buf)); + if (buf == NULL) { + fprintf(stderr, "Memory allocation fails.\n"); + g_set_error_literal(error, G_FILE_ERROR, G_FILE_ERROR_NOSPC, "Memory allocation error"); + return; + } + + efw_flash_recursive_read(proto, offset, buf, quads, error); + if (*error != NULL) { + fprintf(stderr, + "Fail to read contents of flash memory: %s %d %s\n", + g_quark_to_string((*error)->domain), (*error)->code, (*error)->message); + goto end; + } + + for (i = 0; i < quads; ++i) + printf(" %08lx: %08x\n", offset + 4 * i, buf[i]); +end: + g_free(buf); +} diff --git a/efw-downloader/src/subcmd-device.c b/efw-downloader/src/subcmd-device.c index 329eef0..a11450c 100644 --- a/efw-downloader/src/subcmd-device.c +++ b/efw-downloader/src/subcmd-device.c @@ -9,6 +9,8 @@ #include "config-rom.h" #include "node-dispatcher.h" +#include "subcmds.h" + #define report_error(error, msg) \ fprintf(stderr, "Fail to %s: %s %d %s\n", \ msg, g_quark_to_string(error->domain), error->code, error->message) @@ -21,6 +23,7 @@ static int print_help() "where:\n" " CDEV: The firewire character device corresponding to the node for transaction\n" " OPERATION:\n" + " read: read from on-board flash memory\n" " help: print this help message\n" " ARGUMENTS:\n" " depending on OPERATION\n" @@ -84,6 +87,7 @@ int subcmd_device(int argc, char **argv) size_t size; void (*op)(int argc, char **argv, EfwProto *proto, GError **error); } *entry, entries[] = { + { "read", sizeof("read"), op_device_read }, }; GError *error = NULL; gboolean debug; diff --git a/efw-downloader/src/subcmds.h b/efw-downloader/src/subcmds.h index f10c420..70cbb5a 100644 --- a/efw-downloader/src/subcmds.h +++ b/efw-downloader/src/subcmds.h @@ -3,6 +3,10 @@ #ifndef __SUBCMDS_H__ #define __SUBCMDS_H__ +#include "efw-proto.h" + int subcmd_device(int argc, char **argv); +void op_device_read(int argc, char **argv, EfwProto *proto, GError **error); + #endif From patchwork Fri Aug 21 07:31:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 251340 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60518C433DF for ; Fri, 21 Aug 2020 07:44:52 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DD34C2078D for ; Fri, 21 Aug 2020 07:44:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="rS2xEX6v"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="XB9qIwos"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="dV7jXK9/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD34C2078D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 6DE1042; Fri, 21 Aug 2020 09:44:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6DE1042 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1597995890; bh=w42RtQqrjsrW1k7evi5ZzzKLwzbO+Wr2+b8FX2fyrhw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rS2xEX6vpbhkSgptNVtTKLmKkNTUMGYzYk00X6FXLrIa4lIFOP4VB+Jw3GndwXAgO mFRSC8wJTSKAQ+1sDjSa6fj3F2QpytcwM52vkd6l99MHECbBk3mgH4LE790Y7qwMRO mBWOEPs8RqO2tzTFay1qH26erUvpJdMGjsqaVd14= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1B5CEF80384; Fri, 21 Aug 2020 09:32:28 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A4398F80343; Fri, 21 Aug 2020 09:32:11 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5E536F80322 for ; Fri, 21 Aug 2020 09:31:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5E536F80322 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="XB9qIwos"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="dV7jXK9/" Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 898F68D6; Fri, 21 Aug 2020 03:31:53 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 21 Aug 2020 03:31:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=h4YioK3sQj4FJ w+dGh9BBRLRZzKMT9AN+fJGXzo4fGw=; b=XB9qIwosgscxokqfEvIXFAmQNan9U nLpQPT5yIU3E40Uv1g27MlF1DL9gPejg6ui0RJsb5o1dwITJLK2rMUTeGyIhRcr4 62dS1AX8CK//fH2hbux0icnZkDjFWzEhqwZuTIWkoIea78NgnEFxuh3OU2hV7uO0 pVVZsjMwwdH/DR03T3ys4XlIxk944gV6Uy+nDD7/l6sUwHw1yODXZLWak5yKfXHw pXAkuXtnvIV0w0TRWQTIhDilED0492IQ4+UxhZ7NC9xOoGGRVIKyg02iuCFs0Cvm Nre7RVrZKoYrvRI96G8p0ldDDvXFLQr1bEphstqnGL6XDlNHH/PMHOwJg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=h4YioK3sQj4FJw+dGh9BBRLRZzKMT9AN+fJGXzo4fGw=; b=dV7jXK9/ JIGiYHuY/Fc+dRdvaSQ4OX6uywMzz4xYuduwjFPHsBa5URQmjpeM70X8OXlIHPRH /m5nqjaeDuGEjuRPWr8LEPdRH5qNPBdvkdWuf93LFWdhJEw5+QrACzirrQLO/CIT Z37hua2sESf3FLd3Dz2lySAUC2lXel72JrvEscjGjULosbD3IPZzZZsvDm+Rrcqn jD2KzUFXEPC2F2y44k2IViz1fsiH34/qT7CueYXiKHeYm8auzyaArMO6JmvjUpQ+ bO3Gi+g7wSrtvHQJRxzmeosvvczIWtqAfczbi/3QYJLfV+ScjesgfL36BgdZ+Dba szb3LW769gGUkw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudduuddgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucfkphepudek tddrvdefhedrfedrheegnecuvehluhhsthgvrhfuihiivgepudelnecurfgrrhgrmhepmh grihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: from workstation.flets-east.jp (ad003054.dynamic.ppp.asahi-net.or.jp [180.235.3.54]) by mail.messagingengine.com (Postfix) with ESMTPA id D14C230600B1; Fri, 21 Aug 2020 03:31:51 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de, perex@perex.cz Subject: [PATCH 22/25] efw-downloader: subcmd-file: add 'file' sub command Date: Fri, 21 Aug 2020 16:31:08 +0900 Message-Id: <20200821073111.134857-23-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821073111.134857-1-o-takashi@sakamocchi.jp> References: <20200821073111.134857-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: ffado-devel@lists.sourceforge.net, alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This commit adds 'file' subcommand to handle firmware files. Signed-off-by: Takashi Sakamoto --- efw-downloader/src/meson.build | 1 + efw-downloader/src/subcmd-file.c | 85 ++++++++++++++++++++++++++++++++ efw-downloader/src/subcmds.h | 2 + 3 files changed, 88 insertions(+) create mode 100644 efw-downloader/src/subcmd-file.c diff --git a/efw-downloader/src/meson.build b/efw-downloader/src/meson.build index 05d491d..7d11332 100644 --- a/efw-downloader/src/meson.build +++ b/efw-downloader/src/meson.build @@ -22,6 +22,7 @@ sources = [ 'file-cntr.c', 'subcmd-device.c', 'op-device-read.c', + 'subcmd-file.c', ] headers = [ diff --git a/efw-downloader/src/subcmd-file.c b/efw-downloader/src/subcmd-file.c new file mode 100644 index 0000000..0ee7653 --- /dev/null +++ b/efw-downloader/src/subcmd-file.c @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Copyright (c) 2020 Takashi Sakamoto +#include +#include +#include +#include +#include + +#include "subcmds.h" + +static void print_help() +{ + printf("Usage\n" + " efw-downloader file FILEPATH OPERATION ARGUMENTS\n" + "\n" + "where:\n" + " FILEPATH: The path to file.\n" + " OPERATION:\n" + " help: print this help message\n" + " ARGUMENTS:\n" + " depending on the OPERATION\n"); +} + +static int parse_args(int argc, char **argv, const char **filepath, const char **op_name) +{ + if (argc < 2) + return -EINVAL; + assert(strncmp(argv[1], "file", sizeof("file")) == 0); + + if (argc < 3) + return -EINVAL; + *filepath = argv[2]; + + if (argc < 4) + return -EINVAL; + *op_name = argv[3]; + + return 0; +} + +int subcmd_file(int argc, char **argv) +{ + struct { + const char *name; + size_t size; + int (*op)(int argc, char **argv, struct file_cntr *cntr); + } *entry, entries[] = { + }; + const char *op_name; + const char *filepath; + struct file_cntr cntr = {0}; + int err; + int i; + + err = parse_args(argc, argv, &filepath, &op_name); + if (err < 0) { + print_help(); + return EXIT_FAILURE; + } + + for (i = 0; i < sizeof(entries) / sizeof(entries[0]); ++i) { + entry = entries + i; + if (strncmp(op_name, entry->name, entry->size) == 0) + break; + } + if (i == sizeof(entries) / sizeof(entries[0])) { + print_help(); + return EXIT_FAILURE; + } + + err = file_cntr_parse(&cntr, filepath); + if (err < 0) { + printf("Fail to parse: %s\n", strerror(-err)); + return EXIT_FAILURE; + } + + err = entry->op(argc, argv, &cntr); + + file_cntr_release(&cntr); + + if (err < 0) + return EXIT_FAILURE; + + return EXIT_SUCCESS; +} diff --git a/efw-downloader/src/subcmds.h b/efw-downloader/src/subcmds.h index 70cbb5a..b1810b3 100644 --- a/efw-downloader/src/subcmds.h +++ b/efw-downloader/src/subcmds.h @@ -4,8 +4,10 @@ #define __SUBCMDS_H__ #include "efw-proto.h" +#include "file-cntr.h" int subcmd_device(int argc, char **argv); +int subcmd_file(int argc, char **argv); void op_device_read(int argc, char **argv, EfwProto *proto, GError **error); From patchwork Fri Aug 21 07:31:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 251339 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FA88C433DF for ; Fri, 21 Aug 2020 07:45:54 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8C45120738 for ; Fri, 21 Aug 2020 07:45:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="NQFgBoMS"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="ZKTRxkVV"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="d2iz8TXs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C45120738 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 25144169E; Fri, 21 Aug 2020 09:45:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 25144169E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1597995952; bh=OBSwhEBcqI35q6xG/aAUxKl6NhPWCiXlxOhWpXMVifA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=NQFgBoMSHU4DfFG6Qx3Gd9GBPsmk+Rjbj7qw32/EnjfKnfZI289I0gLRy0NSLdaLI O+efZf+NEhEWbstI+j0Zq/FiWRvOEXzGCgoFoE/c40RdagyOaly6n0lHzo3cQk1b0A kIvnyoGETkBI3hVrh9kV6NHk/J/Os1gQWuZD4wMw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9E65AF80393; Fri, 21 Aug 2020 09:32:30 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id ECEF3F80349; Fri, 21 Aug 2020 09:32:15 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E2001F80253 for ; Fri, 21 Aug 2020 09:31:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E2001F80253 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="ZKTRxkVV"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="d2iz8TXs" Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 211F393B; Fri, 21 Aug 2020 03:31:55 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 21 Aug 2020 03:31:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=BMe74KewABkkh TJIZlnshVWfepeONnyeatFA/AXINs8=; b=ZKTRxkVVIIcKG0rmkyls/+d7EB0Z5 Nf4Pfy8G1mwn9GofYjzx69szbPRywkRCf+Y8MhuIo/zlUFP8U+9jGxhnGJhGN0q4 T7NGimaJ8dNUL3WaevMQCQV5fMHTP0MSB8/3Uy0lQ6p4J3aTlvHjexLOK0a3ej+c OL91lNJlBoNv2AOddEFdPZnb2OKpcYYVem+ccfXSHGLvctozaV4bKPcfTL+lX6GW GWJHsrv6L3WZSGVaQspnGlN0b4JU6ljUr1yKthMsQx5k/IZWvJB1X7GWktp8xaKC +cPFX12qCouDkwadcibY3XBwRdnjt5nOIHmHEwe4GqnEQa15fniUTA1bw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=BMe74KewABkkhTJIZlnshVWfepeONnyeatFA/AXINs8=; b=d2iz8TXs 4L4CTi48Sj2Ki6YUvzg2Nhnss7WLFFTJTkYwkU+PUk/Cvrsyr646BoatwYHllESr rWh3qOi02zeIe9XqmTmKaFpuKeKgKWlHGy/gAWcXLoMRu0guBywCF4dBIkld0Inh kKvjZxGxCzCRWnvHUvB1iU3mlppiUynQ9vQpfEKbtr7UHhRf91BTTivjQ2F9W5A0 z4dImNoJ/9771ZrEfZI+2VnZPBd9a2DLHIXYvudwX2LTKMOGzMVqDYFh9BVYV2TL gxNnKXne3zJt1hgnzrVRndn6EU3HJfkEdpV3Km+YtZE1G+n+s+XXVu+2NWyn/dz/ cdW8SuR9LW/OcQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudduuddgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucfkphepudek tddrvdefhedrfedrheegnecuvehluhhsthgvrhfuihiivgepudelnecurfgrrhgrmhepmh grihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: from workstation.flets-east.jp (ad003054.dynamic.ppp.asahi-net.or.jp [180.235.3.54]) by mail.messagingengine.com (Postfix) with ESMTPA id 6308A30600A9; Fri, 21 Aug 2020 03:31:53 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de, perex@perex.cz Subject: [PATCH 23/25] efw-downloader: subcmd-file: add parse operation Date: Fri, 21 Aug 2020 16:31:09 +0900 Message-Id: <20200821073111.134857-24-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821073111.134857-1-o-takashi@sakamocchi.jp> References: <20200821073111.134857-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: ffado-devel@lists.sourceforge.net, alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This commit adds parse operation in file sub command to dump contents of firmware files. Signed-off-by: Takashi Sakamoto --- efw-downloader/src/main.c | 2 + efw-downloader/src/meson.build | 1 + efw-downloader/src/op-file-parse.c | 106 +++++++++++++++++++++++++++++ efw-downloader/src/subcmd-file.c | 2 + efw-downloader/src/subcmds.h | 2 + 5 files changed, 113 insertions(+) create mode 100644 efw-downloader/src/op-file-parse.c diff --git a/efw-downloader/src/main.c b/efw-downloader/src/main.c index e150cc8..a9b52eb 100644 --- a/efw-downloader/src/main.c +++ b/efw-downloader/src/main.c @@ -14,6 +14,7 @@ static void print_help() "where:\n" " SUBCOMMAND:\n" " device: operate for device for unit on IEEE 1394 bus\n" + " file: operate for firmware file" " help: print help\n" " OPTIONS: optional arguments dependent on the subcommand\n"); } @@ -26,6 +27,7 @@ int main(int argc, char **argv) int (*op)(int argc, char **argv); } *entry, entries[] = { { "device", sizeof("device"), subcmd_device }, + { "file", sizeof("file"), subcmd_file }, }; const char *subcmd; int i; diff --git a/efw-downloader/src/meson.build b/efw-downloader/src/meson.build index 7d11332..8f7e363 100644 --- a/efw-downloader/src/meson.build +++ b/efw-downloader/src/meson.build @@ -23,6 +23,7 @@ sources = [ 'subcmd-device.c', 'op-device-read.c', 'subcmd-file.c', + 'op-file-parse.c', ] headers = [ diff --git a/efw-downloader/src/op-file-parse.c b/efw-downloader/src/op-file-parse.c new file mode 100644 index 0000000..c9c81d2 --- /dev/null +++ b/efw-downloader/src/op-file-parse.c @@ -0,0 +1,106 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Copyright (c) 2020 Takashi Sakamoto +#include +#include +#include +#include +#include +#include + +#include "file-cntr.h" + +static void print_help() +{ + printf("Usage\n" + " efw-downloader file PATH parse [--help | -h]\n" + "\n" + "where:\n" + " --help, -h: print this help message\n"); +} + +static const char *get_blob_type_name(enum blob_type type) +{ + const char *name; + + switch (type) { + case BLOB_TYPE_DSP: + name = "DSP"; + break; + case BLOB_TYPE_ICELYNX: + name = "IceLynx"; + break; + case BLOB_TYPE_DATA: + name = "data"; + break; + case BLOB_TYPE_FPGA: + name = "FPGA"; + break; + default: + name = "invalid"; + break; + } + + return name; +} + +static void file_cntr_dump_header(const struct file_cntr *cntr) +{ + printf("Container header:\n"); + printf(" type: %d (%s)\n", cntr->header.type, get_blob_type_name(cntr->header.type)); + printf(" offset_addr: 0x%08x\n", cntr->header.offset_addr); + printf(" blob_quads: %u\n", cntr->header.blob_quads); + printf(" blob_crc32: 0x%08x\n", cntr->header.blob_crc32); + printf(" blob_checksum: 0x%08x\n", cntr->header.blob_checksum); + printf(" version: 0x%08x\n", cntr->header.version); + printf(" crc_in_region_end: %d\n", cntr->header.crc_in_region_end); + printf(" total_quads: %d\n", cntr->header.cntr_quads); +} + +static void file_cntr_dump_payload(const struct file_cntr *cntr) +{ + int i; + + printf("Container payload:\n"); + for (i = 0; i < cntr->payload.count; ++i) + printf(" %08x: %08x\n", cntr->header.offset_addr + i * 4, cntr->payload.blob[i]); +} + +static int parse_args(int argc, char **argv, bool *help) +{ + int i; + + if (argc < 4) + return -EINVAL; + assert(!strncmp(argv[3], "parse", sizeof("parse"))); + + *help = false; + for (i = 0; i < argc; ++i) { + if (strncmp(argv[i], "--help", sizeof("--help")) == 0 || + strncmp(argv[i], "-h", sizeof("-h")) == 0) { + *help = true; + break; + } + } + + return 0; +} + +int op_file_parse(int argc, char **argv, struct file_cntr *cntr) +{ + bool help = false; + int err; + + err = parse_args(argc, argv, &help); + if (err < 0) + return err; + + if (help) { + print_help(); + return 0; + } + + file_cntr_dump_header(cntr); + file_cntr_dump_payload(cntr); + + return 0; +} diff --git a/efw-downloader/src/subcmd-file.c b/efw-downloader/src/subcmd-file.c index 0ee7653..a61378c 100644 --- a/efw-downloader/src/subcmd-file.c +++ b/efw-downloader/src/subcmd-file.c @@ -16,6 +16,7 @@ static void print_help() "where:\n" " FILEPATH: The path to file.\n" " OPERATION:\n" + " parse: parse and dump binary blob released by Echo Audio\n" " help: print this help message\n" " ARGUMENTS:\n" " depending on the OPERATION\n"); @@ -45,6 +46,7 @@ int subcmd_file(int argc, char **argv) size_t size; int (*op)(int argc, char **argv, struct file_cntr *cntr); } *entry, entries[] = { + { "parse", sizeof("parse"), op_file_parse }, }; const char *op_name; const char *filepath; diff --git a/efw-downloader/src/subcmds.h b/efw-downloader/src/subcmds.h index b1810b3..99d3bef 100644 --- a/efw-downloader/src/subcmds.h +++ b/efw-downloader/src/subcmds.h @@ -11,4 +11,6 @@ int subcmd_file(int argc, char **argv); void op_device_read(int argc, char **argv, EfwProto *proto, GError **error); +int op_file_parse(int argc, char **argv, struct file_cntr *cntr); + #endif From patchwork Fri Aug 21 07:31:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 251338 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5686C433DF for ; Fri, 21 Aug 2020 07:46:58 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2AF8A2078D for ; Fri, 21 Aug 2020 07:46:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="uBDtMm+q"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="VjwyHU4+"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="qb/tpPF9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2AF8A2078D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AD9F616B2; Fri, 21 Aug 2020 09:46:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AD9F616B2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1597996016; bh=xSL7vLFiufMvyeL2EA9DIeDW6xH8c3sayA5tkk7KDho=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=uBDtMm+qsxnHsyhuxdKIFoO2ahVLZ0RjCz6leMnWLvC9Tq2MSQHyRWhm0g4l17LiJ mF/8GQ5YZZGGjLSH44fVVJuhcaTsGuieoO59BkTJitX0TginFSpLiqr9yhMBStDakq qeHeNr5FLJio8wGHJcHfvhEOAB2Sw4kEo+FK2tDI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 19B33F803B2; Fri, 21 Aug 2020 09:32:33 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B286DF8034F; Fri, 21 Aug 2020 09:32:19 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 15CDFF80321 for ; Fri, 21 Aug 2020 09:32:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 15CDFF80321 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="VjwyHU4+"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="qb/tpPF9" Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 3FBB1972; Fri, 21 Aug 2020 03:31:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 21 Aug 2020 03:31:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=5VOfFKimvpk+B rmzzYZxBeFsugpeMuRuC5PysM43MGU=; b=VjwyHU4+ZOTTGZBjUkDOil5oZ1Sd0 pHyhAET6NkODdEE4iOUQ6fCDehj/hXmMRABhjQDhVmmICMEUbDHbdikgipDV9Gan RtE2Sth4U7H849+tdtEDEYjDdkjMTZpu6GuwEvEdiO/ol45RD8U8Q/wHMt3tuCNl XC8t1TmOZ2qYQIRHaYz+E9Y8COLc5JoywzX4PQ6r3ZxUYFWI9qJx3XPpdtzfytWd dkrVPK7xaK6+mUez3qsON4Rx4EHzftERv5RrAH/FqohSxiN1W1JLcCEdlKUMCwl8 z0HWmDQO8G5wQqKLpI+39DlXCgmGbzr19TzqvtG4qusljcPFqtiYkZOOw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=5VOfFKimvpk+BrmzzYZxBeFsugpeMuRuC5PysM43MGU=; b=qb/tpPF9 W6BNlIx4uQnE/e9PBbTeDMOmJrqUQPcqu2/Aq14SdxZInpY7DQDDlItBrnblYn/S qLQTXB0vC+apUAD/ZNvpJ+vWcIypz+Yar3KHFcMtB0IFR7kaG2K2nDoMTi4gZVFJ R//zgUkpzxrUssE6uwrxexM9QV0DUssmpUmPlL/vHvmJ95mGyui9zMz9Ua+uiw9I Z5BczaUREyoFQt88e5xbLZY6CnQy5A0PujmNJ7npXKSkSTZ0VGSKKr9XYvKtCohd DLQuVDQUGyUVupO/BXoReMZ9vwZ465F5FaV6xI15Q8ZBHnblsLWrAdG+iH3xZxut PF66lzmQ6ZGcfA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudduuddgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpefftdffje ejgfefleeiffetgfeiieegtdfghedvtdevteffteehvdeuiefhheejgeenucffohhmrghi nhepghhnohhmvgdrohhrghdpghhithhhuhgsrdgtohhmpdiilhhisgdrnhgvthdpmhgvsh honhgsuhhilhgurdgtohhmnecukfhppedukedtrddvfeehrdefrdehgeenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: from workstation.flets-east.jp (ad003054.dynamic.ppp.asahi-net.or.jp [180.235.3.54]) by mail.messagingengine.com (Postfix) with ESMTPA id 7812B30600A9; Fri, 21 Aug 2020 03:31:56 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de, perex@perex.cz Subject: [PATCH 25/25] efw-downloader: add README formatted by reStructuredText Date: Fri, 21 Aug 2020 16:31:11 +0900 Message-Id: <20200821073111.134857-26-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821073111.134857-1-o-takashi@sakamocchi.jp> References: <20200821073111.134857-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: ffado-devel@lists.sourceforge.net, alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This commit adds README so that developers and users can get description about this tool easily. Signed-off-by: Takashi Sakamoto --- efw-downloader/README.rst | 167 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 efw-downloader/README.rst diff --git a/efw-downloader/README.rst b/efw-downloader/README.rst new file mode 100644 index 0000000..8d35ee3 --- /dev/null +++ b/efw-downloader/README.rst @@ -0,0 +1,167 @@ +============== +efw-downloader +============== + +2020/08/21 +Takashi Sakamoto + +Introduction +============ + +This tool is designed to operate on-board flash memory for devices with Fireworks board module. The +goal is to download firmware for the module. + +At present, the tool can perform read operation from flash memory, and parse operation for firmware +file, therefore it's unlikely to make your device bricked. + +Target devices +============== + +* LOUD Audio, LLC (Mackie) + + * Onyx 400F + * Onyx 1200F + +* Echo Digital Audio corporation + + * Audiofire 12 (with DSP) + * Audiofire 12 (with FPGA) + * Audiofire 8 (with DSP) + * Audiofire 8 (with FPGA) + * Audiofire 2 + * Audiofire 4 + * Audiofire Pre8 + +* Gibson guitar corporation + + * Robot Interface Pack (RIP) + +Background +========== + +Echo Digital Audio corporation shipped Fireworks board module. This module is designed for audio and +music units on IEEE 1394 bus with rich features for direct monitoring, on-board routing, and so on. + +The module consists of two combinations of two ICs: + +* A combination: + + * Texus Instruments TSB43Cx43A (IceLynx Micro) + * Texus Instruments TMS320C6713B (DSP) + +* Another combination: + + * Texus Instruments TSB43Cx43A (IceLynx Micro) + * Xilinx Spartan XC35250E (FPGA) + +The module has on-board flash memory to store firmware for the above ICs and allows software to +read, erase, and write to the memory by Fireworks protocol. + +For your information, Echo Digital Audio corporation have US patent. The patent describes that two +processors are used for data processing in IEEE 1394 bus, and for sample processing from/to DAC/ADC. +These two processors independently run via memory bank. I guess that IceLynx Micro is used for the +former role, and DSP/FPGA is used for the latter role. + +Echo Digital Audio corporation provided a series of firmware blob to their customers and bundled the +firmware to driver package for Windows and macOS. The firmware blob has specific structure designed +by Echo Digital Audio corporation. + +Prerequities +============ + +Dependencies for build and runtime +------------------------------------- + +* libglib-2.0 and libgobject v2.34 or later. (https://gitlab.gnome.org/GNOME/glib) +* libhinawa v2.1 or later (https://github.com/alsa-project/libhinawa) +* zlib (https://zlib.net/) + +For build +--------- + +* Meson Build system (https://mesonbuild.com/) is used. + +For runtime +----------- + +* ALSA fireworks driver uses the same address space on 1394 OHCI controller for Fireworks protocol, + therefore it's better to unload the driver in advance of using the tool. +* FFADO applications should be stopped to avoid misfortune. + +Build and Install +================= + +:: + + $ meson (--prefix=xxx, -Dman=false). build + $ cd build + $ ninja + $ meson install + +* The ``man`` meson option is to install online manual for the tool. Default is ``true``. + +Instruction +=========== + +The tool consists of two sub commands; ``device`` and ``file``. The former is to operate on-board +flash memory, and the latter is to handle file of firmware blob. +:: + + efw-downloader SUBCOMMAND OPTIONS ... + + SUBCOMMAND = device | file + + OPTIONS = ( depends on subcommand ) + +The ``device`` sub command consists of several operations. At present, ``read`` operation is just +supported but the other operations are planned to add for future release. +:: + + efw-downloader device PATH OPERATION ARGUMENTS + + PATH The path to special file for firewire character device corresponding to node of Fireworks board module. + + OPERATION + One of read , and help operations. + + ARGUMENTS for read operation + + efw-downloader device PATH read OFFSET SIZE [ --debug | --help | -h ] + + The offset argument is the hexadecimal number of offset on flash memory. + + The size argument is the hexadecimal number of size to read, aligned to quadlet automatically. + + The optional --debug argument is to enable debug output for Fireworks protocol. + + The optional --help and -h arguments are for help message. + + ARGUMENTS for help operation + + efw-downloader device PATH help + + The help operation have no arguments. + +The ``file`` sub command consists of several operations as well. At present, ``parse`` operation is +just supported but the other operations are planned to add for future release. +:: + + efw-downloader file FILEPATH OPERATION ARGUMENTS + + FILEPATH + The path to file of firmware blob included in driver package shipped by vendors. + + OPERATION + One of parse , and help operations. + + ARGUMENTS for parse operation + + efw-downloader file FILEPATH parse [ --help | -h ] + + The --help and -h argument is for help message. + + ARGUMENTS for help operation + + efw-downloder file FILEPATH help + + The help operation have no arguments.