commit 493d61d6c0ed5d25c3241cba68b765e8c42f4581 Author: DreamSourceLab Date: Wed Jan 15 19:48:01 2014 +0800 Initial version. diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..892cf79b --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +*.[oa] +*~ +*.Plo +*.pc +*.pc.in +*.Po + diff --git a/COPYING b/COPYING new file mode 100644 index 00000000..94a9ed02 --- /dev/null +++ b/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/DSLogic-gui/CMakeLists.txt b/DSLogic-gui/CMakeLists.txt new file mode 100644 index 00000000..5a4fb8f1 --- /dev/null +++ b/DSLogic-gui/CMakeLists.txt @@ -0,0 +1,295 @@ +## +## This file is part of the PulseView project. +## +## Copyright (C) 2012 Joel Holdsworth +## Copyright (C) 2012-2013 Alexandru Gagniuc +## +## 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 2 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 . +## + +cmake_minimum_required(VERSION 2.6) +include(FindPkgConfig) +include(GNUInstallDirs) + +project(DSLogic-gui) + +#=============================================================================== +#= User Options +#------------------------------------------------------------------------------- + +option(DISABLE_WERROR "Build without -Werror" FALSE) +option(ENABLE_SIGNALS "Build with UNIX signals" TRUE) +option(ENABLE_TESTS "Enable unit tests" FALSE) +option(STATIC_PKGDEPS_LIBS "Statically link to (pkgconfig) libraries" FALSE) + +if(WIN32) + # On Windows/MinGW we need to statically link to libraries. + # This option is user configurable, but enable it by default on win32. + set(STATIC_PKGDEPS_LIBS TRUE) + + # For boost-thread we need two additional settings on win32: + set(Boost_USE_STATIC_LIBS on) + add_definitions(-DBOOST_THREAD_USE_LIB) + + # Windsws does not support UNIX signals + set(ENABLE_SIGNALS FALSE) +endif() + +#=============================================================================== +#= Dependencies +#------------------------------------------------------------------------------- + +list(APPEND PKGDEPS + libsigrok4DSLogic>=0.2.0 +) + +find_package(PkgConfig) +pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS}) + +find_package(Qt4 REQUIRED) + +# Find the platform's thread library (needed for boost-thread). +# This will set ${CMAKE_THREAD_LIBS_INIT} to the correct, OS-specific value. +find_package(Threads) + +if(WIN32) +# On Windows/MinGW the we need to use 'thread_win32' instead of 'thread'. +# The library is named libboost_thread_win32* (not libboost_thread*). +find_package(Boost 1.42 COMPONENTS system thread_win32 REQUIRED) +else() +find_package(Boost 1.42 COMPONENTS system thread REQUIRED) +endif() + +#=============================================================================== +#= Config Header +#------------------------------------------------------------------------------- + +set(DS_TITLE DSLogic) +set(DS_DESCRIPTION "A GUI for DSLogic") + +set(DS_VERSION_MAJOR 0) +set(DS_VERSION_MINOR 1) +set(DS_VERSION_MICRO 0) +set(DS_VERSION_STRING + ${DS_VERSION_MAJOR}.${DS_VERSION_MINOR}.${DS_VERSION_MICRO} +) + +configure_file ( + ${PROJECT_SOURCE_DIR}/config.h.in + ${PROJECT_BINARY_DIR}/config.h +) + +#=============================================================================== +#= Sources +#------------------------------------------------------------------------------- + +set(DSLogic_SOURCES + main.cpp + pv/devicemanager.cpp + pv/mainwindow.cpp + pv/sigsession.cpp + pv/data/analog.cpp + pv/data/analogsnapshot.cpp + pv/data/group.cpp + pv/data/groupsnapshot.cpp + pv/data/logic.cpp + pv/data/logicsnapshot.cpp + pv/data/signaldata.cpp + pv/data/snapshot.cpp + pv/decoder/decoder.cpp + pv/decoder/decoderfactory.cpp + pv/decoder/democonfig.cpp + pv/decoder/ds1wire.cpp + pv/decoder/dsdmx512.cpp + pv/decoder/dsi2c.cpp + pv/decoder/dsserial.cpp + pv/decoder/dsspi.cpp + pv/dialogs/about.cpp + pv/dialogs/connect.cpp + pv/dialogs/deviceoptions.cpp + pv/dialogs/search.cpp + pv/dock/fakelineedit.cpp + pv/dock/measuredock.cpp + pv/dock/protocoldock.cpp + pv/dock/searchdock.cpp + pv/dock/triggerdock.cpp + pv/prop/bool.cpp + pv/prop/double.cpp + pv/prop/enum.cpp + pv/prop/int.cpp + pv/prop/property.cpp + pv/prop/binding/binding.cpp + pv/prop/binding/binding_deviceoptions.cpp + pv/toolbars/devicebar.cpp + pv/toolbars/filebar.cpp + pv/toolbars/logobar.cpp + pv/toolbars/samplingbar.cpp + pv/toolbars/trigbar.cpp + pv/view/analogsignal.cpp + pv/view/cursor.cpp + pv/view/groupsignal.cpp + pv/view/header.cpp + pv/view/logicsignal.cpp + pv/view/protocolsignal.cpp + pv/view/ruler.cpp + pv/view/signal.cpp + pv/view/timemarker.cpp + pv/view/view.cpp + pv/view/viewport.cpp +) + +set(DSLogic_HEADERS + pv/sigsession.h + pv/mainwindow.h + pv/decoder/democonfig.h + pv/dock/fakelineedit.h + pv/dock/measuredock.h + pv/dock/protocoldock.h + pv/dock/searchdock.h + pv/dock/triggerdock.h + pv/dialogs/about.h + pv/dialogs/connect.h + pv/dialogs/deviceoptions.h + pv/dialogs/search.h + pv/toolbars/samplingbar.h + pv/toolbars/devicebar.h + pv/toolbars/filebar.h + pv/toolbars/logobar.h + pv/toolbars/trigbar.h + pv/view/cursor.h + pv/view/header.h + pv/view/ruler.h + pv/view/timemarker.h + pv/view/groupsignal.h + pv/view/protocolsignal.h + pv/view/view.h + pv/view/viewport.h +) + +set(DSLogic_FORMS + pv/dialogs/about.ui + pv/dialogs/search.ui + pv/decoder/dmx512config.ui + pv/decoder/i2cconfig.ui + pv/decoder/serialconfig.ui + pv/decoder/spiconfig.ui + pv/decoder/wire1config.ui +) + +set(DSLogic_RESOURCES + DSLogic.qrc +) + +qt4_wrap_cpp(DSLogic_HEADERS_MOC ${DSLogic_HEADERS}) +qt4_wrap_ui(DSLogic_FORMS_HEADERS ${DSLogic_FORMS}) +qt4_add_resources(DSLogic_RESOURCES_RCC ${DSLogic_RESOURCES}) + +include(${QT_USE_FILE}) + +#=============================================================================== +#= Global Definitions +#------------------------------------------------------------------------------- + +add_definitions(${QT_DEFINITIONS}) +add_definitions(-Wall -Wextra -Wno-return-type -Wno-ignored-qualifiers) + +if(NOT DISABLE_WERROR) + add_definitions(-Werror) +endif() + +#=============================================================================== +#= Global Include Directories +#------------------------------------------------------------------------------- + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${Boost_INCLUDE_DIRS} +) + +if(STATIC_PKGDEPS_LIBS) + include_directories(${PKGDEPS_STATIC_INCLUDE_DIRS}) +else() + include_directories(${PKGDEPS_INCLUDE_DIRS}) +endif() + +#=============================================================================== +#= Linker Configuration +#------------------------------------------------------------------------------- + +link_directories(${Boost_LIBRARY_DIRS}) + +set(DSLOGIC_LINK_LIBS + ${Boost_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} + ${QT_LIBRARIES} +) + +if(STATIC_PKGDEPS_LIBS) + link_directories(${PKGDEPS_STATIC_LIBRARY_DIRS}) + list(APPEND DSLOGIC_LINK_LIBS ${PKGDEPS_STATIC_LIBRARIES}) +else() + link_directories(${PKGDEPS_LIBRARY_DIRS}) + list(APPEND DSLOGIC_LINK_LIBS ${PKGDEPS_LIBRARIES}) +endif() + +add_executable(${PROJECT_NAME} + ${DSLogic_SOURCES} + ${DSLogic_HEADERS_MOC} + ${DSLogic_FORMS_HEADERS} + ${DSLogic_RESOURCES_RCC} +) + +target_link_libraries(${PROJECT_NAME} ${DSLOGIC_LINK_LIBS}) + +if(WIN32) +# Pass -mwindows so that no "DOS box" will open when PulseView is started. +set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-mwindows") +endif() + +#=============================================================================== +#= Installation +#------------------------------------------------------------------------------- + +# Install the executable. +install(TARGETS ${PROJECT_NAME} DESTINATION bin/) + +# Install the manpage. +install(FILES doc/DSLogic.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc) + +#=============================================================================== +#= Packaging (handled by CPack) +#------------------------------------------------------------------------------- + +set(CPACK_PACKAGE_VERSION_MAJOR ${DS_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${DS_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${DS_VERSION_MICRO}) +set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README) +set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/COPYING) +set(CPACK_SOURCE_IGNORE_FILES ${CMAKE_CURRENT_BINARY_DIR} ".gitignore" ".git") +set(CPACK_SOURCE_PACKAGE_FILE_NAME + "${CMAKE_PROJECT_NAME}-${DS_VERSION_MAJOR}.${DS_VERSION_MINOR}.${DS_VERSION_MICRO}") +set(CPACK_SOURCE_GENERATOR "TGZ") + +include(CPack) + +#=============================================================================== +#= Tests +#------------------------------------------------------------------------------- + +if(ENABLE_TESTS) + add_subdirectory(test) + enable_testing() + add_test(test ${CMAKE_CURRENT_BINARY_DIR}/test/DSLogic-test) +endif(ENABLE_TESTS) diff --git a/DSLogic-gui/COPYING b/DSLogic-gui/COPYING new file mode 100644 index 00000000..94a9ed02 --- /dev/null +++ b/DSLogic-gui/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/DSLogic-gui/DSLogic.qrc b/DSLogic-gui/DSLogic.qrc new file mode 100644 index 00000000..8162e2d1 --- /dev/null +++ b/DSLogic-gui/DSLogic.qrc @@ -0,0 +1,31 @@ + + + icons/search.png + icons/next.png + icons/pre.png + icons/file.png + icons/photo.png + icons/save.png + icons/open.png + icons/params.png + stylesheet.qss + icons/down-arrow.png + icons/slider-handle.png + icons/set.png + icons/add.png + icons/del.png + icons/trigger.png + icons/measure.png + icons/search-bar.png + icons/protocol.png + icons/logo_noColor.png + icons/logo_color.png + icons/logo_muColor.png + icons/about.png + icons/capture.png + icons/stop.png + icons/start.png + icons/dsl_logo.png + icons/logo.png + + diff --git a/DSLogic-gui/INSTALL b/DSLogic-gui/INSTALL new file mode 100644 index 00000000..4032ead4 --- /dev/null +++ b/DSLogic-gui/INSTALL @@ -0,0 +1,49 @@ +------------------------------------------------------------------------------- +INSTALL +------------------------------------------------------------------------------- + +Requirements +------------ + + - git + - g++ + - make + - libtool + - pkg-config >= 0.22 + - cmake >= 2.6 + - libglib >= 2.28.0 + - Qt >= 4.5 + - libboost >= 1.42 (including the following libs): + - libboost-system + - libboost-thread + - libsigrok4DSLogic >= 0.2.0 + + +Building and installing +----------------------- +Get the DSLogic-gui source code from: www.dreamsourcelab.com/download.html +In order to build it, run: + + $ cd DSLogic-gui + $ cmake . + $ make + +For installing PulseView: + + $ make install + +See the following wiki page for more (OS-specific) instructions: + + http://sigrok.org/wiki/Building + + +Creating a source distribution package +-------------------------------------- + +In order to build a source package begin with an unconfigured source tree. + + $ mkdir dist + $ cd dist + $ cmake .. + $ make package_source + diff --git a/DSLogic-gui/NEWS b/DSLogic-gui/NEWS new file mode 100644 index 00000000..dbbe9709 --- /dev/null +++ b/DSLogic-gui/NEWS @@ -0,0 +1,5 @@ +0.1.0 (2013-12-15) +------------------ + + * Initial release. + diff --git a/DSLogic-gui/README b/DSLogic-gui/README new file mode 100644 index 00000000..7452797b --- /dev/null +++ b/DSLogic-gui/README @@ -0,0 +1,72 @@ +------------------------------------------------------------------------------- +README +------------------------------------------------------------------------------- +DSLogic-gui is GUI for DSLogic software, it's based on PulseView +from the sigrok project. + +The sigrok project aims at creating a portable, cross-platform, +Free/Libre/Open-Source signal analysis software suite that supports various +device types (such as logic analyzers, oscilloscopes, multimeters, and more). + +PulseView is a Qt-based LA/scope/MSO GUI for sigrok. + + +Status +------ + +DSLogic-gui is in a usable state and has had official tarball releases. + +However, it is still work in progress. Some basic functionality +is available and working, but other things are still on the TODO list. + + +Copyright and license +--------------------- + +DSLogic-gui is licensed under the terms of the GNU General Public License +(GPL), version 3 or later. + +While some individual source code files are licensed under the GPLv2+, and +some files are licensed under the GPLv3+, this doesn't change the fact that +the program as a whole is licensed under the terms of the GPLv3+ (e.g. also +due to the fact that it links against GPLv3+ libraries). + +Please see the individual source files for the full list of copyright holders. + + +Copyright notices +----------------- + +A copyright notice indicating a range of years, must be interpreted as having +had copyrightable material added in each of those years. + +Example: + + Copyright (C) 2010-2013 Contributor Name + +is to be interpreted as + + Copyright (C) 2010,2011,2012,2013 Contributor Name + + +Mailing lists +------------- + +There are two mailing lists for sigrok/PulseView: + + https://lists.sourceforge.net/lists/listinfo/sigrok-devel + https://lists.sourceforge.net/lists/listinfo/sigrok-commits + + +IRC +--- + +You can find the sigrok developers in the #sigrok IRC channel on Freenode. + + +Website +------- + + http://sigrok.org/wiki/PulseView + http://dreamsourcelab.com + diff --git a/DSLogic-gui/config.h b/DSLogic-gui/config.h new file mode 100644 index 00000000..f6afda91 --- /dev/null +++ b/DSLogic-gui/config.h @@ -0,0 +1,34 @@ +/* + * This file is part of the PulseView project. + * + * Copyright (C) 2012 Alexandru Gagniuc + * + * 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 2 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 . + */ + +#ifndef _DSLOGIC_CONFIG_H +#define _DSLOGIC_CONFIG_H + +/* Application details */ +#define DS_TITLE "DSLogic" +#define DS_DESCRIPTION "A GUI for DSLogic" +#define DS_BIN_NAME "DSLogic-gui" + +/* DSLogic version information */ +#define DS_VERSION_MAJOR 0 +#define DS_VERSION_MINOR 1 +#define DS_VERSION_MICRO 0 +#define DS_VERSION_STRING "0.1.0" + +#endif diff --git a/DSLogic-gui/config.h.in b/DSLogic-gui/config.h.in new file mode 100644 index 00000000..89868e31 --- /dev/null +++ b/DSLogic-gui/config.h.in @@ -0,0 +1,34 @@ +/* + * This file is part of the PulseView project. + * + * Copyright (C) 2012 Alexandru Gagniuc + * + * 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 2 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 . + */ + +#ifndef _DSLOGIC_CONFIG_H +#define _DSLOGIC_CONFIG_H + +/* Application details */ +#define DS_TITLE "@DS_TITLE@" +#define DS_DESCRIPTION "@DS_DESCRIPTION@" +#define DS_BIN_NAME "@PROJECT_NAME@" + +/* DSLogic version information */ +#define DS_VERSION_MAJOR @DS_VERSION_MAJOR@ +#define DS_VERSION_MINOR @DS_VERSION_MINOR@ +#define DS_VERSION_MICRO @DS_VERSION_MICRO@ +#define DS_VERSION_STRING "@DS_VERSION_STRING@" + +#endif diff --git a/DSLogic-gui/extdef.h b/DSLogic-gui/extdef.h new file mode 100644 index 00000000..29ea8f53 --- /dev/null +++ b/DSLogic-gui/extdef.h @@ -0,0 +1,29 @@ +/* + * This file is part of the PulseView project. + * + * Copyright (C) 2012 Joel Holdsworth + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DSLOGIC_EXTDEF_H +#define DSLOGIC_EXTDEF_H + +#define countof(x) (sizeof(x)/sizeof(x[0])) + +#define begin_element(x) (&x[0]) +#define end_element(x) (&x[countof(x)]) + +#endif // DSLOGIC_EXTDEF_H diff --git a/DSLogic-gui/icons/Thumbs.db b/DSLogic-gui/icons/Thumbs.db new file mode 100644 index 00000000..8ea51172 Binary files /dev/null and b/DSLogic-gui/icons/Thumbs.db differ diff --git a/DSLogic-gui/icons/about.png b/DSLogic-gui/icons/about.png new file mode 100644 index 00000000..b2a3208e Binary files /dev/null and b/DSLogic-gui/icons/about.png differ diff --git a/DSLogic-gui/icons/add.png b/DSLogic-gui/icons/add.png new file mode 100644 index 00000000..e4e1684b Binary files /dev/null and b/DSLogic-gui/icons/add.png differ diff --git a/DSLogic-gui/icons/capture.png b/DSLogic-gui/icons/capture.png new file mode 100644 index 00000000..7b7db85b Binary files /dev/null and b/DSLogic-gui/icons/capture.png differ diff --git a/DSLogic-gui/icons/del.png b/DSLogic-gui/icons/del.png new file mode 100644 index 00000000..9420adc1 Binary files /dev/null and b/DSLogic-gui/icons/del.png differ diff --git a/DSLogic-gui/icons/down-arrow.png b/DSLogic-gui/icons/down-arrow.png new file mode 100644 index 00000000..4cc0d6ca Binary files /dev/null and b/DSLogic-gui/icons/down-arrow.png differ diff --git a/DSLogic-gui/icons/dsl_logo.png b/DSLogic-gui/icons/dsl_logo.png new file mode 100644 index 00000000..7e4db82b Binary files /dev/null and b/DSLogic-gui/icons/dsl_logo.png differ diff --git a/DSLogic-gui/icons/file.png b/DSLogic-gui/icons/file.png new file mode 100644 index 00000000..563dc477 Binary files /dev/null and b/DSLogic-gui/icons/file.png differ diff --git a/DSLogic-gui/icons/fullscreen.png b/DSLogic-gui/icons/fullscreen.png new file mode 100644 index 00000000..373ebfeb Binary files /dev/null and b/DSLogic-gui/icons/fullscreen.png differ diff --git a/DSLogic-gui/icons/logo.png b/DSLogic-gui/icons/logo.png new file mode 100644 index 00000000..9cdf4644 Binary files /dev/null and b/DSLogic-gui/icons/logo.png differ diff --git a/DSLogic-gui/icons/logo_color.png b/DSLogic-gui/icons/logo_color.png new file mode 100644 index 00000000..730f3b24 Binary files /dev/null and b/DSLogic-gui/icons/logo_color.png differ diff --git a/DSLogic-gui/icons/logo_muColor.png b/DSLogic-gui/icons/logo_muColor.png new file mode 100644 index 00000000..7b1d6a05 Binary files /dev/null and b/DSLogic-gui/icons/logo_muColor.png differ diff --git a/DSLogic-gui/icons/logo_noColor.png b/DSLogic-gui/icons/logo_noColor.png new file mode 100644 index 00000000..eccc8c4a Binary files /dev/null and b/DSLogic-gui/icons/logo_noColor.png differ diff --git a/DSLogic-gui/icons/measure.png b/DSLogic-gui/icons/measure.png new file mode 100644 index 00000000..a00a19e8 Binary files /dev/null and b/DSLogic-gui/icons/measure.png differ diff --git a/DSLogic-gui/icons/next.png b/DSLogic-gui/icons/next.png new file mode 100644 index 00000000..95ec60ff Binary files /dev/null and b/DSLogic-gui/icons/next.png differ diff --git a/DSLogic-gui/icons/open.png b/DSLogic-gui/icons/open.png new file mode 100644 index 00000000..35c395c5 Binary files /dev/null and b/DSLogic-gui/icons/open.png differ diff --git a/DSLogic-gui/icons/params.png b/DSLogic-gui/icons/params.png new file mode 100644 index 00000000..9432007e Binary files /dev/null and b/DSLogic-gui/icons/params.png differ diff --git a/DSLogic-gui/icons/photo.png b/DSLogic-gui/icons/photo.png new file mode 100644 index 00000000..934f63e5 Binary files /dev/null and b/DSLogic-gui/icons/photo.png differ diff --git a/DSLogic-gui/icons/pre.png b/DSLogic-gui/icons/pre.png new file mode 100644 index 00000000..f09cdc9a Binary files /dev/null and b/DSLogic-gui/icons/pre.png differ diff --git a/DSLogic-gui/icons/protocol.png b/DSLogic-gui/icons/protocol.png new file mode 100644 index 00000000..23aff772 Binary files /dev/null and b/DSLogic-gui/icons/protocol.png differ diff --git a/DSLogic-gui/icons/save.png b/DSLogic-gui/icons/save.png new file mode 100644 index 00000000..805dc0eb Binary files /dev/null and b/DSLogic-gui/icons/save.png differ diff --git a/DSLogic-gui/icons/search-bar.png b/DSLogic-gui/icons/search-bar.png new file mode 100644 index 00000000..09053b86 Binary files /dev/null and b/DSLogic-gui/icons/search-bar.png differ diff --git a/DSLogic-gui/icons/search.png b/DSLogic-gui/icons/search.png new file mode 100644 index 00000000..3ad1068b Binary files /dev/null and b/DSLogic-gui/icons/search.png differ diff --git a/DSLogic-gui/icons/set.png b/DSLogic-gui/icons/set.png new file mode 100644 index 00000000..a076e229 Binary files /dev/null and b/DSLogic-gui/icons/set.png differ diff --git a/DSLogic-gui/icons/setting.png b/DSLogic-gui/icons/setting.png new file mode 100644 index 00000000..32a65bfb Binary files /dev/null and b/DSLogic-gui/icons/setting.png differ diff --git a/DSLogic-gui/icons/slider-handle.png b/DSLogic-gui/icons/slider-handle.png new file mode 100644 index 00000000..a23b0fb7 Binary files /dev/null and b/DSLogic-gui/icons/slider-handle.png differ diff --git a/DSLogic-gui/icons/start.png b/DSLogic-gui/icons/start.png new file mode 100644 index 00000000..f3c624d6 Binary files /dev/null and b/DSLogic-gui/icons/start.png differ diff --git a/DSLogic-gui/icons/stop.png b/DSLogic-gui/icons/stop.png new file mode 100644 index 00000000..2b2c9829 Binary files /dev/null and b/DSLogic-gui/icons/stop.png differ diff --git a/DSLogic-gui/icons/trigger.png b/DSLogic-gui/icons/trigger.png new file mode 100644 index 00000000..6b36974d Binary files /dev/null and b/DSLogic-gui/icons/trigger.png differ diff --git a/DSLogic-gui/icons/╕┤╝■ down-arrow.png b/DSLogic-gui/icons/╕┤╝■ down-arrow.png new file mode 100644 index 00000000..602c191e Binary files /dev/null and b/DSLogic-gui/icons/╕┤╝■ down-arrow.png differ diff --git a/DSLogic-gui/icons/╕┤╝■ params.png b/DSLogic-gui/icons/╕┤╝■ params.png new file mode 100644 index 00000000..8c4b2c83 Binary files /dev/null and b/DSLogic-gui/icons/╕┤╝■ params.png differ diff --git a/DSLogic-gui/main.cpp b/DSLogic-gui/main.cpp new file mode 100644 index 00000000..04772d4e --- /dev/null +++ b/DSLogic-gui/main.cpp @@ -0,0 +1,161 @@ +/* + * This file is part of the PulseView project. + * + * Copyright (C) 2012 Joel Holdsworth + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifdef ENABLE_SIGROKDECODE +#include /* First, so we avoid a _POSIX_C_SOURCE warning. */ +#endif + +#include +#include + +#include + +#include +#include +#include + +#include "pv/devicemanager.h" +#include "pv/mainwindow.h" + +#include "config.h" + +void usage() +{ + fprintf(stdout, + "Usage:\n" + " %s [OPTION…] [FILE] — %s\n" + "\n" + "Help Options:\n" + " -l, --loglevel Set libsigrok/libsigrokdecode loglevel\n" + " -V, --version Show release version\n" + " -h, -?, --help Show help option\n" + "\n", DS_BIN_NAME, DS_DESCRIPTION); +} + +int main(int argc, char *argv[]) +{ + int ret = 0; + struct sr_context *sr_ctx = NULL; + const char *open_file = NULL; + + QApplication a(argc, argv); + + // Set some application metadata + QApplication::setApplicationVersion(DS_VERSION_STRING); + QApplication::setApplicationName("DSLogic"); + QApplication::setOrganizationDomain("http://www.DreamSourceLab.com"); + + // Parse arguments + while (1) { + static const struct option long_options[] = { + {"loglevel", required_argument, 0, 'l'}, + {"version", no_argument, 0, 'V'}, + {"help", no_argument, 0, 'h'}, + {0, 0, 0, 0} + }; + + const int c = getopt_long(argc, argv, + "l:Vh?", long_options, NULL); + if (c == -1) + break; + + switch (c) { + case 'l': + { + const int loglevel = atoi(optarg); + sr_log_loglevel_set(loglevel); + +#ifdef ENABLE_SIGROKDECODE + srd_log_loglevel_set(loglevel); +#endif + + break; + } + + case 'V': + // Print version info + fprintf(stdout, "%s %s\n", DS_TITLE, DS_VERSION_STRING); + return 0; + + case 'h': + case '?': + usage(); + return 0; + } + } + + if (argc - optind > 1) { + fprintf(stderr, "Only one file can be openened.\n"); + return 1; + } else if (argc - optind == 1) + open_file = argv[argc - 1]; + + // Initialise libsigrok + if (sr_init(&sr_ctx) != SR_OK) { + qDebug() << "ERROR: libsigrok init failed."; + return 1; + } + + do { + +#ifdef ENABLE_SIGROKDECODE + // Initialise libsigrokdecode + if (srd_init(NULL) != SRD_OK) { + qDebug() << "ERROR: libsigrokdecode init failed."; + break; + } + + // Load the protocol decoders + srd_decoder_load_all(); +#endif + + try { + // Create the device manager, initialise the drivers + pv::DeviceManager device_manager(sr_ctx); + + // Initialise the main window + pv::MainWindow w(device_manager, open_file); + //QFile qss(":/levelfour.qss"); + QFile qss(":/stylesheet.qss"); + qss.open(QFile::ReadOnly); + a.setStyleSheet(qss.readAll()); + qss.close(); + w.show(); + + // Run the application + ret = a.exec(); + + } catch(std::exception e) { + qDebug() << e.what(); + } + +#ifdef ENABLE_SIGROKDECODE + // Destroy libsigrokdecode + srd_exit(); +#endif + + } while (0); + + // Destroy libsigrok + if (sr_ctx) + sr_exit(sr_ctx); + + return ret; +} diff --git a/DSLogic-gui/pv/data/analog.cpp b/DSLogic-gui/pv/data/analog.cpp new file mode 100644 index 00000000..a62e2884 --- /dev/null +++ b/DSLogic-gui/pv/data/analog.cpp @@ -0,0 +1,49 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "analog.h" +#include "analogsnapshot.h" + +using namespace boost; +using namespace std; + +namespace pv { +namespace data { + +Analog::Analog(unsigned int num_probes, uint64_t samplerate) : + SignalData(num_probes, samplerate) +{ +} + +void Analog::push_snapshot(shared_ptr &snapshot) +{ + _snapshots.push_front(snapshot); +} + +deque< shared_ptr >& Analog::get_snapshots() +{ + return _snapshots; +} + +} // namespace data +} // namespace pv diff --git a/DSLogic-gui/pv/data/analog.h b/DSLogic-gui/pv/data/analog.h new file mode 100644 index 00000000..281b936c --- /dev/null +++ b/DSLogic-gui/pv/data/analog.h @@ -0,0 +1,55 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_DATA_ANALOG_H +#define DSLOGIC_PV_DATA_ANALOG_H + +#include "signaldata.h" + +#include +#include + +namespace pv { +namespace data { + +class AnalogSnapshot; + +class Analog : public SignalData +{ +public: + Analog(unsigned int num_probes, uint64_t samplerate); + + void push_snapshot( + boost::shared_ptr &snapshot); + + std::deque< boost::shared_ptr >& + get_snapshots(); + +private: + std::deque< boost::shared_ptr > _snapshots; +}; + +} // namespace data +} // namespace pv + +#endif // DSLOGIC_PV_DATA_ANALOG_H diff --git a/DSLogic-gui/pv/data/analogsnapshot.cpp b/DSLogic-gui/pv/data/analogsnapshot.cpp new file mode 100644 index 00000000..3ff8e804 --- /dev/null +++ b/DSLogic-gui/pv/data/analogsnapshot.cpp @@ -0,0 +1,234 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include + +#include +#include +#include +#include + +#include + +#include + +#include "analogsnapshot.h" + +using namespace boost; +using namespace std; + +namespace pv { +namespace data { + +const int AnalogSnapshot::EnvelopeScalePower = 4; +const int AnalogSnapshot::EnvelopeScaleFactor = 1 << EnvelopeScalePower; +const float AnalogSnapshot::LogEnvelopeScaleFactor = + logf(EnvelopeScaleFactor); +const uint64_t AnalogSnapshot::EnvelopeDataUnit = 64*1024; // bytes + +AnalogSnapshot::AnalogSnapshot(const sr_datafeed_analog &analog, uint64_t _total_sample_len, unsigned int channel_num) : + Snapshot(sizeof(uint16_t), _total_sample_len, channel_num) +{ + lock_guard lock(_mutex); + memset(_envelope_levels, 0, sizeof(_envelope_levels)); + init(_total_sample_len * channel_num); + append_payload(analog); +} + +AnalogSnapshot::~AnalogSnapshot() +{ + lock_guard lock(_mutex); + BOOST_FOREACH(Envelope &e, _envelope_levels[0]) + free(e.samples); +} + +void AnalogSnapshot::append_payload( + const sr_datafeed_analog &analog) +{ + lock_guard lock(_mutex); + append_data(analog.data, analog.num_samples); + + // Generate the first mip-map from the data + append_payload_to_envelope_levels(); +} + +const uint16_t* AnalogSnapshot::get_samples( + int64_t start_sample, int64_t end_sample) const +{ + assert(start_sample >= 0); + assert(start_sample < (int64_t)get_sample_count()); + assert(end_sample >= 0); + assert(end_sample < (int64_t)get_sample_count()); + assert(start_sample <= end_sample); + + lock_guard lock(_mutex); + +// uint16_t *const data = new uint16_t[end_sample - start_sample]; +// memcpy(data, (uint16_t*)_data + start_sample, sizeof(uint16_t) * +// (end_sample - start_sample)); +// return data; + return (uint16_t*)_data + start_sample * _channel_num; +} + +void AnalogSnapshot::get_envelope_section(EnvelopeSection &s, + uint64_t start, uint64_t end, float min_length, int probe_index) const +{ + assert(end <= get_sample_count()); + assert(start <= end); + assert(min_length > 0); + + lock_guard lock(_mutex); + + const unsigned int min_level = max((int)floorf(logf(min_length) / + LogEnvelopeScaleFactor) - 1, 0); + const unsigned int scale_power = (min_level + 1) * + EnvelopeScalePower; + start >>= scale_power; + end >>= scale_power; + + s.start = start << scale_power; + s.scale = 1 << scale_power; + s.length = end - start; +// s.samples = new EnvelopeSample[s.length]; +// memcpy(s.samples, _envelope_levels[min_level].samples + start, +// s.length * sizeof(EnvelopeSample)); + s.samples = _envelope_levels[probe_index][min_level].samples + start; +} + +void AnalogSnapshot::reallocate_envelope(Envelope &e) +{ + const uint64_t new_data_length = ((e.length + EnvelopeDataUnit - 1) / + EnvelopeDataUnit) * EnvelopeDataUnit; + if (new_data_length > e.data_length) + { + e.data_length = new_data_length; + e.samples = (EnvelopeSample*)realloc(e.samples, + new_data_length * sizeof(EnvelopeSample)); + } +} + +void AnalogSnapshot::append_payload_to_envelope_levels() +{ + int i; + for (i = 0; i < (int)_channel_num; i++) { + Envelope &e0 = _envelope_levels[i][0]; + uint64_t prev_length; + EnvelopeSample *dest_ptr; + + // Expand the data buffer to fit the new samples + prev_length = e0.length; + e0.length = get_sample_count() / EnvelopeScaleFactor; + + // Break off if there are no new samples to compute + // if (e0.length == prev_length) + // return; + if (e0.length == 0) + return; + if (e0.length == prev_length) + prev_length = 0; + + reallocate_envelope(e0); + + dest_ptr = e0.samples + prev_length; + + // Iterate through the samples to populate the first level mipmap + const uint16_t *const stop_src_ptr = (uint16_t*)_data + + e0.length * EnvelopeScaleFactor * _channel_num; +// for (const uint16_t *src_ptr = (uint16_t*)_data + +// prev_length * EnvelopeScaleFactor; +// src_ptr < end_src_ptr; src_ptr += EnvelopeScaleFactor) +// { +// const EnvelopeSample sub_sample = { +// *min_element(src_ptr, src_ptr + EnvelopeScaleFactor), +// *max_element(src_ptr, src_ptr + EnvelopeScaleFactor), +// }; + +// *dest_ptr++ = sub_sample; +// } + for (const uint16_t *src_ptr = (uint16_t*)_data + + prev_length * EnvelopeScaleFactor * _channel_num + i; + src_ptr < stop_src_ptr; src_ptr += EnvelopeScaleFactor * _channel_num) + { + const uint16_t * begin_src_ptr = + src_ptr; + const uint16_t *const end_src_ptr = + src_ptr + EnvelopeScaleFactor * _channel_num; + + EnvelopeSample sub_sample; + sub_sample.min = *begin_src_ptr; + sub_sample.max = *begin_src_ptr; + begin_src_ptr += _channel_num; + while (begin_src_ptr < end_src_ptr) + { + sub_sample.min = min(sub_sample.min, *begin_src_ptr); + sub_sample.max = max(sub_sample.max, *begin_src_ptr); + begin_src_ptr += _channel_num; + } + + *dest_ptr++ = sub_sample; + } + + // Compute higher level mipmaps + for (unsigned int level = 1; level < ScaleStepCount; level++) + { + Envelope &e = _envelope_levels[i][level]; + const Envelope &el = _envelope_levels[i][level-1]; + + // Expand the data buffer to fit the new samples + prev_length = e.length; + e.length = el.length / EnvelopeScaleFactor; + + // Break off if there are no more samples to computed + // if (e.length == prev_length) + // break; + if (e.length == prev_length) + prev_length = 0; + + reallocate_envelope(e); + + // Subsample the level lower level + const EnvelopeSample *src_ptr = + el.samples + prev_length * EnvelopeScaleFactor; + const EnvelopeSample *const end_dest_ptr = e.samples + e.length; + for (dest_ptr = e.samples + prev_length; + dest_ptr < end_dest_ptr; dest_ptr++) + { + const EnvelopeSample *const end_src_ptr = + src_ptr + EnvelopeScaleFactor; + + EnvelopeSample sub_sample = *src_ptr++; + while (src_ptr < end_src_ptr) + { + sub_sample.min = min(sub_sample.min, src_ptr->min); + sub_sample.max = max(sub_sample.max, src_ptr->max); + src_ptr++; + } + + *dest_ptr = sub_sample; + } + } + } +} + +} // namespace data +} // namespace pv diff --git a/DSLogic-gui/pv/data/analogsnapshot.h b/DSLogic-gui/pv/data/analogsnapshot.h new file mode 100644 index 00000000..c004f88a --- /dev/null +++ b/DSLogic-gui/pv/data/analogsnapshot.h @@ -0,0 +1,98 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_DATA_ANALOGSNAPSHOT_H +#define DSLOGIC_PV_DATA_ANALOGSNAPSHOT_H + +#include "snapshot.h" + +#include +#include + +namespace AnalogSnapshotTest { +class Basic; +} + +namespace pv { +namespace data { + +class AnalogSnapshot : public Snapshot +{ +public: + struct EnvelopeSample + { + uint16_t min; + uint16_t max; + }; + + struct EnvelopeSection + { + uint64_t start; + unsigned int scale; + uint64_t length; + EnvelopeSample *samples; + }; + +private: + struct Envelope + { + uint64_t length; + uint64_t data_length; + EnvelopeSample *samples; + }; + +private: + static const unsigned int ScaleStepCount = 10; + static const int EnvelopeScalePower; + static const int EnvelopeScaleFactor; + static const float LogEnvelopeScaleFactor; + static const uint64_t EnvelopeDataUnit; + +public: + AnalogSnapshot(const sr_datafeed_analog &analog, uint64_t _total_sample_len, unsigned int channel_num); + + virtual ~AnalogSnapshot(); + + void append_payload(const sr_datafeed_analog &analog); + + const uint16_t* get_samples(int64_t start_sample, + int64_t end_sample) const; + + void get_envelope_section(EnvelopeSection &s, + uint64_t start, uint64_t end, float min_length, int probe_index) const; + +private: + void reallocate_envelope(Envelope &l); + + void append_payload_to_envelope_levels(); + +private: + struct Envelope _envelope_levels[2*DS_MAX_ANALOG_PROBES_NUM][ScaleStepCount]; + + friend class AnalogSnapshotTest::Basic; +}; + +} // namespace data +} // namespace pv + +#endif // DSLOGIC_PV_DATA_ANALOGSNAPSHOT_H diff --git a/DSLogic-gui/pv/data/group.cpp b/DSLogic-gui/pv/data/group.cpp new file mode 100644 index 00000000..26cccd7f --- /dev/null +++ b/DSLogic-gui/pv/data/group.cpp @@ -0,0 +1,49 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "group.h" +#include "groupsnapshot.h" + +using namespace boost; +using namespace std; + +namespace pv { +namespace data { + +Group::Group(unsigned int num_probes, uint64_t samplerate) : + SignalData(num_probes, samplerate) +{ +} + +void Group::push_snapshot(shared_ptr &snapshot) +{ + _snapshots.push_back(snapshot); +} + +deque< shared_ptr >& Group::get_snapshots() +{ + return _snapshots; +} + +} // namespace data +} // namespace pv diff --git a/DSLogic-gui/pv/data/group.h b/DSLogic-gui/pv/data/group.h new file mode 100644 index 00000000..c55f6e93 --- /dev/null +++ b/DSLogic-gui/pv/data/group.h @@ -0,0 +1,55 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_DATA_GROUP_H +#define DSLOGIC_PV_DATA_GROUP_H + +#include "signaldata.h" + +#include +#include + +namespace pv { +namespace data { + +class GroupSnapshot; + +class Group : public SignalData +{ +public: + Group(unsigned int num_probes, uint64_t samplerate); + + void push_snapshot( + boost::shared_ptr &snapshot); + + std::deque< boost::shared_ptr >& + get_snapshots(); + +private: + std::deque< boost::shared_ptr > _snapshots; +}; + +} // namespace data +} // namespace pv + +#endif // DSLOGIC_PV_DATA_GROUP_H diff --git a/DSLogic-gui/pv/data/groupsnapshot.cpp b/DSLogic-gui/pv/data/groupsnapshot.cpp new file mode 100644 index 00000000..d46da5bd --- /dev/null +++ b/DSLogic-gui/pv/data/groupsnapshot.cpp @@ -0,0 +1,276 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include + +#include +#include +#include +#include + +#include + +#include + +#include "logicsnapshot.h" +#include "groupsnapshot.h" + +using namespace boost; +using namespace std; + +namespace pv { +namespace data { + +const int GroupSnapshot::EnvelopeScalePower = 4; +const int GroupSnapshot::EnvelopeScaleFactor = 1 << EnvelopeScalePower; +const float GroupSnapshot::LogEnvelopeScaleFactor = + logf(EnvelopeScaleFactor); +const uint64_t GroupSnapshot::EnvelopeDataUnit = 64*1024; // bytes +const uint16_t GroupSnapshot::value_mask[16] = {0x1, 0x2, 0x4, 0x8, + 0x10, 0x20, 0x40, 0x80, + 0x100, 0x200, 0x400, 0x800, + 0x1000, 0x2000, 0x4000, 0x8000}; + +GroupSnapshot::GroupSnapshot(const shared_ptr &_logic_snapshot, std::list index_list) +{ + assert(_logic_snapshot); + + lock_guard lock(_mutex); + memset(_envelope_levels, 0, sizeof(_envelope_levels)); + _data = _logic_snapshot->get_data(); + _sample_count = _logic_snapshot->get_sample_count(); + _unit_size = _logic_snapshot->get_unit_size(); + _index_list = index_list; + append_payload(); +} + +GroupSnapshot::~GroupSnapshot() +{ + lock_guard lock(_mutex); + BOOST_FOREACH(Envelope &e, _envelope_levels) + free(e.samples); +} + +uint64_t GroupSnapshot::get_sample_count() const +{ + lock_guard lock(_mutex); + return _sample_count; +} + +void GroupSnapshot::append_payload() +{ + lock_guard lock(_mutex); + + // Generate the first mip-map from the data + append_payload_to_envelope_levels(); +} + +const uint16_t* GroupSnapshot::get_samples( + int64_t start_sample, int64_t end_sample) +{ + assert(start_sample >= 0); + assert(start_sample < (int64_t)_sample_count); + assert(end_sample >= 0); + assert(end_sample < (int64_t)_sample_count); + assert(start_sample <= end_sample); + + int64_t i; + uint64_t pow; + lock_guard lock(_mutex); + + uint16_t *const data = new uint16_t[end_sample - start_sample]; +// memcpy(data, (uint16_t*)_data + start_sample, sizeof(uint16_t) * +// (end_sample - start_sample)); + memset(data, 0, sizeof(uint16_t) * (end_sample - start_sample)); + for(i = start_sample; i < end_sample; i++) { + std::list::iterator j = _index_list.begin(); + pow = 0; + while(j != _index_list.end()) { + *(data + i - start_sample) += ((*((uint16_t*)_data + i) & value_mask[(*j)]) >> ((*j) - pow)); + pow++; + j++; + } + } + return data; +} + +void GroupSnapshot::get_envelope_section(EnvelopeSection &s, + uint64_t start, uint64_t end, float min_length) const +{ + assert(end <= _sample_count); + assert(start <= end); + assert(min_length > 0); + + lock_guard lock(_mutex); + + const unsigned int min_level = max((int)floorf(logf(min_length) / + LogEnvelopeScaleFactor) - 1, 0); + const unsigned int scale_power = (min_level + 1) * + EnvelopeScalePower; + start >>= scale_power; + end >>= scale_power; + + s.start = start << scale_power; + s.scale = 1 << scale_power; + s.length = end - start; + s.samples = new EnvelopeSample[s.length]; + memcpy(s.samples, _envelope_levels[min_level].samples + start, + s.length * sizeof(EnvelopeSample)); +} + +void GroupSnapshot::reallocate_envelope(Envelope &e) +{ + const uint64_t new_data_length = ((e.length + EnvelopeDataUnit - 1) / + EnvelopeDataUnit) * EnvelopeDataUnit; + if (new_data_length > e.data_length) + { + e.data_length = new_data_length; + e.samples = (EnvelopeSample*)realloc(e.samples, + new_data_length * sizeof(EnvelopeSample)); + } +} + +void GroupSnapshot::append_payload_to_envelope_levels() +{ + Envelope &e0 = _envelope_levels[0]; + uint64_t prev_length; + EnvelopeSample *dest_ptr; + + // Expand the data buffer to fit the new samples + prev_length = e0.length; + e0.length = _sample_count / EnvelopeScaleFactor; + + // Break off if there are no new samples to compute + if (e0.length == prev_length) + return; + + reallocate_envelope(e0); + + dest_ptr = e0.samples + prev_length; + + // Iterate through the samples to populate the first level mipmap + uint16_t group_value[EnvelopeScaleFactor]; + const uint16_t *const end_src_ptr = (uint16_t*)_data + + e0.length * EnvelopeScaleFactor; + for (const uint16_t *src_ptr = (uint16_t*)_data + + prev_length * EnvelopeScaleFactor; + src_ptr < end_src_ptr; src_ptr += EnvelopeScaleFactor) + { + int pow; +// for(i = 0; i < EnvelopeScaleFactor; i++) { +// group_value[i] = 0; +// std::list::iterator j = _index_list.begin(); +// pow = 0; +// while(j != _index_list.end()) { +// group_value[i] += ((*(src_ptr + i) & value_mask[(*j)]) >> ((*j) - pow)); +// pow++; +// j++; +// } +// } + group_value[0] = 0; + group_value[1] = 0; + group_value[2] = 0; + group_value[3] = 0; + group_value[4] = 0; + group_value[5] = 0; + group_value[6] = 0; + group_value[7] = 0; + group_value[8] = 0; + group_value[9] = 0; + group_value[10] = 0; + group_value[11] = 0; + group_value[12] = 0; + group_value[13] = 0; + group_value[14] = 0; + group_value[15] = 0; + std::list::iterator j = _index_list.begin(); + pow = 0; + while(j != _index_list.end()) { + group_value[0] += ((*(src_ptr + 0) & value_mask[(*j)]) >> ((*j) - pow)); + group_value[1] += ((*(src_ptr + 1) & value_mask[(*j)]) >> ((*j) - pow)); + group_value[2] += ((*(src_ptr + 2) & value_mask[(*j)]) >> ((*j) - pow)); + group_value[3] += ((*(src_ptr + 3) & value_mask[(*j)]) >> ((*j) - pow)); + group_value[4] += ((*(src_ptr + 4) & value_mask[(*j)]) >> ((*j) - pow)); + group_value[5] += ((*(src_ptr + 5) & value_mask[(*j)]) >> ((*j) - pow)); + group_value[6] += ((*(src_ptr + 6) & value_mask[(*j)]) >> ((*j) - pow)); + group_value[7] += ((*(src_ptr + 7) & value_mask[(*j)]) >> ((*j) - pow)); + group_value[8] += ((*(src_ptr + 8) & value_mask[(*j)]) >> ((*j) - pow)); + group_value[9] += ((*(src_ptr + 9) & value_mask[(*j)]) >> ((*j) - pow)); + group_value[10] += ((*(src_ptr + 10) & value_mask[(*j)]) >> ((*j) - pow)); + group_value[11] += ((*(src_ptr + 11) & value_mask[(*j)]) >> ((*j) - pow)); + group_value[12] += ((*(src_ptr + 12) & value_mask[(*j)]) >> ((*j) - pow)); + group_value[13] += ((*(src_ptr + 13) & value_mask[(*j)]) >> ((*j) - pow)); + group_value[14] += ((*(src_ptr + 14) & value_mask[(*j)]) >> ((*j) - pow)); + group_value[15] += ((*(src_ptr + 15) & value_mask[(*j)]) >> ((*j) - pow)); + pow++; + j++; + } + const EnvelopeSample sub_sample = { + *min_element(group_value, group_value + EnvelopeScaleFactor), + *max_element(group_value, group_value + EnvelopeScaleFactor), + }; + + *dest_ptr++ = sub_sample; + } + + // Compute higher level mipmaps + for (unsigned int level = 1; level < ScaleStepCount; level++) + { + Envelope &e = _envelope_levels[level]; + const Envelope &el = _envelope_levels[level-1]; + + // Expand the data buffer to fit the new samples + prev_length = e.length; + e.length = el.length / EnvelopeScaleFactor; + + // Break off if there are no more samples to computed + if (e.length == prev_length) + break; + + reallocate_envelope(e); + + // Subsample the level lower level + const EnvelopeSample *src_ptr = + el.samples + prev_length * EnvelopeScaleFactor; + const EnvelopeSample *const end_dest_ptr = e.samples + e.length; + for (dest_ptr = e.samples + prev_length; + dest_ptr < end_dest_ptr; dest_ptr++) + { + const EnvelopeSample *const end_src_ptr = + src_ptr + EnvelopeScaleFactor; + + EnvelopeSample sub_sample = *src_ptr++; + while (src_ptr < end_src_ptr) + { + sub_sample.min = min(sub_sample.min, src_ptr->min); + sub_sample.max = max(sub_sample.max, src_ptr->max); + src_ptr++; + } + + *dest_ptr = sub_sample; + } + } +} + +} // namespace data +} // namespace pv diff --git a/DSLogic-gui/pv/data/groupsnapshot.h b/DSLogic-gui/pv/data/groupsnapshot.h new file mode 100644 index 00000000..083e08e0 --- /dev/null +++ b/DSLogic-gui/pv/data/groupsnapshot.h @@ -0,0 +1,113 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_DATA_GROUPSNAPSHOT_H +#define DSLOGIC_PV_DATA_GROUPSNAPSHOT_H + +#include +#include + +#include "../view/signal.h" + +#include +#include +#include + +namespace GroupSnapshotTest { +class Basic; +} + +namespace pv { +namespace data { + +class LogicSnapshot; + +class GroupSnapshot +{ +public: + struct EnvelopeSample + { + uint16_t min; + uint16_t max; + }; + + struct EnvelopeSection + { + uint64_t start; + unsigned int scale; + uint64_t length; + EnvelopeSample *samples; + }; + +private: + struct Envelope + { + uint64_t length; + uint64_t data_length; + EnvelopeSample *samples; + }; + +private: + static const unsigned int ScaleStepCount = 10; + static const int EnvelopeScalePower; + static const int EnvelopeScaleFactor; + static const float LogEnvelopeScaleFactor; + static const uint64_t EnvelopeDataUnit; + static const uint16_t value_mask[16]; + +public: + GroupSnapshot(const boost::shared_ptr &_logic_snapshot, std::list index_list); + + virtual ~GroupSnapshot(); + + void append_payload(); + + uint64_t get_sample_count() const; + + const uint16_t* get_samples(int64_t start_sample, + int64_t end_sample); + + void get_envelope_section(EnvelopeSection &s, + uint64_t start, uint64_t end, float min_length) const; + +private: + void reallocate_envelope(Envelope &l); + + void append_payload_to_envelope_levels(); + +private: + struct Envelope _envelope_levels[ScaleStepCount]; + mutable boost::recursive_mutex _mutex; + void *_data; + uint64_t _sample_count; + int _unit_size; + boost::shared_ptr _signal; + std::list _index_list; + + friend class GroupSnapshotTest::Basic; +}; + +} // namespace data +} // namespace pv + +#endif // DSLOGIC_PV_DATA_GROUPSNAPSHOT_H diff --git a/DSLogic-gui/pv/data/logic.cpp b/DSLogic-gui/pv/data/logic.cpp new file mode 100644 index 00000000..036cc543 --- /dev/null +++ b/DSLogic-gui/pv/data/logic.cpp @@ -0,0 +1,51 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "logic.h" +#include "logicsnapshot.h" + +using namespace boost; +using namespace std; + +namespace pv { +namespace data { + +Logic::Logic(unsigned int num_probes, uint64_t samplerate) : + SignalData(num_probes, samplerate) +{ + assert(_num_probes > 0); +} + +void Logic::push_snapshot( + shared_ptr &snapshot) +{ + _snapshots.push_front(snapshot); +} + +deque< shared_ptr >& Logic::get_snapshots() +{ + return _snapshots; +} + +} // namespace data +} // namespace pv diff --git a/DSLogic-gui/pv/data/logic.h b/DSLogic-gui/pv/data/logic.h new file mode 100644 index 00000000..d7e23d36 --- /dev/null +++ b/DSLogic-gui/pv/data/logic.h @@ -0,0 +1,55 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_DATA_LOGIC_H +#define DSLOGIC_PV_DATA_LOGIC_H + +#include "signaldata.h" + +#include +#include + +namespace pv { +namespace data { + +class LogicSnapshot; + +class Logic : public SignalData +{ +public: + Logic(unsigned int num_probes, uint64_t samplerate); + + void push_snapshot( + boost::shared_ptr &snapshot); + + std::deque< boost::shared_ptr >& + get_snapshots(); + +private: + std::deque< boost::shared_ptr > _snapshots; +}; + +} // namespace data +} // namespace pv + +#endif // DSLOGIC_PV_DATA_LOGIC_H diff --git a/DSLogic-gui/pv/data/logicsnapshot.cpp b/DSLogic-gui/pv/data/logicsnapshot.cpp new file mode 100644 index 00000000..e01386a4 --- /dev/null +++ b/DSLogic-gui/pv/data/logicsnapshot.cpp @@ -0,0 +1,866 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include + +#include +#include +#include +#include + +#include + +#include "logicsnapshot.h" + +using namespace boost; +using namespace std; + +namespace pv { +namespace data { + +const int LogicSnapshot::MipMapScalePower = 4; +const int LogicSnapshot::MipMapScaleFactor = 1 << MipMapScalePower; +const float LogicSnapshot::LogMipMapScaleFactor = logf(MipMapScaleFactor); +const uint64_t LogicSnapshot::MipMapDataUnit = 64*1024; // bytes + +LogicSnapshot::LogicSnapshot(const sr_datafeed_logic &logic, uint64_t _total_sample_len, unsigned int channel_num) : + Snapshot(logic.unitsize, _total_sample_len, channel_num), + _last_append_sample(0) +{ + lock_guard lock(_mutex); + memset(_mip_map, 0, sizeof(_mip_map)); + if (init(_total_sample_len * channel_num) == SR_OK) + append_payload(logic); +} + +LogicSnapshot::~LogicSnapshot() +{ + lock_guard lock(_mutex); + BOOST_FOREACH(MipMapLevel &l, _mip_map) + free(l.data); +} + +void LogicSnapshot::append_payload( + const sr_datafeed_logic &logic) +{ + assert(_unit_size == logic.unitsize); + assert((logic.length % _unit_size) == 0); + + lock_guard lock(_mutex); + + append_data(logic.data, logic.length / _unit_size); + + // Generate the first mip-map from the data + append_payload_to_mipmap(); +} + +void LogicSnapshot::reallocate_mipmap_level(MipMapLevel &m) +{ + const uint64_t new_data_length = ((m.length + MipMapDataUnit - 1) / + MipMapDataUnit) * MipMapDataUnit; + if (new_data_length > m.data_length) + { + m.data_length = new_data_length; + + // Padding is added to allow for the uint64_t write word + m.data = realloc(m.data, new_data_length * _unit_size + + sizeof(uint64_t)); + } +} + +void LogicSnapshot::append_payload_to_mipmap() +{ + MipMapLevel &m0 = _mip_map[0]; + uint64_t prev_length; + const uint8_t *src_ptr; + uint8_t *dest_ptr; + uint64_t accumulator; + unsigned int diff_counter; + + // Expand the data buffer to fit the new samples + prev_length = m0.length; + m0.length = _sample_count / MipMapScaleFactor; + + // Break off if there are no new samples to compute + if (m0.length == prev_length) + return; + + reallocate_mipmap_level(m0); + + dest_ptr = (uint8_t*)m0.data + prev_length * _unit_size; + + // Iterate through the samples to populate the first level mipmap + const uint8_t *const end_src_ptr = (uint8_t*)_data + + m0.length * _unit_size * MipMapScaleFactor; + for (src_ptr = (uint8_t*)_data + + prev_length * _unit_size * MipMapScaleFactor; + src_ptr < end_src_ptr;) + { + // Accumulate transitions which have occurred in this sample + accumulator = 0; + diff_counter = MipMapScaleFactor; + while (diff_counter-- > 0) + { + const uint64_t sample = *(uint64_t*)src_ptr; + accumulator |= _last_append_sample ^ sample; + _last_append_sample = sample; + src_ptr += _unit_size; + } + + *(uint64_t*)dest_ptr = accumulator; + dest_ptr += _unit_size; + } + + // Compute higher level mipmaps + for (unsigned int level = 1; level < ScaleStepCount; level++) + { + MipMapLevel &m = _mip_map[level]; + const MipMapLevel &ml = _mip_map[level-1]; + + // Expand the data buffer to fit the new samples + prev_length = m.length; + m.length = ml.length / MipMapScaleFactor; + + // Break off if there are no more samples to computed + if (m.length == prev_length) + break; + + reallocate_mipmap_level(m); + + // Subsample the level lower level + src_ptr = (uint8_t*)ml.data + + _unit_size * prev_length * MipMapScaleFactor; + const uint8_t *const end_dest_ptr = + (uint8_t*)m.data + _unit_size * m.length; + for (dest_ptr = (uint8_t*)m.data + + _unit_size * prev_length; + dest_ptr < end_dest_ptr; + dest_ptr += _unit_size) + { + accumulator = 0; + diff_counter = MipMapScaleFactor; + while (diff_counter-- > 0) + { + accumulator |= *(uint64_t*)src_ptr; + src_ptr += _unit_size; + } + + *(uint64_t*)dest_ptr = accumulator; + } + } +} + +uint64_t LogicSnapshot::get_sample(uint64_t index) const +{ + assert(_data); + assert(index < _sample_count); + + return *(uint64_t*)((uint8_t*)_data + index * _unit_size); +} + +void LogicSnapshot::get_subsampled_edges( + std::vector &edges, + uint64_t start, uint64_t end, + float min_length, int sig_index) +{ + uint64_t index = start; + unsigned int level; + bool last_sample; + bool fast_forward; + + assert(end <= get_sample_count()); + assert(start <= end); + assert(min_length > 0); + assert(sig_index >= 0); + assert(sig_index < 64); + + lock_guard lock(_mutex); + + const uint64_t block_length = (uint64_t)max(min_length, 1.0f); + const unsigned int min_level = max((int)floorf(logf(min_length) / + LogMipMapScaleFactor) - 1, 0); + const uint64_t sig_mask = 1ULL << sig_index; + + if (!edges.empty()) + edges.clear(); + // Store the initial state + last_sample = (get_sample(start) & sig_mask) != 0; + edges.push_back(pair(index++, last_sample)); + + while (index + block_length <= end) + { + //----- Continue to search -----// + level = min_level; + + // We cannot fast-forward if there is no mip-map data at + // at the minimum level. + fast_forward = (_mip_map[level].data != NULL); + + if (min_length < MipMapScaleFactor) + { + // Search individual samples up to the beginning of + // the next first level mip map block + const uint64_t final_index = min(end, + pow2_ceil(index, MipMapScalePower)); + + for (; index < final_index && + (index & ~(~0 << MipMapScalePower)) != 0; + index++) + { + const bool sample = + (get_sample(index) & sig_mask) != 0; + + // If there was a change we cannot fast forward + if (sample != last_sample) { + fast_forward = false; + break; + } + } + } + else + { + // If resolution is less than a mip map block, + // round up to the beginning of the mip-map block + // for this level of detail + const int min_level_scale_power = + (level + 1) * MipMapScalePower; + index = pow2_ceil(index, min_level_scale_power); + if (index >= end) + break; + + // We can fast forward only if there was no change + const bool sample = + (get_sample(index) & sig_mask) != 0; + if (last_sample != sample) + fast_forward = false; + } + + if (fast_forward) { + + // Fast forward: This involves zooming out to higher + // levels of the mip map searching for changes, then + // zooming in on them to find the point where the edge + // begins. + + // Slide right and zoom out at the beginnings of mip-map + // blocks until we encounter a change + while (1) { + const int level_scale_power = + (level + 1) * MipMapScalePower; + const uint64_t offset = + index >> level_scale_power; + + // Check if we reached the last block at this + // level, or if there was a change in this block + if (offset >= _mip_map[level].length || + (get_subsample(level, offset) & + sig_mask)) + break; + + if ((offset & ~(~0 << MipMapScalePower)) == 0) { + // If we are now at the beginning of a + // higher level mip-map block ascend one + // level + if (level + 1 >= ScaleStepCount || + !_mip_map[level + 1].data) + break; + + level++; + } else { + // Slide right to the beginning of the + // next mip map block + index = pow2_ceil(index + 1, + level_scale_power); + } + } + + // Zoom in, and slide right until we encounter a change, + // and repeat until we reach min_level + while (1) { + assert(_mip_map[level].data); + + const int level_scale_power = + (level + 1) * MipMapScalePower; + const uint64_t offset = + index >> level_scale_power; + + // Check if we reached the last block at this + // level, or if there was a change in this block + if (offset >= _mip_map[level].length || + (get_subsample(level, offset) & + sig_mask)) { + // Zoom in unless we reached the minimum + // zoom + if (level == min_level) + break; + + level--; + } else { + // Slide right to the beginning of the + // next mip map block + index = pow2_ceil(index + 1, + level_scale_power); + } + } + + // If individual samples within the limit of resolution, + // do a linear search for the next transition within the + // block + if (min_length < MipMapScaleFactor) { + for (; index < end; index++) { + const bool sample = (get_sample(index) & + sig_mask) != 0; + if (sample != last_sample) + break; + } + } + } + + //----- Store the edge -----// + + // Take the last sample of the quanization block + const int64_t final_index = index + block_length; + if (index + block_length > end) + break; + + // Store the final state + const bool final_sample = + (get_sample(final_index - 1) & sig_mask) != 0; + edges.push_back(pair(index, final_sample)); + + index = final_index; + last_sample = final_sample; + } + + // Add the final state + const bool end_sample = ((get_sample(end) & sig_mask) != 0); + if ((end != get_sample_count() - 1) || + ((end == get_sample_count() - 1) && end_sample != last_sample)) + edges.push_back(pair(end, end_sample)); + + if (end == get_sample_count() - 1) + edges.push_back(pair(end + 1, ~last_sample)); +} + +int LogicSnapshot::get_first_edge( + uint64_t &edge_index, bool &edge, + uint64_t start, uint64_t end, + int sig_index, int edge_type, + int flag_index, int flag) +{ + uint64_t index = start; + unsigned int level; + bool last_sample; + bool fast_forward; + + assert(end <= get_sample_count()); + assert(start <= end); + assert(sig_index >= 0); + assert(sig_index < 64); + + lock_guard lock(_mutex); + + const uint64_t block_length = 1; + const unsigned int min_level = 0; + const uint64_t sig_mask = 1ULL << sig_index; + const uint64_t flag_mask = 1ULL << flag_index; + + // Store the initial state + last_sample = (get_sample(start) & sig_mask) != 0; + + while (index + block_length <= end) + { + //----- Continue to search -----// + level = min_level; + + // We cannot fast-forward if there is no mip-map data at + // at the minimum level. + fast_forward = (_mip_map[level].data != NULL); + + // Search individual samples up to the beginning of + // the next first level mip map block + uint64_t final_index = min(end, + pow2_ceil(index, MipMapScalePower)); + + for (; index < final_index && + (index & ~(~0 << MipMapScalePower)) != 0; + index++) + { + const bool sample = + (get_sample(index) & sig_mask) != 0; + + // If there was a change we cannot fast forward + if (sample != last_sample) { + fast_forward = false; + break; + } + } + + if (fast_forward) { + + // Fast forward: This involves zooming out to higher + // levels of the mip map searching for changes, then + // zooming in on them to find the point where the edge + // begins. + + // Slide right and zoom out at the beginnings of mip-map + // blocks until we encounter a change + while (1) { + const int level_scale_power = + (level + 1) * MipMapScalePower; + const uint64_t offset = + index >> level_scale_power; + + // Check if we reached the last block at this + // level, or if there was a change in this block + if (offset >= _mip_map[level].length || + (get_subsample(level, offset) & + sig_mask)) + break; + + if ((offset & ~(~0 << MipMapScalePower)) == 0) { + // If we are now at the beginning of a + // higher level mip-map block ascend one + // level + if (level + 1 >= ScaleStepCount || + !_mip_map[level + 1].data) + break; + + level++; + } else { + // Slide right to the beginning of the + // next mip map block + index = pow2_ceil(index + 1, + level_scale_power); + } + } + + // Zoom in, and slide right until we encounter a change, + // and repeat until we reach min_level + while (1) { + assert(_mip_map[level].data); + + const int level_scale_power = + (level + 1) * MipMapScalePower; + const uint64_t offset = + index >> level_scale_power; + + // Check if we reached the last block at this + // level, or if there was a change in this block + if (offset >= _mip_map[level].length || + (get_subsample(level, offset) & + sig_mask)) { + // Zoom in unless we reached the minimum + // zoom + if (level == min_level) + break; + + level--; + } else { + // Slide right to the beginning of the + // next mip map block + index = pow2_ceil(index + 1, + level_scale_power); + } + } + + // If individual samples within the limit of resolution, + // do a linear search for the next transition within the + // block + for (; index < end; index++) { + const bool sample = (get_sample(index) & + sig_mask) != 0; + if (sample != last_sample) + break; + } + } + + //----- Store the edge -----// + + // Take the last sample of the quanization block + final_index = index + block_length; + if (index + block_length > end) + break; + + // Store the final state + const bool final_sample = + (get_sample(final_index - 1) & sig_mask) != 0; + if (final_index > 1) { + const bool final_flag_sample = ((get_sample(final_index - 1) & flag_mask) != 0); + const bool final_pre_flag_sample = ((get_sample(final_index - 2) & flag_mask) != 0); + if (final_sample != last_sample && + ((edge_type == -1) || final_sample == (edge_type != 0)) && + ((flag == -1) || (final_flag_sample == (flag != 0) && final_flag_sample == final_pre_flag_sample))) { + edge_index = index; + edge = final_sample; + return SR_OK; + } + } + + index = final_index; + last_sample = final_sample; + } + + // Add the final state + const bool end_sample = ((get_sample(end) & sig_mask) != 0); + const bool end_flag_sample = ((get_sample(end) & flag_mask) != 0); + const bool end_pre_flag_sample = ((get_sample(end - 1) & flag_mask) != 0); + if (end_sample != last_sample && + ((edge_type == -1) || end_sample == (edge_type != 0)) && + ((flag == -1) || (end_flag_sample == (flag != 0) && end_flag_sample == end_pre_flag_sample))) { + edge_index = end; + edge = end_sample; + return SR_OK; + } else { + return SR_ERR; + } +} + +void LogicSnapshot::get_edges( + std::vector &edges, + uint64_t start, uint64_t end, int sig_index, int edge_type) +{ + uint64_t index = start; + unsigned int level; + bool last_sample; + bool fast_forward; + + assert(end <= get_sample_count()); + assert(start <= end); + assert(sig_index >= 0); + assert(sig_index < 64); + + lock_guard lock(_mutex); + + const uint64_t block_length = 1; + const unsigned int min_level = 0; + const uint64_t sig_mask = 1ULL << sig_index; + + if (!edges.empty()) + edges.clear(); + // Store the initial state + last_sample = (get_sample(start) & sig_mask) != 0; + + while (index + block_length <= end) + { + //----- Continue to search -----// + level = min_level; + + // We cannot fast-forward if there is no mip-map data at + // at the minimum level. + fast_forward = (_mip_map[level].data != NULL); + + // Search individual samples up to the beginning of + // the next first level mip map block + uint64_t final_index = min(end, + pow2_ceil(index, MipMapScalePower)); + + for (; index < final_index && + (index & ~(~0 << MipMapScalePower)) != 0; + index++) + { + const bool sample = + (get_sample(index) & sig_mask) != 0; + + // If there was a change we cannot fast forward + if (sample != last_sample) { + fast_forward = false; + break; + } + } + + if (fast_forward) { + + // Fast forward: This involves zooming out to higher + // levels of the mip map searching for changes, then + // zooming in on them to find the point where the edge + // begins. + + // Slide right and zoom out at the beginnings of mip-map + // blocks until we encounter a change + while (1) { + const int level_scale_power = + (level + 1) * MipMapScalePower; + const uint64_t offset = + index >> level_scale_power; + + // Check if we reached the last block at this + // level, or if there was a change in this block + if (offset >= _mip_map[level].length || + (get_subsample(level, offset) & + sig_mask)) + break; + + if ((offset & ~(~0 << MipMapScalePower)) == 0) { + // If we are now at the beginning of a + // higher level mip-map block ascend one + // level + if (level + 1 >= ScaleStepCount || + !_mip_map[level + 1].data) + break; + + level++; + } else { + // Slide right to the beginning of the + // next mip map block + index = pow2_ceil(index + 1, + level_scale_power); + } + } + + // Zoom in, and slide right until we encounter a change, + // and repeat until we reach min_level + while (1) { + assert(_mip_map[level].data); + + const int level_scale_power = + (level + 1) * MipMapScalePower; + const uint64_t offset = + index >> level_scale_power; + + // Check if we reached the last block at this + // level, or if there was a change in this block + if (offset >= _mip_map[level].length || + (get_subsample(level, offset) & + sig_mask)) { + // Zoom in unless we reached the minimum + // zoom + if (level == min_level) + break; + + level--; + } else { + // Slide right to the beginning of the + // next mip map block + index = pow2_ceil(index + 1, + level_scale_power); + } + } + + // If individual samples within the limit of resolution, + // do a linear search for the next transition within the + // block + for (; index < end; index++) { + const bool sample = (get_sample(index) & + sig_mask) != 0; + if (sample != last_sample) + break; + } + } + + //----- Store the edge -----// + + // Take the last sample of the quanization block + final_index = index + block_length; + if (index + block_length > end) + break; + + // Store the final state + const bool final_sample = + (get_sample(final_index - 1) & sig_mask) != 0; + if ((edge_type == -1) || (final_sample == (edge_type != 0))) + edges.push_back(pair(final_index - 1, final_sample)); + + index = final_index; + last_sample = final_sample; + } + + // Add the final state + const bool end_sample = ((get_sample(end) & sig_mask) != 0); + if ((end_sample != last_sample) && + ((edge_type == -1) || (end_sample == (edge_type != 0)))) + edges.push_back(pair(end, end_sample)); +} + +uint64_t LogicSnapshot::get_min_pulse(uint64_t start, uint64_t end, int sig_index) +{ + uint64_t index = start; + unsigned int level; + bool last_sample; + bool fast_forward; + uint64_t last_index; + uint64_t min_pulse = end - start; + + assert(end <= get_sample_count()); + assert(start <= end); + assert(sig_index >= 0); + assert(sig_index < 64); + + lock_guard lock(_mutex); + + const uint64_t block_length = 1; + const unsigned int min_level = 0; + const uint64_t sig_mask = 1ULL << sig_index; + + // Store the initial state + last_index = start; + last_sample = (get_sample(start) & sig_mask) != 0; + + while (index + block_length <= end) + { + //----- Continue to search -----// + level = min_level; + + // We cannot fast-forward if there is no mip-map data at + // at the minimum level. + fast_forward = (_mip_map[level].data != NULL); + + // Search individual samples up to the beginning of + // the next first level mip map block + uint64_t final_index = min(end, + pow2_ceil(index, MipMapScalePower)); + + for (; index < final_index && + (index & ~(~0 << MipMapScalePower)) != 0; + index++) + { + const bool sample = + (get_sample(index) & sig_mask) != 0; + + // If there was a change we cannot fast forward + if (sample != last_sample) { + fast_forward = false; + break; + } + } + + if (fast_forward) { + + // Fast forward: This involves zooming out to higher + // levels of the mip map searching for changes, then + // zooming in on them to find the point where the edge + // begins. + + // Slide right and zoom out at the beginnings of mip-map + // blocks until we encounter a change + while (1) { + const int level_scale_power = + (level + 1) * MipMapScalePower; + const uint64_t offset = + index >> level_scale_power; + + // Check if we reached the last block at this + // level, or if there was a change in this block + if (offset >= _mip_map[level].length || + (get_subsample(level, offset) & + sig_mask)) + break; + + if ((offset & ~(~0 << MipMapScalePower)) == 0) { + // If we are now at the beginning of a + // higher level mip-map block ascend one + // level + if (level + 1 >= ScaleStepCount || + !_mip_map[level + 1].data) + break; + + level++; + } else { + // Slide right to the beginning of the + // next mip map block + index = pow2_ceil(index + 1, + level_scale_power); + } + } + + // Zoom in, and slide right until we encounter a change, + // and repeat until we reach min_level + while (1) { + assert(_mip_map[level].data); + + const int level_scale_power = + (level + 1) * MipMapScalePower; + const uint64_t offset = + index >> level_scale_power; + + // Check if we reached the last block at this + // level, or if there was a change in this block + if (offset >= _mip_map[level].length || + (get_subsample(level, offset) & + sig_mask)) { + // Zoom in unless we reached the minimum + // zoom + if (level == min_level) + break; + + level--; + } else { + // Slide right to the beginning of the + // next mip map block + index = pow2_ceil(index + 1, + level_scale_power); + } + } + + // If individual samples within the limit of resolution, + // do a linear search for the next transition within the + // block + for (; index < end; index++) { + const bool sample = (get_sample(index) & + sig_mask) != 0; + if (sample != last_sample) + break; + } + } + + //----- Store the edge -----// + + // Take the last sample of the quanization block + final_index = index + block_length; + if (index + block_length > end) + break; + + // get pulse width + const bool final_sample = + (get_sample(final_index - 1) & sig_mask) != 0; + min_pulse = min(index - last_index, min_pulse); + last_index = index; + if (min_pulse == 1) + break; + + index = final_index; + last_sample = final_sample; + } + + // Add the final state + min_pulse = min(end - last_index, min_pulse); + + return min_pulse; +} + +uint64_t LogicSnapshot::get_subsample(int level, uint64_t offset) const +{ + assert(level >= 0); + assert(_mip_map[level].data); + return *(uint64_t*)((uint8_t*)_mip_map[level].data + + _unit_size * offset); +} + +uint64_t LogicSnapshot::pow2_ceil(uint64_t x, unsigned int power) +{ + const uint64_t p = 1 << power; + return (x + p - 1) / p * p; +} + +} // namespace data +} // namespace pv diff --git a/DSLogic-gui/pv/data/logicsnapshot.h b/DSLogic-gui/pv/data/logicsnapshot.h new file mode 100644 index 00000000..5a3bff88 --- /dev/null +++ b/DSLogic-gui/pv/data/logicsnapshot.h @@ -0,0 +1,121 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_DATA_LOGICSNAPSHOT_H +#define DSLOGIC_PV_DATA_LOGICSNAPSHOT_H + +#include "snapshot.h" + +#include +#include + +namespace LogicSnapshotTest { +class Pow2; +class Basic; +class LargeData; +class Pulses; +class LongPulses; +} + +namespace pv { +namespace data { + +class LogicSnapshot : public Snapshot +{ +private: + struct MipMapLevel + { + uint64_t length; + uint64_t data_length; + void *data; + }; + +private: + static const unsigned int ScaleStepCount = 10; + static const int MipMapScalePower; + static const int MipMapScaleFactor; + static const float LogMipMapScaleFactor; + static const uint64_t MipMapDataUnit; + +public: + typedef std::pair EdgePair; + +public: + LogicSnapshot(const sr_datafeed_logic &logic, uint64_t _total_sample_len, unsigned int channel_num); + + virtual ~LogicSnapshot(); + + void append_payload(const sr_datafeed_logic &logic); + + uint64_t get_sample(uint64_t index) const; + +private: + void reallocate_mipmap_level(MipMapLevel &m); + + void append_payload_to_mipmap(); + +public: + /** + * Parses a logic data snapshot to generate a list of transitions + * in a time interval to a given level of detail. + * @param[out] edges The vector to place the edges into. + * @param[in] start The start sample index. + * @param[in] end The end sample index. + * @param[in] min_length The minimum number of samples that + * can be resolved at this level of detail. + * @param[in] sig_index The index of the signal. + **/ + void get_subsampled_edges(std::vector &edges, + uint64_t start, uint64_t end, + float min_length, int sig_index); + + int get_first_edge(uint64_t &edge_index, bool &edge, + uint64_t start, uint64_t end, + int sig_index, int edge_type, + int flag_index, int flag); + + void get_edges(std::vector &edges, + uint64_t start, uint64_t end, int sig_index, int edge_type); + + uint64_t get_min_pulse(uint64_t start, uint64_t end, int sig_index); + +private: + uint64_t get_subsample(int level, uint64_t offset) const; + + static uint64_t pow2_ceil(uint64_t x, unsigned int power); + +private: + struct MipMapLevel _mip_map[ScaleStepCount]; + uint64_t _last_append_sample; + + friend class LogicSnapshotTest::Pow2; + friend class LogicSnapshotTest::Basic; + friend class LogicSnapshotTest::LargeData; + friend class LogicSnapshotTest::Pulses; + friend class LogicSnapshotTest::LongPulses; +}; + +} // namespace data +} // namespace pv + +#endif // DSLOGIC_PV_DATA_LOGICSNAPSHOT_H diff --git a/DSLogic-gui/pv/data/signaldata.cpp b/DSLogic-gui/pv/data/signaldata.cpp new file mode 100644 index 00000000..355640af --- /dev/null +++ b/DSLogic-gui/pv/data/signaldata.cpp @@ -0,0 +1,52 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "signaldata.h" + +namespace pv { +namespace data { + +SignalData::SignalData(unsigned int num_probes, double samplerate) : + _num_probes(num_probes), + _samplerate(samplerate), + _start_time(0) +{ +} + +int SignalData::get_num_probes() const +{ + return _num_probes; +} + +double SignalData::get_samplerate() const +{ + return _samplerate; +} + +double SignalData::get_start_time() const +{ + return _start_time; +} + +} // namespace data +} // namespace pv diff --git a/DSLogic-gui/pv/data/signaldata.h b/DSLogic-gui/pv/data/signaldata.h new file mode 100644 index 00000000..be5280a9 --- /dev/null +++ b/DSLogic-gui/pv/data/signaldata.h @@ -0,0 +1,51 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_DATA_SIGNALDATA_H +#define DSLOGIC_PV_DATA_SIGNALDATA_H + +#include + +namespace pv { +namespace data { + +class SignalData +{ +public: + SignalData(unsigned int num_probes, double samplerate); + +public: + double get_samplerate() const; + double get_start_time() const; + int get_num_probes() const; + +protected: + const unsigned int _num_probes; + const double _samplerate; + const double _start_time; +}; + +} // namespace data +} // namespace pv + +#endif // DSLOGIC_PV_DATA_SIGNALDATA_H diff --git a/DSLogic-gui/pv/data/snapshot.cpp b/DSLogic-gui/pv/data/snapshot.cpp new file mode 100644 index 00000000..8cf4b6ff --- /dev/null +++ b/DSLogic-gui/pv/data/snapshot.cpp @@ -0,0 +1,122 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "snapshot.h" + +#include +#include +#include + +using namespace boost; + +namespace pv { +namespace data { + +Snapshot::Snapshot(int unit_size, uint64_t total_sample_count, unsigned int channel_num) : + _data(NULL), + _channel_num(channel_num), + _sample_count(0), + _total_sample_count(total_sample_count * channel_num), + _ring_sample_count(0), + _unit_size(unit_size) +{ + lock_guard lock(_mutex); + assert(_unit_size > 0); +} + +Snapshot::~Snapshot() +{ + lock_guard lock(_mutex); + if (_data != NULL) + free(_data); + _data = NULL; +} + +int Snapshot::init(uint64_t _total_sample_len) +{ + _data = malloc(_total_sample_len * _unit_size + + sizeof(uint64_t)); + + if (_data == NULL) + return SR_ERR_MALLOC; + else + return SR_OK; +} + +bool Snapshot::buf_null() const +{ + if (_data == NULL) + return true; + else + return false; +} + +uint64_t Snapshot::get_sample_count() const +{ + lock_guard lock(_mutex); + return _sample_count / _channel_num; +} + +void* Snapshot::get_data() const +{ + lock_guard lock(_mutex); + return _data; +} + +int Snapshot::get_unit_size() const +{ + lock_guard lock(_mutex); + return _unit_size; +} + +unsigned int Snapshot::get_channel_num() const +{ + lock_guard lock(_mutex); + return _channel_num; +} + +void Snapshot::append_data(void *data, uint64_t samples) +{ +// lock_guard lock(_mutex); +// _data = realloc(_data, (_sample_count + samples) * _unit_size + +// sizeof(uint64_t)); + if (_sample_count + samples < _total_sample_count) + _sample_count += samples; + else + _sample_count = _total_sample_count; + + if (_ring_sample_count + samples > _total_sample_count) { + memcpy((uint8_t*)_data + _ring_sample_count * _unit_size, + data, (_total_sample_count - _ring_sample_count) * _unit_size); + _ring_sample_count = (samples + _ring_sample_count - _total_sample_count) % _total_sample_count; + memcpy((uint8_t*)_data, + data, _ring_sample_count * _unit_size); + } else { + memcpy((uint8_t*)_data + _ring_sample_count * _unit_size, + data, samples * _unit_size); + _ring_sample_count += samples; + } +} + +} // namespace data +} // namespace pv diff --git a/DSLogic-gui/pv/data/snapshot.h b/DSLogic-gui/pv/data/snapshot.h new file mode 100644 index 00000000..5968c4bf --- /dev/null +++ b/DSLogic-gui/pv/data/snapshot.h @@ -0,0 +1,69 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_DATA_SNAPSHOT_H +#define DSLOGIC_PV_DATA_SNAPSHOT_H + +#include + +#include + +namespace pv { +namespace data { + +class Snapshot +{ +public: + Snapshot(int unit_size, uint64_t total_sample_count, unsigned int channel_num); + + virtual ~Snapshot(); + + int init(uint64_t _total_sample_len); + + uint64_t get_sample_count() const; + + void * get_data() const; + + int get_unit_size() const; + + bool buf_null() const; + + unsigned int get_channel_num() const; + +protected: + void append_data(void *data, uint64_t samples); + +protected: + mutable boost::recursive_mutex _mutex; + void *_data; + unsigned int _channel_num; + uint64_t _sample_count; + uint64_t _total_sample_count; + uint64_t _ring_sample_count; + int _unit_size; +}; + +} // namespace data +} // namespace pv + +#endif // DSLOGIC_PV_DATA_SNAPSHOT_H diff --git a/DSLogic-gui/pv/decoder/decoder.cpp b/DSLogic-gui/pv/decoder/decoder.cpp new file mode 100644 index 00000000..cf3f47b9 --- /dev/null +++ b/DSLogic-gui/pv/decoder/decoder.cpp @@ -0,0 +1,55 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "decoder.h" + +namespace pv { +namespace decoder { + +Decoder::Decoder(boost::shared_ptr data, std::list sel_probes, QMap options_index) : + _data(data), + _sel_probes(sel_probes), + _options_index(options_index), + _total_state(0), + _max_state_samples(0) +{ +} + +std::list Decoder::get_probes() +{ + return _sel_probes; +} + +QMap Decoder::get_options_index() +{ + return _options_index; +} + +void Decoder::set_data(boost::shared_ptr _logic_data) +{ + assert(_logic_data); + _data = _logic_data; +} + +} // namespace decoder +} // namespace pv diff --git a/DSLogic-gui/pv/decoder/decoder.h b/DSLogic-gui/pv/decoder/decoder.h new file mode 100644 index 00000000..fc2f82de --- /dev/null +++ b/DSLogic-gui/pv/decoder/decoder.h @@ -0,0 +1,115 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_DECODER_H +#define DSLOGIC_PV_DECODER_H + +#include + +#include +#include +#include + +#include +#include + +namespace pv { + +namespace data { +class Logic; +} + +namespace decoder { + +enum { + DEC_CMD = 0, + DEC_DATA = 1, + DEC_CNT = 2, + DEC_NODETAIL +}; + +struct ds_view_state { + uint64_t index; + uint64_t samples; + uint16_t type; + uint8_t state; + uint8_t data; +}; + +enum { + I2C = 0, + SPI, + Serial, + Dmx512, + Wire1 +}; + +static QString protocol_list[] = { + "I2C", + "SPI", + "Serial", + "DMX512", + "1-Wire", + NULL, +}; + +class Decoder +{ +protected: + static const int _view_scale = 8; + Decoder(boost::shared_ptr data, std::list sel_probes, QMap options_index); +public: + std::list get_probes(); + QMap get_options_index(); + void set_data(boost::shared_ptr _logic_data); + +public: + virtual QString get_decode_name() = 0; + + virtual void recode(std::list sel_probes, QMap & options, QMap options_index) = 0; + virtual void decode() = 0; + + virtual void fill_color_table(std::vector & _color_table) = 0; + + virtual void fill_state_table(std::vector & _state_table) = 0; + + virtual void get_subsampled_states(std::vector &states, + uint64_t start, uint64_t end, + float min_length) = 0; + +private: + + +protected: + + boost::shared_ptr _data; + std::list _sel_probes; + QMap _options_index; + uint64_t _total_state; + uint64_t _max_state_samples; +}; + +} // namespace decoder +} // namespace pv + +#endif // DSLOGIC_PV_DECODER_H diff --git a/DSLogic-gui/pv/decoder/decoderfactory.cpp b/DSLogic-gui/pv/decoder/decoderfactory.cpp new file mode 100644 index 00000000..9cb13cc9 --- /dev/null +++ b/DSLogic-gui/pv/decoder/decoderfactory.cpp @@ -0,0 +1,67 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "decoderfactory.h" +#include "dsi2c.h" +#include "dsspi.h" +#include "dsserial.h" +#include "dsdmx512.h" +#include "ds1wire.h" + +namespace pv { +namespace decoder { + +DecoderFactory::DecoderFactory() +{ +} + +Decoder* DecoderFactory::createDecoder(int type, boost::shared_ptr data, + std::list _sel_probes, QMap &_options, QMap _options_index) +{ + Decoder *decoder = NULL; + + switch(type) + { + case I2C: + decoder = new dsI2c(data, _sel_probes, _options, _options_index); + break; + case SPI: + decoder = new dsSpi(data, _sel_probes, _options, _options_index); + break; + case Serial: + decoder = new dsSerial(data, _sel_probes, _options, _options_index); + break; + case Dmx512: + decoder = new dsDmx512(data, _sel_probes, _options, _options_index); + break; + case Wire1: + decoder = new ds1Wire(data, _sel_probes, _options, _options_index); + break; + default: + decoder = new dsI2c(data, _sel_probes, _options, _options_index); + } + + return decoder; +} + +} // namespace decoder +} // namespace pv diff --git a/DSLogic-gui/pv/decoder/decoderfactory.h b/DSLogic-gui/pv/decoder/decoderfactory.h new file mode 100644 index 00000000..435949d8 --- /dev/null +++ b/DSLogic-gui/pv/decoder/decoderfactory.h @@ -0,0 +1,49 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_DECODERFACTORY_H +#define DSLOGIC_PV_DECODERFACTORY_H + +#include "decoder.h" + +#include +#include + +namespace pv { +namespace decoder { + +class DecoderFactory +{ +public: + DecoderFactory(); + +public: + Decoder * createDecoder(int type, boost::shared_ptr data, + std::list _sel_probes, QMap &_options, QMap _options_index); + +}; + +} // namespace decoder +} // namespace pv + +#endif // DSLOGIC_PV_DECODERFACTORY_H diff --git a/DSLogic-gui/pv/decoder/democonfig.cpp b/DSLogic-gui/pv/decoder/democonfig.cpp new file mode 100644 index 00000000..0a91fe5d --- /dev/null +++ b/DSLogic-gui/pv/decoder/democonfig.cpp @@ -0,0 +1,260 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "democonfig.h" +#include "ui_i2cconfig.h" +#include "ui_spiconfig.h" +#include "ui_serialconfig.h" +#include "ui_dmx512config.h" +#include "ui_wire1config.h" + +#include "decoder.h" +#include "../sigsession.h" +#include "../view/signal.h" +#include "../view/logicsignal.h" + +#include + +namespace pv { +namespace decoder { + +DemoConfig::DemoConfig(QWidget *parent, struct sr_dev_inst *sdi, int protocol) : + QDialog(parent), + _sdi(sdi), + _protocol(protocol) +{ + assert(_sdi); + + i2c_ui = NULL; + spi_ui = NULL; + wire1_ui = NULL; + serial_ui = NULL; + dmx512_ui = NULL; + + if (_protocol == I2C) { + i2c_ui = new Ui::I2cConfig; + i2c_ui->setupUi(this); + + i2c_ui->setupUi(this); + for (const GSList *l = _sdi->probes; l; l = l->next) { + sr_probe *const probe = (sr_probe*)l->data; + assert(probe); + i2c_ui->scl_comboBox->addItem(QString::number(probe->index) + " - " + probe->name); + i2c_ui->sda_comboBox->addItem(QString::number(probe->index) + " - " + probe->name); + } + i2c_ui->scl_comboBox->setCurrentIndex(0); + i2c_ui->sda_comboBox->setCurrentIndex(1); + } else if (_protocol == SPI) { + spi_ui = new Ui::SpiConfig; + spi_ui->setupUi(this); + + spi_ui->setupUi(this); + for (const GSList *l = _sdi->probes; l; l = l->next) { + sr_probe *const probe = (sr_probe*)l->data; + assert(probe); + spi_ui->ssn_comboBox->addItem(QString::number(probe->index) + " - " + probe->name); + spi_ui->sclk_comboBox->addItem(QString::number(probe->index) + " - " + probe->name); + spi_ui->mosi_comboBox->addItem(QString::number(probe->index) + " - " + probe->name); + spi_ui->miso_comboBox->addItem(QString::number(probe->index) + " - " + probe->name); + } + spi_ui->ssn_comboBox->setCurrentIndex(0); + spi_ui->sclk_comboBox->setCurrentIndex(1); + spi_ui->mosi_comboBox->setCurrentIndex(2); + spi_ui->miso_comboBox->setCurrentIndex(3); + } else if (_protocol == Serial) { + serial_ui = new Ui::SerialConfig; + serial_ui->setupUi(this); + + serial_ui->setupUi(this); + for (const GSList *l = _sdi->probes; l; l = l->next) { + sr_probe *const probe = (sr_probe*)l->data; + assert(probe); + serial_ui->serial_comboBox->addItem(QString::number(probe->index) + " - " + probe->name); + } + serial_ui->serial_comboBox->setCurrentIndex(0); + } else if (_protocol == Dmx512) { + dmx512_ui = new Ui::Dmx512Config; + dmx512_ui->setupUi(this); + + dmx512_ui->setupUi(this); + for (const GSList *l = _sdi->probes; l; l = l->next) { + sr_probe *const probe = (sr_probe*)l->data; + assert(probe); + dmx512_ui->probe_comboBox->addItem(QString::number(probe->index) + " - " + probe->name); + } + dmx512_ui->probe_comboBox->setCurrentIndex(0); + } else if (_protocol == Wire1) { + wire1_ui = new Ui::Wire1Config; + wire1_ui->setupUi(this); + + wire1_ui->setupUi(this); + for (const GSList *l = _sdi->probes; l; l = l->next) { + sr_probe *const probe = (sr_probe*)l->data; + assert(probe); + wire1_ui->probe_comboBox->addItem(QString::number(probe->index) + " - " + probe->name); + } + wire1_ui->probe_comboBox->setCurrentIndex(0); + } + +} + +DemoConfig::~DemoConfig() +{ + if (i2c_ui) + delete i2c_ui; + if (spi_ui) + delete spi_ui; + if (serial_ui) + delete serial_ui; + if (dmx512_ui) + delete dmx512_ui; + if (wire1_ui) + delete wire1_ui; +} + +void DemoConfig::accept() +{ + using namespace Qt; + + QDialog::accept(); + + if (_protocol == I2C) { + if (!_sel_probes.empty()) + _sel_probes.clear(); + _sel_probes.push_back(i2c_ui->scl_comboBox->currentIndex()); + _sel_probes.push_back(i2c_ui->sda_comboBox->currentIndex()); + } else if (_protocol == SPI) { + const int ssn_option = spi_ui->cs_comboBox->currentText().contains("low", Qt::CaseInsensitive) ? 0 : + spi_ui->cs_comboBox->currentText().contains("high", Qt::CaseInsensitive) ? 1 : -1; + if (!_sel_probes.empty()) + _sel_probes.clear(); + if (ssn_option != -1) + _sel_probes.push_back(spi_ui->ssn_comboBox->currentIndex()); + _sel_probes.push_back(spi_ui->sclk_comboBox->currentIndex()); + _sel_probes.push_back(spi_ui->mosi_comboBox->currentIndex()); + _sel_probes.push_back(spi_ui->miso_comboBox->currentIndex()); + + if (!_options.empty()) + _options.clear(); + _options.insert("cpol", spi_ui->cpol_comboBox->currentText().contains("0", Qt::CaseInsensitive) ? 0 : 1); + _options.insert("cpha", spi_ui->cpha_comboBox->currentText().contains("0", Qt::CaseInsensitive) ? 0 : 1); + _options.insert("bits", spi_ui->bits_comboBox->currentText().toUInt()); + _options.insert("order", spi_ui->order_comboBox->currentText().contains("MSB", Qt::CaseInsensitive) ? 1 : 0); + _options.insert("ssn", ssn_option); + + if (!_options_index.empty()) + _options_index.clear(); + _options_index.insert("cpol", spi_ui->cpol_comboBox->currentIndex()); + _options_index.insert("cpha", spi_ui->cpha_comboBox->currentIndex()); + _options_index.insert("bits", spi_ui->bits_comboBox->currentIndex()); + _options_index.insert("order", spi_ui->order_comboBox->currentIndex()); + _options_index.insert("ssn", spi_ui->ssn_comboBox->currentIndex()); + } else if (_protocol == Serial) { + if (!_sel_probes.empty()) + _sel_probes.clear(); + _sel_probes.push_back(serial_ui->serial_comboBox->currentIndex()); + + if (!_options.empty()) + _options.clear(); + _options.insert("baudrate", (serial_ui->baud_checkBox->checkState() == Qt::Checked) ? 0 : serial_ui->baud_comboBox->currentText().toULongLong()); + _options.insert("stopbits", serial_ui->stopbits_comboBox->currentText().toFloat()); + _options.insert("parity", serial_ui->parity_comboBox->currentText().contains("even", Qt::CaseInsensitive) ? 0 : + serial_ui->parity_comboBox->currentText().contains("odd", Qt::CaseInsensitive) ? 1 : -1); + _options.insert("order", serial_ui->order_comboBox->currentText().contains("LSB", Qt::CaseInsensitive) ? 1 : 0); + _options.insert("bits", serial_ui->bits_comboBox->currentText().toUInt()); + _options.insert("idle", serial_ui->idle_comboBox->currentText().contains("Low", Qt::CaseInsensitive) ? 0 : 1); + + if (!_options_index.empty()) + _options_index.clear(); + _options_index.insert("baudrate", (serial_ui->baud_checkBox->checkState() == Qt::Checked) ? -1 : serial_ui->baud_comboBox->currentIndex()); + _options_index.insert("stopbits", serial_ui->stopbits_comboBox->currentIndex()); + _options_index.insert("parity", serial_ui->parity_comboBox->currentIndex()); + _options_index.insert("order", serial_ui->order_comboBox->currentIndex()); + _options_index.insert("bits", serial_ui->bits_comboBox->currentIndex()); + _options_index.insert("idle", serial_ui->idle_comboBox->currentIndex()); + } else if (_protocol == Dmx512) { + if (!_sel_probes.empty()) + _sel_probes.clear(); + _sel_probes.push_back(dmx512_ui->probe_comboBox->currentIndex()); + } else if (_protocol == Wire1) { + if (!_sel_probes.empty()) + _sel_probes.clear(); + _sel_probes.push_back(wire1_ui->probe_comboBox->currentIndex()); + } + +} + +void DemoConfig::set_config(std::list sel_probes, QMap options_index) +{ + if (_protocol == I2C) { + i2c_ui->scl_comboBox->setCurrentIndex(sel_probes.front()); + i2c_ui->sda_comboBox->setCurrentIndex(sel_probes.back()); + } else if (_protocol == SPI) { + spi_ui->ssn_comboBox->setCurrentIndex(sel_probes.front());sel_probes.pop_front(); + spi_ui->sclk_comboBox->setCurrentIndex(sel_probes.front());sel_probes.pop_front(); + spi_ui->mosi_comboBox->setCurrentIndex(sel_probes.front());sel_probes.pop_front(); + spi_ui->miso_comboBox->setCurrentIndex(sel_probes.front());sel_probes.pop_front(); + + spi_ui->cpol_comboBox->setCurrentIndex(options_index.value("cpol")); + spi_ui->cpha_comboBox->setCurrentIndex(options_index.value("cpha")); + spi_ui->bits_comboBox->setCurrentIndex(options_index.value("bits")); + spi_ui->order_comboBox->setCurrentIndex(options_index.value("order")); + spi_ui->ssn_comboBox->setCurrentIndex(options_index.value("ssn")); + + } else if (_protocol == Serial) { + serial_ui->serial_comboBox->setCurrentIndex(sel_probes.front()); + + if (options_index.value("baudrate") == -1) + serial_ui->baud_checkBox->setChecked(true); + else + serial_ui->baud_comboBox->setCurrentIndex(options_index.value("baudrate")); + serial_ui->stopbits_comboBox->setCurrentIndex(options_index.value("stopbits")); + serial_ui->parity_comboBox->setCurrentIndex(options_index.value("parity")); + serial_ui->order_comboBox->setCurrentIndex(options_index.value("order")); + serial_ui->bits_comboBox->setCurrentIndex(options_index.value("bits")); + serial_ui->idle_comboBox->setCurrentIndex(options_index.value("idle")); + } else if (_protocol == Dmx512) { + dmx512_ui->probe_comboBox->setCurrentIndex(sel_probes.front()); + } else if (_protocol == Wire1) { + wire1_ui->probe_comboBox->setCurrentIndex(sel_probes.front()); + } + +} + +std::list DemoConfig::get_sel_probes() +{ + return _sel_probes; +} + +QMap &DemoConfig::get_options() +{ + return _options; +} + +QMap DemoConfig::get_options_index() +{ + return _options_index; +} + +} // namespace decoder +} // namespace pv diff --git a/DSLogic-gui/pv/decoder/democonfig.h b/DSLogic-gui/pv/decoder/democonfig.h new file mode 100644 index 00000000..d4892091 --- /dev/null +++ b/DSLogic-gui/pv/decoder/democonfig.h @@ -0,0 +1,91 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_DEMOCONFIG_H +#define DSLOGIC_PV_DEMOCONFIG_H + +#include +#include +#include + +#include "../sigsession.h" + +#include + +#include + +namespace Ui { +class I2cConfig; +class SpiConfig; +class SerialConfig; +class Dmx512Config; +class Wire1Config; +} + +namespace pv { +namespace decoder { + +class DemoConfig : public QDialog +{ + Q_OBJECT + +public: + + DemoConfig(QWidget *parent = 0, sr_dev_inst *sdi = 0, int protocol = 0); + virtual ~DemoConfig(); + + void set_config(std::list sel_probes, QMap options_index); + + std::list get_sel_probes(); + + QMap & get_options(); + + QMap get_options_index(); + +protected: + void accept(); + +signals: + +public slots: + +private: + sr_dev_inst *_sdi; + + int _protocol; + + std::list _sel_probes; + QMap _options; + QMap _options_index; + + Ui::I2cConfig *i2c_ui; + Ui::SpiConfig *spi_ui; + Ui::SerialConfig *serial_ui; + Ui::Dmx512Config *dmx512_ui; + Ui::Wire1Config *wire1_ui; +}; + +} // namespace decoder +} // namespace pv + +#endif // DSLOGIC_PV_DEMOCONFIG_H diff --git a/DSLogic-gui/pv/decoder/dmx512config.ui b/DSLogic-gui/pv/decoder/dmx512config.ui new file mode 100644 index 00000000..bc7b902f --- /dev/null +++ b/DSLogic-gui/pv/decoder/dmx512config.ui @@ -0,0 +1,103 @@ + + + Dmx512Config + + + + 0 + 0 + 360 + 150 + + + + + 360 + 150 + + + + + 360 + 150 + + + + Dialog + + + + + 10 + 100 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 130 + 40 + 141 + 20 + + + + + + + 21 + 40 + 84 + 16 + + + + Data Signal + + + + + + + buttonBox + accepted() + Dmx512Config + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dmx512Config + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/DSLogic-gui/pv/decoder/ds1wire.cpp b/DSLogic-gui/pv/decoder/ds1wire.cpp new file mode 100644 index 00000000..1f8d759f --- /dev/null +++ b/DSLogic-gui/pv/decoder/ds1wire.cpp @@ -0,0 +1,455 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "ds1wire.h" + +#include + +using namespace boost; +using namespace std; + +namespace pv { +namespace decoder { + +const QColor ds1Wire::ColorTable[TableSize] = { + QColor(255, 255, 255, 150), + QColor(0, 255, 0, 150), + QColor(255, 0, 0, 150), + QColor(0, 255, 0, 150), + QColor(255, 0, 0, 150), + QColor(0, 0, 255, 150), + QColor(0, 0, 255, 150), + QColor(0, 255, 255, 150), +}; + +const QString ds1Wire::StateTable[TableSize] = { + "UNKNOWN", + "RESET", + "PRESENCE", + "COMMAND", + "FAMILY CODE", + "SERIAL NUMBER", + "CRC", + "DATA" +}; + +ds1Wire::ds1Wire(shared_ptr data, std::list _sel_probes, QMap &_options, QMap _options_index) : + Decoder(data, _sel_probes, _options_index) +{ + (void)_options; + + assert(_sel_probes.size() == 1); + + _wire_index = _sel_probes.front(); +} + +ds1Wire::~ds1Wire() +{ +} + +QString ds1Wire::get_decode_name() +{ + return "1-Wire"; +} + +void ds1Wire::recode(std::list _sel_probes, QMap & _options, QMap _options_index) +{ + (void)_options; + + assert(_sel_probes.size() == 1); + _wire_index = _sel_probes.front(); + + this->_sel_probes = _sel_probes; + this->_options_index = _options_index; + + decode(); +} + +void ds1Wire::decode() +{ + assert(_data); + _max_width = 0; + uint8_t cur_state = Unknown; + + const deque< shared_ptr > &snapshots = + _data->get_snapshots(); + if (snapshots.empty()) + return; + + const shared_ptr &snapshot = + snapshots.front(); + + uint64_t flag_index1; + uint64_t flag_index2; + uint64_t flag_index3; + uint64_t flag_index4; + //uint64_t start_index; + //uint64_t stop_index; + //bool edge1; + //bool edge2; + uint64_t left = 0; + uint64_t right = snapshot->get_sample_count() - 1; + const uint64_t samplerate = _data->get_samplerate(); + double pulse_width1; + double pulse_width2; + double pulse_width3; + double pulse_width4; + + uint8_t data; + bool valid = false; + + if (!_state_index.empty()) + _state_index.clear(); + + while(left < right && pulse_width1 != 0) // Regular Speed + { + // search reset flag + pulse_width1 = get_next_pulse_width(0, samplerate, left, right, snapshot); + flag_index1 = left; + if (pulse_width1 >= 0.48 && pulse_width1 <= 0.96) { // tRSTL + pulse_width2 = get_next_pulse_width(1, samplerate, left, right, snapshot); + flag_index2 = left; + if (pulse_width2 >= 0.015 && pulse_width2 <= 0.06) { // tPDH + pulse_width3 = get_next_pulse_width(0, samplerate, left, right, snapshot); + flag_index3 = left; + if (pulse_width3 >= 0.06 && pulse_width3 <= 0.24) { // tPDL + pulse_width4 = get_next_pulse_width(1, samplerate, left, right, snapshot); + flag_index4 = left; + if (pulse_width2 + pulse_width3 + pulse_width4 >= 0.48) { + cur_state = Reset; + _state_index.push_back(std::make_pair(std::make_pair(flag_index1, flag_index2 - flag_index1), std::make_pair(cur_state, 0))); + cur_state = Presence; + _state_index.push_back(std::make_pair(std::make_pair(flag_index3, flag_index4 - flag_index3), std::make_pair(cur_state, 0))); + } else { + continue; + } + } else { + continue; + } + } else { + continue; + } + } else { + continue; + } + + uint64_t start; + uint64_t end; + int i; + if (cur_state == Presence) { + data = get_next_data(false, valid, start, end, samplerate, left, right, snapshot); + if (valid) { + cur_state = Command; + _state_index.push_back(std::make_pair(std::make_pair(start, end - start), std::make_pair(cur_state, data))); + }else { + continue; + } + } + + if (cur_state == Command) { + data = get_next_data(false, valid, start, end, samplerate, left, right, snapshot); + if (valid) { + cur_state = Family; + _state_index.push_back(std::make_pair(std::make_pair(start, end - start), std::make_pair(cur_state, data))); + } else { + continue; + } + } + + if (cur_state == Family) { + for (i = 0; i < 6; i++) { + data = get_next_data(false, valid, start, end, samplerate, left, right, snapshot); + if (valid) { + cur_state = Serial; + _state_index.push_back(std::make_pair(std::make_pair(start, end - start), std::make_pair(cur_state, data))); + } else { + break; + } + } + if (i != 6) + continue; + } + + if (cur_state == Serial) { + data = get_next_data(false, valid, start, end, samplerate, left, right, snapshot); + if (valid) { + cur_state = Crc; + _state_index.push_back(std::make_pair(std::make_pair(start, end - start), std::make_pair(cur_state, data))); + } else { + continue; + } + } + + if (cur_state == Crc) { + while (1) { + data = get_next_data(false, valid, start, end, samplerate, left, right, snapshot); + if (valid) { + cur_state = Data; + _state_index.push_back(std::make_pair(std::make_pair(start, end - start), std::make_pair(cur_state, data))); + } else { + break; + } + } + } + } + +// if (cur_state == Unknown) { +// while(1) { // Overdrive Speed + +// } +// } +} + +double ds1Wire::get_next_pulse_width(bool level, uint64_t samplerate, uint64_t &left, uint64_t right, + const boost::shared_ptr &snapshot) +{ + double pulse_width = 0; + uint64_t flag_index1; + uint64_t flag_index2; + bool edge1; + bool edge2; + + if (snapshot->get_first_edge(flag_index1, edge1, left, right, _wire_index, level, _wire_index, -1) == SR_OK) { + left = flag_index1; + if (snapshot->get_first_edge(flag_index2, edge2, left, right, _wire_index, !level, _wire_index, -1) == SR_OK) { + pulse_width = (flag_index2 - flag_index1) * 1000.0f / samplerate; + } + } + + return pulse_width; +} + +uint8_t ds1Wire::get_next_data(bool speed, bool &valid, uint64_t &start, uint64_t &end, + uint64_t samplerate, uint64_t &left, uint64_t right, + const boost::shared_ptr &snapshot) +{ + uint8_t data = 0; + double pulse_width1; + uint64_t org_left = left; + int i; + + valid = true; + if (speed == false) { + for (i = 0; i < 8; i++) { + pulse_width1 = get_next_pulse_width(0, samplerate, left, right, snapshot); + start = (i == 0) ? left : start; + end = (i == 7) ? left + samplerate * 0.001 * 0.06 : end; + if (pulse_width1 >= 0.001 && pulse_width1 < 0.015) { + pulse_width1 = get_next_pulse_width(1, samplerate, left, right, snapshot); + if (pulse_width1 >= 0.046) { + data = data + (1 << i); + org_left = left; + } else { + left = org_left; + valid = false; + break; + } + } else if (pulse_width1 >= 0.06 && pulse_width1 < 0.12) { + pulse_width1 = get_next_pulse_width(1, samplerate, left, right, snapshot); + if (pulse_width1 >= 0.001) { + org_left = left; + //data = data << 1; + } else { + left = org_left; + valid = false; + break; + } + } else { + left = org_left; + valid = false; + break; + } + } + } else { + for (i = 0; i < 8; i++) { + pulse_width1 = get_next_pulse_width(0, samplerate, left, right, snapshot); + start = (i == 0) ? left : start; + end = (i == 7) ? left + samplerate * 0.001 * 0.006 : end; + if (pulse_width1 >= 0.001 && pulse_width1 < 0.002) { + pulse_width1 = get_next_pulse_width(1, samplerate, left, right, snapshot); + if (pulse_width1 >= 0.006) { + org_left = left; + data = data + (1 << i); + } else { + left = org_left; + valid = false; + break; + } + } else if (pulse_width1 >= 0.006 && pulse_width1 < 0.016) { + pulse_width1 = get_next_pulse_width(1, samplerate, left, right, snapshot); + if (pulse_width1 >= 0.001) { + org_left = left; + //data = data << 1; + } else { + left = org_left; + valid = false; + break; + } + } else { + left = org_left; + valid = false; + break; + } + } + } + + return data; +} + +void ds1Wire::fill_color_table(std::vector & _color_table) +{ + int i; + for(i = 0; i < TableSize; i++) + _color_table.push_back(ColorTable[i]); +} + +void ds1Wire::fill_state_table(std::vector & _state_table) +{ + int i; + for(i = 0; i < TableSize; i++) + _state_table.push_back(StateTable[i]); +} + +void ds1Wire::get_subsampled_states(std::vector &states, + uint64_t start, uint64_t end, + float min_length) +{ + ds_view_state view_state; + + const deque< shared_ptr > &snapshots = + _data->get_snapshots(); + if (snapshots.empty()) + return; + const shared_ptr &snapshot = + snapshots.front(); + + assert(end <= snapshot->get_sample_count()); + assert(start <= end); + assert(min_length > 0); + + if (!states.empty()) + states.clear(); + + if (_state_index.empty()) + return; + if (start > _state_index.at(_state_index.size() - 1).first.first) + return; + if (end < _state_index.at(0).first.first) + return; + + if (min_length * _view_scale > _max_width) { + view_state.index = _state_index.at(0).first.first; + view_state.samples = _state_index.at(_state_index.size() - 1).first.first + + _state_index.at(_state_index.size() - 1).first.second - _state_index.at(0).first.first; + view_state.type = DEC_NODETAIL; + view_state.state = 0; + view_state.data = 0; + states.push_back(view_state); + return; + } + + uint64_t view_start = 0; + uint64_t view_end = 0; + uint64_t minIndex = 0; + uint64_t maxIndex = _state_index.size() - 1; + uint64_t i = start * 1.0f / snapshot->get_sample_count() * maxIndex; + bool check_flag = false; + int times = 0; + while(times <= 32) { + if (_state_index.at(i).first.first + _state_index.at(i).first.second >= start) { + check_flag = true; + } else { + minIndex = i; + i = ceil((i + maxIndex) / 2.0f); + } + + if (check_flag) { + if (i == 0) { + view_start = i; + break; + } else if (_state_index.at(i-1).first.first + _state_index.at(i-1).first.second < start) { + view_start = i; + break; + } else { + maxIndex = i; + i = (i + minIndex) / 2; + } + check_flag = false; + } + times++; + } + i = view_start; + check_flag = false; + times = 0; + minIndex = view_start; + //maxIndex = _state_index.size() - 1; + maxIndex = min(_state_index.size() - 1, (size_t)end); + view_end = view_start; + while(times <= 32) { + if (_state_index.at(i).first.first <= end) { + check_flag = true; + } else { + maxIndex = i; + i = (i + minIndex) / 2; + } + + if (check_flag) { + if (i == maxIndex) { + view_end = i; + break; + } else if (_state_index.at(i+1).first.first > end) { + view_end = i; + break; + } else { + minIndex = i; + i = ceil((i + maxIndex) / 2.0f); + } + check_flag = false; + } + times++; + } + + assert(view_end >= view_start); + + for (uint64_t i = view_start; i <= view_end; i++) { + if (_state_index.at(i).first.second >= min_length * _view_scale) { + view_state.index = _state_index.at(i).first.first; + view_state.samples = _state_index.at(i).first.second; + view_state.type = (_state_index.at(i).second.first == Reset || + _state_index.at(i).second.first == Presence) ? DEC_CMD : DEC_DATA; + view_state.state = _state_index.at(i).second.first; + view_state.data = _state_index.at(i).second.second; + states.push_back(view_state); + } else { + view_state.index = _state_index.at(i).first.first; + view_state.samples = _state_index.at(i).first.second; + view_state.type = DEC_NODETAIL; + view_state.state = 0; + view_state.data = 0; + states.push_back(view_state); + } + } +} + +} // namespace decoder +} // namespace pv diff --git a/DSLogic-gui/pv/decoder/ds1wire.h b/DSLogic-gui/pv/decoder/ds1wire.h new file mode 100644 index 00000000..56706fbd --- /dev/null +++ b/DSLogic-gui/pv/decoder/ds1wire.h @@ -0,0 +1,91 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_DS1WIRE_H +#define DSLOGIC_PV_DS1WIRE_H + +#include "decoder.h" +#include "../data/logic.h" +#include "../data/logicsnapshot.h" + +#include + +namespace pv { + +namespace data { +class LogicSnapshot; +} + +namespace decoder { + +class ds1Wire : public Decoder +{ +private: + static const int TableSize = 8; + static const QColor ColorTable[TableSize]; + static const QString StateTable[TableSize]; + + enum {Unknown = 0, Reset, Presence, Command, Family, Serial, Crc, Data}; + +private: + + double get_next_pulse_width(bool level, + uint64_t samplerate, uint64_t &left, uint64_t right, + const boost::shared_ptr &snapshot); + + uint8_t get_next_data(bool speed, bool &valid, uint64_t &start, uint64_t &end, + uint64_t samplerate, uint64_t &left, uint64_t right, + const boost::shared_ptr &snapshot); + +public: + ds1Wire(boost::shared_ptr data, + std::list _sel_probes, QMap &_options, QMap _options_index); + + virtual ~ds1Wire(); + + QString get_decode_name(); + + void recode(std::list _sel_probes, QMap & _options, QMap _options_index); + + void decode(); + + void fill_color_table(std::vector & _color_table); + + void fill_state_table(std::vector & _state_table); + + void get_subsampled_states(std::vector &states, + uint64_t start, uint64_t end, + float min_length); + +private: + + int _wire_index; + uint64_t _max_width; + std::vector< pv::data::LogicSnapshot::EdgePair > _cur_edges; + std::vector< std::pair, std::pair > > _state_index; +}; + +} // namespace decoder +} // namespace pv + +#endif // DSLOGIC_PV_DS1WIRE_H diff --git a/DSLogic-gui/pv/decoder/dsdmx512.cpp b/DSLogic-gui/pv/decoder/dsdmx512.cpp new file mode 100644 index 00000000..19894ecf --- /dev/null +++ b/DSLogic-gui/pv/decoder/dsdmx512.cpp @@ -0,0 +1,380 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "dsdmx512.h" + +#include + +using namespace boost; +using namespace std; + +namespace pv { +namespace decoder { + +const QColor dsDmx512::ColorTable[TableSize] = { + QColor(255, 255, 255, 150), + QColor(0, 255, 0, 150), + QColor(255, 0, 0, 150), + QColor(0, 255, 0, 150), + QColor(255, 0, 0, 150), + QColor(0, 0, 255, 150), + QColor(0, 0, 255, 150), + QColor(0, 255, 255, 150), +}; + +const QString dsDmx512::StateTable[TableSize] = { + "UNKNOWN", + "BREAK", + "MAB", + "START", + "START CODE", + "STOP", + "MARK", + "SLOT" +}; + +dsDmx512::dsDmx512(shared_ptr data, std::list _sel_probes, QMap &_options, QMap _options_index) : + Decoder(data, _sel_probes, _options_index) +{ + (void)_options; + + assert(_sel_probes.size() == 1); + + _dmx_index = _sel_probes.front(); +} + +dsDmx512::~dsDmx512() +{ +} + +QString dsDmx512::get_decode_name() +{ + return "DMX512"; +} + +void dsDmx512::recode(std::list _sel_probes, QMap & _options, QMap _options_index) +{ + (void)_options; + + assert(_sel_probes.size() == 1); + _dmx_index = _sel_probes.front(); + + this->_sel_probes = _sel_probes; + this->_options_index = _options_index; + + decode(); +} + +void dsDmx512::decode() +{ + assert(_data); + _max_width = 0; + uint8_t cur_state = Unknown; + + const deque< shared_ptr > &snapshots = + _data->get_snapshots(); + if (snapshots.empty()) + return; + + const shared_ptr &snapshot = + snapshots.front(); + + //uint64_t flag_index; + uint64_t start_index; + uint64_t stop_index; + //bool edge; + uint64_t left = 0; + uint64_t right = snapshot->get_sample_count() - 1; + const uint64_t samplerate = _data->get_samplerate(); + double pulse_width; + bool valid; + + if (!_state_index.empty()) + _state_index.clear(); + + while(1) + { + // search Break flag + + pulse_width = get_next_pulse_width(0, samplerate, left, right, stop_index, snapshot); + start_index = left; + if (pulse_width >= 0.088 && pulse_width <= 1000) { // Break + cur_state = Break; + _state_index.push_back(std::make_pair(std::make_pair(start_index, stop_index - start_index), std::make_pair(cur_state, 0))); + _max_width = max(_max_width, stop_index - start_index); + } else if (pulse_width == 0){ + break; + } else { + continue; + } + + if (cur_state == Break) { + pulse_width = get_next_pulse_width(1, samplerate, left, right, stop_index, snapshot); + start_index = left; + if (pulse_width >= 0.012 && pulse_width <= 1000) { // Marker After Break + cur_state = Mab; + _state_index.push_back(std::make_pair(std::make_pair(start_index, stop_index - start_index), std::make_pair(cur_state, 0))); + _max_width = max(_max_width, stop_index - start_index); + } else { + continue; + } + } + + if (cur_state == Mab) { + get_next_data(true, valid, cur_state, samplerate, left, right, snapshot); + } + + while(valid) + get_next_data(false, valid, cur_state, samplerate, left, right, snapshot); + } + +} + +double dsDmx512::get_next_pulse_width(bool level, uint64_t samplerate, uint64_t &left, uint64_t right, uint64_t &end, + const boost::shared_ptr &snapshot) +{ + double pulse_width = 0; + uint64_t flag_index1; + uint64_t flag_index2; + bool edge1; + bool edge2; + + if (snapshot->get_first_edge(flag_index1, edge1, left, right, _dmx_index, level, _dmx_index, -1) == SR_OK) { + left = flag_index1; + if (snapshot->get_first_edge(flag_index2, edge2, left, right, _dmx_index, !level, _dmx_index, -1) == SR_OK) { + end = flag_index2; + pulse_width = (flag_index2 - flag_index1) * 1000.0f / samplerate; + } + } + + return pulse_width; +} + +uint8_t dsDmx512::get_next_data(bool code, bool &valid, uint8_t &cur_state, + uint64_t samplerate, uint64_t &left, uint64_t right, + const boost::shared_ptr &snapshot) +{ + uint8_t data = 0; + double pulse_width; + uint64_t org_left = left; + //int i; + uint64_t samplesPerBit = ceil(samplerate * 0.001 * 0.004); + const uint64_t dmx_mask = 1ULL << _dmx_index; + bool edge; + uint64_t start = left; + uint64_t end = left; + const uint8_t *src_ptr; + const int unit_size = snapshot->get_unit_size(); + + valid = false; + pulse_width = get_next_pulse_width(0, samplerate, left, right, end, snapshot); + if (pulse_width >= 0.00392 && pulse_width <= 0.00408 * 9) { // Start bit + org_left = left; + start = left; + end = start + samplesPerBit; + cur_state = Start; + _state_index.push_back(std::make_pair(std::make_pair(start, end - start), std::make_pair(cur_state, 0))); + _max_width = max(_max_width, end - start); + } else { + left = org_left; + return data; + } + + if (cur_state == Start) { + src_ptr = (uint8_t*)snapshot->get_data(); + start = end; + data = data + (((*(uint64_t*)(src_ptr + (int)(start + samplesPerBit * 0.5) * unit_size) & dmx_mask) != 0) << 0); + data = data + (((*(uint64_t*)(src_ptr + (int)(start + samplesPerBit * 1.5) * unit_size) & dmx_mask) != 0) << 1); + data = data + (((*(uint64_t*)(src_ptr + (int)(start + samplesPerBit * 2.5) * unit_size) & dmx_mask) != 0) << 2); + data = data + (((*(uint64_t*)(src_ptr + (int)(start + samplesPerBit * 3.5) * unit_size) & dmx_mask) != 0) << 3); + data = data + (((*(uint64_t*)(src_ptr + (int)(start + samplesPerBit * 4.5) * unit_size) & dmx_mask) != 0) << 4); + data = data + (((*(uint64_t*)(src_ptr + (int)(start + samplesPerBit * 5.5) * unit_size) & dmx_mask) != 0) << 5); + data = data + (((*(uint64_t*)(src_ptr + (int)(start + samplesPerBit * 6.5) * unit_size) & dmx_mask) != 0) << 6); + data = data + (((*(uint64_t*)(src_ptr + (int)(start + samplesPerBit * 7.5) * unit_size) & dmx_mask) != 0) << 7); + end = start + samplesPerBit * 8; + cur_state = code ? Scode : Slot; + _state_index.push_back(std::make_pair(std::make_pair(start, end - start), std::make_pair(cur_state, data))); + _max_width = max(_max_width, end - start); + } + + org_left = end; + left = start + samplesPerBit * 8.5; + if ((*(uint64_t*)(src_ptr + left * unit_size) & dmx_mask) != 0) { + if (snapshot->get_first_edge(end, edge, left, right, _dmx_index, 0, _dmx_index, -1) == SR_OK) { + pulse_width = (end - org_left) * 1000.0f / samplerate; + if (pulse_width >= 0.008 && pulse_width <= 1000) { + start = org_left; + end = start + samplesPerBit * 2; + cur_state = Stop; + _state_index.push_back(std::make_pair(std::make_pair(start, end - start), std::make_pair(cur_state, 0))); + _max_width = max(_max_width, end - start); + } + } else { + left = org_left; + return data; + } + } else { + return data; + } + + valid = true; + return data; +} + +void dsDmx512::fill_color_table(std::vector & _color_table) +{ + int i; + for(i = 0; i < TableSize; i++) + _color_table.push_back(ColorTable[i]); +} + +void dsDmx512::fill_state_table(std::vector & _state_table) +{ + int i; + for(i = 0; i < TableSize; i++) + _state_table.push_back(StateTable[i]); +} + +void dsDmx512::get_subsampled_states(std::vector &states, + uint64_t start, uint64_t end, + float min_length) +{ + ds_view_state view_state; + + const deque< shared_ptr > &snapshots = + _data->get_snapshots(); + if (snapshots.empty()) + return; + const shared_ptr &snapshot = + snapshots.front(); + + assert(end <= snapshot->get_sample_count()); + assert(start <= end); + assert(min_length > 0); + + if (!states.empty()) + states.clear(); + + if (_state_index.empty()) + return; + if (start > _state_index.at(_state_index.size() - 1).first.first) + return; + if (end < _state_index.at(0).first.first) + return; + + if (min_length * _view_scale > _max_width) { + view_state.index = _state_index.at(0).first.first; + view_state.samples = _state_index.at(_state_index.size() - 1).first.first + + _state_index.at(_state_index.size() - 1).first.second - _state_index.at(0).first.first; + view_state.type = DEC_NODETAIL; + view_state.state = 0; + view_state.data = 0; + states.push_back(view_state); + return; + } + + uint64_t view_start = 0; + uint64_t view_end = 0; + uint64_t minIndex = 0; + uint64_t maxIndex = _state_index.size() - 1; + uint64_t i = start * 1.0f / snapshot->get_sample_count() * maxIndex; + bool check_flag = false; + int times = 0; + while(times <= 32) { + if (_state_index.at(i).first.first + _state_index.at(i).first.second >= start) { + check_flag = true; + } else { + minIndex = i; + i = ceil((i + maxIndex) / 2.0f); + } + + if (check_flag) { + if (i == 0) { + view_start = i; + break; + } else if (_state_index.at(i-1).first.first + _state_index.at(i-1).first.second < start) { + view_start = i; + break; + } else { + maxIndex = i; + i = (i + minIndex) / 2; + } + check_flag = false; + } + times++; + } + i = view_start; + check_flag = false; + times = 0; + minIndex = view_start; + //maxIndex = _state_index.size() - 1; + maxIndex = min(_state_index.size() - 1, (size_t)end); + view_end = view_start; + while(times <= 32) { + if (_state_index.at(i).first.first <= end) { + check_flag = true; + } else { + maxIndex = i; + i = (i + minIndex) / 2; + } + + if (check_flag) { + if (i == maxIndex) { + view_end = i; + break; + } else if (_state_index.at(i+1).first.first > end) { + view_end = i; + break; + } else { + minIndex = i; + i = ceil((i + maxIndex) / 2.0f); + } + check_flag = false; + } + times++; + } + + assert(view_end >= view_start); + + for (uint64_t i = view_start; i <= view_end; i++) { + if (_state_index.at(i).first.second >= min_length * _view_scale) { + view_state.index = _state_index.at(i).first.first; + view_state.samples = _state_index.at(i).first.second; + view_state.type = (_state_index.at(i).second.first == Slot) ? DEC_CNT : + (_state_index.at(i).second.first == Scode) ? DEC_DATA : DEC_CMD; + view_state.state = _state_index.at(i).second.first; + view_state.data = _state_index.at(i).second.second; + states.push_back(view_state); + } else { + view_state.index = _state_index.at(i).first.first; + view_state.samples = _state_index.at(i).first.second; + view_state.type = DEC_NODETAIL; + view_state.state = 0; + view_state.data = 0; + states.push_back(view_state); + } + } +} + +} // namespace decoder +} // namespace pv diff --git a/DSLogic-gui/pv/decoder/dsdmx512.h b/DSLogic-gui/pv/decoder/dsdmx512.h new file mode 100644 index 00000000..685c630d --- /dev/null +++ b/DSLogic-gui/pv/decoder/dsdmx512.h @@ -0,0 +1,89 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_DSDMX512_H +#define DSLOGIC_PV_DSDMX512_H + +#include "decoder.h" +#include "../data/logic.h" +#include "../data/logicsnapshot.h" + +#include + +namespace pv { + +namespace data { +class LogicSnapshot; +} + +namespace decoder { + +class dsDmx512 : public Decoder +{ +private: + static const int TableSize = 8; + static const QColor ColorTable[TableSize]; + static const QString StateTable[TableSize]; + + enum {Unknown = 0, Break, Mab, Start, Scode, Stop, Mark, Slot}; + +private: + double get_next_pulse_width(bool level, + uint64_t samplerate, uint64_t &left, uint64_t right, uint64_t &end, + const boost::shared_ptr &snapshot); + + uint8_t get_next_data(bool code, bool &valid, uint8_t &cur_state, + uint64_t samplerate, uint64_t &left, uint64_t right, + const boost::shared_ptr &snapshot); + +public: + dsDmx512(boost::shared_ptr data, + std::list _sel_probes, QMap &_options, QMap _options_index); + + virtual ~dsDmx512(); + + QString get_decode_name(); + + void recode(std::list _sel_probes, QMap & _options, QMap _options_index); + + void decode(); + + void fill_color_table(std::vector & _color_table); + + void fill_state_table(std::vector & _state_table); + + void get_subsampled_states(std::vector &states, + uint64_t start, uint64_t end, + float min_length); + +private: + + int _dmx_index; + uint64_t _max_width; + std::vector< std::pair, std::pair > > _state_index; +}; + +} // namespace decoder +} // namespace pv + +#endif // DSLOGIC_PV_DSDMX512_H diff --git a/DSLogic-gui/pv/decoder/dsi2c.cpp b/DSLogic-gui/pv/decoder/dsi2c.cpp new file mode 100644 index 00000000..9f61b869 --- /dev/null +++ b/DSLogic-gui/pv/decoder/dsi2c.cpp @@ -0,0 +1,366 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "dsi2c.h" + +#include + +using namespace boost; +using namespace std; + +namespace pv { +namespace decoder { + +const QColor dsI2c::ColorTable[TableSize] = { + QColor(255, 255, 255, 150), + QColor(0, 255, 0, 150), + QColor(255, 0, 0, 150), + QColor(0, 255, 0, 150), + QColor(255, 0, 0, 150), + QColor(0, 0, 255, 150), + QColor(0, 0, 255, 150), + QColor(0, 255, 255, 150), +}; + +const QString dsI2c::StateTable[TableSize] = { + "UNKNOWN", + "START", + "STOP", + "ACK", + "NAK", + "READ @", + "WRITE @", + "DATA" +}; + +dsI2c::dsI2c(shared_ptr data, std::list _sel_probes, QMap &_options, QMap _options_index) : + Decoder(data, _sel_probes, _options_index) +{ + (void)_options; + + assert(_sel_probes.size() == 2); + + _scl_index = _sel_probes.front(); + _sda_index = _sel_probes.back(); +} + +dsI2c::~dsI2c() +{ +} + +QString dsI2c::get_decode_name() +{ + return "I2C"; +} + +void dsI2c::recode(std::list _sel_probes, QMap & _options, QMap _options_index) +{ + (void)_options; + + assert(_sel_probes.size() == 2); + _scl_index = _sel_probes.front(); + _sda_index = _sel_probes.back(); + this->_sel_probes = _sel_probes; + this->_options_index = _options_index; + + decode(); +} + +void dsI2c::decode() +{ + assert(_data); + _max_width = 0; + uint8_t cur_state = Unknown; + + const deque< shared_ptr > &snapshots = + _data->get_snapshots(); + if (snapshots.empty()) + return; + + const shared_ptr &snapshot = + snapshots.front(); + + uint64_t flag_index; + uint64_t start_index; + uint64_t stop_index; + bool edge; + uint64_t left = 0; + uint64_t right = snapshot->get_sample_count() - 1; + + if (!_state_index.empty()) + _state_index.clear(); + + while(1) + { + // search start flag + if (snapshot->get_first_edge(flag_index, edge, left, right, _sda_index, -1, _scl_index, 1) == SR_OK) { + left = flag_index + 1; + + if (cur_state == Start) { + stop_index = flag_index; + snapshot->get_edges(_cur_edges, start_index, stop_index, _scl_index, 1); + cmd_decode(snapshot); + data_decode(snapshot); + _cur_edges.clear(); + } + + if (edge == false) { + cur_state = Start; + _state_index.push_back(std::make_pair(std::make_pair(flag_index - 1, 2), std::make_pair(cur_state, 0))); + } else { + cur_state = Stop; + _state_index.push_back(std::make_pair(std::make_pair(flag_index - 1, 2), std::make_pair(cur_state, 0))); + } + start_index = flag_index + 1; + _max_width = max(_max_width, (uint64_t)2); + } else { + if (cur_state == Start) { + stop_index = snapshot->get_sample_count() - 1; + snapshot->get_edges(_cur_edges, start_index, stop_index, _scl_index, 1); + cmd_decode(snapshot); + data_decode(snapshot); + _cur_edges.clear(); + } + _cur_edges.clear(); + break; + } + } + +} + +void dsI2c::cmd_decode(const boost::shared_ptr &snapshot) +{ + uint8_t cur_state; + const uint8_t *src_ptr; + const int unit_size = snapshot->get_unit_size(); + //const uint8_t *const end_src_ptr = (uint8_t*)snapshot->get_data() + + // snapshot->get_sample_count() * unit_size; + + //const uint64_t scl_mask = 1ULL << _scl_index; + const uint64_t sda_mask = 1ULL << _sda_index; + + if (_cur_edges.size() > 9) { + uint8_t slave_addr = 0; + bool read; + bool nak; + //int index = 0; + src_ptr = (uint8_t*)snapshot->get_data(); + slave_addr = ((*(uint64_t*)(src_ptr + _cur_edges[0].first * unit_size) & sda_mask) != 0); + slave_addr = (slave_addr << 1) + ((*(uint64_t*)(src_ptr + _cur_edges[1].first * unit_size) & sda_mask) != 0); + slave_addr = (slave_addr << 1) + ((*(uint64_t*)(src_ptr + _cur_edges[2].first * unit_size) & sda_mask) != 0); + slave_addr = (slave_addr << 1) + ((*(uint64_t*)(src_ptr + _cur_edges[3].first * unit_size) & sda_mask) != 0); + slave_addr = (slave_addr << 1) + ((*(uint64_t*)(src_ptr + _cur_edges[4].first * unit_size) & sda_mask) != 0); + slave_addr = (slave_addr << 1) + ((*(uint64_t*)(src_ptr + _cur_edges[5].first * unit_size) & sda_mask) != 0); + slave_addr = (slave_addr << 1) + ((*(uint64_t*)(src_ptr + _cur_edges[6].first * unit_size) & sda_mask) != 0); + read = ((*(uint64_t*)(src_ptr + _cur_edges[7].first * unit_size) & sda_mask) != 0); + nak = ((*(uint64_t*)(src_ptr + _cur_edges[8].first * unit_size) & sda_mask) != 0); + + cur_state = read ? Read : Write; + _state_index.push_back(std::make_pair(std::make_pair(_cur_edges.at(0).first - 1, _cur_edges.at(7).first - _cur_edges.at(0).first + 2), + std::make_pair(cur_state, slave_addr))); + cur_state = nak ? Nak : Ack; + _state_index.push_back(std::make_pair(std::make_pair(_cur_edges.at(8).first - 1, 2), + std::make_pair(cur_state, 0))); + _max_width = max(_max_width, _cur_edges.at(7).first - _cur_edges.at(0).first + 2); + //_cur_edges.erase(_cur_edges.begin(), _cur_edges.begin() + 9); + } +} + +void dsI2c::data_decode(const shared_ptr &snapshot) +{ + uint8_t cur_state; + const uint8_t *src_ptr; + const int unit_size = snapshot->get_unit_size(); + //const uint8_t *const end_src_ptr = (uint8_t*)snapshot->get_data() + + // snapshot->get_sample_count() * unit_size; + + //const uint64_t scl_mask = 1ULL << _scl_index; + const uint64_t sda_mask = 1ULL << _sda_index; + + uint64_t edge_size = _cur_edges.size(); + uint64_t index = 9; + + while (edge_size > index + 9) { + uint8_t data = 0; + bool nak; + + src_ptr = (uint8_t*)snapshot->get_data(); + data = ((*(uint64_t*)(src_ptr + _cur_edges[index].first * unit_size) & sda_mask) != 0); + data = (data << 1) + ((*(uint64_t*)(src_ptr + _cur_edges[index + 1].first * unit_size) & sda_mask) != 0); + data = (data << 1) + ((*(uint64_t*)(src_ptr + _cur_edges[index + 2].first * unit_size) & sda_mask) != 0); + data = (data << 1) + ((*(uint64_t*)(src_ptr + _cur_edges[index + 3].first * unit_size) & sda_mask) != 0); + data = (data << 1) + ((*(uint64_t*)(src_ptr + _cur_edges[index + 4].first * unit_size) & sda_mask) != 0); + data = (data << 1) + ((*(uint64_t*)(src_ptr + _cur_edges[index + 5].first * unit_size) & sda_mask) != 0); + data = (data << 1) + ((*(uint64_t*)(src_ptr + _cur_edges[index + 6].first * unit_size) & sda_mask) != 0); + data = (data << 1) + ((*(uint64_t*)(src_ptr + _cur_edges[index + 7].first * unit_size) & sda_mask) != 0); + nak = ((*(uint64_t*)(src_ptr + _cur_edges[index + 8].first * unit_size) & sda_mask) != 0); + + cur_state = Data; + _state_index.push_back(std::make_pair(std::make_pair(_cur_edges.at(index).first - 1, _cur_edges.at(index + 7).first - _cur_edges.at(index).first + 2), + std::make_pair(cur_state, data))); + cur_state = nak ? Nak : Ack; + _state_index.push_back(std::make_pair(std::make_pair(_cur_edges.at(index + 8).first - 1, 2), + std::make_pair(cur_state, 0))); + _max_width = max(_max_width, _cur_edges.at(index + 7).first - _cur_edges.at(index).first + 2); + //_cur_edges.erase(_cur_edges.begin(), _cur_edges.begin() + 9); + index += 9; + } +} + +void dsI2c::fill_color_table(std::vector & _color_table) +{ + int i; + for(i = 0; i < TableSize; i++) + _color_table.push_back(ColorTable[i]); +} + +void dsI2c::fill_state_table(std::vector & _state_table) +{ + int i; + for(i = 0; i < TableSize; i++) + _state_table.push_back(StateTable[i]); +} + +void dsI2c::get_subsampled_states(std::vector &states, + uint64_t start, uint64_t end, + float min_length) +{ + ds_view_state view_state; + + const deque< shared_ptr > &snapshots = + _data->get_snapshots(); + if (snapshots.empty()) + return; + const shared_ptr &snapshot = + snapshots.front(); + + assert(end <= snapshot->get_sample_count()); + assert(start <= end); + assert(min_length > 0); + + if (!states.empty()) + states.clear(); + + if (_state_index.empty()) + return; + if (start > _state_index.at(_state_index.size() - 1).first.first) + return; + if (end < _state_index.at(0).first.first) + return; + + if (min_length * _view_scale > _max_width) { + view_state.index = _state_index.at(0).first.first; + view_state.samples = _state_index.at(_state_index.size() - 1).first.first + + _state_index.at(_state_index.size() - 1).first.second - _state_index.at(0).first.first; + view_state.type = DEC_NODETAIL; + view_state.state = 0; + view_state.data = 0; + states.push_back(view_state); + return; + } + + uint64_t view_start = 0; + uint64_t view_end = 0; + uint64_t minIndex = 0; + uint64_t maxIndex = _state_index.size() - 1; + uint64_t i = start * 1.0f / snapshot->get_sample_count() * maxIndex; + bool check_flag = false; + int times = 0; + while(times <= 32) { + if (_state_index.at(i).first.first + _state_index.at(i).first.second >= start) { + check_flag = true; + } else { + minIndex = i; + i = ceil((i + maxIndex) / 2.0f); + } + + if (check_flag) { + if (i == 0) { + view_start = i; + break; + } else if (_state_index.at(i-1).first.first + _state_index.at(i-1).first.second < start) { + view_start = i; + break; + } else { + maxIndex = i; + i = (i + minIndex) / 2; + } + check_flag = false; + } + times++; + } + i = view_start; + check_flag = false; + times = 0; + minIndex = view_start; + //maxIndex = _state_index.size() - 1; + maxIndex = min(_state_index.size() - 1, (size_t)end); + view_end = view_start; + while(times <= 32) { + if (_state_index.at(i).first.first <= end) { + check_flag = true; + } else { + maxIndex = i; + i = (i + minIndex) / 2; + } + + if (check_flag) { + if (i == maxIndex) { + view_end = i; + break; + } else if (_state_index.at(i+1).first.first > end) { + view_end = i; + break; + } else { + minIndex = i; + i = ceil((i + maxIndex) / 2.0f); + } + check_flag = false; + } + times++; + } + + assert(view_end >= view_start); + + for (uint64_t i = view_start; i <= view_end; i++) { + if (_state_index.at(i).first.second >= min_length * _view_scale) { + view_state.index = _state_index.at(i).first.first; + view_state.samples = _state_index.at(i).first.second; + view_state.type = (_state_index.at(i).second.first == Read || + _state_index.at(i).second.first == Write || + _state_index.at(i).second.first == Data) ? DEC_DATA : DEC_CMD; + view_state.state = _state_index.at(i).second.first; + view_state.data = _state_index.at(i).second.second; + states.push_back(view_state); + } else { + view_state.index = _state_index.at(i).first.first; + view_state.samples = _state_index.at(i).first.second; + view_state.type = DEC_NODETAIL; + view_state.state = 0; + view_state.data = 0; + states.push_back(view_state); + } + } +} + +} // namespace decoder +} // namespace pv diff --git a/DSLogic-gui/pv/decoder/dsi2c.h b/DSLogic-gui/pv/decoder/dsi2c.h new file mode 100644 index 00000000..a30ea5c8 --- /dev/null +++ b/DSLogic-gui/pv/decoder/dsi2c.h @@ -0,0 +1,87 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_DSI2C_H +#define DSLOGIC_PV_DSI2C_H + +#include "decoder.h" +#include "../data/logic.h" +#include "../data/logicsnapshot.h" + +#include + +namespace pv { + +namespace data { +class LogicSnapshot; +} + +namespace decoder { + +class dsI2c : public Decoder +{ +private: + static const int TableSize = 8; + static const QColor ColorTable[TableSize]; + static const QString StateTable[TableSize]; + + enum {Unknown = 0, Start, Stop, Ack, Nak, Read, Write, Data}; + +private: + void cmd_decode(const boost::shared_ptr &snapshot); + + void data_decode(const boost::shared_ptr &snapshot); + +public: + dsI2c(boost::shared_ptr data, + std::list _sel_probes, QMap &_options, QMap _options_index); + + virtual ~dsI2c(); + + QString get_decode_name(); + + void recode(std::list _sel_probes, QMap & _options, QMap _options_index); + + void decode(); + + void fill_color_table(std::vector & _color_table); + + void fill_state_table(std::vector & _state_table); + + void get_subsampled_states(std::vector &states, + uint64_t start, uint64_t end, + float min_length); + +private: + + int _scl_index; + int _sda_index; + uint64_t _max_width; + std::vector< pv::data::LogicSnapshot::EdgePair > _cur_edges; + std::vector< std::pair, std::pair > > _state_index; +}; + +} // namespace decoder +} // namespace pv + +#endif // DSLOGIC_PV_DSI2C_H diff --git a/DSLogic-gui/pv/decoder/dsserial.cpp b/DSLogic-gui/pv/decoder/dsserial.cpp new file mode 100644 index 00000000..5b231864 --- /dev/null +++ b/DSLogic-gui/pv/decoder/dsserial.cpp @@ -0,0 +1,356 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "dsserial.h" + +#include + +using namespace boost; +using namespace std; + +namespace pv { +namespace decoder { + +const QColor dsSerial::ColorTable[TableSize] = { + QColor(255, 255, 255, 150), + QColor(0, 255, 0, 150), + QColor(255, 0, 0, 150), + QColor(0, 255, 0, 150), + QColor(255, 0, 0, 150), + QColor(0, 0, 255, 150), + QColor(0, 0, 255, 150), + QColor(0, 255, 255, 150), +}; + +const QString dsSerial::StateTable[TableSize] = { + "UNKNOWN", + "START", + "STOP", + "START ERROR", + "STOP ERROR", + "PARITY", + "PARITY ERROR", + "DATA" +}; + +dsSerial::dsSerial(shared_ptr data, std::list _sel_probes, QMap &_options, QMap _options_index) : + Decoder(data, _sel_probes, _options_index) +{ + assert(_sel_probes.size() == 1); + + _serial_index = _sel_probes.front(); + + _baudrate = _options.value("baudrate").toULongLong(); + _stopbits = _options.value("stopbits").toFloat(); + _parity = _options.value("parity").toInt(); + _order = _options.value("order").toBool(); + _bits = _options.value("bits").toUInt(); + _idle_level = _options.value("idle").toBool(); +} + +dsSerial::~dsSerial() +{ +} + +QString dsSerial::get_decode_name() +{ + return "Async Serial"; +} + +void dsSerial::recode(std::list _sel_probes, QMap & _options, QMap _options_index) +{ + assert(_sel_probes.size() == 1); + + _serial_index = _sel_probes.front(); + + _baudrate = _options.value("baudrate").toULongLong(); + _stopbits = _options.value("stopbits").toFloat(); + _parity = _options.value("parity").toInt(); + _order = _options.value("order").toBool(); + _bits = _options.value("bits").toUInt(); + _idle_level = _options.value("idle").toBool(); + + + this->_sel_probes = _sel_probes; + this->_options_index = _options_index; + + decode(); +} + +void dsSerial::decode() +{ + assert(_data); + uint8_t cur_state = Unknown; + + const deque< shared_ptr > &snapshots = + _data->get_snapshots(); + if (snapshots.empty()) + return; + + const shared_ptr &snapshot = + snapshots.front(); + + uint64_t flag_index; + uint64_t start_index; + uint64_t stop_index; + bool edge; + uint64_t left = 0; + uint64_t right = snapshot->get_sample_count() - 1; + float samplesPerBit; + int sampleOffset; + int i; + _max_width = 0; + _min_width = right; + + int start_flag = _idle_level ? 0 : 1; + if (_baudrate != 0) + samplesPerBit = _data->get_samplerate() * 1.0f / _baudrate; + else + samplesPerBit = snapshot->get_min_pulse(left, right, _serial_index); + sampleOffset = samplesPerBit / 2; + + if (!_state_index.empty()) + _state_index.clear(); + + while(1) + { + // search start flag + bool stop_err = false; + if (snapshot->get_first_edge(flag_index, edge, left, right, _serial_index, start_flag, _serial_index, -1) == SR_OK) { + left = flag_index + floor((_bits + (_parity != -1) + _stopbits + 1) * samplesPerBit); + + cur_state = Start; + _state_index.push_back(std::make_pair(std::make_pair(flag_index, samplesPerBit), std::make_pair(cur_state, 0))); + _max_width = max(_max_width, (uint64_t)samplesPerBit); + _min_width = min(_min_width, (uint64_t)samplesPerBit); + + start_index = flag_index + samplesPerBit * 1.5; + stop_index = flag_index + ceil((_bits + (_parity != -1) + 1) * samplesPerBit); + + if (left < right) { + for (i = 0; i < _stopbits * samplesPerBit; i++) { + if (_idle_level != ((snapshot->get_sample(stop_index + i) & 1ULL << _serial_index) != 0)) { + stop_err = true; + break; + } + } + if (stop_err) { + cur_state = StopErr; + _state_index.push_back(std::make_pair(std::make_pair(stop_index, samplesPerBit), std::make_pair(cur_state, 0))); + } else { + data_decode(snapshot, start_index, stop_index, samplesPerBit); + cur_state = Stop; + _state_index.push_back(std::make_pair(std::make_pair(stop_index, samplesPerBit), std::make_pair(cur_state, 0))); + } + } else { + _cur_edges.clear(); + break; + } + } else { + _cur_edges.clear(); + break; + } + } + +} + +void dsSerial::data_decode(const shared_ptr &snapshot, uint64_t start, uint64_t stop, float samplesPerBit) +{ + (void)stop; + + uint8_t cur_state; + const uint8_t *src_ptr; + const int unit_size = snapshot->get_unit_size(); + + const uint64_t serial_mask = 1ULL << _serial_index; + + uint32_t data = 0; + uint32_t parity; + int i; + + src_ptr = (uint8_t*)snapshot->get_data(); + if (_order) { + for (i = 0; i < _bits; i++) { + data = data + (((*(uint64_t*)(src_ptr + (int)(start + samplesPerBit * i) * unit_size) & serial_mask) != 0) << i); + } + } else { + for (i = 0; i < _bits; i++) { + data = (data << 1) + ((*(uint64_t*)(src_ptr + (int)(start + samplesPerBit * i) * unit_size) & serial_mask) != 0); + } + } + + cur_state = Data; + _state_index.push_back(std::make_pair(std::make_pair(start - samplesPerBit * 0.5, samplesPerBit * _bits), + std::make_pair(cur_state, data))); + if (_parity != -1) { + parity = ((*(uint64_t*)(src_ptr + (int)(start + samplesPerBit * _bits) * unit_size) & serial_mask) != 0); + parity = parity ^ data; + parity = (parity & 0x55555555) + ((parity >> 1) & 0x55555555); + parity = (parity & 0x33333333) + ((parity >> 2) & 0x33333333); + parity = (parity & 0x0f0f0f0f) + ((parity >> 4) & 0x0f0f0f0f); + parity = (parity & 0x00ff00ff) + ((parity >> 8) & 0x00ff00ff); + parity = (parity & 0x0000ffff) + ((parity >> 16) & 0x0000ffff); + parity = (parity & 0x00000001) ^ _parity; + cur_state = parity ? ParityErr : Parity; + _state_index.push_back(std::make_pair(std::make_pair(start + samplesPerBit * (_bits - 0.5), samplesPerBit), + std::make_pair(cur_state, 0))); + } + _max_width = max(_max_width, (uint64_t)(samplesPerBit * _bits)); +} + +void dsSerial::fill_color_table(std::vector & _color_table) +{ + int i; + for(i = 0; i < TableSize; i++) + _color_table.push_back(ColorTable[i]); +} + +void dsSerial::fill_state_table(std::vector & _state_table) +{ + int i; + for(i = 0; i < TableSize; i++) + _state_table.push_back(StateTable[i]); +} + +void dsSerial::get_subsampled_states(std::vector &states, + uint64_t start, uint64_t end, + float min_length) +{ + ds_view_state view_state; + + const deque< shared_ptr > &snapshots = + _data->get_snapshots(); + if (snapshots.empty()) + return; + const shared_ptr &snapshot = + snapshots.front(); + + assert(end <= snapshot->get_sample_count()); + assert(start <= end); + assert(min_length > 0); + + if (!states.empty()) + states.clear(); + + if (_state_index.empty()) + return; + if (start > _state_index.at(_state_index.size() - 1).first.first) + return; + if (end < _state_index.at(0).first.first) + return; + + if (min_length * _view_scale > _max_width) { + view_state.index = _state_index.at(0).first.first; + view_state.samples = _state_index.at(_state_index.size() - 1).first.first + + _state_index.at(_state_index.size() - 1).first.second - _state_index.at(0).first.first; + view_state.type = DEC_NODETAIL; + view_state.state = 0; + view_state.data = 0; + states.push_back(view_state); + return; + } + + uint64_t view_start = 0; + uint64_t view_end = 0; + uint64_t minIndex = 0; + uint64_t maxIndex = _state_index.size() - 1; + uint64_t i = start * 1.0f / snapshot->get_sample_count() * maxIndex; + bool check_flag = false; + int times = 0; + while(times <= 32) { + if (_state_index.at(i).first.first + _state_index.at(i).first.second >= start) { + check_flag = true; + } else { + minIndex = i; + i = ceil((i + maxIndex) / 2.0f); + } + + if (check_flag) { + if (i == 0) { + view_start = i; + break; + } else if (_state_index.at(i-1).first.first + _state_index.at(i-1).first.second < start) { + view_start = i; + break; + } else { + maxIndex = i; + i = (i + minIndex) / 2; + } + check_flag = false; + } + times++; + } + i = view_start; + check_flag = false; + times = 0; + minIndex = view_start; + //maxIndex = _state_index.size() - 1; + maxIndex = min(_state_index.size() - 1, (size_t)end); + view_end = view_start; + while(times <= 32) { + if (_state_index.at(i).first.first <= end) { + check_flag = true; + } else { + maxIndex = i; + i = (i + minIndex) / 2; + } + + if (check_flag) { + if (i == maxIndex) { + view_end = i; + break; + } else if (_state_index.at(i+1).first.first > end) { + view_end = i; + break; + } else { + minIndex = i; + i = ceil((i + maxIndex) / 2.0f); + } + check_flag = false; + } + times++; + } + + assert(view_end >= view_start); + + for (uint64_t i = view_start; i <= view_end; i++) { + if (_state_index.at(i).first.second >= min_length * _view_scale) { + view_state.index = _state_index.at(i).first.first; + view_state.samples = _state_index.at(i).first.second; + view_state.type = (_state_index.at(i).second.first == Data) ? DEC_DATA : DEC_CMD; + view_state.state = _state_index.at(i).second.first; + view_state.data = _state_index.at(i).second.second; + states.push_back(view_state); + } else { + view_state.index = _state_index.at(i).first.first; + view_state.samples = _state_index.at(i).first.second; + view_state.type = DEC_NODETAIL; + view_state.state = 0; + view_state.data = 0; + states.push_back(view_state); + } + } +} + +} // namespace decoder +} // namespace pv diff --git a/DSLogic-gui/pv/decoder/dsserial.h b/DSLogic-gui/pv/decoder/dsserial.h new file mode 100644 index 00000000..c26c64e0 --- /dev/null +++ b/DSLogic-gui/pv/decoder/dsserial.h @@ -0,0 +1,95 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_SV_DSSERIAL_H +#define DSLOGIC_SV_DSSERIAL_H + +#include "decoder.h" +#include "../data/logic.h" +#include "../data/logicsnapshot.h" + +#include + +#include +#include + +namespace pv { + +namespace data { +class LogicSnapshot; +} + +namespace decoder { + +class dsSerial : public Decoder +{ +private: + static const int TableSize = 8; + static const QColor ColorTable[TableSize]; + static const QString StateTable[TableSize]; + + enum {Unknown = 0, Start, Stop, StartErr, StopErr, Parity, ParityErr, Data}; + +private: + void data_decode(const boost::shared_ptr &snapshot, uint64_t start, uint64_t stop, float samplesPerBit); + +public: + dsSerial(boost::shared_ptr data, + std::list _sel_probes, QMap &_options, QMap _options_index); + + virtual ~dsSerial(); + + QString get_decode_name(); + + void recode(std::list _sel_probes, QMap & _options, QMap _options_index); + + void decode(); + + void fill_color_table(std::vector & _color_table); + + void fill_state_table(std::vector & _state_table); + + void get_subsampled_states(std::vector &states, + uint64_t start, uint64_t end, + float min_length); + +private: + + int _serial_index; + uint64_t _baudrate; + float _stopbits; + int _parity; + bool _order; + int _bits; + bool _idle_level; + + uint64_t _max_width; + uint64_t _min_width; + std::vector< pv::data::LogicSnapshot::EdgePair > _cur_edges; + std::vector< std::pair, std::pair > > _state_index; +}; + +} // namespace decoder +} // namespace pv + +#endif // DSLOGIC_PV_DSSERIAL_H diff --git a/DSLogic-gui/pv/decoder/dsspi.cpp b/DSLogic-gui/pv/decoder/dsspi.cpp new file mode 100644 index 00000000..88ff8db0 --- /dev/null +++ b/DSLogic-gui/pv/decoder/dsspi.cpp @@ -0,0 +1,374 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "dsspi.h" + +#include + +using namespace boost; +using namespace std; + +namespace pv { +namespace decoder { + +const QColor dsSpi::ColorTable[TableSize] = { + QColor(255, 255, 255, 150), + QColor(255, 0, 0, 150), + QColor(255, 0, 0, 150), + QColor(0, 255, 255, 150), +}; + +const QString dsSpi::StateTable[TableSize] = { + "UNKNOWN", + "CLOCK POLARITY ERROR", + "TOO FEW BITS", + "DATA" +}; + +dsSpi::dsSpi(shared_ptr data, std::list _sel_probes, QMap &_options, QMap _options_index) : + Decoder(data, _sel_probes, _options_index) +{ + _cpol = _options.value("cpol").toBool(); + _cpha = _options.value("cpha").toBool(); + _order = _options.value("order").toBool(); + _bits = _options.value("bits").toUInt(); + _ssn = _options.value("ssn").toInt(); + + if (_ssn == -1) + assert(_sel_probes.size() == 3); + else + assert(_sel_probes.size() == 4); + + if (_ssn != -1) { + _ssn_index = _sel_probes.front(); + _sel_probes.pop_front(); + }else{ + _ssn_index = 0; + } + _sclk_index = _sel_probes.front(); + _sel_probes.pop_front(); + _mosi_index = _sel_probes.front(); + _sel_probes.pop_front(); + _miso_index = _sel_probes.front(); + _sel_probes.pop_front(); +} + +dsSpi::~dsSpi() +{ +} + +QString dsSpi::get_decode_name() +{ + return "SPI"; +} + +void dsSpi::recode(std::list _sel_probes, QMap & _options, QMap _options_index) +{ + _cpol = _options.value("cpol").toBool(); + _cpha = _options.value("cpha").toBool(); + _order = _options.value("order").toBool(); + _bits = _options.value("bits").toUInt(); + _ssn = _options.value("ssn").toInt(); + + if (_ssn == -1) + assert(_sel_probes.size() == 3); + else + assert(_sel_probes.size() == 4); + + if (_ssn != -1) { + _ssn_index = _sel_probes.front(); + _sel_probes.pop_front(); + _sel_probes.push_back(_ssn_index); + }else{ + _ssn_index = 0; + } + _sclk_index = _sel_probes.front(); + _sel_probes.pop_front(); + _sel_probes.push_back(_sclk_index); + _mosi_index = _sel_probes.front(); + _sel_probes.pop_front(); + _sel_probes.push_back(_mosi_index); + _miso_index = _sel_probes.front(); + _sel_probes.pop_front(); + _sel_probes.push_back(_miso_index); + + + this->_sel_probes = _sel_probes; + this->_options_index = _options_index; + + decode(); +} + +void dsSpi::decode() +{ + assert(_data); + _max_width = 0; + uint8_t cur_state = Unknown; + + const deque< shared_ptr > &snapshots = + _data->get_snapshots(); + if (snapshots.empty()) + return; + + const shared_ptr &snapshot = + snapshots.front(); + + const uint64_t ssn_mask = 1ULL << _ssn_index; + const uint64_t sclk_mask = 1ULL << _sclk_index; + uint64_t flag_index; + uint64_t start_index; + uint64_t stop_index; + bool edge; + uint64_t left = 0; + uint64_t right = snapshot->get_sample_count() - 1; + + if (!_state_index.empty()) + _state_index.clear(); + + while(1) + { + // search start flag + if (_ssn != -1) { + if (_ssn == ((snapshot->get_sample(left) & ssn_mask) != 0)) { + if (snapshot->get_first_edge(flag_index, edge, left, right, _ssn_index, !_ssn, _ssn_index, -1) == SR_OK) { + start_index = left; + stop_index = flag_index - 1; + } else { + start_index = left; + stop_index = right; + } + } else { + if (snapshot->get_first_edge(flag_index, edge, left, right, _ssn_index, _ssn, _ssn_index, -1) == SR_OK) + start_index = flag_index; + else + break; + + if (snapshot->get_first_edge(flag_index, edge, left, right, _ssn_index, !_ssn, _ssn_index, -1) == SR_OK) + stop_index = flag_index - 1; + else + stop_index = right; + } + } else { + start_index = left; + stop_index = right; + } + + if (stop_index - start_index > 15) { + if (_cpol == ((snapshot->get_sample(start_index) & sclk_mask) != 0)) { + snapshot->get_edges(_cur_edges, start_index, stop_index, _sclk_index, !(_cpha ^ _cpol)); + data_decode(snapshot); + } else { + cur_state = ClockErr; + _state_index.push_back(std::make_pair(std::make_pair(start_index, stop_index - start_index), + std::make_pair(cur_state, 0))); + _max_width = max(_max_width, stop_index - start_index); + } + } + + left = stop_index + 1; + if (left >= right) + break; + } +} + +void dsSpi::data_decode(const shared_ptr &snapshot) +{ + uint8_t cur_state; + const uint8_t *src_ptr; + const int unit_size = snapshot->get_unit_size(); + + const uint64_t miso_mask = 1ULL << _miso_index; + const uint64_t mosi_mask = 1ULL << _mosi_index; + + uint64_t edge_size = _cur_edges.size(); + uint64_t index = 0; + src_ptr = (uint8_t*)snapshot->get_data(); + + while (edge_size >= index + _bits) { + uint8_t mosi = 0; + uint8_t miso = 0; + int i; + + if (_order) { + for (i = 0; i < _bits; i++) { + mosi = (mosi << 1) + ((*(uint64_t*)(src_ptr + _cur_edges[index + i].first * unit_size) & mosi_mask) != 0); + miso = (miso << 1) + ((*(uint64_t*)(src_ptr + _cur_edges[index + i].first * unit_size) & miso_mask) != 0); + } + } else { + for (i = 0; i < _bits; i++) { + mosi = mosi + (((*(uint64_t*)(src_ptr + _cur_edges[index + i].first * unit_size) & mosi_mask) != 0) << i); + miso = miso + (((*(uint64_t*)(src_ptr + _cur_edges[index + i].first * unit_size) & miso_mask) != 0) << i); + } + } + + cur_state = Data; + _state_index.push_back(std::make_pair(std::make_pair(_cur_edges.at(index).first - 1, _cur_edges.at(index + _bits - 1).first - _cur_edges.at(index).first + 2), + std::make_pair(cur_state, mosi))); + + _max_width = max(_max_width, _cur_edges.at(index + _bits - 1).first - _cur_edges.at(index).first + 2); + index += 8; + } + + if (edge_size > index + 1 && edge_size < index + _bits) { + cur_state = BitsErr; + _state_index.push_back(std::make_pair(std::make_pair(_cur_edges.at(index + 1).first - 1, _cur_edges.at(_cur_edges.size() - 1).first - _cur_edges.at(index + 1).first + 2), + std::make_pair(cur_state, 0))); + } +} + +void dsSpi::fill_color_table(std::vector & _color_table) +{ + int i; + for(i = 0; i < TableSize; i++) + _color_table.push_back(ColorTable[i]); +} + +void dsSpi::fill_state_table(std::vector & _state_table) +{ + int i; + for(i = 0; i < TableSize; i++) + _state_table.push_back(StateTable[i]); +} + +void dsSpi::get_subsampled_states(std::vector &states, + uint64_t start, uint64_t end, + float min_length) +{ + ds_view_state view_state; + + const deque< shared_ptr > &snapshots = + _data->get_snapshots(); + if (snapshots.empty()) + return; + const shared_ptr &snapshot = + snapshots.front(); + + assert(end <= snapshot->get_sample_count()); + assert(start <= end); + assert(min_length > 0); + + if (!states.empty()) + states.clear(); + + if (_state_index.empty()) + return; + if (start > _state_index.at(_state_index.size() - 1).first.first) + return; + if (end < _state_index.at(0).first.first) + return; + + if (min_length * _view_scale > _max_width) { + view_state.index = _state_index.at(0).first.first; + view_state.samples = _state_index.at(_state_index.size() - 1).first.first + + _state_index.at(_state_index.size() - 1).first.second - _state_index.at(0).first.first; + view_state.type = DEC_NODETAIL; + view_state.state = 0; + view_state.data = 0; + states.push_back(view_state); + return; + } + + uint64_t view_start = 0; + uint64_t view_end = 0; + uint64_t minIndex = 0; + uint64_t maxIndex = _state_index.size() - 1; + uint64_t i = start * 1.0f / snapshot->get_sample_count() * maxIndex; + bool check_flag = false; + int times = 0; + while(times <= 32) { + if (_state_index.at(i).first.first + _state_index.at(i).first.second >= start) { + check_flag = true; + } else { + minIndex = i; + i = ceil((i + maxIndex) / 2.0f); + } + + if (check_flag) { + if (i == 0) { + view_start = i; + break; + } else if (_state_index.at(i-1).first.first + _state_index.at(i-1).first.second < start) { + view_start = i; + break; + } else { + maxIndex = i; + i = (i + minIndex) / 2; + } + check_flag = false; + } + times++; + } + i = view_start; + check_flag = false; + times = 0; + minIndex = view_start; + //maxIndex = _state_index.size() - 1; + maxIndex = min(_state_index.size() - 1, (size_t)end); + view_end = view_start; + while(times <= 32) { + if (_state_index.at(i).first.first <= end) { + check_flag = true; + } else { + maxIndex = i; + i = (i + minIndex) / 2; + } + + if (check_flag) { + if (i == maxIndex) { + view_end = i; + break; + } else if (_state_index.at(i+1).first.first > end) { + view_end = i; + break; + } else { + minIndex = i; + i = ceil((i + maxIndex) / 2.0f); + } + check_flag = false; + } + times++; + } + + assert(view_end >= view_start); + + for (uint64_t i = view_start; i <= view_end; i++) { + if (_state_index.at(i).first.second >= min_length * _view_scale) { + view_state.index = _state_index.at(i).first.first; + view_state.samples = _state_index.at(i).first.second; + view_state.type = (_state_index.at(i).second.first == Data) ? DEC_DATA : DEC_CMD; + view_state.state = _state_index.at(i).second.first; + view_state.data = _state_index.at(i).second.second; + states.push_back(view_state); + } else { + view_state.index = _state_index.at(i).first.first; + view_state.samples = _state_index.at(i).first.second; + view_state.type = DEC_NODETAIL; + view_state.state = 0; + view_state.data = 0; + states.push_back(view_state); + } + } +} + +} // namespace decoder +} // namespace pv diff --git a/DSLogic-gui/pv/decoder/dsspi.h b/DSLogic-gui/pv/decoder/dsspi.h new file mode 100644 index 00000000..edf601a5 --- /dev/null +++ b/DSLogic-gui/pv/decoder/dsspi.h @@ -0,0 +1,97 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_DSSPI_H +#define DSLOGIC_PV_DSSPI_H + +#include "decoder.h" +#include "../data/logic.h" +#include "../data/logicsnapshot.h" + +#include + +#include +#include + +namespace pv { + +namespace data { +class LogicSnapshot; +} + +namespace decoder { + +class dsSpi : public Decoder +{ +private: + static const int TableSize = 4; + static const QColor ColorTable[TableSize]; + static const QString StateTable[TableSize]; + + enum {Unknown = 0, ClockErr, BitsErr, Data}; + +private: + void data_decode(const boost::shared_ptr &snapshot); + +public: + dsSpi(boost::shared_ptr data, + std::list _sel_probes, QMap &_options, QMap _options_index); + + virtual ~dsSpi(); + + QString get_decode_name(); + + void recode(std::list _sel_probes, QMap & _options, QMap _options_index); + + void decode(); + + void fill_color_table(std::vector & _color_table); + + void fill_state_table(std::vector & _state_table); + + void get_subsampled_states(std::vector &states, + uint64_t start, uint64_t end, + float min_length); + +private: + + int _ssn_index; + int _sclk_index; + int _mosi_index; + int _miso_index; + + bool _cpol; + bool _cpha; + int _bits; + bool _order; + int _ssn; + + uint64_t _max_width; + std::vector< pv::data::LogicSnapshot::EdgePair > _cur_edges; + std::vector< std::pair, std::pair > > _state_index; +}; + +} // namespace decoder +} // namespace pv + +#endif // DSLOGIC_PV_DSSPI_H diff --git a/DSLogic-gui/pv/decoder/i2cconfig.ui b/DSLogic-gui/pv/decoder/i2cconfig.ui new file mode 100644 index 00000000..a487f7b7 --- /dev/null +++ b/DSLogic-gui/pv/decoder/i2cconfig.ui @@ -0,0 +1,127 @@ + + + I2cConfig + + + + 0 + 0 + 385 + 204 + + + + + 385 + 204 + + + + + 385 + 204 + + + + Dialog + + + + + 30 + 160 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 30 + 50 + 301 + 73 + + + + + QFormLayout::AllNonFixedFieldsGrow + + + 16 + + + 16 + + + + + + 0 + 0 + + + + SCL + + + + + + + + + + SDA + + + + + + + + + + + + + buttonBox + accepted() + I2cConfig + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + I2cConfig + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/DSLogic-gui/pv/decoder/serialconfig.ui b/DSLogic-gui/pv/decoder/serialconfig.ui new file mode 100644 index 00000000..23f6aa5a --- /dev/null +++ b/DSLogic-gui/pv/decoder/serialconfig.ui @@ -0,0 +1,535 @@ + + + SerialConfig + + + + 0 + 0 + 434 + 507 + + + + + 434 + 507 + + + + + 434 + 507 + + + + Dialog + + + + + 70 + 460 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 30 + 20 + 351 + 81 + + + + Probes Setting + + + + + 20 + 30 + 331 + 41 + + + + + QFormLayout::AllNonFixedFieldsGrow + + + 16 + + + 16 + + + + + + 0 + 0 + + + + Serial + + + + + + + + + + + + + 30 + 120 + 351 + 301 + + + + Mode Setting + + + + + 20 + 30 + 331 + 261 + + + + + QFormLayout::AllNonFixedFieldsGrow + + + 16 + + + 16 + + + + + + 0 + 0 + + + + Baudrate + + + + + + + 6 + + + + 150 + + + + + 300 + + + + + 600 + + + + + 1200 + + + + + 2400 + + + + + 4800 + + + + + 9600 + + + + + 14400 + + + + + 19200 + + + + + 28800 + + + + + 38400 + + + + + 57600 + + + + + 76800 + + + + + 115200 + + + + + 230400 + + + + + 460800 + + + + + 921600 + + + + + + + + Use Autobaud + + + + + + + Stopbits + + + + + + + + 1 + + + + + 1.5 + + + + + 2 + + + + + + + + Parity + + + + + + + 0 + + + + No Parity + + + + + Odd Parity + + + + + Even Parity + + + + + + + + Bit Order + + + + + + + + LSB - Least Significant Bit First + + + + + MSB - Most Significant Bit First + + + + + + + + Bits + + + + + + + 4 + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + 17 + + + + + 18 + + + + + 19 + + + + + 20 + + + + + 21 + + + + + 22 + + + + + 23 + + + + + 24 + + + + + 25 + + + + + 26 + + + + + 27 + + + + + 28 + + + + + 29 + + + + + 30 + + + + + 31 + + + + + 32 + + + + + + + + Idle level + + + + + + + + High - start = L, stop = H + + + + + Low - start = H, stop = L + + + + + + + + groupBox + buttonBox + groupBox_2 + + + + + buttonBox + accepted() + SerialConfig + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + SerialConfig + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/DSLogic-gui/pv/decoder/spiconfig.ui b/DSLogic-gui/pv/decoder/spiconfig.ui new file mode 100644 index 00000000..85028bee --- /dev/null +++ b/DSLogic-gui/pv/decoder/spiconfig.ui @@ -0,0 +1,381 @@ + + + SpiConfig + + + + 0 + 0 + 442 + 535 + + + + + 442 + 535 + + + + + 442 + 535 + + + + Dialog + + + + + 70 + 480 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 20 + 20 + 351 + 191 + + + + Probes Setting + + + + + 30 + 30 + 241 + 145 + + + + + QFormLayout::AllNonFixedFieldsGrow + + + 16 + + + 16 + + + + + + 0 + 0 + + + + SSn + + + + + + + + + + SCLK + + + + + + + + + + MOSI + + + + + + + + + + MISO + + + + + + + + + + + + + 30 + 230 + 351 + 221 + + + + Mode Setting + + + + + 20 + 30 + 311 + 181 + + + + + QFormLayout::AllNonFixedFieldsGrow + + + 16 + + + 16 + + + + + + 0 + 0 + + + + CPOL + + + + + + + + 0 - Clock is Low when Inactive + + + + + 1 - Clock is High when Inactive + + + + + + + + CPHA + + + + + + + + 0 - Data is Valid on Clock Rising Edge + + + + + 1 - Data is Valid on Clock Falling Edge + + + + + + + + Bits + + + + + + + 4 + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + 24 + + + + + 32 + + + + + + + + Order + + + + + + + + MSB - Most Significant Bit First + + + + + LSB - Least Significant Bit First + + + + + + + + SSn + + + + + + + + SSn is Active Low + + + + + SSn is Active High + + + + + Don't use SSn + + + + + + + + groupBox + buttonBox + groupBox_2 + + + + + buttonBox + accepted() + SpiConfig + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + SpiConfig + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/DSLogic-gui/pv/decoder/wire1config.ui b/DSLogic-gui/pv/decoder/wire1config.ui new file mode 100644 index 00000000..e0212854 --- /dev/null +++ b/DSLogic-gui/pv/decoder/wire1config.ui @@ -0,0 +1,103 @@ + + + Wire1Config + + + + 0 + 0 + 360 + 150 + + + + + 360 + 150 + + + + + 360 + 150 + + + + Dialog + + + + + 10 + 100 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 120 + 40 + 151 + 20 + + + + + + + 40 + 40 + 84 + 16 + + + + 1-Wire + + + + + + + buttonBox + accepted() + Wire1Config + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Wire1Config + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/DSLogic-gui/pv/devicemanager.cpp b/DSLogic-gui/pv/devicemanager.cpp new file mode 100644 index 00000000..4a17ca95 --- /dev/null +++ b/DSLogic-gui/pv/devicemanager.cpp @@ -0,0 +1,228 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "devicemanager.h" +#include "sigsession.h" + +#include +#include +#include +#include + +#include +#include + +#include + +using namespace std; + +namespace pv { + +DeviceManager::DeviceManager(struct sr_context *sr_ctx) : + _sr_ctx(sr_ctx) +{ + init_drivers(); + scan_all_drivers(); +} + +DeviceManager::~DeviceManager() +{ + release_devices(); +} + +const std::list& DeviceManager::devices() const +{ + return _devices; +} + +int DeviceManager::use_device(sr_dev_inst *sdi, SigSession *owner) +{ + assert(sdi); + assert(owner); + + if (sr_dev_open(sdi) != SR_OK) + return SR_ERR; + + _used_devices[sdi] = owner; + return SR_OK; +} + +void DeviceManager::release_device(sr_dev_inst *sdi) +{ + assert(sdi); + + // Notify the owner, and removed the device from the used device list + _used_devices[sdi]->release_device(sdi); + _used_devices.erase(sdi); + + sr_dev_close(sdi); +} + +list DeviceManager::driver_scan( + struct sr_dev_driver *const driver, GSList *const drvopts) +{ + list driver_devices; + + assert(driver); + + // Remove any device instances from this driver from the device + // list. They will not be valid after the scan. + list::iterator i = _devices.begin(); + while (i != _devices.end()) { + if ((*i)->driver == driver) + i = _devices.erase(i); + else + i++; + } + + // Release this driver and all it's attached devices + release_driver(driver); + + // Do the scan + GSList *const devices = sr_driver_scan(driver, drvopts); + for (GSList *l = devices; l; l = l->next) + driver_devices.push_back((sr_dev_inst*)l->data); + g_slist_free(devices); + driver_devices.sort(compare_devices); + + // Add the scanned devices to the main list + _devices.insert(_devices.end(), driver_devices.begin(), + driver_devices.end()); + _devices.sort(compare_devices); + + return driver_devices; +} + +string DeviceManager::format_device_title(const sr_dev_inst *const sdi) +{ + ostringstream s; + + assert(sdi); + + if (sdi->vendor && sdi->vendor[0]) { + s << sdi->vendor; + if ((sdi->model && sdi->model[0]) || + (sdi->version && sdi->version[0])) + s << ' '; + } + + if (sdi->model && sdi->model[0]) { + s << sdi->model; + if (sdi->version && sdi->version[0]) + s << ' '; + } + + if (sdi->version && sdi->version[0]) + s << sdi->version; + + return s.str(); +} + +void DeviceManager::init_drivers() +{ + // Initialise all libsigrok drivers + sr_dev_driver **const drivers = sr_driver_list(); + for (sr_dev_driver **driver = drivers; *driver; driver++) { + if (sr_driver_init(_sr_ctx, *driver) != SR_OK) { + throw runtime_error( + string("Failed to initialize driver ") + + string((*driver)->name)); + } + } +} + +void DeviceManager::release_devices() +{ + // Release all the used devices + for (map::iterator i = _used_devices.begin(); + i != _used_devices.end();) + release_device((*i++).first); + + _used_devices.clear(); + + // Clear all the drivers + sr_dev_driver **const drivers = sr_driver_list(); + for (sr_dev_driver **driver = drivers; *driver; driver++) + sr_dev_clear(*driver); +} + +void DeviceManager::scan_all_drivers() +{ + // Scan all drivers for all devices. + struct sr_dev_driver **const drivers = sr_driver_list(); + for (struct sr_dev_driver **driver = drivers; *driver; driver++) + driver_scan(*driver); +} + +void DeviceManager::release_driver(struct sr_dev_driver *const driver) +{ + assert(driver); +// map::iterator i = _used_devices.begin(); +// while(i != _used_devices.end()) { +// if((*i).first->driver == driver) +// { +// // Notify the current owner of the device +// (*i).second->release_device((*i).first); + +// // Close the device instance +// sr_dev_close((*i).first); + +// // Remove it from the used device list +// i = _used_devices.erase(i); +// } else { +// i++; +// } +// } + for (map::iterator i = _used_devices.begin(); + i != _used_devices.end();) + if((*i).first->driver == driver) + { + // Notify the current owner of the device + (*i).second->release_device((*i).first); + + // Close the device instance + sr_dev_close((*i).first); + + // Remove it from the used device list + _used_devices.erase(i++); + } else { + i++; + } + + // Clear all the old device instances from this driver + sr_dev_clear(driver); +} + +bool DeviceManager::compare_devices(const sr_dev_inst *const a, + const sr_dev_inst *const b) +{ + return format_device_title(a).compare(format_device_title(b)) < 0; +} + +int DeviceManager::test_device(sr_dev_inst *sdi) +{ + assert(sdi); + return sdi->driver->dev_test(sdi); +} + +} // namespace pv diff --git a/DSLogic-gui/pv/devicemanager.h b/DSLogic-gui/pv/devicemanager.h new file mode 100644 index 00000000..0fc63963 --- /dev/null +++ b/DSLogic-gui/pv/devicemanager.h @@ -0,0 +1,91 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_DEVICEMANAGER_H +#define DSLOGIC_PV_DEVICEMANAGER_H + +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include + +struct sr_context; +struct sr_dev_driver; +struct sr_dev_inst; +struct libusbhp_t; +struct libusbhp_device_t; + +namespace pv { + +class SigSession; + +class DeviceManager +{ +public: + DeviceManager(struct sr_context *sr_ctx); + + ~DeviceManager(); + + const std::list& devices() const; + + int use_device(sr_dev_inst *sdi, SigSession *owner); + + void release_device(sr_dev_inst *sdi); + + std::list driver_scan( + struct sr_dev_driver *const driver, + GSList *const drvopts = NULL); + + static std::string format_device_title(const sr_dev_inst *const sdi); + + void scan_all_drivers(); + + int test_device(sr_dev_inst *sdi); + +private: + void init_drivers(); + + void release_devices(); + + void release_driver(struct sr_dev_driver *const driver); + + static bool compare_devices(const sr_dev_inst *const a, + const sr_dev_inst *const b); + +private: + struct sr_context *const _sr_ctx; + std::list _devices; + std::map _used_devices; +}; + +} // namespace pv + +#endif // DSLOGIC_PV_DEVICEMANAGER_H diff --git a/DSLogic-gui/pv/dialogs/about.cpp b/DSLogic-gui/pv/dialogs/about.cpp new file mode 100644 index 00000000..a46b24bf --- /dev/null +++ b/DSLogic-gui/pv/dialogs/about.cpp @@ -0,0 +1,58 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include + +#include "about.h" +#include + +/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */ +#define __STDC_FORMAT_MACROS +#include +#include + + +namespace pv { +namespace dialogs { + +About::About(QWidget *parent) : + QDialog(parent), + ui(new Ui::About) +{ + ui->setupUi(this); + + /* Setup the version field */ + ui->versionInfo->setText(tr("%1 %2
%4") + .arg(QApplication::applicationName()) + .arg(QApplication::applicationVersion()) + .arg(QApplication::organizationDomain())); + ui->versionInfo->setOpenExternalLinks(true); +} + +About::~About() +{ + delete ui; +} + +} // namespace dialogs +} // namespace pv diff --git a/DSLogic-gui/pv/dialogs/about.h b/DSLogic-gui/pv/dialogs/about.h new file mode 100644 index 00000000..49b5fbdc --- /dev/null +++ b/DSLogic-gui/pv/dialogs/about.h @@ -0,0 +1,53 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_ABOUT_H +#define DSLOGIC_PV_ABOUT_H + +#include + +#include + +namespace Ui { +class About; +} + +namespace pv { +namespace dialogs { + +class About : public QDialog +{ + Q_OBJECT + +public: + explicit About(QWidget *parent = 0); + ~About(); + +private: + Ui::About *ui; +}; + +} // namespace dialogs +} // namespace pv + +#endif // DSLOGIC_PV_ABOUT_H diff --git a/DSLogic-gui/pv/dialogs/about.ui b/DSLogic-gui/pv/dialogs/about.ui new file mode 100644 index 00000000..5c1c7adb --- /dev/null +++ b/DSLogic-gui/pv/dialogs/about.ui @@ -0,0 +1,62 @@ + + + About + + + Qt::WindowModal + + + + 0 + 0 + 600 + 320 + + + + + 600 + 320 + + + + About + + + + + + + + + + + + + + :/icons/dsl_logo.png + + + Qt::AlignCenter + + + + + + + + + + Qt::AlignCenter + + + + + + + + + + + + diff --git a/DSLogic-gui/pv/dialogs/connect.cpp b/DSLogic-gui/pv/dialogs/connect.cpp new file mode 100644 index 00000000..f4cffbca --- /dev/null +++ b/DSLogic-gui/pv/dialogs/connect.cpp @@ -0,0 +1,223 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include + +#include "connect.h" + +#include "pv/devicemanager.h" + +extern "C" { +/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */ +#define __STDC_FORMAT_MACROS +#include +#include +} + +using namespace std; + +extern sr_context *sr_ctx; + +namespace pv { +namespace dialogs { + +Connect::Connect(QWidget *parent, pv::DeviceManager &device_manager) : + QDialog(parent), + _device_manager(device_manager), + _layout(this), + _form(this), + _form_layout(&_form), + _drivers(&_form), + _serial_device(&_form), + _scan_button(tr("Scan for Devices"), this), + _device_list(this), + _button_box(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, + Qt::Horizontal, this) +{ + setWindowTitle(tr("Connect to Device")); + + connect(&_button_box, SIGNAL(accepted()), this, SLOT(accept())); + connect(&_button_box, SIGNAL(rejected()), this, SLOT(reject())); + + populate_drivers(); + connect(&_drivers, SIGNAL(activated(int)), + this, SLOT(device_selected(int))); + + _form.setLayout(&_form_layout); + _form_layout.addRow(tr("Driver"), &_drivers); + + _form_layout.addRow(tr("Serial Port"), &_serial_device); + + unset_connection(); + + connect(&_scan_button, SIGNAL(pressed()), + this, SLOT(scan_pressed())); + + setLayout(&_layout); + _layout.addWidget(&_form); + _layout.addWidget(&_scan_button); + _layout.addWidget(&_device_list); + _layout.addWidget(&_button_box); +} + +struct sr_dev_inst* Connect::get_selected_device() const +{ + const QListWidgetItem *const item = _device_list.currentItem(); + if (!item) + return NULL; + + return (sr_dev_inst*)item->data(Qt::UserRole).value(); +} + +void Connect::populate_drivers() +{ + gsize num_opts = 0; + const int32_t *hwopts; + struct sr_dev_driver **drivers = sr_driver_list(); + GVariant *gvar_opts; + + for (int i = 0; drivers[i]; ++i) { + /** + * We currently only support devices that can deliver + * samples at a fixed samplerate i.e. oscilloscopes and + * logic analysers. + * @todo Add support for non-monotonic devices i.e. DMMs + * and sensors. + */ + bool supported_device = false; + if ((sr_config_list(drivers[i], SR_CONF_DEVICE_OPTIONS, + &gvar_opts, NULL) == SR_OK)) { + hwopts = (const int32_t *)g_variant_get_fixed_array(gvar_opts, + &num_opts, sizeof(int32_t)); + for (unsigned int j = 0; j < num_opts; j++) + if (hwopts[j] == SR_CONF_SAMPLERATE) { + supported_device = true; + break; + } + } + + if (supported_device) + _drivers.addItem(QString("%1 (%2)").arg( + drivers[i]->longname).arg(drivers[i]->name), + qVariantFromValue((void*)drivers[i])); + } +} + +void Connect::unset_connection() +{ + _device_list.clear(); + _serial_device.hide(); + _form_layout.labelForField(&_serial_device)->hide(); + _button_box.button(QDialogButtonBox::Ok)->setDisabled(true); +} + +void Connect::set_serial_connection() +{ + _serial_device.show(); + _form_layout.labelForField(&_serial_device)->show(); +} + +void Connect::scan_pressed() +{ + _device_list.clear(); + + const int index = _drivers.currentIndex(); + if (index == -1) + return; + + sr_dev_driver *const driver = (sr_dev_driver*)_drivers.itemData( + index).value(); + + GSList *drvopts = NULL; + + if (_serial_device.isVisible()) { + sr_config *const src = (sr_config*)g_try_malloc(sizeof(sr_config)); + src->key = SR_CONF_CONN; + const QByteArray byteArray = _serial_device.text().toUtf8(); + src->data = g_variant_new_string((const gchar*)byteArray.constData()); + drvopts = g_slist_append(drvopts, src); + } + + const list devices = _device_manager.driver_scan( + driver, drvopts); + + g_slist_free_full(drvopts, (GDestroyNotify)free_drvopts); + + BOOST_FOREACH(sr_dev_inst *const sdi, devices) + { + const string title = DeviceManager::format_device_title(sdi); + QString text(title.c_str()); + if (sdi->probes) { + text += QString(" with %1 probes").arg( + g_slist_length(sdi->probes)); + } + + QListWidgetItem *const item = new QListWidgetItem(text, + &_device_list); + item->setData(Qt::UserRole, qVariantFromValue((void*)sdi)); + _device_list.addItem(item); + } + + _device_list.setCurrentRow(0); + _button_box.button(QDialogButtonBox::Ok)->setDisabled(false); +} + +void Connect::device_selected(int index) +{ + gsize num_opts = 0; + const int32_t *hwopts; + GVariant *gvar_list; + sr_dev_driver *const driver = (sr_dev_driver*)_drivers.itemData( + index).value(); + + unset_connection(); + + if ((sr_config_list(driver, SR_CONF_SCAN_OPTIONS, + &gvar_list, NULL) == SR_OK)) { + hwopts = (const int32_t *)g_variant_get_fixed_array(gvar_list, + &num_opts, sizeof(int32_t)); + + for (unsigned int i = 0; i < num_opts; i++) { + switch(hwopts[i]) { + case SR_CONF_SERIALCOMM: + set_serial_connection(); + break; + + default: + continue; + } + + break; + } + g_variant_unref(gvar_list); + } +} + +void Connect::free_drvopts(struct sr_config *src) +{ + g_variant_unref(src->data); + g_free(src); +} + +} // namespace dialogs +} // namespace pv diff --git a/DSLogic-gui/pv/dialogs/connect.h b/DSLogic-gui/pv/dialogs/connect.h new file mode 100644 index 00000000..7de68283 --- /dev/null +++ b/DSLogic-gui/pv/dialogs/connect.h @@ -0,0 +1,90 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_CONNECT_H +#define DSLOGIC_PV_CONNECT_H + +#include +#include +#include +#include +#include +#include +#include +#include + +struct sr_config; +struct sr_dev_inst; + +namespace pv { + +class DeviceManager; + +namespace dialogs { + +class Connect : public QDialog +{ + Q_OBJECT + +public: + Connect(QWidget *parent, pv::DeviceManager &device_manager); + + struct sr_dev_inst* get_selected_device() const; + +private: + void populate_drivers(); + + void unset_connection(); + + void set_serial_connection(); + +private slots: + void device_selected(int index); + + void scan_pressed(); + +private: + static void free_drvopts(sr_config *src); + +private: + pv::DeviceManager &_device_manager; + + QVBoxLayout _layout; + + QWidget _form; + QFormLayout _form_layout; + + QComboBox _drivers; + + QLineEdit _serial_device; + + QPushButton _scan_button; + QListWidget _device_list; + + QDialogButtonBox _button_box; +}; + +} // namespace dialogs +} // namespace pv + +#endif // DSLOGIC_PV_CONNECT_H diff --git a/DSLogic-gui/pv/dialogs/deviceoptions.cpp b/DSLogic-gui/pv/dialogs/deviceoptions.cpp new file mode 100644 index 00000000..75023c33 --- /dev/null +++ b/DSLogic-gui/pv/dialogs/deviceoptions.cpp @@ -0,0 +1,190 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "deviceoptions.h" + +#include + +#include +#include + +#include + +using namespace boost; +using namespace std; + +namespace pv { +namespace dialogs { + +DeviceOptions::DeviceOptions(QWidget *parent, struct sr_dev_inst *sdi) : + QDialog(parent), + _sdi(sdi), + _layout(this), + _probes_box(tr("Channels"), this), + _props_box(tr("Mode"), this), + _mode_comboBox(this), + _button_box(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, + Qt::Horizontal, this), + _device_options_binding(sdi) +{ + setWindowTitle(tr("Configure Device")); + setLayout(&_layout); + + _mode_comboBox.addItem(mode_strings[LOGIC]); + _mode_comboBox.addItem(mode_strings[ANALOG]); + _mode_comboBox.setCurrentIndex(_sdi->mode); + _props_box.setLayout(&_props_box_layout); + _props_box_layout.addWidget(get_property_form()); + _layout.addWidget(&_props_box); + + setup_probes(); + _probes_box.setLayout(&_probes_box_layout); + + _layout.addWidget(&_probes_box); + _layout.addStretch(1); + _layout.addWidget(&_button_box); + + connect(&_button_box, SIGNAL(accepted()), this, SLOT(accept())); + connect(&_button_box, SIGNAL(rejected()), this, SLOT(reject())); + + connect(&_mode_comboBox, SIGNAL(currentIndexChanged(QString)), + this, SLOT(mode_changed(QString))); +} + +void DeviceOptions::accept() +{ + using namespace Qt; + + QDialog::accept(); + + // Commit the properties + const vector< shared_ptr > &properties = + _device_options_binding.properties(); + BOOST_FOREACH(shared_ptr p, properties) { + assert(p); + p->commit(); + } + + // Commit the probes + int index = 0; + for (const GSList *l = _sdi->probes; l; l = l->next) { + sr_probe *const probe = (sr_probe*)l->data; + assert(probe); + + probe->enabled = (_probes_checkBox_list.at(index)->checkState() == Qt::Checked); + index++; + } +} + +QWidget* DeviceOptions::get_property_form() +{ + QWidget *const form = new QWidget(this); + QFormLayout *const layout = new QFormLayout(form); + form->setLayout(layout); + + layout->addRow("Device Mode", &_mode_comboBox); + const vector< shared_ptr > &properties = + _device_options_binding.properties(); + BOOST_FOREACH(shared_ptr p, properties) + { + assert(p); + const QString label = p->labeled_widget() ? QString() : p->name(); + layout->addRow(label, p->get_widget(form)); + } + + return form; +} + +void DeviceOptions::setup_probes() +{ + using namespace Qt; + + int row = 0, col = 0; + int index = 0; + + while(_probes_box_layout.count() > 0) + { + //remove Widgets in QLayoutGrid + QWidget* widget = _probes_box_layout.itemAt(0)->widget(); + _probes_box_layout.removeWidget(widget); + delete widget; + } + _probes_label_list.clear(); + _probes_checkBox_list.clear(); + + for (const GSList *l = _sdi->probes; l; l = l->next) { + sr_probe *const probe = (sr_probe*)l->data; + assert(probe); + + QLabel *probe_label = new QLabel(QString::number(probe->index), this); + QCheckBox *probe_checkBox = new QCheckBox(this); + probe_checkBox->setCheckState(probe->enabled ? Qt::Checked : Qt::Unchecked); + _probes_box_layout.addWidget(probe_label, row * 2, col); + _probes_box_layout.addWidget(probe_checkBox, row * 2 + 1, col); + _probes_label_list.push_back(probe_label); + _probes_checkBox_list.push_back(probe_checkBox); + + index++; + col = index % 8; + row = index / 8; + } + + QPushButton *_enable_all_probes = new QPushButton("Enable All", this); + QPushButton *_disable_all_probes = new QPushButton("Disable All", this); + + connect(_enable_all_probes, SIGNAL(clicked()), + this, SLOT(enable_all_probes())); + connect(_disable_all_probes, SIGNAL(clicked()), + this, SLOT(disable_all_probes())); + + _probes_box_layout.addWidget(_enable_all_probes, (row + 1) * 2, 0, 1, 4); + _probes_box_layout.addWidget(_disable_all_probes, (row + 1) * 2, 4, 1, 4); +} + +void DeviceOptions::set_all_probes(bool set) +{ + QVector::iterator i = _probes_checkBox_list.begin(); + while(i != _probes_checkBox_list.end()) { + (*i)->setCheckState(set ? Qt::Checked : Qt::Unchecked); + i++; + } +} + +void DeviceOptions::enable_all_probes() +{ + set_all_probes(true); +} + +void DeviceOptions::disable_all_probes() +{ + set_all_probes(false); +} + +void DeviceOptions::mode_changed(QString mode) +{ + sr_config_set(_sdi, SR_CONF_DEVICE_MODE, g_variant_new_string(mode.toLocal8Bit())); + setup_probes(); +} + +} // namespace dialogs +} // namespace pv diff --git a/DSLogic-gui/pv/dialogs/deviceoptions.h b/DSLogic-gui/pv/dialogs/deviceoptions.h new file mode 100644 index 00000000..2ee2534a --- /dev/null +++ b/DSLogic-gui/pv/dialogs/deviceoptions.h @@ -0,0 +1,90 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_DEVICEOPTIONS_H +#define DSLOGIC_PV_DEVICEOPTIONS_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace pv { +namespace dialogs { + +class DeviceOptions : public QDialog +{ + Q_OBJECT + +public: + DeviceOptions(QWidget *parent, struct sr_dev_inst *sdi); + +protected: + void accept(); + +private: + + QWidget* get_property_form(); + + void setup_probes(); + + void set_all_probes(bool set); + +private slots: + void enable_all_probes(); + void disable_all_probes(); + void mode_changed(QString mode); + +private: + struct sr_dev_inst *const _sdi; + + QVBoxLayout _layout; + + QGroupBox _probes_box; + QGridLayout _probes_box_layout; + QVector _probes_label_list; + QVector _probes_checkBox_list; + + QGroupBox _props_box; + QComboBox _mode_comboBox; + QVBoxLayout _props_box_layout; + + QDialogButtonBox _button_box; + + pv::prop::binding::DeviceOptions _device_options_binding; +}; + +} // namespace dialogs +} // namespace pv + +#endif // DSLOGIC_PV_DEVICEOPTIONS_H diff --git a/DSLogic-gui/pv/dialogs/search.cpp b/DSLogic-gui/pv/dialogs/search.cpp new file mode 100644 index 00000000..50c15c9d --- /dev/null +++ b/DSLogic-gui/pv/dialogs/search.cpp @@ -0,0 +1,69 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "search.h" +#include "ui_search.h" +#include + +namespace pv { +namespace dialogs { + +Search::Search(QWidget *parent, struct sr_dev_inst *sdi, QString pattern) : + QDialog(parent), + ui(new Ui::Search), + _sdi(sdi) +{ + assert(_sdi); + ui->setupUi(this); + + QRegExp value_rx("[10XRFCxrfc ]+"); + QValidator *value_validator = new QRegExpValidator(value_rx, this); + + //ui->_value_lineEdit->setText("X X X X X X X X X X X X X X X X"); + ui->_value_lineEdit->setText(pattern); + ui->_value_lineEdit->setValidator(value_validator); + ui->_value_lineEdit->setMaxLength(16 * 2 - 1); + ui->_value_lineEdit->setInputMask("X X X X X X X X X X X X X X X X"); +} + +Search::~Search() +{ + delete ui; +} + +void Search::accept() +{ + using namespace Qt; + + QDialog::accept(); +} + +QString Search::get_pattern() +{ + QString pattern = ui->_value_lineEdit->text(); + //pattern.remove(QChar('/r'), Qt::CaseInsensitive); + return pattern; +} + +} // namespace decoder +} // namespace pv diff --git a/DSLogic-gui/pv/dialogs/search.h b/DSLogic-gui/pv/dialogs/search.h new file mode 100644 index 00000000..a4dea4cc --- /dev/null +++ b/DSLogic-gui/pv/dialogs/search.h @@ -0,0 +1,66 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_SEARCH_H +#define DSLOGIC_PV_SEARCH_H + +#include +#include +#include +#include "../sigsession.h" +#include + +namespace Ui { +class Search; +} + +namespace pv { +namespace dialogs { + +class Search : public QDialog +{ + Q_OBJECT + +public: + + Search(QWidget *parent = 0, sr_dev_inst *sdi = 0, QString pattern = ""); + ~Search(); + + QString get_pattern(); + +protected: + void accept(); + +signals: + +public slots: + +private: + Ui::Search *ui; + sr_dev_inst *_sdi; +}; + +} // namespace decoder +} // namespace pv + +#endif // DSLOGIC_PV_SEARCH_H diff --git a/DSLogic-gui/pv/dialogs/search.ui b/DSLogic-gui/pv/dialogs/search.ui new file mode 100644 index 00000000..5737b703 --- /dev/null +++ b/DSLogic-gui/pv/dialogs/search.ui @@ -0,0 +1,166 @@ + + + Search + + + + 0 + 0 + 486 + 231 + + + + Search + + + + + 130 + 180 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 40 + 20 + 351 + 204 + + + + + 16 + + + 16 + + + + + + + + Search Value + + + + + + + 6 + + + + + X: Don't care + + + + + + + 0: Low level + + + + + + + 1: High level + + + + + + + R: Rising edge + + + + + + + F: Falling edge + + + + + + + C: Rising/Falling edge + + + + + + + + + 0 + + + + + 1 1 1 1 1 1 + + + + + + + 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 + + + + + + + + + + + + buttonBox + accepted() + Search + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Search + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/DSLogic-gui/pv/dialogs/trig.ui b/DSLogic-gui/pv/dialogs/trig.ui new file mode 100644 index 00000000..ce388938 --- /dev/null +++ b/DSLogic-gui/pv/dialogs/trig.ui @@ -0,0 +1,91 @@ + + + Trig + + + + 0 + 0 + 597 + 481 + + + + Dialog + + + + + 230 + 390 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 40 + 40 + 411 + 21 + + + + Qt::Horizontal + + + + Trigger Positon: + + + + + Qt::Horizontal + + + + + + + + buttonBox + accepted() + Trig + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Trig + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/DSLogic-gui/pv/dock/fakelineedit.cpp b/DSLogic-gui/pv/dock/fakelineedit.cpp new file mode 100644 index 00000000..98c90c4c --- /dev/null +++ b/DSLogic-gui/pv/dock/fakelineedit.cpp @@ -0,0 +1,42 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "fakelineedit.h" +#include + +namespace pv { +namespace dock { + +FakeLineEdit::FakeLineEdit(QLineEdit *parent) : + QLineEdit(parent) +{ +} + +void FakeLineEdit::mousePressEvent(QMouseEvent *event) +{ + if (event->button() & Qt::LeftButton) { + trigger(); + } +} + +} // namespace dock +} // namespace pv diff --git a/DSLogic-gui/pv/dock/fakelineedit.h b/DSLogic-gui/pv/dock/fakelineedit.h new file mode 100644 index 00000000..fda3156a --- /dev/null +++ b/DSLogic-gui/pv/dock/fakelineedit.h @@ -0,0 +1,53 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef FAKELINEEDIT_H +#define FAKELINEEDIT_H + +#include + +namespace pv { + +class SigSession; + +namespace dock { + +class FakeLineEdit : public QLineEdit +{ + Q_OBJECT +public: + explicit FakeLineEdit(QLineEdit *parent = 0); + +private: + void mousePressEvent(QMouseEvent * event); + +signals: + void trigger(); + +public slots: + +}; + +} // namespace dock +} // namespace pv + +#endif // FAKELINEEDIT_H diff --git a/DSLogic-gui/pv/dock/measuredock.cpp b/DSLogic-gui/pv/dock/measuredock.cpp new file mode 100644 index 00000000..e2ab59d0 --- /dev/null +++ b/DSLogic-gui/pv/dock/measuredock.cpp @@ -0,0 +1,237 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "measuredock.h" +#include "../sigsession.h" +#include "../view/cursor.h" +#include "../view/view.h" +#include "../view/timemarker.h" +#include "../view/ruler.h" + +#include +#include +#include + +namespace pv { +namespace dock { + +using namespace pv::view; + +MeasureDock::MeasureDock(QWidget *parent, View &view, SigSession &session) : + QWidget(parent), + _session(session), + _view(view) +{ + + _mouse_groupBox = new QGroupBox("Mouse measurement", this); + _fen_checkBox = new QCheckBox("Enable floating measurement", this); + _fen_checkBox->setChecked(true); + _width_label = new QLabel(view.get_mm_width(), this); + _period_label = new QLabel(view.get_mm_period(), this); + _freq_label = new QLabel(view.get_mm_freq(), this); + + _mouse_layout = new QGridLayout(); + _mouse_layout->addWidget(_fen_checkBox, 0, 0, 1, 2); + _mouse_layout->addWidget(new QLabel("Width: ", this), 1, 0); + _mouse_layout->addWidget(_width_label, 1, 1); + _mouse_layout->addWidget(new QLabel("Period: ", this), 2, 0); + _mouse_layout->addWidget(_period_label, 2, 1); + _mouse_layout->addWidget(new QLabel("Freqency: ", this), 3, 0); + _mouse_layout->addWidget(_freq_label, 3, 1); + _mouse_layout->addWidget(new QLabel(this), 0, 2); + _mouse_layout->addWidget(new QLabel(this), 1, 2); + _mouse_layout->addWidget(new QLabel(this), 2, 2); + _mouse_layout->addWidget(new QLabel(this), 3, 2); + _mouse_layout->setColumnStretch(2, 1); + _mouse_groupBox->setLayout(_mouse_layout); + + + _cursor_groupBox = new QGroupBox("Cursor measurement", this); + _t1_comboBox = new QComboBox(this); + _t2_comboBox = new QComboBox(this); + _delta_label = new QLabel("#####", this); + _cnt_label = new QLabel("#####", this); + + _cursor_layout = new QGridLayout(); + _cursor_layout->addWidget(new QLabel("T1: ", this), 0, 0); + _cursor_layout->addWidget(_t1_comboBox, 0, 1); + _cursor_layout->addWidget(new QLabel("T2: ", this), 1, 0); + _cursor_layout->addWidget(_t2_comboBox, 1, 1); + _cursor_layout->addWidget(new QLabel("|T2 - T1|: ", this), 2, 0); + _cursor_layout->addWidget(_delta_label, 2, 1); + _cursor_layout->addWidget(new QLabel("Delta Samples: ", this), 2, 2); + _cursor_layout->addWidget(_cnt_label, 2, 3); + + _cursor_layout->addWidget(new QLabel("Cursors", this), 4, 0); + _cursor_layout->addWidget(new QLabel("Time/Samples", this), 4, 1); + _cursor_layout->addWidget(new QLabel("Sample Value", this), 4, 2); + _cursor_layout->addWidget(new QLabel("Value Radix", this), 4, 3); + + _cursor_layout->addWidget(new QLabel(this), 0, 4); + _cursor_layout->addWidget(new QLabel(this), 1, 4); + _cursor_layout->addWidget(new QLabel(this), 2, 4); + _cursor_layout->addWidget(new QLabel(this), 3, 4); + _cursor_layout->addWidget(new QLabel(this), 4, 4); + + _cursor_layout->setColumnStretch(4, 1); + _cursor_groupBox->setLayout(_cursor_layout); + + QVBoxLayout *layout = new QVBoxLayout(this); + layout->addWidget(_mouse_groupBox); + layout->addWidget(_cursor_groupBox); + layout->addStretch(1); + setLayout(layout); + + connect(_t1_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(delta_update())); + connect(_t2_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(delta_update())); + + connect(_fen_checkBox, SIGNAL(stateChanged(int)), &_view, SLOT(set_measure_en(int))); +} + +MeasureDock::~MeasureDock() +{ +} + +void MeasureDock::paintEvent(QPaintEvent *) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} + +void MeasureDock::cursor_update() +{ + int index = 1; + + _t1_comboBox->clear(); + _t2_comboBox->clear(); + + if (!_cursor_pushButton_list.empty()) { + for (QVector::Iterator i = _cursor_pushButton_list.begin(); + i != _cursor_pushButton_list.end(); i++) + delete (*i); + for (QVector::Iterator i = _curpos_label_list.begin(); + i != _curpos_label_list.end(); i++) + delete (*i); + for (QVector::Iterator i = _curvalue_label_list.begin(); + i != _curvalue_label_list.end(); i++) + delete (*i); + for (QVector::Iterator i = _radix_comboBox_list.begin(); + i != _radix_comboBox_list.end(); i++) + delete (*i); + for (QVector::Iterator i = _space_label_list.begin(); + i != _space_label_list.end(); i++) + delete (*i); + + _cursor_pushButton_list.clear(); + _curpos_label_list.clear(); + _curvalue_label_list.clear(); + _radix_comboBox_list.clear(); + _space_label_list.clear(); + } + + for(std::list::iterator i = _view.get_cursorList().begin(); + i != _view.get_cursorList().end(); i++) { + QString curCursor = "Cursor "+QString::number(index); + _t1_comboBox->addItem(curCursor); + _t2_comboBox->addItem(curCursor); + + QPushButton *_cursor_pushButton = new QPushButton(curCursor, this); + QLabel *_curpos_label = new QLabel(_view.get_cm_time(index - 1), this); + QLabel *_curvalue_label = new QLabel("####", this); + QComboBox *_radix_comboBox = new QComboBox(this); + _radix_comboBox->addItem("Bin"); + _radix_comboBox->addItem("Oct"); + _radix_comboBox->addItem("Dec"); + _radix_comboBox->addItem("Hex"); + QLabel *_space_label = new QLabel(this); + _cursor_pushButton_list.push_back(_cursor_pushButton); + _curpos_label_list.push_back(_curpos_label); + _curvalue_label_list.push_back(_curvalue_label); + _radix_comboBox_list.push_back(_radix_comboBox); + _space_label_list.push_back(_space_label); + + _cursor_layout->addWidget(_cursor_pushButton, 4 + index, 0); + _cursor_layout->addWidget(_curpos_label, 4 + index, 1); + _cursor_layout->addWidget(_curvalue_label, 4 + index, 2); + _cursor_layout->addWidget(_radix_comboBox, 4 + index, 3); + _cursor_layout->addWidget(_space_label, 4 + index, 4); + + connect(_cursor_pushButton, SIGNAL(clicked()), this, SLOT(goto_cursor())); + + index++; + } + + update(); +} + +void MeasureDock::mouse_moved() +{ + _width_label->setText(_view.get_mm_width()); + _period_label->setText(_view.get_mm_period()); + _freq_label->setText(_view.get_mm_freq()); +} + +void MeasureDock::cursor_moved() +{ + //TimeMarker* grabbed_marker = _view.get_ruler()->get_grabbed_cursor(); + if (_view.cursors_shown()) { + int index = 0; + for(std::list::iterator i = _view.get_cursorList().begin(); + i != _view.get_cursorList().end(); i++) { + _curpos_label_list.at(index)->setText(_view.get_cm_time(index)); + //_curvalue_label_list.at(index)->setText(_view.get_cm_value(index)); + index++; + } + } + delta_update(); +} + +void MeasureDock::delta_update() +{ + if (_t1_comboBox->count() != 0 && _t2_comboBox->count() != 0) { + int t1_index = _t1_comboBox->currentIndex(); + int t2_index = _t2_comboBox->currentIndex(); + _delta_label->setText(_view.get_cm_delta(t1_index, t2_index)); + _cnt_label->setText(_view.get_cm_delta_cnt(t1_index, t2_index)); + } +} + +void MeasureDock::goto_cursor() +{ + int index = 0; + + for (QVector::Iterator i = _cursor_pushButton_list.begin(); + i != _cursor_pushButton_list.end(); i++) { + QPushButton *button = qobject_cast(sender()); + if ((*i) == button) { + _view.set_cursor_middle(index); + break; + } + index++; + } +} + +} // namespace dock +} // namespace pv diff --git a/DSLogic-gui/pv/dock/measuredock.h b/DSLogic-gui/pv/dock/measuredock.h new file mode 100644 index 00000000..738de43f --- /dev/null +++ b/DSLogic-gui/pv/dock/measuredock.h @@ -0,0 +1,107 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_MEASUREDOCK_H +#define DSLOGIC_PV_MEASUREDOCK_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include + +namespace pv { + +class SigSession; + +namespace view { + class View; +} + +namespace dock { + +class MeasureDock : public QWidget +{ + Q_OBJECT + +public: + MeasureDock(QWidget *parent, pv::view::View &view, SigSession &session); + ~MeasureDock(); + + void paintEvent(QPaintEvent *); + +signals: + +private slots: + void delta_update(); + void goto_cursor(); + +public slots: + void cursor_update(); + void cursor_moved(); + void mouse_moved(); + +private: + SigSession &_session; + view::View &_view; + + QGridLayout *_mouse_layout; + QGroupBox *_mouse_groupBox; + QCheckBox *_fen_checkBox; + QLabel *_width_label; + QLabel *_period_label; + QLabel *_freq_label; + + QGridLayout *_cursor_layout; + QGroupBox *_cursor_groupBox; + QComboBox *_t1_comboBox; + QComboBox *_t2_comboBox; + QLabel *_delta_label; + QLabel *_cnt_label; + + QVector _cursor_pushButton_list; + QVector _curpos_label_list; + QVector _curvalue_label_list; + QVector _radix_comboBox_list; + QVector _space_label_list; +}; + +} // namespace dock +} // namespace pv + +#endif // DSLOGIC_PV_MEASUREDOCK_H diff --git a/DSLogic-gui/pv/dock/protocoldock.cpp b/DSLogic-gui/pv/dock/protocoldock.cpp new file mode 100644 index 00000000..ed8c5729 --- /dev/null +++ b/DSLogic-gui/pv/dock/protocoldock.cpp @@ -0,0 +1,240 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "protocoldock.h" +#include "../decoder/democonfig.h" +#include "../sigsession.h" + +#include +#include +#include +#include + +namespace pv { +namespace dock { + +ProtocolDock::ProtocolDock(QWidget *parent, SigSession &session) : + QWidget(parent), + _session(session) +{ + QHBoxLayout *hori_layout = new QHBoxLayout(); + + _add_button = new QPushButton(this); + _add_button->setFlat(true); + _add_button->setIcon(QIcon::fromTheme("protocol", + QIcon(":/icons/add.png"))); + _del_all_button = new QPushButton(this); + _del_all_button->setFlat(true); + _del_all_button->setIcon(QIcon::fromTheme("protocol", + QIcon(":/icons/del.png"))); + _del_all_button->setCheckable(true); + _protocol_combobox = new QComboBox(this); + for (int i = 0; decoder::protocol_list[i] != NULL;) { + _protocol_combobox->addItem(decoder::protocol_list[i]); + i++; + } + hori_layout->addWidget(_add_button); + hori_layout->addWidget(_del_all_button); + hori_layout->addWidget(_protocol_combobox); + hori_layout->addStretch(1); + + connect(_add_button, SIGNAL(clicked()), + this, SLOT(add_protocol())); + connect(_del_all_button, SIGNAL(clicked()), + this, SLOT(del_protocol())); + + _layout = new QVBoxLayout(); + _layout->addLayout(hori_layout); + _layout->addStretch(1); + + setLayout(_layout); +} + +ProtocolDock::~ProtocolDock() +{ +} + +void ProtocolDock::paintEvent(QPaintEvent *) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} + +void ProtocolDock::add_protocol() +{ + if (_session.get_device()->mode != LOGIC) { + QMessageBox msg(this); + msg.setText("Protocol Analyzer"); + msg.setInformativeText("Protocol Analyzer is only valid in Digital Mode!"); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); + } else { + pv::decoder::DemoConfig dlg(this, _session.get_device(), _protocol_combobox->currentIndex()); + if (dlg.exec()) { + std::list _sel_probes = dlg.get_sel_probes(); + QMap & _options = dlg.get_options(); + QMap _options_index = dlg.get_options_index(); + + QPushButton *_del_button = new QPushButton(this); + QPushButton *_set_button = new QPushButton(this); + _del_button->setFlat(true); + _del_button->setIcon(QIcon::fromTheme("protocol", + QIcon(":/icons/del.png"))); + _set_button->setFlat(true); + _set_button->setIcon(QIcon::fromTheme("protocol", + QIcon(":/icons/set.png"))); + QLabel *_protocol_label = new QLabel(this); + + _del_button->setCheckable(true); + _protocol_label->setText(_protocol_combobox->currentText()); + + connect(_del_button, SIGNAL(clicked()), + this, SLOT(del_protocol())); + connect(_set_button, SIGNAL(clicked()), + this, SLOT(rst_protocol())); + + _del_button_list.push_back(_del_button); + _set_button_list.push_back(_set_button); + _protocol_label_list.push_back(_protocol_label); + _protocol_index_list.push_back(_protocol_combobox->currentIndex()); + + QHBoxLayout *hori_layout = new QHBoxLayout(); + hori_layout->addWidget(_set_button); + hori_layout->addWidget(_del_button); + hori_layout->addWidget(_protocol_label); + hori_layout->addStretch(1); + _hori_layout_list.push_back(hori_layout); + _layout->insertLayout(_del_button_list.size(), hori_layout); + + _session.add_protocol_analyzer(_protocol_combobox->currentIndex(), _sel_probes, _options, _options_index); + } + } +} + +void ProtocolDock::rst_protocol() +{ + int rst_index = 0; + for (QVector ::const_iterator i = _set_button_list.begin(); + i != _set_button_list.end(); i++) { + QPushButton *button = qobject_cast(sender()); + if ((*i) == button) { + pv::decoder::DemoConfig dlg(this, _session.get_device(), _protocol_index_list.at(rst_index)); + dlg.set_config(_session.get_decode_probes(rst_index), _session.get_decode_options_index(rst_index)); + if (dlg.exec()) { + std::list _sel_probes = dlg.get_sel_probes(); + QMap & _options = dlg.get_options(); + QMap _options_index = dlg.get_options_index(); + + _session.rst_protocol_analyzer(rst_index, _sel_probes, _options, _options_index); + } + break; + } + rst_index++; + } +} + +void ProtocolDock::del_protocol() +{ + if (_del_all_button->isChecked()) { + _del_all_button->setChecked(false); + if (_hori_layout_list.size() > 0) { + int del_index = 0; + for (QVector ::const_iterator i = _hori_layout_list.begin(); + i != _hori_layout_list.end(); i++) { + _layout->removeItem((*i)); + delete (*i); + delete _del_button_list.at(del_index); + delete _set_button_list.at(del_index); + delete _protocol_label_list.at(del_index); + + _session.del_protocol_analyzer(0); + del_index++; + } + _hori_layout_list.clear(); + _del_button_list.clear(); + _set_button_list.clear(); + _protocol_label_list.clear(); + _protocol_index_list.clear(); + } else { + QMessageBox msg(this); + msg.setText("Protocol Analyzer"); + msg.setInformativeText("No Protocol Analyzer to delete!"); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); + } + } else { + int del_index = 0; + for (QVector ::const_iterator i = _del_button_list.begin(); + i != _del_button_list.end(); i++) { + if ((*i)->isChecked()) { + _layout->removeItem(_hori_layout_list.at(del_index)); + + delete _hori_layout_list.at(del_index); + delete _del_button_list.at(del_index); + delete _set_button_list.at(del_index); + delete _protocol_label_list.at(del_index); + + _hori_layout_list.remove(del_index); + _del_button_list.remove(del_index); + _set_button_list.remove(del_index); + _protocol_label_list.remove(del_index); + _protocol_index_list.remove(del_index); + + _session.del_protocol_analyzer(del_index); + + break; + } + del_index++; + } + } +} + +void ProtocolDock::del_all_protocol() +{ + if (_hori_layout_list.size() > 0) { + int del_index = 0; + for (QVector ::const_iterator i = _hori_layout_list.begin(); + i != _hori_layout_list.end(); i++) { + _layout->removeItem((*i)); + delete (*i); + delete _del_button_list.at(del_index); + delete _set_button_list.at(del_index); + delete _protocol_label_list.at(del_index); + + _session.del_protocol_analyzer(0); + del_index++; + } + _hori_layout_list.clear(); + _del_button_list.clear(); + _set_button_list.clear(); + _protocol_label_list.clear(); + _protocol_index_list.clear(); + } +} + +} // namespace dock +} // namespace pv diff --git a/DSLogic-gui/pv/dock/protocoldock.h b/DSLogic-gui/pv/dock/protocoldock.h new file mode 100644 index 00000000..2165af13 --- /dev/null +++ b/DSLogic-gui/pv/dock/protocoldock.h @@ -0,0 +1,85 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_PROTOCOLDOCK_H +#define DSLOGIC_PV_PROTOCOLDOCK_H + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "../decoder/decoder.h" + +namespace pv { + +class SigSession; + +namespace dock { + +class ProtocolDock : public QWidget +{ + Q_OBJECT + +public: + ProtocolDock(QWidget *parent, SigSession &session); + ~ProtocolDock(); + + void paintEvent(QPaintEvent *); + + void del_all_protocol(); + +signals: + +private slots: + void add_protocol(); + void rst_protocol(); + void del_protocol(); + +private: + +private: + SigSession &_session; + + QPushButton *_add_button; + QPushButton *_del_all_button; + QComboBox *_protocol_combobox; + QVector _del_button_list; + QVector _set_button_list; + QVector _protocol_label_list; + QVector _protocol_index_list; + QVector _hori_layout_list; + QVBoxLayout *_layout; +}; + +} // namespace dock +} // namespace pv + +#endif // DSLOGIC_PV_PROTOCOLDOCK_H diff --git a/DSLogic-gui/pv/dock/searchdock.cpp b/DSLogic-gui/pv/dock/searchdock.cpp new file mode 100644 index 00000000..fc079b7f --- /dev/null +++ b/DSLogic-gui/pv/dock/searchdock.cpp @@ -0,0 +1,332 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "searchdock.h" +#include "../sigsession.h" +#include "../view/cursor.h" +#include "../view/view.h" +#include "../view/timemarker.h" +#include "../view/ruler.h" +#include "../dialogs/search.h" +#include "../data/snapshot.h" +#include "../data/logicsnapshot.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +namespace pv { +namespace dock { + +using namespace pv::view; + +SearchDock::SearchDock(QWidget *parent, View &view, SigSession &session) : + QWidget(parent), + _session(session), + _view(view) +{ + _pattern = "X X X X X X X X X X X X X X X X"; + + connect(&_pre_button, SIGNAL(clicked()), + this, SLOT(on_previous())); + connect(&_nxt_button, SIGNAL(clicked()), + this, SLOT(on_next())); + + _pre_button.setIcon(QIcon::fromTheme("search", + QIcon(":/icons/pre.png"))); + _nxt_button.setIcon(QIcon::fromTheme("search", + QIcon(":/icons/next.png"))); + + QPushButton *_search_button = new QPushButton(this); + _search_button->setIcon(QIcon::fromTheme("search", + QIcon(":/icons/search.png"))); + _search_button->setFixedWidth(_search_button->height()); + _search_button->setDisabled(true); + + QLineEdit *_search_parent = new QLineEdit(this); + _search_parent->setVisible(false); + _search_value = new FakeLineEdit(_search_parent); + _search_value->setPlaceholderText(tr("search")); + + QHBoxLayout *search_layout = new QHBoxLayout(); + search_layout->addWidget(_search_button); + search_layout->addStretch(); + search_layout->setContentsMargins(0, 0, 0, 0); + _search_value->setLayout(search_layout); + _search_value->setTextMargins(_search_button->width(), 0, 0, 0); + _search_value->setReadOnly(true); + + connect(_search_value, SIGNAL(trigger()), this, SLOT(on_set())); + + QHBoxLayout *layout = new QHBoxLayout(); + layout->addStretch(1); + layout->addWidget(&_pre_button); + layout->addWidget(_search_value); + layout->addWidget(&_nxt_button); + layout->addStretch(1); + + setLayout(layout); +} + +SearchDock::~SearchDock() +{ +} + +void SearchDock::paintEvent(QPaintEvent *) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} + +void SearchDock::on_previous() +{ + uint64_t last_pos; + uint8_t *data; + int unit_size; + uint64_t length; + QString value = _search_value->text(); + search_previous(value); + + last_pos = _view.get_search_pos(); + if (last_pos == 0) { + QMessageBox msg(this); + msg.setText("Search"); + msg.setInformativeText("Search cursor at the start position!"); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); + return; + } else { + data = (uint8_t*)_session.get_buf(unit_size, length); + if (data == NULL) { + QMessageBox msg(this); + msg.setText("Search"); + msg.setInformativeText("No Sample data!"); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); + return; + } else { + const bool ret = search_value(data, unit_size, length, last_pos, 1, value); + if (!ret) { + QMessageBox msg(this); + msg.setText("Search"); + msg.setInformativeText("Pattern " + value + " not found!"); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); + return; + } else { + _view.set_search_pos(last_pos); + } + } + } +} + +void SearchDock::on_next() +{ + uint64_t last_pos; + int unit_size; + uint64_t length; + uint8_t *data = (uint8_t*)_session.get_buf(unit_size, length); + QString value = _search_value->text(); + search_previous(value); + + last_pos = _view.get_search_pos(); + if (last_pos == length - 1) { + QMessageBox msg(this); + msg.setText("Search"); + msg.setInformativeText("Search cursor at the end position!"); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); + return; + } else { + if (data == NULL) { + QMessageBox msg(this); + msg.setText("Search"); + msg.setInformativeText("No Sample data!"); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); + return; + } else { + const int ret = search_value(data, unit_size, length, last_pos, 0, value); + if (!ret) { + QMessageBox msg(this); + msg.setText("Search"); + msg.setInformativeText("Pattern " + value + " not found!"); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); + return; + } else { + _view.set_search_pos(last_pos); + } + } + } +} + +void SearchDock::on_set() +{ + dialogs::Search dlg(this, _session.get_device(), _pattern); + if (dlg.exec()) { + _pattern = dlg.get_pattern(); + _pattern.remove(QChar(' '), Qt::CaseInsensitive); + _pattern = _pattern.toUpper(); + _search_value->setText(_pattern); + } +} + +bool SearchDock::search_value(const uint8_t *data, int unit_size, uint64_t length, uint64_t& pos, bool left, QString value) +{ + QByteArray pattern = value.toUtf8(); + int i = 0; + uint64_t match_pos = left ? pos - 1 : pos + 1; + bool part_match = false; + int match_bits = unit_size * 8 - 1; + bool unmatch = false; + + while(i <= match_bits) { + unmatch = false; + uint64_t pattern_mask = 1ULL << i; + + if (pattern[match_bits - i] == 'X') { + part_match = true; + } else if (pattern[match_bits - i] == '0') { + //while((match_pos >= 0 && left) || (match_pos < length && !left)) { + while(left || (match_pos < length && !left)) { + if (0 == ((*(uint64_t *)(data + match_pos * unit_size) & pattern_mask) != 0)) { + part_match = true; + break; + } else if ((match_pos == 0 && left) || (match_pos == length - 1 && !left)) { + unmatch = true; + part_match = false; + break; + } else if (part_match) { + unmatch = true; + match_pos = left ? match_pos - 1 : match_pos + 1; + i = 0; + break; + } else if (!part_match) { + match_pos = left ? match_pos - 1 : match_pos + 1; + } + } + } else if (pattern[match_bits - i] == '1') { + //while((match_pos >= 0 && left) || (match_pos < length && !left)) { + while(left || (match_pos < length && !left)) { + if (1 == ((*(uint64_t *)(data + match_pos * unit_size) & pattern_mask) != 0)) { + part_match = true; + break; + } else if ((match_pos == 0 && left) || (match_pos == length - 1 && !left)) { + unmatch = true; + part_match = false; + break; + } else if (part_match) { + unmatch = true; + match_pos = left ? match_pos - 1 : match_pos + 1; + i = 0; + break; + } else if (!part_match) { + match_pos = left ? match_pos - 1 : match_pos + 1; + } + } + }else if (pattern[match_bits - i] == 'R') { + while((match_pos > 0 && left) || (match_pos < length && !left)) { + if (1 == ((*(uint64_t *)(data + match_pos * unit_size) & pattern_mask) != 0) && + 0 == ((*(uint64_t *)(data + (match_pos - 1) * unit_size) & pattern_mask) != 0)) { + part_match = true; + break; + } else if ((match_pos == 1 && left) || (match_pos == length - 1 && !left)) { + unmatch = true; + part_match = false; + break; + } else if (part_match) { + unmatch = true; + match_pos = left ? match_pos - 1 : match_pos + 1; + i = 0; + break; + } else if (!part_match) { + match_pos = left ? match_pos - 1 : match_pos + 1; + } + } + } else if (pattern[match_bits - i] == 'F') { + while((match_pos > 0 && left) || (match_pos < length && !left)) { + if (0 == ((*(uint64_t *)(data + match_pos * unit_size) & pattern_mask) != 0) && + 1 == ((*(uint64_t *)(data + (match_pos - 1) * unit_size) & pattern_mask) != 0)) { + part_match = true; + break; + } else if ((match_pos == 1 && left) || (match_pos == length - 1 && !left)) { + unmatch = true; + part_match = false; + break; + } else if (part_match) { + unmatch = true; + match_pos = left ? match_pos - 1 : match_pos + 1; + i = 0; + break; + } else if (!part_match) { + match_pos = left ? match_pos - 1 : match_pos + 1; + } + } + } else if (pattern[match_bits - i] == 'C') { + while((match_pos > 0 && left) || (match_pos < length && !left)) { + if (((*(uint64_t *)(data + match_pos * unit_size) & pattern_mask) != 0) != + ((*(uint64_t *)(data + (match_pos - 1) * unit_size) & pattern_mask) != 0)) { + part_match = true; + break; + } else if ((match_pos == 1 && left) || (match_pos == length - 1 && !left)) { + unmatch = true; + part_match = false; + break; + } else if (part_match) { + unmatch = true; + match_pos = left ? match_pos - 1 : match_pos + 1; + i = 0; + break; + } else if (!part_match) { + match_pos = left ? match_pos - 1 : match_pos + 1; + } + } + } + + if (unmatch && !part_match) + break; + else if ((!unmatch && part_match) || !part_match) + i++; + } + + pos = match_pos; + return !unmatch; +} + +} // namespace dock +} // namespace pv diff --git a/DSLogic-gui/pv/dock/searchdock.h b/DSLogic-gui/pv/dock/searchdock.h new file mode 100644 index 00000000..c29f061d --- /dev/null +++ b/DSLogic-gui/pv/dock/searchdock.h @@ -0,0 +1,95 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_SEARCHDOCK_H +#define DSLOGIC_PV_SEARCHDOCK_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include + +#include "fakelineedit.h" + +namespace pv { + +class SigSession; + +namespace view { + class View; +} + +namespace dock { + +class SearchDock : public QWidget +{ + Q_OBJECT + +public: + SearchDock(QWidget *parent, pv::view::View &view, SigSession &session); + ~SearchDock(); + + void paintEvent(QPaintEvent *); + +signals: + void search_previous(QString); + void search_next(QString); + +public slots: + void on_previous(); + void on_next(); + void on_set(); +private: + bool search_value(const uint8_t* data, int unit_size, uint64_t length, + uint64_t& pos, bool left, QString value); + +private: + SigSession &_session; + view::View &_view; + QString _pattern; + + QPushButton _pre_button; + QPushButton _nxt_button; + FakeLineEdit* _search_value; +}; + +} // namespace dock +} // namespace pv + +#endif // DSLOGIC_PV_SEARCHDOCK_H diff --git a/DSLogic-gui/pv/dock/triggerdock.cpp b/DSLogic-gui/pv/dock/triggerdock.cpp new file mode 100644 index 00000000..38e89b85 --- /dev/null +++ b/DSLogic-gui/pv/dock/triggerdock.cpp @@ -0,0 +1,352 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "triggerdock.h" +#include "../sigsession.h" + +#include +#include +#include +#include +#include +#include + +namespace pv { +namespace dock { + +TriggerDock::TriggerDock(QWidget *parent, SigSession &session) : + QWidget(parent), + _session(session) +{ + int i; + + simple_radioButton = new QRadioButton("Simple Trigger", this); + simple_radioButton->setChecked(true); + adv_radioButton = new QRadioButton("Advanced Trigger", this); + + position_label = new QLabel("Trigger Position: ", this); + position_spinBox = new QSpinBox(this); + position_spinBox->setRange(0, 100); + position_spinBox->setButtonSymbols(QAbstractSpinBox::NoButtons); + position_slider = new QSlider(Qt::Horizontal, this); + position_slider->setRange(0, 100); + connect(position_slider, SIGNAL(valueChanged(int)), position_spinBox, SLOT(setValue(int))); + connect(position_spinBox, SIGNAL(valueChanged(int)), position_slider, SLOT(setValue(int))); + + stages_label = new QLabel("Total Trigger Stages: ", this); + stages_label->setDisabled(true); + stages_comboBox = new QComboBox(this); + for (i = 1; i <= TriggerStages; i++) + stages_comboBox->addItem(QString::number(i)); + //stages_comboBox->setCurrentIndex(stages_comboBox->count() - 1); + stages_comboBox->setDisabled(true); + + stage_tabWidget = new QTabWidget(this); + stage_tabWidget->setTabPosition(QTabWidget::East); + stage_tabWidget->setDisabled(true); + + QRegExp value_rx("[10XRFCxrfc ]+"); + QValidator *value_validator = new QRegExpValidator(value_rx, this); + for (i = 0; i < TriggerStages; i++) { + QComboBox *_logic_comboBox = new QComboBox(this); + _logic_comboBox->addItem(tr("Or")); + _logic_comboBox->addItem(tr("And")); + _logic_comboBox->setCurrentIndex(1); + _logic_comboBox_list.push_back(_logic_comboBox); + + QLineEdit *_value0_lineEdit = new QLineEdit("X X X X X X X X X X X X X X X X", this); + _value0_lineEdit->setValidator(value_validator); + _value0_lineEdit->setMaxLength(TriggerProbes * 2 - 1); + _value0_lineEdit->setInputMask("X X X X X X X X X X X X X X X X"); + _value0_lineEdit_list.push_back(_value0_lineEdit); + QSpinBox *_count0_spinBox = new QSpinBox(this); + _count0_spinBox->setRange(1, 1 << TriggerCountBits); + _count0_spinBox->setButtonSymbols(QAbstractSpinBox::NoButtons); + _count0_spinBox_list.push_back(_count0_spinBox); + QComboBox *_inv0_comboBox = new QComboBox(this); + _inv0_comboBox->addItem(tr("==")); + _inv0_comboBox->addItem(tr("!=")); + _inv0_comboBox_list.push_back(_inv0_comboBox); + + QLineEdit *_value1_lineEdit = new QLineEdit("X X X X X X X X X X X X X X X X", this); + _value1_lineEdit->setValidator(value_validator); + _value1_lineEdit->setMaxLength(TriggerProbes * 2 - 1); + _value1_lineEdit->setInputMask("X X X X X X X X X X X X X X X X"); + _value1_lineEdit_list.push_back(_value1_lineEdit); + QSpinBox *_count1_spinBox = new QSpinBox(this); + _count1_spinBox->setRange(1, 1 << TriggerCountBits); + _count1_spinBox->setButtonSymbols(QAbstractSpinBox::NoButtons); + _count1_spinBox_list.push_back(_count1_spinBox); + QComboBox *_inv1_comboBox = new QComboBox(this); + _inv1_comboBox->addItem(tr("==")); + _inv1_comboBox->addItem(tr("!=")); + _inv1_comboBox_list.push_back(_inv1_comboBox); + + QLabel *value_exp0_label = new QLabel("1 1 1 1 1 1", this); + QLabel *value_exp1_label = new QLabel("5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0", this); + QLabel *inv_exp_label = new QLabel("Inv", this); + QLabel *count_exp_label = new QLabel("Counter", this); + + QVBoxLayout *stage_layout = new QVBoxLayout(); + QGridLayout *stage_glayout = new QGridLayout(); + stage_glayout->addWidget(value_exp0_label, 0, 0); + stage_glayout->addWidget(value_exp1_label, 1, 0); + stage_glayout->addWidget(inv_exp_label, 1, 1); + stage_glayout->addWidget(count_exp_label, 1, 2); + stage_glayout->addWidget(_value0_lineEdit, 2, 0); + stage_glayout->addWidget(_inv0_comboBox, 2, 1); + stage_glayout->addWidget(_count0_spinBox, 2, 2); + stage_glayout->addWidget(_logic_comboBox, 2, 3); + stage_glayout->addWidget(_value1_lineEdit, 3, 0); + stage_glayout->addWidget(_inv1_comboBox, 3, 1); + stage_glayout->addWidget(_count1_spinBox, 3, 2); + stage_layout->addLayout(stage_glayout); + stage_layout->addSpacing(124); + stage_layout->addWidget(new QLabel("X: Don't care")); + stage_layout->addWidget(new QLabel("0: Low level")); + stage_layout->addWidget(new QLabel("1: High level")); + stage_layout->addWidget(new QLabel("R: Rising edge")); + stage_layout->addWidget(new QLabel("F: Falling edge")); + stage_layout->addWidget(new QLabel("C: Rising/Falling edge")); + stage_layout->addStretch(1); + + QGroupBox *_stage_groupBox = new QGroupBox("Stage"+QString::number(i), this); + _stage_groupBox->setFlat(true); + _stage_groupBox->setLayout(stage_layout); + _stage_groupBox_list.push_back(_stage_groupBox); + + stage_tabWidget->addTab((QWidget *)_stage_groupBox, QString::number(i)); + + connect(_value0_lineEdit, SIGNAL(editingFinished()), this, SLOT(value_changed())); + connect(_value1_lineEdit, SIGNAL(editingFinished()), this, SLOT(value_changed())); + connect(_logic_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(logic_changed(int))); + connect(_inv0_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(inv_changed(int))); + connect(_inv1_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(inv_changed(int))); + connect(_count0_spinBox, SIGNAL(editingFinished()), this, SLOT(count_changed())); + connect(_count1_spinBox, SIGNAL(editingFinished()), this, SLOT(count_changed())); + } + + connect(simple_radioButton, SIGNAL(clicked()), this, SLOT(simple_trigger())); + connect(adv_radioButton, SIGNAL(clicked()), this, SLOT(adv_trigger())); + connect(stages_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(trigger_stages_changed(int))); + connect(position_slider, SIGNAL(valueChanged(int)), this, SLOT(pos_changed(int))); + + QVBoxLayout *layout = new QVBoxLayout(this); + QGridLayout *gLayout = new QGridLayout(); + gLayout->addWidget(simple_radioButton, 0, 0); + gLayout->addWidget(adv_radioButton, 1, 0); + gLayout->addWidget(position_label, 2, 0); + gLayout->addWidget(position_spinBox, 2, 1); + gLayout->addWidget(new QLabel(this), 2, 2); + gLayout->addWidget(position_slider, 3, 0, 1, 3); + gLayout->addWidget(stages_label, 4, 0); + gLayout->addWidget(stages_comboBox, 4, 1); + gLayout->addWidget(new QLabel(this), 4, 2); + gLayout->setColumnStretch(2, 1); + + layout->addLayout(gLayout); + layout->addWidget(stage_tabWidget); + layout->addStretch(1); + setLayout(layout); +} + +TriggerDock::~TriggerDock() +{ +} + +void TriggerDock::paintEvent(QPaintEvent *) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} + +void TriggerDock::simple_trigger() +{ + int i; + stages_label->setDisabled(true); + stages_comboBox->setDisabled(true); + stage_tabWidget->setDisabled(true); + for (i = 0; i < TriggerStages; i++) { + stage_tabWidget->setTabEnabled(i, true); +// _mu_label_list.at(i)->setDisabled(true); +// _logic_comboBox_list.at(i)->setDisabled(true); + +// _value0_lineEdit_list.at(i)->setDisabled(true); +// _count0_spinBox_list.at(i)->setDisabled(true); +// _inv0_comboBox_list.at(i)->setDisabled(true); + +// _value1_lineEdit_list.at(i)->setDisabled(true); +// _count1_spinBox_list.at(i)->setDisabled(true); +// _inv1_comboBox_list.at(i)->setDisabled(true); + } + ds_trigger_set_mode(SIMPLE_TRIGGER); + _session.set_adv_trigger(false); +} + +void TriggerDock::adv_trigger() +{ + if (strcmp(_session.get_device()->driver->name, "DSLogic") == 0) { + widget_enable(); + ds_trigger_set_mode(ADV_TRIGGER); + _session.set_adv_trigger(true); + } else { + QMessageBox msg(this); + msg.setText("Trigger"); + msg.setInformativeText("Advanced Trigger need DSLogic Hardware Support!"); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); + simple_radioButton->setChecked(true); + } +} + +void TriggerDock::trigger_stages_changed(int index) +{ + widget_enable(); + ds_trigger_set_stage(index); + value_changed(); + logic_changed(0); + inv_changed(0); + count_changed(); +} + +void TriggerDock::widget_enable() +{ + int i; + int enable_stages; + stages_label->setDisabled(false); + stages_comboBox->setVisible(true); + stages_comboBox->setDisabled(false); + stage_tabWidget->setDisabled(false); + enable_stages = stages_comboBox->currentText().toInt(); + for (i = 0; i < enable_stages; i++) { + stage_tabWidget->setTabEnabled(i, true); +// _mu_label_list.at(i)->setVisible(true); +// _mu_label_list.at(i)->setDisabled(false); +// _logic_comboBox_list.at(i)->setVisible(true); +// _logic_comboBox_list.at(i)->setDisabled(false); + +// _value0_lineEdit_list.at(i)->setVisible(true); +// _value0_lineEdit_list.at(i)->setDisabled(false); +// _count0_spinBox_list.at(i)->setVisible(true); +// _count0_spinBox_list.at(i)->setDisabled(false); +// _inv0_comboBox_list.at(i)->setVisible(true); +// _inv0_comboBox_list.at(i)->setDisabled(false); + +// _value1_lineEdit_list.at(i)->setVisible(true); +// _value1_lineEdit_list.at(i)->setDisabled(false); +// _count1_spinBox_list.at(i)->setVisible(true); +// _count1_spinBox_list.at(i)->setDisabled(false); +// _inv1_comboBox_list.at(i)->setVisible(true); +// _inv1_comboBox_list.at(i)->setDisabled(false); + } + for (i = enable_stages; i < TriggerStages; i++) { + stage_tabWidget->setTabEnabled(i, false); +// _mu_label_list.at(i)->setVisible(false); +// _logic_comboBox_list.at(i)->setVisible(false); + +// _value0_lineEdit_list.at(i)->setVisible(false); +// _count0_spinBox_list.at(i)->setVisible(false); +// _inv0_comboBox_list.at(i)->setVisible(false); + +// _value1_lineEdit_list.at(i)->setVisible(false); +// _count1_spinBox_list.at(i)->setVisible(false); +// _inv1_comboBox_list.at(i)->setVisible(false); + } +} + +void TriggerDock::value_changed() +{ + int i; + + for (i = 0; i < stages_comboBox->currentText().toInt(); i++) { + _value0_lineEdit_list.at(i)->setText(_value0_lineEdit_list.at(i)->text().toUpper()); + while(_value0_lineEdit_list.at(i)->text().length() < TriggerProbes) + _value0_lineEdit_list.at(i)->setText("X" + _value0_lineEdit_list.at(i)->text()); + + _value1_lineEdit_list.at(i)->setText(_value1_lineEdit_list.at(i)->text().toUpper()); + while(_value1_lineEdit_list.at(i)->text().length() < TriggerProbes) + _value1_lineEdit_list.at(i)->setText("X" + _value1_lineEdit_list.at(i)->text()); + + ds_trigger_stage_set_value(i, TriggerProbes, + _value0_lineEdit_list.at(i)->text().toLocal8Bit().data(), + _value1_lineEdit_list.at(i)->text().toLocal8Bit().data()); + } +} + +void TriggerDock::logic_changed(int index) +{ + (void)index; + + int i; + + for (i = 0; i < stages_comboBox->currentText().toInt(); i++) { + ds_trigger_stage_set_logic(i, TriggerProbes, + _logic_comboBox_list.at(i)->currentIndex()); + } +} + +void TriggerDock::inv_changed(int index) +{ + (void)index; + + int i; + + for (i = 0; i < stages_comboBox->currentText().toInt(); i++) { + ds_trigger_stage_set_inv(i, TriggerProbes, + _inv0_comboBox_list.at(i)->currentIndex(), + _inv1_comboBox_list.at(i)->currentIndex()); + } +} + +void TriggerDock::count_changed() +{ + int i; + + for (i = 0; i < stages_comboBox->currentText().toInt(); i++) { + ds_trigger_stage_set_count(i, TriggerProbes, + _count0_spinBox_list.at(i)->value() - 1, + _count1_spinBox_list.at(i)->value() - 1); + } +} + +void TriggerDock::pos_changed(int pos) +{ + ds_trigger_set_pos(pos); +} + +void TriggerDock::device_change() +{ + if (strcmp(_session.get_device()->driver->name, "DSLogic") != 0) { + position_spinBox->setDisabled(true); + position_slider->setDisabled(true); + } else { + position_spinBox->setDisabled(false); + position_slider->setDisabled(false); + } +} + +} // namespace dock +} // namespace pv diff --git a/DSLogic-gui/pv/dock/triggerdock.h b/DSLogic-gui/pv/dock/triggerdock.h new file mode 100644 index 00000000..a2915db2 --- /dev/null +++ b/DSLogic-gui/pv/dock/triggerdock.h @@ -0,0 +1,110 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_TRIGGERDOCK_H +#define DSLOGIC_PV_TRIGGERDOCK_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include + +namespace pv { + +class SigSession; + +namespace dock { + +class TriggerDock : public QWidget +{ + Q_OBJECT + +public: + TriggerDock(QWidget *parent, SigSession &session); + ~TriggerDock(); + + void paintEvent(QPaintEvent *); + + void device_change(); + +signals: + +private slots: + void simple_trigger(); + void adv_trigger(); + void trigger_stages_changed(int index); + void widget_enable(); + + void value_changed(); + void logic_changed(int index); + void count_changed(); + void inv_changed(int index); + + void pos_changed(int pos); + +private: + +private: + SigSession &_session; + + QRadioButton *simple_radioButton; + QRadioButton *adv_radioButton; + + QLabel *position_label; + QSpinBox *position_spinBox; + QSlider *position_slider; + + QLabel *stages_label; + QComboBox *stages_comboBox; + + QTabWidget *stage_tabWidget; + + QVector _stage_groupBox_list; + QVector _mu_label_list; + QVector _logic_comboBox_list; + QVector _value0_lineEdit_list; + QVector _count0_spinBox_list; + QVector _inv0_comboBox_list; + QVector _value1_lineEdit_list; + QVector _count1_spinBox_list; + QVector _inv1_comboBox_list; +}; + +} // namespace dock +} // namespace pv + +#endif // DSLOGIC_PV_TRIGGERDOCK_H diff --git a/DSLogic-gui/pv/mainwindow.cpp b/DSLogic-gui/pv/mainwindow.cpp new file mode 100644 index 00000000..32c7a94b --- /dev/null +++ b/DSLogic-gui/pv/mainwindow.cpp @@ -0,0 +1,568 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifdef ENABLE_SIGROKDECODE +#include +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mainwindow.h" + +#include "devicemanager.h" + +#include "dialogs/about.h" +#include "dialogs/connect.h" + +#include "toolbars/samplingbar.h" +#include "toolbars/devicebar.h" +#include "toolbars/trigbar.h" +#include "toolbars/filebar.h" +#include "toolbars/logobar.h" + +#include "dock/protocoldock.h" +#include "dock/triggerdock.h" +#include "dock/measuredock.h" +#include "dock/searchdock.h" + +#include "view/view.h" + +/* __STDC_FORMAT_MACROS is required for PRIu64 and friends (in C++). */ +#define __STDC_FORMAT_MACROS +#include +#include +#include +#include +#include + +using namespace std; + +namespace pv { + +MainWindow::MainWindow(DeviceManager &device_manager, + const char *open_file_name, + QWidget *parent) : + QMainWindow(parent), + _device_manager(device_manager), + _session(device_manager) +{ + setup_ui(); + if (open_file_name) { + const QString s(QString::fromUtf8(open_file_name)); + QMetaObject::invokeMethod(this, "load_file", + Qt::QueuedConnection, + Q_ARG(QString, s)); + } +} + +void MainWindow::setup_ui() +{ + setObjectName(QString::fromUtf8("MainWindow")); + setMinimumHeight(680); + resize(1024, 768); + + // Set the window icon + QIcon icon; + icon.addFile(QString::fromUtf8(":/icons/logo.png"), + QSize(), QIcon::Normal, QIcon::Off); + setWindowIcon(icon); + + // Setup the central widget + _central_widget = new QWidget(this); + _vertical_layout = new QVBoxLayout(_central_widget); + _vertical_layout->setSpacing(6); + _vertical_layout->setContentsMargins(0, 0, 0, 0); + setCentralWidget(_central_widget); + +// // Setup the menu bar +// _menu_bar = new QMenuBar(this); +// _menu_bar->setGeometry(QRect(0, 0, 400, 25)); + +// // File Menu +// _menu_file = new QMenu(_menu_bar); +// _menu_file->setTitle(QApplication::translate( +// "MainWindow", "&File", 0, QApplication::UnicodeUTF8)); + +// _action_open = new QAction(this); +// _action_open->setText(QApplication::translate( +// "MainWindow", "&Open...", 0, QApplication::UnicodeUTF8)); +// _action_open->setIcon(QIcon::fromTheme("document-open", +// QIcon(":/icons/document-open.png"))); +// _action_open->setObjectName(QString::fromUtf8("actionOpen")); +// _menu_file->addAction(_action_open); + +// _menu_file->addSeparator(); + +// _action_connect = new QAction(this); +// _action_connect->setText(QApplication::translate( +// "MainWindow", "&Connect to Device...", 0, +// QApplication::UnicodeUTF8)); +// _action_connect->setObjectName(QString::fromUtf8("actionConnect")); +// _menu_file->addAction(_action_connect); + +// _menu_file->addSeparator(); + +// _action_quit = new QAction(this); +// _action_quit->setText(QApplication::translate( +// "MainWindow", "&Quit", 0, QApplication::UnicodeUTF8)); +// _action_quit->setIcon(QIcon::fromTheme("application-exit", +// QIcon(":/icons/application-exit.png"))); +// _action_quit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); +// _action_quit->setObjectName(QString::fromUtf8("actionQuit")); +// _menu_file->addAction(_action_quit); + +// // View Menu +// _menu_view = new QMenu(_menu_bar); +// _menu_view->setTitle(QApplication::translate( +// "MainWindow", "&View", 0, QApplication::UnicodeUTF8)); + +// _action_view_zoom_in = new QAction(this); +// _action_view_zoom_in->setText(QApplication::translate( +// "MainWindow", "Zoom &In", 0, QApplication::UnicodeUTF8)); +// _action_view_zoom_in->setIcon(QIcon::fromTheme("zoom-in", +// QIcon(":/icons/zoom-in.png"))); +// _action_view_zoom_in->setObjectName( +// QString::fromUtf8("actionViewZoomIn")); +// _menu_view->addAction(_action_view_zoom_in); + +// _action_view_zoom_out = new QAction(this); +// _action_view_zoom_out->setText(QApplication::translate( +// "MainWindow", "Zoom &Out", 0, QApplication::UnicodeUTF8)); +// _action_view_zoom_out->setIcon(QIcon::fromTheme("zoom-out", +// QIcon(":/icons/zoom-out.png"))); +// _action_view_zoom_out->setObjectName( +// QString::fromUtf8("actionViewZoomOut")); +// _menu_view->addAction(_action_view_zoom_out); + +// _menu_view->addSeparator(); + +// _action_view_show_cursors = new QAction(this); +// _action_view_show_cursors->setCheckable(true); +// _action_view_show_cursors->setChecked(_view->cursors_shown()); +// _action_view_show_cursors->setShortcut(QKeySequence(Qt::Key_C)); +// _action_view_show_cursors->setObjectName( +// QString::fromUtf8("actionViewShowCursors")); +// _action_view_show_cursors->setText(QApplication::translate( +// "MainWindow", "Show &Cursors", 0, QApplication::UnicodeUTF8)); +// _menu_view->addAction(_action_view_show_cursors); + +// // Help Menu +// _menu_help = new QMenu(_menu_bar); +// _menu_help->setTitle(QApplication::translate( +// "MainWindow", "&Help", 0, QApplication::UnicodeUTF8)); + +// _action_about = new QAction(this); +// _action_about->setObjectName(QString::fromUtf8("actionAbout")); +// _action_about->setText(QApplication::translate( +// "MainWindow", "&About...", 0, QApplication::UnicodeUTF8)); +// _menu_help->addAction(_action_about); + +// _menu_bar->addAction(_menu_file->menuAction()); +// _menu_bar->addAction(_menu_view->menuAction()); +// _menu_bar->addAction(_menu_help->menuAction()); + + //setMenuBar(_menu_bar); + //QMenuBar *_void_menu = new QMenuBar(this); + //setMenuBar(_void_menu); + //QMetaObject::connectSlotsByName(this); + + // Setup the sampling bar + _sampling_bar = new toolbars::SamplingBar(this); + _trig_bar = new toolbars::TrigBar(this); + _file_bar = new toolbars::FileBar(_session, this); + _device_bar = new toolbars::DeviceBar(this); + _logo_bar = new toolbars::LogoBar(_session, this); + + connect(_trig_bar, SIGNAL(on_protocol(bool)), this, + SLOT(on_protocol(bool))); + connect(_trig_bar, SIGNAL(on_trigger(bool)), this, + SLOT(on_trigger(bool))); + connect(_trig_bar, SIGNAL(on_measure(bool)), this, + SLOT(on_measure(bool))); + connect(_trig_bar, SIGNAL(on_search(bool)), this, + SLOT(on_search(bool))); + connect(_file_bar, SIGNAL(on_screenShot()), this, + SLOT(on_screenShot())); + + // protocol dock + _protocol_dock=new QDockWidget(tr("Protocol"),this); + _protocol_dock->setFeatures(QDockWidget::NoDockWidgetFeatures); + _protocol_dock->setAllowedAreas(Qt::RightDockWidgetArea); + _protocol_dock->setVisible(false); + //dock::ProtocolDock *_protocol_widget = new dock::ProtocolDock(_protocol_dock, _session); + _protocol_widget = new dock::ProtocolDock(_protocol_dock, _session); + _protocol_dock->setWidget(_protocol_widget); + // trigger dock + _trigger_dock=new QDockWidget(tr("Trigger Setting..."),this); + _trigger_dock->setFeatures(QDockWidget::NoDockWidgetFeatures); + _trigger_dock->setAllowedAreas(Qt::RightDockWidgetArea); + _trigger_dock->setVisible(false); + _trigger_widget = new dock::TriggerDock(_trigger_dock, _session); + _trigger_dock->setWidget(_trigger_widget); + + // Setup _view widget + _view = new pv::view::View(_session, this); + _vertical_layout->addWidget(_view); + + // Populate the device list and select the initially selected device + update_device_list(); + +// connect(_device_bar, SIGNAL(device_selected()), this, +// SLOT(device_selected())); + connect(_device_bar, SIGNAL(device_selected()), this, + SLOT(init())); + connect(_device_bar, SIGNAL(device_updated()), this, + SLOT(update())); + connect(_sampling_bar, SIGNAL(run_stop()), this, + SLOT(run_stop())); + addToolBar(_sampling_bar); + addToolBar(_trig_bar); + addToolBar(_device_bar); + addToolBar(_file_bar); + addToolBar(_logo_bar); + + // Setup the dockWidget + // protocol dock +// _protocol_dock=new QDockWidget(tr("Protocol"),this); +// _protocol_dock->setFeatures(QDockWidget::NoDockWidgetFeatures); +// _protocol_dock->setAllowedAreas(Qt::RightDockWidgetArea); +// _protocol_dock->setVisible(false); +// //dock::ProtocolDock *_protocol_widget = new dock::ProtocolDock(_protocol_dock, _session); +// _protocol_widget = new dock::ProtocolDock(_protocol_dock, _session); +// _protocol_dock->setWidget(_protocol_widget); +// // trigger dock +// _trigger_dock=new QDockWidget(tr("Trigger Setting..."),this); +// _trigger_dock->setFeatures(QDockWidget::NoDockWidgetFeatures); +// _trigger_dock->setAllowedAreas(Qt::RightDockWidgetArea); +// _trigger_dock->setVisible(false); +// dock::TriggerDock *_trigger_widget = new dock::TriggerDock(_trigger_dock, _session); +// _trigger_dock->setWidget(_trigger_widget); + // measure dock + _measure_dock=new QDockWidget(tr("Measurement"),this); + _measure_dock->setFeatures(QDockWidget::NoDockWidgetFeatures); + _measure_dock->setAllowedAreas(Qt::RightDockWidgetArea); + _measure_dock->setVisible(false); + dock::MeasureDock *_measure_widget = new dock::MeasureDock(_measure_dock, *_view, _session); + _measure_dock->setWidget(_measure_widget); + // search dock + _search_dock=new QDockWidget(tr("Search..."), this); + _search_dock->setFeatures(QDockWidget::NoDockWidgetFeatures); + _search_dock->setTitleBarWidget(new QWidget(_search_dock)); + _search_dock->setAllowedAreas(Qt::BottomDockWidgetArea); + _search_dock->setVisible(false); + //dock::SearchDock *_search_widget = new dock::SearchDock(_search_dock, *_view, _session); + _search_widget = new dock::SearchDock(_search_dock, *_view, _session); + _search_dock->setWidget(_search_widget); + + + _protocol_dock->setObjectName(tr("protocolDock")); + _trigger_dock->setObjectName(tr("triggerDock")); + addDockWidget(Qt::RightDockWidgetArea,_protocol_dock); + addDockWidget(Qt::RightDockWidgetArea,_trigger_dock); + addDockWidget(Qt::RightDockWidgetArea, _measure_dock); + addDockWidget(Qt::BottomDockWidgetArea, _search_dock); + + // Set the title + setWindowTitle(QApplication::translate("MainWindow", "DSLogic", 0, + QApplication::UnicodeUTF8)); + + // Setup _session events + connect(&_session, SIGNAL(capture_state_changed(int)), this, + SLOT(capture_state_changed(int))); + connect(&_session, SIGNAL(device_attach()), this, + SLOT(device_attach())); + connect(&_session, SIGNAL(device_detach()), this, + SLOT(device_detach())); + connect(&_session, SIGNAL(test_data_error()), this, + SLOT(test_data_error())); + + connect(_view, SIGNAL(cursor_update()), _measure_widget, + SLOT(cursor_update())); + connect(_view, SIGNAL(cursor_moved()), _measure_widget, + SLOT(cursor_moved())); + connect(_view, SIGNAL(mouse_moved()), _measure_widget, + SLOT(mouse_moved())); +} + +void MainWindow::init() +{ + _protocol_widget->del_all_protocol(); + _trigger_widget->device_change(); + if (_session.get_device()) + _session.init_signals(_session.get_device()); +} + +void MainWindow::update() +{ + if (_session.get_device()) + _session.update_signals(_session.get_device()); +} + +void MainWindow::session_error( + const QString text, const QString info_text) +{ + QMetaObject::invokeMethod(this, "show_session_error", + Qt::QueuedConnection, Q_ARG(QString, text), + Q_ARG(QString, info_text)); +} + +void MainWindow::update_device_list(struct sr_dev_inst *selected_device) +{ + assert(_device_bar); + + const list &devices = _device_manager.devices(); + _device_bar->set_device_list(devices); + + if (!selected_device && !devices.empty()) { + // Fall back to the first device in the list. + selected_device = devices.front(); + + // Try and find the demo device and select that by default + BOOST_FOREACH (struct sr_dev_inst *sdi, devices) + if (strcmp(sdi->driver->name, "DSLogic") == 0) { + selected_device = sdi; + } + } + + if (selected_device) { + if (_session.set_device(selected_device) == SR_OK) { + _device_bar->set_selected_device(selected_device, false); + _sampling_bar->set_device(selected_device); + _sampling_bar->update_sample_rate_selector(); + _logo_bar->dslogic_connected(strcmp(selected_device->driver->name, "DSLogic") == 0); + init(); + } else { + show_session_error("Open Device Failed", + "the selected device can't be opened!"); + } + } + + #ifdef HAVE_LA_DSLOGIC + _session.start_hot_plug_proc(boost::bind(&MainWindow::session_error, this, + QString("Hotplug failed"), _1)); + #endif +} + +void MainWindow::device_change() +{ + assert(_device_bar); + + struct sr_dev_inst *selected_device; + + const list &devices = _device_manager.devices(); + _device_bar->set_device_list(devices); + + // Fall back to the first device in the list. + selected_device = devices.front(); + + // Try and find the demo device and select that by default + BOOST_FOREACH (struct sr_dev_inst *sdi, devices) + if (strcmp(sdi->driver->name, "DSLogic") == 0) { + selected_device = sdi; + } + + if (_session.set_device(selected_device) == SR_OK) {; + _device_bar->set_selected_device(selected_device, true); + _sampling_bar->set_device(selected_device); + _sampling_bar->update_sample_rate_selector(); + _logo_bar->dslogic_connected(strcmp(selected_device->driver->name, "DSLogic") == 0); + init(); + } else { +// show_session_error("Open Device Failed", +// "the selected device can't be opened!"); + device_detach(); + } + + #ifdef HAVE_LA_DSLOGIC + _session.stop_hot_plug_proc(); + _session.start_hot_plug_proc(boost::bind(&MainWindow::session_error, this, + QString("Hotplug failed"), _1)); + #endif + + +} + +void MainWindow::load_file(QString file_name) +{ + const QString errorMessage( + QString("Failed to load file %1").arg(file_name)); + const QString infoMessage; + _session.load_file(file_name.toStdString(), + boost::bind(&MainWindow::session_error, this, + errorMessage, infoMessage)); +} + +void MainWindow::show_session_error( + const QString text, const QString info_text) +{ + QMessageBox msg(this); + msg.setText(text); + msg.setInformativeText(info_text); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); +} + +void MainWindow::device_selected() +{ + if (_session.set_device(_device_bar->get_selected_device()) == SR_OK) {; + _sampling_bar->set_device(_device_bar->get_selected_device()); + _sampling_bar->update_sample_rate_selector(); + _view->show_trig_cursor(false); + init(); + } else { + show_session_error("Open Device Failed", + "the selected device can't be opened!"); + } +} + +void MainWindow::device_attach() +{ + _session.stop_hot_plug_proc(); + + if (_session.get_capture_state() == SigSession::Running) + _session.stop_capture(); + + struct sr_dev_driver **const drivers = sr_driver_list(); + struct sr_dev_driver **driver; + for (driver = drivers; strcmp(((struct sr_dev_driver *)*driver)->name, "DSLogic") != 0 && *driver; driver++); + + if (*driver) + _device_manager.driver_scan(*driver); + + device_change(); +} + +void MainWindow::device_detach() +{ + _session.stop_hot_plug_proc(); + + if (_session.get_capture_state() == SigSession::Running) + _session.stop_capture(); + + struct sr_dev_driver **const drivers = sr_driver_list(); + struct sr_dev_driver **driver; + for (driver = drivers; strcmp(((struct sr_dev_driver *)*driver)->name, "DSLogic") != 0 && *driver; driver++); + + if (*driver) + _device_manager.driver_scan(*driver); + + device_change(); +} + +void MainWindow::run_stop() +{ + _sampling_bar->enable_run_stop(false); + switch(_session.get_capture_state()) { + case SigSession::Init: + case SigSession::Stopped: + _view->show_trig_cursor(false); + _session.set_total_sample_len(_sampling_bar->get_record_length()); + _session.start_capture(_sampling_bar->get_record_length(), + boost::bind(&MainWindow::session_error, this, + QString("Capture failed"), _1)); + break; + + case SigSession::Running: + _session.stop_capture(); + break; + } + g_usleep(1000); + _sampling_bar->enable_run_stop(true); +} + +void MainWindow::test_data_error() +{ + QMessageBox msg(this); + msg.setText("Data Error"); + msg.setInformativeText("the receive data are not consist with pre-defined test data"); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); +} + +void MainWindow::capture_state_changed(int state) +{ + _sampling_bar->enable_toggle(state != SigSession::Running); + _trig_bar->enable_toggle(state != SigSession::Running); + _device_bar->enable_toggle(state != SigSession::Running); + _file_bar->enable_toggle(state != SigSession::Running); + _sampling_bar->set_sampling(state == SigSession::Running); + _measure_dock->widget()->setEnabled(state != SigSession::Running); + _view->on_state_changed(state != SigSession::Running); +} + +void MainWindow::on_protocol(bool visible) +{ + _protocol_dock->setVisible(visible); +} + +void MainWindow::on_trigger(bool visible) +{ + _trigger_dock->setVisible(visible); +} + +void MainWindow::on_measure(bool visible) +{ + _measure_dock->setVisible(visible); +} + +void MainWindow::on_search(bool visible) +{ + _search_dock->setVisible(visible); + _view->show_search_cursor(visible); +} + +void MainWindow::on_screenShot() +{ + QPixmap pixmap; + QDesktopWidget *desktop = QApplication::desktop(); + pixmap = QPixmap::grabWindow(desktop->winId(), pos().x(), pos().y(), frameGeometry().width(), frameGeometry().height()); + QString format = "png"; + QString initialPath = QDir::currentPath()+ + tr("/untitled.") + format; + + QString fileName = QFileDialog::getSaveFileName(this, + tr("Save As"),initialPath, + tr("%1 Files (*.%2);;All Files (*)") + .arg(format.toUpper()).arg(format)); + if (!fileName.isEmpty()) + pixmap.save(fileName, format.toAscii()); +} + +} // namespace pv diff --git a/DSLogic-gui/pv/mainwindow.h b/DSLogic-gui/pv/mainwindow.h new file mode 100644 index 00000000..b89aee9e --- /dev/null +++ b/DSLogic-gui/pv/mainwindow.h @@ -0,0 +1,166 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_MAINWINDOW_H +#define DSLOGIC_PV_MAINWINDOW_H + +#include + +#include + +#include "sigsession.h" + +class QAction; +class QMenuBar; +class QMenu; +class QVBoxLayout; +class QStatusBar; +class QToolBar; +class QWidget; +class QDockWidget; + +namespace pv { + +class DeviceManager; + +namespace toolbars { +class SamplingBar; +class DeviceBar; +class TrigBar; +class FileBar; +class LogoBar; +} + +namespace dock{ +class ProtocolDock; +class TriggerDock; +class MeasureDock; +class SearchDock; +} + +namespace view { +class View; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(DeviceManager &device_manager, + const char *open_file_name = NULL, + QWidget *parent = 0); + +private: + void setup_ui(); + + void session_error(const QString text, const QString info_text); + + /** + * Updates the device list in the sampling bar, and updates the + * selection. + * @param selected_device The device to select, or NULL if the + * first device in the device list should be selected. + */ + void update_device_list( + struct sr_dev_inst *selected_device = NULL); + + void device_change(); + +private slots: + void load_file(QString file_name); + + + void show_session_error( + const QString text, const QString info_text); + + void device_selected(); + + void run_stop(); + + void test_data_error(); + + void capture_state_changed(int state); + + void init(); + + void update(); + + void on_protocol(bool visible); + + void on_trigger(bool visible); + + void on_measure(bool visible); + + void on_search(bool visible); + + void on_screenShot(); + + /* + * hotplug slot function + */ + void device_attach(); + void device_detach(); + +private: + DeviceManager &_device_manager; + + SigSession _session; + + pv::view::View *_view; + + QMenuBar *_menu_bar; + QMenu *_menu_file; + QAction *_action_open; + QAction *_action_connect; + QAction *_action_quit; + + QMenu *_menu_view; + QAction *_action_view_zoom_in; + QAction *_action_view_zoom_out; + QAction *_action_view_show_cursors; + + QMenu *_menu_help; + QAction *_action_about; + + QWidget *_central_widget; + QVBoxLayout *_vertical_layout; + + toolbars::SamplingBar *_sampling_bar; + toolbars::DeviceBar *_device_bar; + toolbars::TrigBar *_trig_bar; + toolbars::FileBar *_file_bar; + toolbars::LogoBar *_logo_bar; + + QDockWidget *_protocol_dock; + dock::ProtocolDock *_protocol_widget; + QDockWidget *_trigger_dock; + dock::TriggerDock *_trigger_widget; + QDockWidget *_measure_dock; + QDockWidget *_search_dock; + dock::SearchDock * _search_widget; +}; + +} // namespace pv + +#endif // DSLOGIC_PV_MAINWINDOW_H diff --git a/DSLogic-gui/pv/prop/binding/binding.cpp b/DSLogic-gui/pv/prop/binding/binding.cpp new file mode 100644 index 00000000..e2ddd6a8 --- /dev/null +++ b/DSLogic-gui/pv/prop/binding/binding.cpp @@ -0,0 +1,37 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "binding.h" + +namespace pv { +namespace prop { +namespace binding { + +const std::vector< boost::shared_ptr >& Binding::properties() +{ + return _properties; +} + +} // binding +} // prop +} // pv diff --git a/DSLogic-gui/pv/prop/binding/binding.h b/DSLogic-gui/pv/prop/binding/binding.h new file mode 100644 index 00000000..fdf4fe8d --- /dev/null +++ b/DSLogic-gui/pv/prop/binding/binding.h @@ -0,0 +1,54 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_PROP_BINDING_BINDING_H +#define DSLOGIC_PV_PROP_BINDING_BINDING_H + +#include +#include + +class QWidget; + +namespace pv { +namespace prop { + +class Property; + +namespace binding { + +class Binding +{ +public: + const std::vector< boost::shared_ptr >& properties(); + +protected: + std::vector< boost::shared_ptr > _properties; + + QWidget *_form; +}; + +} // binding +} // prop +} // pv + +#endif // DSLOGIC_PV_PROP_BINDING_BINDING_H diff --git a/DSLogic-gui/pv/prop/binding/binding_deviceoptions.cpp b/DSLogic-gui/pv/prop/binding/binding_deviceoptions.cpp new file mode 100644 index 00000000..189afccf --- /dev/null +++ b/DSLogic-gui/pv/prop/binding/binding_deviceoptions.cpp @@ -0,0 +1,268 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#include +#include + +#include + +#include "deviceoptions.h" + +#include +#include +#include +#include + +using namespace boost; +using namespace std; + +namespace pv { +namespace prop { +namespace binding { + +DeviceOptions::DeviceOptions(struct sr_dev_inst *sdi) : + _sdi(sdi) +{ + GVariant *gvar_opts, *gvar_list; + gsize num_opts; + + if ((sr_config_list(sdi->driver, SR_CONF_DEVICE_CONFIGS, + &gvar_opts, sdi) != SR_OK)) + /* Driver supports no device instance options. */ + return; + + const int *const options = (const int32_t *)g_variant_get_fixed_array( + gvar_opts, &num_opts, sizeof(int32_t)); + for (unsigned int i = 0; i < num_opts; i++) { + const struct sr_config_info *const info = + sr_config_info_get(options[i]); + + if (!info) + continue; + + const int key = info->key; + + if(sr_config_list(_sdi->driver, key, &gvar_list, _sdi) != SR_OK) + gvar_list = NULL; + + const QString name(info->name); + + switch(key) + { + case SR_CONF_SAMPLERATE: + bind_samplerate(name, gvar_list); + break; + + case SR_CONF_CAPTURE_RATIO: + bind_int(name, key, "%", pair(0, 100)); + break; + + case SR_CONF_DEVICE_MODE: + case SR_CONF_PATTERN_MODE: + case SR_CONF_BUFFERSIZE: + case SR_CONF_TRIGGER_SOURCE: + case SR_CONF_FILTER: + case SR_CONF_COUPLING: + bind_enum(name, key, gvar_list); + break; + + case SR_CONF_RLE: + bind_bool(name, key); + break; + + case SR_CONF_CLOCK_TYPE: + bind_bool(name, key); + break; + + case SR_CONF_TIMEBASE: + bind_enum(name, key, gvar_list, print_timebase); + break; + + case SR_CONF_VDIV: + bind_enum(name, key, gvar_list, print_vdiv); + break; + } + + if (gvar_list) + g_variant_unref(gvar_list); + } + g_variant_unref(gvar_opts); +} + +GVariant* DeviceOptions::config_getter( + const struct sr_dev_inst *sdi, int key) +{ + GVariant *data = NULL; + if (sr_config_get(sdi->driver, key, &data, sdi) != SR_OK) { + qDebug() << + "WARNING: Failed to get value of config id" << key; + return NULL; + } + return data; +} + +void DeviceOptions::config_setter( + const struct sr_dev_inst *sdi, int key, GVariant* value) +{ + if (sr_config_set(sdi, key, value) != SR_OK) + qDebug() << "WARNING: Failed to set value of sample rate"; +} + +void DeviceOptions::bind_bool(const QString &name, int key) +{ + _properties.push_back(shared_ptr( + new Bool(name, bind(config_getter, _sdi, key), + bind(config_setter, _sdi, key, _1)))); +} + +void DeviceOptions::bind_enum(const QString &name, int key, + GVariant *const gvar_list, function printer) +{ + GVariant *gvar; + GVariantIter iter; + vector< pair > values; + + assert(gvar_list); + + g_variant_iter_init (&iter, gvar_list); + while ((gvar = g_variant_iter_next_value (&iter))) + values.push_back(make_pair(gvar, printer(gvar))); + + _properties.push_back(shared_ptr( + new Enum(name, values, + bind(config_getter, _sdi, key), + bind(config_setter, _sdi, key, _1)))); +} + +void DeviceOptions::bind_int(const QString &name, int key, QString suffix, + optional< std::pair > range) +{ + _properties.push_back(shared_ptr( + new Int(name, suffix, range, + bind(config_getter, _sdi, key), + bind(config_setter, _sdi, key, _1)))); +} + +QString DeviceOptions::print_gvariant(GVariant *const gvar) +{ + QString s; + + if (g_variant_is_of_type(gvar, G_VARIANT_TYPE("s"))) + s = QString(g_variant_get_string(gvar, NULL)); + else + { + gchar *const text = g_variant_print(gvar, FALSE); + s = QString(text); + g_free(text); + } + + return s; +} + +void DeviceOptions::bind_samplerate(const QString &name, + GVariant *const gvar_list) +{ + GVariant *gvar_list_samplerates; + + assert(gvar_list); + + if ((gvar_list_samplerates = g_variant_lookup_value(gvar_list, + "samplerate-steps", G_VARIANT_TYPE("at")))) + { + gsize num_elements; + const uint64_t *const elements = + (const uint64_t *)g_variant_get_fixed_array( + gvar_list_samplerates, &num_elements, sizeof(uint64_t)); + + assert(num_elements == 3); + + _properties.push_back(shared_ptr( + new Double(name, 0, QObject::tr("Hz"), + make_pair((double)elements[0], (double)elements[1]), + (double)elements[2], + bind(samplerate_double_getter, _sdi), + bind(samplerate_double_setter, _sdi, _1)))); + + g_variant_unref(gvar_list_samplerates); + } + else if ((gvar_list_samplerates = g_variant_lookup_value(gvar_list, + "samplerates", G_VARIANT_TYPE("at")))) + { + bind_enum(name, SR_CONF_SAMPLERATE, + gvar_list_samplerates, print_samplerate); + g_variant_unref(gvar_list_samplerates); + } +} + +QString DeviceOptions::print_samplerate(GVariant *const gvar) +{ + char *const s = sr_samplerate_string( + g_variant_get_uint64(gvar)); + const QString qstring(s); + g_free(s); + return qstring; +} + +GVariant* DeviceOptions::samplerate_double_getter( + const struct sr_dev_inst *sdi) +{ + GVariant *const gvar = config_getter(sdi, SR_CONF_SAMPLERATE); + + if(!gvar) + return NULL; + + GVariant *const gvar_double = g_variant_new_double( + g_variant_get_uint64(gvar)); + + g_variant_unref(gvar); + + return gvar_double; +} + +void DeviceOptions::samplerate_double_setter( + struct sr_dev_inst *sdi, GVariant *value) +{ + GVariant *const gvar = g_variant_new_uint64( + g_variant_get_double(value)); + config_setter(sdi, SR_CONF_SAMPLERATE, gvar); +} + +QString DeviceOptions::print_timebase(GVariant *const gvar) +{ + uint64_t p, q; + g_variant_get(gvar, "(tt)", &p, &q); + return QString(sr_period_string(p * q)); +} + +QString DeviceOptions::print_vdiv(GVariant *const gvar) +{ + uint64_t p, q; + g_variant_get(gvar, "(tt)", &p, &q); + return QString(sr_voltage_string(p, q)); +} + +} // binding +} // prop +} // pv + diff --git a/DSLogic-gui/pv/prop/binding/deviceoptions.h b/DSLogic-gui/pv/prop/binding/deviceoptions.h new file mode 100644 index 00000000..7d9f1f83 --- /dev/null +++ b/DSLogic-gui/pv/prop/binding/deviceoptions.h @@ -0,0 +1,80 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_PROP_BINDING_DEVICEOPTIONS_H +#define DSLOGIC_PV_PROP_BINDING_DEVICEOPTIONS_H + +#include +#include + +#include + +#include + +#include "binding.h" + +namespace pv { +namespace prop { +namespace binding { + +class DeviceOptions : public Binding +{ +public: + DeviceOptions(struct sr_dev_inst *sdi); + +private: + + static GVariant* config_getter( + const struct sr_dev_inst *sdi, int key); + static void config_setter( + const struct sr_dev_inst *sdi, int key, GVariant* value); + + void bind_bool(const QString &name, int key); + void bind_enum(const QString &name, int key, + GVariant *const gvar_list, + boost::function printer = print_gvariant); + void bind_int(const QString &name, int key, QString suffix, + boost::optional< std::pair > range); + + static QString print_gvariant(GVariant *const gvar); + + void bind_samplerate(const QString &name, + GVariant *const gvar_list); + static QString print_samplerate(GVariant *const gvar); + static GVariant* samplerate_double_getter( + const struct sr_dev_inst *sdi); + static void samplerate_double_setter( + struct sr_dev_inst *sdi, GVariant *value); + + static QString print_timebase(GVariant *const gvar); + static QString print_vdiv(GVariant *const gvar); + +protected: + struct sr_dev_inst *const _sdi; +}; + +} // binding +} // prop +} // pv + +#endif // DSLOGIC_PV_PROP_BINDING_DEVICEOPTIONS_H diff --git a/DSLogic-gui/pv/prop/bool.cpp b/DSLogic-gui/pv/prop/bool.cpp new file mode 100644 index 00000000..996cbde2 --- /dev/null +++ b/DSLogic-gui/pv/prop/bool.cpp @@ -0,0 +1,81 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include + +#include + +#include "bool.h" + +using namespace std; +using namespace boost; + +namespace pv { +namespace prop { + +Bool::Bool(QString name, Getter getter, Setter setter) : + Property(name, getter, setter), + _check_box(NULL) +{ +} + +Bool::~Bool() +{ +} + +QWidget* Bool::get_widget(QWidget *parent) +{ + if (_check_box) + return _check_box; + + _check_box = new QCheckBox(name(), parent); + + GVariant *const value = _getter ? _getter() : NULL; + + if (value) { + _check_box->setCheckState(g_variant_get_boolean(value) ? + Qt::Checked : Qt::Unchecked); + g_variant_unref(value); + } + + return _check_box; +} + +bool Bool::labeled_widget() const +{ + return true; +} + +void Bool::commit() +{ + assert(_setter); + + if (!_check_box) + return; + + _setter(g_variant_new_boolean( + _check_box->checkState() == Qt::Checked)); +} + +} // prop +} // pv diff --git a/DSLogic-gui/pv/prop/bool.h b/DSLogic-gui/pv/prop/bool.h new file mode 100644 index 00000000..a48f52f2 --- /dev/null +++ b/DSLogic-gui/pv/prop/bool.h @@ -0,0 +1,53 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_PROP_BOOL_H +#define DSLOGIC_PV_PROP_BOOL_H + +#include "property.h" + +class QCheckBox; + +namespace pv { +namespace prop { + +class Bool : public Property +{ +public: + Bool(QString name, Getter getter, Setter setter); + + virtual ~Bool(); + + QWidget* get_widget(QWidget *parent); + bool labeled_widget() const; + + void commit(); + +private: + QCheckBox *_check_box; +}; + +} // prop +} // pv + +#endif // DSLOGIC_PV_PROP_BOOL_H diff --git a/DSLogic-gui/pv/prop/double.cpp b/DSLogic-gui/pv/prop/double.cpp new file mode 100644 index 00000000..b8045759 --- /dev/null +++ b/DSLogic-gui/pv/prop/double.cpp @@ -0,0 +1,90 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include + +#include + +#include "double.h" + +using namespace std; +using namespace boost; + +namespace pv { +namespace prop { + +Double::Double(QString name, + int decimals, + QString suffix, + optional< pair > range, + optional step, + Getter getter, + Setter setter) : + Property(name, getter, setter), + _decimals(decimals), + _suffix(suffix), + _range(range), + _step(step), + _spin_box(NULL) +{ +} + +Double::~Double() +{ +} + +QWidget* Double::get_widget(QWidget *parent) +{ + if (_spin_box) + return _spin_box; + + _spin_box = new QDoubleSpinBox(parent); + _spin_box->setDecimals(_decimals); + _spin_box->setSuffix(_suffix); + if (_range) + _spin_box->setRange(_range->first, _range->second); + if (_step) + _spin_box->setSingleStep(*_step); + + GVariant *const value = _getter ? _getter() : NULL; + + if (value) { + _spin_box->setValue(g_variant_get_double(value)); + g_variant_unref(value); + } + + return _spin_box; +} + +void Double::commit() +{ + assert(_setter); + + if (!_spin_box) + return; + + _setter(g_variant_new_double(_spin_box->value())); +} + +} // prop +} // pv diff --git a/DSLogic-gui/pv/prop/double.h b/DSLogic-gui/pv/prop/double.h new file mode 100644 index 00000000..47ef17de --- /dev/null +++ b/DSLogic-gui/pv/prop/double.h @@ -0,0 +1,65 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_PROP_DOUBLE_H +#define DSLOGIC_PV_PROP_DOUBLE_H + +#include + +#include + +#include "property.h" + +class QDoubleSpinBox; + +namespace pv { +namespace prop { + +class Double : public Property +{ +public: + Double(QString name, int decimals, QString suffix, + boost::optional< std::pair > range, + boost::optional step, + Getter getter, + Setter setter); + + virtual ~Double(); + + QWidget* get_widget(QWidget *parent); + + void commit(); + +private: + const int _decimals; + const QString _suffix; + const boost::optional< std::pair > _range; + const boost::optional _step; + + QDoubleSpinBox *_spin_box; +}; + +} // prop +} // pv + +#endif // DSLOGIC_PV_PROP_DOUBLE_H diff --git a/DSLogic-gui/pv/prop/enum.cpp b/DSLogic-gui/pv/prop/enum.cpp new file mode 100644 index 00000000..edf6584a --- /dev/null +++ b/DSLogic-gui/pv/prop/enum.cpp @@ -0,0 +1,86 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include + +#include + +#include "enum.h" + +using namespace boost; +using namespace std; + +namespace pv { +namespace prop { + +Enum::Enum(QString name, + vector > values, + Getter getter, Setter setter) : + Property(name, getter, setter), + _values(values), + _selector(NULL) +{ +} + +Enum::~Enum() +{ + for (unsigned int i = 0; i < _values.size(); i++) + g_variant_unref(_values[i].first); +} + +QWidget* Enum::get_widget(QWidget *parent) +{ + if (_selector) + return _selector; + + GVariant *const value = _getter ? _getter() : NULL; + + _selector = new QComboBox(parent); + for (unsigned int i = 0; i < _values.size(); i++) { + const pair &v = _values[i]; + _selector->addItem(v.second, qVariantFromValue((void*)v.first)); + if (value && g_variant_compare(v.first, value) == 0) + _selector->setCurrentIndex(i); + } + + g_variant_unref(value); + + return _selector; +} + +void Enum::commit() +{ + assert(_setter); + + if (!_selector) + return; + + const int index = _selector->currentIndex(); + if (index < 0) + return; + + _setter((GVariant*)_selector->itemData(index).value()); +} + +} // prop +} // pv diff --git a/DSLogic-gui/pv/prop/enum.h b/DSLogic-gui/pv/prop/enum.h new file mode 100644 index 00000000..c26e512e --- /dev/null +++ b/DSLogic-gui/pv/prop/enum.h @@ -0,0 +1,58 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_PROP_ENUM_H +#define DSLOGIC_PV_PROP_ENUM_H + +#include +#include + +#include "property.h" + +class QComboBox; + +namespace pv { +namespace prop { + +class Enum : public Property +{ +public: + Enum(QString name, std::vector > values, + Getter getter, Setter setter); + + virtual ~Enum(); + + QWidget* get_widget(QWidget *parent); + + void commit(); + +private: + const std::vector< std::pair > _values; + + QComboBox *_selector; +}; + +} // prop +} // pv + +#endif // DSLOGIC_PV_PROP_ENUM_H diff --git a/DSLogic-gui/pv/prop/int.cpp b/DSLogic-gui/pv/prop/int.cpp new file mode 100644 index 00000000..741b8796 --- /dev/null +++ b/DSLogic-gui/pv/prop/int.cpp @@ -0,0 +1,82 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include + +#include + +#include "int.h" + +using namespace std; +using namespace boost; + +namespace pv { +namespace prop { + +Int::Int(QString name, + QString suffix, + optional< pair > range, + Getter getter, + Setter setter) : + Property(name, getter, setter), + _suffix(suffix), + _range(range), + _spin_box(NULL) +{ +} + +Int::~Int() +{ +} + +QWidget* Int::get_widget(QWidget *parent) +{ + if (_spin_box) + return _spin_box; + + _spin_box = new QSpinBox(parent); + _spin_box->setSuffix(_suffix); + if (_range) + _spin_box->setRange((int)_range->first, (int)_range->second); + + GVariant *const value = _getter ? _getter() : NULL; + if (value) { + _spin_box->setValue((int)g_variant_get_int64(value)); + g_variant_unref(value); + } + + return _spin_box; +} + +void Int::commit() +{ + assert(_setter); + + if (!_spin_box) + return; + + _setter(g_variant_new_int64(_spin_box->value())); +} + +} // prop +} // pv diff --git a/DSLogic-gui/pv/prop/int.h b/DSLogic-gui/pv/prop/int.h new file mode 100644 index 00000000..b9ae22ba --- /dev/null +++ b/DSLogic-gui/pv/prop/int.h @@ -0,0 +1,61 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_PROP_INT_H +#define DSLOGIC_PV_PROP_INT_H + +#include + +#include + +#include "property.h" + +class QSpinBox; + +namespace pv { +namespace prop { + +class Int : public Property +{ +public: + Int(QString name, QString suffix, + boost::optional< std::pair > range, + Getter getter, Setter setter); + + virtual ~Int(); + + QWidget* get_widget(QWidget *parent); + + void commit(); + +private: + const QString _suffix; + const boost::optional< std::pair > _range; + + QSpinBox *_spin_box; +}; + +} // prop +} // pv + +#endif // DSLOGIC_PV_PROP_INT_H diff --git a/DSLogic-gui/pv/prop/property.cpp b/DSLogic-gui/pv/prop/property.cpp new file mode 100644 index 00000000..907278b5 --- /dev/null +++ b/DSLogic-gui/pv/prop/property.cpp @@ -0,0 +1,47 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "property.h" + +namespace pv { +namespace prop { + +Property::Property(QString name, Getter getter, Setter setter) : + _getter(getter), + _setter(setter), + _name(name) +{ +} + +const QString& Property::name() const +{ + return _name; +} + +bool Property::labeled_widget() const +{ + return false; +} + +} // prop +} // pv diff --git a/DSLogic-gui/pv/prop/property.h b/DSLogic-gui/pv/prop/property.h new file mode 100644 index 00000000..61e880cd --- /dev/null +++ b/DSLogic-gui/pv/prop/property.h @@ -0,0 +1,67 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_PROP_PROPERTY_H +#define DSLOGIC_PV_PROP_PROPERTY_H + +#include + +#include + +#include +#include + +class QWidget; + +namespace pv { +namespace prop { + +class Property +{ +public: + typedef boost::function Getter; + typedef boost::function Setter; + +protected: + Property(QString name, Getter getter, Setter setter); + +public: + const QString& name() const; + + virtual QWidget* get_widget(QWidget *parent) = 0; + virtual bool labeled_widget() const; + + virtual void commit() = 0; + +protected: + const Getter _getter; + const Setter _setter; + +private: + QString _name; +}; + +} // prop +} // pv + +#endif // DSLOGIC_PV_PROP_PROPERTY_H diff --git a/DSLogic-gui/pv/sigsession.cpp b/DSLogic-gui/pv/sigsession.cpp new file mode 100644 index 00000000..684f346c --- /dev/null +++ b/DSLogic-gui/pv/sigsession.cpp @@ -0,0 +1,1129 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "sigsession.h" + +#include "devicemanager.h" +#include "data/analog.h" +#include "data/analogsnapshot.h" +#include "data/logic.h" +#include "data/logicsnapshot.h" +#include "data/group.h" +#include "data/groupsnapshot.h" +#include "view/analogsignal.h" +#include "view/logicsignal.h" +#include "view/groupsignal.h" +#include "view/protocolsignal.h" +#include "decoder/decoder.h" +#include "decoder/decoderfactory.h" + +#include + +#include +#include + +#include + +using namespace boost; +using namespace std; + +namespace pv { + +const float SigSession::Oversampling = 2.0f; + +// TODO: This should not be necessary +SigSession* SigSession::_session = NULL; + +SigSession::SigSession(DeviceManager &device_manager) : + _device_manager(device_manager), + _sdi(NULL), + _capture_state(Init), + _last_sample_rate(1), + _total_sample_len(1), + _hot_plug_handle(NULL) +{ + // TODO: This should not be necessary + _session = this; + _hot_attach = false; + _hot_detach = false; + _adv_trigger = false; + _group_cnt = 0; + _protocol_cnt = 0; + _decoderFactory = new decoder::DecoderFactory(); + ds_trigger_init(); +} + +SigSession::~SigSession() +{ + stop_capture(); + + if (_sampling_thread.get()) + _sampling_thread->join(); + _sampling_thread.reset(); + + if (_hot_plug_handle) + stop_hot_plug_proc(); + + ds_trigger_destroy(); + + // TODO: This should not be necessary + _session = NULL; +} + +quint64 SigSession::get_last_sample_rate() const +{ + return _last_sample_rate; +} + +quint64 SigSession::get_total_sample_len() const +{ + return _total_sample_len; +} + +void SigSession::set_total_sample_len(quint64 length) +{ + _total_sample_len = length; +} + +struct sr_dev_inst* SigSession::get_device() const +{ + return _sdi; +} + +int SigSession::set_device(struct sr_dev_inst *sdi) +{ + int ret = SR_ERR; + + if (sdi) + ret = _device_manager.use_device(sdi, this); + if (ret == SR_OK && (sdi != _sdi) && _sdi) { + _device_manager.release_device(_sdi); + } + if (ret == SR_OK) + _sdi = sdi; + + set_capture_state(Init); + + return ret; +} + +void SigSession::release_device(struct sr_dev_inst *sdi) +{ + (void)sdi; + + assert(_capture_state != Running); + _sdi = NULL; +} + +void SigSession::save_file(const std::string &name){ + if (_sdi->mode == LOGIC) { + const deque< shared_ptr > &snapshots = + _logic_data->get_snapshots(); + if (snapshots.empty()) + return; + + const shared_ptr &snapshot = + snapshots.front(); + + sr_session_save(name.c_str(), _sdi, + (unsigned char*)snapshot->get_data(), + snapshot->get_unit_size(), + snapshot->get_sample_count()); + } else { + const deque< shared_ptr > &snapshots = + _analog_data->get_snapshots(); + if (snapshots.empty()) + return; + + const shared_ptr &snapshot = + snapshots.front(); + + sr_session_save(name.c_str(), _sdi, + (unsigned char*)snapshot->get_data(), + snapshot->get_unit_size(), + snapshot->get_sample_count()); + } +} + +void SigSession::load_file(const string &name, + function error_handler) +{ + stop_capture(); + _sampling_thread.reset(new boost::thread( + &SigSession::load_thread_proc, this, name, + error_handler)); +} + +SigSession::capture_state SigSession::get_capture_state() const +{ + lock_guard lock(_sampling_mutex); + return _capture_state; +} + +void SigSession::start_capture(uint64_t record_length, + function error_handler) +{ + stop_capture(); + + // Check that a device instance has been selected. + if (!_sdi) { + qDebug() << "No device selected"; + return; + } + + // Check that at least one probe is enabled + const GSList *l; + for (l = _sdi->probes; l; l = l->next) { + sr_probe *const probe = (sr_probe*)l->data; + assert(probe); + if (probe->enabled) + break; + } + + if (!l) { + error_handler(tr("No probes enabled.")); + return; + } + + // Begin the session + _sampling_thread.reset(new boost::thread( + &SigSession::sample_thread_proc, this, _sdi, + record_length, error_handler)); +} + +void SigSession::stop_capture() +{ + if (get_capture_state() == Stopped) + return; + + sr_session_stop(); + + // Check that sampling stopped + if (_sampling_thread.get()) + _sampling_thread->join(); + _sampling_thread.reset(); +} + +vector< shared_ptr > SigSession::get_signals() +{ + lock_guard lock(_signals_mutex); + return _signals; +} + +vector< shared_ptr > SigSession::get_pro_signals() +{ + lock_guard lock(_signals_mutex); + return _protocol_signals; +} + +int SigSession::get_logic_probe_cnt(const sr_dev_inst *sdi) +{ + unsigned int logic_probe_cnt = 0; + // Detect what data types we will receive + for (const GSList *l = sdi->probes; l; l = l->next) { + const sr_probe *const probe = (const sr_probe *)l->data; + if (!probe->enabled) + continue; + + switch(probe->type) { + case SR_PROBE_LOGIC: + logic_probe_cnt++; + break; + } + } + + return logic_probe_cnt; +} + +int SigSession::get_analog_probe_cnt(const sr_dev_inst *sdi) +{ + unsigned int analog_probe_cnt = 0; + for (const GSList *l = sdi->probes; l; l = l->next) { + const sr_probe *const probe = (const sr_probe *)l->data; + if (!probe->enabled) + continue; + + switch(probe->type) { + case SR_PROBE_ANALOG: + analog_probe_cnt++; + break; + } + } + + return analog_probe_cnt; +} + +boost::shared_ptr SigSession::get_data() +{ + return _logic_data; +} + +void* SigSession::get_buf(int& unit_size, uint64_t &length) +{ + if (_sdi->mode == LOGIC) { + const deque< shared_ptr > &snapshots = + _logic_data->get_snapshots(); + if (snapshots.empty()) + return NULL; + + const shared_ptr &snapshot = + snapshots.front(); + + unit_size = snapshot->get_unit_size(); + length = snapshot->get_sample_count(); + return snapshot->get_data(); + } else { + const deque< shared_ptr > &snapshots = + _analog_data->get_snapshots(); + if (snapshots.empty()) + return NULL; + + const shared_ptr &snapshot = + snapshots.front(); + + unit_size = snapshot->get_unit_size(); + length = snapshot->get_sample_count(); + return snapshot->get_data(); + } +} + +void SigSession::set_capture_state(capture_state state) +{ + lock_guard lock(_sampling_mutex); + _capture_state = state; + data_updated(); + capture_state_changed(state); +} + +void SigSession::load_thread_proc(const string name, + function error_handler) +{ + if (sr_session_load(name.c_str()) != SR_OK) { + error_handler(tr("Failed to load file.")); + return; + } + + sr_session_datafeed_callback_add(data_feed_in_proc, NULL); + + if (sr_session_start() != SR_OK) { + error_handler(tr("Failed to start session.")); + return; + } + + set_capture_state(Running); + + sr_session_run(); + sr_session_destroy(); + + set_capture_state(Stopped); + + // Confirm that SR_DF_END was received + assert(!_cur_logic_snapshot); + assert(!_cur_analog_snapshot); +} + +void SigSession::sample_thread_proc(struct sr_dev_inst *sdi, + uint64_t record_length, + function error_handler) +{ +// while(1) { + assert(sdi); + assert(error_handler); + + if (!_adv_trigger) { + /* simple trigger check trigger_enable */ + ds_trigger_set_en(false); + BOOST_FOREACH(const shared_ptr s, _signals) + { + assert(s); + if (s->get_trig() != 0) { + ds_trigger_set_en(true); + s->set_trig(s->get_trig()); + } + } + } else { + /* advanced trigger check trigger_enable */ + ds_trigger_set_en(true); + } + + sr_session_new(); + sr_session_datafeed_callback_add(data_feed_in_proc, NULL); + + if (sr_session_dev_add(sdi) != SR_OK) { + error_handler(tr("Failed to use device.")); + sr_session_destroy(); + return; + } + + // Set the sample limit + if (sr_config_set(sdi, SR_CONF_LIMIT_SAMPLES, + g_variant_new_uint64(record_length)) != SR_OK) { + error_handler(tr("Failed to configure " + "time-based sample limit.")); + sr_session_destroy(); + return; + } + + receive_data(0); + set_capture_state(Running); + + if (sr_session_start() != SR_OK) { + error_handler(tr("Failed to start session.")); + set_capture_state(Stopped); + return; + } + + sr_session_run(); + sr_session_destroy(); + + set_capture_state(Stopped); + + // Confirm that SR_DF_END was received + assert(!_cur_logic_snapshot); + assert(!_cur_analog_snapshot); + +// g_usleep(3000*1000); +// } +} + +void SigSession::feed_in_header(const sr_dev_inst *sdi) +{ + shared_ptr signal; + GVariant *gvar; + uint64_t sample_rate = 0; + unsigned int logic_probe_count = 0; + unsigned int analog_probe_count = 0; + + // Detect what data types we will receive + for (const GSList *l = sdi->probes; l; l = l->next) { + const sr_probe *const probe = (const sr_probe *)l->data; + if (!probe->enabled) + continue; + + switch(probe->type) { + case SR_PROBE_LOGIC: + logic_probe_count++; + break; + + case SR_PROBE_ANALOG: + analog_probe_count++; + break; + } + } + + // Read out the sample rate + assert(sdi->driver); + + int ret = sr_config_get(sdi->driver, SR_CONF_SAMPLERATE, + &gvar, sdi); + if (ret != SR_OK) { + qDebug("Failed to get samplerate\n"); + return; + } + sample_rate = g_variant_get_uint64(gvar); + g_variant_unref(gvar); + + ret = sr_config_get(sdi->driver, SR_CONF_LIMIT_SAMPLES, + &gvar, sdi); + if (ret != SR_OK) { + qDebug("Failed to get total samples"); + return; + } + if (g_variant_get_uint64(gvar) != 0) + _total_sample_len = g_variant_get_uint64(gvar); + g_variant_unref(gvar); + + if (sample_rate != _last_sample_rate) { + _last_sample_rate = sample_rate; + sample_rate_changed(sample_rate); + } + + // Create data containers for the coming data snapshots + { + lock_guard data_lock(_data_mutex); + + if (logic_probe_count != 0) { + _logic_data.reset(new data::Logic( + logic_probe_count, sample_rate)); + assert(_logic_data); + + _group_data.reset(new data::Group(logic_probe_count, sample_rate)); + assert(_group_data); + } + + if (analog_probe_count != 0) { + _analog_data.reset(new data::Analog(analog_probe_count, sample_rate)); + assert(_analog_data); + } + } + + // Set Signal data + { + BOOST_FOREACH(const shared_ptr s, _signals) + { + assert(s); + s->set_data(_logic_data, _analog_data, _group_data); + } + + receive_data(0); + //signals_changed(); + } +} + +void SigSession::add_group() +{ + std::list probe_index_list; + + std::vector< boost::shared_ptr >::iterator i = _signals.begin(); + while (i != _signals.end()) { + if ((*i)->get_type() == view::Signal::DS_LOGIC && (*i)->selected()) + probe_index_list.push_back((*i)->get_index()); + i++; + } + + if (probe_index_list.size() > 1) { + //_group_data.reset(new data::Group(_last_sample_rate)); + const shared_ptr signal = shared_ptr( + new view::GroupSignal("New Group", + _group_data, probe_index_list, _signals.size(), _group_cnt)); + _signals.push_back(signal); + _group_cnt++; + + if (_capture_state == Stopped) { + if (!_cur_group_snapshot) + { + // Create a new data snapshot + _cur_group_snapshot = shared_ptr( + new data::GroupSnapshot(_logic_data->get_snapshots().front(), signal->get_index_list())); + //_cur_group_snapshot->append_payload(); + _group_data->push_snapshot(_cur_group_snapshot); + _cur_group_snapshot.reset(); + } + } + + signals_changed(); + data_updated(); + } +} + +void SigSession::del_group() +{ + std::vector< boost::shared_ptr >::iterator i = _signals.begin(); + while (i != _signals.end()) { + if ((*i)->get_type() == view::Signal::DS_GROUP) { + if ((*i)->selected()) { + std::vector< boost::shared_ptr >::iterator j = _signals.begin(); + while(j != _signals.end()) { + if ((*j)->get_order() > (*i)->get_order()) + (*j)->set_order((*j)->get_order() - 1); + if ((*j)->get_sec_index() > (*i)->get_sec_index()) + (*j)->set_sec_index((*j)->get_sec_index() - 1); + j++; + } + + _group_data->get_snapshots().at((*i)->get_sec_index()).reset(); + std::deque< boost::shared_ptr >::iterator k = _group_data->get_snapshots().begin(); + k += (*i)->get_sec_index(); + _group_data->get_snapshots().erase(k); + + (*i).reset(); + i = _signals.erase(i); + + _group_cnt--; + continue; + } + } + i++; + } + + signals_changed(); + data_updated(); +} + +void SigSession::add_protocol(std::list probe_index_list, decoder::Decoder *decoder) +{ + assert(_logic_data); + + std::vector< boost::shared_ptr >::iterator i = _signals.begin(); + while (i != _signals.end()) { + (*i)->set_order((*i)->get_order() + 1); + i++; + } + + if (probe_index_list.size() > 0) { + //_group_data.reset(new data::Group(_last_sample_rate)); + const shared_ptr signal = shared_ptr( + new view::ProtocolSignal(decoder->get_decode_name(), + _logic_data, decoder, probe_index_list, 0, _protocol_cnt)); + _signals.push_back(signal); + _protocol_cnt++; + + signals_changed(); + data_updated(); + } +} + +void SigSession::del_protocol(int protocol_index) +{ + std::vector< boost::shared_ptr >::iterator i = _signals.begin(); + while (i != _signals.end()) { + if ((*i)->get_type() == view::Signal::DS_PROTOCOL) { + if ((*i)->get_sec_index() == protocol_index) { + std::vector< boost::shared_ptr >::iterator j = _signals.begin(); + while(j != _signals.end()) { + if ((*j)->get_order() > (*i)->get_order()) + (*j)->set_order((*j)->get_order() - 1); + if ((*j)->get_sec_index() > (*i)->get_sec_index()) + (*j)->set_sec_index((*j)->get_sec_index() - 1); + j++; + } + + (*i).reset(); + i = _signals.erase(i); + + _protocol_cnt--; + break; + } + } + i++; + } + + signals_changed(); + data_updated(); +} + +void SigSession::del_signal(std::vector< boost::shared_ptr >::iterator i) +{ + std::vector< boost::shared_ptr >::iterator j = _signals.begin(); + while(j != _signals.end()) { + if ((*j)->get_order() > (*i)->get_order()) + (*j)->set_order((*j)->get_order() - 1); + j++; + } + + (*i).reset(); + _signals.erase(i); +} + +void SigSession::init_signals(const sr_dev_inst *sdi) +{ + shared_ptr signal; + GVariant *gvar; + uint64_t sample_rate = 0; + unsigned int logic_probe_count = 0; + unsigned int analog_probe_count = 0; + + // Detect what data types we will receive + for (const GSList *l = sdi->probes; l; l = l->next) { + const sr_probe *const probe = (const sr_probe *)l->data; + if (!probe->enabled) + continue; + + switch(probe->type) { + case SR_PROBE_LOGIC: + logic_probe_count++; + break; + + case SR_PROBE_ANALOG: + analog_probe_count++; + break; + } + } + + // Read out the sample rate + assert(sdi->driver); + + const int ret = sr_config_get(sdi->driver, SR_CONF_SAMPLERATE, + &gvar, sdi); + if (ret != SR_OK) { + qDebug("Failed to get samplerate\n"); + return; + } + + sample_rate = g_variant_get_uint64(gvar); + g_variant_unref(gvar); + + if (sample_rate != _last_sample_rate) { + _last_sample_rate = sample_rate; + sample_rate_changed(sample_rate); + } + + // Create data containers for the coming data snapshots + { + if (logic_probe_count != 0) { + _logic_data.reset(new data::Logic( + logic_probe_count, sample_rate)); + assert(_logic_data); + + _group_data.reset(new data::Group(logic_probe_count, sample_rate)); + assert(_group_data); + _group_cnt = 0; + } + + if (analog_probe_count != 0) { + _analog_data.reset(new data::Analog(analog_probe_count, sample_rate)); + assert(_analog_data); + } + } + + // Make the logic probe list + { + _signals.clear(); + + for (const GSList *l = sdi->probes; l; l = l->next) { + const sr_probe *const probe = + (const sr_probe *)l->data; + assert(probe); + if (!probe->enabled) + continue; + + switch(probe->type) { + case SR_PROBE_LOGIC: + signal = shared_ptr( + new view::LogicSignal(probe->name, + _logic_data, probe->index, _signals.size())); + break; + + case SR_PROBE_ANALOG: + signal = shared_ptr( + new view::AnalogSignal(probe->name, + _analog_data, probe->index, _signals.size())); + break; + } + + _signals.push_back(signal); + } + signals_changed(); + data_updated(); + } +} + +void SigSession::update_signals(const sr_dev_inst *sdi) +{ + shared_ptr signal; + QMap probes_en_table; + QMap signals_en_table; + int index = 0; + + std::vector< boost::shared_ptr >::iterator i = _signals.begin(); + while (i != _signals.end()) { + if (((*i)->get_type() == view::Signal::DS_LOGIC || + (*i)->get_type() == view::Signal::DS_ANALOG)) + signals_en_table.insert((*i)->get_index(), 1); + i++; + } + + index = 0; + for (const GSList *l = sdi->probes; l; l = l->next) { + const sr_probe *const probe = + (const sr_probe *)l->data; + assert(probe); + probes_en_table.insert(index, probe->enabled); + if (probe->enabled && !signals_en_table.contains(index)) { + i = _signals.begin(); + while (i != _signals.end()) { + (*i)->set_order((*i)->get_order() + 1); + i++; + } + + switch(probe->type) { + case SR_PROBE_LOGIC: + signal = shared_ptr( + new view::LogicSignal(probe->name, + _logic_data, probe->index, 0)); + break; + + case SR_PROBE_ANALOG: + signal = shared_ptr( + new view::AnalogSignal(probe->name, + _analog_data, probe->index, 0)); + break; + } + _signals.push_back(signal); + } + index++; + } + + i = _signals.begin(); + while (i != _signals.end()) { + if (((*i)->get_type() == view::Signal::DS_LOGIC || + (*i)->get_type() == view::Signal::DS_ANALOG) && + probes_en_table.value((*i)->get_index()) == false) { + std::vector< boost::shared_ptr >::iterator j = _signals.begin(); + while(j != _signals.end()) { + if ((*j)->get_order() > (*i)->get_order()) + (*j)->set_order((*j)->get_order() - 1); + j++; + } + + (*i).reset(); + i = _signals.erase(i); + continue; + } + i++; + } + + signals_changed(); + data_updated(); +} + +void SigSession::feed_in_meta(const sr_dev_inst *sdi, + const sr_datafeed_meta &meta) +{ + (void)sdi; + + for (const GSList *l = meta.config; l; l = l->next) { + const sr_config *const src = (const sr_config*)l->data; + switch (src->key) { + case SR_CONF_SAMPLERATE: + /// @todo handle samplerate changes + /// samplerate = (uint64_t *)src->value; + break; + default: + // Unknown metadata is not an error. + break; + } + } +} + +void SigSession::feed_in_trigger(const ds_trigger_pos &trigger_pos) +{ + receive_trigger(trigger_pos.real_pos); +} + +void SigSession::feed_in_logic(const sr_datafeed_logic &logic) +{ + lock_guard lock(_data_mutex); + + if (!_logic_data) + { + qDebug() << "Unexpected logic packet"; + return; + } + + if (logic.data_error == 1) { + test_data_error(); + } + + if (!_cur_logic_snapshot) + { + // Create a new data snapshot + _cur_logic_snapshot = shared_ptr( + new data::LogicSnapshot(logic, _total_sample_len, 1)); + if (_cur_logic_snapshot->buf_null()) + stop_capture(); + else + _logic_data->push_snapshot(_cur_logic_snapshot); + } + else + { + // Append to the existing data snapshot + _cur_logic_snapshot->append_payload(logic); + } + + receive_data(logic.length/logic.unitsize); + //data_updated(); +} + +void SigSession::feed_in_analog(const sr_datafeed_analog &analog) +{ + lock_guard lock(_data_mutex); + + if(!_analog_data) + { + qDebug() << "Unexpected analog packet"; + return; // This analog packet was not expected. + } + + if (!_cur_analog_snapshot) + { + // Create a new data snapshot + _cur_analog_snapshot = shared_ptr( + new data::AnalogSnapshot(analog, _total_sample_len, _analog_data->get_num_probes())); + if (_cur_analog_snapshot->buf_null()) + stop_capture(); + else + _analog_data->push_snapshot(_cur_analog_snapshot); + } + else + { + // Append to the existing data snapshot + _cur_analog_snapshot->append_payload(analog); + } + + receive_data(analog.num_samples); + data_updated(); +} + +void SigSession::data_feed_in(const struct sr_dev_inst *sdi, + const struct sr_datafeed_packet *packet) +{ + assert(sdi); + assert(packet); + + switch (packet->type) { + case SR_DF_HEADER: + feed_in_header(sdi); + break; + + case SR_DF_META: + assert(packet->payload); + feed_in_meta(sdi, + *(const sr_datafeed_meta*)packet->payload); + break; + + case SR_DF_TRIGGER: + assert(packet->payload); + feed_in_trigger(*(const ds_trigger_pos*)packet->payload); + break; + + case SR_DF_LOGIC: + assert(packet->payload); + feed_in_logic(*(const sr_datafeed_logic*)packet->payload); + break; + + case SR_DF_ANALOG: + assert(packet->payload); + feed_in_analog(*(const sr_datafeed_analog*)packet->payload); + break; + + case SR_DF_END: + { + { + lock_guard lock(_data_mutex); + BOOST_FOREACH(const shared_ptr s, _signals) + { + assert(s); + if (s->get_type() == view::Signal::DS_GROUP) { + _cur_group_snapshot = shared_ptr( + new data::GroupSnapshot(_logic_data->get_snapshots().front(), s->get_index_list())); + //_cur_group_snapshot->append_payload(); + _group_data->push_snapshot(_cur_group_snapshot); + _cur_group_snapshot.reset(); + } + if (s->get_type() == view::Signal::DS_PROTOCOL) { + s->get_decoder()->decode(); + } + } + _cur_logic_snapshot.reset(); + _cur_analog_snapshot.reset(); + } + break; + } + } +} + +void SigSession::data_feed_in_proc(const struct sr_dev_inst *sdi, + const struct sr_datafeed_packet *packet, void *cb_data) +{ + (void) cb_data; + assert(_session); + _session->data_feed_in(sdi, packet); +} + +QVector > > SigSession::get_decoders() const +{ + return _decoders; +} + +void SigSession::add_protocol_analyzer(int decoder_index, std::list _sel_probes, + QMap & _options, QMap _options_index) +{ + decoder::Decoder *decoder; + + // new different docoder according to protocol_list in decoder.h + decoder = _decoderFactory->createDecoder(decoder_index, _logic_data, _sel_probes, _options, _options_index); + + // if current data is valid, do decode + if (_logic_data) + decoder->decode(); + _decoders.push_back(std::pair >(decoder, _sel_probes)); + +// // config signal's attribute for display +// BOOST_FOREACH(const int _index, _sel_probes) { +// _signals.at(_index)->set_decoder(decoder); +// } + + // add protocol decoder signal + add_protocol(_sel_probes, decoder); +} + +void SigSession::rst_protocol_analyzer(int rst_index, std::list _sel_probes, + QMap & _options, QMap _options_index) +{ + // if current data is valid, redo decode + if (_logic_data) + _decoders.at(rst_index).first->recode(_sel_probes, _options, _options_index); + + BOOST_FOREACH(const shared_ptr s, _signals) + { + assert(s); + if (s->get_decoder() == _decoders.at(rst_index).first) { + s->set_index_list(s->get_decoder()->get_probes()); + break; + } + } + + // update protocol signal + signals_changed(); + data_updated(); +} + +void SigSession::del_protocol_analyzer(int protocol_index) +{ + assert(protocol_index < _decoders.size()); + delete (_decoders.at(protocol_index)).first; + +// BOOST_FOREACH(const int _index, (_decoders.at(protocol_index)).second) { +// _signals.at(_index)->del_decoder(); +// } + del_protocol(protocol_index); + + _decoders.remove(protocol_index); +} + +std::list SigSession::get_decode_probes(int decode_index) +{ + assert(decode_index >= 0); + assert(decode_index < _decoders.size()); + return _decoders.at(decode_index).first->get_probes(); +} + +QMap SigSession::get_decode_options_index(int decode_index) +{ + assert(decode_index >= 0); + assert(decode_index < _decoders.size()); + return _decoders.at(decode_index).first->get_options_index(); +} + +/* + * hotplug function + */ +void SigSession::start_hot_plug_proc(boost::function error_handler) +{ +#ifdef HAVE_LA_DSLOGIC + if (_hot_plug_handle) { + error_handler("Hotplug proc have started!"); + return; + } + + int ret = libusbhp_init(&_hot_plug_handle); + if(ret != 0) { + error_handler("Could not initialize hotplug handle."); + return; + } + + libusbhp_register_hotplug_listeners(_hot_plug_handle, + dev_attach_callback, + dev_detach_callback, + NULL); + + // Begin the session + _hot_plug.reset(new boost::thread( + &SigSession::hot_plug_proc, this, error_handler)); +#else + error_handler("No hotplug device."); +#endif +} + +void SigSession::stop_hot_plug_proc() +{ +#ifdef HAVE_LA_DSLOGIC + if (_hot_plug.get()) { + _hot_plug->interrupt(); + _hot_plug->join(); + } + _hot_plug.reset(); + + if(_hot_plug_handle) { + libusbhp_exit(_hot_plug_handle); + _hot_plug_handle = NULL; + } +#endif +} + +void SigSession::hot_plug_proc(boost::function error_handler) +{ + if (!_sdi) + return; + + try { + while(_session) { + if (_hot_attach) { + device_attach(); + _hot_attach = false; + break; + } + if (_hot_detach) { + device_detach(); + _logic_data.reset(); + _analog_data.reset(); + _hot_detach = false; + break; + } + boost::this_thread::sleep(boost::posix_time::millisec(100)); + } + } catch(...) { + qDebug("Interrupt exception for hotplug thread was thrown."); + error_handler("Interrupt exception for hotplug thread was thrown."); + } + qDebug("Hotplug thread exit!"); +} + +void SigSession::dev_attach_callback(struct libusbhp_device_t *device, void *user_data) +{ + (void)user_data; + + if (device) + qDebug("Attach: (%04x/%04x)", device->idVendor, device->idProduct); + + _session->_hot_attach = true; +} + +void SigSession::dev_detach_callback(struct libusbhp_device_t *device, void *user_data) +{ + (void)user_data; + + if (device) + qDebug("Detach: (%04x/%04x)", device->idVendor, device->idProduct); + + _session->_hot_detach = true; +} + +int SigSession::hot_plug_active() +{ + if (_hot_plug_handle) + return 1; + else + return 0; +} + +/* + * Tigger + */ +void SigSession::set_adv_trigger(bool adv_trigger) +{ + _adv_trigger = adv_trigger; +} + +} // namespace pv diff --git a/DSLogic-gui/pv/sigsession.h b/DSLogic-gui/pv/sigsession.h new file mode 100644 index 00000000..9debdead --- /dev/null +++ b/DSLogic-gui/pv/sigsession.h @@ -0,0 +1,261 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_SIGSESSION_H +#define DSLOGIC_PV_SIGSESSION_H + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +namespace pv { + +class DeviceManager; + +namespace data { +class Analog; +class AnalogSnapshot; +class Logic; +class LogicSnapshot; +class Group; +class GroupSnapshot; +} + +namespace view { +class Signal; +} + +namespace decoder { +class Decoder; +class DecoderFactory; +} + +class SigSession : public QObject +{ + Q_OBJECT + +private: + static const float Oversampling; + +public: + enum capture_state { + Init, + Stopped, + Running + }; + +public: + SigSession(DeviceManager &device_manager); + + ~SigSession(); + + struct sr_dev_inst* get_device() const; + + /** + * Sets device instance that will be used in the next capture session. + */ + int set_device(struct sr_dev_inst *sdi); + + void release_device(struct sr_dev_inst *sdi); + + void load_file(const std::string &name, + boost::function error_handler); + + void save_file(const std::string &name); + + capture_state get_capture_state() const; + + void start_capture(uint64_t record_length, + boost::function error_handler); + + void stop_capture(); + + std::vector< boost::shared_ptr > + get_signals(); + std::vector< boost::shared_ptr > + get_pro_signals(); + + int get_logic_probe_cnt(const struct sr_dev_inst *sdi); + + int get_analog_probe_cnt(const struct sr_dev_inst *sdi); + + void init_signals(const struct sr_dev_inst *sdi); + + void update_signals(const struct sr_dev_inst *sdi); + + void add_group(); + + void del_group(); + + void add_protocol(std::list probe_index_list, decoder::Decoder *decoder); + + void del_protocol(int protocol_index); + + void del_signal(std::vector< boost::shared_ptr >::iterator i); + + boost::shared_ptr get_data(); + + void* get_buf(int& unit_size, uint64_t& length); + + quint64 get_last_sample_rate() const; + + quint64 get_total_sample_len() const; + void set_total_sample_len(quint64 length); + + QVector > > get_decoders() const; + + void add_protocol_analyzer(int decoder_index, std::list _sel_probes, + QMap &_options, QMap _options_index); + void rst_protocol_analyzer(int rst_index, std::list _sel_probes, + QMap &_options, QMap _options_index); + void del_protocol_analyzer(int protocol_index); + + std::list get_decode_probes(int decode_index); + QMap get_decode_options_index(int decode_index); + + void start_hot_plug_proc(boost::function error_handler); + void stop_hot_plug_proc(); + int hot_plug_active(); + + void set_adv_trigger(bool adv_trigger); + +private: + void set_capture_state(capture_state state); + +private: + void load_thread_proc(const std::string name, + boost::function error_handler); + + void sample_thread_proc(struct sr_dev_inst *sdi, + uint64_t record_length, + boost::function error_handler); + + void feed_in_header(const sr_dev_inst *sdi); + + void feed_in_meta(const sr_dev_inst *sdi, + const sr_datafeed_meta &meta); + + void feed_in_trigger(const ds_trigger_pos &trigger_pos); + + void feed_in_logic(const sr_datafeed_logic &logic); + + void feed_in_analog(const sr_datafeed_analog &analog); + + void data_feed_in(const struct sr_dev_inst *sdi, + const struct sr_datafeed_packet *packet); + + static void data_feed_in_proc(const struct sr_dev_inst *sdi, + const struct sr_datafeed_packet *packet, void *cb_data); + + void hot_plug_proc(boost::function error_handler); + + static void dev_attach_callback(struct libusbhp_device_t *device, void *user_data); + + static void dev_detach_callback(struct libusbhp_device_t *device, void *user_data); + +private: + DeviceManager &_device_manager; + + /** + * The device instance that will be used in the next capture session. + */ + struct sr_dev_inst *_sdi; + + mutable boost::mutex _sampling_mutex; + capture_state _capture_state; + + mutable boost::mutex _signals_mutex; + std::vector< boost::shared_ptr > _signals; + + decoder::DecoderFactory *_decoderFactory; + QVector< std::pair > > _decoders; + std::vector< boost::shared_ptr > _protocol_signals; + + mutable boost::mutex _data_mutex; + boost::shared_ptr _logic_data; + boost::shared_ptr _cur_logic_snapshot; + boost::shared_ptr _analog_data; + boost::shared_ptr _cur_analog_snapshot; + boost::shared_ptr _group_data; + boost::shared_ptr _cur_group_snapshot; + int _group_cnt; + int _protocol_cnt; + + std::auto_ptr _sampling_thread; + + quint64 _last_sample_rate; + + quint64 _total_sample_len; + + struct libusbhp_t *_hot_plug_handle; + std::auto_ptr _hot_plug; + bool _hot_attach; + bool _hot_detach; + + bool _adv_trigger; + +signals: + void capture_state_changed(int state); + + void signals_changed(); + + void data_updated(); + + void sample_rate_changed(quint64 sample_rate); + + void receive_data(quint64 length); + + void device_attach(); + void device_detach(); + + void test_data_error(); + + void receive_trigger(quint64 trigger_pos); + +public slots: + + +private: + // TODO: This should not be necessary. Multiple concurrent + // sessions should should be supported and it should be + // possible to associate a pointer with a ds_session. + static SigSession *_session; +}; + +} // namespace pv + +#endif // DSLOGIC_PV_SIGSESSION_H diff --git a/DSLogic-gui/pv/toolbars/devicebar.cpp b/DSLogic-gui/pv/toolbars/devicebar.cpp new file mode 100644 index 00000000..1c49f867 --- /dev/null +++ b/DSLogic-gui/pv/toolbars/devicebar.cpp @@ -0,0 +1,141 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include + +#include + +#include + +#include + +#include +#include + +#include "devicebar.h" + +#include +#include + +using namespace std; + +namespace pv { +namespace toolbars { + +DeviceBar::DeviceBar(QWidget *parent) : + QToolBar("Device Bar", parent), + _enable(true), + _device_selector(this), + _configure_button(this) +{ + setMovable(false); + + connect(&_device_selector, SIGNAL(currentIndexChanged (int)), + this, SLOT(on_device_selected())); + connect(&_configure_button, SIGNAL(clicked()), + this, SLOT(on_configure())); + + _configure_button.setIcon(QIcon::fromTheme("configure", + QIcon(":/icons/params.png"))); + + addWidget(&_device_selector); + addWidget(&_configure_button); +} + +void DeviceBar::set_device_list( + const std::list &devices) +{ + disconnect(&_device_selector, SIGNAL(currentIndexChanged (int)), + this, SLOT(on_device_selected())); + _device_selector.clear(); + + BOOST_FOREACH (sr_dev_inst *sdi, devices) { + const string title = DeviceManager::format_device_title(sdi); + _device_selector.addItem(title.c_str(), + qVariantFromValue((void*)sdi)); + } + connect(&_device_selector, SIGNAL(currentIndexChanged (int)), + this, SLOT(on_device_selected())); +} + +struct sr_dev_inst* DeviceBar::get_selected_device() const +{ + const int index = _device_selector.currentIndex(); + if (index < 0) + return NULL; + + return (sr_dev_inst*)_device_selector.itemData( + index).value(); +} + +void DeviceBar::set_selected_device(struct sr_dev_inst *const sdi, bool discon) +{ + if (discon) + disconnect(&_device_selector, SIGNAL(currentIndexChanged (int)), + this, SLOT(on_device_selected())); + + for (int i = 0; i < _device_selector.count(); i++) + if (sdi == _device_selector.itemData(i).value()) { + _device_selector.setCurrentIndex(i); + if (!discon) + device_selected(); + break; + } + + if (discon) + connect(&_device_selector, SIGNAL(currentIndexChanged (int)), + this, SLOT(on_device_selected())); +} + +void DeviceBar::on_device_selected() +{ + device_selected(); +} + +void DeviceBar::on_configure() +{ + int dev_mode; + sr_dev_inst *const sdi = get_selected_device(); + assert(sdi); + + dev_mode = sdi->mode; + + pv::dialogs::DeviceOptions dlg(this, sdi); + //ret = dlg.exec(); + //if (ret == QDialog::Accepted) { + if (dlg.exec()) { + if (dev_mode != sdi->mode) + device_selected(); + else + device_updated(); + } +} + +void DeviceBar::enable_toggle(bool enable) +{ + _device_selector.setDisabled(!enable); + _configure_button.setDisabled(!enable); +} + +} // namespace toolbars +} // namespace pv diff --git a/DSLogic-gui/pv/toolbars/devicebar.h b/DSLogic-gui/pv/toolbars/devicebar.h new file mode 100644 index 00000000..68b555d3 --- /dev/null +++ b/DSLogic-gui/pv/toolbars/devicebar.h @@ -0,0 +1,73 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_TOOLBARS_DEVICEBAR_H +#define DSLOGIC_PV_TOOLBARS_DEVICEBAR_H + +#include + +#include + +#include +#include +#include + +struct st_dev_inst; +class QAction; + +namespace pv { +namespace toolbars { + +class DeviceBar : public QToolBar +{ + Q_OBJECT + +public: + DeviceBar(QWidget *parent); + + void set_device_list(const std::list &devices); + + struct sr_dev_inst* get_selected_device() const; + void set_selected_device(struct sr_dev_inst *const sdi, bool discon); + + void enable_toggle(bool enable); + +signals: + void device_selected(); + + void device_updated(); + +private slots: + void on_device_selected(); + void on_configure(); + +private: + bool _enable; + QComboBox _device_selector; + QToolButton _configure_button; +}; + +} // namespace toolbars +} // namespace pv + +#endif // DSLOGIC_PV_TOOLBARS_DEVICEBAR_H diff --git a/DSLogic-gui/pv/toolbars/filebar.cpp b/DSLogic-gui/pv/toolbars/filebar.cpp new file mode 100644 index 00000000..11242231 --- /dev/null +++ b/DSLogic-gui/pv/toolbars/filebar.cpp @@ -0,0 +1,152 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include +#include +#include + +#include +#include +#include +#include + +#include "filebar.h" + +#include + +namespace pv { +namespace toolbars { + +FileBar::FileBar(SigSession &session, QWidget *parent) : + QToolBar("File Bar", parent), + _enable(true), + _session(session), + _file_button(this) +{ + setMovable(false); + + _action_open = new QAction(this); + _action_open->setText(QApplication::translate( + "File", "&Open...", 0, QApplication::UnicodeUTF8)); + _action_open->setIcon(QIcon::fromTheme("file", + QIcon(":/icons/open.png"))); + _action_open->setObjectName(QString::fromUtf8("actionOpen")); + _file_button.addAction(_action_open); + connect(_action_open, SIGNAL(triggered()), this, SLOT(on_actionOpen_triggered())); + + _action_save = new QAction(this); + _action_save->setText(QApplication::translate( + "File", "&Save...", 0, QApplication::UnicodeUTF8)); + _action_save->setIcon(QIcon::fromTheme("file", + QIcon(":/icons/save.png"))); + _action_save->setObjectName(QString::fromUtf8("actionSave")); + _file_button.addAction(_action_save); + connect(_action_save, SIGNAL(triggered()), this, SLOT(on_actionSave_triggered())); + + _action_capture = new QAction(this); + _action_capture->setText(QApplication::translate( + "File", "&Capture...", 0, QApplication::UnicodeUTF8)); + _action_capture->setIcon(QIcon::fromTheme("file", + QIcon(":/icons/capture.png"))); + _action_capture->setObjectName(QString::fromUtf8("actionCapture")); + _file_button.addAction(_action_capture); + connect(_action_capture, SIGNAL(triggered()), this, SLOT(on_actionCapture_triggered())); + + _file_button.setPopupMode(QToolButton::InstantPopup); + _file_button.setIcon(QIcon(":/icons/file.png")); + + addWidget(&_file_button); +} + +void FileBar::on_actionOpen_triggered() +{ + const QString file_name = QFileDialog::getOpenFileName( + this, tr("Open File"), "", + tr("DSLogic Sessions (*.dsl)")); + if (!file_name.isEmpty()) + load_file(file_name); +} + +void FileBar::load_file(QString file_name) +{ + const QString errorMessage( + QString("Failed to load file %1").arg(file_name)); + const QString infoMessage; + _session.load_file(file_name.toStdString(), + boost::bind(&FileBar::session_error, this, + errorMessage, infoMessage)); +} + +void FileBar::session_error( + const QString text, const QString info_text) +{ + QMetaObject::invokeMethod(this, "show_session_error", + Qt::QueuedConnection, Q_ARG(QString, text), + Q_ARG(QString, info_text)); +} + +void FileBar::show_session_error( + const QString text, const QString info_text) +{ + QMessageBox msg(this); + msg.setText(text); + msg.setInformativeText(info_text); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); +} + +void FileBar::on_actionSave_triggered() +{ + int unit_size; + uint64_t length; + void* buf = _session.get_buf(unit_size, length); + if (buf != NULL) { + const QString file_name = QFileDialog::getSaveFileName( + this, tr("Save File"), "", + tr("DSLogic Session (*.dsl)")); + if (!file_name.isEmpty()) { + _session.save_file(file_name.toStdString()); + } + } else { + QMessageBox msg(this); + msg.setText("File Save"); + msg.setInformativeText("No Data to Save!"); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); + } +} + +void FileBar::on_actionCapture_triggered() +{ + on_screenShot(); +} + +void FileBar::enable_toggle(bool enable) +{ + _file_button.setDisabled(!enable); +} + +} // namespace toolbars +} // namespace pv diff --git a/DSLogic-gui/pv/toolbars/filebar.h b/DSLogic-gui/pv/toolbars/filebar.h new file mode 100644 index 00000000..e0760f86 --- /dev/null +++ b/DSLogic-gui/pv/toolbars/filebar.h @@ -0,0 +1,75 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_TOOLBARS_FILEBAR_H +#define DSLOGIC_PV_TOOLBARS_FILEBAR_H + +#include +#include +#include + +#include "../sigsession.h" + +namespace pv { +namespace toolbars { + +class FileBar : public QToolBar +{ + Q_OBJECT + +public: + explicit FileBar(SigSession &session, QWidget *parent = 0); + + void enable_toggle(bool enable); + +private: + void load_file(QString file_name); + void session_error( + const QString text, const QString info_text); + void show_session_error( + const QString text, const QString info_text); + +signals: + void on_screenShot(); + +private slots: + void on_actionOpen_triggered(); + void on_actionSave_triggered(); + void on_actionCapture_triggered(); + +private: + bool _enable; + SigSession& _session; + + QToolButton _file_button; + + QAction *_action_open; + QAction *_action_save; + QAction *_action_capture; + +}; + +} // namespace toolbars +} // namespace pv + +#endif // DSLOGIC_PV_TOOLBARS_FILEBAR_H diff --git a/DSLogic-gui/pv/toolbars/logobar.cpp b/DSLogic-gui/pv/toolbars/logobar.cpp new file mode 100644 index 00000000..9aa17f81 --- /dev/null +++ b/DSLogic-gui/pv/toolbars/logobar.cpp @@ -0,0 +1,106 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include +#include + +#include +#include +#include +#include + +#include "logobar.h" +#include "../dialogs/about.h" + +namespace pv { +namespace toolbars { + +LogoBar::LogoBar(SigSession &session, QWidget *parent) : + QToolBar("File Bar", parent), + _enable(true), + _session(session), + _logo_button(this) +{ + setMovable(false); + + _about = new QAction(this); + _about->setText(QApplication::translate( + "File", "&About...", 0, QApplication::UnicodeUTF8)); + _about->setIcon(QIcon::fromTheme("file", + QIcon(":/icons/about.png"))); + _about->setObjectName(QString::fromUtf8("actionAbout")); + _logo_button.addAction(_about); + connect(_about, SIGNAL(triggered()), this, SLOT(on_actionAbout_triggered())); + + _logo_button.setPopupMode(QToolButton::InstantPopup); + _logo_button.setIcon(QIcon(":/icons/logo_noColor.png")); + + QWidget *spacer = new QWidget(this); + spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + addWidget(spacer); + addWidget(&_logo_button); + QWidget *margin = new QWidget(this); + margin->setMinimumWidth(20); + addWidget(margin); +} + +void LogoBar::dslogic_connected(bool conn) +{ + if (conn) + _logo_button.setIcon(QIcon(":/icons/logo_color.png")); + else + _logo_button.setIcon(QIcon(":/icons/logo_noColor.png")); +} + +void LogoBar::session_error( + const QString text, const QString info_text) +{ + QMetaObject::invokeMethod(this, "show_session_error", + Qt::QueuedConnection, Q_ARG(QString, text), + Q_ARG(QString, info_text)); +} + +void LogoBar::show_session_error( + const QString text, const QString info_text) +{ + QMessageBox msg(this); + msg.setText(text); + msg.setInformativeText(info_text); + msg.setStandardButtons(QMessageBox::Ok); + msg.setIcon(QMessageBox::Warning); + msg.exec(); +} + +void LogoBar::on_actionAbout_triggered() +{ + dialogs::About dlg(this); + dlg.exec(); +} + +void LogoBar::enable_toggle(bool enable) +{ + _logo_button.setDisabled(!enable); +} + +} // namespace toolbars +} // namespace pv diff --git a/DSLogic-gui/pv/toolbars/logobar.h b/DSLogic-gui/pv/toolbars/logobar.h new file mode 100644 index 00000000..df5508a4 --- /dev/null +++ b/DSLogic-gui/pv/toolbars/logobar.h @@ -0,0 +1,72 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_TOOLBARS_LOGOBAR_H +#define DSLOGIC_PV_TOOLBARS_LOGOBAR_H + +#include +#include +#include + +#include "../sigsession.h" + +namespace pv { +namespace toolbars { + +class LogoBar : public QToolBar +{ + Q_OBJECT + +public: + explicit LogoBar(SigSession &session, QWidget *parent = 0); + + void enable_toggle(bool enable); + + void dslogic_connected(bool conn); + +private: + void load_file(QString file_name); + void session_error( + const QString text, const QString info_text); + void show_session_error( + const QString text, const QString info_text); + +signals: + +private slots: + void on_actionAbout_triggered(); + +private: + bool _enable; + SigSession& _session; + + QToolButton _logo_button; + + QAction *_about; + +}; + +} // namespace toolbars +} // namespace pv + +#endif // DSLOGIC_PV_TOOLBARS_LOGOBAR_H diff --git a/DSLogic-gui/pv/toolbars/samplingbar.cpp b/DSLogic-gui/pv/toolbars/samplingbar.cpp new file mode 100644 index 00000000..9c5c2bb9 --- /dev/null +++ b/DSLogic-gui/pv/toolbars/samplingbar.cpp @@ -0,0 +1,293 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include + +#include + +#include + +#include +#include +#include + +#include "samplingbar.h" + +using namespace std; + +namespace pv { +namespace toolbars { + +const uint64_t SamplingBar::RecordLengths[19] = { + 1000, + 2000, + 4000, + 8000, + 10000, + 20000, + 40000, + 80000, + 100000, + 200000, + 400000, + 800000, + 1000000, + 2000000, + 4000000, + 8000000, + 10000000, + 20000000, + 40000000, +}; + +const uint64_t SamplingBar::DefaultRecordLength = 1000000; + +const uint64_t SamplingBar::DSLogic_RecordLengths[15] = { + 1000, + 2000, + 5000, + 10000, + 20000, + 50000, + 100000, + 200000, + 500000, + 1000000, + 2000000, + 5000000, + 10000000, + 16000000, + 100000000, +}; + +const uint64_t SamplingBar::DSLogic_DefaultRecordLength = 16000000; + +SamplingBar::SamplingBar(QWidget *parent) : + QToolBar("Sampling Bar", parent), + _record_length_selector(this), + _sample_rate_list(this), + _icon_stop(":/icons/stop.png"), + _icon_start(":/icons/start.png"), + _run_stop_button(this) +{ + setMovable(false); + + connect(&_run_stop_button, SIGNAL(clicked()), + this, SLOT(on_run_stop())); + +// for (size_t i = 0; i < countof(RecordLengths); i++) +// { +// const uint64_t &l = RecordLengths[i]; +// char *const text = ds_si_string_u64(l, " samples"); +// _record_length_selector.addItem(QString(text), +// qVariantFromValue(l)); +// g_free(text); + +// if (l == DefaultRecordLength) +// _record_length_selector.setCurrentIndex(i); +// } + + set_sampling(false); + + //_run_stop_button.setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + _run_stop_button.setObjectName(tr("run_stop_button")); + + addWidget(new QLabel(tr(" "))); + addWidget(&_record_length_selector); + addWidget(new QLabel(tr(" @ "))); + _sample_rate_list_action = addWidget(&_sample_rate_list); + addWidget(&_run_stop_button); + + connect(&_sample_rate_list, SIGNAL(currentIndexChanged(int)), + this, SLOT(on_sample_rate_changed())); +} + +void SamplingBar::set_device(struct sr_dev_inst *sdi) +{ + assert(sdi); + _sdi = sdi; + if (strcmp(sdi->driver->name, "DSLogic") == 0) { + _record_length_selector.clear(); + for (size_t i = 0; i < countof(DSLogic_RecordLengths); i++) + { + const uint64_t &l = DSLogic_RecordLengths[i]; + char *const text = sr_si_string_u64(l, " samples"); + _record_length_selector.addItem(QString(text), + qVariantFromValue(l)); + g_free(text); + + if (l == DSLogic_DefaultRecordLength) + _record_length_selector.setCurrentIndex(i); + } + } else { + for (size_t i = 0; i < countof(RecordLengths); i++) + { + const uint64_t &l = RecordLengths[i]; + char *const text = sr_si_string_u64(l, " samples"); + _record_length_selector.addItem(QString(text), + qVariantFromValue(l)); + g_free(text); + + if (l == DefaultRecordLength) + _record_length_selector.setCurrentIndex(i); + } + } +} + +uint64_t SamplingBar::get_record_length() const +{ + const int index = _record_length_selector.currentIndex(); + if (index < 0) + return 0; + + return _record_length_selector.itemData(index).value(); +} + +void SamplingBar::set_sampling(bool sampling) +{ + _run_stop_button.setIcon(sampling ? _icon_stop : _icon_start); + //_run_stop_button.setText(sampling ? " Stop" : "Start"); +} + +void SamplingBar::update_sample_rate_selector() +{ + GVariant *gvar_dict, *gvar_list; + const uint64_t *elements = NULL; + gsize num_elements; + QAction *selector_action = NULL; + + assert(_sample_rate_list_action); + + if (!_sdi) + return; + + if (sr_config_list(_sdi->driver, SR_CONF_SAMPLERATE, + &gvar_dict, _sdi) != SR_OK) + return; + + _sample_rate_list_action->setVisible(false); + + if ((gvar_list = g_variant_lookup_value(gvar_dict, + "samplerates", G_VARIANT_TYPE("at")))) + { + elements = (const uint64_t *)g_variant_get_fixed_array( + gvar_list, &num_elements, sizeof(uint64_t)); + _sample_rate_list.clear(); + + for (unsigned int i = 0; i < num_elements; i++) + { + char *const s = sr_samplerate_string(elements[i]); + _sample_rate_list.addItem(QString(s), + qVariantFromValue(elements[i])); + g_free(s); + } + + _sample_rate_list.show(); + g_variant_unref(gvar_list); + + selector_action = _sample_rate_list_action; + } + + g_variant_unref(gvar_dict); + _sample_rate_list_action->setVisible(true); + update_sample_rate_selector_value(); +} + +void SamplingBar::update_sample_rate_selector_value() +{ + GVariant *gvar; + uint64_t samplerate; + + assert(_sdi); + + if (sr_config_get(_sdi->driver, SR_CONF_SAMPLERATE, + &gvar, _sdi) != SR_OK) { + qDebug() << + "WARNING: Failed to get value of sample rate"; + return; + } + samplerate = g_variant_get_uint64(gvar); + g_variant_unref(gvar); + + assert(_sample_rate_list_action); + + if (_sample_rate_list_action->isVisible()) + { + for (int i = 0; i < _sample_rate_list.count(); i++) + if (samplerate == _sample_rate_list.itemData( + i).value()) + _sample_rate_list.setCurrentIndex(i); + } +} + +void SamplingBar::commit_sample_rate() +{ + uint64_t sample_rate = 0; + + assert(_sdi); + + assert(_sample_rate_list_action); + + if (_sample_rate_list_action->isVisible()) + { + const int index = _sample_rate_list.currentIndex(); + if (index >= 0) + sample_rate = _sample_rate_list.itemData( + index).value(); + } + + if (sample_rate == 0) + return; + + // Set the samplerate + if (sr_config_set(_sdi, SR_CONF_SAMPLERATE, + g_variant_new_uint64(sample_rate)) != SR_OK) { + qDebug() << "Failed to configure samplerate."; + return; + } +} + +void SamplingBar::on_sample_rate_changed() +{ + commit_sample_rate(); +} + +void SamplingBar::on_run_stop() +{ + commit_sample_rate(); + run_stop(); +} + +void SamplingBar::enable_toggle(bool enable) +{ + _record_length_selector.setDisabled(!enable); + _sample_rate_list.setDisabled(!enable); +} + +void SamplingBar::enable_run_stop(bool enable) +{ + _run_stop_button.setDisabled(!enable); +} + +} // namespace toolbars +} // namespace pv diff --git a/DSLogic-gui/pv/toolbars/samplingbar.h b/DSLogic-gui/pv/toolbars/samplingbar.h new file mode 100644 index 00000000..ddd6c16b --- /dev/null +++ b/DSLogic-gui/pv/toolbars/samplingbar.h @@ -0,0 +1,96 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_TOOLBARS_SAMPLINGBAR_H +#define DSLOGIC_PV_TOOLBARS_SAMPLINGBAR_H + +#include + +#include + +#include +#include +#include + +#include + +struct st_dev_inst; +class QAction; + +namespace pv { +namespace toolbars { + +class SamplingBar : public QToolBar +{ + Q_OBJECT + +private: + static const uint64_t RecordLengths[19]; + static const uint64_t DefaultRecordLength; + static const uint64_t DSLogic_RecordLengths[15]; + static const uint64_t DSLogic_DefaultRecordLength; + +public: + SamplingBar(QWidget *parent); + + uint64_t get_record_length() const; + + void set_sampling(bool sampling); + void update_sample_rate_selector(); + + void set_device(struct sr_dev_inst *sdi); + + void enable_toggle(bool enable); + + void enable_run_stop(bool enable); + +signals: + void run_stop(); + +private: + void update_sample_rate_selector_value(); + void commit_sample_rate(); + +private slots: + void on_sample_rate_changed(); + void on_run_stop(); + +private: + bool _enable; + + struct sr_dev_inst *_sdi; + + QComboBox _record_length_selector; + + QComboBox _sample_rate_list; + QAction *_sample_rate_list_action; + + QIcon _icon_stop; + QIcon _icon_start; + QToolButton _run_stop_button; +}; + +} // namespace toolbars +} // namespace pv + +#endif // DSLOGIC_PV_TOOLBARS_SAMPLINGBAR_H diff --git a/DSLogic-gui/pv/toolbars/trigbar.cpp b/DSLogic-gui/pv/toolbars/trigbar.cpp new file mode 100644 index 00000000..f60b7523 --- /dev/null +++ b/DSLogic-gui/pv/toolbars/trigbar.cpp @@ -0,0 +1,96 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "trigbar.h" + +namespace pv { +namespace toolbars { + +TrigBar::TrigBar(QWidget *parent) : + QToolBar("Trig Bar", parent), + _enable(true), + _trig_button(this), + _protocol_button(this), + _measure_button(this), + _search_button(this) +{ + setMovable(false); + + connect(&_trig_button, SIGNAL(clicked()), + this, SLOT(trigger_clicked())); + connect(&_protocol_button, SIGNAL(clicked()), + this, SLOT(protocol_clicked())); + connect(&_measure_button, SIGNAL(clicked()), + this, SLOT(measure_clicked())); + connect(&_search_button, SIGNAL(clicked()), + this, SLOT(search_clicked())); + + _trig_button.setIcon(QIcon::fromTheme("trig", + QIcon(":/icons/trigger.png"))); + _trig_button.setCheckable(true); + _protocol_button.setIcon(QIcon::fromTheme("trig", + QIcon(":/icons/protocol.png"))); + _protocol_button.setCheckable(true); + _measure_button.setIcon(QIcon::fromTheme("trig", + QIcon(":/icons/measure.png"))); + _measure_button.setCheckable(true); + _search_button.setIcon(QIcon::fromTheme("trig", + QIcon(":/icons/search-bar.png"))); + _search_button.setCheckable(true); + + addWidget(&_trig_button); + addWidget(&_protocol_button); + addWidget(&_measure_button); + addWidget(&_search_button); +} + +void TrigBar::protocol_clicked() +{ + on_protocol(_protocol_button.isChecked()); +} + +void TrigBar::trigger_clicked() +{ + on_trigger(_trig_button.isChecked()); +} + +void TrigBar::measure_clicked() +{ + on_measure(_measure_button.isChecked()); +} + +void TrigBar::search_clicked() +{ + on_search(_search_button.isChecked()); +} + +void TrigBar::enable_toggle(bool enable) +{ + _trig_button.setDisabled(!enable); + _protocol_button.setDisabled(!enable); + _measure_button.setDisabled(!enable); + _search_button.setDisabled(!enable); +} + +} // namespace toolbars +} // namespace pv diff --git a/DSLogic-gui/pv/toolbars/trigbar.h b/DSLogic-gui/pv/toolbars/trigbar.h new file mode 100644 index 00000000..bc9333cd --- /dev/null +++ b/DSLogic-gui/pv/toolbars/trigbar.h @@ -0,0 +1,65 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_TOOLBARS_TRIGBAR_H +#define DSLOGIC_PV_TOOLBARS_TRIGBAR_H + +#include +#include + +namespace pv { +namespace toolbars { + +class TrigBar : public QToolBar +{ + Q_OBJECT +public: + explicit TrigBar(QWidget *parent = 0); + + void enable_toggle(bool enable); + +signals: + void on_protocol(bool visible); + void on_trigger(bool visible); + void on_measure(bool visible); + void on_search(bool visible); + +public slots: + void protocol_clicked(); + void trigger_clicked(); + void measure_clicked(); + void search_clicked(); + +private: + bool _enable; + QToolButton _trig_button; + QToolButton _protocol_button; + QToolButton _measure_button; + QToolButton _search_button; + +}; + +} // namespace toolbars +} // namespace pv + +#endif // DSLOGIC_PV_TOOLBARS_TRIGBAR_H diff --git a/DSLogic-gui/pv/view/analogsignal.cpp b/DSLogic-gui/pv/view/analogsignal.cpp new file mode 100644 index 00000000..1d863108 --- /dev/null +++ b/DSLogic-gui/pv/view/analogsignal.cpp @@ -0,0 +1,226 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include + +#include + +#include "analogsignal.h" +#include "pv/data/analog.h" +#include "pv/data/analogsnapshot.h" + +using namespace boost; +using namespace std; + +namespace pv { +namespace view { + +//const QColor AnalogSignal::SignalColours[4] = { +// QColor(0xC4, 0xA0, 0x00), // Yellow +// QColor(0x87, 0x20, 0x7A), // Magenta +// QColor(0x20, 0x4A, 0x87), // Blue +// QColor(0x4E, 0x9A, 0x06) // Green +//}; +const QColor AnalogSignal::SignalColours[4] = { + QColor(17, 133, 209, 255), // dsBlue + QColor(238, 178, 17, 255), // dsYellow + QColor(213, 15, 37, 255), // dsRed + QColor(0, 153, 37, 255) // dsGreen +}; + +const float AnalogSignal::EnvelopeThreshold = 256.0f; + +AnalogSignal::AnalogSignal(QString name, shared_ptr data, + int probe_index, int order) : + Signal(name, probe_index, DS_ANALOG, order), + _data(data) +{ + _colour = SignalColours[probe_index % countof(SignalColours)]; + _scale = _signalHeight * 1.0f / 65536; +} + +AnalogSignal::~AnalogSignal() +{ +} + +void AnalogSignal::set_data(boost::shared_ptr _logic_data, + boost::shared_ptr _analog_data, + boost::shared_ptr _group_data) +{ + (void)_logic_data; + (void)_group_data; + + assert(_analog_data); + + _data = _analog_data; +} + +void AnalogSignal::set_scale(float scale) +{ + _scale = scale; +} + +void AnalogSignal::paint(QPainter &p, int y, int left, int right, double scale, + double offset) +{ + assert(scale > 0); + assert(_data); + assert(right >= left); + + //paint_axis(p, y, left, right); + + const deque< shared_ptr > &snapshots = + _data->get_snapshots(); + if (snapshots.empty()) + return; + + _scale = _signalHeight * 1.0f / 65536; + const shared_ptr &snapshot = + snapshots.front(); + + if (get_index() >= (int)snapshot->get_channel_num()) + return; + + const double pixels_offset = offset / scale; + const double samplerate = _data->get_samplerate(); + const double start_time = _data->get_start_time(); + const int64_t last_sample = max((int64_t)(snapshot->get_sample_count() - 1), (int64_t)0); + const double samples_per_pixel = samplerate * scale; + const double start = samplerate * (offset - start_time); + const double end = start + samples_per_pixel * (right - left); + + const int64_t start_sample = min(max((int64_t)floor(start), + (int64_t)0), last_sample); + const int64_t end_sample = min(max((int64_t)ceil(end) + 1, + (int64_t)0), last_sample); + + if (samples_per_pixel < EnvelopeThreshold) + paint_trace(p, snapshot, y, left, + start_sample, end_sample, + pixels_offset, samples_per_pixel); + else + paint_envelope(p, snapshot, y, left, + start_sample, end_sample, + pixels_offset, samples_per_pixel); +} + +void AnalogSignal::paint_trace(QPainter &p, + const shared_ptr &snapshot, + int y, int left, const int64_t start, const int64_t end, + const double pixels_offset, const double samples_per_pixel) +{ + const int64_t sample_count = end - start; + const int64_t channel_num = snapshot->get_channel_num(); + + if (sample_count > 0) { + const uint16_t *const samples = snapshot->get_samples(start, end); + assert(samples); + + p.setPen(_colour); + //p.setPen(QPen(_colour, 2, Qt::SolidLine)); + + QPointF *points = new QPointF[sample_count]; + QPointF *point = points; + + for (int64_t sample = start; sample != end; sample++) { + const float x = (sample / samples_per_pixel - + pixels_offset) + left; + *point++ = QPointF(x, + y - samples[(sample - start) * channel_num + get_index()] * _scale); + } + + p.drawPolyline(points, point - points); + + //delete[] samples; + delete[] points; + } +} + +void AnalogSignal::paint_envelope(QPainter &p, + const shared_ptr &snapshot, + int y, int left, const int64_t start, const int64_t end, + const double pixels_offset, const double samples_per_pixel) +{ + using namespace Qt; + using pv::data::AnalogSnapshot; + + AnalogSnapshot::EnvelopeSection e; + snapshot->get_envelope_section(e, start, end, samples_per_pixel, get_index()); + + if (e.length < 2) + return; + + p.setPen(QPen(NoPen)); + //p.setPen(QPen(_colour, 2, Qt::SolidLine)); + p.setBrush(_colour); + + QRectF *const rects = new QRectF[e.length]; + QRectF *rect = rects; + + for(uint64_t sample = 0; sample < e.length-1; sample++) { + const float x = ((e.scale * sample + e.start) / + samples_per_pixel - pixels_offset) + left; + const AnalogSnapshot::EnvelopeSample *const s = + e.samples + sample; + + // We overlap this sample with the next so that vertical + // gaps do not appear during steep rising or falling edges + const float b = y - max(s->max, (s+1)->min) * _scale; + const float t = y - min(s->min, (s+1)->max) * _scale; + + float h = b - t; + if(h >= 0.0f && h <= 1.0f) + h = 1.0f; + if(h <= 0.0f && h >= -1.0f) + h = -1.0f; + + *rect++ = QRectF(x, t, 1.0f, h); + } + + p.drawRects(rects, e.length); + + delete[] rects; + //delete[] e.samples; +} + +const std::vector< std::pair > AnalogSignal::cur_edges() const +{ + +} + +void AnalogSignal::set_decoder(pv::decoder::Decoder *decoder) +{ + (void)decoder; +} + +decoder::Decoder *AnalogSignal::get_decoder() +{ + return NULL; +} + +void AnalogSignal::del_decoder() +{ +} + +} // namespace view +} // namespace pv diff --git a/DSLogic-gui/pv/view/analogsignal.h b/DSLogic-gui/pv/view/analogsignal.h new file mode 100644 index 00000000..fc38a2e3 --- /dev/null +++ b/DSLogic-gui/pv/view/analogsignal.h @@ -0,0 +1,100 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_ANALOGSIGNAL_H +#define DSLOGIC_PV_ANALOGSIGNAL_H + +#include "signal.h" + +#include + +namespace pv { + +namespace data { +class Logic; +class Analog; +class AnalogSnapshot; +} + +namespace view { + +class AnalogSignal : public Signal +{ +private: + static const QColor SignalColours[4]; + + static const float EnvelopeThreshold; + +public: + AnalogSignal(QString name, + boost::shared_ptr data, int probe_index, int order); + + virtual ~AnalogSignal(); + + void set_scale(float scale); + + /** + * Paints the signal with a QPainter + * @param p the QPainter to paint into. + * @param y the y-coordinate to draw the signal at. + * @param left the x-coordinate of the left edge of the signal. + * @param right the x-coordinate of the right edge of the signal. + * @param scale the scale in seconds per pixel. + * @param offset the time to show at the left hand edge of + * the view in seconds. + **/ + void paint(QPainter &p, int y, int left, int right, double scale, + double offset); + + const std::vector< std::pair > cur_edges() const; + + void set_decoder(pv::decoder::Decoder *decoder); + + pv::decoder::Decoder* get_decoder(); + + void del_decoder(); + + void set_data(boost::shared_ptr _logic_data, + boost::shared_ptr _analog_data, + boost::shared_ptr _group_data); + +private: + void paint_trace(QPainter &p, + const boost::shared_ptr &snapshot, + int y, int left, const int64_t start, const int64_t end, + const double pixels_offset, const double samples_per_pixel); + + void paint_envelope(QPainter &p, + const boost::shared_ptr &snapshot, + int y, int left, const int64_t start, const int64_t end, + const double pixels_offset, const double samples_per_pixel); + +private: + boost::shared_ptr _data; + float _scale; +}; + +} // namespace view +} // namespace pv + +#endif // DSLOGIC_PV_ANALOGSIGNAL_H diff --git a/DSLogic-gui/pv/view/cursor.cpp b/DSLogic-gui/pv/view/cursor.cpp new file mode 100644 index 00000000..8c9712c2 --- /dev/null +++ b/DSLogic-gui/pv/view/cursor.cpp @@ -0,0 +1,157 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "cursor.h" + +#include "ruler.h" +#include "view.h" + +#include +#include +#include +#include +#include + +#include +#include + +#include + +namespace pv { +namespace view { + +const QColor Cursor::LineColour(32, 74, 135); +const QColor Cursor::FillColour(52, 101, 164); +const QColor Cursor::HighlightColour(83, 130, 186); +const QColor Cursor::TextColour(Qt::white); + +const int Cursor::Offset = 1; + +const int Cursor::ArrowSize = 10; + +const int Cursor::CloseSize = 10; + +Cursor::Cursor(View &view, QColor color, double time) : + TimeMarker(view, color, time), + _other(*this) +{ +} + +QRectF Cursor::get_label_rect(const QRect &rect) const +{ + const float x = (_time - _view.offset()) / _view.scale(); + + const QSizeF label_size( + _text_size.width() + View::LabelPadding.width() * 2, + _text_size.height() + View::LabelPadding.height() * 2); + const float top = rect.height() - label_size.height() - + Cursor::Offset - Cursor::ArrowSize - 0.5f; + const float height = label_size.height(); + + return QRectF(x - label_size.width() / 2, top, label_size.width(), height); +} + +QRectF Cursor::get_close_rect(const QRect &rect) const +{ + const QRectF r(get_label_rect(rect)); + return QRectF(r.right() - CloseSize, r.top(), CloseSize, CloseSize); +} + +void Cursor::paint_label(QPainter &p, const QRect &rect, + unsigned int prefix, int index) +{ + assert(index > 0); + + using pv::view::Ruler; + + compute_text_size(p, prefix); + const QRectF r(get_label_rect(rect)); + const QRectF close(get_close_rect(rect)); + + p.setPen(Qt::transparent); + if (close.contains(QPoint(_view.hover_point().x(), _view.hover_point().y()))) + p.setBrush(Ruler::CursorColor[(index - 1) % 8]); + else if (r.contains(QPoint(_view.hover_point().x(), _view.hover_point().y()))) + p.setBrush(Ruler::HitColor); + else + p.setBrush(Ruler::CursorColor[(index - 1) % 8]); + p.drawRect(r); + + const QPointF points[] = { + QPointF(r.left() + r.width() / 2 - ArrowSize, r.bottom()), + QPointF(r.left() + r.width() / 2 + ArrowSize, r.bottom()), + QPointF(r.left() + r.width() / 2, rect.bottom()), + }; + p.drawPolygon(points, countof(points)); + + if (close.contains(QPoint(_view.hover_point().x(), _view.hover_point().y()))) + p.setBrush(Ruler::WarnColor); + else + p.setBrush(Ruler::HitColor); + p.drawRect(close); + p.setPen(Qt::black); + p.drawLine(close.left() + 2, close.top() + 2, close.right() - 2, close.bottom() - 2); + p.drawLine(close.left() + 2, close.bottom() - 2, close.right() - 2, close.top() + 2); + + p.drawText(r, Qt::AlignCenter | Qt::AlignVCenter, + Ruler::format_time(_time, prefix, 2)); + + const QRectF arrowRect = QRectF(r.bottomLeft().x(), r.bottomLeft().y(), r.width(), ArrowSize); + p.drawText(arrowRect, Qt::AlignCenter | Qt::AlignVCenter, QString::number(index)); +} + +void Cursor::paint_fix_label(QPainter &p, const QRect &rect, + unsigned int prefix, QChar label, QColor color) +{ + using pv::view::Ruler; + + compute_text_size(p, prefix); + const QRectF r(get_label_rect(rect)); + + p.setPen(Qt::transparent); + p.setBrush(color); + p.drawRect(r); + + const QPointF points[] = { + QPointF(r.left() + r.width() / 2 - ArrowSize, r.bottom()), + QPointF(r.left() + r.width() / 2 + ArrowSize, r.bottom()), + QPointF(r.left() + r.width() / 2, rect.bottom()), + }; + p.drawPolygon(points, countof(points)); + + p.setPen(Qt::white); + p.drawText(r, Qt::AlignCenter | Qt::AlignVCenter, + Ruler::format_time(_time, prefix, 2)); + + const QRectF arrowRect = QRectF(r.bottomLeft().x(), r.bottomLeft().y(), r.width(), ArrowSize); + p.drawText(arrowRect, Qt::AlignCenter | Qt::AlignVCenter, label); +} + +void Cursor::compute_text_size(QPainter &p, unsigned int prefix) +{ + _text_size = p.boundingRect(QRectF(), 0, + Ruler::format_time(_time, prefix, 2)).size(); +} + +} // namespace view +} // namespace pv diff --git a/DSLogic-gui/pv/view/cursor.h b/DSLogic-gui/pv/view/cursor.h new file mode 100644 index 00000000..87364c94 --- /dev/null +++ b/DSLogic-gui/pv/view/cursor.h @@ -0,0 +1,94 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_VIEW_CURSOR_H +#define DSLOGIC_PV_VIEW_CURSOR_H + +#include "timemarker.h" + +#include + +class QPainter; + +namespace pv { +namespace view { + +class Cursor : public TimeMarker +{ + Q_OBJECT + +public: + static const QColor LineColour; + static const QColor FillColour; + static const QColor HighlightColour; + static const QColor TextColour; + + static const int Offset; + + static const int ArrowSize; + static const int CloseSize; + +public: + /** + * Constructor. + * @param view A reference to the view that owns this cursor pair. + * @param time The time to set the flag to. + * @param other A reference to the other cursor. + */ + Cursor(View &view, QColor color, double time); + +public: + /** + * Gets the marker label rectangle. + * @param rect The rectangle of the ruler client area. + * @return Returns the label rectangle. + */ + QRectF get_label_rect(const QRect &rect) const; + + QRectF get_close_rect(const QRect &rect) const; + + /** + * Paints the cursor's label to the ruler. + * @param p The painter to draw with. + * @param rect The rectangle of the ruler client area. + * @param prefix The index of the SI prefix to use. + */ + void paint_label(QPainter &p, const QRect &rect, + unsigned int prefix, int index); + + void paint_fix_label(QPainter &p, const QRect &rect, + unsigned int prefix, QChar label, QColor color); + +private: + void compute_text_size(QPainter &p, unsigned int prefix); + +private: + const Cursor &_other; + + QSizeF _text_size; +}; + +} // namespace view +} // namespace pv + +#endif // DSLOGIC_PV_VIEW_CURSOR_H diff --git a/DSLogic-gui/pv/view/groupsignal.cpp b/DSLogic-gui/pv/view/groupsignal.cpp new file mode 100644 index 00000000..391779c6 --- /dev/null +++ b/DSLogic-gui/pv/view/groupsignal.cpp @@ -0,0 +1,212 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include + +#include + +#include "groupsignal.h" +#include "pv/data/group.h" +#include "pv/data/groupsnapshot.h" + +using namespace boost; +using namespace std; + +namespace pv { +namespace view { + +const QColor GroupSignal::SignalColours[4] = { + QColor(0xC4, 0xA0, 0x00), // Yellow + QColor(0x87, 0x20, 0x7A), // Magenta + QColor(0x20, 0x4A, 0x87), // Blue + QColor(0x4E, 0x9A, 0x06) // Green +}; + +const float GroupSignal::EnvelopeThreshold = 256.0f; + +GroupSignal::GroupSignal(QString name, boost::shared_ptr data, + std::list probe_index_list, int order, int group_index) : + Signal(name, probe_index_list, DS_GROUP, order, group_index), + _data(data) +{ + _colour = SignalColours[probe_index_list.front() % countof(SignalColours)]; + _scale = _signalHeight * 1.0f / pow(2, probe_index_list.size()); +} + +GroupSignal::~GroupSignal() +{ +} + +void GroupSignal::set_data(boost::shared_ptr _logic_data, + boost::shared_ptr _analog_data, + boost::shared_ptr _group_data) +{ + (void)_logic_data; + (void)_analog_data; + + assert(_group_data); + + _data = _group_data; +} + +void GroupSignal::set_scale(float scale) +{ + _scale = scale; +} + +void GroupSignal::paint(QPainter &p, int y, int left, int right, double scale, + double offset) +{ + assert(scale > 0); + assert(_data); + assert(right >= left); + + _scale = _signalHeight * 1.0f / pow(2, _index_list.size()); + paint_axis(p, y, left, right); + + const deque< shared_ptr > &snapshots = + _data->get_snapshots(); + if (snapshots.empty()) + return; + + const shared_ptr &snapshot = + snapshots.at(_sec_index); + + const double pixels_offset = offset / scale; + const double samplerate = _data->get_samplerate(); + const double start_time = _data->get_start_time(); + const int64_t last_sample = snapshot->get_sample_count() - 1; + const double samples_per_pixel = samplerate * scale; + const double start = samplerate * (offset - start_time); + const double end = start + samples_per_pixel * (right - left); + + const int64_t start_sample = min(max((int64_t)floor(start), + (int64_t)0), last_sample); + const int64_t end_sample = min(max((int64_t)ceil(end) + 1, + (int64_t)0), last_sample); + + if (samples_per_pixel < EnvelopeThreshold) + paint_trace(p, snapshot, y, left, + start_sample, end_sample, + pixels_offset, samples_per_pixel); + else + paint_envelope(p, snapshot, y, left, + start_sample, end_sample, + pixels_offset, samples_per_pixel); +} + +void GroupSignal::paint_trace(QPainter &p, + const shared_ptr &snapshot, + int y, int left, const int64_t start, const int64_t end, + const double pixels_offset, const double samples_per_pixel) +{ + const int64_t sample_count = end - start; + + const uint16_t *samples = snapshot->get_samples(start, end); + assert(samples); + + p.setPen(_colour); + + QPointF *points = new QPointF[sample_count]; + QPointF *point = points; + + for (int64_t sample = start; sample != end; sample++) { + const float x = (sample / samples_per_pixel - + pixels_offset) + left; + *point++ = QPointF(x, + y - samples[sample - start] * _scale); + } + + p.drawPolyline(points, point - points); + + delete[] samples; + delete[] points; +} + +void GroupSignal::paint_envelope(QPainter &p, + const shared_ptr &snapshot, + int y, int left, const int64_t start, const int64_t end, + const double pixels_offset, const double samples_per_pixel) +{ + using namespace Qt; + using pv::data::GroupSnapshot; + + GroupSnapshot::EnvelopeSection e; + snapshot->get_envelope_section(e, start, end, samples_per_pixel); + + if (e.length < 2) + return; + + p.setPen(QPen(NoPen)); + p.setBrush(_colour); + + QRectF *const rects = new QRectF[e.length]; + QRectF *rect = rects; + + for(uint64_t sample = 0; sample < e.length-1; sample++) { + const float x = ((e.scale * sample + e.start) / + samples_per_pixel - pixels_offset) + left; + const GroupSnapshot::EnvelopeSample *const s = + e.samples + sample; + + // We overlap this sample with the next so that vertical + // gaps do not appear during steep rising or falling edges + const float b = y - max(s->max, (s+1)->min) * _scale; + const float t = y - min(s->min, (s+1)->max) * _scale; + + float h = b - t; + if(h >= 0.0f && h <= 1.0f) + h = 1.0f; + if(h <= 0.0f && h >= -1.0f) + h = -1.0f; + + *rect++ = QRectF(x, t, 1.0f, h); + } + + p.drawRects(rects, e.length); + + delete[] rects; + delete[] e.samples; +} + +const std::vector< std::pair > GroupSignal::cur_edges() const +{ + +} + +void GroupSignal::set_decoder(pv::decoder::Decoder *decoder) +{ + (void)decoder; +} + +decoder::Decoder *GroupSignal::get_decoder() +{ + return NULL; +} + +void GroupSignal::del_decoder() +{ +} + +} // namespace view +} // namespace pv diff --git a/DSLogic-gui/pv/view/groupsignal.h b/DSLogic-gui/pv/view/groupsignal.h new file mode 100644 index 00000000..43f858d9 --- /dev/null +++ b/DSLogic-gui/pv/view/groupsignal.h @@ -0,0 +1,104 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_SV_GROUPSIGNAL_H +#define DSLOGIC_SV_GROUPSIGNAL_H + +#include "signal.h" +#include "../data/groupsnapshot.h" + +#include +#include + +namespace pv { + +namespace data { +class Logic; +class Analog; +class Group; +class GroupSnapshot; +} + +namespace view { + +class GroupSignal : public Signal +{ +private: + static const QColor SignalColours[4]; + + static const float EnvelopeThreshold; + +public: + GroupSignal(QString name, + boost::shared_ptr data, + std::list probe_index_list, int order, int group_index); + + virtual ~GroupSignal(); + + void set_scale(float scale); + + /** + * Paints the signal with a QPainter + * @param p the QPainter to paint into. + * @param y the y-coordinate to draw the signal at. + * @param left the x-coordinate of the left edge of the signal. + * @param right the x-coordinate of the right edge of the signal. + * @param scale the scale in seconds per pixel. + * @param offset the time to show at the left hand edge of + * the view in seconds. + **/ + void paint(QPainter &p, int y, int left, int right, double scale, + double offset); + + const std::vector< std::pair > cur_edges() const; + + void set_decoder(pv::decoder::Decoder *decoder); + + pv::decoder::Decoder* get_decoder(); + + void del_decoder(); + + void set_data(boost::shared_ptr _logic_data, + boost::shared_ptr _analog_data, + boost::shared_ptr _group_data); + +private: + void paint_trace(QPainter &p, + const boost::shared_ptr &snapshot, + int y, int left, const int64_t start, const int64_t end, + const double pixels_offset, const double samples_per_pixel); + + void paint_envelope(QPainter &p, + const boost::shared_ptr &snapshot, + int y, int left, const int64_t start, const int64_t end, + const double pixels_offset, const double samples_per_pixel); + +private: + boost::shared_ptr _data; + float _scale; +}; + +} // namespace view +} // namespace pv + +#endif // DSLOGIC_PV_GROUPSIGNAL_H diff --git a/DSLogic-gui/pv/view/header.cpp b/DSLogic-gui/pv/view/header.cpp new file mode 100644 index 00000000..9bbea0b6 --- /dev/null +++ b/DSLogic-gui/pv/view/header.cpp @@ -0,0 +1,533 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "header.h" +#include "view.h" + +#include "signal.h" +#include "../sigsession.h" + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace boost; +using namespace std; + +namespace pv { +namespace view { + +const int Header::COLOR = 1; +const int Header::NAME = 2; +const int Header::POSTRIG = 3; +const int Header::HIGTRIG = 4; +const int Header::NEGTRIG = 5; +const int Header::LOWTRIG = 6; +const int Header::LABEL = 7; + +Header::Header(View &parent) : + QWidget(&parent), + _view(parent), + _action_add_group(new QAction(tr("Add Group"), this)), + _action_del_group(new QAction(tr("Del Group"), this)) +{ + _moveFlag = false; + _colorFlag = false; + _nameFlag = false; + nameEdit = new QLineEdit(this); + nameEdit->setFixedWidth(100); + nameEdit->hide(); + + setMouseTracking(true); + + connect(_action_del_group, SIGNAL(triggered()), + this, SLOT(on_action_del_group_triggered())); + connect(_action_add_group, SIGNAL(triggered()), + this, SLOT(on_action_add_group_triggered())); + + connect(nameEdit, SIGNAL(editingFinished()), + this, SLOT(on_action_set_name_triggered())); + + connect(&_view, SIGNAL(signals_moved()), + this, SLOT(on_signals_moved())); +} + + +int Header::get_nameEditWidth() +{ + if (nameEdit->hasFocus()) + return nameEdit->width(); + else + return 0; +} + +boost::shared_ptr Header::get_mouse_over_signal( + int &action, + const QPoint &pt) +{ + const int w = width(); + const vector< shared_ptr > sigs( + _view.session().get_signals()); + + const int v_offset = _view.v_offset(); + BOOST_FOREACH(const shared_ptr s, sigs) + { + assert(s); + + if ((action = s->pt_in_rect(s->get_v_offset() - v_offset - _view.get_signalHeight() / 2, + w, pt))) + return s; + } + + return shared_ptr(); +} + +void Header::paintEvent(QPaintEvent*) +{ + using pv::view::Signal; + + QStyleOption o; + o.initFrom(this); + QPainter painter(this); + style()->drawPrimitive(QStyle::PE_Widget, &o, &painter, this); + + const int w = width(); + int action; + const vector< shared_ptr > sigs( + _view.session().get_signals()); + + //QPainter painter(this); + //painter.setRenderHint(QPainter::Antialiasing); + + const int v_offset = _view.v_offset(); + const bool dragging = !_drag_sigs.empty(); + BOOST_FOREACH(const shared_ptr s, sigs) + { + assert(s); + + const int y = s->get_v_offset() - v_offset - _view.get_signalHeight() / 2; + const bool highlight = !dragging && + (action = s->pt_in_rect(y, w, _mouse_point)); + s->paint_label(painter, y, w, highlight, action); + // Paint the Backgroud + painter.setRenderHint(QPainter::Antialiasing, false); + painter.setPen(Signal::dsGray); + if (s->selected() && _moveFlag) { + if (s->get_type() == Signal::DS_ANALOG) { + painter.drawLine(0, s->get_old_v_offset() - v_offset - s->get_signalHeight(), + w, s->get_old_v_offset() - v_offset - s->get_signalHeight()); + painter.drawLine(0, s->get_old_v_offset() - v_offset, + w, s->get_old_v_offset() - v_offset); + } else { + painter.drawLine(0, s->get_old_v_offset() - v_offset + 10, + w, s->get_old_v_offset() - v_offset + 10); + } + } else { + if (s->get_type() == Signal::DS_ANALOG) { + painter.drawLine(0, s->get_v_offset() - v_offset, + w, s->get_v_offset() - v_offset); + painter.drawLine(0, s->get_v_offset() - v_offset - s->get_signalHeight(), + w, s->get_v_offset() - v_offset - s->get_signalHeight()); + } else { + painter.drawLine(0, s->get_v_offset() - v_offset + 10, + w, s->get_v_offset() - v_offset + 10); + } + } + } + + painter.end(); +} + +void Header::mousePressEvent(QMouseEvent *event) +{ + assert(event); + + const vector< shared_ptr > sigs( + _view.session().get_signals()); + int action; + + if (event->button() & Qt::LeftButton) { + _mouse_down_point = event->pos(); + + // Save the offsets of any signals which will be dragged + BOOST_FOREACH(const shared_ptr s, sigs) + if (s->selected()) + _drag_sigs.push_back( + make_pair(s, s->get_v_offset())); + + // Select the signal if it has been clicked + const shared_ptr mouse_over_signal = + get_mouse_over_signal(action, event->pos()); + if (action == COLOR && mouse_over_signal) { + _colorFlag = true; + } else if (action == NAME && mouse_over_signal) { + _nameFlag = true; + } else if (action == LABEL && mouse_over_signal) { + if (mouse_over_signal->selected()) + mouse_over_signal->select(false); + else { + mouse_over_signal->select(true); + + if (~QApplication::keyboardModifiers() & + Qt::ControlModifier) + _drag_sigs.clear(); + + // Add the signal to the drag list + if (event->button() & Qt::LeftButton) + _drag_sigs.push_back( + make_pair(mouse_over_signal, + mouse_over_signal->get_v_offset())); + } + mouse_over_signal->set_old_v_offset(mouse_over_signal->get_v_offset()); + } else if (action == POSTRIG && mouse_over_signal) { + if (mouse_over_signal->get_trig() == POSTRIG) + mouse_over_signal->set_trig(0); + else + mouse_over_signal->set_trig(POSTRIG); + } else if (action == HIGTRIG && mouse_over_signal) { + if (mouse_over_signal->get_trig() == HIGTRIG) + mouse_over_signal->set_trig(0); + else + mouse_over_signal->set_trig(HIGTRIG); + } else if (action == NEGTRIG && mouse_over_signal) { + if (mouse_over_signal->get_trig() == NEGTRIG) + mouse_over_signal->set_trig(0); + else + mouse_over_signal->set_trig(NEGTRIG); + } else if (action == LOWTRIG && mouse_over_signal) { + if (mouse_over_signal->get_trig() == LOWTRIG) + mouse_over_signal->set_trig(0); + else + mouse_over_signal->set_trig(LOWTRIG); + } + + if (~QApplication::keyboardModifiers() & Qt::ControlModifier) { + // Unselect all other signals because the Ctrl is not + // pressed + BOOST_FOREACH(const shared_ptr s, sigs) + if (s != mouse_over_signal) + s->select(false); + } + update(); + } +} + +void Header::mouseReleaseEvent(QMouseEvent *event) +{ + assert(event); + + // judge for color / name / trigger / move + int action; + const shared_ptr mouse_over_signal = + get_mouse_over_signal(action, event->pos()); + if (mouse_over_signal){ + if (action == COLOR && _colorFlag) { + _context_signal = mouse_over_signal; + changeColor(event); + _view.set_need_update(true); + } else if (action == NAME && _nameFlag) { + _context_signal = mouse_over_signal; + changeName(event); + } + } + if (_moveFlag) { + move(event); + _view.set_need_update(true); + } + _colorFlag = false; + _nameFlag = false; + _moveFlag = false; + _drag_sigs.clear(); + _view.normalize_layout(); +} + +void Header::move(QMouseEvent *event) +{ + bool _moveValid = false; + bool _moveUp = false; + bool firstCheck = true; + const vector< shared_ptr > sigs( + _view.session().get_signals()); + boost::shared_ptr minDragSig; + boost::shared_ptr maxDragSig; + int minOffset; + int minOldOffset; + int maxOffset; + int maxOldOffset; + int targetOffset; + std::list, + int> >::iterator minJ; + std::list, + int> >::iterator maxJ; + int targetOrder; + + // reCalculate _v_offset of all signals after dragging release + if ((event->button() == Qt::LeftButton)) { + while (!_drag_sigs.empty()) { + minOffset = INT_MAX; + maxOffset = 0; + for (std::list, + int> >::iterator i = _drag_sigs.begin(); + i != _drag_sigs.end(); i++) { + const boost::shared_ptr sig((*i).first); + if (sig) { + if (sig->get_v_offset() < minOffset) { + minDragSig = sig; + minOldOffset = (*i).second; + minOffset = sig->get_v_offset(); + minJ = i; + } + if (sig->get_v_offset() > maxOffset) { + maxDragSig = sig; + maxOldOffset = (*i).second; + maxOffset = sig->get_v_offset(); + maxJ = i; + } + } + } + if (minOffset > minOldOffset) { + _moveUp = false; + _drag_sigs.erase(maxJ); + } else { + _moveUp = true; + _drag_sigs.erase(minJ); + } + if (!_moveValid && firstCheck){ + firstCheck = false; + BOOST_FOREACH(const shared_ptr s, sigs) { + if (_moveUp) { + if (s->selected()) { + if ((minOffset <= s->get_old_v_offset()) && (minOffset > (s->get_old_v_offset() - _view.get_spanY()))) { + _moveValid = true; + targetOffset = s->get_old_v_offset(); + targetOrder = s->get_order(); + break; + } + } else { + if ((minOffset <= s->get_v_offset()) && (minOffset > (s->get_v_offset() - _view.get_spanY()))) { + _moveValid = true; + targetOffset = s->get_v_offset(); + targetOrder = s->get_order(); + break; + } + } + } else { + if (s->selected()) { + if ((maxOffset >= s->get_old_v_offset()) && (maxOffset < (s->get_old_v_offset() + _view.get_spanY()))) { + _moveValid = true; + targetOffset = s->get_old_v_offset(); + targetOrder = s->get_order(); + break; + } + } else { + if ((maxOffset >= s->get_v_offset()) && (maxOffset < (s->get_v_offset() + _view.get_spanY()))) { + _moveValid = true; + targetOffset = s->get_v_offset(); + targetOrder = s->get_order(); + break; + } + } + } + } + } + if (_moveValid) { + BOOST_FOREACH(const shared_ptr s, sigs) { + if (_moveUp) { + if (s->selected() && s == minDragSig) { + s->set_v_offset(targetOffset); + s->set_order(targetOrder); + s->select(false); + } else if (!s->selected() && s->get_v_offset() >= targetOffset && s->get_v_offset() < minOldOffset) { + s->set_v_offset(s->get_v_offset() + _view.get_spanY()); + s->set_order(s->get_order() + 1); + } + } else { + if (s->selected() && s == maxDragSig) { + s->set_v_offset(targetOffset); + s->set_order(targetOrder); + s->select(false); + } else if (!s->selected() && s->get_v_offset() <= targetOffset && s->get_v_offset() > maxOldOffset) { + s->set_v_offset(s->get_v_offset() - _view.get_spanY()); + s->set_order(s->get_order() - 1); + } + } + } + if (_moveUp) { + targetOffset += _view.get_spanY(); + targetOrder++; + } else { + targetOffset -= _view.get_spanY(); + targetOrder--; + } + } + } + if (_moveValid) { + signals_moved(); + } else { + BOOST_FOREACH(const shared_ptr s, sigs) { + if (s->selected()) { + s->set_v_offset(s->get_old_v_offset()); + s->select(false); + } + } + } + } + _moveValid = false; +} + +void Header::changeName(QMouseEvent *event) +{ + if ((event->button() == Qt::LeftButton)) { + header_resize(); + nameEdit->setText(_context_signal->get_name()); + nameEdit->selectAll(); + nameEdit->setFocus(); + nameEdit->show(); + header_updated(); + } +} + +void Header::changeColor(QMouseEvent *event) +{ + if ((event->button() == Qt::LeftButton)) { + const QColor new_color = QColorDialog::getColor(_context_signal->get_colour(), this, tr("Set Channel Colour")); + if (new_color.isValid()) + _context_signal->set_colour(new_color); + } +} + +void Header::mouseMoveEvent(QMouseEvent *event) +{ + assert(event); + _mouse_point = event->pos(); + + // Move the signals if we are dragging + if (!_drag_sigs.empty()) { + const int delta = event->pos().y() - _mouse_down_point.y(); + + for (std::list, + int> >::iterator i = _drag_sigs.begin(); + i != _drag_sigs.end(); i++) { + const boost::shared_ptr sig((*i).first); + if (sig) { + const int y = (*i).second + delta; + const int y_snap = + ((y + View::SignalSnapGridSize / 2) / + View::SignalSnapGridSize) * + View::SignalSnapGridSize; + if (y_snap != sig->get_v_offset()) { + _moveFlag = true; + sig->set_v_offset(y_snap); + } + // Ensure the signal is selected + sig->select(true); + } + + } + + //signals_moved(); + } + + update(); +} + +void Header::leaveEvent(QEvent*) +{ + _mouse_point = QPoint(-1, -1); + update(); +} + +void Header::contextMenuEvent(QContextMenuEvent *event) +{ + int action; + + const shared_ptr s = get_mouse_over_signal(action, _mouse_point); + + //if (!s || action != LABEL) + if (!s || !s->selected() || action != LABEL) + return; + + QMenu menu(this); + if (s->get_type() == Signal::DS_LOGIC) + menu.addAction(_action_add_group); + else if (s->get_type() == Signal::DS_GROUP) + menu.addAction(_action_del_group); + + _context_signal = s; + menu.exec(event->globalPos()); + _context_signal.reset(); +} + +void Header::on_action_set_name_triggered() +{ + shared_ptr context_signal = _context_signal; + if (!context_signal) + return; + + if (nameEdit->isModified()) { + context_signal->set_name(nameEdit->text()); + if (context_signal->get_type() == Signal::DS_LOGIC || + context_signal->get_type() == Signal::DS_ANALOG) + sr_dev_probe_name_set(_view.session().get_device(), context_signal->get_index(), nameEdit->text().toUtf8().constData()); + } + + nameEdit->hide(); + header_updated(); +} + +void Header::on_action_add_group_triggered() +{ + _view.session().add_group(); +} + +void Header::on_action_del_group_triggered() +{ + _view.session().del_group(); +} + +void Header::on_signals_moved() +{ + update(); +} + +void Header::header_resize() +{ + //if (nameEdit->isVisible()) { + if (_context_signal) { + const int y = _context_signal->get_v_offset() - _view.v_offset() - _view.get_signalHeight() / 2; + nameEdit->move(QPoint(_context_signal->get_leftWidth(), y - nameEdit->height() / 2)); + } +} + + +} // namespace view +} // namespace pv diff --git a/DSLogic-gui/pv/view/header.h b/DSLogic-gui/pv/view/header.h new file mode 100644 index 00000000..1756278b --- /dev/null +++ b/DSLogic-gui/pv/view/header.h @@ -0,0 +1,123 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_VIEW_HEADER_H +#define DSLOGIC_PV_VIEW_HEADER_H + +#include +#include + +#include +#include + +#include +#include + +namespace pv { +namespace view { + +class Signal; +class View; + +class Header : public QWidget +{ + Q_OBJECT + +public: + Header(View &parent); + +private: + static const int COLOR; + static const int NAME; + static const int POSTRIG; + static const int HIGTRIG; + static const int NEGTRIG; + static const int LOWTRIG; + static const int LABEL; + +private: + boost::shared_ptr get_mouse_over_signal( + int &action, + const QPoint &pt); + +private: + void paintEvent(QPaintEvent *event); + +private: + void mousePressEvent(QMouseEvent * event); + + void mouseReleaseEvent(QMouseEvent *event); + + void mouseMoveEvent(QMouseEvent *event); + + void leaveEvent(QEvent *event); + + void contextMenuEvent(QContextMenuEvent *event); + + void move(QMouseEvent *event); + void changeName(QMouseEvent *event); + void changeColor(QMouseEvent *event); + +public: + int get_nameEditWidth(); + void header_resize(); + +private slots: + void on_action_set_name_triggered(); + + void on_action_add_group_triggered(); + + void on_action_del_group_triggered(); + + void on_signals_moved(); + +signals: + void signals_moved(); + + void header_updated(); + +private: + View &_view; + + bool _moveFlag; + bool _colorFlag; + bool _nameFlag; + + QPoint _mouse_point; + QPoint _mouse_down_point; + + QLineEdit *nameEdit; + + std::list, int> > + _drag_sigs; + + boost::shared_ptr _context_signal; + + QAction *_action_add_group; + QAction *_action_del_group; +}; + +} // namespace view +} // namespace pv + +#endif // DSLOGIC_PV_VIEW_HEADER_H diff --git a/DSLogic-gui/pv/view/logicsignal.cpp b/DSLogic-gui/pv/view/logicsignal.cpp new file mode 100644 index 00000000..5e66bb79 --- /dev/null +++ b/DSLogic-gui/pv/view/logicsignal.cpp @@ -0,0 +1,268 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include + +#include + +#include "logicsignal.h" +#include "view.h" +#include "pv/data/logic.h" +#include "pv/data/logicsnapshot.h" + +using namespace boost; +using namespace std; + +namespace pv { +namespace view { + +//const float LogicSignal::Oversampling = 2.0f; +const float LogicSignal::Oversampling = 1.0f; + +const QColor LogicSignal::EdgeColour(0x80, 0x80, 0x80); +const QColor LogicSignal::HighColour(0x00, 0xC0, 0x00); +const QColor LogicSignal::LowColour(0xC0, 0x00, 0x00); + +const QColor LogicSignal::SignalColours[8] = { + QColor(0x16, 0x19, 0x1A), // Black + QColor(0x8F, 0x52, 0x02), // Brown + QColor(0xCC, 0x00, 0x00), // Red + QColor(0xF5, 0x79, 0x00), // Orange + QColor(0xED, 0xD4, 0x00), // Yellow + QColor(0x73, 0xD2, 0x16), // Green + QColor(0x34, 0x65, 0xA4), // Blue + QColor(0x75, 0x50, 0x7B), // Violet +// QColor(17, 133, 209), +// QColor(17, 133, 209), +// QColor(17, 133, 209), +// QColor(17, 133, 209), +// QColor(17, 133, 209), +// QColor(17, 133, 209), +// QColor(17, 133, 209), +// QColor(17, 133, 209), +}; + +const int LogicSignal::StateHeight = 12; +const int LogicSignal::StateRound = 5; + +LogicSignal::LogicSignal(QString name, shared_ptr data, + int probe_index, int order) : + Signal(name, probe_index, DS_LOGIC, order), + _probe_index(probe_index), + _data(data), + _need_decode(false), + _decoder(NULL) +{ + assert(_probe_index >= 0); + _colour = SignalColours[_probe_index % countof(SignalColours)]; +} + +LogicSignal::~LogicSignal() +{ +} + +void LogicSignal::set_data(boost::shared_ptr _logic_data, + boost::shared_ptr _analog_data, + boost::shared_ptr _group_data) +{ + (void)_analog_data; + (void)_group_data; + + assert(_logic_data); + + if (!_cur_edges.empty()) + _cur_edges.clear(); + + _data = _logic_data; +} + +void LogicSignal::paint(QPainter &p, int y, int left, int right, + double scale, double offset) +{ + using pv::view::View; + + QLineF *line; + + assert(scale > 0); + assert(_data); + assert(right >= left); + + const float high_offset = y - _signalHeight + 0.5f; + const float low_offset = y + 0.5f; + + const deque< shared_ptr > &snapshots = + _data->get_snapshots(); + if (snapshots.empty()) + return; + + const shared_ptr &snapshot = + snapshots.front(); + + double samplerate = _data->get_samplerate(); + + // Show sample rate as 1Hz when it is unknown + if (samplerate == 0.0) + samplerate = 1.0; + + const double pixels_offset = offset / scale; + const double start_time = _data->get_start_time(); + const int64_t last_sample = snapshot->get_sample_count() - 1; + const double samples_per_pixel = samplerate * scale; + const double start = samplerate * (offset - start_time); + const double end = start + samples_per_pixel * (right - left); + + snapshot->get_subsampled_edges(_cur_edges, + min(max((int64_t)floor(start), (int64_t)0), last_sample), + min(max((int64_t)ceil(end), (int64_t)0), last_sample), + samples_per_pixel / Oversampling, _probe_index); + assert(_cur_edges.size() >= 2); + + // Paint the edges + const unsigned int edge_count = 2 * _cur_edges.size() - 3; + QLineF *const edge_lines = new QLineF[edge_count]; + line = edge_lines; + + double preX = ((*(_cur_edges.begin())).first / samples_per_pixel - pixels_offset) + left; + double preY = (*(_cur_edges.begin())).second ? high_offset : low_offset; + vector::const_iterator i; + for ( i = _cur_edges.begin() + 1; i != _cur_edges.end() - 1; i++) { + const double x = ((*i).first / samples_per_pixel - + pixels_offset) + left; + const double y = (*i).second ? high_offset : low_offset; + *line++ = QLineF(preX, preY, x, preY); + *line++ = QLineF(x, high_offset, x, low_offset); + preX = x; + preY = y; + } + const double x = ((*i).first / samples_per_pixel - + pixels_offset) + left; + *line++ = QLineF(preX, preY, x, preY); + + p.setPen(_colour); + p.drawLines(edge_lines, edge_count); + delete[] edge_lines; + + if (_need_decode) { + assert(_decoder); + _decoder->get_subsampled_states(_cur_states, + min(max((int64_t)floor(start), (int64_t)0), last_sample), + min(max((int64_t)ceil(end), (int64_t)0), last_sample), + samples_per_pixel); + + const float top_offset = y - (_signalHeight + StateHeight) / 2.0f; + const uint64_t sig_mask = 1ULL << _probe_index; + const uint8_t *const init_ptr = (uint8_t*)snapshot->get_data(); + const uint8_t *src_ptr; + const int unit_size = snapshot->get_unit_size(); + uint64_t value; + uint64_t finalValue = 0; + + if (!_cur_states.empty()) { + _decoder->fill_color_table(_color_table); + _decoder->fill_state_table(_state_table); + + vector::const_iterator i; + for ( i = _cur_states.begin(); i != _cur_states.end(); i++) { + finalValue = 0; + const uint64_t index = (*i).index; + const uint64_t samples = (*i).samples; + const int64_t x = (index / samples_per_pixel - + pixels_offset) + left; + const int64_t width = samples / samples_per_pixel; + + if ((*i).type == decoder::DEC_DATA) { + src_ptr = init_ptr + index * unit_size; + for (uint64_t j = 0; j < samples; j++) { + value = (*(uint64_t*)src_ptr & sig_mask); + if (_probe_index - j > 0) + value = value >> (_probe_index - j); + else + value = value << (j - _probe_index); + finalValue |= value; + src_ptr += unit_size; + } + } + + p.setBrush(_color_table.at((*i).state)); + const QRectF state_rect = QRectF(x, top_offset, width, StateHeight); + p.drawRoundedRect(state_rect, StateRound, StateRound); + p.setPen(Qt::black); + if ((*i).type == decoder::DEC_CMD) + p.drawText(state_rect, Qt::AlignCenter | Qt::AlignVCenter, + _state_table.at((*i).state)); + else if ((*i).type == decoder::DEC_DATA) + p.drawText(state_rect, Qt::AlignCenter | Qt::AlignVCenter, + _state_table.at((*i).state) + "0x" + QString::number(finalValue, 16).toUpper()); + } + } + } +} + +void LogicSignal::paint_caps(QPainter &p, QLineF *const lines, + vector< pair > &edges, bool level, + double samples_per_pixel, double pixels_offset, float x_offset, + float y_offset) +{ + QLineF *line = lines; + + uint64_t curX = 0; + uint64_t nxtX = 0; + for (vector::const_iterator i = + edges.begin(); i != (edges.end() - 1); i++) + if ((*i).second == level) { + curX = ((*i).first / samples_per_pixel - + pixels_offset) + x_offset; + nxtX = ((*(i+1)).first / samples_per_pixel - + pixels_offset) + x_offset; + if (nxtX > curX) + *line++ = QLineF(curX, y_offset, nxtX, y_offset); + } + + p.drawLines(lines, line - lines); +} + +const std::vector< std::pair > LogicSignal::cur_edges() const +{ + return _cur_edges; +} + +void LogicSignal::set_decoder(pv::decoder::Decoder *decoder) +{ + assert(decoder); + _need_decode = true; + _decoder = decoder; +} + +decoder::Decoder *LogicSignal::get_decoder() +{ + return _decoder; +} + +void LogicSignal::del_decoder() +{ + _need_decode = false; + _decoder = NULL; +} + +} // namespace view +} // namespace pv diff --git a/DSLogic-gui/pv/view/logicsignal.h b/DSLogic-gui/pv/view/logicsignal.h new file mode 100644 index 00000000..39dd3888 --- /dev/null +++ b/DSLogic-gui/pv/view/logicsignal.h @@ -0,0 +1,110 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_LOGICSIGNAL_H +#define DSLOGIC_PV_LOGICSIGNAL_H + +#include "signal.h" +#include "../decoder/decoder.h" + +#include + +#include + +namespace pv { + +namespace data { +class Logic; +class Analog; +} + +namespace view { + +class LogicSignal : public Signal +{ +private: + static const float Oversampling; + + static const QColor EdgeColour; + static const QColor HighColour; + static const QColor LowColour; + + static const QColor SignalColours[8]; + + static const int StateHeight; + static const int StateRound; + +public: + LogicSignal(QString name, + boost::shared_ptr data, + int probe_index, int order); + + virtual ~LogicSignal(); + + void set_data(boost::shared_ptr _logic_data, + boost::shared_ptr _analog_data, + boost::shared_ptr _group_data); + /** + * Paints the signal with a QPainter + * @param p the QPainter to paint into. + * @param y the y-coordinate to draw the signal at. + * @param left the x-coordinate of the left edge of the signal. + * @param right the x-coordinate of the right edge of the signal. + * @param scale the scale in seconds per pixel. + * @param offset the time to show at the left hand edge of + * the view in seconds. + **/ + void paint(QPainter &p, int y, int left, int right, double scale, + double offset); + + const std::vector< std::pair > cur_edges() const; + + void set_decoder(pv::decoder::Decoder *decoder); + + pv::decoder::Decoder* get_decoder(); + + void del_decoder(); + +private: + + void paint_caps(QPainter &p, QLineF *const lines, + std::vector< std::pair > &edges, + bool level, double samples_per_pixel, double pixels_offset, + float x_offset, float y_offset); + +private: + int _probe_index; + boost::shared_ptr _data; + std::vector< std::pair > _cur_edges; + + bool _need_decode; + pv::decoder::Decoder * _decoder; + std::vector _cur_states; + std::vector< QColor > _color_table; + std::vector< QString > _state_table; +}; + +} // namespace view +} // namespace pv + +#endif // DSLOGIC_PV_LOGICSIGNAL_H diff --git a/DSLogic-gui/pv/view/protocolsignal.cpp b/DSLogic-gui/pv/view/protocolsignal.cpp new file mode 100644 index 00000000..91834d3e --- /dev/null +++ b/DSLogic-gui/pv/view/protocolsignal.cpp @@ -0,0 +1,190 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include + +#include + +#include "protocolsignal.h" +#include "view.h" +#include "pv/data/logic.h" +#include "pv/data/logicsnapshot.h" + + + +using namespace boost; +using namespace std; + +namespace pv { +namespace view { + +const int ProtocolSignal::StateHeight = 16; +const int ProtocolSignal::StateRound = 3; + +ProtocolSignal::ProtocolSignal(QString name, shared_ptr data, + pv::decoder::Decoder *decoder, std::list probe_index_list, int order, int protocol_index) : + Signal(name, probe_index_list, DS_PROTOCOL, order, protocol_index), + _probe_index_list(probe_index_list), + _data(data), + _decoder(decoder) +{ + assert(_probe_index_list.size() > 0); +} + +ProtocolSignal::~ProtocolSignal() +{ +} + +void ProtocolSignal::set_data(boost::shared_ptr _logic_data, + boost::shared_ptr _analog_data, + boost::shared_ptr _group_data) +{ + (void)_analog_data; + (void)_group_data; + + assert(_logic_data); + + if (!_cur_states.empty()) + _cur_states.clear(); + + _data = _logic_data; + _decoder->set_data(_logic_data); +} + +void ProtocolSignal::paint(QPainter &p, int y, int left, int right, double scale, double offset) +{ + using pv::view::View; + + //QLineF *line; + + assert(scale > 0); + assert(_data); + assert(right >= left); + + //const float top_offset = y - (_signalHeight + StateHeight) / 2.0f; + const float high_offset = y - _signalHeight + 0.5f; + const float middle_offset = y - _signalHeight / 2 + 0.5f; + //const float low_offset = y + 0.5f; + + const deque< shared_ptr > &snapshots = + _data->get_snapshots(); + if (snapshots.empty()) + return; + + const shared_ptr &snapshot = + snapshots.front(); + + double samplerate = _data->get_samplerate(); + + // Show sample rate as 1Hz when it is unknown + if (samplerate == 0.0) + samplerate = 1.0; + + const double pixels_offset = offset / scale; + const double start_time = _data->get_start_time(); + const int64_t last_sample = snapshot->get_sample_count() - 1; + const double samples_per_pixel = samplerate * scale; + const double start = samplerate * (offset - start_time); + const double end = start + samples_per_pixel * (right - left); + + _decoder->get_subsampled_states(_cur_states, + min(max((int64_t)floor(start), (int64_t)0), last_sample), + min(max((int64_t)ceil(end), (int64_t)0), last_sample), + samples_per_pixel); + + int64_t preX = left; + if (!_cur_states.empty()) { + _decoder->fill_color_table(_color_table); + _decoder->fill_state_table(_state_table); + +// const unsigned int edge_count = 2 * _cur_states.size(); +// QLineF *const edge_lines = new QLineF[edge_count]; +// line = edge_lines; + + vector::const_iterator i; + const int counter_init = 1; + int counter = counter_init; + for ( i = _cur_states.begin(); i != _cur_states.end(); i++) { + const uint64_t index = (*i).index; + const uint64_t samples = (*i).samples; + const int64_t x = (index / samples_per_pixel - + pixels_offset) + left; + const int64_t width = samples / samples_per_pixel; + +// *line++ = QLineF(x, high_offset, x, low_offset); +// *line++ = QLineF(x + width, high_offset, x + width, low_offset); + + p.setPen(dsBlue); + p.setBrush(_color_table.at((*i).state)); + const QRectF state_rect = QRectF(x, high_offset, width, _signalHeight); + //const QRectF cmd_rect = QRectF(x + width / 2 - 5, low_offset - 12, 10, 10); + p.drawRoundedRect(state_rect, StateRound, StateRound); + p.setPen(Qt::black); + if ((*i).type == decoder::DEC_CMD) { + counter = counter_init; + p.drawText(state_rect, Qt::AlignCenter | Qt::AlignCenter, + _state_table.at((*i).state)); + //p.drawRect(cmd_rect); + } else if ((*i).type == decoder::DEC_DATA) { + counter = counter_init; + p.drawText(state_rect, Qt::AlignCenter | Qt::AlignCenter, + _state_table.at((*i).state) + " 0x" + QString::number((*i).data, 16).toUpper()); + } else if ((*i).type == decoder::DEC_CNT) { + p.drawText(state_rect, Qt::AlignCenter | Qt::AlignCenter, + _state_table.at((*i).state) + QString::number(counter) + ": 0x" + QString::number((*i).data, 16).toUpper()); + counter++; + } + if (x > preX) + p.drawLine(preX, middle_offset, x, middle_offset); + preX = x + width; + } + +// p.setPen(_colour); +// p.drawLines(edge_lines, edge_count); +// delete[] edge_lines; + } + p.drawLine(preX, middle_offset, right, middle_offset); +} + +const std::vector< std::pair > ProtocolSignal::cur_edges() const +{ + +} + +void ProtocolSignal::set_decoder(pv::decoder::Decoder *decoder) +{ + (void)decoder; +} + +decoder::Decoder *ProtocolSignal::get_decoder() +{ + return _decoder; +} + +void ProtocolSignal::del_decoder() +{ +} + +} // namespace view +} // namespace pv + diff --git a/DSLogic-gui/pv/view/protocolsignal.h b/DSLogic-gui/pv/view/protocolsignal.h new file mode 100644 index 00000000..e608be46 --- /dev/null +++ b/DSLogic-gui/pv/view/protocolsignal.h @@ -0,0 +1,86 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_PROTOCOLSIGNAL_H +#define DSLOGIC_PV_PROTOCOLSIGNAL_H + +#include "signal.h" +#include "../decoder/decoder.h" + +#include + +#include + +namespace pv { + +namespace data { +class Logic; +} +namespace decoder { +class Decoder; +} + +namespace view { + +class ProtocolSignal : public Signal +{ +private: + static const int StateHeight; + static const int StateRound; + +public: + ProtocolSignal(QString name, + boost::shared_ptr data, + pv::decoder::Decoder *decoder, + std::list index_list, int order, int protocol_index); + + virtual ~ProtocolSignal(); + + void set_data(boost::shared_ptr _logic_data, + boost::shared_ptr _analog_data, + boost::shared_ptr _group_data); + + void paint(QPainter &p, int y, int left, int right, double scale, + double offset); + + const std::vector< std::pair > cur_edges() const; + + void set_decoder(pv::decoder::Decoder *decoder); + + pv::decoder::Decoder* get_decoder(); + + void del_decoder(); + +private: + std::list _probe_index_list; + boost::shared_ptr _data; + pv::decoder::Decoder * _decoder; + std::vector _cur_states; + std::vector< QColor > _color_table; + std::vector< QString > _state_table; +}; + +} // namespace view +} // namespace pv + +#endif // DSLOGIC_PV_PROTOCOLSIGNAL_H diff --git a/DSLogic-gui/pv/view/ruler.cpp b/DSLogic-gui/pv/view/ruler.cpp new file mode 100644 index 00000000..1441318a --- /dev/null +++ b/DSLogic-gui/pv/view/ruler.cpp @@ -0,0 +1,625 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "ruler.h" + +#include "cursor.h" +#include "view.h" +#include "viewport.h" +#include "../sigsession.h" + +#include + +#include +#include +#include + +#include +#include +#include +#include + +using namespace std; + +namespace pv { +namespace view { + +const int Ruler::MinorTickSubdivision = 4; +const int Ruler::ScaleUnits[3] = {1, 2, 5}; +const int Ruler::MinPeriodScale = 10; + +const QString Ruler::SIPrefixes[9] = + {"f", "p", "n", QChar(0x03BC), "m", "", "k", "M", "G"}; +const QString Ruler::FreqPrefixes[9] = + {"P", "T", "G", "M", "K", "", "", "", ""}; +const int Ruler::FirstSIPrefixPower = -15; +const int Ruler::pricision = 2; + +const int Ruler::HoverArrowSize = 5; + +const int Ruler::CursorSelWidth = 20; +const QColor Ruler::CursorColor[8] = + {QColor(25, 189, 155, 200), + QColor(46, 205, 113, 200), + QColor(53, 152, 220, 200), + QColor(154, 89, 181, 200), + QColor(52, 73, 94 , 200), + QColor(242, 196, 15, 200), + QColor(231, 126, 34, 200), + QColor(232, 76, 61, 200)}; + +const QColor Ruler::dsBlue = QColor(17, 133, 209, 255); +const QColor Ruler::dsYellow = QColor(238, 178, 17, 255); +const QColor Ruler::dsRed = QColor(213, 15, 37, 255); +const QColor Ruler::dsGreen = QColor(0, 153, 37, 255); + +const QColor Ruler::HitColor = dsYellow; +const QColor Ruler::WarnColor = dsRed; + +Ruler::Ruler(View &parent) : + QWidget(&parent), + _view(parent), + _cursor_sel_visible(false), + _cursor_go_visible(false), + _cursor_sel_x(-1), + _grabbed_marker(NULL) +{ + setMouseTracking(true); + + connect(&_view, SIGNAL(hover_point_changed()), + this, SLOT(hover_point_changed())); +} + +QString Ruler::format_freq(double period, unsigned precision) +{ + if (period <= 0) { + return "#####"; + } else { + const int order = ceil(log10f(period)); + assert(order >= FirstSIPrefixPower); + const unsigned int prefix = ceil((order - FirstSIPrefixPower) / 3.0f); + const double multiplier = pow(10.0, + - prefix * 3 - FirstSIPrefixPower); + + QString s; + QTextStream ts(&s); + ts.setRealNumberPrecision(precision); + ts << fixed << forcesign << 1 / (period * multiplier) << + FreqPrefixes[prefix] << "Hz"; + return s; + } +} + +QString Ruler::format_time(double t, unsigned int prefix, + unsigned int precision) +{ + const double multiplier = pow(10.0, + - prefix * 3 - FirstSIPrefixPower); + + QString s; + QTextStream ts(&s); + ts.setRealNumberPrecision(precision); + ts << fixed << forcesign << (t * multiplier) << + SIPrefixes[prefix] << "s"; + return s; +} + +QString Ruler::format_time(double t) +{ + return format_time(t, _cur_prefix); +} + +TimeMarker* Ruler::get_grabbed_cursor() +{ + return _grabbed_marker; +} + +void Ruler::set_grabbed_cursor(TimeMarker *grabbed_marker) +{ + _grabbed_marker = grabbed_marker; + _grabbed_marker->set_grabbed(true); +} + +void Ruler::rel_grabbed_cursor() +{ + if (_grabbed_marker) { + _grabbed_marker->set_grabbed(false); + _grabbed_marker = NULL; + } +} + +void Ruler::paintEvent(QPaintEvent*) +{ + QStyleOption o; + o.initFrom(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this); + + //QPainter p(this); + //p.setRenderHint(QPainter::Antialiasing); + + // Draw tick mark + draw_logic_tick_mark(p); + + p.setRenderHint(QPainter::Antialiasing); + // Draw the hover mark + draw_hover_mark(p); + + // Draw cursor selection + if (_cursor_sel_visible || _cursor_go_visible) + draw_cursor_sel(p); + + p.end(); +} + +void Ruler::mouseMoveEvent(QMouseEvent *e) +{ + (void)e; + + if (_grabbed_marker) { + _grabbed_marker->set_time(_view.offset() + + _view.hover_point().x() * _view.scale()); + } + + update(); + _view.viewport()->update(); +} + +void Ruler::leaveEvent(QEvent *) +{ + _cursor_sel_visible = false; + _cursor_go_visible = false; + update(); +} + +void Ruler::mousePressEvent(QMouseEvent *e) +{ + (void)e; +} + +void Ruler::mouseReleaseEvent(QMouseEvent *event) +{ + bool addCursor = false; + if (event->button() & Qt::LeftButton) { + bool hitCursor = false; + if (!_cursor_sel_visible & !_view.get_cursorList().empty()) { + _view.show_cursors(true); + if (_grabbed_marker) { + rel_grabbed_cursor(); + hitCursor = true; + } else { + list::iterator i = _view.get_cursorList().begin(); + while (i != _view.get_cursorList().end()) { + if ((*i)->get_close_rect(rect()).contains(event->pos())) { + _view.del_cursor(*i); + if (_view.get_cursorList().empty()) { + _cursor_sel_visible = false; + _view.show_cursors(false); + } + hitCursor = true; + break; + } + if ((*i)->get_label_rect(rect()).contains(event->pos())) { + set_grabbed_cursor(*i); + _cursor_sel_visible = false; + _cursor_go_visible = false; + hitCursor = true; + break; + } + i++; + } + } + } + if (!hitCursor && !_grabbed_marker) { + if (!_cursor_go_visible) { + if (!_cursor_sel_visible) { + _cursor_sel_x = event->pos().x(); + _cursor_sel_visible = true; + } else { + int overCursor; + double time = _view.offset() + (_cursor_sel_x + 0.5) * _view.scale(); + overCursor = in_cursor_sel_rect(event->pos()); + if (overCursor == 0) { + //Cursor *newCursor = new Cursor(_view, CursorColor[_view.get_cursorList().size() % 8], time); + //_view.get_cursorList().push_back(newCursor); + _view.add_cursor(CursorColor[_view.get_cursorList().size() % 8], time); + _view.show_cursors(true); + addCursor = true; + } else if (overCursor > 0) { + list::iterator i = _view.get_cursorList().begin(); + while (--overCursor != 0) + i++; + (*i)->set_time(time); + } + _cursor_sel_visible = false; + } + } else { + int overCursor; + overCursor = in_cursor_sel_rect(event->pos()); + if (overCursor > 0) { +// list::iterator i = _view.get_cursorList().begin(); +// while (--overCursor != 0) +// i++; +// _view.set_scale_offset(_view.scale(), (*i)->time() - _view.scale() * _view.viewport()->width() / 2); + _view.set_cursor_middle(overCursor - 1); + } + + _cursor_go_visible = false; + } + } + } + + if (event->button() & Qt::RightButton) { + if (!_cursor_sel_visible) { + if (!_cursor_go_visible) { + _cursor_sel_x = event->pos().x(); + _cursor_go_visible = true; + } + } else { + int overCursor; + overCursor = in_cursor_sel_rect(event->pos()); + if (overCursor > 0) { + list::iterator i = _view.get_cursorList().begin(); + while (--overCursor != 0) + i++; + _view.del_cursor(*i); + } + if (_view.get_cursorList().empty()) { + _cursor_sel_visible = false; + _view.show_cursors(false); + } + } + } + + update(); + if (addCursor) { + const QRect reDrawRect = QRect(_cursor_sel_x - 1, 0, 3, _view.viewport()->height()); + _view.viewport()->update(reDrawRect); + } +} + +void Ruler::draw_tick_mark(QPainter &p) +{ + using namespace Qt; + + const double SpacingIncrement = 32.0f; + const double MinValueSpacing = 16.0f; + const int ValueMargin = 5; + + double min_width = SpacingIncrement, typical_width; + double tick_period; + unsigned int prefix; + + // Find tick spacing, and number formatting that does not cause + // value to collide. + do + { + _min_period = _view.scale() * min_width; + + //const int order = (int)floorf(log10f(_min_period)); + const int order = ceil(log10f(_min_period)); + const double order_decimal = pow(10, order); + + unsigned int unit = 0; + + do + { + tick_period = order_decimal * ScaleUnits[unit++]; + } while (tick_period < _min_period && unit < countof(ScaleUnits)); + + prefix = ceil((order - FirstSIPrefixPower) / 3.0f); + assert(prefix < countof(SIPrefixes)); + + + typical_width = p.boundingRect(0, 0, INT_MAX, INT_MAX, + AlignLeft | AlignTop, format_time(_view.offset(), + prefix)).width() + MinValueSpacing; + + min_width += SpacingIncrement; + + } while(typical_width > tick_period / _view.scale()); + + const int text_height = p.boundingRect(0, 0, INT_MAX, INT_MAX, + AlignLeft | AlignTop, "8").height(); + + // Draw the tick marks + p.setPen(dsBlue); + + const double minor_tick_period = tick_period / MinorTickSubdivision; + const double first_major_division = + floor(_view.offset() / tick_period); + const double first_minor_division = + ceil(_view.offset() / minor_tick_period); + const double t0 = first_major_division * tick_period; + + int division = (int)round(first_minor_division - + first_major_division * MinorTickSubdivision) - 1; + + const int major_tick_y1 = text_height + ValueMargin * 3; + const int tick_y2 = height(); + const int minor_tick_y1 = (major_tick_y1 + tick_y2) / 2; + + double x; + + do { + const double t = t0 + division * minor_tick_period; + x = (t - _view.offset()) / _view.scale(); + + if (division % MinorTickSubdivision == 0) + { + // Draw a major tick + p.drawText(x, 2 * ValueMargin, 0, text_height, + AlignCenter | AlignTop | TextDontClip, + format_time(t, prefix)); + p.drawLine(QPointF(x, major_tick_y1), + QPointF(x, tick_y2)); + } + else + { + // Draw a minor tick + p.drawLine(QPointF(x, minor_tick_y1), + QPointF(x, tick_y2)); + } + + division++; + + } while (x < width()); + + // Draw the cursors + if (!_view.get_cursorList().empty()) { + list::iterator i = _view.get_cursorList().begin(); + int index = 1; + while (i != _view.get_cursorList().end()) { + (*i)->paint_label(p, rect(), prefix, index); + index++; + i++; + } + } +} + +void Ruler::draw_logic_tick_mark(QPainter &p) +{ + using namespace Qt; + + const double SpacingIncrement = 32.0f; + const double MinValueSpacing = 16.0f; + const int ValueMargin = 5; + + const double abs_min_period = 10.0f / _view.session().get_last_sample_rate(); + + double min_width = SpacingIncrement; + double typical_width; + double tick_period = 0; + + const uint64_t cur_period_scale = ceil((_view.scale() * min_width) / abs_min_period); + + // Find tick spacing, and number formatting that does not cause + // value to collide. + _min_period = cur_period_scale * abs_min_period; + const int order = (int)floorf(log10f(_min_period)); + //const double order_decimal = pow(10, order); + const unsigned int prefix = (order - FirstSIPrefixPower) / 3; + _cur_prefix = prefix; + assert(prefix < countof(SIPrefixes)); + typical_width = p.boundingRect(0, 0, INT_MAX, INT_MAX, + AlignLeft | AlignTop, format_time(_view.offset(), + prefix)).width() + MinValueSpacing; + do + { + tick_period += _min_period; + + } while(typical_width > tick_period / _view.scale()); + + const int text_height = p.boundingRect(0, 0, INT_MAX, INT_MAX, + AlignLeft | AlignTop, "8").height(); + + // Draw the tick marks + p.setPen(dsBlue); + + const double minor_tick_period = tick_period / MinPeriodScale; + const int minor_order = (int)floorf(log10f(minor_tick_period)); + //const double minor_order_decimal = pow(10, minor_order); + const unsigned int minor_prefix = (minor_order - FirstSIPrefixPower) / 3; + assert(minor_prefix < countof(SIPrefixes)); + + const double first_major_division = + floor(_view.offset() / tick_period); + const double first_minor_division = + floor(_view.offset() / minor_tick_period + 1); + const double t0 = first_major_division * tick_period; + + int division = (int)round(first_minor_division - + first_major_division * MinPeriodScale) - 1; + + const int major_tick_y1 = text_height + ValueMargin * 3; + const int tick_y2 = height(); + const int minor_tick_y1 = (major_tick_y1 + tick_y2) / 2; + + double x; + + const double inc_text_width = p.boundingRect(0, 0, INT_MAX, INT_MAX, + AlignLeft | AlignTop, + format_time(tick_period - minor_tick_period, + minor_prefix)).width() + MinValueSpacing; + do { + const double t = t0 + division * minor_tick_period; + const double major_t = t0 + floor(division / MinPeriodScale) * tick_period; + + x = (t - _view.offset()) / _view.scale(); + + if (division % MinPeriodScale == 0) + { + // Draw a major tick + p.drawText(x, 2 * ValueMargin, 0, text_height, + AlignCenter | AlignTop | TextDontClip, + format_time(t, prefix)); + p.drawLine(QPointF(x, major_tick_y1), + QPointF(x, tick_y2)); + } + else + { + // Draw a minor tick + if (minor_tick_period / _view.scale() > 2 * typical_width || + tick_period / _view.scale() > width()) + p.drawText(x, 2 * ValueMargin, 0, text_height, + AlignCenter | AlignTop | TextDontClip, + format_time(t, prefix)); + //else if ((tick_period / _view.scale() > width() / 4) && (minor_tick_period / _view.scale() > inc_text_width)) + else if (minor_tick_period / _view.scale() > 1.2 * inc_text_width) + p.drawText(x, 2 * ValueMargin, 0, minor_tick_y1 + ValueMargin, + AlignCenter | AlignTop | TextDontClip, + format_time(t - major_t, minor_prefix)); + p.drawLine(QPointF(x, minor_tick_y1), + QPointF(x, tick_y2)); + } + + division++; + + } while (x < width()); + + // Draw the cursors + if (!_view.get_cursorList().empty()) { + list::iterator i = _view.get_cursorList().begin(); + int index = 1; + while (i != _view.get_cursorList().end()) { + (*i)->paint_label(p, rect(), prefix, index); + index++; + i++; + } + _view.on_cursor_moved(); + } + if (_view.trig_cursor_shown()) { + _view.get_trig_cursor()->paint_fix_label(p, rect(), prefix, 'T', Signal::dsLightRed); + } + if (_view.search_cursor_shown()) { + _view.get_search_cursor()->paint_fix_label(p, rect(), prefix, 'S', Signal::dsLightBlue); + } +} + +void Ruler::draw_hover_mark(QPainter &p) +{ + const double x = _view.hover_point().x(); + + if (x == -1 || _grabbed_marker) + return; + + p.setPen(QPen(Qt::NoPen)); + p.setBrush(dsBlue); + + const int b = height() - 1; + const QPointF points[] = { + QPointF(x, b), + QPointF(x - HoverArrowSize, b - HoverArrowSize), + QPointF(x + HoverArrowSize, b - HoverArrowSize) + }; + p.drawPolygon(points, countof(points)); +} + +void Ruler::draw_cursor_sel(QPainter &p) +{ + if (_cursor_sel_x == -1) + return; + + p.setPen(QPen(Qt::NoPen)); + p.setBrush(dsBlue); + + const QPoint pos = QPoint(_view.hover_point().x(), _view.hover_point().y()); + if (in_cursor_sel_rect(pos) == 0) + p.setBrush(HitColor); + + const int y = height(); + const QRectF selRect = get_cursor_sel_rect(0); + const QPointF del_points[] = { + QPointF(_cursor_sel_x + CursorSelWidth / 2, (selRect.top() + CursorSelWidth / 2)), + QPointF((selRect.left() + selRect.right()) / 2, selRect.top()), + selRect.topLeft(), + selRect.bottomLeft(), + QPointF((selRect.left() + selRect.right()) / 2, selRect.bottom()) + }; + const QPointF points[] = { + QPointF(_cursor_sel_x, y), + selRect.bottomLeft(), + selRect.topLeft(), + selRect.topRight(), + selRect.bottomRight() + }; + p.drawPolygon((_cursor_go_visible ? del_points : points), countof(points)); + + if (!_view.get_cursorList().empty()) { + int index = 1; + list::iterator i = _view.get_cursorList().begin(); + while (i != _view.get_cursorList().end()) { + const QRectF cursorRect = get_cursor_sel_rect(index); + p.setPen(QPen(Qt::black, 1, Qt::DotLine)); + p.drawLine(cursorRect.left(), cursorRect.top() + 3, + cursorRect.left(), cursorRect.bottom() - 3); + p.setPen(QPen(Qt::NoPen)); + if (in_cursor_sel_rect(pos) == index) + p.setBrush(HitColor); + else + p.setBrush(CursorColor[(index - 1)%8]); + p.drawRect(cursorRect); + p.setPen(Qt::black); + p.drawText(cursorRect, Qt::AlignCenter | Qt::AlignVCenter, QString::number(index)); + index++; + i++; + } + } +} + +int Ruler::in_cursor_sel_rect(QPointF pos) +{ + if (_cursor_sel_x == -1) + return -1; + + for (unsigned int i = 0; i < _view.get_cursorList().size() + 1; i++) { + const QRectF cursorRect = get_cursor_sel_rect(i); + if (cursorRect.contains(pos)) + return i; + } + + return -1; +} + +QRectF Ruler::get_cursor_sel_rect(int index) +{ + if (_cursor_sel_x == -1) + return QRectF(-1, -1, 0, 0); + const int y = height(); + return QRectF(_cursor_sel_x - (0.5 - index) * CursorSelWidth, + y - 1.3 * CursorSelWidth, + CursorSelWidth, CursorSelWidth); +} + +void Ruler::hover_point_changed() +{ + update(); +} + +const double Ruler::get_min_period() const +{ + return _min_period / MinPeriodScale; +} + +} // namespace view +} // namespace pv diff --git a/DSLogic-gui/pv/view/ruler.h b/DSLogic-gui/pv/view/ruler.h new file mode 100644 index 00000000..8d9bc83d --- /dev/null +++ b/DSLogic-gui/pv/view/ruler.h @@ -0,0 +1,118 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_VIEW_RULER_H +#define DSLOGIC_PV_VIEW_RULER_H + +#include + +namespace pv { +namespace view { + +class TimeMarker; +class View; + +class Ruler : public QWidget +{ + Q_OBJECT + +private: + static const int MinorTickSubdivision; + static const int ScaleUnits[3]; + static const int MinPeriodScale; + + static const QString SIPrefixes[9]; + static const QString FreqPrefixes[9]; + static const int FirstSIPrefixPower; + static const int pricision; + + static const int HoverArrowSize; + static const int CursorSelWidth; + + static const QColor dsBlue; + static const QColor dsYellow; + static const QColor dsRed; + static const QColor dsGreen; + +public: + static const QColor CursorColor[8]; + static const QColor HitColor; + static const QColor WarnColor; + +public: + Ruler(View &parent); + + static QString format_time(double t, unsigned int prefix, + unsigned precision = pricision); + static QString format_freq(double period, unsigned precision = pricision); + QString format_time(double t); + + TimeMarker* get_grabbed_cursor(); + void set_grabbed_cursor(TimeMarker* grabbed_marker); + void rel_grabbed_cursor(); + + const double get_min_period() const; + +private: + void paintEvent(QPaintEvent *event); + + void mouseMoveEvent(QMouseEvent *e); + void mousePressEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *event); + void leaveEvent(QEvent *); + +private: + void draw_tick_mark(QPainter &p); + void draw_logic_tick_mark(QPainter &p); + /** + * Draw a hover arrow under the cursor position. + */ + void draw_hover_mark(QPainter &p); + + void draw_cursor_sel(QPainter &p); + + int in_cursor_sel_rect(QPointF pos); + + QRectF get_cursor_sel_rect(int index); + +private slots: + void hover_point_changed(); + +private: + View &_view; + + bool _cursor_sel_visible; + bool _cursor_go_visible; + int _cursor_sel_x; + + TimeMarker *_grabbed_marker; + + double _min_period; + + unsigned int _cur_prefix; +}; + +} // namespace view +} // namespace pv + +#endif // DSLOGIC_PV_VIEW_RULER_H diff --git a/DSLogic-gui/pv/view/signal.cpp b/DSLogic-gui/pv/view/signal.cpp new file mode 100644 index 00000000..2ac4e926 --- /dev/null +++ b/DSLogic-gui/pv/view/signal.cpp @@ -0,0 +1,440 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include + +#include + +#include + +#include "signal.h" +#include "view.h" + +namespace pv { +namespace view { + +const int Signal::SquareWidth = 20; +const int Signal::Margin = 5; + +const int Signal::COLOR = 1; +const int Signal::NAME = 2; +const int Signal::POSTRIG = 3; +const int Signal::HIGTRIG = 4; +const int Signal::NEGTRIG = 5; +const int Signal::LOWTRIG = 6; +const int Signal::LABEL = 7; + +const QColor Signal::dsBlue = QColor(17, 133, 209, 255); +const QColor Signal::dsYellow = QColor(238, 178, 17, 255); +const QColor Signal::dsRed = QColor(213, 15, 37, 255); +const QColor Signal::dsGreen = QColor(0, 153, 37, 255); +const QColor Signal::dsGray = QColor(0x88, 0x8A, 0x85, 100); +const QColor Signal::dsLightBlue = QColor(17, 133, 209, 150); +const QColor Signal::dsLightRed = QColor(213, 15, 37, 150); + +const QPen Signal::SignalAxisPen(QColor(128, 128, 128, 64)); + +Signal::Signal(QString name, int index, int type, int order) : + _type(type), + _order(order), + _sec_index(0), + _name(name), + _v_offset(0), + _signalHeight(30), + _selected(false), + _trig(0) +{ + _index_list.push_back(index); +} + +Signal::Signal(QString name, std::list index_list, int type, int order, int sec_index) : + _type(type), + _index_list(index_list), + _order(order), + _sec_index(sec_index), + _name(name), + _v_offset(0), + _signalHeight(30), + _selected(false), + _trig(0) +{ +} + +int Signal::get_type() const +{ + return _type; +} + +int Signal::get_order() const +{ + return _order; +} + +void Signal::set_order(int order) +{ + assert(order >= 0); + + _order = order; +} + +int Signal::get_leftWidth() const +{ + return SquareWidth + Margin; +} + +int Signal::get_rightWidth() const +{ + return 2 * Margin + 4 * SquareWidth + 1.5 * SquareWidth; +} + +int Signal::get_headerHeight() const +{ + return SquareWidth; +} + +int Signal::get_index() const +{ + return _index_list.front(); +} + +std::list &Signal::get_index_list() +{ + return _index_list; +} + +void Signal::set_index_list(std::list index_list) +{ + assert(index_list.size() != 0); + + _index_list = index_list; +} + +int Signal::get_sec_index() const +{ + return _sec_index; +} + +void Signal::set_sec_index(int sec_index) +{ + _sec_index = sec_index; +} + +QString Signal::get_name() const +{ + return _name; +} + +void Signal::set_name(QString name) +{ + _name = name; +} + +QColor Signal::get_colour() const +{ + return _colour; +} + +void Signal::set_colour(QColor colour) +{ + _colour = colour; +} + +int Signal::get_v_offset() const +{ + return _v_offset; +} + +void Signal::set_v_offset(int v_offset) +{ + _v_offset = v_offset; +} + +int Signal::get_old_v_offset() const +{ + return _old_v_offset; +} + +void Signal::set_old_v_offset(int v_offset) +{ + _old_v_offset = v_offset; +} + +int Signal::get_signalHeight() const +{ + return _signalHeight; +} + +void Signal::set_signalHeight(int height) +{ + _signalHeight = height; +} + +bool Signal::selected() const +{ + return _selected; +} + +void Signal::select(bool select) +{ + _selected = select; +} + +int Signal::get_trig() const +{ + return _trig; +} + +void Signal::set_trig(int trig) +{ + _trig = trig; + if (trig == 0) + ds_trigger_probe_set(_index_list.front(), 'X', 'X'); + else if (trig == POSTRIG) + ds_trigger_probe_set(_index_list.front(), 'R', 'X'); + else if (trig == HIGTRIG) + ds_trigger_probe_set(_index_list.front(), '1', 'X'); + else if (trig == NEGTRIG) + ds_trigger_probe_set(_index_list.front(), 'F', 'X'); + else if (trig == LOWTRIG) + ds_trigger_probe_set(_index_list.front(), '0', 'X'); +} + +void Signal::paint_label(QPainter &p, int y, int right, bool hover, int action) +{ + compute_text_size(p); + const QRectF color_rect = get_rect("color", y, right); + const QRectF name_rect = get_rect("name", y, right); + const QRectF posTrig_rect = get_rect("posTrig", y, right); + const QRectF higTrig_rect = get_rect("higTrig", y, right); + const QRectF negTrig_rect = get_rect("negTrig", y, right); + const QRectF lowTrig_rect = get_rect("lowTrig", y, right); + const QRectF label_rect = get_rect("label", y, right); + + p.setRenderHint(QPainter::Antialiasing); + // Paint the ColorButton + p.setPen(Qt::transparent); + p.setBrush(_colour); + p.drawRect(color_rect); + + // Paint the signal name + p.setPen(Qt::black); + p.drawText(name_rect, Qt::AlignLeft | Qt::AlignVCenter, _name); + + // Paint the trigButton + if (_type == DS_LOGIC) { + p.setPen(Qt::transparent); + p.setBrush(((hover && action == POSTRIG) || (_trig == POSTRIG)) ? + dsYellow : + dsBlue); + p.drawRect(posTrig_rect); + p.setBrush(((hover && action == HIGTRIG) || (_trig == HIGTRIG)) ? + dsYellow : + dsBlue); + p.drawRect(higTrig_rect); + p.setBrush(((hover && action == NEGTRIG) || (_trig == NEGTRIG)) ? + dsYellow : + dsBlue); + p.drawRect(negTrig_rect); + p.setBrush(((hover && action == LOWTRIG) || (_trig == LOWTRIG)) ? + dsYellow : + dsBlue); + p.drawRect(lowTrig_rect); + + p.setPen(QPen(Qt::blue, 1, Qt::DotLine)); + p.setBrush(Qt::transparent); + p.drawLine(posTrig_rect.right(), posTrig_rect.top() + 3, + posTrig_rect.right(), posTrig_rect.bottom() - 3); + p.drawLine(higTrig_rect.right(), higTrig_rect.top() + 3, + higTrig_rect.right(), higTrig_rect.bottom() - 3); + p.drawLine(negTrig_rect.right(), negTrig_rect.top() + 3, + negTrig_rect.right(), negTrig_rect.bottom() - 3); + + p.setPen(QPen(Qt::white, 2, Qt::SolidLine)); + p.setBrush(Qt::transparent); + p.drawLine(posTrig_rect.left() + 5, posTrig_rect.bottom() - 5, + posTrig_rect.center().x(), posTrig_rect.bottom() - 5); + p.drawLine(posTrig_rect.center().x(), posTrig_rect.bottom() - 5, + posTrig_rect.center().x(), posTrig_rect.top() + 5); + p.drawLine(posTrig_rect.center().x(), posTrig_rect.top() + 5, + posTrig_rect.right() - 5, posTrig_rect.top() + 5); + + p.drawLine(higTrig_rect.left() + 5, higTrig_rect.top() + 5, + higTrig_rect.right() - 5, higTrig_rect.top() + 5); + + p.drawLine(negTrig_rect.left() + 5, negTrig_rect.top() + 5, + negTrig_rect.center().x(), negTrig_rect.top() + 5); + p.drawLine(negTrig_rect.center().x(), negTrig_rect.top() + 5, + negTrig_rect.center().x(), negTrig_rect.bottom() - 5); + p.drawLine(negTrig_rect.center().x(), negTrig_rect.bottom() - 5, + negTrig_rect.right() - 5, negTrig_rect.bottom() - 5); + + p.drawLine(lowTrig_rect.left() + 5, lowTrig_rect.bottom() - 5, + lowTrig_rect.right() - 5, lowTrig_rect.bottom() - 5); + } else if (_type == DS_GROUP || _type == DS_PROTOCOL) { + const QRectF group_index_rect = get_rect("groupIndex", y, right); + QString index_string; + int last_index; + p.setPen(Qt::transparent); + p.setBrush(dsBlue); + p.drawRect(group_index_rect); + std::list::iterator i = _index_list.begin(); + last_index = (*i); + index_string = QString::number(last_index); + while (++i != _index_list.end()) { + if ((*i) == last_index + 1 && index_string.indexOf("-") < 3 && index_string.indexOf("-") > 0) + index_string.replace(QString::number(last_index), QString::number((*i))); + else if ((*i) == last_index + 1) + index_string = QString::number((*i)) + "-" + index_string; + else + index_string = QString::number((*i)) + "," + index_string; + last_index = (*i); + } + p.setPen(Qt::white); + p.drawText(group_index_rect, Qt::AlignRight | Qt::AlignVCenter, index_string); + } + + // Paint the label + const QPointF points[] = { + label_rect.topLeft(), + label_rect.topRight(), + QPointF(right, y), + label_rect.bottomRight(), + label_rect.bottomLeft() + }; + + p.setPen(Qt::transparent); + p.setBrush(((hover && action == LABEL) || _selected) ? dsYellow : dsBlue); + p.drawPolygon(points, countof(points)); + + if ((hover && action == LABEL) || _selected) { + p.setPen(QPen(dsBlue, 2, Qt::DotLine)); + p.setBrush(Qt::transparent); + p.drawPoint(label_rect.right(), label_rect.top() + 4); + p.drawPoint(label_rect.right(), label_rect.top() + 8); + p.drawPoint(label_rect.right(), label_rect.top() + 12); + p.drawPoint(label_rect.right(), label_rect.top() + 16); + } + + // Paint the text + p.setPen(Qt::white); + if (_type == DS_GROUP) + p.drawText(label_rect, Qt::AlignCenter | Qt::AlignVCenter, "G"); + else if (_type == DS_ANALOG) + p.drawText(label_rect, Qt::AlignCenter | Qt::AlignVCenter, "A"); + else if (_type == DS_PROTOCOL) + p.drawText(label_rect, Qt::AlignCenter | Qt::AlignVCenter, "D"); + else + p.drawText(label_rect, Qt::AlignCenter | Qt::AlignVCenter, QString::number(_index_list.front())); +} + +int Signal::pt_in_rect(int y, int right, const QPoint &point) +{ + const QRectF color = get_rect("color", y, right); + const QRectF name = get_rect("name", y, right); + const QRectF posTrig = get_rect("posTrig", y, right); + const QRectF higTrig = get_rect("higTrig", y, right); + const QRectF negTrig = get_rect("negTrig", y, right); + const QRectF lowTrig = get_rect("lowTrig", y, right); + const QRectF label = get_rect("label", y, right); + + if (color.contains(point)) + return COLOR; + else if (name.contains(point)) + return NAME; + else if (posTrig.contains(point) && _type == DS_LOGIC) + return POSTRIG; + else if (higTrig.contains(point) && _type == DS_LOGIC) + return HIGTRIG; + else if (negTrig.contains(point) && _type == DS_LOGIC) + return NEGTRIG; + else if (lowTrig.contains(point) && _type == DS_LOGIC) + return LOWTRIG; + else if (label.contains(point)) + return LABEL; + else + return 0; +} + +void Signal::paint_axis(QPainter &p, int y, int left, int right) +{ + p.setPen(SignalAxisPen); + p.drawLine(QPointF(left, y + 0.5f), QPointF(right, y + 0.5f)); +} + +void Signal::compute_text_size(QPainter &p) +{ + _text_size = QSize( + p.boundingRect(QRectF(), 0, "99").width(), + p.boundingRect(QRectF(), 0, "99").height()); +} + +QRectF Signal::get_rect(const char *s, int y, int right) +{ + const QSizeF color_size(SquareWidth, SquareWidth); + const QSizeF name_size(right - get_leftWidth() - get_rightWidth(), SquareWidth); + const QSizeF label_size(_text_size.width() + Margin, SquareWidth); + + if (!strcmp(s, "name")) + return QRectF( + get_leftWidth(), + y - name_size.height() / 2, + name_size.width(), name_size.height()); + else if (!strcmp(s, "label")) + return QRectF( + right - 1.5f * label_size.width(), + y - label_size.height() / 2, + label_size.width(), label_size.height()); + else if (!strcmp(s, "posTrig")) + return QRectF( + get_leftWidth() + name_size.width() + Margin, + y - color_size.height() / 2, + color_size.width(), color_size.height()); + else if (!strcmp(s, "higTrig")) + return QRectF( + get_leftWidth() + name_size.width() + SquareWidth + Margin, + y - color_size.height() / 2, + color_size.width(), color_size.height()); + else if (!strcmp(s, "negTrig")) + return QRectF( + get_leftWidth() + name_size.width() + 2 * SquareWidth + Margin, + y - color_size.height() / 2, + color_size.width(), color_size.height()); + else if (!strcmp(s, "lowTrig")) + return QRectF( + get_leftWidth() + name_size.width() + 3 * SquareWidth + Margin, + y - color_size.height() / 2, + color_size.width(), color_size.height()); + else if (!strcmp(s, "groupIndex")) + return QRectF( + get_leftWidth() + name_size.width() + Margin, + y - color_size.height() / 2, + color_size.width() * 4, color_size.height()); + else + return QRectF( + 2, + y - color_size.height() / 2, + color_size.width(), color_size.height()); +} + +} // namespace view +} // namespace pv diff --git a/DSLogic-gui/pv/view/signal.h b/DSLogic-gui/pv/view/signal.h new file mode 100644 index 00000000..f6f82424 --- /dev/null +++ b/DSLogic-gui/pv/view/signal.h @@ -0,0 +1,272 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_SIGNAL_H +#define DSLOGIC_PV_SIGNAL_H + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include "libsigrok4DSLogic/libsigrok.h" + +namespace pv { + +namespace data { +class SignalData; +class Logic; +class Analog; +class Group; +} + +namespace decoder { +class Decoder; +} + +namespace view { + +class Signal +{ +private: + static const int SquareWidth; + static const int Margin; + + static const int COLOR; + static const int NAME; + static const int POSTRIG; + static const int HIGTRIG; + static const int NEGTRIG; + static const int LOWTRIG; + static const int LABEL; + +public: + static const QColor dsBlue; + static const QColor dsYellow; + static const QColor dsRed; + static const QColor dsGreen; + static const QColor dsGray; + static const QColor dsLightBlue; + static const QColor dsLightRed; + static const QPen SignalAxisPen; + + enum {DS_LOGIC = 0, DS_ANALOG, DS_GROUP, DS_PROTOCOL}; + +protected: + Signal(QString name, int index, int type, int order); + Signal(QString name, std::list index_list, int type, int order, int sec_index); + +public: + int get_type() const; + int get_order() const; + void set_order(int order); + + /** + * Gets the header area size + */ + int get_leftWidth() const; + int get_rightWidth() const; + int get_headerHeight() const; + int get_index() const; + std::list &get_index_list(); + void set_index_list(std::list index_list); + int get_sec_index() const; + void set_sec_index(int sec_index); + + /** + * Gets the name of this signal. + */ + QString get_name() const; + + /** + * Sets the name of the signal. + */ + void set_name(QString name); + + /** + * Get the colour of the signal. + */ + QColor get_colour() const; + + /** + * Set the colour of the signal. + */ + void set_colour(QColor colour); + + /** + * Gets the vertical layout offset of this signal. + */ + int get_v_offset() const; + + /** + * Sets the vertical layout offset of this signal. + */ + void set_v_offset(int v_offset); + + /** + * Gets the height of this signal. + */ + int get_signalHeight() const; + + /** + * Sets the height of this signal. + */ + void set_signalHeight(int height); + + /** + * Gets the old vertical layout offset of this signal. + */ + int get_old_v_offset() const; + + /** + * Sets the old vertical layout offset of this signal. + */ + void set_old_v_offset(int v_offset); + + /** + * Returns true if the signal has been selected by the user. + */ + bool selected() const; + + /** + * Selects or deselects the signal. + */ + void select(bool select = true); + + /* + * + */ + int get_trig() const; + void set_trig(int trig); + + /** + * Paints the signal with a QPainter + * @param p the QPainter to paint into. + * @param y the y-coordinate to draw the signal at + * @param left the x-coordinate of the left edge of the signal + * @param right the x-coordinate of the right edge of the signal + * @param scale the scale in seconds per pixel. + * @param offset the time to show at the left hand edge of + * the view in seconds. + **/ + virtual void paint(QPainter &p, int y, int left, int right, + double scale, double offset) = 0; + + virtual const std::vector< std::pair > cur_edges() const = 0; + + virtual void set_decoder(pv::decoder::Decoder *decoder) = 0; + + virtual pv::decoder::Decoder* get_decoder() = 0; + + virtual void del_decoder() = 0; + + virtual void set_data(boost::shared_ptr _logic_data, + boost::shared_ptr _analog_data, + boost::shared_ptr _group_data) = 0; + + /** + * Paints the signal label into a QGLWidget. + * @param p the QPainter to paint into. + * @param y the y-coordinate of the signal. + * @param right the x-coordinate of the right edge of the header + * area. + * @param hover true if the label is being hovered over by the mouse. + */ + virtual void paint_label(QPainter &p, int y, int right, + bool hover, int action); + + /** + * Determines if a point is in the header rect. + * 1 - in color rect + * 2 - in name rect + * 3 - in posTrig rect + * 4 - in higTrig rect + * 5 - in negTrig rect + * 6 - in lowTrig rect + * 7 - in label rect + * 0 - not + * @param y the y-coordinate of the signal. + * @param right the x-coordinate of the right edge of the header + * area. + * @param point the point to test. + */ + int pt_in_rect(int y, int right, + const QPoint &point); + +protected: + + /** + * Paints a zero axis across the viewport. + * @param p the QPainter to paint into. + * @param y the y-offset of the axis. + * @param left the x-coordinate of the left edge of the view. + * @param right the x-coordinate of the right edge of the view. + */ + void paint_axis(QPainter &p, int y, int left, int right); + +private: + + /** + * Computes an caches the size of the label text. + */ + void compute_text_size(QPainter &p); + + /** + * Computes the outline rectangle of a label. + * @param p the QPainter to lay out text with. + * @param y the y-coordinate of the signal. + * @param right the x-coordinate of the right edge of the header + * area. + * @return Returns the rectangle of the signal label. + */ + QRectF get_rect(const char *s, int y, int right); + +protected: + int _type; + std::list _index_list; + int _order; + int _sec_index; + QString _name; + QColor _colour; + int _v_offset; + int _old_v_offset; + + int _signalHeight; + + bool _selected; + + int _trig; + + QSizeF _text_size; +}; + +} // namespace view +} // namespace pv + +#endif // DSLOGIC_PV_SIGNAL_H diff --git a/DSLogic-gui/pv/view/timemarker.cpp b/DSLogic-gui/pv/view/timemarker.cpp new file mode 100644 index 00000000..74b833d9 --- /dev/null +++ b/DSLogic-gui/pv/view/timemarker.cpp @@ -0,0 +1,78 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "timemarker.h" + +#include "view.h" + +#include + +namespace pv { +namespace view { + +TimeMarker::TimeMarker(View &view, QColor &colour, + double time) : + _view(view), + _time(time), + _grabbed(false), + _colour(colour) +{ +} + +TimeMarker::TimeMarker(const TimeMarker &s) : + QObject(), + _view(s._view), + _time(s._time), + _colour(s._colour) +{ +} + +bool TimeMarker::grabbed() const +{ + return _grabbed; +} +void TimeMarker::set_grabbed(bool grabbed) +{ + _grabbed = grabbed; +} + +double TimeMarker::time() const +{ + return _time; +} + +void TimeMarker::set_time(double time) +{ + _time = time; + time_changed(); +} + +void TimeMarker::paint(QPainter &p, const QRect &rect, const bool highlight) +{ + const float x = (_time - _view.offset()) / _view.scale(); + p.setPen((_grabbed | highlight) ? QPen(_colour.lighter(), 2, Qt::DashLine) : QPen(_colour, 1, Qt::DashLine)); + p.drawLine(QPointF(x, rect.top()), QPointF(x, rect.bottom())); +} + +} // namespace view +} // namespace pv diff --git a/DSLogic-gui/pv/view/timemarker.h b/DSLogic-gui/pv/view/timemarker.h new file mode 100644 index 00000000..9b25d73f --- /dev/null +++ b/DSLogic-gui/pv/view/timemarker.h @@ -0,0 +1,118 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_VIEW_MARKER_H +#define DSLOGIC_PV_VIEW_MARKER_H + +#include +#include +#include + +class QPainter; +class QRect; + +namespace pv { +namespace view { + +class View; + +class TimeMarker : public QObject +{ + Q_OBJECT + +protected: + /** + * Constructor. + * @param view A reference to the view that owns this marker. + * @param colour A reference to the colour of this cursor. + * @param time The time to set the flag to. + */ + TimeMarker(View &view, QColor &colour, double time); + + /** + * Copy constructor + */ + TimeMarker(const TimeMarker &s); + +public: + /** + * Gets the time of the marker. + */ + double time() const; + + /** + * Sets the time of the marker. + */ + void set_time(double time); + + /* + * + */ + bool grabbed() const; + void set_grabbed(bool grabbed); + + /** + * Paints the marker to the viewport. + * @param p The painter to draw with. + * @param rect The rectangle of the viewport client area. + */ + virtual void paint(QPainter &p, const QRect &rect, const bool highlight); + + /** + * Gets the marker label rectangle. + * @param rect The rectangle of the ruler client area. + * @return Returns the label rectangle. + */ + virtual QRectF get_label_rect(const QRect &rect) const = 0; + + /** + * Paints the marker's label to the ruler. + * @param p The painter to draw with. + * @param rect The rectangle of the ruler client area. + * @param prefix The SI prefix to paint time value with. + */ + virtual void paint_label(QPainter &p, const QRect &rect, + unsigned int prefix, int index) = 0; + + virtual void paint_fix_label(QPainter &p, const QRect &rect, + unsigned int prefix, QChar label, QColor color) = 0; + +signals: + void time_changed(); + +protected: + View &_view; + + double _time; + + QSizeF _text_size; + +private: + bool _grabbed; + QColor _colour; +}; + +} // namespace view +} // namespace pv + +#endif // DSLOGIC_PV_VIEW_MARKER_H diff --git a/DSLogic-gui/pv/view/view.cpp b/DSLogic-gui/pv/view/view.cpp new file mode 100644 index 00000000..7d9d8bd3 --- /dev/null +++ b/DSLogic-gui/pv/view/view.cpp @@ -0,0 +1,702 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include +#include +#include + +#include + +#include +#include +#include + +#include "header.h" +#include "ruler.h" +#include "signal.h" +#include "view.h" +#include "viewport.h" + +#include "pv/sigsession.h" +#include "pv/data/logic.h" +#include "pv/data/logicsnapshot.h" + +using namespace boost; +using namespace std; + +namespace pv { +namespace view { + +const int View::LabelMarginWidth = 70; +const int View::RulerHeight = 50; + +const int View::MaxScrollValue = INT_MAX / 2; + +//const int View::SignalHeight = 30;s +const int View::SignalMargin = 10; +const int View::SignalSnapGridSize = 10; + +const QColor View::CursorAreaColour(220, 231, 243); + +const QSizeF View::LabelPadding(4, 4); + +const int View::WellPixelsPerSample = 1.0f; +const double View::MaxViewRate = 1.0f; + +View::View(SigSession &session, QWidget *parent) : + QAbstractScrollArea(parent), + _session(session), + _viewport(new Viewport(*this)), + _ruler(new Ruler(*this)), + _header(new Header(*this)), + _data_length(0), + _scale(1e-8), + _preScale(1e-6), + _maxscale(1e9), + _minscale(1e-15), + _offset(0), + _preOffset(0), + _v_offset(0), + _updating_scroll(false), + _need_update(false), + _show_cursors(false), + _hover_point(-1, -1) +{ + setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + + connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), + this, SLOT(h_scroll_value_changed(int))); + connect(verticalScrollBar(), SIGNAL(valueChanged(int)), + this, SLOT(v_scroll_value_changed(int))); + + connect(&_session, SIGNAL(signals_changed()), + this, SLOT(signals_changed())); + connect(&_session, SIGNAL(data_updated()), + this, SLOT(data_updated())); + connect(&_session, SIGNAL(sample_rate_changed(quint64)), + this, SLOT(sample_rate_changed(quint64))); + connect(&_session, SIGNAL(receive_data(quint64)), + this, SLOT(receive_data(quint64))); + connect(&_session, SIGNAL(receive_trigger(quint64)), + this, SLOT(set_trig_pos(quint64))); + + connect(_header, SIGNAL(signals_moved()), + this, SLOT(on_signals_moved())); + connect(_header, SIGNAL(header_updated()), + this, SLOT(header_updated())); + + setViewportMargins(headerWidth(), RulerHeight, 0, 0); + setViewport(_viewport); + + _viewport->installEventFilter(this); + _ruler->installEventFilter(this); + _header->installEventFilter(this); + + _viewport->setObjectName(tr("ViewArea_viewport")); + _ruler->setObjectName(tr("ViewArea_ruler")); + _header->setObjectName(tr("ViewArea_header")); + + _show_trig_cursor = false; + _trig_cursor = new Cursor(*this, Signal::dsLightRed, 0); + _show_search_cursor = false; + _search_pos = 0; + _search_cursor = new Cursor(*this, Signal::dsLightBlue, _search_pos); +} + +SigSession& View::session() +{ + return _session; +} + +double View::scale() const +{ + return _scale; +} + +double View::offset() const +{ + return _offset; +} + +int View::v_offset() const +{ + return _v_offset; +} + +double View::get_minscale() const +{ + return _minscale; +} + +double View::get_maxscale() const +{ + return _maxscale; +} + +void View::zoom(double steps) +{ + zoom(steps, (width() - headerWidth()) / 2); +} + +void View::set_need_update(bool need_update) +{ + _need_update = need_update; +} + +bool View::need_update() const +{ + return _need_update; +} + +void View::zoom(double steps, int offset) +{ + //if (_session.get_capture_state() == SigSession::Stopped) { + _preScale = _scale; + _preOffset = _offset; + + const double cursor_offset = _offset + _scale * offset; + _scale *= pow(3.0/2.0, -steps); + _scale = max(min(_scale, _maxscale), _minscale); + _offset = cursor_offset - _scale * offset; + const double MinOffset = -(_scale * (_viewport->width() * (1 - MaxViewRate))); + const double MaxOffset = _data_length * 1.0f / _session.get_last_sample_rate() - + _scale * (_viewport->width() * MaxViewRate); + _offset = max(min(_offset, MaxOffset), MinOffset); + + if (_scale != _preScale || _offset != _preOffset) { + _ruler->update(); + _viewport->update(); + update_scroll(); + } + //} +} + + +void View::set_scale_offset(double scale, double offset) +{ + //if (_session.get_capture_state() == SigSession::Stopped) { + _preScale = _scale; + _preOffset = _offset; + + _scale = max(min(scale, _maxscale), _minscale); + const double MinOffset = -(_scale * (_viewport->width() * (1 - MaxViewRate))); + const double MaxOffset = _data_length * 1.0f / _session.get_last_sample_rate() + - _scale * (_viewport->width() * MaxViewRate); + _offset = max(min(offset, MaxOffset), MinOffset); + + if (_scale != _preScale || _offset != _preOffset) { + update_scroll(); + _ruler->update(); + _viewport->update(); + } + //} +} + +void View::set_preScale_preOffset() +{ + //assert(_preScale <= _maxscale); + //assert(_preScale >= _minscale); + //assert(_preOffset >= 0); + + set_scale_offset(_preScale, _preOffset); +} + +bool View::cursors_shown() const +{ + return _show_cursors; +} + +bool View::trig_cursor_shown() const +{ + return _show_trig_cursor; +} + +bool View::search_cursor_shown() const +{ + return _show_search_cursor; +} + +void View::show_cursors(bool show) +{ + _show_cursors = show; + _ruler->update(); + _viewport->update(); +} + +void View::show_trig_cursor(bool show) +{ + _show_trig_cursor = show; + _ruler->update(); + _viewport->update(); +} + +void View::show_search_cursor(bool show) +{ + _show_search_cursor = show; + _ruler->update(); + _viewport->update(); +} + +void View::set_trig_pos(quint64 trig_pos) +{ + const double time = trig_pos * 1.0f / _session.get_last_sample_rate(); + _trig_pos = trig_pos; + _trig_cursor->set_time(time); + _show_trig_cursor = true; + set_scale_offset(_scale, time - _scale * _viewport->width() / 2); + _ruler->update(); + _viewport->update(); +} + +void View::set_search_pos(uint64_t search_pos) +{ + //assert(search_pos >= 0); + + const double time = search_pos * 1.0f / _session.get_last_sample_rate(); + _search_pos = search_pos; + _search_cursor->set_time(time); + set_scale_offset(_scale, time - _scale * _viewport->width() / 2); + _ruler->update(); + _viewport->update(); +} + +uint64_t View::get_trig_pos() +{ + return _trig_pos; +} + +uint64_t View::get_search_pos() +{ + return _search_pos; +} + +const QPointF& View::hover_point() const +{ + return _hover_point; +} + +void View::normalize_layout() +{ + const vector< shared_ptr > sigs(_session.get_signals()); + + int v_min = INT_MAX; + BOOST_FOREACH(const shared_ptr s, sigs) + v_min = min(s->get_v_offset(), v_min); + + const int delta = -min(v_min, 0); + BOOST_FOREACH(shared_ptr s, sigs) + s->set_v_offset(s->get_v_offset() + delta); + + verticalScrollBar()->setSliderPosition(_v_offset + delta); + v_scroll_value_changed(verticalScrollBar()->sliderPosition()); +} + + +int View::get_spanY() +{ + return _spanY; +} + +int View::get_signalHeight() +{ + return SignalHeight; +} + +void View::get_scroll_layout(double &length, double &offset) const +{ + const shared_ptr sig_data = _session.get_data(); + if (!sig_data) + return; + + length = _data_length / (sig_data->get_samplerate() * _scale); + offset = _offset / _scale; +} + +void View::update_scroll() +{ + assert(_viewport); + + const QSize areaSize = _viewport->size(); + + // Set the horizontal scroll bar + double length = 0, offset = 0; + get_scroll_layout(length, offset); + length = max(length - areaSize.width(), 0.0); + + horizontalScrollBar()->setPageStep(areaSize.width() / 2); + + _updating_scroll = true; + + if (length < MaxScrollValue) { + horizontalScrollBar()->setRange(0, length); + horizontalScrollBar()->setSliderPosition(offset); + } else { + horizontalScrollBar()->setRange(0, MaxScrollValue); + horizontalScrollBar()->setSliderPosition( + _offset * MaxScrollValue / (_scale * length)); + } + + _updating_scroll = false; + + // Set the vertical scrollbar + verticalScrollBar()->setPageStep(areaSize.height()); + verticalScrollBar()->setRange(0, + _viewport->get_total_height() + SignalMargin - + areaSize.height()); +} + +void View::reset_signal_layout() +{ + if (_session.get_signals().size()) + SignalHeight = + ((_viewport->height() - horizontalScrollBar()->height()) / + _session.get_signals().size()) + - 2 * SignalMargin; + + int offset = SignalMargin + SignalHeight; + _spanY = SignalHeight + 2 * SignalMargin; + + const vector< shared_ptr > sigs(_session.get_signals()); + BOOST_FOREACH(shared_ptr s, sigs) { + s->set_signalHeight(SignalHeight); + //s->set_v_offset(offset); + //offset += SignalHeight + 2 * SignalMargin; + s->set_v_offset(offset + s->get_order() * _spanY); + } + normalize_layout(); +} + +bool View::eventFilter(QObject *object, QEvent *event) +{ + const QEvent::Type type = event->type(); + if (type == QEvent::MouseMove) { + + const QMouseEvent *const mouse_event = (QMouseEvent*)event; + if (object == _ruler || object == _viewport) { + //_hover_point = QPoint(mouse_event->x(), 0); + double cur_periods = (mouse_event->pos().x() * _scale + _offset) / _ruler->get_min_period(); + double integer_x = (round(cur_periods) * _ruler->get_min_period() - _offset ) / _scale; + double cur_deviate_x = qAbs(mouse_event->pos().x() - integer_x); + if (cur_deviate_x < 10) + _hover_point = QPointF(integer_x, mouse_event->pos().y()); + else + _hover_point = mouse_event->pos(); + } else if (object == _header) + _hover_point = QPoint(0, mouse_event->y()); + else + _hover_point = QPoint(-1, -1); + + hover_point_changed(); + + } else if (type == QEvent::Leave) { + _hover_point = QPoint(-1, -1); + hover_point_changed(); + } + + return QObject::eventFilter(object, event); +} + +bool View::viewportEvent(QEvent *e) +{ + switch(e->type()) { + case QEvent::Paint: + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseButtonDblClick: + case QEvent::MouseMove: + case QEvent::Wheel: + return false; + + default: + return QAbstractScrollArea::viewportEvent(e); + } +} + +int View::headerWidth() +{ + int headerWidth; + int maxNameWidth = 0; + int maxLeftWidth = 0; + int maxRightWidth = 0; + const vector< shared_ptr > sigs(_session.get_signals()); + if (!sigs.empty()){ + BOOST_FOREACH(const shared_ptr s, sigs) { + maxNameWidth = max(s->get_name().length() * 6, maxNameWidth); + maxLeftWidth = max(s->get_leftWidth(), maxLeftWidth); + maxRightWidth = max(s->get_rightWidth(), maxRightWidth); + } + } + maxNameWidth = max(_header->get_nameEditWidth(), maxNameWidth); + headerWidth = maxLeftWidth + maxNameWidth + maxRightWidth; + + setViewportMargins(headerWidth, RulerHeight, 0, 0); + + return headerWidth; +} + +void View::resizeEvent(QResizeEvent*) +{ + update_margins(); + update_scroll(); + if (_session.get_capture_state() == SigSession::Stopped) { + _maxscale = (_data_length * 1.0f / _session.get_last_sample_rate()) / (_viewport->width() * MaxViewRate); + _scale = min(_scale, _maxscale); + } + reset_signal_layout(); + _header->header_resize(); + _need_update = true; +} + +void View::h_scroll_value_changed(int value) +{ + if (_updating_scroll) + return; + + _preOffset = _offset; + + const double MinOffset = -(_scale * (_viewport->width() * (1 - MaxViewRate))); + const double MaxOffset = _data_length * 1.0f / _session.get_last_sample_rate() + - _scale * (_viewport->width() * MaxViewRate); + + const int range = horizontalScrollBar()->maximum(); + if (range < MaxScrollValue) + _offset = _scale * value; + else { + double length = 0, offset; + get_scroll_layout(length, offset); + _offset = _scale * length * value / MaxScrollValue; + } + + _offset = max(min(_offset, MaxOffset), MinOffset); + + if (_offset != _preOffset) { + _ruler->update(); + _viewport->update(); + } +} + +void View::v_scroll_value_changed(int value) +{ + _v_offset = value; + _header->update(); + _viewport->update(); +} + +void View::signals_changed() +{ + reset_signal_layout(); +} + +void View::data_updated() +{ + // Get the new data length + _data_length = max(_session.get_total_sample_len(), (quint64)1000); + _maxscale = (_data_length * 1.0f / _session.get_last_sample_rate()) / (_viewport->width() * MaxViewRate); + _scale = min(_scale, _maxscale); + + setViewportMargins(headerWidth(), RulerHeight, 0, 0); + update_margins(); + + // Update the scroll bars + update_scroll(); + + // Repaint the view + _need_update = true; + _viewport->update(); +} + +void View::update_margins() +{ + _ruler->setGeometry(_viewport->x(), 0, + _viewport->width(), _viewport->y()); + _header->setGeometry(0, _viewport->y(), + _viewport->x(), _viewport->height()); +} + +void View::header_updated() +{ + headerWidth(); + update_margins(); + + // Update the scroll bars + update_scroll(); + + _viewport->update(); + _header->update(); +} + +void View::sample_rate_changed(quint64 sample_rate) +{ + assert(sample_rate > 0); + + _scale = (1.0f / sample_rate) / WellPixelsPerSample; + _minscale = (1.0f / sample_rate) / (_viewport->width() * MaxViewRate); + _offset = 0; + _preScale = _scale; + _preOffset = _offset; + + _ruler->update(); + _viewport->update(); +} + +void View::marker_time_changed() +{ + _ruler->update(); + _viewport->update(); +} + +void View::on_signals_moved() +{ + update_scroll(); + signals_moved(); +} + +/* + * cursorList + */ +std::list& View::get_cursorList() +{ + return _cursorList; +} + +Cursor* View::get_trig_cursor() +{ + return _trig_cursor; +} + +Cursor* View::get_search_cursor() +{ + return _search_cursor; +} + +Ruler* View::get_ruler() +{ + return _ruler; +} + +void View::add_cursor(QColor color, double time) +{ + Cursor *newCursor = new Cursor(*this, color, time); + _cursorList.push_back(newCursor); + cursor_update(); +} + +void View::del_cursor(Cursor* cursor) +{ + assert(cursor); + + _cursorList.remove(cursor); + delete cursor; + cursor_update(); +} + +void View::set_cursor_middle(int index) +{ + assert(index < (int)_cursorList.size()); + + list::iterator i = _cursorList.begin(); + while (index-- != 0) + i++; + set_scale_offset(_scale, (*i)->time() - _scale * _viewport->width() / 2); +} + +void View::receive_data(quint64 length) +{ + _viewport->set_receive_len(length); +} + +QString View::get_mm_width() +{ + return _viewport->get_mm_width(); +} + +QString View::get_mm_period() +{ + return _viewport->get_mm_period(); +} + +QString View::get_mm_freq() +{ + return _viewport->get_mm_freq(); +} + +QString View::get_cm_time(int index) +{ + return _ruler->format_time(get_cursor_time(index)); +} + +QString View::get_cm_delta(int index1, int index2) +{ + if (index1 == index2) + return "0"; + + return _ruler->format_time(abs(get_cursor_time(index1) - + get_cursor_time(index2))); +} + +QString View::get_cm_delta_cnt(int index1, int index2) +{ + if (index1 == index2) + return "0"; + + return QString::number( + floor(abs(get_cursor_time(index1) - + get_cursor_time(index2)) * _session.get_data()->get_samplerate())); +} + +double View::get_cursor_time(int index) +{ + assert(index < (int)_cursorList.size()); + + int curIndex = 0; + for (list::iterator i = _cursorList.begin(); + i != _cursorList.end(); i++) { + if (index == curIndex) { + return (*i)->time(); + } + curIndex++; + } +} + +void View::on_mouse_moved() +{ + mouse_moved(); +} +void View::on_cursor_moved() +{ + cursor_moved(); +} + +void View::set_measure_en(int enable) +{ + _viewport->set_measure_en(enable); +} + +void View::on_state_changed(bool stop) +{ + if (stop) + _viewport->stop_trigger_timer(); +} + +} // namespace view +} // namespace pv diff --git a/DSLogic-gui/pv/view/view.h b/DSLogic-gui/pv/view/view.h new file mode 100644 index 00000000..346e298f --- /dev/null +++ b/DSLogic-gui/pv/view/view.h @@ -0,0 +1,257 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_VIEW_VIEW_H +#define DSLOGIC_PV_VIEW_VIEW_H + +#include + +#include +#include + +#include "cursor.h" +#include "signal.h" + +namespace pv { + +class SigSession; + +namespace view { + +class Header; +class Ruler; +class Viewport; + +class View : public QAbstractScrollArea { + Q_OBJECT + +private: + static const int LabelMarginWidth; + static const int RulerHeight; + + static const int MaxScrollValue; + +public: + //static const int SignalHeight; + static const int SignalMargin; + static const int SignalSnapGridSize; + + static const QColor CursorAreaColour; + + static const QSizeF LabelPadding; + + static const int WellPixelsPerSample; + + static const double MaxViewRate; + +public: + explicit View(SigSession &session, QWidget *parent = 0); + + SigSession& session(); + + /** + * Returns the view time scale in seconds per pixel. + */ + double scale() const; + + /** + * Returns the time offset of the left edge of the view in + * seconds. + */ + double offset() const; + int v_offset() const; + + void zoom(double steps); + void zoom(double steps, int offset); + + /** + * Sets the scale and offset. + * @param scale The new view scale in seconds per pixel. + * @param offset The view time offset in seconds. + */ + void set_scale_offset(double scale, double offset); + void set_preScale_preOffset(); + + /** + * Returns true if cursors are displayed. false otherwise. + */ + bool cursors_shown() const; + bool trig_cursor_shown() const; + bool search_cursor_shown() const; + + int get_spanY(); + + int get_signalHeight(); + + int headerWidth(); + + Ruler* get_ruler(); + + /** + * Shows or hides the cursors. + */ + void show_cursors(bool show = true); + + const QPointF& hover_point() const; + + void normalize_layout(); + + void show_trig_cursor(bool show = true); + + void show_search_cursor(bool show = true); + + /* + * cursorList + */ + std::list& get_cursorList(); + void add_cursor(QColor color, double time); + void del_cursor(Cursor* cursor); + void set_cursor_middle(int index); + + Cursor* get_trig_cursor(); + Cursor* get_search_cursor(); + + //void set_trig_pos(uint64_t trig_pos); + void set_search_pos(uint64_t search_pos); + + uint64_t get_trig_pos(); + uint64_t get_search_pos(); + + /* + * + */ + double get_minscale() const; + double get_maxscale() const; + + void set_need_update(bool need_update); + bool need_update() const; + + QString get_mm_width(); + QString get_mm_period(); + QString get_mm_freq(); + QString get_cm_time(int index); + QString get_cm_delta(int index1, int index2); + QString get_cm_delta_cnt(int index1, int index2); + + void on_mouse_moved(); + void on_cursor_moved(); + + void on_state_changed(bool stop); + +signals: + void hover_point_changed(); + + void signals_moved(); + + void cursor_update(); + + void mouse_moved(); + void cursor_moved(); + +private: + void get_scroll_layout(double &length, double &offset) const; + + void update_scroll(); + + void reset_signal_layout(); + + void update_margins(); + + double get_cursor_time(int index); + +private: + bool eventFilter(QObject *object, QEvent *event); + + bool viewportEvent(QEvent *e); + + void resizeEvent(QResizeEvent *e); + +public slots: + void set_measure_en(int enable); + +private slots: + + void h_scroll_value_changed(int value); + void v_scroll_value_changed(int value); + + void signals_changed(); + void data_updated(); + + void marker_time_changed(); + + void on_signals_moved(); + + void header_updated(); + + void sample_rate_changed(quint64 sample_rate); + + void receive_data(quint64 length); + + void set_trig_pos(quint64 trig_pos); + +private: + + SigSession &_session; + + Viewport *_viewport; + Ruler *_ruler; + Header *_header; + + uint64_t _data_length; + + /// The view time scale in seconds per pixel. + double _scale; + double _preScale; + double _maxscale; + double _minscale; + + /// The view time offset in seconds. + double _offset; + double _preOffset; + + int _spanY; + int SignalHeight; + + int _v_offset; + bool _updating_scroll; + + bool _need_update; + + bool _show_cursors; + + std::list _cursorList; + + Cursor *_trig_cursor; + bool _show_trig_cursor; + uint64_t _trig_pos; + Cursor *_search_cursor; + bool _show_search_cursor; + uint64_t _search_pos; + + QPointF _hover_point; +}; + +} // namespace view +} // namespace pv + +#endif // DSLOGIC_PV_VIEW_VIEW_H diff --git a/DSLogic-gui/pv/view/viewport.cpp b/DSLogic-gui/pv/view/viewport.cpp new file mode 100644 index 00000000..e0b7e45c --- /dev/null +++ b/DSLogic-gui/pv/view/viewport.cpp @@ -0,0 +1,654 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "view.h" +#include "viewport.h" +#include "ruler.h" + +#include "signal.h" +#include "../data/logic.h" +#include "../data/logicsnapshot.h" +#include "../sigsession.h" + +#include +#include + +#include + +using namespace boost; +using namespace std; + +namespace pv { +namespace view { + +const int Viewport::HitCursorMargin = 3; +const int Viewport::NumSpanY = 5; +const int Viewport::NumMiniSpanY = 5; +const int Viewport::NumSpanX = 10; + +Viewport::Viewport(View &parent) : + QWidget(&parent), + _view(parent), + _total_receive_len(0), + _zoom_rect_visible(false), + _measure_shown(false), + _cur_sample(0), + _nxt_sample(1), + _cur_preX(0), + _cur_aftX(1), + _cur_midY(0) +{ + setMouseTracking(true); + setAutoFillBackground(true); + setBackgroundRole(QPalette::Base); + + //setFixedSize(QSize(600, 400)); + _mm_width = "#####"; + _mm_period = "#####"; + _mm_freq = "#####"; + _measure_en = true; + triggered = false; + timer_cnt = 0; + + connect(&_view, SIGNAL(signals_moved()), + this, SLOT(on_signals_moved())); + connect(&trigger_timer, SIGNAL(timeout()), + this, SLOT(on_trigger_timer())); +} + +int Viewport::get_total_height() const +{ + int h = 0; + const vector< shared_ptr > sigs( + _view.session().get_signals()); + BOOST_FOREACH(const shared_ptr s, sigs) { + assert(s); + //h = max(s->get_v_offset() + _view.get_signalHeight(), h); + h = max(s->get_v_offset(), h); + } + + return h; +} + +void Viewport::paintEvent(QPaintEvent *event) +{ + (void)event; + + using pv::view::Signal; + + QStyleOption o; + o.initFrom(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this); + + //QPainter p(this); + p.setRenderHint(QPainter::Antialiasing); + + if (_view.session().get_device()->mode == LOGIC) { + switch(_view.session().get_capture_state()) { + case SigSession::Init: + break; + + case SigSession::Stopped: + paintSignals(p); + break; + + case SigSession::Running: + //p.setRenderHint(QPainter::Antialiasing); + paintProgress(p); + break; + } + } else if (_view.session().get_device()->mode == ANALOG) { + paintSignals(p); + } + + p.setRenderHint(QPainter::Antialiasing, false); + if (_view.get_signalHeight() != _curSignalHeight) + _curSignalHeight = _view.get_signalHeight(); + const vector< shared_ptr > sigs( + _view.session().get_signals()); + + BOOST_FOREACH(const shared_ptr s, sigs) { + assert(s); + //paint_axis(p, y, left, right); + p.setPen(Signal::dsGray); + const double sigY = s->get_v_offset() - _view.v_offset(); + + int i, j; + if (s->get_type() == Signal::DS_ANALOG) { + p.drawLine(0, sigY, width(), sigY); + const double spanY = (s->get_signalHeight()) * 1.0f / NumSpanY; + for (i = 1; i <= NumSpanY; i++) { + const double posY = sigY - spanY * i; + p.drawLine(0, posY, width(), posY); + const double miniSpanY = spanY / NumMiniSpanY; + for (j = 1; j < NumMiniSpanY; j++) { + p.drawLine(width() / 2.0f - 10, posY + miniSpanY * j, + width() / 2.0f + 10, posY + miniSpanY * j); + } + } + const double spanX = width() * 1.0f / NumSpanX; + for (i = 1; i < NumSpanX; i++) { + p.drawLine(0 + spanX * i, sigY, + 0 + spanX * i, sigY - s->get_signalHeight()); + } + } else { + p.drawLine(0, sigY + 10, width(), sigY + 10); + } + } + + p.end(); +} + +void Viewport::paintSignals(QPainter &p) +{ + const vector< shared_ptr > sigs( + _view.session().get_signals()); +// const vector< shared_ptr > pro_sigs( +// _view.session().get_pro_signals()); + // Plot the signal + const int v_offset = _view.v_offset(); + if (_view.scale() != _curScale || + _view.offset() != _curOffset || + _view.get_signalHeight() != _curSignalHeight || + _view.need_update()) { + _curScale = _view.scale(); + _curOffset = _view.offset(); + _curSignalHeight = _view.get_signalHeight(); + + pixmap = QPixmap(size()); + pixmap.fill(Qt::transparent); + QPainter dbp(&pixmap); + dbp.initFrom(this); + p.setRenderHint(QPainter::Antialiasing, false); + BOOST_FOREACH(const shared_ptr s, sigs) { + assert(s); + s->paint(dbp, s->get_v_offset() - v_offset, 0, width(), + _view.scale(), _view.offset()); + } +// p.setRenderHint(QPainter::Antialiasing); +// BOOST_FOREACH(const shared_ptr s, pro_sigs) { +// assert(s); +// s->paint(dbp, s->get_v_offset() - v_offset, 0, width(), +// _view.scale(), _view.offset()); +// } + _view.set_need_update(false); + } + p.drawPixmap(0, 0, pixmap); + + // plot cursors + if (_view.cursors_shown()) { + list::iterator i = _view.get_cursorList().begin(); + double cursorX; + while (i != _view.get_cursorList().end()) { + cursorX = ((*i)->time() - _view.offset()) / _view.scale(); + if (rect().contains(_view.hover_point().x(), _view.hover_point().y()) && + qAbs(cursorX - _view.hover_point().x()) <= HitCursorMargin) + (*i)->paint(p, rect(), 1); + else + (*i)->paint(p, rect(), 0); + if (!_view.session().get_data()->get_snapshots().empty()) { + uint64_t _hit_sample = floor((*i)->time() * _view.session().get_last_sample_rate()); + if (_hit_sample > _total_receive_len) { + (*i)->set_time(0); + } else { + QRectF valueRect = QRectF(cursorX + 3, height()-20, 100, 20); + p.setPen(Qt::black); + p.drawLine(cursorX, height()-13, cursorX + 3, height()-10); + p.drawLine(cursorX, height()-7, cursorX + 3, height()-10); + p.drawText(valueRect, Qt::AlignLeft | Qt::AlignVCenter, + "Value: " + + QString::number((uint16_t)_view.session().get_data()->get_snapshots().front()->get_sample(_hit_sample))); + } + } + + i++; + } + } + if (_view.trig_cursor_shown()) { + _view.get_trig_cursor()->paint(p, rect(), 0); + } + if (_view.search_cursor_shown()) { + _view.get_search_cursor()->paint(p, rect(), 0); + } + + // plot zoom rect + if (_zoom_rect_visible) { + p.setPen(Qt::NoPen); + p.setBrush(Signal::dsLightBlue); + p.drawRect(_zoom_rect); + } + + //plot measure arrow + if (_measure_shown) { + paintMeasure(p); + } +} + +void Viewport::paintProgress(QPainter &p) +{ + using pv::view::Signal; + + const quint64 _total_sample_len = _view.session().get_total_sample_len(); + double progress = -(_total_receive_len * 1.0f / _total_sample_len * 360 * 16); + + p.setPen(Qt::gray); + const QPoint cenPos = QPoint(width() / 2, height() / 2); + const int radius = min(0.3 * width(), 0.3 * height()); + p.drawEllipse(cenPos, radius - 2, radius - 2); + p.setPen(QPen(Signal::dsGreen, 4, Qt::SolidLine)); + p.drawArc(cenPos.x() - radius, cenPos.y() - radius, 2* radius, 2 * radius, 180 * 16, progress); + + p.setPen(Qt::gray); + const QPoint logoPoints[] = { + QPoint(cenPos.x() - 0.75 * radius, cenPos.y()), + QPoint(cenPos.x() - 0.75 * radius, cenPos.y() + 0.15 * radius), + QPoint(cenPos.x() - 0.6 * radius, cenPos.y()), + QPoint(cenPos.x() - 0.6 * radius, cenPos.y() + 0.3 * radius), + QPoint(cenPos.x() - 0.45 * radius, cenPos.y()), + QPoint(cenPos.x() - 0.45 * radius, cenPos.y() + 0.45 * radius), + QPoint(cenPos.x() - 0.3 * radius, cenPos.y()), + QPoint(cenPos.x() - 0.3 * radius, cenPos.y() + 0.3 * radius), + QPoint(cenPos.x() - 0.15 * radius, cenPos.y()), + QPoint(cenPos.x() - 0.15 * radius, cenPos.y() + 0.15 * radius), + QPoint(cenPos.x() + 0.15 * radius, cenPos.y()), + QPoint(cenPos.x() + 0.15 * radius, cenPos.y() - 0.15 * radius), + QPoint(cenPos.x() + 0.3 * radius, cenPos.y()), + QPoint(cenPos.x() + 0.3 * radius, cenPos.y() - 0.3 * radius), + QPoint(cenPos.x() + 0.45 * radius, cenPos.y()), + QPoint(cenPos.x() + 0.45 * radius, cenPos.y() - 0.45 * radius), + QPoint(cenPos.x() + 0.6 * radius, cenPos.y()), + QPoint(cenPos.x() + 0.6 * radius, cenPos.y() - 0.3 * radius), + QPoint(cenPos.x() + 0.75 * radius, cenPos.y()), + QPoint(cenPos.x() + 0.75 * radius, cenPos.y() - 0.15 * radius) + }; + const int logoRadius = 10; + p.drawLine(logoPoints[0], logoPoints[1]); + p.drawLine(logoPoints[2], logoPoints[3]); + p.drawLine(logoPoints[4], logoPoints[5]); + p.drawLine(logoPoints[6], logoPoints[7]); + p.drawLine(logoPoints[8], logoPoints[9]); + p.drawLine(logoPoints[10], logoPoints[11]); + p.drawLine(logoPoints[12], logoPoints[13]); + p.drawLine(logoPoints[14], logoPoints[15]); + p.drawLine(logoPoints[16], logoPoints[17]); + p.drawLine(logoPoints[18], logoPoints[19]); + p.drawEllipse(logoPoints[1].x() - 0.5 * logoRadius, logoPoints[1].y(), + logoRadius, logoRadius); + p.drawEllipse(logoPoints[3].x() - 0.5 * logoRadius, logoPoints[3].y(), + logoRadius, logoRadius); + p.drawEllipse(logoPoints[5].x() - 0.5 * logoRadius, logoPoints[5].y(), + logoRadius, logoRadius); + p.drawEllipse(logoPoints[7].x() - 0.5 * logoRadius, logoPoints[7].y(), + logoRadius, logoRadius); + p.drawEllipse(logoPoints[9].x() - 0.5 * logoRadius, logoPoints[9].y(), + logoRadius, logoRadius); + p.drawEllipse(logoPoints[11].x() - 0.5 * logoRadius, logoPoints[11].y() - logoRadius, + logoRadius, logoRadius); + p.drawEllipse(logoPoints[13].x() - 0.5 * logoRadius, logoPoints[13].y() - logoRadius, + logoRadius, logoRadius); + p.drawEllipse(logoPoints[15].x() - 0.5 * logoRadius, logoPoints[15].y() - logoRadius, + logoRadius, logoRadius); + p.drawEllipse(logoPoints[17].x() - 0.5 * logoRadius, logoPoints[17].y() - logoRadius, + logoRadius, logoRadius); + p.drawEllipse(logoPoints[19].x() - 0.5 * logoRadius, logoPoints[19].y() - logoRadius, + logoRadius, logoRadius); + + if (!triggered) { + + const QPoint cenLeftPos = QPoint(width() / 2 - 0.05 * width(), height() / 2); + const QPoint cenRightPos = QPoint(width() / 2 + 0.05 * width(), height() / 2); + const int trigger_radius = min(0.02 * width(), 0.02 * height()); + + p.setPen(Qt::NoPen); + p.setBrush((timer_cnt % 3) == 0 ? Signal::dsLightBlue : Signal::dsGray); + p.drawEllipse(cenLeftPos, trigger_radius, trigger_radius); + p.setBrush((timer_cnt % 3) == 1 ? Signal::dsLightBlue : Signal::dsGray); + p.drawEllipse(cenPos, trigger_radius, trigger_radius); + p.setBrush((timer_cnt % 3) == 2 ? Signal::dsLightBlue : Signal::dsGray); + p.drawEllipse(cenRightPos, trigger_radius, trigger_radius); + } else { + const int progress100 = ceil(progress / -3.6 / 16); + p.setPen(QColor(0, 0, 0, 50)); + QFont font=p.font(); + font.setPointSize(50); + font.setBold(true); + p.setFont(font); + p.drawText(rect(), Qt::AlignCenter | Qt::AlignVCenter, QString::number(progress100)+"%"); + } +} + +void Viewport::mousePressEvent(QMouseEvent *event) +{ + assert(event); + + _mouse_down_point = event->pos(); + _mouse_down_offset = _view.offset(); + + if (event->buttons() & Qt::LeftButton) { + if (_view.cursors_shown()) { + list::iterator i = _view.get_cursorList().begin(); + double cursorX; + while (i != _view.get_cursorList().end()) { + cursorX = ((*i)->time() - _view.offset()) / _view.scale(); + if ((*i)->grabbed()) + _view.get_ruler()->rel_grabbed_cursor(); + else if (qAbs(cursorX - event->pos().x()) <= HitCursorMargin) { + _view.get_ruler()->set_grabbed_cursor(*i); + break; + } + i++; + } + + } +// if (!_view.get_ruler()->get_grabbed_cursor()) { +// _zoom_rect_visible = true; +// } + update(); + } +} + +void Viewport::mouseMoveEvent(QMouseEvent *event) +{ + assert(event); + + if (event->buttons() & Qt::RightButton) { + _zoom_rect = QRectF(_mouse_down_point, event->pos()); + _zoom_rect_visible = true; + } + + if (event->buttons() & Qt::LeftButton) { + _view.set_scale_offset(_view.scale(), + _mouse_down_offset + + (_mouse_down_point - event->pos()).x() * + _view.scale()); + + measure(); + } + + if (!(event->buttons() || Qt::NoButton)) { + TimeMarker* grabbed_marker = _view.get_ruler()->get_grabbed_cursor(); + if (_view.cursors_shown() && grabbed_marker) { + grabbed_marker->set_time(_view.offset() + _view.hover_point().x() * _view.scale()); + } + + measure(); + } + + update(); +} + +void Viewport::mouseReleaseEvent(QMouseEvent *event) +{ + assert(event); + + if (_zoom_rect_visible) { + _zoom_rect_visible = false; + const double newOffset = _view.offset() + (min(event->pos().x(), _mouse_down_point.x()) + 0.5) * _view.scale(); + const double newScale = max(min(_view.scale() * (event->pos().x() - _mouse_down_point.x()) / width(), + _view.get_maxscale()), _view.get_minscale()); + if (newScale != _view.scale()) + _view.set_scale_offset(newScale, newOffset); + } + + update(); +} + +void Viewport::mouseDoubleClickEvent(QMouseEvent *event) +{ + assert (event); + if (_view.scale() == _view.get_maxscale()) + _view.set_preScale_preOffset(); + else + _view.set_scale_offset(_view.get_maxscale(), 0); + + update(); +} + +void Viewport::wheelEvent(QWheelEvent *event) +{ + assert(event); + + if (event->orientation() == Qt::Vertical) { + // Vertical scrolling is interpreted as zooming in/out + _view.zoom(event->delta() / 80, event->x()); + } else if (event->orientation() == Qt::Horizontal) { + // Horizontal scrolling is interpreted as moving left/right + _view.set_scale_offset(_view.scale(), + event->delta() * _view.scale() + + _view.offset()); + } + + measure(); +} + +void Viewport::leaveEvent(QEvent *) +{ + _measure_shown = false; + //_view.show_cursors(false); + update(); +} + +void Viewport::on_signals_moved() +{ + update(); +} + +void Viewport::set_receive_len(quint64 length) +{ + if (length == 0) { + _total_receive_len = 0; + start_trigger_timer(333); + } else { + stop_trigger_timer(); + if (_total_receive_len + length > _view.session().get_total_sample_len()) + _total_receive_len = _view.session().get_total_sample_len(); + else + _total_receive_len += length; + } + update(); +} + +void Viewport::measure() +{ + const vector< shared_ptr > sigs(_view.session().get_signals()); + BOOST_FOREACH(const shared_ptr s, sigs) { + assert(s); + const int curY = _view.hover_point().y(); + const double curX = _view.hover_point().x(); + if (curY <= View::SignalMargin || s->get_type() != Signal::DS_LOGIC) { + _measure_shown = false; + break; + } else if ( curY < s->get_v_offset() && + curY > (s->get_v_offset() - _view.get_signalHeight())) { + if (s->cur_edges().size() > 2) { + const double pixels_offset = _view.offset() / _view.scale(); + const double samples_per_pixel = _view.session().get_last_sample_rate() * _view.scale(); + + uint64_t findIndex = curX / width() * s->cur_edges().size(); + uint64_t left_findIndex = 0; + uint64_t right_findIndex = s->cur_edges().size() - 1; + int times = 0; + while(!s->cur_edges().empty() && times < 20) { + findIndex = min(findIndex, (uint64_t)(s->cur_edges().size() - 2)); + const double pre_edge_x = + s->cur_edges().at(findIndex).first / samples_per_pixel - pixels_offset; + const double aft_edge_x = + s->cur_edges().at(findIndex + 1).first / samples_per_pixel - pixels_offset; + if ( curX >= pre_edge_x && curX <= aft_edge_x) { + if (aft_edge_x - pre_edge_x < 2 || + findIndex == 0 || + findIndex == s->cur_edges().size() - 2) { + _measure_shown = false; + break; + } else { + _measure_shown = true; + _cur_sample = s->cur_edges().at(findIndex).first; + _nxt_sample = s->cur_edges().at(findIndex + 1).first; + _cur_preX = pre_edge_x; + _cur_aftX = aft_edge_x; + //if (findIndex >= 0 && findIndex <= s->cur_edges().size() - 4) { + if(findIndex <= s->cur_edges().size() - 4) { + _thd_sample = s->cur_edges().at(findIndex + 2).first; + _cur_thdX = + s->cur_edges().at(findIndex + 2).first / samples_per_pixel - pixels_offset; + } else { + _thd_sample = 0; + _cur_thdX = 0; + + } + _cur_midY = s->get_v_offset() - 0.5 * _view.get_signalHeight(); + break; + } + } else if (curX < pre_edge_x) { + right_findIndex = findIndex; + findIndex = (left_findIndex + findIndex) / 2; + } else if (curX > aft_edge_x) { + left_findIndex = findIndex; + findIndex = (right_findIndex + findIndex) / 2; + } + times++; + } + } + break; + } else if (curY >= s->get_v_offset() && + curY <= (s->get_v_offset() + 2 * View::SignalMargin)){ + _measure_shown = false; + break; + }else { + _measure_shown = false; + } + } + + if (_measure_shown == true) { + const uint64_t delta_sample = _nxt_sample - _cur_sample; + const uint64_t delta1_sample = _thd_sample - _cur_sample; + //assert(delta_sample >= 0); + const double delta_time = delta_sample * 1.0f / _view.session().get_last_sample_rate(); + const double delta1_time = delta1_sample * 1.0f / _view.session().get_last_sample_rate(); + const int order = (int)floorf(log10f(delta_time)); + unsigned int prefix = (15 + order) / 3; + assert(prefix < 9); + + _mm_width = _view.get_ruler()->format_time(delta_time, prefix); + _mm_period = _thd_sample != 0 ? _view.get_ruler()->format_time(delta1_time, prefix) : + "#####"; + _mm_freq = _thd_sample != 0 ? _view.get_ruler()->format_freq(delta1_time) : + "#####"; + } else { + _mm_width = "#####"; + _mm_period = "#####"; + _mm_freq = "#####"; + } + + _view.on_mouse_moved(); +} + +void Viewport::paintMeasure(QPainter &p) +{ + p.setPen(QColor(17, 133, 209, 255)); + p.drawLine(QLineF(_cur_preX, _cur_midY, _cur_aftX, _cur_midY)); + p.drawLine(QLineF(_cur_preX, _cur_midY, _cur_preX + 2, _cur_midY - 2)); + p.drawLine(QLineF(_cur_preX, _cur_midY, _cur_preX + 2, _cur_midY + 2)); + p.drawLine(QLineF(_cur_aftX - 2, _cur_midY - 2, _cur_aftX, _cur_midY)); + p.drawLine(QLineF(_cur_aftX - 2, _cur_midY + 2, _cur_aftX, _cur_midY)); + if (_thd_sample != 0) { + p.drawLine(QLineF(_cur_aftX, _cur_midY, _cur_thdX, _cur_midY)); + p.drawLine(QLineF(_cur_aftX, _cur_midY, _cur_aftX + 2, _cur_midY - 2)); + p.drawLine(QLineF(_cur_aftX, _cur_midY, _cur_aftX + 2, _cur_midY + 2)); + p.drawLine(QLineF(_cur_thdX - 2, _cur_midY - 2, _cur_thdX, _cur_midY)); + p.drawLine(QLineF(_cur_thdX - 2, _cur_midY + 2, _cur_thdX, _cur_midY)); + } + + if (_measure_en) { + double typical_width = p.boundingRect(0, 0, INT_MAX, INT_MAX, + Qt::AlignLeft | Qt::AlignTop, _mm_width).width() + 150; + QRectF measure_rect = QRectF(_view.hover_point().x(), _view.hover_point().y(), + (double)typical_width, 60.0); + QRectF measure1_rect = QRectF(_view.hover_point().x(), _view.hover_point().y(), + (double)typical_width, 20.0); + QRectF measure2_rect = QRectF(_view.hover_point().x(), _view.hover_point().y() + 20, + (double)typical_width, 20.0); + QRectF measure3_rect = QRectF(_view.hover_point().x(), _view.hover_point().y() + 40, + (double)typical_width, 20.0); + + p.setPen(Qt::NoPen); + p.setBrush(QColor(17, 133, 209, 150)); + p.drawRect(measure_rect); + + p.setPen(Qt::black); + p.drawText(measure1_rect, Qt::AlignRight | Qt::AlignVCenter, + "Width: " + _mm_width); + p.drawText(measure2_rect, Qt::AlignRight | Qt::AlignVCenter, + "Period: " + _mm_period); + p.drawText(measure3_rect, Qt::AlignRight | Qt::AlignVCenter, + "Frequency: " + _mm_freq); + } +} + +QString Viewport::get_mm_width() +{ + return _mm_width; +} + +QString Viewport::get_mm_period() +{ + return _mm_period; +} + +QString Viewport::get_mm_freq() +{ + return _mm_freq; +} + +void Viewport::set_measure_en(int enable) +{ + if (enable == 0) + _measure_en = false; + else + _measure_en = true; +} + +void Viewport::start_trigger_timer(int msec) +{ + assert(msec > 0); + triggered = false; + timer_cnt = 0; + trigger_timer.start(msec); +} + +void Viewport::stop_trigger_timer() +{ + triggered = true; + timer_cnt = 0; + trigger_timer.stop(); +} + +void Viewport::on_trigger_timer() +{ + timer_cnt++; + update(); +} + +} // namespace view +} // namespace pv diff --git a/DSLogic-gui/pv/view/viewport.h b/DSLogic-gui/pv/view/viewport.h new file mode 100644 index 00000000..0ecb0c72 --- /dev/null +++ b/DSLogic-gui/pv/view/viewport.h @@ -0,0 +1,123 @@ +/* + * This file is part of the DSLogic-gui project. + * DSLogic-gui is based on PulseView. + * + * Copyright (C) 2012 Joel Holdsworth + * Copyright (C) 2013 DreamSourceLab + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DSLOGIC_PV_VIEW_VIEWPORT_H +#define DSLOGIC_PV_VIEW_VIEWPORT_H + +#include +#include +#include + +class QPainter; +class QPaintEvent; +class SigSession; + +namespace pv { +namespace view { + +class View; + +class Viewport : public QWidget +{ + Q_OBJECT + +private: + static const int HitCursorMargin; + static const int NumSpanY; + static const int NumMiniSpanY; + static const int NumSpanX; + +public: + explicit Viewport(View &parent); + + int get_total_height() const; + + void set_receive_len(quint64 length); + + QString get_mm_width(); + QString get_mm_period(); + QString get_mm_freq(); + + void set_measure_en(int enable); + + void start_trigger_timer(int msec); + void stop_trigger_timer(); + +protected: + void paintEvent(QPaintEvent *event); + +private: + void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void mouseDoubleClickEvent(QMouseEvent *event); + void wheelEvent(QWheelEvent *event); + void leaveEvent(QEvent *); + + void paintSignals(QPainter& p); + void paintProgress(QPainter& p); + void paintMeasure(QPainter &p); + + void measure(); + +private slots: + void on_signals_moved(); + void on_trigger_timer(); + +private: + View &_view; + + quint64 _total_receive_len; + QPoint _mouse_down_point; + double _mouse_down_offset; + double _curScale; + double _curOffset; + int _curSignalHeight; + + QPixmap pixmap; + + bool _zoom_rect_visible; + QRectF _zoom_rect; + + bool _measure_en; + bool _measure_shown; + uint64_t _cur_sample; + uint64_t _nxt_sample; + uint64_t _thd_sample; + int64_t _cur_preX; + int64_t _cur_aftX; + int64_t _cur_thdX; + int64_t _cur_midY; + QString _mm_width; + QString _mm_period; + QString _mm_freq; + + QTimer trigger_timer; + bool triggered; + int timer_cnt; +}; + +} // namespace view +} // namespace pv + +#endif // DSLOGIC_PV_VIEW_VIEWPORT_H diff --git a/DSLogic-gui/stylesheet.qss b/DSLogic-gui/stylesheet.qss new file mode 100644 index 00000000..ad912772 --- /dev/null +++ b/DSLogic-gui/stylesheet.qss @@ -0,0 +1,268 @@ +palette { + background: rgb(17, 133, 209, 255); + disabled: rgb(232, 232, 230, 255); +} + +QMainWindow { + icon-size: 48px, 48px; +} + +QDialog { + border: none; + background: rgb(17, 133, 209, 255); +} + +QToolBar { + border: none; + /*background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 rgb(0, 75, 165, 255), + stop: 0.05 rgb(31, 164, 227, 255), + stop: 0.5 rgb(17, 133, 209, 255), + stop: 0.95 rgb(0, 102, 185, 255), + stop: 1 rgb(0, 75, 165, 255));*/ + background: rgb(17, 133, 209, 255); + min-height: 50px; +} + +pv--view--View, +pv--view--Viewport{ + margin: 0px; + border: none; + background-color: rgb(255, 255, 255); + padding: 0px; +} + +QToolButton { + border: none; + border-style: flat; + color: white; + font: bold 10ft; + min-height: 50px; + min-width: 50px; +} + +QPushButton:hover, +QToolButton:hover { + background-color: rgb(238, 178, 17, 200); +} + +QPushButton:pressed, +QToolButton:pressed { + background-color: rgb(238, 178, 17, 255); +} + +QPushButton { + padding: 3px; + border: none; + border-style: flat; + border-radius: 4px; + color: white; + background-color: rgb(255, 255, 255, 50); + font: bold 10ft; + min-height: 20px; + min-width: 20px; +} + +/* >>> QToolBar: QLineEdit/QComboBox */ +QLineEdit, +QComboBox:!editable, +QSpinBox { + border: none; + border-radius: 4px; + background-color: white; + padding: 3px; + min-height: 20px; +} + +QLineEdit:disabled, +QComboBox:disabled, +QSpinBox:disabled { + background-color: rgb(232, 232, 230, 255); +} + +QComboBox:!editable { + padding-right: 5px; +} + +/* QComboBox gets the "on" state when the popup is open */ +QComboBox:!editable:on, QToolBar > QComboBox::drop-down:editable:on { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #D3D3D3, stop: 0.4 #D8D8D8, + stop: 0.5 #DDDDDD, stop: 1.0 #E1E1E1); +} + +QComboBox:on { /* shift the text when the popup opens */ + padding-top: 3px; + padding-left: 4px; +} + +QComboBox::drop-down { + subcontrol-origin: padding; + subcontrol-position: top right; + width: 15px; + + border-left-width: 0px; + border-top-right-radius: 4px; /* same radius as the QComboBox */ + border-bottom-right-radius: 4px; +} + +QComboBox::down-arrow { + image: url(:/icons/down-arrow.png); +} +QComboBox::down-arrow:disabled { + image: none; +} + +QComboBox::down-arrow:on { /* shift the arrow when popup is open */ + top: 1px; + left: 1px; +} +/* <<< QToolBar: QLineEdit/QComboBox */ + +/* >>> QDockWidget */ +QDockWidget { + margin: 0px; + background-color: rgb(17, 133, 209, 255); + border: 0px; + padding: 0px; + color: rgb(17, 133, 209, 255); + font-size: 16px; + font-weight: bold; +} + +QDockWidget::title { + margin: 0px; + text-align: left center; + background-color: rgb(255, 255, 255, 255); + border: 0px; + color: white; + padding: 8px; +} +QDockWidget > QWidget{ + margin: 0px; + background-color: rgb(17, 133, 209, 255); + border: 0px; + padding: 0px; +} + +QGroupBox { + margin: 0px; + background-color: rgb(17, 133, 209, 255); + border: 0px; + padding: 40px, 10px, 10px, 10px; + color: white; + font-size: 20px; + font-weight: bold; +} + +QGroupBox::title +{ + subcontrol-origin: margin; + subcontrol-position: top center; + padding: 5 20px; +} +QGroupBox:disabled +{ + color: rgb(232, 232, 230, 255); +} + +QDockWidget > QWidget > QTabWidget::pane{ + margin: 0px; + background-color: rgb(17, 133, 209, 255); + border: 1px solid rgb(255, 255, 255); + border-right-color: rgb(17, 133, 209, 255); /* same as the pane color */ + padding: 0px; +} + +QDockWidget > QWidget > QTabWidget::pane:disabled{ + border: 1px solid rgb(232, 232, 230, 255); + border-right-color: rgb(17, 133, 209, 255); /* same as the pane color */ +} + +QDockWidget > QWidget > QTabWidget > QTabBar::tab +{ + background: transparent; + color: white; + border: 2px solid rgb(238, 178, 17, 255); + border-left-color: rgb(17, 133, 209, 255); /* same as the pane color */ + border-bottom-right-radius: 4px; + border-top-right-radius: 4px; + min-height: 8ex; + padding: 2px; +} +QDockWidget > QWidget > QTabWidget > QTabBar::tab:hover +{ + border: 3px solid rgb(238, 178, 17, 255); + border-left-color: rgb(17, 133, 209, 255); /* same as the pane color */ +} +QDockWidget > QWidget > QTabWidget > QTabBar::tab:selected +{ + color: white; + background: rgb(238, 178, 17, 255); + border-left-color: rgb(17, 133, 209, 255); /* same as the pane color */ +} +QDockWidget > QWidget > QTabWidget > QTabBar::tab:disabled +{ + color: rgb(232, 232, 230, 50); + border: 1px solid rgb(232, 232, 230, 255); + background: transparent; + border-left-color: rgb(17, 133, 209, 255); /* same as the pane color */ +} + +QCheckBox, +QRadioButton, +QLabel { + border: none; + color: white; + min-height: 20px; +} + +QCheckBox, +QLabel { + padding: 1px 1px 1px 1px; + margin: 0px; +} + +QLabel:disabled { + color: rgb(232, 232, 230, 255); +} + +QSlider::groove:horizontal { + border: 1px solid #999999; + height: 2px; + margin: 0px 0; + left: 10px; right: 10px; + border-radius: 4px; +} + +QSlider::handle:horizontal { + border-image:url(:/icons/slider-handle.png); + margin-left: -12px; + margin-right: -12px; + margin-top: -11px; + margin-bottom: -11px; +} + +QSlider::sub-page:horizontal{ + background: qlineargradient(spread:pad, + x1:0, y1:1, x2:0, y2:0, + stop:0 rgba(17, 133, 209, 255), + stop:0.25 rgba(238, 178, 17, 255), + stop:0.75 rgba(238, 178, 17, 255), + stop:1 rgba(17, 133, 209, 255)); + height: 2px; + border-radius: 4px; +} + +QSlider::add-page:horizontal{ + background: qlineargradient(spread:pad, + x1:0, y1:1, x2:0, y2:0, + stop:0 rgba(17, 133, 209, 255), + stop:0.25 rgba(255, 255, 255, 255), + stop:0.75 rgba(255, 255, 255, 255), + stop:1 rgba(17, 133, 209, 255)); + height: 2px; + border-radius: 4px; +} + +/* <<< QDockWidget */ diff --git a/DSLogic-gui/test/CMakeLists.txt b/DSLogic-gui/test/CMakeLists.txt new file mode 100644 index 00000000..c2831710 --- /dev/null +++ b/DSLogic-gui/test/CMakeLists.txt @@ -0,0 +1,52 @@ +## +## This file is part of the PulseView project. +## +## Copyright (C) 2012 Joel Holdsworth +## Copyright (C) 2012 Alexandru Gagniuc +## +## 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 2 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 . +## + +# Find the platform's thread library (needed for boost-thread). +# This will set ${CMAKE_THREAD_LIBS_INIT} to the correct, OS-specific value. +find_package(Threads) + +find_package(Boost 1.46 COMPONENTS unit_test_framework REQUIRED) + +set(pulseview_TEST_SOURCES + ${PROJECT_SOURCE_DIR}/pv/data/analogsnapshot.cpp + ${PROJECT_SOURCE_DIR}/pv/data/snapshot.cpp + ${PROJECT_SOURCE_DIR}/pv/data/logicsnapshot.cpp + data/analogsnapshot.cpp + data/logicsnapshot.cpp + test.cpp +) + +add_definitions(-DBOOST_TEST_DYN_LINK) + +include_directories( + ${Boost_INCLUDE_DIRS} +) + +set(PULSEVIEW_LINK_LIBS + ${Boost_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} +) + +add_executable(pulseview-test + ${pulseview_TEST_SOURCES} +) + +target_link_libraries(pulseview-test ${PULSEVIEW_LINK_LIBS}) + diff --git a/DSLogic-gui/test/data/analogsnapshot.cpp b/DSLogic-gui/test/data/analogsnapshot.cpp new file mode 100644 index 00000000..cd1fd773 --- /dev/null +++ b/DSLogic-gui/test/data/analogsnapshot.cpp @@ -0,0 +1,125 @@ +/* + * This file is part of the PulseView project. + * + * Copyright (C) 2013 Joel Holdsworth + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#define __STDC_LIMIT_MACROS +#include + +#include + +#include "../../pv/data/analogsnapshot.h" + +using namespace std; + +using pv::data::AnalogSnapshot; + +BOOST_AUTO_TEST_SUITE(AnalogSnapshotTest) + +void push_analog(AnalogSnapshot &s, unsigned int num_samples, + float value) +{ + sr_datafeed_analog analog; + analog.num_samples = num_samples; + + float *data = new float[num_samples]; + analog.data = data; + while(num_samples-- != 0) + *data++ = value; + + s.append_payload(analog); + delete[] (float*)analog.data; +} + +BOOST_AUTO_TEST_CASE(Basic) +{ + // Create an empty AnalogSnapshot object + sr_datafeed_analog analog; + analog.num_samples = 0; + analog.data = NULL; + + AnalogSnapshot s(analog); + + //----- Test AnalogSnapshot::push_analog -----// + + BOOST_CHECK(s.get_sample_count() == 0); + for (unsigned int i = 0; i < AnalogSnapshot::ScaleStepCount; i++) + { + const AnalogSnapshot::Envelope &m = s._envelope_levels[i]; + BOOST_CHECK_EQUAL(m.length, 0); + BOOST_CHECK_EQUAL(m.data_length, 0); + BOOST_CHECK(m.samples == NULL); + } + + // Push 8 samples of all zeros + push_analog(s, 8, 0.0f); + + BOOST_CHECK(s.get_sample_count() == 8); + + // There should not be enough samples to have a single mip map sample + for (unsigned int i = 0; i < AnalogSnapshot::ScaleStepCount; i++) + { + const AnalogSnapshot::Envelope &m = s._envelope_levels[i]; + BOOST_CHECK_EQUAL(m.length, 0); + BOOST_CHECK_EQUAL(m.data_length, 0); + BOOST_CHECK(m.samples == NULL); + } + + // Push 8 samples of 1.0s to bring the total up to 16 + push_analog(s, 8, 1.0f); + + // There should now be enough data for exactly one sample + // in mip map level 0, and that sample should be 0 + const AnalogSnapshot::Envelope &e0 = s._envelope_levels[0]; + BOOST_CHECK_EQUAL(e0.length, 1); + BOOST_CHECK_EQUAL(e0.data_length, AnalogSnapshot::EnvelopeDataUnit); + BOOST_REQUIRE(e0.samples != NULL); + BOOST_CHECK_EQUAL(e0.samples[0].min, 0.0f); + BOOST_CHECK_EQUAL(e0.samples[0].max, 1.0f); + + // The higher levels should still be empty + for (unsigned int i = 1; i < AnalogSnapshot::ScaleStepCount; i++) + { + const AnalogSnapshot::Envelope &m = s._envelope_levels[i]; + BOOST_CHECK_EQUAL(m.length, 0); + BOOST_CHECK_EQUAL(m.data_length, 0); + BOOST_CHECK(m.samples == NULL); + } + + // Push 240 samples of all zeros to bring the total up to 256 + push_analog(s, 240, -1.0f); + + BOOST_CHECK_EQUAL(e0.length, 16); + BOOST_CHECK_EQUAL(e0.data_length, AnalogSnapshot::EnvelopeDataUnit); + + for (unsigned int i = 1; i < e0.length; i++) { + BOOST_CHECK_EQUAL(e0.samples[i].min, -1.0f); + BOOST_CHECK_EQUAL(e0.samples[i].max, -1.0f); + } + + const AnalogSnapshot::Envelope &e1 = s._envelope_levels[1]; + BOOST_CHECK_EQUAL(e1.length, 1); + BOOST_CHECK_EQUAL(e1.data_length, AnalogSnapshot::EnvelopeDataUnit); + BOOST_REQUIRE(e1.samples != NULL); + BOOST_CHECK_EQUAL(e1.samples[0].min, -1.0f); + BOOST_CHECK_EQUAL(e1.samples[0].max, 1.0f); +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/DSLogic-gui/test/data/logicsnapshot.cpp b/DSLogic-gui/test/data/logicsnapshot.cpp new file mode 100644 index 00000000..bbc74383 --- /dev/null +++ b/DSLogic-gui/test/data/logicsnapshot.cpp @@ -0,0 +1,536 @@ +/* + * This file is part of the PulseView project. + * + * Copyright (C) 2012 Joel Holdsworth + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#define __STDC_LIMIT_MACROS +#include + +#include + +#include "../../pv/data/logicsnapshot.h" + +using namespace std; + +using pv::data::LogicSnapshot; + +BOOST_AUTO_TEST_SUITE(LogicSnapshotTest) + +void push_logic(LogicSnapshot &s, unsigned int length, uint8_t value) +{ + sr_datafeed_logic logic; + logic.unitsize = 1; + logic.length = length; + logic.data = new uint8_t[length]; + memset(logic.data, value, length * logic.unitsize); + s.append_payload(logic); + delete[] (uint8_t*)logic.data; +} + +BOOST_AUTO_TEST_CASE(Pow2) +{ + BOOST_CHECK_EQUAL(LogicSnapshot::pow2_ceil(0, 0), 0); + BOOST_CHECK_EQUAL(LogicSnapshot::pow2_ceil(1, 0), 1); + BOOST_CHECK_EQUAL(LogicSnapshot::pow2_ceil(2, 0), 2); + + BOOST_CHECK_EQUAL( + LogicSnapshot::pow2_ceil(INT64_MIN, 0), INT64_MIN); + BOOST_CHECK_EQUAL( + LogicSnapshot::pow2_ceil(INT64_MAX, 0), INT64_MAX); + + BOOST_CHECK_EQUAL(LogicSnapshot::pow2_ceil(0, 1), 0); + BOOST_CHECK_EQUAL(LogicSnapshot::pow2_ceil(1, 1), 2); + BOOST_CHECK_EQUAL(LogicSnapshot::pow2_ceil(2, 1), 2); + BOOST_CHECK_EQUAL(LogicSnapshot::pow2_ceil(3, 1), 4); +} + +BOOST_AUTO_TEST_CASE(Basic) +{ + // Create an empty LogicSnapshot object + sr_datafeed_logic logic; + logic.length = 0; + logic.unitsize = 1; + logic.data = NULL; + + LogicSnapshot s(logic); + + //----- Test LogicSnapshot::push_logic -----// + + BOOST_CHECK(s.get_sample_count() == 0); + for (unsigned int i = 0; i < LogicSnapshot::ScaleStepCount; i++) + { + const LogicSnapshot::MipMapLevel &m = s._mip_map[i]; + BOOST_CHECK_EQUAL(m.length, 0); + BOOST_CHECK_EQUAL(m.data_length, 0); + BOOST_CHECK(m.data == NULL); + } + + // Push 8 samples of all zeros + push_logic(s, 8, 0); + + BOOST_CHECK(s.get_sample_count() == 8); + + // There should not be enough samples to have a single mip map sample + for (unsigned int i = 0; i < LogicSnapshot::ScaleStepCount; i++) + { + const LogicSnapshot::MipMapLevel &m = s._mip_map[i]; + BOOST_CHECK_EQUAL(m.length, 0); + BOOST_CHECK_EQUAL(m.data_length, 0); + BOOST_CHECK(m.data == NULL); + } + + // Push 8 samples of 0x11s to bring the total up to 16 + push_logic(s, 8, 0x11); + + // There should now be enough data for exactly one sample + // in mip map level 0, and that sample should be 0 + const LogicSnapshot::MipMapLevel &m0 = s._mip_map[0]; + BOOST_CHECK_EQUAL(m0.length, 1); + BOOST_CHECK_EQUAL(m0.data_length, LogicSnapshot::MipMapDataUnit); + BOOST_REQUIRE(m0.data != NULL); + BOOST_CHECK_EQUAL(((uint8_t*)m0.data)[0], 0x11); + + // The higher levels should still be empty + for (unsigned int i = 1; i < LogicSnapshot::ScaleStepCount; i++) + { + const LogicSnapshot::MipMapLevel &m = s._mip_map[i]; + BOOST_CHECK_EQUAL(m.length, 0); + BOOST_CHECK_EQUAL(m.data_length, 0); + BOOST_CHECK(m.data == NULL); + } + + // Push 240 samples of all zeros to bring the total up to 256 + push_logic(s, 240, 0); + + BOOST_CHECK_EQUAL(m0.length, 16); + BOOST_CHECK_EQUAL(m0.data_length, LogicSnapshot::MipMapDataUnit); + + BOOST_CHECK_EQUAL(((uint8_t*)m0.data)[1], 0x11); + for (unsigned int i = 2; i < m0.length; i++) + BOOST_CHECK_EQUAL(((uint8_t*)m0.data)[i], 0); + + const LogicSnapshot::MipMapLevel &m1 = s._mip_map[1]; + BOOST_CHECK_EQUAL(m1.length, 1); + BOOST_CHECK_EQUAL(m1.data_length, LogicSnapshot::MipMapDataUnit); + BOOST_REQUIRE(m1.data != NULL); + BOOST_CHECK_EQUAL(((uint8_t*)m1.data)[0], 0x11); + + //----- Test LogicSnapshot::get_subsampled_edges -----// + + // Test a full view at full zoom. + vector edges; + s.get_subsampled_edges(edges, 0, 255, 1, 0); + BOOST_REQUIRE_EQUAL(edges.size(), 4); + + BOOST_CHECK_EQUAL(edges[0].first, 0); + BOOST_CHECK_EQUAL(edges[1].first, 8); + BOOST_CHECK_EQUAL(edges[2].first, 16); + BOOST_CHECK_EQUAL(edges[3].first, 255); + + // Test a subset at high zoom + edges.clear(); + s.get_subsampled_edges(edges, 6, 17, 0.05f, 0); + BOOST_REQUIRE_EQUAL(edges.size(), 4); + + BOOST_CHECK_EQUAL(edges[0].first, 6); + BOOST_CHECK_EQUAL(edges[1].first, 8); + BOOST_CHECK_EQUAL(edges[2].first, 16); + BOOST_CHECK_EQUAL(edges[3].first, 17); +} + +BOOST_AUTO_TEST_CASE(LargeData) +{ + uint8_t prev_sample; + const unsigned int Length = 1000000; + + sr_datafeed_logic logic; + logic.unitsize = 1; + logic.length = Length; + logic.data = new uint8_t[Length]; + uint8_t *data = (uint8_t*)logic.data; + + for (unsigned int i = 0; i < Length; i++) + *data++ = (uint8_t)(i >> 8); + + LogicSnapshot s(logic); + delete[] (uint8_t*)logic.data; + + BOOST_CHECK(s.get_sample_count() == Length); + + // Check mip map level 0 + BOOST_CHECK_EQUAL(s._mip_map[0].length, 62500); + BOOST_CHECK_EQUAL(s._mip_map[0].data_length, + LogicSnapshot::MipMapDataUnit); + BOOST_REQUIRE(s._mip_map[0].data != NULL); + + prev_sample = 0; + for (unsigned int i = 0; i < s._mip_map[0].length;) + { + BOOST_TEST_MESSAGE("Testing mip_map[0].data[" << i << "]"); + + const uint8_t sample = (uint8_t)((i*16) >> 8); + BOOST_CHECK_EQUAL(s.get_subsample(0, i++) & 0xFF, + prev_sample ^ sample); + prev_sample = sample; + + for (int j = 1; i < s._mip_map[0].length && j < 16; j++) + { + BOOST_TEST_MESSAGE("Testing mip_map[0].data[" << i << "]"); + BOOST_CHECK_EQUAL(s.get_subsample(0, i++) & 0xFF, 0); + } + } + + // Check mip map level 1 + BOOST_CHECK_EQUAL(s._mip_map[1].length, 3906); + BOOST_CHECK_EQUAL(s._mip_map[1].data_length, + LogicSnapshot::MipMapDataUnit); + BOOST_REQUIRE(s._mip_map[1].data != NULL); + + prev_sample = 0; + for (unsigned int i = 0; i < s._mip_map[1].length; i++) + { + BOOST_TEST_MESSAGE("Testing mip_map[1].data[" << i << "]"); + + const uint8_t sample = i; + const uint8_t expected = sample ^ prev_sample; + prev_sample = i; + + BOOST_CHECK_EQUAL(s.get_subsample(1, i) & 0xFF, expected); + } + + // Check mip map level 2 + BOOST_CHECK_EQUAL(s._mip_map[2].length, 244); + BOOST_CHECK_EQUAL(s._mip_map[2].data_length, + LogicSnapshot::MipMapDataUnit); + BOOST_REQUIRE(s._mip_map[2].data != NULL); + + prev_sample = 0; + for (unsigned int i = 0; i < s._mip_map[2].length; i++) + { + BOOST_TEST_MESSAGE("Testing mip_map[2].data[" << i << "]"); + + const uint8_t sample = i << 4; + const uint8_t expected = (sample ^ prev_sample) | 0x0F; + prev_sample = sample; + + BOOST_CHECK_EQUAL(s.get_subsample(2, i) & 0xFF, expected); + } + + // Check mip map level 3 + BOOST_CHECK_EQUAL(s._mip_map[3].length, 15); + BOOST_CHECK_EQUAL(s._mip_map[3].data_length, + LogicSnapshot::MipMapDataUnit); + BOOST_REQUIRE(s._mip_map[3].data != NULL); + + for (unsigned int i = 0; i < s._mip_map[3].length; i++) + BOOST_CHECK_EQUAL(*((uint8_t*)s._mip_map[3].data + i), + 0xFF); + + // Check the higher levels + for (unsigned int i = 4; i < LogicSnapshot::ScaleStepCount; i++) + { + const LogicSnapshot::MipMapLevel &m = s._mip_map[i]; + BOOST_CHECK_EQUAL(m.length, 0); + BOOST_CHECK_EQUAL(m.data_length, 0); + BOOST_CHECK(m.data == NULL); + } + + //----- Test LogicSnapshot::get_subsampled_edges -----// + // Check in normal case + vector edges; + s.get_subsampled_edges(edges, 0, Length-1, 1, 7); + + BOOST_CHECK_EQUAL(edges.size(), 32); + + for (unsigned int i = 0; i < edges.size() - 1; i++) + { + BOOST_CHECK_EQUAL(edges[i].first, i * 32768); + BOOST_CHECK_EQUAL(edges[i].second, i & 1); + } + + BOOST_CHECK_EQUAL(edges[31].first, 999999); + + // Check in very low zoom case + edges.clear(); + s.get_subsampled_edges(edges, 0, Length-1, 50e6f, 7); + + BOOST_CHECK_EQUAL(edges.size(), 2); +} + +BOOST_AUTO_TEST_CASE(Pulses) +{ + const int Cycles = 3; + const int Period = 64; + const int Length = Cycles * Period; + + vector edges; + + //----- Create a LogicSnapshot -----// + sr_datafeed_logic logic; + logic.unitsize = 1; + logic.length = Length; + logic.data = (uint64_t*)new uint8_t[Length]; + uint8_t *p = (uint8_t*)logic.data; + + for (int i = 0; i < Cycles; i++) { + *p++ = 0xFF; + for (int j = 1; j < Period; j++) + *p++ = 0x00; + } + + LogicSnapshot s(logic); + delete[] (uint8_t*)logic.data; + + //----- Check the mip-map -----// + // Check mip map level 0 + BOOST_CHECK_EQUAL(s._mip_map[0].length, 12); + BOOST_CHECK_EQUAL(s._mip_map[0].data_length, + LogicSnapshot::MipMapDataUnit); + BOOST_REQUIRE(s._mip_map[0].data != NULL); + + for (unsigned int i = 0; i < s._mip_map[0].length;) { + BOOST_TEST_MESSAGE("Testing mip_map[0].data[" << i << "]"); + BOOST_CHECK_EQUAL(s.get_subsample(0, i++) & 0xFF, 0xFF); + + for (int j = 1; + i < s._mip_map[0].length && + j < Period/LogicSnapshot::MipMapScaleFactor; j++) { + BOOST_TEST_MESSAGE( + "Testing mip_map[0].data[" << i << "]"); + BOOST_CHECK_EQUAL(s.get_subsample(0, i++) & 0xFF, 0x00); + } + } + + // Check the higher levels are all inactive + for (unsigned int i = 1; i < LogicSnapshot::ScaleStepCount; i++) { + const LogicSnapshot::MipMapLevel &m = s._mip_map[i]; + BOOST_CHECK_EQUAL(m.length, 0); + BOOST_CHECK_EQUAL(m.data_length, 0); + BOOST_CHECK(m.data == NULL); + } + + //----- Test get_subsampled_edges at reduced scale -----// + s.get_subsampled_edges(edges, 0, Length-1, 16.0f, 2); + BOOST_REQUIRE_EQUAL(edges.size(), Cycles + 2); + + BOOST_CHECK_EQUAL(0, false); + for (unsigned int i = 1; i < edges.size(); i++) + BOOST_CHECK_EQUAL(edges[i].second, false); +} + +BOOST_AUTO_TEST_CASE(LongPulses) +{ + const int Cycles = 3; + const int Period = 64; + const int PulseWidth = 16; + const int Length = Cycles * Period; + + int j; + vector edges; + + //----- Create a LogicSnapshot -----// + sr_datafeed_logic logic; + logic.unitsize = 8; + logic.length = Length * 8; + logic.data = (uint64_t*)new uint64_t[Length]; + uint64_t *p = (uint64_t*)logic.data; + + for (int i = 0; i < Cycles; i++) { + for (j = 0; j < PulseWidth; j++) + *p++ = ~0; + for (; j < Period; j++) + *p++ = 0; + } + + LogicSnapshot s(logic); + delete[] (uint64_t*)logic.data; + + //----- Check the mip-map -----// + // Check mip map level 0 + BOOST_CHECK_EQUAL(s._mip_map[0].length, 12); + BOOST_CHECK_EQUAL(s._mip_map[0].data_length, + LogicSnapshot::MipMapDataUnit); + BOOST_REQUIRE(s._mip_map[0].data != NULL); + + for (unsigned int i = 0; i < s._mip_map[0].length;) { + for (j = 0; i < s._mip_map[0].length && j < 2; j++) { + BOOST_TEST_MESSAGE( + "Testing mip_map[0].data[" << i << "]"); + BOOST_CHECK_EQUAL(s.get_subsample(0, i++), ~0); + } + + for (; i < s._mip_map[0].length && + j < Period/LogicSnapshot::MipMapScaleFactor; j++) { + BOOST_TEST_MESSAGE( + "Testing mip_map[0].data[" << i << "]"); + BOOST_CHECK_EQUAL(s.get_subsample(0, i++), 0); + } + } + + // Check the higher levels are all inactive + for (unsigned int i = 1; i < LogicSnapshot::ScaleStepCount; i++) { + const LogicSnapshot::MipMapLevel &m = s._mip_map[i]; + BOOST_CHECK_EQUAL(m.length, 0); + BOOST_CHECK_EQUAL(m.data_length, 0); + BOOST_CHECK(m.data == NULL); + } + + //----- Test get_subsampled_edges at a full scale -----// + s.get_subsampled_edges(edges, 0, Length-1, 16.0f, 2); + BOOST_REQUIRE_EQUAL(edges.size(), Cycles * 2 + 1); + + for (int i = 0; i < Cycles; i++) { + BOOST_CHECK_EQUAL(edges[i*2].first, i * Period); + BOOST_CHECK_EQUAL(edges[i*2].second, true); + BOOST_CHECK_EQUAL(edges[i*2+1].first, i * Period + PulseWidth); + BOOST_CHECK_EQUAL(edges[i*2+1].second, false); + } + + BOOST_CHECK_EQUAL(edges.back().first, Length-1); + BOOST_CHECK_EQUAL(edges.back().second, false); + + //----- Test get_subsampled_edges at a simplified scale -----// + edges.clear(); + s.get_subsampled_edges(edges, 0, Length-1, 17.0f, 2); + + BOOST_CHECK_EQUAL(edges[0].first, 0); + BOOST_CHECK_EQUAL(edges[0].second, true); + BOOST_CHECK_EQUAL(edges[1].first, 16); + BOOST_CHECK_EQUAL(edges[1].second, false); + + for (int i = 1; i < Cycles; i++) { + BOOST_CHECK_EQUAL(edges[i+1].first, i * Period); + BOOST_CHECK_EQUAL(edges[i+1].second, false); + } + + BOOST_CHECK_EQUAL(edges.back().first, Length-1); + BOOST_CHECK_EQUAL(edges.back().second, false); +} + +BOOST_AUTO_TEST_CASE(LisaMUsbHid) +{ + /* This test was created from the beginning of the USB_DM signal in + * sigrok-dumps-usb/lisa_m_usbhid/lisa_m_usbhid.sr + */ + + const int Edges[] = { + 7028, 7033, 7036, 7041, 7044, 7049, 7053, 7066, 7073, 7079, + 7086, 7095, 7103, 7108, 7111, 7116, 7119, 7124, 7136, 7141, + 7148, 7162, 7500 + }; + const int Length = Edges[countof(Edges) - 1]; + + bool state = false; + int lastEdgePos = 0; + + //----- Create a LogicSnapshot -----// + sr_datafeed_logic logic; + logic.unitsize = 1; + logic.length = Length; + logic.data = new uint8_t[Length]; + uint8_t *data = (uint8_t*)logic.data; + + for (unsigned int i = 0; i < countof(Edges); i++) { + const int edgePos = Edges[i]; + memset(&data[lastEdgePos], state ? 0x02 : 0, + edgePos - lastEdgePos - 1); + + lastEdgePos = edgePos; + state = !state; + } + + LogicSnapshot s(logic); + delete[] (uint64_t*)logic.data; + + vector edges; + + + /* The trailing edge of the pulse train is falling in the source data. + * Check this is always true at different scales + */ + + edges.clear(); + s.get_subsampled_edges(edges, 0, Length-1, 33.333332f, 1); + BOOST_CHECK_EQUAL(edges[edges.size() - 2].second, false); +} + +/* + * This test checks the rendering of wide data (more than 8 probes) + * Probe signals are either all-high, or all-low, but are interleaved such that + * they would toggle during every sample if treated like 8 probes. + * The packet contains a large number of samples, so the mipmap generation kicks + * in. + * + * The signals should not toggle (have exactly two edges: the start and end) + */ +BOOST_AUTO_TEST_CASE(WideData) +{ + const int Length = 512<<10; + uint16_t *data = new uint16_t[Length]; + + sr_datafeed_logic logic; + logic.unitsize = sizeof(data[0]); + logic.length = Length * sizeof(data[0]); + logic.data = data; + + for (int i = 0; i < Length; i++) + data[i] = 0x0FF0; + + LogicSnapshot s(logic); + + vector edges; + + edges.clear(); + s.get_subsampled_edges(edges, 0, Length-1, 1, 0); + BOOST_CHECK_EQUAL(edges.size(), 2); + + edges.clear(); + s.get_subsampled_edges(edges, 0, Length-1, 1, 8); + BOOST_CHECK_EQUAL(edges.size(), 2); + + // Cleanup + delete [] data; +} + +/* + * This test is a replica of sixteen.sr attached to Bug #33. + */ +BOOST_AUTO_TEST_CASE(Sixteen) +{ + const int Length = 8; + uint16_t data[Length]; + + sr_datafeed_logic logic; + logic.unitsize = sizeof(data[0]); + logic.length = Length * sizeof(data[0]); + logic.data = data; + + for (int i = 0; i < Length; i++) + data[i] = 0xFFFE; + + LogicSnapshot s(logic); + + vector edges; + s.get_subsampled_edges(edges, 0, 2, 0.0004, 1); + + BOOST_CHECK_EQUAL(edges.size(), 2); +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/DSLogic-gui/test/test.cpp b/DSLogic-gui/test/test.cpp new file mode 100644 index 00000000..04c99819 --- /dev/null +++ b/DSLogic-gui/test/test.cpp @@ -0,0 +1,22 @@ +/* + * This file is part of the PulseView project. + * + * Copyright (C) 2012 Joel Holdsworth + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#define BOOST_TEST_MAIN +#include diff --git a/INSTALL b/INSTALL new file mode 100644 index 00000000..7f35dd87 --- /dev/null +++ b/INSTALL @@ -0,0 +1,86 @@ +------------------------------------------------------------------------------- +INSTALL +------------------------------------------------------------------------------- + +Requirements +------------ + +libsigrok4DSLoigc + - gcc (>= 4.0) + - make + - autoconf >= 2.63 + - automake >= 1.11 + - libtool + - pkg-config >= 0.22 + This is part of the standard OpenBSD install (not an extra package), apparently. + - libglib >= 2.32.0 + - libzip >= 0.10 + - libusb-1.0 >= 1.0.9 (optional, used by most drivers) + On FreeBSD, this is an integral part of the FreeBSD libc, not an extra package/library. + This is part of the standard OpenBSD install (not an extra package), apparently. + - check >= 0.9.4 (optional, only needed to run unit tests) + +DSLgoic-gui + - git + - g++ + - make + - libtool + - pkg-config >= 0.22 + - cmake >= 2.6 + - libglib >= 2.28.0 + - Qt >= 4.5 + - libboost >= 1.42 (including the following libs): + - libboost-system + - libboost-thread + - libsigrok4DSLogic >= 0.2.0 + +Building and installing +----------------------- +Get the DSLogic source code from: www.dreamsourcelab.com/download.html + +Step1: Build libsigrok4DSLogic + +Installing the requirements: + +Example on Debian/Ubuntu (please check your respective distro's package manager tool if you use other distros): + $ sudo apt-get install git-core gcc make autoconf automake libtool pkg-config \ + libglib2.0-dev libzip-dev libusb-1.0-0-dev libftdi-dev libudev-dev libasound2-dev check + +Fedora (18, 19): + $ sudo yum install git gcc make autoconf automake libtool pkgconfig glib2-devel \ + libzip-devel libusb1-devel libftdi-devel libudev-devel alsa-lib-devel check + +OpenSuSE (12.2): + $ zypper install git gcc make autoconf automake libtool pkg-config glib2-devel \ + libzip-devel libusb-1_0-devel libftdi1-devel libudev-devel alsa-devel check + +Building: + + $ cd libsigrok4DSLogic + $ ./autogen.sh + $ ./configure + $ make + $ sudo make install + +Step2: Build DSLogic-gui + +Installing the requirements: + +Example on Debian/Ubuntu (please check your respective distro's package manager tool if you use other distros): +$ sudo apt-get install git-core g++ make cmake libtool pkg-config \ + libglib2.0-dev libqt4-dev libboost-dev libboost-test-dev libboost-thread-dev libboost-system-dev + +Fedora (18, 19): +$ sudo yum install git gcc cmake libtool pkgconfig glib2-devel \ + boost-devel qt-devel boost-devel + +Building: + +$ cd DSLogic-gui +$ cmake . +$ make +$ sudo make install + +See the following wiki page for more (OS-specific) instructions: + + http://sigrok.org/wiki/Building diff --git a/NEWS b/NEWS new file mode 100644 index 00000000..dbbe9709 --- /dev/null +++ b/NEWS @@ -0,0 +1,5 @@ +0.1.0 (2013-12-15) +------------------ + + * Initial release. + diff --git a/README b/README new file mode 100644 index 00000000..791e7ad0 --- /dev/null +++ b/README @@ -0,0 +1,57 @@ +------------------------------------------------------------------------------- +README +------------------------------------------------------------------------------- +DSLogic is an open source multi-function instrument for everyone. +DSLogic software is based on sigrok project. +You can find DSLogic on: +www.dreamsourcelab.com +www.kickstarter.com/projects/dreamsourcelab/dslogic-multifunction-instruments-for-everyone + +The sigrok project aims at creating a portable, cross-platform, +Free/Libre/Open-Source signal analysis software suite that supports various +device types (such as logic analyzers, oscilloscopes, multimeters, and more). + +Status +------ + +DSLogic software is in a usable state and has had official tarball releases. + +However, it is still work in progress. Some basic functionality +is available and working, but other things are still on the TODO list. + + +Copyright and license +--------------------- + +DSLogic software is licensed under the terms of the GNU General Public License +(GPL), version 3 or later. + +While some individual source code files are licensed under the GPLv2+, and +some files are licensed under the GPLv3+, this doesn't change the fact that +the program as a whole is licensed under the terms of the GPLv3+ (e.g. also +due to the fact that it links against GPLv3+ libraries). + +Please see the individual source files for the full list of copyright holders. + + +Copyright notices +----------------- + +A copyright notice indicating a range of years, must be interpreted as having +had copyrightable material added in each of those years. + +Example: + + Copyright (C) 2010-2013 Contributor Name + +is to be interpreted as + + Copyright (C) 2010,2011,2012,2013 Contributor Name + + +Website +------- + http://dreamsourcelab.com + http://sigrok.org + + diff --git a/libsigrok4DSLogic/AUTHORS b/libsigrok4DSLogic/AUTHORS new file mode 100644 index 00000000..28c1b20e --- /dev/null +++ b/libsigrok4DSLogic/AUTHORS @@ -0,0 +1,7 @@ +------------------------------------------------------------------------------- +AUTHORS +------------------------------------------------------------------------------- + +Please check the source code files and/or git history and/or ChangeLog for +a list of all authors and contributors. + diff --git a/libsigrok4DSLogic/COPYING b/libsigrok4DSLogic/COPYING new file mode 100644 index 00000000..94a9ed02 --- /dev/null +++ b/libsigrok4DSLogic/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/libsigrok4DSLogic/ChangeLog b/libsigrok4DSLogic/ChangeLog new file mode 100644 index 00000000..5f04282a --- /dev/null +++ b/libsigrok4DSLogic/ChangeLog @@ -0,0 +1,12054 @@ +commit 26aec7fdc4c5d1f3e7ec6c373b16b6605b4a6e38 +Author: Uwe Hermann +Date: Thu Apr 25 19:01:54 2013 +0200 + + Drop link-mso19/nexus-osciprime in preparation for release. + + These two drivers are currently unfinished and don't work, so disable + and "unhook" them for now in preparation of the next libsigrok release. + + They're still in the git repository, but not hooked up to the build + system, so that they won't get detected or built, and also don't end up + in the release tarball. + + Since link-mso19 is the only driver that currently requires libudev, + drop any reference to that, too. + + It should be relatively easy to apply this patch in reverse after the + release to bring back both drivers. + +commit a4fdbbe1c2d9e95982c48aea46773affd6812ec8 +Author: Uwe Hermann +Date: Sat May 4 15:55:11 2013 +0200 + + Doxyfile: Set version number to 0.2.0. + +commit 7c3e7b43067d14fc717a0bf825e57ed959032771 +Author: Uwe Hermann +Date: Sat May 4 15:22:45 2013 +0200 + + udev rules file: Add entry for the ZEROPLUS LAP-16128U. + +commit 048e8babf73565721707dd9e9ecf4f915941d23e +Author: Uwe Hermann +Date: Sat May 4 15:17:50 2013 +0200 + + NEWS: Minor update. + +commit 6941f84568b0e362decdc25e6aecaf304dc670bb +Author: Uwe Hermann +Date: Sat May 4 15:12:20 2013 +0200 + + Fix libsigrok lib version (current:revision:age). + + The last release (libsigrok 0.1.1) had a lib version of 0:0:0. + + This release thus gets 1:0:0 according to the libtool manual guidelines. + +commit c5ffac414899eb7f0e187b8eb9d61e381d40f0a6 +Author: Uwe Hermann +Date: Sat May 4 00:07:34 2013 +0200 + + uni-t-dmm: Add missing SR_CONF_LIMIT_MSEC support. + +commit 29a27196a13de2ffd9b671185e4b464b9db9b549 +Author: Uwe Hermann +Date: Fri May 3 21:59:32 2013 +0200 + + s/DRIVER_LOG_DOMAIN/LOG_PREFIX/. + + This is more correct anyway, and also a bit shorter and more readable. + +commit 06c45a66f76f986cd845a05fdee36956b1339621 +Author: Uwe Hermann +Date: Fri May 3 14:03:49 2013 +0200 + + Minor whitespace fixes. + +commit e6b2b4df9dcfaf9eb6fa10f94e0aa5e039230e21 +Author: Uwe Hermann +Date: Thu May 2 23:37:23 2013 +0200 + + README.devices: Document how to make some DMMs log. + +commit 456dfd9f704885c8ffbeb5dd1c2b281d27fff053 +Author: Uwe Hermann +Date: Thu May 2 19:03:47 2013 +0200 + + NEWS: Various updates and minor fixes. + +commit a0c7e23ad871c0e77dd8632c76f87bec1c6fd002 +Author: Uwe Hermann +Date: Thu May 2 17:37:55 2013 +0200 + + Fix the build when libusb is not available. + + Thanks Simon Richter for reporting. + +commit 3a277f3b2b01da3d7d1e26ddbb30471db68fc11c +Author: Bert Vermeulen +Date: Wed May 1 14:54:44 2013 +0200 + + Deal with uninitialized drivers + +commit c2fa697afa86a8e6f37bef13acb5b8532714274e +Author: Uwe Hermann +Date: Wed May 1 03:16:47 2013 +0200 + + serial-dmm: Add Tecpel DMM-8060 support. + +commit b38e08fbb7b6fec5ff22495f13f039b1f7218361 +Author: Uwe Hermann +Date: Wed May 1 03:13:15 2013 +0200 + + serial-dmm: Add Tecpel DMM-8061 support. + +commit 4554314c4f72d8df69b7236cb19d15a00fdceaeb +Author: Uwe Hermann +Date: Wed May 1 03:04:46 2013 +0200 + + uni-t-dmm: Add Tecpel DMM-8060 support. + + This is _very_ likely to be a rebadged Voltcraft VC-820, treating as such. + +commit b6bad47c91a7cbc19571cbe49918a0612ad2babe +Author: Uwe Hermann +Date: Wed May 1 03:00:08 2013 +0200 + + uni-t-dmm: Add Tecpel DMM-8061 support. + +commit 2451a20ff5137d178ed4a02ee04076c6eae97235 +Author: Uwe Hermann +Date: Wed May 1 02:10:56 2013 +0200 + + fs9721: Factor out common code from serial-dmm. + + These functions are FS9721 specific (and DMM specific), and can be used + from various drivers (e.g. serial-dmm or uni-t-dmm or possibly others). + +commit 48535594664cc5d55db428cd8ca5ffba328be05a +Author: Uwe Hermann +Date: Wed May 1 01:56:30 2013 +0200 + + uni-t-dmm/serial-dmm: Handle Voltcraft VC-840 temperature. + +commit ad00a54da6a17c881881d2ed7a3f3fe41170fa26 +Author: Uwe Hermann +Date: Wed May 1 01:02:46 2013 +0200 + + fs9922: Fix beep mode. + +commit 649a4cd672e5ea14707c4591dd0426fdd87ddd5a +Author: Uwe Hermann +Date: Wed May 1 01:00:54 2013 +0200 + + fs9922: Fix diode mode parsing. + +commit 767aae30edce24c9e5b8b6e083653b2f68dbc922 +Author: Uwe Hermann +Date: Tue Apr 30 20:28:29 2013 +0200 + + uni-t-dmm: Fix incorrect UNI-T UT61D baudrate. + +commit 695d0e1efa819dc98914ce1baec388c8734e98a7 +Author: Uwe Hermann +Date: Tue Apr 30 20:27:04 2013 +0200 + + uni-t-dmm: Add support for the Voltcraft VC-840. + + This DMM is already supported via the serial-dmm driver when using the + RS232 cable. The uni-t-dmm support makes it usable with the USB/HID + cable too. + +commit bbef5e326de1669b039413d8753fceda7281e936 +Author: Uwe Hermann +Date: Mon Apr 29 20:23:21 2013 +0200 + + uni-t-dmm: Add support for the UNI-T UT61E. + + This DMM is already supported via the serial-dmm driver when using the + RS232 cable. The uni-t-dmm support makes it usable with the USB/HID + cable too. + +commit ae3a59de62e5912d68d8738a78a4403146cbfda5 +Author: Uwe Hermann +Date: Mon Apr 29 20:15:02 2013 +0200 + + serial-dmm: Add support for the UNI-T UT61D. + + This DMM is already supported via the uni-t-dmm driver when using the + USB/HID cable. The serial-dmm support makes it usable with the RS232 + cable too. + +commit 3ece1dff6ce9d29021215a1aa4a4ae8cff25aa49 +Author: Uwe Hermann +Date: Sun Apr 28 08:13:15 2013 +0200 + + uni-t-dmm: Use sr_dev_inst to store connection handle. + +commit d9a7c349ed731f826b166c12f6d03dbd973cc0ec +Author: Uwe Hermann +Date: Sun Apr 28 08:01:51 2013 +0200 + + brymen-dmm: Use sr_dev_inst to store connection handle. + +commit af51a7718eb22e9630107af814db6ae9f179a969 +Author: Bert Vermeulen +Date: Tue Apr 30 16:03:37 2013 +0200 + + output: Use sr_config_get() wrapper + + This obviates the need for a valid driver, and thus makes converting + from any (non-sr) input format to any output format possible; the only + thing missing is the samplerate. + + Fixes bug 105. + +commit 0a7da5f8c9f1c6656672152ad48d76b5a4cd7ecd +Author: Bert Vermeulen +Date: Tue Apr 30 09:55:44 2013 +0200 + + fx2lafw: Keep track of our own libusb fds + +commit 037286445116d0f4f7f9b16a4a7353f3be207ff0 +Author: Bert Vermeulen +Date: Tue Apr 30 00:04:39 2013 +0200 + + Don't remove stray source from the session after stopping + + It's up to the drivers and frontends to remove the sources they + added to the session. + + Also don't tell the driver about a forced session stop more than + once, because it's sloppy. + + Fixes bug 62. + +commit 2a67abfe349f26f0cc9d34e36f48b250cb9cac50 +Author: Bert Vermeulen +Date: Mon Apr 29 19:02:26 2013 +0200 + + fx2lafw: Properly initialize operational state before acquisition + +commit 0f75d6f5a9b5d9d479dc03d67a8c828f99dce8f0 +Author: Bert Vermeulen +Date: Mon Apr 29 12:39:26 2013 +0200 + + ols: Don't close serial port after acquisition is done + +commit 681803dfdeeaae66c48d6c45da194be0c6789deb +Author: Bert Vermeulen +Date: Sun Apr 28 22:35:42 2013 +0200 + + Don't try to close devices when removing them from the session + + That's the frontend's job. + +commit 115f82939661da6ad2d26d5ceca709bbc0ad25b5 +Author: Uwe Hermann +Date: Mon Apr 22 21:57:51 2013 +0200 + + NEWS: Add most important items since last release. + +commit a5e44c3247ae64ab1a65e7c6ebe6d66c6ab0a0a1 +Author: Uwe Hermann +Date: Wed Apr 24 19:14:52 2013 +0200 + + tondaj-sl-814: Use sr_dev_inst to store connection handle. + +commit 44f91e29509125a54cfd975689e6d10379645f08 +Author: Uwe Hermann +Date: Sat Apr 27 19:06:27 2013 +0200 + + unittests: Disable a broken test for now. + +commit 50c604f50bf33e68ac67caa8ebad20b87b3aacc1 +Author: Bert Vermeulen +Date: Sat Apr 27 18:27:32 2013 +0200 + + Don't automatically clear known instances from USB drivers on scan + + This invalidates previously returned sr_dev_inst pointers, which a + frontend may be holding. It's the frontend's responsibility to clear + the list of instances a driver keeps track of by calling + + sr_dev_clear(driver); + + if it wants a completely new scan done. + +commit c2523f221364c0df51b8093693a246a713633912 +Author: Bert Vermeulen +Date: Sat Apr 27 18:24:50 2013 +0200 + + Explicitly initialize all struct parameters on init + +commit 17f63de642c3cb613f91eabd2e19ebed6785f755 +Author: Bert Vermeulen +Date: Sat Apr 27 17:29:46 2013 +0200 + + Fix output API receive() function + + This changes the new output API's recv() to receive(), and has it + return an integer status code. The output of the function, if any, + is stored in a new parameter as a pointer to a newly allocated GString. + + All output modules using this API have been adjusted. + +commit 9c48c2e91ecdb4b0ce364f55084e8f882b7a3bf1 +Author: Martin Ling +Date: Fri Apr 26 23:20:33 2013 +0100 + + Remove SR_MAX_NUM_PROBES, which is now no longer used. + +commit a1be7b6c3f1f00644bdae96317f14b99fe31cf3d +Author: Martin Ling +Date: Fri Apr 26 23:16:30 2013 +0100 + + vcd output: Replace fixed length array of indices with GArray. + +commit d601c0e9b37be9174c8a4447aa05aeb7be82be73 +Author: Martin Ling +Date: Fri Apr 26 23:00:51 2013 +0100 + + vcd output: Eliminate unnecessary array of probe names. + +commit 90f680ff006e5ae2fd4935bd885a14bd9927fd99 +Author: Martin Ling +Date: Fri Apr 26 22:50:09 2013 +0100 + + gnuplot: Eliminate fixed-size header buffer based on max probes. + +commit deb09083385deab1a8afc2a585200de043444464 +Author: Martin Ling +Date: Fri Apr 26 22:29:41 2013 +0100 + + gnuplot: Remove unnecessary array of probe names. + +commit 1c5b099a1312ae64307fb7d9a0030643936a3636 +Author: Martin Ling +Date: Fri Apr 26 22:26:14 2013 +0100 + + csv: Remove unnecessary array of probe names. + +commit 91a44f50f0817b32c869f9623b86a6e698ba8e19 +Author: Martin Ling +Date: Fri Apr 26 22:20:05 2013 +0100 + + chronovu-l8: remove unused array of probe names. + +commit d53e4e8d92242488642211f441dacba29937104d +Author: Martin Ling +Date: Fri Apr 26 22:14:57 2013 +0100 + + text: Use a GSList of enabled probe names, not an array. + +commit db9679afc9f46bdf038efabd3ac69983d15f89cf +Author: Martin Ling +Date: Fri Apr 26 20:52:25 2013 +0100 + + vcd input: Use a GSList rather than fixed size array of probes. + +commit b050fc481bf8fc2a55277cc3fc3b62121932e1bb +Author: Martin Ling +Date: Sat Apr 27 00:13:02 2013 +0100 + + vcd output: fix for big-endian architectures. + +commit 9c178ffa50da5bd6978d26989b79936dc341f308 +Author: Martin Ling +Date: Fri Apr 26 23:57:44 2013 +0100 + + gnuplot: fix for big-endian architectures. + +commit 3292535c878ec82756c122facddf61bbd81bec18 +Author: Bert Vermeulen +Date: Sat Apr 27 14:24:47 2013 +0200 + + output/ols: Use new API + + This now properly supports samplerate changes coming in from + SR_DF_META packets, and also fixes bug 99. + +commit 409a811b8c078341185badadda8f4be380a5f88d +Author: Uwe Hermann +Date: Sat Apr 27 10:49:52 2013 +0200 + + error.c: Add SR_ERR_DEV_CLOSED. + +commit 3a581560f1288b4cecc4ab885c85ac7603dd21db +Author: Martin Ling +Date: Fri Apr 26 21:35:18 2013 +0100 + + ascii: fix for big-endian architectures. + +commit ddb292571d03ee2e13100d749edcf0dceed5d9a2 +Author: Martin Ling +Date: Fri Apr 26 21:22:36 2013 +0100 + + bits: Remove unused code. + +commit 9275d232089be359ad6ffe3a7b65d6230ff912b3 +Author: Martin Ling +Date: Fri Apr 26 21:17:36 2013 +0100 + + hex: fix for big-endian architectures. + +commit 542dbd185b2e01e61df8a70a2ab850f5cfe03271 +Author: Martin Ling +Date: Fri Apr 26 21:14:00 2013 +0100 + + bits: fix for big-endian architectures. + +commit b9470914d045f05e445e9f25a3b4f0cc79bc6681 +Author: Bert Vermeulen +Date: Fri Apr 26 22:17:41 2013 +0200 + + Remove sr_rational + +commit bc653a56781de54f90e9fb08b39e6c9a596cc6af +Author: Uwe Hermann +Date: Sat Jan 26 23:39:24 2013 +0100 + + uni-t-dmm: Do proper detection of packets in the stream. + + Also, various fixups in the driver. + +commit c8852687778a33b9de218af800eec4ae7e3848a6 +Author: Uwe Hermann +Date: Wed Dec 19 19:01:54 2012 +0100 + + uni-t-dmm: Make driver more similar to serial-dmm. + +commit 7381251e33611b6c06f3adedfcf2e1943453670e +Author: Uwe Hermann +Date: Fri Apr 26 19:56:02 2013 +0200 + + common/dmm: Drop obsolete *is_packet_start() functions. + +commit 913abe83214f68d1743c555aa3fbe112db48a0cb +Author: Uwe Hermann +Date: Wed Dec 19 22:47:26 2012 +0100 + + fs9922: Use common DMM API. + + Use the same functions and structs as the other DMM protocol parsers + in hardware/common/dmm. Among other things, this allows the functions + to be used from drivers in a generic way, e.g. in serial-dmm, uni-t-dmm, + and possibly other drivers. + +commit 6d0369591b7b30009bf497a5bb285afc7f431ad8 +Author: Uwe Hermann +Date: Fri Apr 26 13:35:19 2013 +0200 + + README: Add "Copyright and license" section. + +commit 695f32d89d678b20896e34affc74b4363b686387 +Author: Uwe Hermann +Date: Fri Apr 26 10:47:34 2013 +0200 + + Bring back link-mso19/nexus-osciprime for now. + + This patch will be re-introduced later. + +commit 9d1164f9a12c218def0e898e4d28fcd55f2fa8cd +Author: Uwe Hermann +Date: Thu Apr 25 19:01:54 2013 +0200 + + Drop link-mso19/nexus-osciprime in preparation for release. + + These two drivers are currently unfinished and don't work, so disable + and "unhook" them for now in preparation of the next libsigrok release. + + They're still in the git repository, but not hooked up to the build + system, so that they won't get detected or built, and also don't end up + in the release tarball. + + Since link-mso19 is the only driver that currently requires libudev, + drop any reference to that, too. + + It should be relatively easy to apply this patch in reverse after the + release to bring back both drivers. + +commit 8d3764aacad94d4bf44cbfdfd4a45dad995eeb33 +Author: Uwe Hermann +Date: Thu Apr 25 17:42:20 2013 +0200 + + README.devices: Fix typo. + +commit 0e77b7cab31186b35d461e7d4ad3ce8a577857ee +Author: Uwe Hermann +Date: Thu Apr 25 00:15:49 2013 +0200 + + python: Add Session.open_device(). + +commit 57dd5e63ecc6cad49f31f94ed0ef9a5336330c4a +Author: Uwe Hermann +Date: Wed Apr 24 23:43:56 2013 +0200 + + python: sr_config's value field is called 'data'. + +commit 3124e80bfe6189d52c5aec9a8c1cacb6ee852b91 +Author: Martin Ling +Date: Wed Apr 24 17:48:04 2013 +0100 + + python: Support keyword arguments to scan() + +commit f245b7669e7ffb7591dc1b1b7087e4352738c84d +Author: Martin Ling +Date: Wed Apr 24 17:47:40 2013 +0100 + + python: Add a ConfigKey class. + +commit 05cfe1147a9f85d9d3db41d6025c708898a66be9 +Author: Martin Ling +Date: Wed Apr 24 14:47:07 2013 +0100 + + python: Add conversion functions to/from GSList * + +commit bd7bfe8c5140d459092f93f9ffc3130a487f5d58 +Author: Bert Vermeulen +Date: Wed Apr 24 23:06:50 2013 +0200 + + Open virtual device before loading file + +commit e73ffd4238c6d1be58d3fcdcf7f100200f033856 +Author: Bert Vermeulen +Date: Tue Apr 23 15:14:42 2013 +0200 + + Enforce open device before config_set()/dev_acquisition_start() + +commit efdecf4c0553ce00ea2a6365212f5fe305496fed +Author: Bert Vermeulen +Date: Tue Apr 23 00:21:57 2013 +0200 + + Add sr_dev_open()/sr_dev_close() + + Frontends will be required to open a device before using + sr_config_set() or starting acquisition. + +commit 46a743c1fa77b1b68ada2b642c095b4f9034edce +Author: Bert Vermeulen +Date: Wed Apr 24 19:07:46 2013 +0200 + + Whitespace fixes + + Damn editor. + +commit a31a4d371f3c3925a9d3a0eefa472147e7b36748 +Author: Bert Vermeulen +Date: Wed Apr 24 03:05:25 2013 +0200 + + fx2lafw: Minor cleanup + +commit 294dbac724d5b36acea17366057bb81c70a265bb +Author: Bert Vermeulen +Date: Wed Apr 24 03:04:12 2013 +0200 + + hantek-dso: Support conn scan parameter + +commit cc9fd2d29c5ff4ab2509b6bb5b33a16304fafa55 +Author: Bert Vermeulen +Date: Wed Apr 24 02:09:49 2013 +0200 + + rigol-ds1xx2: Code cleanup + +commit 9bd4c95606668bdc58a6df3c30bcd91f288a4ea9 +Author: Martin Ling +Date: Mon Apr 22 16:12:06 2013 +0100 + + rigol-ds1xx2: Use common serial code. + +commit ca55277ca8bed14dd569b793dc578212898bb1fb +Author: Martin Ling +Date: Mon Apr 22 14:59:55 2013 +0100 + + rigol-ds1xx2: Accept SR_CONF_CONN. + +commit 886bd5e05686617c928be2d600ce91ed298a2331 +Author: Uwe Hermann +Date: Tue Apr 23 23:06:02 2013 +0200 + + mic-985xx: Use sr_dev_inst to store connection handle. + +commit 31e537725096d578e12923b811d2da79187363e4 +Author: Uwe Hermann +Date: Tue Apr 23 22:54:02 2013 +0200 + + Fix minor warning with some compilers. + +commit 50985c2019b2b5a6ce394589d89ee925b4f5e3a9 +Author: Uwe Hermann +Date: Tue Apr 23 22:24:30 2013 +0200 + + GPL headers: Use correct project name. + +commit 1e1bfcd0fef7c397b3d8fc6cd244263e6828a5da +Author: Uwe Hermann +Date: Tue Apr 23 19:07:15 2013 +0200 + + serial-dmm: Use sr_dev_inst to store connection handle. + +commit 625cc7834a26333b77f4a43f3c74b4aba3f41627 +Author: Bert Vermeulen +Date: Tue Apr 23 10:05:48 2013 +0200 + + More python build stuff to ignore + +commit f99e32affc3a18a2a6b45c988bc440013a8b2e4e +Author: Bert Vermeulen +Date: Mon Apr 22 15:55:06 2013 +0200 + + sr_dev_inst_*() -> sr_dev_*() + +commit 609bfd753c4a813791a6f678f545940c6d331c20 +Author: Bert Vermeulen +Date: Mon Apr 22 15:00:04 2013 +0200 + + zeroplus-logic-cube: Use sr_dev_inst to store connection handle + +commit 459a0f2623686472b134735ae37a52f0d61d715e +Author: Bert Vermeulen +Date: Mon Apr 22 13:40:40 2013 +0200 + + ols: Use sr_dev_inst to store connection handle + +commit 2e5b73c00c7329c9b6ef7bf8f626a22884eac5c0 +Author: Bert Vermeulen +Date: Mon Apr 22 13:33:31 2013 +0200 + + ols: Fix stack clobbering at start of acquisition + + This off-by-one was clobbering the stack since introduced in a803c0db4d58. + However it only set one bit, and that generally appears to have been set + already, so this rarely affected anything. But when it did, it affected + a pointer, causing a segfault. + +commit 919681f0e8b4681b2af64db72abc1945f3b4adb2 +Author: Bert Vermeulen +Date: Mon Apr 22 01:07:35 2013 +0200 + + fluke-dmm: Use sr_dev_inst to store connection handle + +commit aa7066353c9a54d90695fca3b303e1476dd772fd +Author: Bert Vermeulen +Date: Mon Apr 22 00:27:11 2013 +0200 + + colead-slm: Use sr_dev_inst to store connection handle + +commit fb3a15059938770a064fb7d35a813cfa20d8e363 +Author: Bert Vermeulen +Date: Sun Apr 21 21:44:31 2013 +0200 + + agilent-dmm: Use sr_dev_inst to store connection handle + +commit e31d410d26c7377de83d46c1ce80525e2dc7d23b +Author: Martin Ling +Date: Sun Apr 21 20:42:22 2013 +0100 + + rigol-ds1xx2: fix delay time. + +commit 1e2bd8af128529d686fb1ac449334a21b74d4fc0 +Author: Martin Ling +Date: Sun Apr 21 19:52:09 2013 +0100 + + python: fix Fraction -> GVariant tuple conversion. + +commit d2e0b1fa71b90faf1f7e77b72627868baf5e9135 +Author: Martin Ling +Date: Sun Apr 21 13:17:40 2013 +0100 + + rigol-ds1xx2: better error handling in hw_scan. + +commit 8bb2981df075082071b3edf2426a3444109726f0 +Author: Bert Vermeulen +Date: Fri Apr 19 21:19:54 2013 +0200 + + victor-dmm: Allow configuration before the device is opened + +commit 522a34343f78eb55ff7213e34ff3e002867dbad3 +Author: Uwe Hermann +Date: Sat Apr 20 13:43:48 2013 +0200 + + Drop obsolete g_match_info_unref() workaround. + + We hard-depend on glib >= 2.32.0 now anyway, so this is no longer needed. + +commit ac070c7744471350e38836a58dd565750d96ce7f +Author: Uwe Hermann +Date: Fri Apr 19 20:19:14 2013 +0200 + + Add initial, lowlevel Ruby bindings. + +commit 91bea31f6bff799f90fc21201312505d37441981 +Author: Martin Ling +Date: Fri Apr 19 17:41:44 2013 +0100 + + python: unify pkg-config calls in setup.py. + +commit 0cd466ccd8f1149883f535868650d4236d0b7ab4 +Author: Martin Ling +Date: Fri Apr 19 17:30:44 2013 +0100 + + python: Use --cflags-only-I to get includes in setup.py. + +commit 9bbd6a6a0d8747538db2e1ef03e52e4fdcadfaa2 +Author: Martin Ling +Date: Fri Apr 19 16:57:13 2013 +0100 + + python: Add classes for values of API enums. + +commit 816aed6c9157721c7123f1f29fe01f353278af22 +Author: Uwe Hermann +Date: Fri Apr 19 13:15:51 2013 +0200 + + python: Add a Log class to control libsigrok logging. + +commit 0021b077416c09dc72bef411e3768bbe87afdf56 +Author: Uwe Hermann +Date: Fri Apr 19 11:58:40 2013 +0200 + + python: config_get() now returns SR_ERR_NA. + +commit ac046ef8cf64098fc20030fe60b345cd563f72f8 +Author: Bert Vermeulen +Date: Thu Apr 18 22:48:09 2013 +0200 + + victor-dmm: Support SR_CONF_CONN + +commit 0f1506497b615b3c935b9a7bce9af85390a09d24 +Author: Bert Vermeulen +Date: Thu Apr 18 22:30:10 2013 +0200 + + lascar-el-usb: Support SR_CONF_CONN + +commit e2033d491753c5746ddbc0b8f29a5aa56c297ac3 +Author: Bert Vermeulen +Date: Thu Apr 18 21:37:38 2013 +0200 + + hantek-dso: Consistently return SR_ERR_ARG if sdi is needed + +commit 38ab8dbec8b1944e06dd3a809229b106c5e628df +Author: Bert Vermeulen +Date: Thu Apr 18 21:36:25 2013 +0200 + + fx2lafw: Consistently return SR_ERR_ARG if sdi is needed + +commit c2ec42ce938bc38bfd72ca3959611baab326530a +Author: Uwe Hermann +Date: Thu Apr 18 17:45:17 2013 +0200 + + python: Add further properties to Analog class. + +commit 15574a3cecc14dcbed38464317e37ac9cfe2d220 +Author: Martin Ling +Date: Wed Apr 17 17:48:39 2013 +0100 + + python: Add Analog class. + +commit 624f5b4c1e329e74d6bb6e7fc0fce27945506567 +Author: Bert Vermeulen +Date: Thu Apr 18 01:21:57 2013 +0200 + + hantek-dso: Support config_get(SR_CONF_CONN) + +commit 89befd46a8a12b0ba7867e73f7aec77a7dfc0add +Author: Bert Vermeulen +Date: Thu Apr 18 01:15:37 2013 +0200 + + fx2lafw: Support config_get(SR_CONF_CONN) + + This generates a bus.address conn string which can be used to + uniquely identify the given sr_dev_inst. + +commit 3bc55222c8503703ac76bc61fb9a5d2c101f0ed7 +Author: Uwe Hermann +Date: Wed Apr 17 17:26:46 2013 +0200 + + python: Add missing license headers. + +commit 08d59537c353c6980c5e9a0f8b0039f2ab5b0ba5 +Author: Martin Ling +Date: Wed Apr 17 15:38:33 2013 +0100 + + python: fix cdata to work with Python 3.x. + +commit 1cad2115477176001f44cbe8a46a3c74e650f866 +Author: Martin Ling +Date: Wed Apr 17 15:37:58 2013 +0100 + + python: Fix syntax to support Python 3.x. + +commit d8f6e041aa109f328612f6d7301411abde9e5134 +Author: Martin Ling +Date: Wed Apr 17 14:30:31 2013 +0100 + + python: Add high level API. + +commit a8d162f6d33f2d5112193d6539a08e9b7beac4d7 +Author: Martin Ling +Date: Wed Apr 17 14:03:38 2013 +0100 + + swig: Wrap additional GVariant operations. + +commit cccb59914799002df75299ec98da132fcccfaac0 +Author: Martin Ling +Date: Wed Apr 17 14:01:19 2013 +0100 + + python: Release GIL during libsigrok calls. + +commit a25932e08c6b7424fec07bb2295fadd613294075 +Author: Martin Ling +Date: Wed Apr 17 13:59:30 2013 +0100 + + python: Adding callback can fail, and refcount must be incremented. + +commit 0220626994c6bac7bce967fe6dc8804667cce03e +Author: Martin Ling +Date: Wed Apr 17 03:50:27 2013 +0100 + + python: use setuptools and put bindings into sigrok.core.lowlevel. + +commit d0eec1eea17c62d731e44fc0b3b436b78d0df718 +Author: Bert Vermeulen +Date: Wed Apr 17 01:08:18 2013 +0200 + + hantek-dso: Mark connection as USB + +commit 949b3dc0916eed68ba6f3878300feb61ad858014 +Author: Bert Vermeulen +Date: Wed Apr 17 00:49:18 2013 +0200 + + hantek-dso: Use std_dev_clear() + +commit 72f9d6dc5e4fb4bcc33c70e601f643d0ce5d1f3e +Author: Bert Vermeulen +Date: Wed Apr 17 00:42:06 2013 +0200 + + fx2lafw: No device context internals to clear + +commit ae5859fff08a8ccc8cba081d7500f75cc46114f7 +Author: Bert Vermeulen +Date: Wed Apr 17 00:41:01 2013 +0200 + + Allow for sdi->priv helper function in std_dev_clear + +commit c118080b1db555c1eb226ea783fc186602c20315 +Author: Bert Vermeulen +Date: Tue Apr 16 23:15:34 2013 +0200 + + hantek-dso: Store USB connection in sr_dev_inst + +commit 9bb2f327a9dd482f609b10e34f72e57816cd4531 +Author: Uwe Hermann +Date: Tue Apr 16 22:19:00 2013 +0200 + + Python bindings: Small fix for Python 3 support. + +commit 415e6389ce2d57e9559a04f0e3523d111843a618 +Author: Uwe Hermann +Date: Tue Apr 16 15:42:45 2013 +0200 + + chronovu-la8: Fix incorrect 0Hz samplerate being reported. + + This closes bug #93. + +commit 250a78c7d5d049edd8c4f792f9eee56eae773a0b +Author: Bert Vermeulen +Date: Tue Apr 16 17:55:56 2013 +0200 + + fx2lafw: Use standard dev_clear() instead + +commit 49f00e13f72d11a9cac8523e0c1506dde138f218 +Author: Bert Vermeulen +Date: Tue Apr 16 17:53:21 2013 +0200 + + Add driver helper std_dev_clear() + +commit 9e2e98640ac2b12545f4923a143d06d3896f8435 +Author: Bert Vermeulen +Date: Mon Oct 1 03:03:24 2012 +0200 + + sr: add conn to sdi, for storing a ptr to device-specific connection info + + What's in conn depends on the long-ignored inst_type field. + +commit 0223135bfb6771d7749fa39cff64a78c7a84a674 +Author: Uwe Hermann +Date: Tue Apr 16 12:54:11 2013 +0200 + + error.c: Add missing SR_ERR_ARG and SR_ERR_NA. + +commit 85222791a9f3722c1cf659cfd4e4144314dbeec0 +Author: Uwe Hermann +Date: Tue Apr 16 12:48:58 2013 +0200 + + Doxygen: Add missing parameter docs. + +commit 63c290b9840d459a9dac5073b71db43688cc94e9 +Author: Uwe Hermann +Date: Tue Apr 16 12:45:38 2013 +0200 + + Doxygen: Exclude bindings/. + +commit 1a64618a2f46bf4374a673dcfc413dce8771fe89 +Author: Uwe Hermann +Date: Tue Apr 16 12:43:42 2013 +0200 + + Doxygen: Set SHOW_NAMESPACES=no. + + Since this is a C project, a "Namespaces" page is not really useful. + +commit 9fb5f2dfa6bcded8082677ed3b915ff6b880cfab +Author: Uwe Hermann +Date: Sat Apr 13 18:58:11 2013 +0200 + + Doxygen: Add @since markers. + + Add @since tags to some (not all yet) public API functions, to document + in which release they were added (and/or in which release there were + API changes). + + Document the @since usage in HACKING. + + Also, add Doxygen docs for the functions in version.c. + +commit 22f8cb54d18bf4abd5a7513a509539f15570784c +Author: Martin Ling +Date: Tue Apr 16 03:33:56 2013 +0100 + + swig: wrap g_variant_new_uint64. + +commit d962ed92a118a8bc9d98e00f7a218a4cc9c71e69 +Author: Martin Ling +Date: Tue Apr 16 03:11:48 2013 +0100 + + swig: include cdata interface. + +commit 966fcbe3e34de14b163987550d17b00dc84bf82e +Author: Martin Ling +Date: Tue Apr 16 03:02:52 2013 +0100 + + swig: add function to cast from void * to struct sr_datafeed_logic * + +commit 0849c7d3104efc098aa282d7e8b841506c386ea3 +Author: Martin Ling +Date: Tue Apr 16 02:55:39 2013 +0100 + + python: support datafeed callbacks implemented in python. + +commit ab0340c804c31a146977907e90d7b1d012f401a1 +Author: Martin Ling +Date: Tue Apr 16 02:55:11 2013 +0100 + + swig: use standard wrappers for integer types. + +commit 2726474a619e5d9a9bfcf797a5e306f4496a4545 +Author: Martin Ling +Date: Mon Apr 15 21:08:55 2013 +0100 + + Add a void *cb_data parameter to datafeed callbacks. + +commit bd6fbf628abef9fab5293e016ad11e1a1ac4a0a9 +Author: Bert Vermeulen +Date: Tue Apr 16 02:33:03 2013 +0200 + + drivers: return SR_ERR_NA on unsupported config key + + Fixes bug 89. + +commit f02121f8d2623a7b8cbc87b75cf529e0a9cfd7d5 +Author: Uwe Hermann +Date: Tue Apr 16 00:58:29 2013 +0200 + + Python bindings: Fix reported libsigrok version. + + Use 'pkg-config --modversion libsigrok' to get the libsigrok package + version. 'pkg-config --version libsigrok' ignores the argument and just + reports the version of pkg-config itself. + +commit 8dc93c841f73dd2dbb252c1be42701a5e03d2f26 +Author: Uwe Hermann +Date: Tue Apr 16 00:57:00 2013 +0200 + + Python bindings: Cosmetics. + +commit 7aafb892746356c9089a2ba91188bfa51c68cea2 +Author: Martin Ling +Date: Mon Apr 15 23:05:38 2013 +0100 + + Tell SWIG that gpointer is really void *. + +commit 758b01adcbbc2cd4c077281ad06c7bb2ac414391 +Author: Martin Ling +Date: Mon Apr 15 20:01:07 2013 +0100 + + Add SWIG interface file and build script for Python bindings. + +commit 72cd99b876eb2185358bc108b488585c956f3dc7 +Author: Bert Vermeulen +Date: Tue Apr 16 00:23:34 2013 +0200 + + ols: Report when a device doesn't support metadata + + Not an error, but it does mean it's either a really old or really + basic device, and will help us to debug people's problems with + these. + + Fixes bug 92. + +commit 754b5ff2b48fc2fda3771940aa9d98108ae4f6af +Author: Bert Vermeulen +Date: Mon Apr 15 23:50:16 2013 +0200 + + fx2lafw: Support conn scan parameter + + This takes a USB specification. Fixes bug 82. + +commit 1eb0a0df666e8ed117c9b3d3c65291367cbb961f +Author: Bert Vermeulen +Date: Mon Apr 15 23:47:04 2013 +0200 + + usb: Fix bus.address format detection + +commit e5d15bd2a2eb8c34ee7bc9db1e70ba0741215097 +Author: Bert Vermeulen +Date: Mon Apr 15 20:05:43 2013 +0200 + + ols: Allow configuration before the device is opened + +commit a7be14ada20d594c5338613a73788e8f89c0d9d5 +Author: Bert Vermeulen +Date: Mon Apr 15 18:45:38 2013 +0200 + + rigol-ds1xx2: Don't assume there's a valid sdi + +commit bf256783599262b94c4b3be3797f4576053d96e1 +Author: Bert Vermeulen +Date: Mon Apr 15 18:28:16 2013 +0200 + + ols: Properly initialize operational state before start + +commit e45ad6e24ff1a3873d551f9ed08acb3ffd0d1d0d +Author: Uwe Hermann +Date: Mon Apr 15 12:27:55 2013 +0200 + + demo: Fix compiler warning, cosmetics. + +commit 1d166757694b259bbcca205ced91ac69e8a5ef7e +Author: Bert Vermeulen +Date: Mon Apr 15 01:30:24 2013 +0200 + + lascar-el-usb: Use two probes for temp/humidity loggers + +commit 2150a69b7633ebd1bcf13f645c026506f3dfe03b +Author: Joel Holdsworth +Date: Sun Apr 14 19:19:35 2013 +0100 + + demo: Unref the IO channel when it is no longer used + +commit ed20a42803c8b4e79b259ae03298dec88f2299f5 +Author: Joel Holdsworth +Date: Sun Apr 14 18:52:02 2013 +0100 + + demo: Free dev_contexts + +commit a76842947faadad98572f011cb20f3220998f71b +Author: Joel Holdsworth +Date: Sun Apr 14 17:00:47 2013 +0100 + + demo: Moved demo configuration variables into dev_context + +commit 33c6e4c5a428115965f980e88e6415fb782658e9 +Author: Alexandru Gagniuc +Date: Sat Feb 2 00:50:00 2013 -0600 + + session: Make sr_session_stop thread-safe + + With the sigrok session running in a worker thread, if sr_session_stop is called + from another thread, it shuts down the pollfds used by the hardware drivers, + without ensuring that the sigrok event loop is no longer using those pollfds. + + On the demo driver, this involves shutting down the GIOChannels, causing a + segfault when the sigrok event loop tries to use them. This is evident when + using the Stop button in PulseView, while the session is running. + + This isn't a problem with just the demo driver; any driver's resources may be + freed by sr_session_stop concurrently with the sigrok session running. + + To solve this problem, we don't touch the session itself in sr_session_stop(). + Instead, we mark it for decommissioning and return. The session polls this flag, + and shuts itself down when requested. + + This fixes bug 4. + + Signed-off-by: Alexandru Gagniuc + +commit 33ef757383896959651c48744fabb417729424dc +Author: Joel Holdsworth +Date: Sun Apr 14 15:46:15 2013 +0100 + + demo: Keep a pointer to dev_context in sr_dev_inst and vice-versa + +commit e053204700fa0a9151e6efb54eae9dc5a73e3ccd +Author: Joel Holdsworth +Date: Sat Apr 13 16:43:16 2013 +0100 + + demo: Only one GIOChannel is needed + +commit bbd7ef0f18df94232bafe6606c6d37eaad9ffd80 +Author: Joel Holdsworth +Date: Sat Apr 13 16:08:52 2013 +0100 + + demo: Fixed glitching in increment signal + +commit f0b6ae19a8e6ae7050cde3e1fa0a3ce46b9b5f66 +Author: Joel Holdsworth +Date: Sat Mar 16 08:43:36 2013 +0000 + + alsa: Set the probe index + +commit 9e5670d0ab63af4353003bf879b0aa5e1a6919f8 +Author: Jan Luebbe +Date: Sat Apr 13 23:27:07 2013 +0200 + + zeroplus-logic-cube: add USB ID for LAP-16128U + +commit 6bb192bc05f976a5660e35c9507450a573679296 +Author: Martin Ling +Date: Sun Apr 14 02:21:55 2013 +0100 + + rigol-ds1xx2: support digital channels. + +commit a789b61087f156f3f5b38de6c56c7744fde2c3eb +Author: Martin Ling +Date: Sat Apr 13 22:25:41 2013 +0100 + + rigol-ds1xx2: doesn't actually support SR_CONF_LIMIT_SAMPLES + +commit ee7e9bee5d943261d866f92cb8b81584e290df01 +Author: Martin Ling +Date: Sun Apr 14 01:58:35 2013 +0100 + + rigol-ds1xx2: fix handling of partial frames. + +commit 4c7aca66defecb82245d2fd8b62b3ff70049982a +Author: Bert Vermeulen +Date: Sun Apr 14 16:44:49 2013 +0200 + + ignore test leftovers + +commit 0c05591abf6b313aebb1f717903c5cc337f58329 +Author: Bert Vermeulen +Date: Sun Apr 14 00:36:05 2013 +0200 + + ols: Support get/set/list on all device options + + Where it makes sense: _LOGIC_ANALYZER and _TRIGGER_TYPE don't have much + use for all of them. + +commit 8f35be72b46769b3b51e9c91a131eaf6c256ac1a +Author: Bert Vermeulen +Date: Fri Apr 12 19:42:44 2013 +0200 + + rigol-ds1xx2: Use g_usleep() for portability + +commit 406569ddeadbbbc73c9fefb92b855e03fc107987 +Author: Uwe Hermann +Date: Fri Apr 12 18:47:06 2013 +0200 + + Bump glib requirement to >= 2.32.0. + + This is now required, e.g. due to the usage of g_variant_new_fixed_array(). + +commit 169dbe8577c2f7570f61799a064f95b39b3b6fe3 +Author: Uwe Hermann +Date: Fri Apr 12 18:44:28 2013 +0200 + + rigol-ds1xx2: Whitespace, minor fix. + + Return SR_ERR_MALLOC for failed malloc, not SR_ERR. + +commit 34e4c273916d8fd246ca6aefbff05528f92391fc +Author: Uwe Hermann +Date: Fri Apr 12 17:59:38 2013 +0200 + + unittests: Adapt to new GVariant system. + +commit ff08a52a0fb66abb471fa0bfe0369300c313778f +Author: Uwe Hermann +Date: Fri Apr 12 17:45:01 2013 +0200 + + Fix two minor compiler warnings. + +commit ba6568c5adcbb2075964c582bf2939b46f729b12 +Author: Bert Vermeulen +Date: Thu Apr 11 18:49:24 2013 +0200 + + output/vcd: Use selected probes, not lowest-numbered ones + + Thanks to Andrew Bardsley for the patch. + +commit 254dd102e84a6f9e5a62be5172bb94cbca3da4e8 +Author: Bert Vermeulen +Date: Thu Apr 11 16:06:55 2013 +0200 + + rigol-ds1xx2: Support for all channels, proper defaults + + Since this driver supports devices with a control panel and display, + we take the defaults from the device -- not a set of sensible + defaults as usual. + +commit 88e429c97f4fa482f8897c4795ad14f0afa96b56 +Author: Bert Vermeulen +Date: Mon Apr 8 12:01:00 2013 +0200 + + rigol-ds1xx2: fix channel numbers + + Copyright bump, too. + +commit a3df166f02201abe253b6fd4ee416394dace9e5e +Author: Bert Vermeulen +Date: Mon Apr 8 01:12:42 2013 +0200 + + rigol-ds1xx2: better debugging + +commit 75d8a4e5766cccdcd7f017093fa822e7218749b8 +Author: Bert Vermeulen +Date: Mon Apr 8 00:38:58 2013 +0200 + + rigol-ds1xx2: properly send frame begin/end packets + +commit 7991784841727d39a6f71ffa4ccdc1fc86af9f98 +Author: Bert Vermeulen +Date: Mon Apr 8 00:37:50 2013 +0200 + + hantek-dso: Support SR_CONF_NUM_TIMEBASE/SR_CONF_NUM_VDIV + +commit d62d7ad151e2b50484bc6bf36c94b9657ed6a500 +Author: Bert Vermeulen +Date: Mon Apr 8 00:37:12 2013 +0200 + + rigol-ds1xx2: Support SR_CONF_NUM_TIMEBASE/SR_CONF_NUM_VDIV + +commit 2efa699fda95b6d2d722d41407ca741cdbfe709c +Author: Bert Vermeulen +Date: Mon Apr 8 00:29:37 2013 +0200 + + Add SR_CONF keys to report the number of timebases and vdivs + + Number of timebases is needed to properly interpret a frame's worth + of samples. Number of vertical divisions isn't, but may nevertheless + be interesting for a frontend that wants to reproduce the scope's + native display. + +commit d8284802ca6bbdf19e7ff0ae9bcc5b6e111056c0 +Author: Bert Vermeulen +Date: Sun Apr 7 22:51:45 2013 +0200 + + use driver callbacks directly + +commit 861c447bfb020a59ac9d197c4a74a4e8ea3998bf +Author: Bert Vermeulen +Date: Sun Apr 7 21:51:26 2013 +0200 + + rigol-ds1xx2: SR_CONF_TIMEBASE and _VDIVS lists are now an array of tuples + +commit 6cefe516aacc215fa8d144e9da09e69cfb1e5ff6 +Author: Bert Vermeulen +Date: Sun Apr 7 21:50:42 2013 +0200 + + return SR_ERR_ARG if a driver doesn't implement sr_config_*() + +commit 82b904b173f1443c4d6bdebdf1a7f0dda01c4982 +Author: Bert Vermeulen +Date: Sun Apr 7 21:28:54 2013 +0200 + + Add Rigol DS1052E/1102E VID:PID + +commit 3973ee26f58efa469657c57d23a285273f316c35 +Author: Bert Vermeulen +Date: Sun Apr 7 21:02:18 2013 +0200 + + hantek-dso: SR_CONF_TIMEBASE and _VDIVS lists are now an array of tuples + +commit 034accb512e43172ee292d1585870db9e2477ed0 +Author: Bert Vermeulen +Date: Tue Apr 2 20:54:44 2013 +0200 + + hantek-dso: move buffer sizes to device context + + There are only two sizes for every device: 10k and the complete + per-channel buffer size. This can be doubled if one channel is disabled. + +commit fe9ac252502fbb90badc84367eea75d6ab027686 +Author: Bert Vermeulen +Date: Mon Apr 1 16:53:14 2013 +0200 + + ols: Get rid of gcc warnings + +commit 1bec72d2ac388bd78c1c4e573431170c4ed97f8c +Author: Bert Vermeulen +Date: Sun Mar 31 21:31:49 2013 +0200 + + chronovu-la8: Adjust to GVariant-based sr_config_* functions + +commit afdf6d6a20a0d5ac7c3f9b84d1af4f782eda3177 +Author: Bert Vermeulen +Date: Sun Mar 31 21:28:33 2013 +0200 + + tondaj-sl-814: Adjust to GVariant-based sr_config_* functions + +commit 7d93a62ea3b7c8853603fa267bb8b1320dde4b69 +Author: Bert Vermeulen +Date: Sun Mar 31 21:28:33 2013 +0200 + + uni-t-dmm: Adjust to GVariant-based sr_config_* functions + +commit ede25f4e6f9dbf84629c0058f91014a8bab59a56 +Author: Bert Vermeulen +Date: Sun Mar 31 21:28:33 2013 +0200 + + serial-dmm: Adjust to GVariant-based sr_config_* functions + +commit f6a0ac9f6217f808d02f1c64a49c7ead3afb06e1 +Author: Bert Vermeulen +Date: Sun Mar 31 21:25:51 2013 +0200 + + rigol-ds1xx2: Adjust to GVariant-based sr_config_* functions + +commit 2c2be401897895c0a343dfd461adcfffbee950a6 +Author: Bert Vermeulen +Date: Sun Mar 31 21:25:51 2013 +0200 + + mic-985xx: Adjust to GVariant-based sr_config_* functions + +commit a9ed6877f7c5e920a5ba065324be9587f3c1ffaf +Author: Bert Vermeulen +Date: Sun Mar 31 21:25:51 2013 +0200 + + link-mso19: Adjust to GVariant-based sr_config_* functions + +commit 510b3e692a61239bfa1c6794218acd80e5ba28ef +Author: Bert Vermeulen +Date: Sun Mar 31 20:55:39 2013 +0200 + + brymen-dmm: Adjust to GVariant-based sr_config_* functions + +commit 2c9c0df86eaf9b64cf0ba7537b3c3c84f2da4686 +Author: Bert Vermeulen +Date: Sun Mar 31 20:55:39 2013 +0200 + + asix-sigma: Adjust to GVariant-based sr_config_* functions + +commit aa0dbd683c58c9dd342140a4080d2aa0b95c5bb3 +Author: Bert Vermeulen +Date: Sun Mar 31 20:55:39 2013 +0200 + + alsa: Adjust to GVariant-based sr_config_* functions + +commit 3316e149d0dd03e65aca72183bc15eb839e392c6 +Author: Bert Vermeulen +Date: Sun Mar 31 20:47:01 2013 +0200 + + zeroplus-logic-cube: fix samplerate setting + +commit e0e150672af8b52f7931ad827bdfb85773cfb4bb +Author: Bert Vermeulen +Date: Sun Mar 31 10:27:15 2013 +0200 + + sr_voltage_string(): deprecate struct sr_rational + +commit 8386096f013a2735553d5066ed2b96f519c12a76 +Author: Bert Vermeulen +Date: Sat Mar 30 19:48:38 2013 +0100 + + zeroplus-logic-cube: Adjust to GVariant-based sr_config_* functions + +commit c8733a2bbb876496e3c6eb9e95084d9d5fb7e834 +Author: Bert Vermeulen +Date: Sat Mar 30 19:48:38 2013 +0100 + + nexus-osciprime: Adjust to GVariant-based sr_config_* functions + +commit e44ac12a29c39cb873968a8fd4c02b3e05316b3b +Author: Bert Vermeulen +Date: Sat Mar 30 19:48:38 2013 +0100 + + agilent-dmm: Adjust to GVariant-based sr_config_* functions + +commit a59b4eef5576f1c32d1d4a0968be05eb17c865f9 +Author: Bert Vermeulen +Date: Sat Mar 30 19:29:44 2013 +0100 + + victor-dmm: Adjust to GVariant-based sr_config_* functions + +commit 70424328c10640f0c1db0ab6334723658c043470 +Author: Bert Vermeulen +Date: Sat Mar 30 19:29:44 2013 +0100 + + fluke-dmm: Adjust to GVariant-based sr_config_* functions + +commit dccda194dbd202eb0274f479b51152400ff9de88 +Author: Bert Vermeulen +Date: Sat Mar 30 19:29:44 2013 +0100 + + colead-slm: Adjust to GVariant-based sr_config_* functions + +commit 7faf69da10e743820ef54d7f3c11cdcc06fc9b1a +Author: Bert Vermeulen +Date: Sat Mar 30 19:08:29 2013 +0100 + + lascar-el-usb: Adjust to GVariant-based sr_config_* functions + +commit d40073113bc1c09f3924cac275791e53905bbab5 +Author: Bert Vermeulen +Date: Sat Mar 30 15:47:01 2013 +0100 + + hantek-dso: Small debug fix + +commit 86bb3f4a865a7eed9f0537f01356231cf7d86012 +Author: Bert Vermeulen +Date: Sat Mar 30 15:24:37 2013 +0100 + + hantek-dso: deprecate struct sr_rational + +commit e48a54629242584b7b2508d657815730ad80cbfe +Author: Bert Vermeulen +Date: Sat Mar 30 15:23:44 2013 +0100 + + input/vcd: deprecate struct sr_rational + +commit 76e107d68c010ee3aaede5a1eec2893f82062184 +Author: Bert Vermeulen +Date: Sat Mar 30 14:41:01 2013 +0100 + + sr_parse_(period|voltage): deprecate struct sr_rational + +commit d00088ca6daf91270f8c2f063167eedf2644bb8f +Author: Bert Vermeulen +Date: Tue Mar 26 22:02:45 2013 +0100 + + demo: Adjust to GVariant-based sr_config_* functions + +commit f627afd65b5b544b1c10345bddf1b3a490fb8c93 +Author: Bert Vermeulen +Date: Tue Mar 26 21:38:32 2013 +0100 + + hantek-dso: Adjust to GVariant-based sr_config_* functions + +commit 38f1e846a81a4fee1a28c0f3547c4ac821b0f882 +Author: Bert Vermeulen +Date: Mon Mar 25 20:41:28 2013 +0100 + + struct sr_samplerates is now obsolete + + sr_config_get() of SR_CONF_SAMPLERATE now returns a GVARIANT_TYPE_DICTIONARY. + This dictionary contains a single key-value pair. Possible values for the key: + + - "samplerates": the value is an array of GVARIANT_TYPE_UINT64 representing + all valid samplerates. + - "samplerate-steps": the value is an array of GVARIANT_TYPE_UINT64 with + exactly three members, which represent the lowest samplerate, highest + samplerate, and the minimum step, respectively. + +commit aeea0572202fa20093534a8e97da87c324151932 +Author: Bert Vermeulen +Date: Mon Mar 25 20:40:40 2013 +0100 + + ols: allow for disabling of RLE as well + +commit e46aa4f611da95cc705279c199f0e662b39eed1b +Author: Bert Vermeulen +Date: Mon Mar 25 20:40:15 2013 +0100 + + ols: Adjust to GVariant-based sr_config_* functions + +commit d6836bf129adc8efbd826b8ea04246167987e0cc +Author: Bert Vermeulen +Date: Mon Mar 25 20:30:56 2013 +0100 + + fx2lafw: Adjust to GVariant-based sr_config_* functions + +commit 8e34ca86fb54ec1c841724900006868e29b180fa +Author: Bert Vermeulen +Date: Mon Mar 25 20:29:45 2013 +0100 + + Add SR_CONF_TRIGGER_TYPE config_info list + +commit ec4063b83c9b8a0693b9837787306dd5405e076b +Author: Bert Vermeulen +Date: Mon Mar 25 20:27:26 2013 +0100 + + input/output modules: Adjust to GVariant-based sr_config_* functions + +commit 722db131a45dbc84aaa27cf65467a11552a32548 +Author: Bert Vermeulen +Date: Mon Mar 25 20:23:13 2013 +0100 + + Add sr_config_free() + + Due to struct sr_config now containing a GVariant, this needs to be + cleaned up after use properly. This is a helper function for that. + +commit 003595ac375fac61ed9ef45b13119c80e7c1ade3 +Author: Bert Vermeulen +Date: Mon Mar 25 20:21:10 2013 +0100 + + Adjust to GVariant-based sr_config_* functions + +commit bc1c2f001a3b8499052348ec45155313153b2194 +Author: Bert Vermeulen +Date: Mon Mar 25 15:38:44 2013 +0100 + + Use GVariant for sr_config_*() functions + + sr_config_get() provides a GVariant owned by the caller, so it must be + released with g_variant_unref() when done. + + sr_config_set() takes a GVariant from the caller which may be floating; + it will be properly sunk and release after use by this function. Thus + the output of g_variant_new_*() may be used as an argument. + + sr_config_list() also provides a GVariant owned by the caller, to be + unreferenced when done. + + sr_config_make() can take a floating reference. + +commit 13d8e03c4f9fb6fe9c5f682ab957173effe42d43 +Author: Bert Vermeulen +Date: Sun Mar 24 11:21:00 2013 +0100 + + Bump copyright year + +commit 2e542814cb97a9937f9e4cace367ffdb7a2231cc +Author: Uwe Hermann +Date: Tue Apr 9 19:52:38 2013 +0200 + + configure.ac: Fix checks for cross-compiles. + + When checking architecture-specific things, always check $host, i.e. the + architecture we're building _for_, not the one we happen to build _on_. + + E.g. when cross-compiling _for_ Android (or Windows or others) it's important + to check for Android in $host; whether we happen to cross-compile _on_ a Linux + or Windows or OpenBSD or FreeBSD machine ($build) doesn't matter, only the + fact that we compile _for_ Android is important for most checks. + +commit bbe6e336b3baf86b43f88185f25eab424cbd61f6 +Author: Uwe Hermann +Date: Tue Apr 9 18:50:34 2013 +0200 + + vcd output: Build fix for Windows/MinGW. + + On Windows/MinGW 'recv' seems to be already defined in windows.h/winsock2.h. + + Use 'receive' instead, for now, otherwise we get an error: + + vcd.c:147:17: error: conflicting types for 'recv' + +commit 6bad8487243cb5e86979b801069f9656f627480f +Author: Uwe Hermann +Date: Tue Apr 9 18:47:31 2013 +0200 + + configure.ac: Print $host and $build. + + In the configure summary at the end also print the architecture we're + building on ($build) and the target host we build for ($host). The two are + not necessarily the same, e.g. in the case of cross-compiles. + +commit 6e772cbe802327ed79cdaae9d366fed1ec6b081c +Author: Uwe Hermann +Date: Tue Apr 9 18:08:16 2013 +0200 + + configure.ac: Mention required lib versions. + + In the summary output at the end of a configure run, explicitly mention + which versions of which libraries are required, and also the version which + pkg-config has found. + +commit 63cbeaeb597450a52086ff23839f5dbf8989a8a2 +Author: Uwe Hermann +Date: Tue Apr 9 17:58:37 2013 +0200 + + configure.ac: Only enable rigol-ds1xx2 on Linux. + +commit e4fad80b8534a05e7318bc4f9e0e688ae04d3ea2 +Author: Uwe Hermann +Date: Tue Apr 9 10:03:58 2013 +0200 + + configure.ac: Cosmetics for the list of drivers. + + Use the canonical driver name (all-lowercase, e.g. "serial-dmm") in the + list of enabled/disabled drivers that configure prints after a run. + + It's common to many drivers that they support multiple devices, so + printing one device name (e.g. "ChronoVu LA8") is seldom really correct. + E.g. the agilent-dmm, asix-sigma, brymen-dmm, colead-slm, fluke-dmm, + fx2lafw, hantek-dso, lascar-el-usb, mic-985xx, openbench-logic-sniffer, + rigol-ds1xx2, uni-t-dmm, victor-dmm, and zeroplus-logic-cube drivers + all support more than just one device. + + So, just print the driver name instead which is more correct anyway + since it's specifically a list of enabled/disabled drivers. + +commit ccf35720c0494f4102fba8ee0a44ce1d3b67fc10 +Author: Uwe Hermann +Date: Mon Apr 8 15:56:54 2013 +0200 + + configure.ac: Improve a libusb-1.0 related check. + + Don't rely on the "heuristic" that 'libusb_CFLAGS' will be non-empty if + libusb-1.0 was found, but rather use the proper method of checking the + variable 'have_libusb1_0' which pkg-config will set to "yes"/"no" + depending on whether it finds the library. + +commit 3fd1d0ee1c6e8f9d1c6e30c16add1cc4253662bb +Author: Uwe Hermann +Date: Mon Apr 8 15:40:57 2013 +0200 + + configure.ac: Improve USB/EZUSB/serial checks. + + - If libusb-1.0 is not found, do not compile in ezusb.c and usb.c since + they require libusb.h. The respective hardware drivers that use + libusb-1.0, and usb.c and/or ezusb.c will be excluded from the build + elsewhere in configure.ac. Rename NEED_EZUSB to NEED_USB. + + - Drop the NEED_SERIAL check and always compile in serial.c. This is a + very small chunk of code, it does not depend on any external + libraries that might be missing, and it compiles on all architectures. + Thus there's no need to conditionally include or exclude it. + +commit ae4c3d0431571346f489be3a370a9bb431a6ec59 +Author: Uwe Hermann +Date: Tue Apr 9 12:32:30 2013 +0200 + + configure.ac: Fix the order of some entries. + + In order for lib autodetection and disabling of drivers (which require + libs that cannot be found) to work, the order of AC_ARG_ENABLEs, + AM_CONDITIONALs, and AC_DEFINEs needs to be changed. + + All drivers start out enabled or disabled (depending on whether + the --disable-drivers option was supplied or not). Then, any driver can + be enabled or disabled explicitly via --enable- or the + resp. --disable- option. Finally, pkg-config checks for all + libraries are performed, and all drivers which require a library that + cannot be found are disabled explicitly (regardless of any + --enable- option that might have been supplied). + +commit aba692624593131b9f1ea7cd63d1f88b9e09b668 +Author: Uwe Hermann +Date: Mon Apr 8 14:46:13 2013 +0200 + + configure.ac: Improve pkg-config related checks. + + Until now, we checked for certain (optional) libraries via pkg-config and + the configure script would abort if any of them was not found, even + though they were optional. It was up to the user to then figure out which + combination of --disable- switches were required for his + specific OS (and set of installed libs) to get a working configure run. + + Only if the user already specified enough --disable- + switches beforehand, so that all drivers which require a missing library + were disabled, would the configure run not check for that specific lib + (and would thus not fail). + + With this change, we now always unconditionally check for all libs + (required and optional) via pkg-config. However, whether an (optional) lib + is found or not, configure will not abort. Instead, it'll just disable + all drivers which need a lib that cannot be found. + + The user will no longer have to supply --disable- parameters + in order to get a working build. + +commit 3f98bf7017341f70ceb92f98b976d972254c3ba0 +Author: Bert Vermeulen +Date: Sun Apr 7 14:14:16 2013 +0200 + + Fix kernel driver attached check + + The check is really only broken on darwin, but useful on all other + platforms, even if only Linux can actually detach a driver. + +commit 8c971b6e5c6fa0242d786b3c85aabedf2d9ad432 +Author: Bert Vermeulen +Date: Tue Apr 2 14:33:17 2013 +0200 + + hantek-dso: cosmetics + +commit 67b5fba8cac632ab2ec60a3e115ff9016e900114 +Author: Uwe Hermann +Date: Sat Apr 6 19:28:48 2013 +0200 + + Doxygen: Exclude std.c and tests/*. + + These don't contain any public API functions or macros and thus should + not appear in the ("public API" version of) the Doxygen docs. + +commit c27e5f1e82819cad599b95a24bf9f617abd6fafb +Author: Uwe Hermann +Date: Sat Apr 6 19:25:03 2013 +0200 + + Doxygen: Properly document and handle version.h. + +commit ca0938c50b4bf5d010d6140f64542f8307d8ea17 +Author: Uwe Hermann +Date: Sat Apr 6 19:18:37 2013 +0200 + + Doxygen: Fix a few warnings. + +commit 7b78b2f78fbd8309fd9898c4940b82328a2c39af +Author: Bert Vermeulen +Date: Tue Apr 2 14:18:59 2013 +0200 + + hantek-dso: use per-device firmware filenames + +commit 3ebce226a2672ea4f0788f5f2a222586148aabc1 +Author: Uwe Hermann +Date: Sun Mar 17 16:50:51 2013 +0100 + + s/sr_config_make/sr_config_new/. + + This matches the naming of other/similar functions better. + +commit 333bf022e3ab268fb575ec61ccf0c0f17213647c +Author: Uwe Hermann +Date: Tue Mar 12 21:40:03 2013 +0100 + + rigol-ds1xx2: Use ARRAY_SIZE. + +commit 3864648bb6ebf24106898a1296bc106daa55e964 +Author: Alexandru Gagniuc +Date: Wed Mar 20 20:36:56 2013 -0500 + + serial-dmm: Add support for RadioShack 22-805 + + Protocol-wise, this is identical to the 22-168, except that it communicates at + 600 baud instead of 1200 baud. + +commit 5a7587cd03d81e84a8e4538a1ec9ab36f3a077c2 +Author: Bert Vermeulen +Date: Tue Mar 19 22:07:21 2013 +0100 + + set proper build defaults for brymen-dmm and mic-985xx drivers + +commit cc840ab618ede3d642a1f8d07c353ba91b96e22c +Author: Uwe Hermann +Date: Sun Mar 17 15:07:50 2013 +0100 + + serial.c: FreeBSD and OpenBSD don't have OFILL either. + +commit 22ca5aa68b55ffc9f33c6fe0138c460b0b2f8f94 +Author: Uwe Hermann +Date: Sun Mar 17 13:22:22 2013 +0100 + + configure.ac: Add 'color-tests' (colorized 'make check'). + +commit 57981a0716a5d9bec807cad8289d091893de0919 +Author: Uwe Hermann +Date: Sun Mar 17 13:19:57 2013 +0100 + + configure.ac: Drop std-options, unneeded. + + The automake 'std-options' option checks whether all installed tools + and scripts have a --help and --version CLI option. This check is not + needed for libsigrok though, since it doesn't install any tools. + +commit 9d67e248cab789314d758e5ee20a7b47eef69fe5 +Author: Uwe Hermann +Date: Sun Mar 17 13:07:59 2013 +0100 + + Don't make README.devices executable. + +commit ba642e8678906a27015755f8ca04ca7f73195036 +Author: Uwe Hermann +Date: Sun Mar 17 12:53:08 2013 +0100 + + README: Refer to INSTALL and new Building wiki page. + +commit 898c562fd3b33b07d030ea7f57eb09cd49efe69b +Author: Uwe Hermann +Date: Sun Mar 17 12:58:26 2013 +0100 + + autotools: Don't use "foreign" option. + + This adds INSTALL and allows for a few more sanity checks being done. + +commit 8e77bc20b92574076683d861687b63b416d3e965 +Author: Bert Vermeulen +Date: Sat Mar 16 21:50:35 2013 +0100 + + lascar-el-usb: push samplerate before data log + +commit 7231a14590840ffdbb77c1cc076d7dcafa3ee673 +Author: Bert Vermeulen +Date: Sat Mar 16 20:17:41 2013 +0100 + + add SR_CONF_SAMPLE_INTERVAL + + Expresses the time between samples, in milliseconds. This can be used + for devices with a samplerate > 1 second, such as dataloggers, which + cannot be expressed with SR_CONF_SAMPLERATE. + +commit c77ed446f2c08e2906883023c85feafa19a0ec10 +Author: Uwe Hermann +Date: Wed Mar 13 10:33:17 2013 +0100 + + Add initial README.devices file. + +commit bb203cde9d42df0430e64cb5d2b604c9d68b5639 +Author: Uwe Hermann +Date: Tue Mar 12 23:00:58 2013 +0100 + + configure.ac: Add missing AM_PROG_CC_C_O. + +commit 361d15110ce355dd69099d95ac8c9716e45b3173 +Author: Bert Vermeulen +Date: Mon Mar 11 16:36:40 2013 +0100 + + lascar-el-usb: support for SR_CONF_DATALOG + +commit e6551ea640f113a9f7cd6bfaaf3a8d0689c71edf +Author: Bert Vermeulen +Date: Mon Mar 11 16:35:18 2013 +0100 + + add SR_CONF_DATALOG + +commit 985727626183bf1517a9046f4eb40c732e566b8f +Author: Bert Vermeulen +Date: Mon Mar 11 15:28:41 2013 +0100 + + ols: use ptr to int dereference for SR_T_BOOL + + This mad ptr to int casting has to go. + +commit 218e629fa48e2efb970b018d8d2ff8ccfa2d9a2c +Author: Uwe Hermann +Date: Sun Mar 10 17:13:15 2013 +0100 + + sr_init(): Sanity-check input/output modules. + +commit 0b4b41eed84be29e21b0e65c8072b546b4fdd37e +Author: Uwe Hermann +Date: Sat Mar 9 12:20:17 2013 +0100 + + Add missing ULL suffixes to SR_MHZ() et al. + + This fixes bug #72. + +commit 79bb0e97d53526ef6deb491ea9c7698ed6e90631 +Author: Uwe Hermann +Date: Thu Mar 7 09:37:42 2013 +0100 + + Add a testsuite for libsigrok. + + This adds a suite of unit tests for libsigrok. It uses the 'Check' + tool/library (apt-get install check) to run the tests. + + The configure tool tries to find libcheck. If it succeeds, a + "make check" will run all tests. Otherwise, none of the tests will + be built and "make check" will not run any tests. + + This also means that users who don't have 'check' installed will still + be able to build and install libsigrok just fine. + +commit d5585e32dd856b09d78acab2aac3ba6c78ad7752 +Author: Bert Vermeulen +Date: Wed Mar 6 23:14:00 2013 +0100 + + output/vcd: use new API + +commit 2474d87e8c9b1133017a06c9ef0896626267e95b +Author: Bert Vermeulen +Date: Sun Mar 3 21:17:48 2013 +0100 + + demo: sync get/set options + +commit a819da9c258bd1f295604e4078c84ca0bab2de04 +Author: Uwe Hermann +Date: Sun Mar 3 18:02:24 2013 +0100 + + Drop deprecated sr_session_halt(). + + This has been deprecated in favor of sr_session_stop() since a while. + + None of the current frontends use sr_session_halt() anymore, neither + does libsigrok. + +commit 365f04d61f54908013021be83450d38fff67964f +Author: lelazary +Date: Tue Jan 8 08:27:52 2013 -0800 + + mso-19: Initial analog probe support (unfinished). + + - Added the analog probe (unfinished). + + - Reset trigger to state to 0 before capture, just incase the scope is in + the middle of a capture. + +commit 5952553f569f82b878717b9d97053690014604c9 +Author: lelazary +Date: Tue Jan 8 08:00:57 2013 -0800 + + mso-19: Fixed warning. + +commit 07e1aad5c4d53ee1028613312061f261f1a7800a +Author: Uwe Hermann +Date: Fri Feb 22 15:12:32 2013 +0100 + + doxygen: Add more output format docs. + + This is largely taken from the respective wiki page (with some updates + and improvements), which will be removed in favor of the doxygen docs. + +commit 8368734386f3bce5c568258b830c002d2581dfc6 +Author: Uwe Hermann +Date: Thu Feb 21 21:27:27 2013 +0100 + + doxygen: Add more input format docs. + + This is largely taken from the respective wiki page (with some updates + and improvements), which will be removed in favor of the doxygen docs. + +commit 1d36b4d27f737dfcd6e232bc9d9538bd64bf1afb +Author: Bert Vermeulen +Date: Thu Feb 21 15:20:50 2013 +0100 + + input: new WAV file module + +commit 543d45c581658851b41af42ebdbc476ccf3d88d3 +Author: Bert Vermeulen +Date: Thu Feb 21 14:48:43 2013 +0100 + + input: feed the filename to the module's init() function + + This is essential if a format contains e.g. the number of probes; the + init() function needs to initialize the sr_dev_inst struct, but needs + access to the file to properly add the probes to it. + +commit ff17e6ba5094d590926a2aa8130220a341fc2c04 +Author: Uwe Hermann +Date: Mon Feb 11 18:23:17 2013 +0100 + + mic985xx: Add missing memset(). + +commit 6f3e5335adc5ba4488c5f7dcb791f929c20f2049 +Author: Uwe Hermann +Date: Sat Feb 9 16:13:03 2013 +0100 + + mic-985xx: Add support for the MIC 98581. + + This device only supports temperature measurements, no humidity. + +commit be6db330f86707c5eadf2a3f20903860dbadaabf +Author: Bert Vermeulen +Date: Sun Feb 10 17:06:38 2013 +0100 + + hantek-dso: minor fixes + +commit 8421ffa44dc9b0ca89c554c40be39dcc151e7495 +Author: Bert Vermeulen +Date: Sun Feb 10 16:49:23 2013 +0100 + + asix-sigma: don't try to free static storage + +commit d5a669a9e0319531595a8a45b6c21f0c316a24f1 +Author: Bert Vermeulen +Date: Mon Feb 4 13:36:23 2013 +0100 + + properly deal with decimals + +commit cd2f0fe22c35dcf3b010411ff6f123701be2a2d6 +Author: Uwe Hermann +Date: Fri Feb 1 23:45:32 2013 +0100 + + Add/use std_hw_dev_acquisition_stop_serial(). + +commit 17548571cc836edaf45e4707e74f6537605fc924 +Author: Uwe Hermann +Date: Fri Feb 8 23:13:33 2013 +0100 + + zeroplus: Only report supported samplerates. + + The currently supported model LAP-C(16032) doesn't support the + samplerates 150MHz and 200MHz which some of the other models have. + + Thus, do not report these samplerates to the frontends. E.g. sigrok-cli + should not show them via --show and GUIs should not list them in their + "Samplerates" drop-down. + +commit e495a676ebda71cdcc39904ee28174ccba7ce2ae +Author: Uwe Hermann +Date: Fri Feb 8 22:18:55 2013 +0100 + + zeroplus: Cosmetics, small fixes, drop unneeded stuff. + +commit 58c5f2ed1785ead87d1398c28b5dbe60ba4610dd +Author: Uwe Hermann +Date: Thu Feb 7 22:09:39 2013 +0100 + + zeroplus: Split into api.c and protocol.c. + +commit c7142604a2d29ca58f6e4d7cba070a329030e60b +Author: Uwe Hermann +Date: Thu Feb 7 09:16:28 2013 +0100 + + session.c: Drop left-over 'session: ' prefix. + + This is added automatically now. + +commit 3e9b7f9c776221c2c6b0d9f51b48db31383a4b03 +Author: Uwe Hermann +Date: Thu Feb 7 09:11:26 2013 +0100 + + Rename session_dev_id to cb_data everywhere. + + We use 'cb_data' in all drivers these days, make the few remaining ones + that use 'session_dev_id' consistent. + +commit 6fab7b8f5365c7be69be4a755910945b6113dd8f +Author: Uwe Hermann +Date: Wed Feb 6 22:35:24 2013 +0100 + + Driver struct cleanups. + + - Explicitly list .config_get in all drivers for consistency, and set it + to NULL if unused (whether or not a driver implements it is optional). + + - List all 'struct sr_dev_driver' entries in the same order in all drivers. + + - Move the check whether .config_set/.config_list exist (i.e., are non-NULL) + into sanity_check_all_drivers(). + +commit 4afdfd4628e9955af02a3ea619ecdfe469f9a9e2 +Author: Uwe Hermann +Date: Wed Feb 6 19:57:32 2013 +0100 + + Add and use std_session_send_df_header(). + + This is a small helper function which sends the SR_DF_HEADER packet that + drivers usually emit in their hw_dev_acquisition_start() API callback. + It simplifies and shortens the hw_dev_acquisition_start() functions + quite a bit. + + It also simplifies the input modules which send an SR_DF_HEADER packet, too. + + This patch also automatically removes some unneeded malloc/free in some + drivers for the 'packet' and 'header' structs used for SR_DF_HEADER. + +commit 961009b0c4002717c669a0cdcafb0fcf29f5ea1b +Author: Uwe Hermann +Date: Fri Feb 1 22:58:54 2013 +0100 + + hw_dev_close(): Move common checks to wrapper. + + Check the relevant arguments for != NULL before calling the actual + driver-specific function, so that the driver can safely assume those + arguments are non-NULL. This removes the need to duplicate these + checks in every driver. + +commit 0e94d524c19fe89c564243421d37c17818f87631 +Author: Uwe Hermann +Date: Sat Feb 2 19:52:26 2013 +0100 + + Shorten/simplify hw_dev_list() implementations. + +commit 7c8a9e1e0fada5d726bce638cf4d36147ed4ebbf +Author: Uwe Hermann +Date: Sat Feb 2 12:22:18 2013 +0100 + + serial-dmm: Drop unneeded g_try_malloc0(). + +commit bf6f8399fc3515c0e3827a17b2fc21f4a9211a0f +Author: Uwe Hermann +Date: Sat Feb 2 12:14:26 2013 +0100 + + Make 'struct rs9lcd_info' non-empty. + + Empty structs can be an issue (compiler-dependent), so add a dummy entry + for this one. + +commit c5d6f5cc1c0069a5141c5c76f7e17dd592427138 +Author: Uwe Hermann +Date: Sat Feb 2 11:35:20 2013 +0100 + + brymen-dmm: Cosmetics, coding-style, consistency. + + Also, name the driver "brymen-bm857" in preparation to doing "subdrivers" + for other Brymen models later (similar to serial-dmm). + +commit 943e94f567a386e3cf754cfe7f4e15893622a95d +Author: Uwe Hermann +Date: Sat Feb 2 11:19:03 2013 +0100 + + brymen-dmm: Use std_hw_init(). + +commit 601fb67cc4977d7e04e20916bde52147b35df970 +Author: Alexandru Gagniuc +Date: Mon Nov 26 17:09:05 2012 -0600 + + brymen-dmm: Add support for Brymen BM857 + + This patch might also work for a number of other Brymen models + -- 859(a), 867, 869--- + including their respective rebadges from Greenlee, Extech, and Amprobe. + + Signed-off-by: Alexandru Gagniuc + +commit 20cbc7854dc0a375e23fea2ca7e7feee3d3ac701 +Author: Alexandru Gagniuc +Date: Wed Nov 21 21:20:39 2012 -0600 + + brymen-dmm: Initial driver skeleton. + +commit 0cd8e23140612703406a57316bb0a507fb8f1994 +Author: Uwe Hermann +Date: Wed Jan 30 18:21:07 2013 +0100 + + Initial driver implementation for MIC 98583. + + This is a USB/serial (Prolific) based temperature and humidity logger. + +commit 7ec5b54955118d8c1ee003a02c3334f1a0046457 +Author: Uwe Hermann +Date: Wed Jan 30 16:58:01 2013 +0100 + + mic-985xx: Initial driver skeleton. + +commit 6d1161142dfce461c8e54c09d821443c68916df8 +Author: Uwe Hermann +Date: Mon Jan 28 17:43:04 2013 +0100 + + zeroplus: Use message logging helpers. + +commit c4227fc637431113ba92092ddbda86461703c06c +Author: Uwe Hermann +Date: Tue Jan 29 12:55:00 2013 +0100 + + device: Cosmetics. + +commit d3b38ad389a6186e2822d62b20b9f0d9d9e7c21c +Author: Uwe Hermann +Date: Tue Jan 29 12:55:00 2013 +0100 + + Drivers: Explicitly list sr_samplerates fields. + + This makes it a bit easier to understand which value means what, just + from looking at the driver code. + +commit 063e7aef6d41d4c44591ff93672079998bf9622f +Author: Uwe Hermann +Date: Tue Jan 29 12:55:00 2013 +0100 + + Factor out common hw_init() driver code. + + Most drivers do pretty much the same things in their hw_init() + right now, so factor out that code to std_hw_init() in std.c. + +commit 4b97c74e0b5c19ad0ee04620b618461248ab69d7 +Author: Uwe Hermann +Date: Mon Jan 28 20:00:54 2013 +0100 + + sr_driver_scan(): Improve checks. + + Check the relevant arguments for != NULL before calling the actual + driver-specific function, so that the driver can safely assume those + arguments are non-NULL. This removes the need to duplicate these + checks in every driver. + + Also, do some minor whitespace and consistency improvements. + +commit c0eea11c4535e071c72b357fa7e2d1288104c134 +Author: Uwe Hermann +Date: Mon Jan 28 19:36:16 2013 +0100 + + sr_driver_init(): Improve checks. + + Check the relevant arguments for != NULL before calling the actual + driver-specific function, so that the driver can safely assume those + arguments are non-NULL. This removes the need to duplicate these + checks in every driver. + + Also, change one SR_ERR to the more correct SR_ERR_MALLOC, and assign + sr_ctx in the rigol-ds1xx2's hw_init() function, like all the other + drivers do. + +commit bd36d826d4b9916034c6268919e2a72a0d7ea000 +Author: Uwe Hermann +Date: Tue Jan 29 12:55:00 2013 +0100 + + hwdriver: Use message logging helpers. + +commit a421dc1d7b24bb7b8f2127b6c07df6b68eb5001f +Author: Uwe Hermann +Date: Tue Jan 29 12:55:00 2013 +0100 + + session: Use message logging helpers. + +commit cbc6f3b25331bc4acca1eff9a5e60786e2efd2f8 +Author: Uwe Hermann +Date: Tue Jan 29 12:05:00 2013 +0100 + + hantek-dso: Use message logging helpers. + +commit 140185af6c2b73a2b940012269f893962cbecd52 +Author: Joel Holdsworth +Date: Mon Jan 28 20:28:03 2013 +0000 + + Check sr_config_set value argument is not NULL + +commit 4c961f5ed5e127aae75e48cd4369dc25439f24d4 +Author: Joel Holdsworth +Date: Mon Jan 28 20:26:37 2013 +0000 + + Made sr_config_list driver argument a const pointer + +commit 9fd504b9eb37502b4cd2d5d105f9f24ad1b5adf9 +Author: Joel Holdsworth +Date: Mon Jan 28 20:25:56 2013 +0000 + + Made sr_config_get driver argument a const pointer + +commit 7d4abe5a77b39c11b2187e1768339fcd11b0b763 +Author: Uwe Hermann +Date: Sun Jan 27 01:23:01 2013 +0100 + + serial.c: NetBSD doesn't have OFILL. + +commit cbadb856d6d833f2822cf63e4884abb409da6172 +Author: Bert Vermeulen +Date: Sat Jan 26 01:18:19 2013 +0100 + + Code cleanup. + +commit 41bad9283d5bf869cfdf3d54373bec4dc51eaf16 +Author: Bert Vermeulen +Date: Fri Jan 25 20:41:49 2013 +0100 + + Remove sr_driver_hwcap_exists(). + +commit 4d15e5c9077a543a452a976933286c705c2e7088 +Author: Bert Vermeulen +Date: Fri Jan 25 16:20:40 2013 +0100 + + Rename sr_dev_has_hwcap() to sr_dev_has_option(). + +commit 6a4710fac267c07cc146b2a3cd23204b08bea552 +Author: Bert Vermeulen +Date: Fri Jan 25 16:05:48 2013 +0100 + + drivers: Trim unused config_get() calls + + None of the driver config_get/set/list calls are required. + +commit ddd9b41f5af2c5f1719439546a378d91ceef6c30 +Author: Bert Vermeulen +Date: Fri Jan 25 15:48:44 2013 +0100 + + Rename sr_info_get() to sr_config_get(). + +commit 358d050d7a2a1729d8200eaa8ffc16318e47958b +Author: Bert Vermeulen +Date: Fri Jan 25 15:38:57 2013 +0100 + + Rename sr_dev_config_set() to sr_config_set() + +commit aeba33ba219c4944b880be0b0687b7798b152ab0 +Author: Bert Vermeulen +Date: Fri Jan 25 15:16:39 2013 +0100 + + Header cleanup. + +commit 0d485e30c607b22b5f328512327e4e0fafc6cbb7 +Author: Bert Vermeulen +Date: Fri Jan 25 15:09:20 2013 +0100 + + Deprecate SR_DI_HWOPTS. + + This is replaced by SR_CONF_SCAN_OPTIONS. + +commit 9a6517d14b1248855cde0d88ec9519f99184cc77 +Author: Bert Vermeulen +Date: Fri Jan 25 15:01:49 2013 +0100 + + Deprecate SR_DI_HWCAPS. + + This is replaced by SR_CONF_DEVICE_OPTIONS. + +commit c50277a6ec09fb35de3a6e0f2ae3401bc72a1526 +Author: Bert Vermeulen +Date: Fri Jan 25 11:52:27 2013 +0100 + + Deprecate SR_DI_TRIGGER_TYPES. + + This is replaced by SR_CONF_TRIGGER_TYPE. + +commit 328bafabd4781e416e3d711dabd8c4c43f219794 +Author: Bert Vermeulen +Date: Fri Jan 25 11:25:32 2013 +0100 + + Deprecate SR_DI_TRIGGER_SOURCES. + + This is replaced by SR_CONF_TRIGGER_SOURCE. + +commit 41f5bd09b0d3c5f9232ff20d076f76cc41acad32 +Author: Bert Vermeulen +Date: Fri Jan 25 11:22:20 2013 +0100 + + Deprecate SR_DI_TIMEBASES. + + This is replaced by SR_CONF_TIMEBASE. + +commit 6e1fbcc41b9d5e627faa704a31ca150715b09861 +Author: Bert Vermeulen +Date: Fri Jan 25 11:19:12 2013 +0100 + + Deprecate SR_DI_FILTERS. + + This is replaced by SR_CONF_FILTER. + +commit e4f2b2adc17bf0ab6dfa38b7511caf5a5dcfa7fd +Author: Bert Vermeulen +Date: Fri Jan 25 11:13:49 2013 +0100 + + Deprecate SR_DI_VDIVS. + + This is replaced by SR_CONF_VDIV. + +commit 2a7b113d1382aef08d63778042589177c9b04347 +Author: Bert Vermeulen +Date: Fri Jan 25 11:04:27 2013 +0100 + + Deprecate SR_DI_COUPLING. + + This is replaced by SR_CONF_COUPLING. + +commit 6d1ceffa9557bf5cd0315949de5791e76e18bdc4 +Author: Bert Vermeulen +Date: Fri Jan 25 10:58:37 2013 +0100 + + Deprecate SR_DI_BUFFERSIZES. + + This is replaced by SR_CONF_BUFFERSIZE. + +commit dd96ea98793ed089f1b0a7dd31f417774f14ad80 +Author: Bert Vermeulen +Date: Fri Jan 25 03:38:44 2013 +0100 + + Deprecate SR_DI_PATTERNS. + + This is replaced by SR_CONF_PATTERN_MODE. + +commit 123e13138385055003cb6bc09e74df783df5af85 +Author: Bert Vermeulen +Date: Fri Jan 25 03:17:36 2013 +0100 + + Deprecate SR_DI_CUR_SAMPLERATE. + + This is replaced by SR_CONF_SAMPLERATE. + +commit fbec8bd2f3ead02358df65240c2cf786c8267f54 +Author: Bert Vermeulen +Date: Fri Jan 25 02:39:58 2013 +0100 + + deprecate SR_DI_SAMPLERATES + + This is replaced by a call to config_list() with id SR_CONF_SAMPLERATE. + +commit a1c743fc51d7b49c769fb525fe4b89985a9468c9 +Author: Bert Vermeulen +Date: Fri Jan 25 02:32:05 2013 +0100 + + drivers: implement config_list() + +commit c5fb502f9773ecf6df83a32ab82bcd1b70fa857f +Author: Bert Vermeulen +Date: Fri Jan 25 01:24:42 2013 +0100 + + New driver API function: config_list() + + This takes an sr_config key and returns a list of possible values for + that key to be submitted with config_set(). The format of the list and + its contents is dependent on the key. + + This will replace the SR_DI_* keys that returned such a list before, + such as SR_DI_SAMPLERATES. + +commit 035a1078fda93cf1da37d19b3a1d95311b99b00f +Author: Bert Vermeulen +Date: Thu Jan 24 19:19:09 2013 +0100 + + drivers: rename and reorganize config get/set + + The driver API calls info_get() and dev_config_set() have been renamed + to config_get() and config_set(), respectively. + +commit 69e19dd7691f86ac001469d1b319e1358e0d9778 +Author: Bert Vermeulen +Date: Wed Jan 23 03:40:44 2013 +0100 + + Always interleave analog data with all enabled probes. + + The new "probes" field in sr_datafeed_analog contains a copy + of all enabled struct sr_probe. + +commit b1a051544d502f15a1da05682e625755563b86c2 +Author: Bert Vermeulen +Date: Wed Jan 23 02:32:58 2013 +0100 + + serial: more serial processing flags to turn off + +commit 08a9260ba4413bbdee0bfcc8a9c4544500fdb241 +Author: Bert Vermeulen +Date: Tue Jan 22 11:18:18 2013 +0100 + + Header cleanup: remove unused structs. + +commit 431ec7ca4abc85810c2553646e6b6af13138b65e +Author: Bert Vermeulen +Date: Mon Jan 21 23:40:09 2013 +0100 + + uni-t-dmm: use new sr_config struct + +commit 1953564a96798bc298d1c94eb90c129adbde1c9e +Author: Bert Vermeulen +Date: Mon Jan 21 23:22:47 2013 +0100 + + Rename SR_HWOPT_* and SR_HWCAP_* to SR_CONF_* + +commit c89c1c9c211a197f24de7bfd32ecbc873dd66818 +Author: Bert Vermeulen +Date: Mon Jan 21 21:58:19 2013 +0100 + + Unify all SR_HWOPT_* and SR_HWCAP_* enums. + + Only two functions remain for accessing meta info on the keys: + sr_config_info_get() and sr_config_info_name_get(). + +commit 63b9e16e7e1564acd8bac9956bd65a4999ae0581 +Author: Bert Vermeulen +Date: Sun Jan 20 16:38:28 2013 +0100 + + No need to send a metapacket when loading a sigrok file. + +commit c71bac3b98ace917533db91e682712105c3ccf45 +Author: Bert Vermeulen +Date: Sun Jan 20 16:37:23 2013 +0100 + + Adjust session debugging to the new SR_DF_META packets. + +commit fbf394c61766e51627033b4e95c8f9ae034c7dc1 +Author: Bert Vermeulen +Date: Sun Jan 20 16:36:35 2013 +0100 + + Deprecate SR_HWOPT_MODEL + + This was only ever used for the defunct genericdmm driver. + +commit 083d64f94f6c619ca427c2544b2c08b2929a8051 +Author: Bert Vermeulen +Date: Sun Jan 20 16:35:25 2013 +0100 + + Use new struct sr_config_info for option metadata + +commit 4c0e310ca305ba776aa70d8062f467ac246c910b +Author: Bert Vermeulen +Date: Sun Jan 20 16:34:38 2013 +0100 + + Add small helper for creating struct sr_config + +commit 72e435ab94ac8838626da034ccbcfa9424add8ef +Author: Bert Vermeulen +Date: Sun Jan 20 16:33:24 2013 +0100 + + Adjust option helpers to new sr_config struct + +commit 2df1e81970b38bd4edb6e219ad295c8a83315797 +Author: Bert Vermeulen +Date: Sun Jan 20 15:45:09 2013 +0100 + + Use new SR_DF_META packet. + + Since input modules determine a samplerate by reading from their + file format (or having it overridden with an option), they need + to pass this up to the frontend. + +commit d8e3685c47088c3219c004885d1be3c34c6503a6 +Author: Bert Vermeulen +Date: Sat Jan 19 13:20:34 2013 +0100 + + free USB config descriptor after use + +commit 1987b8d63e748f0813dc6a4630e99686e4fe1728 +Author: Bert Vermeulen +Date: Sun Jan 6 17:41:30 2013 +0100 + + drivers: use new sr_config struct + + Sending an SR_DF_META packet at the start of every stream is not + mandatory; the frontend should ask for what it needs, and any extra + information the driver wants to send will come in due time. + +commit 9a5693a5acf677c47285307235b9d47bcc3b932e +Author: Bert Vermeulen +Date: Sun Jan 6 16:37:41 2013 +0100 + + unify sr_datafeed_meta_* into one struct containing sr_config + + struct sr_config is the new name for sr_hwopt. Its companion meta + struct, sr_hwcap_option, was renamed sr_config_info. + +commit 86c02e6554061bf84b5fb7893e5837d26534a6d8 +Author: Uwe Hermann +Date: Mon Jan 21 01:47:30 2013 +0100 + + serial.c: Fix copy-paste error. + + Thanks Bert Vermeulen for reporting. + +commit 9d8fde40c3cc852e2d0b2d337609b247310ce277 +Author: Uwe Hermann +Date: Mon Jan 21 01:45:02 2013 +0100 + + uni-t-dmm: Quickfix for UNI-T UT61D. + + This is a temporary fix only, since a major rework of uni-t-dmm is being + done at the moment, soon to be merged. + +commit 5edc02c77c3576a47ee85241f32785cdf0fdddf8 +Author: Uwe Hermann +Date: Sat Jan 19 22:00:39 2013 +0100 + + Add missing "ULL" suffixes. + + These numbers are larger than 32bit, mark them as ULL to avoid compile + failures on 32bit systems. + +commit 73365eaed046b2242a3080cfd282edfa266b1d2f +Author: Uwe Hermann +Date: Sun Jan 20 19:57:04 2013 +0100 + + uni-t-dmm: Expose hwopts. + +commit 388f9d3e25da89df1fb01412688339b6de54e14e +Author: Uwe Hermann +Date: Sun Jan 20 19:55:33 2013 +0100 + + uni-t-dmm: Fix scanning, properly use new sr_usb_find(). + +commit 4ebd48b352a28add68d54d509b291688e1df601b +Author: Uwe Hermann +Date: Sun Jan 20 18:48:02 2013 +0100 + + Remove non-error hw_info_get() messages. + + Currently hw_info_get() can receive requests for entries (info_id) that + the specific driver doesn't support. That is (right now) a valid + use-case and not an error (might change later, though). + + Thus, for now, don't output messages for such requests at all (certainly + not as sr_err() where they show up in e.g. sigrok-cli output per default). + +commit a978eda2c958967518508e4cc461e960e96a0170 +Author: Uwe Hermann +Date: Sun Jan 20 18:47:35 2013 +0100 + + udev: Add UNI-T UT-D04 multimeter cable entry. + +commit 7d39e2105f6da82f4f90a87d081c1bf5cc30968d +Author: Uwe Hermann +Date: Sat Jan 19 21:20:56 2013 +0100 + + configure.ac: Drop AC_PROG_CXX. + + We don't need a C++ compiler for libsigrok, so don't check for one. + + This would cause a build failure on all systems where there is a C compiler + but no C++ compiler installed. + +commit 294245ecf280ce72bffa40586d68195aa5980b6d +Author: Uwe Hermann +Date: Sat Jan 19 19:13:52 2013 +0100 + + README: Document alsa (optional) library. + +commit b97cbca6c9c715619c8a5a9d6f5de267ff061175 +Author: Uwe Hermann +Date: Sat Jan 19 15:55:22 2013 +0100 + + serial.c: OpenBSD doesn't have B460800. + +commit 262dd3e47da1af2233ffd659cda81769f53b4012 +Author: Uwe Hermann +Date: Wed Jan 16 01:31:46 2013 +0100 + + configure.ac: Drop gthread check, no longer used. + + We no longer use gthread (its only user was the 'demo' driver), so drop + the 'configure' check for it. + + The libsigrok.pc pkg-config file is still correct, since the 'configure' + result propagates there automatically. + +commit 3d6de074a445fbd3ac0adfa2bc28e3fd283df681 +Author: Uwe Hermann +Date: Wed Jan 16 00:02:24 2013 +0100 + + alsa: Silence ALSA scanning process. + + Errors while opening or configuring ALSA devices during scan for devices + should not be shown by default (i.e., no sr_err() usage). Non-working + or non-accessible devices (due to permissions or other reasons) will + simply not show up in frontends. Use sr_dbg() instead of sr_err(). + +commit 6b8d6f93bb8df26ea04624009e2715cb6766b4f5 +Author: Bert Vermeulen +Date: Tue Jan 15 17:20:57 2013 +0100 + + Get rid of obsolete SR_DI_NUM_PROBES and SR_DI_PROBE_NAMES. + + Frontends should use the probe list in the device's sr_dev_inst + to get this information. + +commit bd58d8f3ece91443d5e98a7e99fd740767ed6222 +Author: Uwe Hermann +Date: Mon Jan 14 11:13:58 2013 +0100 + + Makefile.am: Fix typo in 'ChangeLog' target. + +commit 8a22e8c0ff4e43ceae154c908c75a3e06bf26cc6 +Author: Bert Vermeulen +Date: Mon Jan 14 00:59:46 2013 +0100 + + cosmetics + +commit dbf2482ec11affee1a6137be1544cc5463359174 +Author: Bert Vermeulen +Date: Mon Jan 14 00:52:55 2013 +0100 + + add --disable-all-drivers option + + Can be overridden by driver --enable options to build only those drivers. + +commit 512bb890df8363e800025b3b63ebac429c139aa0 +Author: Bert Vermeulen +Date: Sun Jan 13 22:42:21 2013 +0100 + + rigol-ds1xx2: More selective Rigol DS1xx2 scan + + Patch submitted by Martin Ling. + +commit 5635705c8330d243ec566e15373eb47eb5b0fd9c +Author: Bert Vermeulen +Date: Sun Jan 13 18:07:05 2013 +0100 + + cleanup of obsolete definition + +commit 18bc270461d656460db8a167c10d390fe665f3b9 +Author: Bert Vermeulen +Date: Tue Jan 8 02:51:03 2013 +0100 + + sr_session_save(): don't use datastore + +commit 6936ee4206817dbf07fdb8524172bdb46d21c5c0 +Author: Bert Vermeulen +Date: Mon Jan 7 02:10:33 2013 +0100 + + remove datastore functionality + + Keeping a copy of acquired data is up to the frontend, not libsigrok. + +commit 305de92e9d50bcabaa055d43dc27fec1c2e97cc1 +Author: Bert Vermeulen +Date: Mon Jan 7 01:52:02 2013 +0100 + + use a dynamically expanding probe list + +commit cbc80f8f8afe28ff825449deffcc5aca7b51d7b8 +Author: Alexandru Gagniuc +Date: Sun Jan 6 09:31:30 2013 -0600 + + fx2lafw: Say if chip is old FX2 or FX2LP + + Look at the extracted REVID, and print out if it is an FX2 (non-LP), or FX2LP. + + Signed-off-by: Alexandru Gagniuc + +commit a24e9d0484c09f972dcb31952a1ab1559bbcdedb +Author: Uwe Hermann +Date: Tue Jan 8 03:12:01 2013 +0100 + + link-mso19: Use more portable g_htons(). + + Not all systems provide and/or htons(). Use portable and + always available g_htons() from glib instead. + +commit 753d722f340465f5bebb175c378b579296ebbd54 +Author: Uwe Hermann +Date: Tue Jan 8 03:02:53 2013 +0100 + + link-mso19: Fix a bunch of compiler warnings. + +commit 00b44ccb8b2482c2c4c7e832ed11f7460f289e15 +Author: Uwe Hermann +Date: Tue Jan 8 02:48:49 2013 +0100 + + link-mso19: Fix white-space, cosmetics, coding-style. + + Fix the bare minumum of whitespace/indentation/coding-style via + automatic 'indent' run, followed by some minor manual fixes. + Some more fixes and cleanups might follow later. + +commit f48cef7897ecda093a7d8b37b2bfeb1868c529af +Author: Uwe Hermann +Date: Tue Jan 8 02:30:40 2013 +0100 + + link-mso19: Fix (C) lines. + + Bring back the original (C) lines from before the split into api.c + and protocol.[ch]. + + Add "Copyright (C) 2013 Lior Elazary " since there + were nontrivial changes to those files. + +commit 8472ae868ec05533bb00b368b4c5140e24c0409b +Author: Uwe Hermann +Date: Tue Jan 8 01:27:11 2013 +0100 + + configure.ac: Enable Link Instruments MSO-19. + + This driver now compiles again and (partially) seems to work, so enable it. + +commit eb913174ab1fa7decaab3dd64eec0a0a42a2391a +Author: lelazary +Date: Mon Jan 7 07:49:31 2013 -0800 + + Added limit samples Eveything seems to work find up to 1024 samples + +commit 087a9161fffa0cabe8aa37cf3358d88bcd72fb21 +Author: lelazary +Date: Sun Jan 6 09:46:01 2013 -0800 + + Rewrote the trigger config. Added trigger position and trigger slope + +commit 5a24e89ca463ba7acb465f4bc9953e2da9c09e45 +Author: lelazary +Date: Sat Jan 5 18:12:45 2013 -0800 + + Eveything seems to work now except for triggers. + +commit 4db2aaffe7b47b15e6ad7e4e11281d62bbd598c8 +Author: lelazary +Date: Sat Jan 5 09:29:00 2013 -0800 + + More cleanup. Communication with mso19 is working, but its not triggering. Need to check why. + +commit 26ddb5bacaf2a0918ef73b253d25afb1ffb744b1 +Author: lelazary +Date: Sat Jan 5 09:00:52 2013 -0800 + + Added flow control to serial configuration to support xon/xoff for link-mso19 + +commit 4b719338ccf3add3f872e8cd7549bddf818c4360 +Author: lelazary +Date: Fri Jan 4 17:22:15 2013 -0800 + + Added missing mso functions + +commit def5c35c4c4a4f62ffc8800a1e2d7154e8fc4bd3 +Author: lelazary +Date: Fri Jan 4 17:05:17 2013 -0800 + + Removing the old link-mso19 files and changing makefile + +commit df92e5cf6b1caad0d1d43eb890d84af1ef79cd18 +Author: lelazary +Date: Fri Jan 4 17:03:20 2013 -0800 + + Rewrote the link-mso19.c into api and protocol. Still need to test and cleanup some more + +commit 26e6ef346d0d188932f6774d52134d8d48e38ab4 +Author: Uwe Hermann +Date: Thu Jan 3 19:17:51 2013 +0100 + + Add gnuplot_rigol_ds1xx2.gpi gnuplot script. + + This is a very simple gnuplot script for testing the Rigol DS1xx2 driver. + It currently has various issues and limitations (e.g. only one channel + is displayed, the scaling is not usable, and so on) to be fixed later. + +commit 29d957ceae3bd9ac5b72cd0e58a5910932bd1768 +Author: Uwe Hermann +Date: Thu Jan 3 19:04:11 2013 +0100 + + rigol-ds1xx2: Cosmetics, whitespace. + +commit fb6e5ba8c7da4cc16eda03e3ffd0a97780655442 +Author: Martin Ling +Date: Sun Dec 30 15:29:00 2012 +0100 + + rigol-ds1xx2: Autoprobe for usbtmc devices on Linux. + +commit 4e108ace13f2dc577e2855e44dfc685b9cfd6204 +Author: Martin Ling +Date: Sun Dec 30 14:17:08 2012 +0100 + + rigol-ds1xx2: Fix setting trigger parameters. + +commit 542843f76f4b2f780bf9ae6265f1a76841297d8a +Author: Martin Ling +Date: Sun Dec 30 14:06:58 2012 +0100 + + rigol-ds1xx2: Assorted parameter setting fixes. + +commit e0b7d23ce884f03ecb693943c5bd822879c68d65 +Author: Martin Ling +Date: Sun Dec 30 04:17:56 2012 +0100 + + rigol-ds1xx2: First working version. + + Currently hardcoded to use /dev/usbtmc1. Analog data readout works. + +commit f4816ac6cc2403558276ada44d3e14eb4a9b3d15 +Author: Martin Ling +Date: Sat Dec 29 22:22:10 2012 +0100 + + rigol-ds1xx2: Initial driver skeleton. + +commit aeabd30820bd3b685fb0bac83d1dc4a7faa32287 +Author: Uwe Hermann +Date: Thu Jan 3 02:15:27 2013 +0100 + + ols: Implement SR_DI_HWOPTS. + +commit 986fde755d6bec3dfbf6d2bf4768ca359fc05174 +Author: Uwe Hermann +Date: Wed Dec 26 01:53:50 2012 +0100 + + serial-dmm: Add UNI-T UT61E support (UT-D02 cable). + +commit fe0c0b98c6d10290cbd2b461e3cb17404b0ba457 +Author: Uwe Hermann +Date: Wed Nov 7 19:10:36 2012 +0100 + + Add Cyrustek ES51922 DMM chip parser. + +commit 21d3d4ee871ee84a5ba598b21e9a1bdeaa9db5e3 +Author: Uwe Hermann +Date: Tue Jan 1 00:33:05 2013 +0100 + + alsa: Add some more samplerates. + + Add some more samplerates that seem to be supported by some devices + (found via random grepping of alsa and kernel sources). + +commit a1b9a9bf44b33ee9f3a6ac5ae59a1ced1e2c3281 +Author: Uwe Hermann +Date: Mon Dec 31 23:31:48 2012 +0100 + + alsa: Add missing % for PRIu64. + +commit 52ba6e05d59d6b2199214aed14330f213e79a593 +Author: Uwe Hermann +Date: Mon Dec 31 23:31:31 2012 +0100 + + alsa: Improved error reporting. + +commit 721ecf3d97aa6e84e6d61b3c25023e9177895025 +Author: Uwe Hermann +Date: Mon Dec 31 22:54:17 2012 +0100 + + alsa: Cosmetics, coding style, typos. + +commit 65faa197ae4c607c9c127af99af6c8e5b6acd7b3 +Author: Alexandru Gagniuc +Date: Wed Dec 26 12:11:33 2012 -0600 + + alsa: Find supported samplerates during device scan + + Since we are using the 'hw' interface of ALSA, we don't have the luxury of + samplerate conversion, given by the 'plughw' interface. If we try to set a + samplerate that is not supported, ALSA will just throw an error. + + We can test for the supported samplerates, and create a list of supported + samplerates, then limit the selection to only those values. The frontend can + query the list of supported samplerates. + + Signed-off-by: Alexandru Gagniuc + +commit 729850c9e7dfa2c08c11a025d5a54b8e8e803f3c +Author: Alexandru Gagniuc +Date: Sun Dec 23 12:57:37 2012 -0600 + + alsa: Fix sample acquisition and send normalized values + + The alsa driver requested signed 16-bit integers from ALSA, but casted them to + to an unsigned 16bit before finally casting them to a float. The end result was + that half of the wave would be clipped off. + We also requested data in little endian format. ALSA can be instructed to send + data with the correct endianness for the platform, without needing to worry + about what that is. + + This patch attempts three points, which, together, fix the acquisition: + 1) Request data from ALSA without specifying endianness; ALSA will handle the + endianness. + 2) Simplify the int16_t to float loop by using straightforward indexes. + 3) Normalize every value before sending it on the session bus. + + NOTE: If testing with PulseView, it will appear as if sigrok is sending all + zeroes. sigrok is sending correct data, but since the data is normalized, + PulseView will incorrectly plot it as a straight line. + + Signed-off-by: Alexandru Gagniuc + +commit 6944b2d02f23cf562574d3d1b37a2d698bdbde4e +Author: Alexandru Gagniuc +Date: Thu Dec 20 13:47:09 2012 -0600 + + alsa: Scan all soundcards and create a sigrok device per input + + The alsa driver only works with device "default". This limits the driver's + scope to whatever device ALSA deems to be "default". It is desirable to have + access to all ALSA devices from sigrok. + + Change the alsa device scan so that: + Each alsa device (not alsa card) gets its own sigrok device + For example, + hw:1,0 == sigrok device 0 + hw:1,1 == sigrok device 1 + hw:2,0 == sigrok device 2 + hw:2,1 == sigrok device 3 + hw:2,2 == sigrok device 4 + [...] + + We don't currently look at alsa subdevices. We only use subdevice 0. + Every input device will have its own channels (left, right, etc). Each of + those channels gets mapped to a different sigrok probe. A device with 4 + channels will have 4 probes from sigrok's perspective. + + Signed-off-by: Alexandru Gagniuc + +commit 0d6ff1039447c35fa8b423ee02468e62a5064cab +Author: Alexandru Gagniuc +Date: Wed Dec 26 20:14:54 2012 -0600 + + alsa: Do not use snd_pcm_hw_params_set_rate_near() + + snd_pcm_hw_params_set_rate_near() will try to use the samplerate closest to the + given value, potentially starting the acquisition with a different samplerate + than the one specified. + + Instead, use snd_pcm_hw_params_set_rate(). It will return an error if the + samplerate is not supported by the hardware, which is arguably better than + collecting data with a different samplerate than the one specified. + + Signed-off-by: Alexandru Gagniuc + +commit cbc8cbd8bbd664043c349133818e0ab41422c751 +Author: Alexandru Gagniuc +Date: Mon Dec 31 15:14:49 2012 -0600 + + rs9lcd: Add missing 'break;' + + A break was missing for "case MODE_AMP_WIDTH:" in sr_rs9lcd_parse(). + + Signed-off-by: Alexandru Gagniuc + +commit f4abaa9f6b37d07bd565c74a60139d641e86b1d1 +Author: Uwe Hermann +Date: Mon Dec 31 21:21:39 2012 +0100 + + asix-sigma: Fix two compiler warnings. + + asix-sigma.c:648:9: warning: 'ret' may be used uninitialized in this + function [-Wmaybe-uninitialized] + + asix-sigma.c:1337:20: warning: 'triggerselect' may be used uninitialized + in this function [-Wmaybe-uninitialized] + +commit b7c3e8499c9dc499874876efdf5fb499368d6f10 +Author: Uwe Hermann +Date: Mon Dec 31 21:05:11 2012 +0100 + + session: Fix compiler warning. + + session.c:258:6: warning: 'ret' may be used uninitialized in this + function [-Wmaybe-uninitialized] + +commit 6375e1c3eba6243bcaa28f0eee5452cc6f9ae2fd +Author: Uwe Hermann +Date: Mon Dec 31 21:03:45 2012 +0100 + + victor-dmm: Fix compiler warning. + + protocol.c:106:10: warning: 'factor' may be used uninitialized in this + function [-Wmaybe-uninitialized] + +commit f057272cac1baeead056502c29faeef83323b0bc +Author: Uwe Hermann +Date: Mon Dec 31 21:02:14 2012 +0100 + + nexus-osciprime: Fix compiler warning. + + protocol.c:26:46: warning: unused parameter 'fd' [-Wunused-parameter] + +commit 811155da461851e8a7f75df898a301a7db48c667 +Author: Uwe Hermann +Date: Mon Dec 31 21:01:53 2012 +0100 + + uni-t-dmm: Fix compiler warning. + + protocol.c:84:5: warning: 'ret' may be used uninitialized in this + function [-Wmaybe-uninitialized] + +commit 6e9d545cf4f546cbdb8a7ecd16d26e7d5e767a0b +Author: Uwe Hermann +Date: Mon Dec 31 20:58:14 2012 +0100 + + rs9lcd: Fix compiler warning. + + rs9lcd.c:289:19: warning: 'rawval' may be used uninitialized in this + function [-Wmaybe-uninitialized] + +commit 9116262931773877e4dd279336ebb2be8f182c05 +Author: Bert Vermeulen +Date: Sun Dec 30 01:44:58 2012 +0100 + + add USBTMC device search helper + +commit 80bc663296dade5d21e74fbbc5259b4f1b069fff +Author: Bert Vermeulen +Date: Sat Dec 29 11:19:19 2012 +0100 + + tondaj-sl-814: remove unneeded debugging + +commit 2239728c43aa12bcac66613bb4c84e745836d19d +Author: Uwe Hermann +Date: Fri Dec 28 17:13:20 2012 +0100 + + ols: Add missing 'extern'. + +commit d40a8d1455d3e08a17d1f9d96ee59e1826c7d8e1 +Author: Bert Vermeulen +Date: Fri Dec 28 16:46:21 2012 +0100 + + added VID:PIDs for all Hantek DSO-2xxx/5xxx + +commit bdd7618cd1f0645e3446814a9438965863d859f6 +Author: Uwe Hermann +Date: Fri Dec 28 11:22:16 2012 +0100 + + configure.ac: Fix CFLAGS settings. + + Don't override/overwrite CFLAGS in configure.ac, but rather amend it + with (currently) "-Wall -Wextra -fvisibility=hidden". + + This properly allows users/packagers to do things like: + + ./configure (this will default to using "-g -O2" additionally) + + CFLAGS="-g -O2" ./configure (same as above) + + CFLAGS="" ./configure (no additional flags) + + CFLAGS="-g -O0" ./configure (disable optimization, e.g. for valgrind use) + + etc. etc. + +commit 14766619703e5b16acee2ebef569751ea90009bb +Author: Uwe Hermann +Date: Wed Dec 19 22:50:07 2012 +0100 + + serial-dmm: Rename VOLTCRAFT_VC820 to VOLTCRAFT_VC820_SER. + + This matches the _ser suffix of the other functions/variables for this + device ("ser" denotes that it is used with the serial UNI-T UT-D02 cable + as opposed the USB/HID based cables which are handled by the uni-t-dmm driver). + + But more importantly, the _SER suffix for the enum value will prevent + name clashes later, when the uni-t-dmm driver gets a VOLTCRAFT_VC820 enum. + + Do the same for VOLTCRAFT_VC840. + +commit 35e199da505f5b8fadffa58875aaca70a8fde4f2 +Author: Uwe Hermann +Date: Wed Dec 26 01:29:27 2012 +0100 + + Fix limit_samples check in various drivers. + + Check whether a sample limit was actually set (> 0) before checking if + that sample limit is reached. This also fixes continuous acquisition mode + for drivers which have that. + +commit 786934010365a0b33aa8a32a7dc62a2975dba4c7 +Author: Uwe Hermann +Date: Wed Dec 26 00:12:52 2012 +0100 + + Shorten probe_names[] arrays everywhere. + + Also, NULL-terminate all of them. + +commit df36acb36a141e81eec0e6c5bd2734f86dd52597 +Author: Bert Vermeulen +Date: Wed Dec 26 00:01:37 2012 +0100 + + nexus-osciprime: suppress warnings + +commit f9b9bd632faf4d5651c31a51026f6cbd219256e4 +Author: Alexandru Gagniuc +Date: Sun Dec 23 12:48:48 2012 -0600 + + serial-dmm: Handle time-limited acquisition + + Implement SR_HWCAP_LIMIT_MSEC capability, to allow acquisition to automatically + stop after a specified amount of time. + + Signed-off-by: Alexandru Gagniuc + +commit 47eda193b2ce105ce50ddd284c99d813dacc49a7 +Author: Alexandru Gagniuc +Date: Tue Dec 25 16:21:24 2012 -0600 + + rs9lcd: Fix segfault with unusual modes. + + Some unusual modes required re-parsing the value. Instead of assigning the + re-parsed value to *floatval, it was reassigned directly to *analog->data; + however, analog->data is not initialized at this point, causing a segfault. + This situation was created when moving the radioshack-dmm code to serial-dmm, + with the segfault not being observed at that time. + + Do not write directly to analog->data, but instead use the intermediate + variable rawval. + + Signed-off-by: Alexandru Gagniuc + +commit 0853d5e627cc8ec493e52197fc8e9b3175701128 +Author: Alexandru Gagniuc +Date: Tue Dec 25 15:40:30 2012 -0600 + + rs9lcd: Convenience fixes + + Convert bit masks from hardcoded hex values to bit shifts. For example 0x80 + becomes (1 << 7). This also fixes a typo error in the definition of INFO_DIODE. + + Add comments explaining that some case values in sr_rs9lcd_parse() are meant to + fall through without a 'break;', and explain some of the unusual modes. + + Signed-off-by: Alexandru Gagniuc + +commit a97a3d708930a62bbc296785664b0d2677b233b2 +Author: Bert Vermeulen +Date: Tue Dec 25 19:13:20 2012 +0100 + + added Nexus-Computing OsciPrime VID:PID + +commit 523dfc2497c8e7c765ea423ec9d638feba9ed73d +Author: Bert Vermeulen +Date: Tue Dec 25 19:09:12 2012 +0100 + + nexus-osciprime: basic scanning functionality + + Unfortunately the device doesn't have an EEPROM on board at all, and so + initially enumerates with the default Cypress FX2 VID:PID (04b4:8613). + Since we already support using plain FX2* as basic logic analyzers using + the fx2lafw firmware, we cannot support that same VID:PID for the + OsciPrime. Therefore a USB conn is required for the initial scan. + + However, once the firmware is uploaded the device re-enumerates as + 04b4:1004, which we do detect for scanning automatically. + + Thus, the OsciPrime driver requires one scan with conn parameter to get + the firmware uploaded, but it will then keep working until powered off. + +commit 35a078bce5cff9b8ff221a9930d271ec90e20ec4 +Author: Bert Vermeulen +Date: Mon Dec 24 20:11:38 2012 +0100 + + nexus-osciprime: Initial driver skeleton. + +commit 2f1e5c7cb7ca72b6ebde7015191486ebfc0ffc70 +Author: Bert Vermeulen +Date: Mon Dec 24 20:27:45 2012 +0100 + + fluke-dmm: Properly handle continuous mode + + Same bug+fix as commit d55c89f523e74a2f629bb23e8fd9bf6db7e3758a + +commit f1f7e62d6df766f4a65d7854ae2dd745c623c863 +Author: Alexandru Gagniuc +Date: Wed Dec 19 04:15:18 2012 -0600 + + session.c: Remove all remaining sources on sr_session_stop + + Some sources may not be necessarily associated with a device. The best example + is the anykey pollfd from sigrok-cli. sr_session_stop only removes sources + associated with hardware devices via dev_acquisition_stop. Sources such as + anykey are not removed, and thus session->num_sources will not get to 0. As a + result, we may get into situations where the event loop enters an infinite + state. + + To prevent this, all we have to do is remove any active sources that are still + present after dev_acquisition_stop has been called for all devices. + + This fixes bug 14. + +commit dc890b8f9fa01895d3849e7d5ab8be1146f07b9e +Author: Uwe Hermann +Date: Mon Dec 24 16:57:55 2012 +0100 + + asix-sigma: Quickfix for an ASIX SIGMA issue. + + It's not entirely clear whether this is the right fix, but we're merging + it for now, pending later review. + + See also: http://sigrok.org/bugzilla/show_bug.cgi?id=26 + +commit b36e715395d220b7542b6038af3742e85e7bab92 +Author: Joel Holdsworth +Date: Tue Dec 11 20:51:53 2012 +0000 + + fx2lafw: Tidied probe_names + +commit 0aba65da9f4031ca6eb7d0c268e4d06b0d0bfa06 +Author: Uwe Hermann +Date: Sun Dec 23 20:41:27 2012 +0100 + + ols: Split into api.c and protocol.[ch]. + + Also, drop various no longer needed #include files. + +commit a567547e205eca58065f21aa5b1502a34ba315b3 +Author: Uwe Hermann +Date: Sun Dec 23 19:09:11 2012 +0100 + + ols: Use logging helper macro. + +commit 11fb7110f46a76a4b078896f0e6c9396bf828189 +Author: Bert Vermeulen +Date: Mon Dec 24 11:00:55 2012 +0100 + + fluke-dmm: 190 series scopemeter support + + 199B only for now. + +commit 4cea0ff7febe335aa4607e544561710963d5e5af +Author: Bert Vermeulen +Date: Mon Dec 24 10:59:41 2012 +0100 + + fluke-dmm: parser cleanup + +commit 9fa09680277cdc1f7f0792bedefff256ad9694ec +Author: Bert Vermeulen +Date: Mon Dec 24 10:56:54 2012 +0100 + + fluke-dmm: adapt scanner to accomodate 190 series scopemeters + +commit d4b11de09a42710c1c043693d5bda0fc8bc72f90 +Author: Bert Vermeulen +Date: Mon Dec 24 10:40:04 2012 +0100 + + fluke-dmm: make poll timeout configurable + + Defaulted to 1s before, but a simple "QM" command on a 199B in scope + mode takes 1.7s to come through. + +commit d92faf6cacf7088bd241bb8f0b1adc48082e85fb +Author: Bert Vermeulen +Date: Sun Dec 23 18:54:24 2012 +0100 + + serial: more debug cleanup + +commit 49aaa0bc68c1bf77cd81989c40e471fe7bd161ec +Author: Bert Vermeulen +Date: Thu Dec 20 10:41:48 2012 +0100 + + serial: get rid of overly verbose spew + + It just made spew-level logging unusable; the way sigrok async comms work + guarantees most of it was a false error. + +commit 9cd9f6b71c35c0203b7e8997ce9425d0dc6e0f4d +Author: Alexandru Gagniuc +Date: Thu Dec 20 11:33:49 2012 -0600 + + alsa: Split into api.c and protocol.c + + This is the driver model agreed upon for all drivers. + + As a result of the split, a devc->num_probes field had to be added in order to + reduce the interdependence between api.c and protocol.c . + + Signed-off-by: Alexandru Gagniuc + +commit acac8fc3500bc1f1e9e43c1508638488d91b2f86 +Author: Alexandru Gagniuc +Date: Wed Dec 19 21:39:38 2012 -0600 + + device.c: Fix memory leak in sr_serial_dev_inst_free + + sr_serial_dev_inst_free() freed all members of sr_serial_dev_inst, but did not + free the struct itself, as expected from a free_*() function. This inadvertently + caused a memory leak in every place sr_serial_dev_inst is used. + + Free the struct itself + + + g_free(serial); + + Signed-off-by: Alexandru Gagniuc + +commit d55c89f523e74a2f629bb23e8fd9bf6db7e3758a +Author: Alexandru Gagniuc +Date: Sat Dec 22 16:00:44 2012 -0600 + + serial-dmm: Properly handle continuous mode + + serial-dmm does not check if a sample limit is actually in place before deciding + to stop acquisition. Since the sample limit is set at 0 by default, operating + in continuous mode will cause acquisition to stop before even sending the first + sample. + + Check to make sure we actually are in a sample-limited mode before stopping for + this reason. + + Signed-off-by: Alexandru Gagniuc + +commit 17dfb2c32c6686630fd95b2f25e554fa01f8ebd1 +Author: Uwe Hermann +Date: Sat Dec 22 01:33:03 2012 +0100 + + configure.ac: Improve check for libusb-1.0. + + PKG_CHECK_MODULES() checks for libusb-1.0 via pkg-config already, no + need to use a "manual" additional check via AC_CHECK_LIB() just to set + HAVE_LIBUSB_1_0 in config.h. + + This helps with cross-compiling setups, among other things. + +commit 0254651dcba4b8c34d35845083250586ecf964ed +Author: Uwe Hermann +Date: Mon Dec 17 19:39:13 2012 +0100 + + alsa: Update to latest APIs/conventions. + + The alsa driver was out of date wrt APIs and libsigrok conventions in + general, and wasn't compiling. + + This fixes the compile and updates it to _basically_ work with the current + state of analog support in libsigrok. + + This is not finished/full support for ALSA analog sampling yet, though, + various TODOs remain that will be addressed later. + +commit bf53457d1ddea58d1cb7e4feea83ad0cc1d63031 +Author: Joel Holdsworth +Date: Thu Dec 13 21:07:53 2012 +0000 + + Pass sr_datafeed_packets and payloads with const pointers + + This patch marks packet structures and their payloads as const. + This indicates to packet receivers that modifications to these are + not allowed. In general all pointers should be marked const unless + modification of the referenced data is explicitly allowed. + +commit 16d6e56d124dcedf7273212bbfab1aed6ac7e7aa +Author: Uwe Hermann +Date: Tue Dec 18 02:25:17 2012 +0100 + + hardware/agilent-dmm/Makefile.am: Fix typo. + +commit 4f9bf9a202d331b0f2ec088d73d72808e1a934b4 +Author: Alexandru Gagniuc +Date: Mon Dec 17 02:04:35 2012 -0600 + + chronovu-la8: Fix memory leak in hw_scan + + Hardware scanning creates an ftdi_context before attempting to locate devices + based on PID/VID. If no devices are detected, execution jumps to cleanup. The + context is freed with free(), instead of ftdi_free(). + + We cannot assume that the libftdi context is stored in a contiguous memory + region, and thus cannot use a simple free. Case in point, this situation is + identified by valgrind as a "definitely lost" memory leak. + + Use ftdi_free() instead of a simple free() in hw_scan(). Valgrind no longer + complains about a memory leak in this area. + + clear_instances() does not need any modification, as it correctly uses + ftdi_free(). + + Signed-off-by: Alexandru Gagniuc + +commit c0bf69c29b138d18ee9f542985664eeaeeb47a0a +Author: Uwe Hermann +Date: Tue Dec 18 01:30:34 2012 +0100 + + fx2lafw: Fix int64_t printing. + +commit b99457f09c90ce7fbb0de1793088dd53a59a0d07 +Author: Uwe Hermann +Date: Tue Dec 18 01:26:58 2012 +0100 + + fx2lafw: Various cosmetics, typo fixes, etc. + +commit a873c5940cc6d2d8f54f2dfdac3a98c4a3d302ee +Author: Uwe Hermann +Date: Tue Dec 18 00:52:39 2012 +0100 + + Consistently use 'di' as variable name. + + Use 'di' consistently in all drivers as the name for a local, static + pointer to the respective driver's 'struct sr_dev_driver'. + +commit 443a14d81f44772076aefdb2b252657d6abc0d29 +Author: Alexandru Gagniuc +Date: Thu Dec 6 15:55:14 2012 -0600 + + fx2lafw: Print device failed to renumerate error + + commit 378abfeac6cc94d88dc82b8481dec9c9f691f3da tried to solve a bug where + the fx2lafw driver would print "Device came back" even if a timeout had occured. + + It solved that issue, but inadvertently introduced a new bug: + "Device came back" would be printed even if no firmware upload was performed. + This is counterintuitive, as the device is only reset when a firmware upload is + performed. + + There are three cases: + i) Firmware upload was successful + ii) Firmware upload failed + iii) Firmware upload was NOT needed + + Each case warrants a separate message from the driver. Print the + following messages depending on the outcome: + + i) "Device came back" + ii) "Device failed to renumerate" + iii) "Firmware upload was not needed." + + Signed-off-by: Alexandru Gagniuc + +commit f427daefb01cdaf578dc8b9fa5f59c5525439289 +Author: Alexandru Gagniuc +Date: Thu Dec 13 15:08:05 2012 -0600 + + fx2lafw: Use DRIVER_LOG_DOMAIN for log messages + + Use the new DRIVER_LOG_DOMAIN mechanism, where explicitly writing + the driver name in the message string is no longer required. + + Thus: + + - sr_err("fx2lafw: Something bad happened."); + + becomes: + + + sr_err("Something bad happened."); + + In either case, the log output is the same. + + Signed-off-by: Alexandru Gagniuc + +commit 006dbe55878ec7499e58a130c27f6c4297ada54b +Author: Uwe Hermann +Date: Sun Dec 16 22:27:04 2012 +0100 + + serial_stream_detect(): Drop unneeded sr_spew(). + +commit 54d112218713b34491cd65454abad340ff19a393 +Author: Uwe Hermann +Date: Sun Dec 16 22:17:48 2012 +0100 + + serial-dmm: Add Voltcraft VC-840 (UT-D02) support. + + This works with the UNI-T UT-D02 (RS232) cable. For the USB/HID + based cable (UNI-T UT-D04), the uni-t-dmm driver must be used. + + Note: This is untested, but should work just fine for all settings, with + the possible exception of temperature (testers needed!) + +commit 40830061eb3a1327c1a8c76758e84b252e1950a8 +Author: Uwe Hermann +Date: Sun Dec 16 22:03:28 2012 +0100 + + serial-dmm: Add Voltcraft VC-820 (UT-D02) support. + + This works with the UNI-T UT-D02 (RS232) cable. For the USB/HID + based cable (UNI-T UT-D04), the uni-t-dmm driver must be used. + +commit 16b7b79005aaf0ab67d207ca11989f62d983ce62 +Author: Uwe Hermann +Date: Sun Dec 16 21:28:26 2012 +0100 + + serial-dmm: Eliminate unneeded "subdriver" field. + + Just use the 'int dmm' + wrapper method that is used for all other + functions which need this information. There is no real need to + special-case the hw_dev_acquisition_start() API call here. + +commit 22f54192358620f24fc2df2ea6e8f578fee24b81 +Author: Uwe Hermann +Date: Sun Dec 16 21:23:49 2012 +0100 + + serial-dmm: Cosmetics, documentation fixes. + +commit 6aed917b133d44199500cdffc0d2f7998add3fb6 +Author: Bert Vermeulen +Date: Sun Dec 16 23:06:15 2012 +0100 + + lascar-el-usb: fix sample limit parameter + +commit 801c7800c6260a2e12aa2618263a717334946eb8 +Author: Alexandru Gagniuc +Date: Sat Dec 15 11:03:10 2012 -0600 + + linsigrok.h: Document meaning of SR_UNIT_CONCENTRATION + + Having concentration as a unit is vague, as it can be expressed in + many ways. In the context of sigrok, concentration means a normalized + number from 0 to 1. + + Document its meaning. + + Signed-off-by: Alexandru Gagniuc + +commit 6787f4049a0c05ffb438fc1718f1fe9840be5a41 +Author: Bert Vermeulen +Date: Sun Dec 16 18:48:20 2012 +0100 + + lascar-el-usb: support for EL-USB-2* + +commit ef4344e7f44fe8b67fdbf1cebf2b1a6d7edbfe77 +Author: Bert Vermeulen +Date: Sun Dec 16 18:38:44 2012 +0100 + + add relative humidity MQ + +commit 7249d7833b69c1d753b18112891870d8aeda3d69 +Author: Bert Vermeulen +Date: Sat Dec 15 22:50:33 2012 +0100 + + analog: support ppm output + +commit 7f00750ca4ed224b3880058847e6398f30cbb8f7 +Author: Bert Vermeulen +Date: Sat Dec 15 22:49:40 2012 +0100 + + lascar-el-usb: properly submit CO concentration as a PPM value + +commit b0c95747e1e7ffa7ca9e8ca4a9bdda781469750a +Author: Bert Vermeulen +Date: Sat Dec 15 22:34:40 2012 +0100 + + lascar-el-usb: add config saver + +commit b6506d5e03e67c5029525d36016936cf9c858720 +Author: Bert Vermeulen +Date: Sat Dec 15 11:15:30 2012 +0100 + + lascar-el-usb: EL-USB-CO300 support + + Works the same way as the EL-USB-CO, but with the more sensitive sensor, + so should work out of the box. + +commit 521a0cd3577db0ec2763493d95d2ffa479568a3a +Author: Bert Vermeulen +Date: Sat Dec 15 11:07:18 2012 +0100 + + cosmetics + +commit 4f3bd685e695790ff578d17d0ed95c00784e58fa +Author: Bert Vermeulen +Date: Sat Dec 15 10:50:22 2012 +0100 + + add MQ/units for carbon monoxide concentration + +commit 6aa1eb4ea33e1aeeef772cd234f140464eea3fe2 +Author: Bert Vermeulen +Date: Sat Dec 15 04:06:51 2012 +0100 + + lascar-el-usb: generic EL-USB support + EL-USB-CO support + +commit c5f1a021b82f3c2c56df2a0860bb6f9776e1076b +Author: Bert Vermeulen +Date: Sun Dec 9 15:19:39 2012 +0100 + + usb: strip overly verbose debugging + +commit 9ec7ff94ed08aecc9c8898b00c797fd2621438c4 +Author: Bert Vermeulen +Date: Sun Dec 9 14:40:12 2012 +0100 + + victor-dmm: free in the right order + +commit e7f378fd1ab895259cda8b0545663b39c7bc16f0 +Author: Bert Vermeulen +Date: Sun Dec 9 14:39:17 2012 +0100 + + usb: strip useless code + +commit e7ed87a469cb3c997ec2e98bc2c39d4284d86252 +Author: Alexandru Gagniuc +Date: Thu Dec 13 12:35:06 2012 -0600 + + serial-dmm: Use dummy info struct for rs9lcd parser + + The rs9lcd parser, which is used for the RadioShack 22-812 does not use its + *info parameter, and therefore did not have a rs9lcd_info struct declared. + + With recent re-factoring of the receive data callbacks, it became necessary to + pass a struct pointer. This made the RECV_DATA macro look like: + + - RECV_DATA(RADIOSHACK_22_812, metex14) + + giving the wrong impression that the RadioShack 22-182 uses the + metex14 protocol, which is not the case. + + Create a dummy rs9lcd_info struct, and correctly identify the parser + as rs9lcd in the RECV_DATA macro: + + + RECV_DATA(RADIOSHACK_22_812, rs9lcd) + + Signed-off-by: Alexandru Gagniuc + +commit c69049091ec6e1383805064d3c472264384ffb57 +Author: Alexandru Gagniuc +Date: Thu Dec 13 11:08:38 2012 -0600 + + libsigrok.h: Don't store subdriver in sr_dev_driver + + Not all drivers use subdrivers. The only reason the subdriver field was + introduced was to accomodate the model of serial-dmm. + + The sr_dev_driver struct is available to the frontend. Exposing the subdriver + field creates the problem of exposing knowledge of libsigrok's internal driver + layout, even though the drivers are designed to be a flat list to the frontend. + + Store the subdriver in the dev_context struct of serial-dmm. + + Signed-off-by: Alexandru Gagniuc + +commit d128bf12b27432988cc5a0bf7d6ec3fca0696b0b +Author: Alexandru Gagniuc +Date: Thu Dec 13 10:53:28 2012 -0600 + + serial-dmm: Remove global sr_dev_driver *di alias + + The global *di alias was used to keep track of the driver context. + It caused issues with trying to use several subdrivers at once, so + its use was obsoleted. + + The correct context is preserved through different mechanisms, either + the *sdi pointer, or wrappers which pass the correct context. + + The *di alias is no longer used, so remove it. + + Signed-off-by: Alexandru Gagniuc + +commit 3098b3902d1794831be010ebff0484caf845de60 +Author: Alexandru Gagniuc +Date: Thu Dec 13 08:58:01 2012 -0600 + + serial-dmm: Simplify wrapper layout + + Wrappers for hw_init, hw_cleanup, clear_instances, and hw_scan are needed for + each subdriver due to the nature of serial-dmm. These wrappers are implemented + as macros, in order to reduce the number of lines of code. + + For each of those functions, we have a separate wrapper list, then we connect + them together in a first-class driver using a DRV macro, and yet another list + (the DRV list). + + Instead of declaring those wrappers in separate lists, include them in the DRV + macro. This approach reduces the number of macro lists from five to just one. + + From the perspective of adding a new subdriver, this also greatly reduces the + number of places needed to hook in a new device. + + Signed-off-by: Alexandru Gagniuc + +commit fd9b2b865ac4e3f12305744753c0759c34c056c4 +Author: Uwe Hermann +Date: Thu Dec 13 01:54:13 2012 +0100 + + serial-dmm: Add per-driver clear_instances() wrappers. + +commit 0c23677d0bc04a024c382aef64e5146887bdcb1b +Author: Uwe Hermann +Date: Thu Dec 13 01:47:02 2012 +0100 + + serial-dmm: Add per-driver hw_cleanup() wrappers. + +commit ca4b130943e266f545ae8ba89528f285831540cd +Author: Uwe Hermann +Date: Thu Dec 13 01:41:34 2012 +0100 + + serial-dmm: Add per-driver hw_dev_list() wrappers. + +commit ea4c6c2311f2c31ccf6863b13a815918ccee974b +Author: Uwe Hermann +Date: Thu Dec 13 01:27:31 2012 +0100 + + serial-dmm: Add per-driver hw_scan() wrappers. + +commit dccfe015868b5f1a5a5996983164d135ec561596 +Author: Uwe Hermann +Date: Thu Dec 13 01:19:17 2012 +0100 + + serial-dmm: Use a macro for receive_data() wrappers. + +commit f1437c6814c693bd624211c5b644951cf16139f2 +Author: Uwe Hermann +Date: Thu Dec 13 00:59:42 2012 +0100 + + serial-dmm: Use a macro for driver struct simplification. + +commit 06b7a8af7e2e4b7baf28f4fa710a7dd00765f18a +Author: Uwe Hermann +Date: Tue Dec 11 17:06:04 2012 +0100 + + serial-dmm: Simplify code a bit. + + Store/use the receive_data() function and a pointer to the driver struct + in the dmms[] array. Use a ".subdriver" entry in the driver struct. + Use a macro to simplify hw_init() wrappers. + +commit 5b389efcfeff17b0f7466597706c898ad65eb6a9 +Author: Alexandru Gagniuc +Date: Sun Dec 9 13:15:24 2012 -0600 + + serial-dmm: Avoid duplicate symbol error + + Declare dmm_info dmms as extern in protocol.h to prevent duplicate + symbol error from the linker. + + Signed-off-by: Alexandru Gagniuc + +commit 378abfeac6cc94d88dc82b8481dec9c9f691f3da +Author: Joel Holdsworth +Date: Thu Dec 6 21:31:37 2012 +0000 + + fx2lafw: Don't say "Device came back" when it didn't + +commit 26be4ebef369e465eb5f13ee7bbab71b62e455f6 +Author: Alexandru Gagniuc +Date: Wed Dec 5 15:16:52 2012 -0600 + + serial-dmm: Fix segfault when no device is used + + di was initialized as NULL. If no device covered by this driver + is used, di remains NULL. This causes a segmentation fault when + calling clear_instances(). + + Check for di being NULL. + + Signed-off-by: Alexandru Gagniuc + +commit 63c07e48c627684f04d70e7dea2baf7c72ff2a41 +Author: Peter Stuge +Date: Sat Nov 3 08:29:26 2012 +0100 + + backend.c: Return a sigrok error in sr_init() on libusb_init() errors + +commit 123d97b17715204c58b795b8e6cbecc55725e5d3 +Author: Peter Stuge +Date: Sat Nov 3 08:27:48 2012 +0100 + + backend.c: Fix memory leak in sr_init() error path + + Commit 785b9ff290cbdb86e7d0b0280c33b43faf9c0518 added libusb init into + sr_init() which can generate an error. In this case, the already + allocated struct sr_context would have leaked. + +commit 1740429d7045385866caafb0d2cbe302e7c74604 +Author: Peter Stuge +Date: Wed Dec 5 01:23:49 2012 +0100 + + hardware: A few further USB error message fixups + +commit d4928d7102c6b2f9f7aa51a1b98669bf148fff80 +Author: Peter Stuge +Date: Tue Dec 4 21:11:25 2012 +0100 + + hardware: Call libusb_error_name() in all USB-related error messages + +commit 851d5b2274f138d58be42adbbe584d9a4c4dfe01 +Author: Bert Vermeulen +Date: Tue Dec 4 23:58:26 2012 +0100 + + lascar-el-usb: add scanning functionality + +commit 402704445e081ef7737081885496169f91af7ab9 +Author: Bert Vermeulen +Date: Tue Dec 4 23:58:03 2012 +0100 + + add thermometer and hygrometer HWCAPs + +commit 7ae6a75826be6d7ddd885947630ecb26ba9fa1a5 +Author: Bert Vermeulen +Date: Tue Dec 4 23:25:11 2012 +0100 + + usb: sr_usb_find() uses standardized connection string to find a USB device + +commit 5ea1e54ab54542803d531bd714b09b54fbaab408 +Author: Bert Vermeulen +Date: Tue Dec 4 23:11:40 2012 +0100 + + add VID:PID for generic SILabs F32x USBXpress chips + + Used in Lascar EL-USB series devices + +commit d458a0ac290c4be4cad19c22e143748a5ddff0e6 +Author: Alexandru Gagniuc +Date: Tue Dec 4 13:31:49 2012 -0600 + + ezusb: Use DRIVER_LOG_DOMAIN for debug output + + Signed-off-by: Alexandru Gagniuc + +commit f4284934354bff761a74eee545e5a4b7911a8e8c +Author: Alexandru Gagniuc +Date: Mon Dec 3 19:39:58 2012 -0600 + + tondaj-sl-814: Fix unused parameter warning + + Signed-off-by: Alexandru Gagniuc + +commit d4abb463a749cd3d614e98c7fe7f5d28ad69475d +Author: Peter Stuge +Date: Mon Dec 3 03:33:24 2012 +0100 + + hardware: Make USB drivers use the libusb_context in struct sr_context + +commit 1ebe4b4e6926eb1288ce77b179a92bc670eb9eca +Author: Peter Stuge +Date: Mon Dec 3 02:49:36 2012 +0100 + + hw_init(): Save struct sr_context * parameter in struct drv_context + +commit 34f06b903e3529a73feb7a6e74fae934a999f821 +Author: Peter Stuge +Date: Mon Dec 3 02:47:55 2012 +0100 + + Add a struct sr_context * parameter to hw_init() + +commit 44fc870c9cc5c0e53b47b9d7fa3dffe81731ee3c +Author: Peter Stuge +Date: Mon Dec 3 02:42:57 2012 +0100 + + Add a struct sr_context * parameter to sr_driver_init() + + Since the public API is changed, this commit also bumps the libtool + version component SR_LIB_VERSION_CURRENT in configure.ac. + +commit 73496bb57138dcd1aad4800c8c9ffc6484ca9d8a +Author: Peter Stuge +Date: Mon Dec 3 01:34:23 2012 +0100 + + alsa: Remove unused and unprovided hw_init() parameter `devname' + +commit 46697e38b286541e0e5aa354d35a6f4564855fa6 +Author: Bert Vermeulen +Date: Tue Nov 27 17:40:14 2012 +0100 + + lascar-el-usb: Initial driver skeleton. + +commit 162b735218b906d5a41e8da69ea15b76d267f1fd +Author: Uwe Hermann +Date: Sun Dec 2 21:58:34 2012 +0100 + + Remove some radioshack-dmm leftovers. + +commit ea088bb6930c617b2d615ee47c9442b27f449c43 +Author: Alexandru Gagniuc +Date: Sun Dec 2 13:34:51 2012 -0600 + + serial.c: Be more verbose about failing to parse parameter string + + Signed-off-by: Alexandru Gagniuc + +commit 21829e6708ce1167e2d7d5d370166cafe328f092 +Author: Alexandru Gagniuc +Date: Sun Dec 2 13:15:21 2012 -0600 + + radioshack-dmm: Integrate into serial-dmm + + Use the infrastructure of serial-dmm to handle the RadioShack 22-812, + and completely remove radioshack-dmm. + + Signed-off-by: Alexandru Gagniuc + +commit 05f134abc2641e6e4d3a22a8dda19460819af16e +Author: Alexandru Gagniuc +Date: Sun Dec 2 12:58:30 2012 -0600 + + radioshack-dmm: Separate protocol parser from driver + + Move the parsing part of radioshack-dmm into a separate protocol + parser, following the model from hardware/common/dmm. + + Signed-off-by: Alexandru Gagniuc + +commit ae95ffebfa0d8c0992332b33631a26d898957b34 +Author: Alexandru Gagniuc +Date: Sun Dec 2 12:43:37 2012 -0600 + + radioshack-dmm: Fix opening of serial port. + + During scan the serial port is opened with SERIAL_RDONLY | SERIAL_NONBLOCK, + which works fine, but when acquisition starts, it is opened only with + SERIAL_RDONLY. On Linux, if cdc_acm can make a claim to the USB to serial + converter, opening the port will fail. + + Open port with SERIAL_RDONLY | SERIAL_NONBLOCK. + + Signed-off-by: Alexandru Gagniuc + +commit d5ce233fe16a68e6522538c226a91e63628521dd +Author: Alexandru Gagniuc +Date: Sun Dec 2 09:17:46 2012 -0600 + + serial-dmm: Add RadioShack 22-168 support. + + Signed-off-by: Alexandru Gagniuc + +commit eebb606762218d7e87a18721bad0d47892e220e9 +Author: Uwe Hermann +Date: Sun Dec 2 17:21:13 2012 +0100 + + demo: Add missing dev_clear() API call. + +commit 55a6daf59f85449d99a62b0a3b6010980125d38d +Author: Uwe Hermann +Date: Sun Nov 11 23:54:49 2012 +0100 + + sr_init(): Add driver sanity checks. + + After sr_init() has successfully run, we can be sure that all drivers + define all the API calls, so we don't have to do these checks later + in the individual API functions / wrappers. + + If there are one or more drivers with missing API functions (or driver + name / longname, and so on), sr_init() will fail. This helps catch this + kind of developer error early on. + +commit 3a18cf625e6f611041554d81c178b29cec19b484 +Author: Uwe Hermann +Date: Sun Dec 2 16:11:42 2012 +0100 + + serial-dmm: Drop accidentally committed file. + +commit 7f64e88fa99d54f22a999e7461e4f13c70f0aa8c +Author: Uwe Hermann +Date: Sun Dec 2 16:09:31 2012 +0100 + + Reduce glib minimum version to 2.28.0 again. + + We no longer use g_thread_try_new() which is only available since 2.32.0. + +commit 3b20367381bcd955e604c40d05f489f2221c036a +Author: Alexandru Gagniuc +Date: Sat Dec 1 18:07:10 2012 -0600 + + demo: Do not use a separate thread for generating data + + We already have an event-based mechanism in place. Using a thread just + adds unneeded complexity, especially for a driver designed not for + performance, but for providing a testbed to frontends. + Generate the data in the event handler, not in a separate thread. + + Signed-off-by: Alexandru Gagniuc + +commit d4bd66a0c7196fb44f6f22036e3ea452ad5870df +Author: Uwe Hermann +Date: Sun Dec 2 01:32:57 2012 +0100 + + serial-dmm: Add PCE PCE-DM32 support. + +commit a376ffea49411cca09b358f3677938612c79afaf +Author: Uwe Hermann +Date: Sun Dec 2 01:02:16 2012 +0100 + + serial-dmm: Add PeakTech 4370 support. + +commit a53da08254a5adcc15c925014eb1083fb067f3b6 +Author: Uwe Hermann +Date: Sun Dec 2 00:40:15 2012 +0100 + + serial-dmm: Add Metex M-3640D support. + +commit 9871215c83f70a2008272de03268291445ed59c3 +Author: Uwe Hermann +Date: Sun Dec 2 00:36:37 2012 +0100 + + metex14: Add dB mode and hFE mode support. + + This is found e.g. on the Metex M-3640D DMM. + +commit 6dca2f16eedfbcaa0ea4e45c7d58bbf596fa1012 +Author: Uwe Hermann +Date: Sat Dec 1 23:32:39 2012 +0100 + + serial-dmm: Add V&A VA18B support. + +commit 5887c9cc1af1d4798d61b338d66b573b1273f9c4 +Author: Uwe Hermann +Date: Sat Dec 1 23:04:00 2012 +0100 + + serial-dmm: Add MASTECH MAS345 support. + +commit f0ac4929d3aaa83e32b0be0637ae1f22040ea724 +Author: Uwe Hermann +Date: Sat Dec 1 22:45:45 2012 +0100 + + serial-dmm: Add PeakTech 3410 support. + +commit ce3777ada98c5099d2867653f25239b85cf55708 +Author: Uwe Hermann +Date: Sun Dec 2 14:22:15 2012 +0100 + + serial-dmm: Add Metex ME-31 support. + +commit f086b83011b1282f62f0058872f333aef4bf9daa +Author: Uwe Hermann +Date: Sat Dec 1 19:53:05 2012 +0100 + + serial-dmm: Add Digitek DT4000ZC support. + +commit e90cf076aa6854ad3f312179a121bafc4c6e9a22 +Author: Uwe Hermann +Date: Sat Dec 1 20:48:03 2012 +0100 + + metex14: Add sr_metex14_packet_request(). + +commit 8f46911e4252bddb680fb9adc603ea2640f1724e +Author: Uwe Hermann +Date: Sat Dec 1 20:11:40 2012 +0100 + + metex14: Fix 'is_ol' handling. + + Thanks to Bert Vermeulen for the reminder. + +commit 2477fb95693aeeeab04323618ba18b1ebdbc3eb2 +Author: Alexandru Gagniuc +Date: Fri Nov 30 13:15:44 2012 -0600 + + metex14: Parse microamp (uA) values. + + Signed-off-by: Alexandru Gagniuc + +commit 3ebc9b59a2e2b96ad95dbfdf3218c3b3b00940ef +Author: Alexandru Gagniuc +Date: Fri Nov 30 13:11:04 2012 -0600 + + metex14: Fix parsing of measurement flags. + + strcmp(buf + 9, " mA") does not work because buf is CR-terminated, + while " mA" is NUL-terminated. + + Drop ambiguities arising from the termination of the strings, and + only compare the characters we care about, using strncmp(). + + Signed-off-by: Alexandru Gagniuc + +commit e82d7dbc202794dc30abdb4e50cfb4507f49025e +Author: Alexandru Gagniuc +Date: Fri Nov 30 12:40:17 2012 -0600 + + metex14: Print contents of received packet. + + The packet is an ASCII string. We can simply print the raw packet data. + + Signed-off-by: Alexandru Gagniuc + +commit 76b55dfa8a5318a0495d3f2cfb29d6cd229ce5dc +Author: Alexandru Gagniuc +Date: Fri Nov 30 12:29:22 2012 -0600 + + metex14: Fix parsing of spaces. + + When the parser found a space, it treated it as an invalid digit + and discarded the whole packet. This behavior was incorrect on + 2000 count devices, where the first digit can be sent as a space + rather than a '0'. + + Convert spaces to '0' and parse them as usual. + + Signed-off-by: Alexandru Gagniuc + +commit 21a7f2692e09269edd872bca4e25a9d06b67c0e5 +Author: Uwe Hermann +Date: Sat Dec 1 19:35:19 2012 +0100 + + Rename tekpower-dmm to serial-dmm. + + This is now a generic driver for multiple DMM "subdrivers" that use simple + serial port protocols. + +commit 729b01f98838b50263511ec135754d741698659b +Author: Uwe Hermann +Date: Sat Dec 1 19:28:36 2012 +0100 + + tekpower-dmm: Generalize & first-class TP4000ZC driver. + + Prepare the tekpower-dmm driver to be able to support various simple + serial port based DMMs. + + Also, make a 'tekpower-tp4000zc' "first-class" driver which is currently + the only user of this generic driver. + +commit 1fbab466268bf6975c0709d5554ce2192a21ef6c +Author: Uwe Hermann +Date: Sat Dec 1 19:01:07 2012 +0100 + + metex14: Pass 'info' as a void pointer. + + This is done so that the function prototype of all sr_*_parse() DMM + functions is the same, which will be needed later. + +commit 93357bc3ce484c2e46a9999d4464ce2d5cc976b6 +Author: Uwe Hermann +Date: Sat Dec 1 18:50:35 2012 +0100 + + fs9721: Pass 'info' as a void pointer. + + This is done so that the function prototype of all sr_*_parse() DMM + functions is the same, which will be needed later. + +commit d84fc9cb3b9fede9234603f95c1467f95686c1a7 +Author: Uwe Hermann +Date: Wed Nov 28 17:14:42 2012 +0100 + + tekpower-dmm: Drop unneeded g_try_malloc(). + +commit 5ddb0cc7d4850375a9ef741012d229ead9a91490 +Author: Uwe Hermann +Date: Sun Dec 2 14:10:27 2012 +0100 + + serial: Don't hardcode parity and stop bits on Windows. + +commit 5ae35c29a7010cd018e43d04a809e1c60b7b72fa +Author: Uwe Hermann +Date: Sun Dec 2 13:56:13 2012 +0100 + + serial: Full baudrate support on Windows/MinGW. + +commit 39e5d79826cd2c1991007faf1a6cde05af995aa9 +Author: Uwe Hermann +Date: Sun Dec 2 13:41:49 2012 +0100 + + serial: RTS/DTR support on Windows/MinGW. + +commit a54dd31e380ca4b469a20e41a0023d1dd9ec3c99 +Author: Uwe Hermann +Date: Sun Dec 2 12:45:54 2012 +0100 + + serial: Use OS-independent flags for serial port opening. + + Add SERIAL_RDWR, SERIAL_RDONLY, and SERIAL_NONBLOCK (for now), which are + mapped to the respective OS-specific mechanism in serial_open(). + +commit 0f84cda05d808f2e1c93ee14c4223be85fb9ef84 +Author: Uwe Hermann +Date: Sat Dec 1 22:34:53 2012 +0100 + + serial: Fix Windows build. + +commit c216d62307a000c75265594a34e8fefee7ba9efc +Author: Alexandru Gagniuc +Date: Sat Dec 1 12:49:15 2012 -0600 + + demo: Properly stop acquisition after reaching our sample quota + + The demo driver was using sr_session_source_add_channel() to add + a poll source, but was relying on sr_session_run_poll() to call + sr_session_source_remove(). This, coupled with the design of the + driver caused errors once the samples were collected. + + The error stream was most likely related to failing to properly close + one of the channels. + + Signed-off-by: Alexandru Gagniuc + +commit 49145a63c73e212e43f1ec901bfb4fe9f99e3caf +Author: Alexandru Gagniuc +Date: Sat Dec 1 12:03:45 2012 -0600 + + demo: Be more verbose about starting/stopping acquisition + + This is the first step in fixing the demo driver: figuring out what is + being called and what is not _and_ have it show up in the logs. + + Signed-off-by: Alexandru Gagniuc + +commit 71caaad46bf285681d4921db796b81746324ff29 +Author: Bert Vermeulen +Date: Tue Nov 27 00:50:51 2012 +0100 + + serial: allow for extra rts and dtr options in conn string + + Options in addition to the usual "9600/8n1" syntax start with a + slash, and take the form of key=value, where different options are + also separated by slashes. For example: + + "9600/8n1/rts=0/dtr=1" + + This sets RTS low and DTR high. + +commit 700dcd5caa1d7569469cd7823add6ffd2ed5a2ee +Author: Uwe Hermann +Date: Mon Nov 26 17:01:15 2012 +0100 + + serial: Initial code for setting DTR/RTS. + + Currently disabled until option parsing is in place. + +commit 6b7ace4832b3b574399098de2ad4f4bd0f35a14e +Author: Petteri Aimonen +Date: Thu Nov 22 23:15:27 2012 +0200 + + Add compress option to input/vcd. + +commit 904735876118f0ff00ae34e1dbdb80dba752bf2d +Author: Alexandru Gagniuc +Date: Wed Nov 21 19:33:55 2012 -0600 + + radioshack-dmm: Be more verbose with packet checks + + Add sr_spew() messages to state why the packet was found to be invalid. + + Signed-off-by: Alexandru Gagniuc + +commit 2ecc5d432fd17127fd221ca4940f9617569911d1 +Author: Alexandru Gagniuc +Date: Wed Nov 21 19:30:26 2012 -0600 + + radioshack-dmm: Check for valid mode before calculating checksum + + The packet mode byte is akin to a signature. If that is invalid, there's + no point in calculating the checksum, so check the mode first. + + Signed-off-by: Alexandru Gagniuc + +commit 54be7c005ed9f1f0eab80d1d1de528c8e8d7ce49 +Author: Alexandru Gagniuc +Date: Wed Nov 21 19:19:58 2012 -0600 + + radioshack-dmm: Improve serial detection + + For device detection, use serial_stream_detect() instead of + serial_readline() + custom logic. + + Signed-off-by: Alexandru Gagniuc + +commit 551c3d8ce36bebe02765c76ee4d04f4e700d61b2 +Author: Alexandru Gagniuc +Date: Wed Nov 21 19:18:21 2012 -0600 + + serial.c: Sanitize serial_stream_detect + + Print the timeout in miliseconds, not microseconds. + Only calculate elapsed time once oer loop. + + Signed-off-by: Alexandru Gagniuc + +commit 8be8746951e5538147370d9871a4c1ed0268db52 +Author: Petteri Aimonen +Date: Wed Nov 21 17:03:49 2012 +0200 + + Improve compatibility with various kinds of VCD files. + +commit 0157808d740ec11f3a94f2d147b4429bd2a9954d +Author: Petteri Aimonen +Date: Wed Nov 21 16:28:55 2012 +0200 + + Add downsample and skip parameters to input/vcd. + +commit 61a429c963fb21c3d8cb8e9166d621526724b714 +Author: Petteri Aimonen +Date: Tue Nov 20 22:24:17 2012 +0200 + + VCD data parsing + +commit 99eaa20695b2e6c41721072c84215331bbd3f3bf +Author: Petteri Aimonen +Date: Tue Nov 20 21:03:06 2012 +0200 + + Beginnings of VCD input module. + + File header parsing implemented. + Data parsing not yet implemented. + +commit 8c012adbc15fcb00aee23f472b08b108d46b818b +Author: Petteri Aimonen +Date: Tue Nov 20 21:02:14 2012 +0200 + + Add support for fs and ps to sr_parse_period. + + These time units are used in VCD files. + +commit ac913e5c3522fcf5a5633eaa8e19f6579dda554c +Author: Uwe Hermann +Date: Wed Nov 14 18:38:26 2012 +0100 + + Add Metex 14-byte ASCII protocol parser. + +commit 90165efe55de692e6329d0820d867d0887db5663 +Author: Bert Vermeulen +Date: Fri Nov 16 15:26:17 2012 +0100 + + ols: if no serial port specified, this driver is not used. + +commit 766456be1c144b0985807279ffd697a395083cae +Author: Uwe Hermann +Date: Wed Nov 14 18:35:37 2012 +0100 + + Move serial_stream_detect() to serial.c. + +commit e42b82a66f4a16dcc17ccf018637daa7a1a0df51 +Author: Uwe Hermann +Date: Wed Nov 14 18:29:27 2012 +0100 + + configure.ac: Update NEED_SERIAL list. + +commit 4da1a800df3ce7776b3a533308dabf484fae9a34 +Author: Uwe Hermann +Date: Wed Nov 14 18:20:13 2012 +0100 + + serial: Compile-fix for Windows/MinGW. + +commit 6bef68a7e1abd472753e16e2188aadd36650c163 +Author: Uwe Hermann +Date: Mon Nov 5 23:25:59 2012 +0100 + + tekpower-dmm: Cosmetics. + +commit 2546b05c801c90a84fb2e6690d8c253c6576b4ab +Author: Alexandru Gagniuc +Date: Fri Nov 2 10:53:06 2012 -0500 + + tekpower-dmm: Improve serial detection. + + Serial detection was using serial_readline, which stripped carriage + return from the packets. This made for a very unreliable detection + mechanism. + + Switch to a timeout-based detection mechanism that parses the data + as it comes in. This also allows us to stop parsing once we found + our first valid packet. + + Signed-off-by: Alexandru Gagniuc + +commit bda8fc98b1eae0fbd7c57b9da705bfce4384756a +Author: Uwe Hermann +Date: Wed Nov 14 15:18:02 2012 +0100 + + Drop obsolete genericdmm driver. + +commit d35afa87c9e6d40d34154a784b62deeaffc3ad80 +Author: Bert Vermeulen +Date: Mon Nov 12 12:50:42 2012 +0100 + + tekpower-dmm: use new serial API + +commit 401476daaf3006c0362bdeb7ee99f1d9b9b78809 +Author: Bert Vermeulen +Date: Mon Nov 12 12:41:10 2012 +0100 + + radioshack-dmm: use new serial API + +commit 19ee7dff78f7195bfc82f14ef659751cdd0f6476 +Author: Bert Vermeulen +Date: Mon Nov 12 03:00:32 2012 +0100 + + tondaj-sl-814: use new serial API + +commit f306ca61f65cb703b38e447bbd3dbea3ff9c57c0 +Author: Bert Vermeulen +Date: Mon Nov 12 02:48:04 2012 +0100 + + colead-slm: use new serial API + +commit 109a3ba4137874373b249fee90055373e13a2a1a +Author: Bert Vermeulen +Date: Mon Nov 12 02:25:37 2012 +0100 + + agilent-dmm: use new serial API + +commit 58d03f034f0d85a2840ed0bc9ea66506b5a1fa1b +Author: Bert Vermeulen +Date: Mon Nov 12 02:25:17 2012 +0100 + + fluke-dmm: use new serial API + +commit 530f201eb8280b343529747107c15e91c2ab0623 +Author: Bert Vermeulen +Date: Mon Nov 12 02:24:47 2012 +0100 + + ols: use new serial API + +commit 299bdb249ecaa9f42900a8f1a0fa0404d619c27a +Author: Bert Vermeulen +Date: Sun Nov 11 20:38:47 2012 +0100 + + serial: revamp internal API + + The only thing to get passed around now is the struct sr_serial_dev_inst + pointer. This should make things more portable as well. + +commit de6e0eca95f5d89e12b0940f2ecf59ab563cb725 +Author: Uwe Hermann +Date: Sun Nov 11 19:40:14 2012 +0100 + + sigma/la8/demo: s/SR_PROBE_ANALOG/SR_PROBE_LOGIC/. + +commit 472bbb464bf9522ed757826ec590aaf8bab087b5 +Author: Uwe Hermann +Date: Sun Nov 11 13:17:44 2012 +0100 + + alsa: Use message logging helpers. + +commit a0a23863daecce5b7aaff352ad2bc5f47eb9bd0b +Author: Uwe Hermann +Date: Sun Nov 11 13:11:58 2012 +0100 + + output/gnuplot: Drop obsolete code. + +commit 121c18854a4327aedbc46378638d1bb20d67b2d8 +Author: Uwe Hermann +Date: Sun Nov 11 13:10:29 2012 +0100 + + contrib/Makefile.am: Add missing files. + +commit a885ce3ee9ed770594d5b231f6dec0b740bba03b +Author: Uwe Hermann +Date: Sun Nov 11 12:44:16 2012 +0100 + + Various subsystems: Use message logging helpers. + +commit a944a84b17c5f5544b45e27dc07d7f60a4fd6ba8 +Author: Uwe Hermann +Date: Sun Nov 11 09:36:21 2012 +0100 + + Output modules: Use message logging helpers. + +commit 8e7f1cfd99a37d21ebe3365067cd21b76e866d1c +Author: Uwe Hermann +Date: Sun Nov 11 09:20:08 2012 +0100 + + Input modules: Use message logging helpers. + +commit 64d33dc28e0e815cade56feb65f26a3d36421a96 +Author: Uwe Hermann +Date: Sun Nov 11 09:30:42 2012 +0100 + + All drivers: Drop unneeded comments. + +commit fa7730623a82bd1703b0d91adb97693e29b2a70c +Author: Uwe Hermann +Date: Sun Nov 11 09:28:30 2012 +0100 + + victor-dmm: Cosmetics. + +commit 5df7b201563f46b5620a027c59cb054f8887966b +Author: Bert Vermeulen +Date: Sun Nov 11 03:27:51 2012 +0100 + + serial: avoid Cyrillic conversion specifiers + +commit fe1c50fba6b96400d9cc83c852a59f9ac9f2f148 +Author: Bert Vermeulen +Date: Sun Nov 11 03:10:29 2012 +0100 + + ols: fix device discovery + +commit a99e0d2a0c9d1bb4db5623ba50f83486238ee793 +Author: Alexandru Gagniuc +Date: Fri Nov 9 19:52:45 2012 -0600 + + ols: Do not randomly probe serial ports + + ols driver used to probe a series of available serial ports obtained + by regexp matching of common serial port names. + There are a number of problems with this approach: + 1. It will probe all serial devices, including devices that do not + like to be probed, potentially causing them to act up. + 2. It will try to probe serial ports which may already be opened in + other applications for other purposes. + 3. It assumes the naming of the serial ports is set in stone, and + creates an unnecessary OS-specific list. + 4. It produces unnecessary debug output even when an OLS device is + not connected. + 5. etc... + + Do not implicitly probe serial ports. Only probe the port specified + by the frontend, if any; otherwise, just quit. + Also get rid of all functionality in serial.c which was designed + specifically for random probing. + + Signed-off-by: Alexandru Gagniuc + +commit 2244356d1069c5b13fe3b728a421750900deaafe +Author: Bert Vermeulen +Date: Sun Nov 11 02:11:49 2012 +0100 + + comment fix + +commit 56eb9f95ba8828aa643eb836e62d3d7c9a0bdd33 +Author: Uwe Hermann +Date: Sat Nov 10 19:39:37 2012 +0100 + + link-mso19: Use message logging helpers. + +commit 92bcedf6e861a11d0b46d2bf5bc7c221b20baa7b +Author: Uwe Hermann +Date: Sat Nov 10 18:24:05 2012 +0100 + + demo: Use message logging helpers. + +commit e98b7f1be0a97207b9a0b4d7c9a8d397fb542eb1 +Author: Uwe Hermann +Date: Sat Nov 10 18:19:30 2012 +0100 + + hantek-dso: Use message logging helpers. + +commit 47f4f073e0a7fe68a55001180c3c9092551f2108 +Author: Uwe Hermann +Date: Sat Nov 10 13:42:00 2012 +0100 + + asix-sigma: Use message logging helpers. + +commit 936e27f19712572d5a1c506dc0ef59aad8743fc4 +Author: Uwe Hermann +Date: Sat Nov 10 13:32:46 2012 +0100 + + radioshack-dmm: Use new file naming conventions. + +commit 4e172b8f8d725667d632484f340b1eec47597097 +Author: Uwe Hermann +Date: Sat Nov 10 13:30:02 2012 +0100 + + radioshack-dmm: Move some stuff out of .h file. + + Most of the enums and #defines are not needed in multiple files, just + put them in the respective .c file where they're used. + +commit ba6383f85574e4e374a141ca88979db86fe2893d +Author: Uwe Hermann +Date: Sat Nov 10 12:51:57 2012 +0100 + + radioshack-dmm: Cosmetics, coding-style, cleanups. + + Also, drop some uneeded code and simplify some parts. + +commit 302c4b5ab54625f3f94af3efe3ee3acf9cea8114 +Author: Uwe Hermann +Date: Sat Nov 10 01:42:32 2012 +0100 + + serial: Deduplicate log messages a bit. + +commit c073af80f89d8bce8675068d084c96e0cf37bb4f +Author: Uwe Hermann +Date: Fri Nov 9 03:40:53 2012 +0100 + + Add initial Tondaj SL-814 protocol handling. + +commit aa2af32432b3410421a89303ef48cc990ff39db9 +Author: Uwe Hermann +Date: Fri Nov 9 03:33:05 2012 +0100 + + tondaj-sl-814: Initial driver skeleton. + +commit 63f7cb9791d2b5fbd32a897e94790c9a6def8462 +Author: Bert Vermeulen +Date: Wed Nov 7 01:25:10 2012 +0100 + + agilent-dmm: use standard serial_readline() + +commit 318dd53c7093aa2ea26e0d246b23ffeb77b46707 +Author: Bert Vermeulen +Date: Wed Nov 7 01:24:23 2012 +0100 + + serial_readline() now terminates on and strips CR and/or LF + +commit b87f8504dc82eab0155263887662ac14c252414d +Author: Bert Vermeulen +Date: Wed Nov 7 01:23:24 2012 +0100 + + g_get_monotonic_time() takes a signed int64 + +commit 74ac7d7f735011012fb942577e38ddfe64738c8d +Author: Bert Vermeulen +Date: Wed Nov 7 00:46:30 2012 +0100 + + agilent-dmm: no need to specify a serialcomm scan parameter + + It's always 9600/8n1 anyway. + +commit 33e8a3c5258d9ac92841cf47abd1e1f7528d640b +Author: Bert Vermeulen +Date: Wed Nov 7 00:39:46 2012 +0100 + + chronovu-la8: not a bug if an unused driver gets asked to clean up + +commit ff945683664a916566289f9bdbb371dfba6f3176 +Author: Bert Vermeulen +Date: Tue Nov 6 19:37:33 2012 +0100 + + victor-dmm: add protocol decoder + +commit 642e9d623cebda60d53d13cf637c42eab8df3c73 +Author: Bert Vermeulen +Date: Tue Nov 6 19:32:53 2012 +0100 + + more deconstifying sr_dev_inst for dev_acquisition_stop() + +commit 7a36037546aaf11b91ff5d63fbd571e15407e357 +Author: Bert Vermeulen +Date: Tue Nov 6 15:14:34 2012 +0100 + + victor-dmm: add basic USB driver skeleton + +commit 69b07d14db24055d23bbb4c4cc718ec073ece0b7 +Author: Bert Vermeulen +Date: Tue Nov 6 15:02:37 2012 +0100 + + allow for intermediate stage in stopping acquisition + + In the case of USB drivers, a driver's dev_acquisition_stop() cannot + simply remove its fd sources from the session and close its devices: + a USB transfer might still be underway, and it needs to be finished + (and its memory freed) properly. + + An sr_dev_inst->status value is added: SR_ST_STOPPING, which should + be set when the driver's dev_acquisition_stop() is called, and acts + as a marker for the USB event handler to wind up its operations. + + In order for dev_acquisition_stop() to be able to set the sdi status, + however, it needs to be unconstified. + +commit ac3898d2d09f54862522967f10487a0708df810c +Author: Bert Vermeulen +Date: Fri Nov 2 20:47:06 2012 +0100 + + victor-dmm: Initial driver skeleton. + +commit 0ab0cb942f59e2232921c10d79ed43cad6cf3153 +Author: Toshiaki Yoshida +Date: Mon Nov 5 16:06:14 2012 +0900 + + zeroplus-logic-cube: Fix samplerate and trigger + + - Default to 1MHz. + The default sample rate is the lowest frequency (100Hz), + but it takes a very long time until 128K memory is full. + + - Fix the 1MHz setting. + + - Use samplerate list. + + - Fix 10MHz frequency. + + - Fix trigger. + + - Change the size of memory according to the number of samples. + + - Add pre-trigger (capture ratio) setting. + + - Fix the first acquisition after power on. + +commit 41d9427f27f8d175fb0a0259c4e4507ca818b616 +Author: Uwe Hermann +Date: Fri Nov 2 23:44:09 2012 +0100 + + uni-t-dmm: Use new USB helper functions. + +commit 0c632d36be4b7b34addadf0649fea95173fe0f9a +Author: Uwe Hermann +Date: Fri Nov 2 21:04:21 2012 +0100 + + genericdmm: Factor out USB functions. + + Move sr_usb_connect() and sr_usb_open() to hardware/common/usb.c in a + slightly more generic form and add more error checks and logging. + + Let genericdmm use the new/moved functions. + +commit 538ac9a91e5efb65e3c28d5a9af16c6fcfd63872 +Author: Bert Vermeulen +Date: Fri Nov 2 20:43:49 2012 +0100 + + colead-slm: fix sloppy driver context handling + +commit f18297a5fd88f09a9e1a1330777f6db6dfe8999a +Author: Uwe Hermann +Date: Fri Nov 2 19:05:53 2012 +0100 + + HACKING: Document enum setup. + +commit 24d04d1e3de61cc3f1f12c3091bf393ee2dac8de +Author: Alexandru Gagniuc +Date: Fri Nov 2 11:56:56 2012 -0500 + + Avoid future ABI breakage by hardcoding enum values. + + Whenever we added a field to the enums in libsigrok.h, we were running + the risk of breaking ABI compatibility. Any reordering of existing values + or the addition of entries other than at the bottom of the list would + cause an ABI breakage. + + By hardcoding the values we ensure that any added field will have an + unused value, and will not take a value previously used by a different + flag. By doing this, we avoid confusing frontends compiled with an + earlier API. + + We use 10000 as the first entry of each enum, and each "category" gets + an explicit number (10000, 20000, 30000, and so on). + + Also avoid making the first value of an enum zero. A value of zero is + used as terminator item in some lists. + + Remove explicit "DUMMY" (terminator) enum entries, they're not needed. + + Signed-off-by: Alexandru Gagniuc + +commit 83e3c368c67d6bbc86015fc47a7f7e39160b3baa +Author: Uwe Hermann +Date: Fri Nov 2 18:49:00 2012 +0100 + + serial: Output successful open and the FD. + +commit 20af610683e4d7fc22deaa26e7b92730057405cd +Author: Uwe Hermann +Date: Fri Nov 2 18:44:52 2012 +0100 + + serial: Fix two segfaults. + +commit c485db908ae2c8f3f85eb70c2a5f86bcc2cab975 +Author: Uwe Hermann +Date: Fri Nov 2 18:35:08 2012 +0100 + + serial: Fix some sr_err() items. + +commit 43d8eaf601416ff5f06eca4d1433cb4381821081 +Author: Uwe Hermann +Date: Fri Nov 2 18:16:58 2012 +0100 + + genericdmm: Drop left-over entry. + +commit 441b80035e0f64e4149ae9d85f2d96fee6cde5bd +Author: Uwe Hermann +Date: Fri Nov 2 18:05:18 2012 +0100 + + genericdmm: Drop some dead code. + +commit b19f4622b6a1d21b00bd93d99e10bb4565ed7af0 +Author: Uwe Hermann +Date: Fri Nov 2 15:58:54 2012 +0100 + + serial: More error-checking & logging, add baudrates. + + This mostly affects the non-Windows code so far, the rest will follow. + +commit d7c776b9ff604bc05ff59ca69539e2179180f5df +Author: Uwe Hermann +Date: Fri Nov 2 15:57:21 2012 +0100 + + serial: Add missing "break"s. + + This would otherwise cause bugs when e.g. asking for 2 stopbits. + +commit a8d09e13264be77bcf1fe53202880ce4c26e39f9 +Author: Bert Vermeulen +Date: Fri Nov 2 15:21:43 2012 +0100 + + colead-slm: SL-5868P support + +commit fc19c288b5ee32618a10f73fda7475b9a5a8ac6d +Author: Bert Vermeulen +Date: Fri Nov 2 15:20:10 2012 +0100 + + add support for sound pressure level measurements + +commit 258eeb77b88852b743e08a751455a2c1965e4db1 +Author: Bert Vermeulen +Date: Fri Nov 2 15:19:01 2012 +0100 + + output/analog: add support for sound pressure level + +commit bde4f4296d8d7a3653c93fc7034e6f7c019e1255 +Author: Bert Vermeulen +Date: Thu Nov 1 23:38:10 2012 +0100 + + analog: if no MQ unit was set of recognized, just print the value + +commit 4d729ddcaf395de1d04af93dd5ea569cfbc17de4 +Author: Bert Vermeulen +Date: Mon Oct 29 22:33:47 2012 +0100 + + colead-slm: Initial driver skeleton. + +commit 8c1adf3738b68912ab8cf4308341b82dbc83056a +Author: Uwe Hermann +Date: Thu Nov 1 15:58:09 2012 +0100 + + Rework FS9721 parser. + + Merge parts of the tekpower-dmm code (the chip of the TekPower + TP4000ZC seems to be an FS9721_LP3 too) and rework parts of the functions. + + Adapt the tekpower-dmm and uni-t-dmm code accordingly. + +commit be5c1d3b52a4c774bdd182ba54225a234d55336f +Author: Alexandru Gagniuc +Date: Mon Oct 29 23:42:10 2012 -0500 + + tekpower-dmm: Use generic fs9721 parser + + Replace the parser with the fs9721 parser, which is just an adapted + version of this parser. + + Signed-off-by: Alexandru Gagniuc + +commit db7d0626c918209db0ba5dc6e896232c8c2e4f6c +Author: Uwe Hermann +Date: Tue Oct 30 20:30:25 2012 +0100 + + Remove 'float' output module. + + This has been replaced by the 'analog' output module. + +commit 886a52b6fbffb0fd06849c928cf9fd31a0d4657b +Author: Uwe Hermann +Date: Tue Oct 30 20:20:22 2012 +0100 + + Return SR_ERR_MALLOC upon allocation errors. + + Add some TODOs. + +commit 6f22a8ef2ccf7091324b41b553632695507215a7 +Author: Uwe Hermann +Date: Tue Oct 30 19:59:21 2012 +0100 + + Factor out serial_readline() to serial.c. + + Only one (slightly different) variant remains in agilent-dmm, this will + be merged soon too, though. + +commit 2980cc249494ac8335296fae7beac52fb078b22b +Author: Uwe Hermann +Date: Tue Oct 30 18:56:04 2012 +0100 + + genericdmm/victor-dmm: Use message logging helpers. + +commit dccbd0ede0013318da866ae941c64e23ad3e2027 +Author: Uwe Hermann +Date: Tue Oct 30 18:52:20 2012 +0100 + + radioshack-dmm: Use message logging helpers. + +commit 38d326e879c6e1bb7d4a11682c262ca838a7dde5 +Author: Uwe Hermann +Date: Tue Oct 30 18:50:15 2012 +0100 + + agilent-dmm: Use message logging helpers. + +commit 31d84da3a22cc6fc9b2226ab3863e9235a3d5b87 +Author: Uwe Hermann +Date: Tue Oct 30 18:48:33 2012 +0100 + + fluke-dmm: Use message logging helpers. + +commit 6ac5f8922e63d1f584a69969190af0389a88d812 +Author: Uwe Hermann +Date: Tue Oct 30 14:23:05 2012 +0100 + + uni-t-dmm: Simplify subdriver setup. + + So far, it seems we can make this work with just hw_init() needing to + be subdriver-specific (it will point 'di' to the respective per-subdriver + entry), the rest of the API functions can then use a strcmp() on di->name to + learn which subdriver they belong to. + +commit fdbcb86dba17eec8e1492736adf1aec45e746c00 +Author: Uwe Hermann +Date: Tue Oct 30 13:11:27 2012 +0100 + + Draft: Make UT61D and VC-820 "first-class" drivers. + + The 'uni-t-dmm' driver/directory will not appear as a "driver" to + frontends anymore, it's just an internal thing. + + The frontends will see a uni-t-ut61d and voltcraft-vc820 driver now, + with the correct names and parsers etc. attached to them. + + This is not fully finished yet, but it's a start (and works mostly): + + $ sigrok-cli -D + The following devices were found: + UNI-T UT61D with 1 probe: P1 + Voltcraft VC-820 with 1 probe: P1 + + $ sigrok-cli --driver voltcraft-vc820 -D + The following devices were found: + Voltcraft VC-820 with 1 probe: P1 + + $ sigrok-cli --driver uni-t-ut61d -D + The following devices were found: + UNI-T UT61D with 1 probe: P1 + + # Now attaching a UNI-T UT61D device via USB. + + $ sigrok-cli --driver uni-t-ut61d --samples 3 -O analog + P1: -0.017800 V DC + P1: -0.017600 V DC + P1: -0.017700 V DC + + # Now attaching a Voltcraft VC-820 device via USB instead. + + $ sigrok-cli --driver voltcraft-vc820 --samples 3 -O analog + P1: -0.319200 V DC + P1: -0.319300 V DC + P1: -0.319300 V DC + +commit 4ca378df8874b8e0bfd323c725c019c3968c0e1e +Author: Bert Vermeulen +Date: Mon Oct 29 22:10:05 2012 +0100 + + don't use deprecated g_thread_init/_create + +commit 7445ed9158294e39ec697f54944e19a4b9636a6a +Author: Bert Vermeulen +Date: Mon Oct 29 22:08:34 2012 +0100 + + require glib version >= 2.32 + + This allows us to do away with a few deprecated g_thread functions + in demo.c which throw deprecation warnings since glib 2.32.0. + +commit 015f1508ad57e1ace60965952389a0b83c271178 +Author: Uwe Hermann +Date: Mon Oct 29 15:20:17 2012 +0100 + + uni-t-dmm: Voltcraft VC-820 draft support. + + This is commented out so far, will be implemented properly soon. + +commit 6c701476ad76c648e9b367ac340c2dd0063e4ed0 +Author: Uwe Hermann +Date: Mon Oct 29 12:02:05 2012 +0100 + + Add protocol parser for FS9721_LP3/FS9721B. + + The Fortune Semiconductor FS9721_LP3 and FS9721B/Q100 DMM chips are very + similar and the protocol looks identical. + + Tested on a Voltcraft VC-820 (FS9721_LP3) with the uni-t-dmm driver + (needs some small changes, tbd). + +commit a28dac0a7307f222e8e145ccc8188519206d0c4c +Author: Bert Vermeulen +Date: Mon Oct 29 11:54:20 2012 +0100 + + fluke-dmm: code cleanup + +commit 2c04dede20e1e69420d872878e8d04792333626c +Author: Bert Vermeulen +Date: Mon Oct 29 11:50:34 2012 +0100 + + Fluke 287/289: support for dBu/dBV measurement units + +commit 79081ec80c79801c439a1a3756cf5426af0739b8 +Author: Uwe Hermann +Date: Sat Oct 27 22:41:50 2012 +0200 + + Initial support for UNI-T DMMs. + + This is not yet fully finished, but works for most use-cases. + + Tested with a UNI-T UT61D using the UT-D04 USB/HID cable (new version). + +commit 45e080b60b2526fd9723dd822215294f973bff2a +Author: Uwe Hermann +Date: Sat Oct 27 22:21:07 2012 +0200 + + la8: Rename driver.[ch] to protocol.[ch]. + +commit f3a35908ef0d9fd56ec170d7f1bafff50c3432e2 +Author: Uwe Hermann +Date: Sat Oct 27 21:27:15 2012 +0200 + + la8: Adapt to new driver conventions. + +commit 9eb2bb960181302893e7c9032dbaba7763132174 +Author: Uwe Hermann +Date: Sat Oct 27 21:07:39 2012 +0200 + + configure.ac: Cosmetics. + +commit bbabddbd64d07811120230203d453c65ac53ce57 +Author: Uwe Hermann +Date: Sat Oct 27 21:03:02 2012 +0200 + + tekpower-dmm: Cosmetics, coding-style, consistency fixes. + +commit 7dc55d930f87433fb35ebf6f18f767eddb7e8a17 +Author: Alexandru Gagniuc +Date: Sat Oct 20 20:39:37 2012 -0500 + + Add support for the TekPower TP4000ZC DMM. + + Also known as Digitek DT4000ZC. + + Signed-off-by: Alexandru Gagniuc + +commit 2bba3dd3a836f4a6d497709d321557a48e6425a3 +Author: Uwe Hermann +Date: Thu Oct 25 23:42:20 2012 +0200 + + HACKING: "Adding a new hardware driver" chapter. + +commit d36777dbf5f61027e404076f1564d769bfc5f3ad +Author: Alexandru Gagniuc +Date: Wed Oct 24 16:48:41 2012 -0500 + + .gitignore: (Trivial) Ignore KDevelop project files + + Signed-off-by: Alexandru Gagniuc + +commit 6f669a68e77a8a8fe4e62d66851cd894d72538dd +Author: Uwe Hermann +Date: Wed Oct 24 02:51:17 2012 +0200 + + configure.ac: Small consistency fixes. + +commit 545f9786390a89b8bb6868907afa555fc0a6ece4 +Author: Uwe Hermann +Date: Wed Oct 24 00:41:21 2012 +0200 + + config.h usage cleanups. + + - Drop config.h #include from files that don't actually use any of + its contents (at the moment). + + - Add comment for those that do need it. + +commit afe2f28e65f3c3d9b510f101d6cd76c59794cd17 +Author: Uwe Hermann +Date: Mon Oct 22 02:32:53 2012 +0200 + + Doxygen: Explain init/shutdown, add small example. + +commit 1f345a21d24e52f482a06da9e434f751abdff203 +Author: Uwe Hermann +Date: Mon Oct 22 01:21:20 2012 +0200 + + Doxygen: libsigrok.h: Explain #include file usage. + +commit a02d77bce91771faf3581beed7af747d9f046c72 +Author: Uwe Hermann +Date: Mon Oct 22 01:13:36 2012 +0200 + + Doxygen: Various fixes in libsigrok.h. + +commit 393fb9cb18c5746d8567c9cf74b872804043345a +Author: Uwe Hermann +Date: Mon Oct 22 00:30:12 2012 +0200 + + Doxygen: Add @file items for the relevant files. + + These short descriptions are shown in the "Files" section of the + Doxygen output. + +commit 777e2035d8293b4636f6bf37afd92e18ced3720e +Author: Uwe Hermann +Date: Sun Oct 21 23:43:41 2012 +0200 + + Doxygen: Fix grouping of session_file.c functions. + + s/@ingroup/@addtogroup/ and s/grp_device/grp_session/. + +commit 6b2d8d3e5c4762cdafd847f9613d3f7b855927ab +Author: Uwe Hermann +Date: Sun Oct 21 23:24:42 2012 +0200 + + Doxygen: TODO cleanup, use @todo where needed. + + Turn TODOs which should be user-visible into @todo so that Doxygen + shows them in the function docs, and also on the special "Todo List" page. + + Those TODOs that should not be in the Doxygen docs are moved out of the + /** */ comment blocks. + + Also fix some comments/items, and remove some obsolete ones. + +commit 3c0839d52475605d61ce385eda95f824fc448c88 +Author: Uwe Hermann +Date: Sun Oct 21 17:49:22 2012 +0200 + + Doxygen: Various improvements in libsigrok.h. + + - Turn SR_OK/SR_ERR_* and SR_LOG_* into proper enums. + + - Use /**< Foo. */ for Doxygen comments that are on the same line as + the (e.g.) enum entry they document. If the comment is not on the + same line (but rather directly above the enum entry) a simple + /** Foo. */ comment is sufficient. + + - Use /** */ instead of /* */ in some places, so that Doxygen actually uses + the respective comments. + + - Various smaller cosmetic fixes or cleanups. + +commit 9c5332d2915ba374775196b7e3624857d320b60a +Author: Uwe Hermann +Date: Sun Oct 21 16:52:56 2012 +0200 + + Doxygen: Fix a bunch of warnings and outdated docs. + +commit f21193fa03c7fe1ff6708e22d7aeb318b5539191 +Author: Uwe Hermann +Date: Sun Oct 21 16:36:23 2012 +0200 + + Doxygen: Move error handling stuff to error.c. + + Also, add an overview mini-section to the main page instead. + +commit 7b870c38e3040fec1165a623ae3986e4fb342218 +Author: Uwe Hermann +Date: Sun Oct 21 16:13:36 2012 +0200 + + Doxygen: Initial groups and topic short descriptions. + +commit b4bd70889f3009f5d836a9bf701725a6aceac039 +Author: Uwe Hermann +Date: Fri Oct 19 10:07:22 2012 +0200 + + Doxygen: Mark non-public stuff for exclusion. + + - /** @private */ can be used for functions, and /** @cond PRIVATE */ and + /** @endcond */ for variables or #defines. + + - Document the above in HACKING. + +commit 5b30cca719b737fed96c00e1b7a5094770d9d815 +Author: Uwe Hermann +Date: Fri Oct 19 10:06:45 2012 +0200 + + Doxygen: Add initial main page documentation section. + +commit d5f1d5382d2b2cb8999fefaf4e6e7af8067d110f +Author: Uwe Hermann +Date: Fri Oct 19 10:01:45 2012 +0200 + + Doxyfile: Various additions/improvements. + + - Show a short project description, the libsigrok version (x.y.z or + "unreleased development snapshot"), and the sigrok logo in the + Doxygen output. + + - Ignore a bunch of files and directories which don't contain public + libsigrok API anyway. + + - Remove the SR_API prefix from the Doxygen output (all + functions/symbols in the output are part of the public API anyway). + + - Various changes of settings to get nicer and more useful output. + +commit e61b4fa0d0f905ee6eb4aa7655ee8189b155dfbf +Author: Uwe Hermann +Date: Fri Oct 19 00:30:31 2012 +0200 + + Doxygen: Add sigrok logo PNG for use by Doxygen. + +commit c63eac737c173cfb7d4ffd939a68f8ae8801b513 +Author: Uwe Hermann +Date: Thu Oct 18 22:51:16 2012 +0200 + + Doxyfile: Update to what doxygen 1.8.1.2 generates. + + The new version has a number of neat improvements/features we could use. + +commit 296821683df6ed064f036205c968e80549429456 +Author: Uwe Hermann +Date: Mon Oct 22 11:54:40 2012 +0200 + + Makefile.am: Add missing backslash. + +commit 8e2d43cc97438e092e1df3ad344c64032b56564e +Author: Uwe Hermann +Date: Mon Oct 22 10:17:38 2012 +0200 + + backend.c: Revert accidentally committed test code. + +commit 589a10135a5b811e16bdbc73b276d13884c27fa4 +Author: Bert Vermeulen +Date: Sun Oct 21 01:34:34 2012 +0200 + + clean up autoconf/autobuild scripts + +commit d11d606626a2ce9359ed2b5395fe4b998604da92 +Author: Uwe Hermann +Date: Sun Oct 21 22:41:39 2012 +0200 + + We now require libusb >= 1.0.9. + + This is due to the use of libusb_error_name(). + +commit c46762a285d7c844a771f5c1f0ad2447a00906b3 +Author: Uwe Hermann +Date: Sun Oct 21 22:40:43 2012 +0200 + + sr_init/sr_exit: Improve docs, add error checks. + +commit 785b9ff290cbdb86e7d0b0280c33b43faf9c0518 +Author: Peter Stuge +Date: Sun Oct 21 20:23:36 2012 +0200 + + Add and init libusb_context * in struct sr_context when using libusb-1.0 + + This allows hardware drivers to use a common libusb_context. + +commit b8072700c1bc7d13ba004fd897668b56cec4ac62 +Author: Peter Stuge +Date: Sun Oct 21 20:23:14 2012 +0200 + + Add a struct sr_context * parameter to sr_init() and sr_exit() + +commit 026c822d8c6d39a2b0e976b02c16bb991431700b +Author: Uwe Hermann +Date: Fri Oct 19 10:35:11 2012 +0200 + + Move 'struct drv_context' to sigrok-internal.h. + + It's not meant to be visible to frontends. + +commit 7c41dc477402c09141c5d478dff493f8efb81264 +Author: Alexandru Gagniuc +Date: Fri Oct 19 20:40:50 2012 -0500 + + radioshack-dmm: Implement support for "LOGIC" mode + + LOGIC mode sends the following data: + V < 0 : actual voltage + 0 <= V < 1 : LOW + 1 <= V < 2 : actual voltage + 2 <= V : HIGH + + We follow the same idea, and set our unit to BOOLEAN for the crazy + case (HIGH or LOW). + + Signed-off-by: Alexandru Gagniuc + +commit dfd8f56ef4a0ee1c353db5078d6d7d8b901ec21b +Author: Alexandru Gagniuc +Date: Fri Oct 19 20:31:19 2012 -0500 + + libsigrok: (Trivial) fix packet type in datafeed_dump + + datafeed_dump would print SR_DF_META_LOGIC when a SR_DF_META_ANALOG + was recieved. Fix that. + + Signed-off-by: Alexandru Gagniuc + +commit 0f7083019449c1d88a5916bae766f3e51f7f8373 +Author: Alexandru Gagniuc +Date: Fri Oct 19 17:50:20 2012 -0500 + + libsigrok: (Trivial) Add support for 2400 baud + + Signed-off-by: Alexandru Gagniuc + +commit 777bbd5b98873ec20c58613e4dbb48a1836174bd +Author: Bert Vermeulen +Date: Thu Oct 18 22:43:03 2012 +0200 + + add SR_HWOPT_* documentation + +commit fe31f8b9f9b743bf47794842b70e56e3b2dda883 +Author: Bert Vermeulen +Date: Tue Oct 16 23:32:39 2012 +0200 + + fluke-dmm: add support for Fluke 187 + +commit 796a79eb75e35fe47becfbf62a840464efbbe96a +Author: Bert Vermeulen +Date: Tue Oct 16 23:31:18 2012 +0200 + + analog: add pretty-printer for dBu and dBV + +commit 6b8692346358362f4b7b004059c62c23f4889410 +Author: Bert Vermeulen +Date: Tue Oct 16 23:28:04 2012 +0200 + + add SR_UNIT_DECIBEL_VOLT (dBu) + +commit d713e561814558d9f07c4186aef35a23df8b8445 +Author: Bert Vermeulen +Date: Tue Oct 16 14:03:40 2012 +0200 + + analog: sane printing of very small and negative values + +commit 8ed262509f6f5e5a3b9a45ae6d116b1c36c750d7 +Author: Uwe Hermann +Date: Tue Oct 16 14:48:39 2012 +0200 + + HACKING: Cosmetics. + +commit 6aff0d16df34c60dada92486db0554ad32e08422 +Author: Uwe Hermann +Date: Tue Oct 16 12:08:01 2012 +0200 + + Build fix for Windows/MinGW. + + On Window/MinGW 'recv' seems to be already defined in some headers. + Use 'receive' instead, for now. + +commit a2353f6051004634f67505987749d56edbfdfb41 +Author: Uwe Hermann +Date: Tue Oct 16 11:24:03 2012 +0200 + + Re-add HACKING file after repo split. + +commit be8dbf3ab24348fe5cc619eca6a63464e72e6aa2 +Author: Alexandru Gagniuc +Date: Tue Oct 16 01:23:50 2012 -0500 + + radioshack-dmm: (Trivial) Convenience fixes + + While testing the new radioshack-dmm driver with pulseview, I found + a few inconvenients. + + 1. Print an info message when a port is probed, and when a device is + found. This makes it easy to tell if and where the driver is looking. + + 2. num_samples was not reset after the first aquisition, so the + second aquisition would quit right away. Reset num_samples at start + of a new aquisition. + + 3. There's no need to open the serial port RW, so change O_RDWR to + O_RDONLY when opening the port. + + These changes are too trivial to split into different patches. + + Signed-off-by: Alexandru Gagniuc + +commit 7b0a85c81c6bce43ced9bf59d99b3584fd1498d8 +Author: Bert Vermeulen +Date: Mon Oct 15 18:25:48 2012 +0200 + + radioshack-dmm: build fixes + +commit d375b3c3ec01c246dbf6f0827c33aafc0953431b +Author: Alexandru Gagniuc +Date: Mon Oct 15 01:17:32 2012 -0500 + + radioshack-dmm: Add support for Radioshack 22-812 DMM + + Signed-off-by: Alexandru Gagniuc + +commit b82a17d370a74dc7d4788f343f0ef050490e057f +Author: Alexandru Gagniuc +Date: Mon Oct 15 01:14:04 2012 -0500 + + libsigrok.h: Add measured quantity and units used by Radioshack 22-812 + + The Radioshack 22-812 can measure parameters such as transistor gain, + dbm, etc. Add those to libsigrok.h. + + The SR_UNIT_UNITLESS is for quantities that do not have units. Any + ratio or gain are just factors, whic do not have units. Specifically, + a transistor's gain, or hFE, is a unitless quantity. + + Signed-off-by: Alexandru Gagniuc + +commit e8e9dcdd705c64a8ac1c04bc04d91e1a371e76c8 +Author: Alexandru Gagniuc +Date: Mon Oct 15 01:12:53 2012 -0500 + + serial: (Trivial) add support for 4800 baud + + Signed-off-by: Alexandru Gagniuc + +commit 5fef6b9d6cd17f89a05f8e7a02a8c523e6a2632d +Author: Alexandru Gagniuc +Date: Mon Oct 15 01:11:39 2012 -0500 + + .qitignore: Ignore KDE backup files + + *.kate-swp files can become annoying, so ignore them. + + Signed-off-by: Alexandru Gagniuc + +commit 2b98e0aaab7e83c30fb1f690318584aa0f85b50a +Author: Bert Vermeulen +Date: Mon Oct 15 11:32:36 2012 +0200 + + analog: support AC+DC unit modifier + +commit 17ff11240ee1ed8afd504b84a99990969a75544b +Author: Bert Vermeulen +Date: Mon Oct 8 23:56:06 2012 +0200 + + don't accept numbers as probe identifiers in trigger string + + Only the probe name, as supplied by the device driver, is accepted. + +commit 33df15f14440397bb8358fbf0939588c1b410e0c +Author: Uwe Hermann +Date: Thu Oct 11 23:46:30 2012 +0200 + + Quick workaround for g_match_info_unref(). + +commit 4a1c927fd6c47831b984d9d7f4757408cf6fb800 +Author: Uwe Hermann +Date: Wed Oct 10 23:08:32 2012 +0200 + + README: Add status, update URL, small fixes. + +commit a5b2293fa84c076236fd3a6c7202ad4996ba16fd +Author: Bert Vermeulen +Date: Mon Oct 8 18:52:36 2012 +0200 + + updated URLs and description + +commit c750b9b1944723532b2924fd305573c26927d2fb +Author: Bert Vermeulen +Date: Mon Oct 8 15:53:00 2012 +0200 + + restore pre-split ignores + +commit a2e222d24fdca68fbf34031baa889ca3ebf23e1a +Author: Uwe Hermann +Date: Thu Sep 27 23:29:33 2012 +0200 + + sr: struct drv_context is global now. + +commit d38d2ef0ce0e4ec49369e6cbfac616d9b1065c38 +Author: Bert Vermeulen +Date: Tue Sep 25 19:38:59 2012 +0200 + + fluke-dmm: support for all basic 287 functionality + +commit 96b3b3d56834f7c07a4760cfa3444b516c819de3 +Author: Bert Vermeulen +Date: Tue Sep 25 19:34:53 2012 +0200 + + sr: add support for conductance measurements in Siemens + +commit aa839a5c4fb3d994c7254da403eef8beab2880ba +Author: Bert Vermeulen +Date: Tue Sep 25 18:33:42 2012 +0200 + + sr: add support for pulse width measurements + +commit f46a36ad801bc96754183e8aa1cc2a8c0583ae33 +Author: Bert Vermeulen +Date: Sun Sep 23 00:03:24 2012 +0200 + + fluke-dmm: definitely use CR as line terminator + +commit acd29accb3a458ab6a494e3f6c42dacc56a4c7a8 +Author: Bert Vermeulen +Date: Sat Sep 22 23:52:23 2012 +0200 + + fluke-dmm: add Fluke 287 to supported list + +commit fb9d3bf9cc0cafbd3caedcd54831219a533ef7fb +Author: Bert Vermeulen +Date: Sat Sep 22 23:50:51 2012 +0200 + + sr: always turn off ICRNL on serial ports + + It does rather screw with protocols that use CR. + +commit d3f8f1415c5c707edc1c78377f30875604e9b8c1 +Author: Bert Vermeulen +Date: Mon Sep 17 16:31:15 2012 +0200 + + fluke-dmm: flesh out the driver API + +commit 4129832014ddb8330bd3f4a91e7c69ce6eb6b0cc +Author: Bert Vermeulen +Date: Mon Sep 17 15:40:41 2012 +0200 + + fluke-dmm: auto-discover serial bitrate if not provided + +commit bc41e012e6eda6277cbbeb5933c82c3d74a5ce69 +Author: Bert Vermeulen +Date: Sun Sep 16 21:27:06 2012 +0200 + + fluke-dmm: don't log anything if no conn params given + +commit fb480d578e423cd0f5702d1251e3cdccb990c9fb +Author: Bert Vermeulen +Date: Sun Sep 16 21:07:17 2012 +0200 + + fluke-dmm: fix discovery + +commit 5c51e09868ea24c0eb77908aa3a9d585a46a3158 +Author: Bert Vermeulen +Date: Sun Sep 16 14:07:21 2012 +0200 + + sr: turn off canonical mode and echo ion serial ports by default + +commit e7edd64f4573b786a8a1ab00e837d9e56cc69480 +Author: Bert Vermeulen +Date: Sat Sep 15 18:28:43 2012 +0200 + + fluke-dmm: build fixes + +commit 4f958423d17c4c264ae02884888615df28c60f3d +Author: Bert Vermeulen +Date: Tue Sep 11 20:11:13 2012 +0200 + + fluke-dmm: basic scan functionality + +commit 883a2e9e71d4d0f84d9f8df6a6a5e754052bad8a +Author: Bert Vermeulen +Date: Mon Sep 10 22:31:29 2012 +0200 + + fluke-dmm: initial driver skeleton + +commit c2016fa0eb1d0eb1b9ebf8af4556f6d606614f61 +Author: Bert Vermeulen +Date: Sun Sep 16 23:43:47 2012 +0200 + + agilent-dmm: don't log anything if no conn params given + +commit e9022f596d9a6d35919445f3aa6394061b3e6681 +Author: Bert Vermeulen +Date: Tue Sep 11 21:27:26 2012 +0200 + + sr: make struct drv_context global + +commit f5cfe894eca22fc40dac721566a727cae8d8454c +Author: Bert Vermeulen +Date: Tue Sep 11 21:20:50 2012 +0200 + + fx2lafw: use default libusb context + +commit 19b0cce3125f08f961886fb312219c7c6f496ffc +Author: Bert Vermeulen +Date: Tue Sep 11 21:16:16 2012 +0200 + + hantek-dso: use default libusb context + +commit 7c1cb432b8afc14f63d984aaebd0239c74376c74 +Author: Bert Vermeulen +Date: Mon Sep 10 22:14:37 2012 +0200 + + sr: enable genericdmm and agilent-dmm drivers by default + +commit b186aa78b8302942c8853c9aed40e3e5eaba8e34 +Author: Bert Vermeulen +Date: Mon Sep 10 21:27:50 2012 +0200 + + agilent-dmm: fix model identifiers + +commit 8c0152f29b7892bb3f131e92c55ecd60a29ece5a +Author: Bert Vermeulen +Date: Mon Sep 10 01:00:48 2012 +0200 + + agilent-dmm: tentative support for all U123x and U125x models + + Only tested on U1233A, but it just might work. + + The U125x protocol decoding only supports voltage, current, resistance, + capacitance and diode measurements for now. + +commit a4394fb3d9362cc686d6f8a05d2bc0b219903069 +Author: Bert Vermeulen +Date: Mon Sep 10 00:13:26 2012 +0200 + + agilent-dmm: code cleanup + + This should make it easier to support other Agilent U12xx models + +commit e066c32a252f4e5cd881a270adb98b004e688427 +Author: Bert Vermeulen +Date: Sun Sep 9 22:49:07 2012 +0200 + + agilent-dmm: fix AC/DC mode detection + +commit f2e86bbfa64f328feb063ea2b79110a0ec1716e1 +Author: Bert Vermeulen +Date: Sun Sep 9 22:48:22 2012 +0200 + + agilent-dmm: make parser deal with input better + +commit 81599cc55b8f22fe4ef78e7bd4bdb6958d458c64 +Author: Bert Vermeulen +Date: Sat Sep 8 14:53:49 2012 +0200 + + agilent-dmm: remove IDN check at 1Hz, we just don't need it. + + Some debug message cleanup. + +commit 161a8a272699a7b818ddab01043838f07d7cf6eb +Author: Bert Vermeulen +Date: Sat Sep 8 13:24:48 2012 +0200 + + sr: add new analog output module + + This outputs text representation of SR_DF_ANALOG packets. Unlike the + float module however, it also outputs the standard abbreviations of + SI units corresponding to the packet's MQ and unit. + + It also makes an effort to multiply or divide the floating point value + as needed to the nearest multiple or fraction, and inserts the + appropriate SI prefix to match. + +commit e6b021f3775295bb3cbf7fa523281bfd64eaa39a +Author: Bert Vermeulen +Date: Sat Sep 8 03:06:45 2012 +0200 + + agilent-dmm: support for submodes + +commit f45b75901436310684b5fbb567269bc44d08c2d4 +Author: Bert Vermeulen +Date: Sat Sep 8 02:31:08 2012 +0200 + + sr: add recv/cleanup calls to output module API + + The new output module callbacks will be init, recv and cleanup. The + existing data and event callbacks still work, but will be phased out + as existing modules get converted. + + The recv() callback gets a copy of every packet on the session bus, + and thus has visibility of all metadata, allowing it to properly + output any acquired data. + +commit 69a74024902eecd3fc9ebd4f64fdef6ae460d0d7 +Author: Bert Vermeulen +Date: Sat Sep 8 02:28:41 2012 +0200 + + genericdmm/victor-70c: fix resistance and frequency measurements + +commit 4cc9aea15b2d76930f565e810e0520918e2cc7bd +Author: Joel Holdsworth +Date: Sat Jul 7 09:32:00 2012 +0100 + + sr: Refactored sr_samplerate_string into a more general function: sr_si_string_u64 + +commit b863fb1b9d486867ab1fc5e0f62fb42321080b5a +Author: Lars-Peter Clausen +Date: Sun Sep 2 19:02:42 2012 +0200 + + sr: session_driver: Remove source on completion + + Remove the session source once we are done loading the file, otherwise we'll + spin forever in sr_session_run. + + Reported-by: Joel Holdsworth + Signed-off-by: Lars-Peter Clausen + +commit 40578aa487f6624db787289e4f254af14deee102 +Author: Bert Vermeulen +Date: Sun Sep 2 15:41:19 2012 +0200 + + sr: output up to 12 significant digits for floats + +commit c0d93341cb6f409f53f5d9d47058e1efb1cd2d8b +Author: Bert Vermeulen +Date: Sun Sep 2 15:39:56 2012 +0200 + + generic-dmm: cosmetics + +commit f6b8ffa6c0eb94fa59c0e09f3c4d8bed071167d0 +Author: Bert Vermeulen +Date: Sun Sep 2 15:13:00 2012 +0200 + + genericdmm/victor-70c: warn if detaching kernel driver fails + +commit e93cdf428c6383b9868d08bdae07ff775bedd0c0 +Author: Bert Vermeulen +Date: Sun Sep 2 15:11:52 2012 +0200 + + sr: mostly finished Agilent DMM driver + +commit 792fc686581a9412364d06be2e05dfe4d4014ed1 +Author: Bert Vermeulen +Date: Sun Sep 2 15:02:24 2012 +0200 + + serial: add serial_set_paramstr() + +commit f38b9763fa5ba8f4b481718b245e1258a307d2a6 +Author: Bert Vermeulen +Date: Sun Sep 2 15:01:23 2012 +0200 + + serial: fix flow control setting + +commit 6a6e23abf5e28471f368b225c96c1b0cb8797191 +Author: Bert Vermeulen +Date: Sun Sep 2 15:00:02 2012 +0200 + + serial: set speed in both directions + +commit 6ac0db19f36ada4cfccf19bbd48ebdb4665bc9ff +Author: Bert Vermeulen +Date: Sun Sep 2 11:58:29 2012 +0200 + + sr: add new agilent-dmm driver (Agilent U12xxA multimeters) + +commit b84c13d700eff9eceb12463b0ed17f5b984b2582 +Author: Bert Vermeulen +Date: Sat Aug 18 16:22:36 2012 +0200 + + genericdmm: Victor 70C multimeter support + +commit 3c6ce226dec2ee70c044d844ffbb3845f07baf7e +Author: Bert Vermeulen +Date: Sat Aug 18 16:21:21 2012 +0200 + + genericdmm: finish basic USB support + +commit 606a07b670270b4bcf0bfa4ffcf67dfd1cfedad3 +Author: Bert Vermeulen +Date: Sat Aug 18 14:34:29 2012 +0200 + + sr: corrected VID for Victor 70C + +commit 02e864d0bf866b045abf04a696ad555959f1b171 +Author: Bert Vermeulen +Date: Sat Aug 18 14:33:51 2012 +0200 + + sr: added mqflags field to sr_datafeed_analog + +commit edb000eb2f78aff4ea805ffc25a07792bedcea90 +Author: Bert Vermeulen +Date: Sat Aug 18 14:26:43 2012 +0200 + + sr: add fahrenheit and boolean MQ units + +commit 64591be2f25055d4c9f55689f641334a54613746 +Author: Bert Vermeulen +Date: Sat Aug 18 14:25:21 2012 +0200 + + sr: add continuity MQ + +commit 811deee4af9f600ae0c457a74d3877c4f68f2f37 +Author: Bert Vermeulen +Date: Mon Aug 6 00:59:25 2012 +0200 + + sr/drivers: add API calls sr_dev_inst_list() and sr_dev_inst_clear() + + These are used to list the device instances currently known to the driver, + and clear that list. + + Drivers that don't necessarily clear their list of instances on every scan, + such as genericdmm, need to provide these to the frontend to keep instance + management sane. + +commit 014359e3293ef0cdc61fbde4f63dc0a9da98179d +Author: Bert Vermeulen +Date: Sun Aug 5 18:56:12 2012 +0200 + + sr/drivers: obsolete SR_HWCAP_PROBECONFIG + + Since probes now live in a struct sr_dev_inst owned by the driver, it + already knows about them. Instead of a frontend telling the driver to + configure probes, all driver now do this just before starting acquisition. + +commit a56f1480949e84e94dad2afcdf9f758988a4aff9 +Author: Bert Vermeulen +Date: Sun Aug 5 15:53:04 2012 +0200 + + sr: new API call sr_dev_config_set() + + This is a wrapper around the driver dev_config_set() call, to avoid + frontends needing visibility into drivers. + +commit 15cb43d67cee5d7381c9cbcf0a355329a5cabfd1 +Author: Bert Vermeulen +Date: Sun Aug 5 03:18:07 2012 +0200 + + sr: replace published static option data with API calls + + To find a driver or device option by name, the sr_drvopt_name_get() and + sr_devopt_name_get() calls are now available. This was the only reason the + driver and device struct sr_hwcap_option arrays were published. + +commit 3cf91809a5aca7462f0fc9c3ca6fb9a7ebdf92d2 +Author: Bert Vermeulen +Date: Sat Aug 4 14:35:40 2012 +0200 + + sr: rename sr_hw_hwcap_get() to sr_devopt_get() + +commit fabe59b326c8ed17582f54d5525b278b6712085b +Author: Bert Vermeulen +Date: Sat Aug 4 12:21:02 2012 +0200 + + sr: drivers using sr_usb_dev_inst_new() must free it properly as well + + sr_usb_dev_inst_free() doesn't really do anything, but it might one + day. + +commit d3cff734e550430027f195317650a6c0e7c81fa3 +Author: Bert Vermeulen +Date: Sat Aug 4 12:03:05 2012 +0200 + + sr: properly free probes when freeing their device instance + +commit 228b2cccaf2773efa81891273e2cf32ce6f14b2f +Author: Bert Vermeulen +Date: Fri Aug 3 14:19:00 2012 +0200 + + asix-sigma: fix double free + +commit 8012ae1e3b40a88bbe20deaded7d66942a82380e +Author: Bert Vermeulen +Date: Fri Aug 3 14:18:02 2012 +0200 + + chronovu-la8: fix double free + +commit afc88319384053b3f2ca4b17706c10ded9c7174b +Author: Bert Vermeulen +Date: Fri Aug 3 13:50:31 2012 +0200 + + chronovu-la8: code cleanup + +commit 7021f98596fdd0ca744e9ffa2ab73979f65125a3 +Author: Bert Vermeulen +Date: Fri Aug 3 10:17:31 2012 +0200 + + chronovu-la8: remove session source when done + +commit 503c4afbb43da85723d1a40bf985b88f7a4bc3c7 +Author: Bert Vermeulen +Date: Fri Aug 3 10:12:54 2012 +0200 + + asix-sigma: remove session source when done + +commit 7fd3e8596192316cacd0d22d52f287df2c12d437 +Author: Bert Vermeulen +Date: Fri Aug 3 10:09:02 2012 +0200 + + demo: remove sources from session when done + +commit a3508e33f9e4e54331d086b37272e7c55faf11d8 +Author: Bert Vermeulen +Date: Fri Aug 3 01:05:40 2012 +0200 + + hantek-dso: remove sources from session when done + +commit 26bf9d56c079889cd493376b341ab75acee795f7 +Author: Bert Vermeulen +Date: Fri Aug 3 01:05:01 2012 +0200 + + ols: remove serial source from session when done + +commit 2cbeb2b7fb5791dd765ab6eee180ee053cc20b1c +Author: Bert Vermeulen +Date: Fri Aug 3 01:04:05 2012 +0200 + + sr: drivers should remove their sources from the session when done + +commit 310e9e9be4e4421f0171d47dfdb5fc299d6f749c +Author: Bert Vermeulen +Date: Fri Aug 3 01:01:38 2012 +0200 + + zeroplus: use driver-private storage for instances + +commit fefc4b858e8db2b1c569dd302af1b30c1a4bce4f +Author: Bert Vermeulen +Date: Fri Aug 3 00:09:33 2012 +0200 + + ols: use driver-private storage for instances + +commit 301a5e4c4ade2f640eeb532195e6e84dee81783c +Author: Bert Vermeulen +Date: Thu Aug 2 23:54:11 2012 +0200 + + genericdmm: use driver-private storage for instances + +commit b4750a3a938ff5be295095b05e27c0f7a7cd2bbe +Author: Bert Vermeulen +Date: Thu Aug 2 23:53:31 2012 +0200 + + demo: use driver-private storage for instances + +commit b9636cf4dcd07fa215bcfdb265913baa848227ab +Author: Bert Vermeulen +Date: Thu Aug 2 23:51:47 2012 +0200 + + fx2lafw: minor cleanup + +commit cf1ebd544652274923e808c93f7e88292acc2f11 +Author: Bert Vermeulen +Date: Thu Aug 2 21:54:21 2012 +0200 + + chronovu-la8: don't try to clean up unless we've initialized + +commit b32503cccdf88769619dc9a2ca3566d06040c1b4 +Author: Bert Vermeulen +Date: Thu Aug 2 21:42:37 2012 +0200 + + asix-sigma: properly init driver-private storage + +commit 1644fb2473e0c2f0dd81464f885c9212f413657e +Author: Bert Vermeulen +Date: Thu Aug 2 21:35:25 2012 +0200 + + chronovu-la8: use driver-private storage for instances + +commit 0e1357e8960734e4b599979511c7f9a51fb611a8 +Author: Bert Vermeulen +Date: Thu Aug 2 21:20:41 2012 +0200 + + asix-sigma: use driver-private storage for instances + +commit dc9dbe949a2c195ec0c5afff34bec3cc03a5613b +Author: Bert Vermeulen +Date: Wed Aug 1 00:42:19 2012 +0200 + + fx2lafw: use driver-private storage for instances and libusb_context + +commit 269971ddce18664a2ad06b7e2f56dcad70d155bb +Author: Bert Vermeulen +Date: Mon Jul 30 00:24:26 2012 +0200 + + hantek-dso: use driver-private storage for instances and libusb_context + +commit c259726a161411a7fe955dd139fce374635ddf7c +Author: Bert Vermeulen +Date: Mon Jul 30 00:22:26 2012 +0200 + + sr: driver struct gets a more generic *priv instead of GSList *instances + + It's up to the driver to keep its GSList of struct sr_dev_inst * in there. + Anything else the driver wants to keep driver-global should also go in + there, such as libusb_context. + +commit ef2345bc29fc8b3bc31e5d89e028be31c7b39428 +Author: Bert Vermeulen +Date: Sun Jul 29 15:21:08 2012 +0200 + + sr: build: hantek-dso driver requires libusb as well + +commit e8d3d6c84378481b5c0b53236e2fb09288e211b1 +Author: Bert Vermeulen +Date: Sun Jul 29 03:01:57 2012 +0200 + + sr: properly initialize and check on device instance driver field + +commit aee878fa2efb8483bf93fa3bb03508357fc713a8 +Author: Bert Vermeulen +Date: Sun Jul 29 03:01:02 2012 +0200 + + sr: fix initialization for output from driverless devices + +commit 6f57fd96949e4290933ac175c6c82d56965f7665 +Author: Bert Vermeulen +Date: Wed Jul 25 00:33:38 2012 +0200 + + sr: remove obsolete SR_DI_INST + +commit 48a486cd3ed51cfefce271224541502f4388c225 +Author: Bert Vermeulen +Date: Wed Jul 25 00:20:06 2012 +0200 + + sr: code organization cleanup + + Device-specific functions (public and private) go in device.c, + more general driver-related code in hwdriver.c + +commit 87ca93c5043899e3c30edb7e09fadef3ee67d810 +Author: Bert Vermeulen +Date: Tue Jul 24 19:10:09 2012 +0200 + + sr/drivers: add proper probe list to instances of all drivers + +commit b35c829306b86dbeeeecf14de7fe30a05a88c914 +Author: Bert Vermeulen +Date: Tue Jul 24 17:13:25 2012 +0200 + + sr/drivers: fix off-by-one if frontend-initiated probe configuration + +commit d6a8df467de03fe211dea7a0c91f63ceb22c5480 +Author: Bert Vermeulen +Date: Tue Jul 24 15:42:51 2012 +0200 + + sr: remove obsolete sr_dev_inst_get() call + +commit 47a98b6e2c241f225f78044f0237dc77d235ce6b +Author: Bert Vermeulen +Date: Tue Jul 24 13:06:15 2012 +0200 + + sr: remove obsolete driver API call dev_info_get() + +commit a2e464604ca19c1a41b8e94625971eb3818c9090 +Author: Bert Vermeulen +Date: Mon Jul 23 15:09:19 2012 +0200 + + sr: cosmetic changes + +commit c1864d5589749a881d661ab3abfd09cdbb96253d +Author: Bert Vermeulen +Date: Mon Jul 23 15:08:44 2012 +0200 + + sr: better file version check + + Still not really used though. + +commit 056be0719f0c1a05cde6fc2483b50e024708fdac +Author: Bert Vermeulen +Date: Mon Jul 23 15:06:49 2012 +0200 + + sr: sr_session_save() now takes sdi and datastore parameters + + This means it's restricted to saving one device's capture per file, for + now. + +commit fb381e4d713fcd3fdec99b4deff3a75e809df825 +Author: Bert Vermeulen +Date: Mon Jul 23 14:55:43 2012 +0200 + + sr: fix session loading for 0-numbered probes + + They're still numbered starting from 1 in the current version (1) + of the sigrok file format, we just work around that for now. + +commit 31fc1fbce399ac89d07093886301b9b4971f56f9 +Author: Bert Vermeulen +Date: Mon Jul 23 02:58:56 2012 +0200 + + sr: fix sr_parse_triggerstring() to use probe numbers starting from 0 + +commit 1907d2c928e328209f6d8832f73e369d28db5ab1 +Author: Bert Vermeulen +Date: Mon Jul 23 02:57:17 2012 +0200 + + sr: fix sr_filter_probes() to use probe numbers starting from 0 + + The probelist parameter is now terminated with -1, since 0 is a valid + probe number. + +commit a5f2e70712827c48a095204ef48c7cf1a0193ed0 +Author: Bert Vermeulen +Date: Sun Jul 22 20:06:13 2012 +0200 + + sr: comments/docs + +commit 37e8b4c4f7eaa6132a25448bccc690ac764f9a63 +Author: Bert Vermeulen +Date: Sun Jul 22 20:05:36 2012 +0200 + + sr: change sr_dev_probe_name_set() to use sdi + +commit a10ddf9ba04429d6762171a3bbbac12a7717ef59 +Author: Bert Vermeulen +Date: Sun Jul 22 19:44:20 2012 +0200 + + sr: remove dead/obsolete code + +commit 2ac2e629fc2ba2e89351d3ce337e0de9e034c540 +Author: Bert Vermeulen +Date: Sun Jul 22 15:32:35 2012 +0200 + + sr: cosmetic changes + +commit de4d3f99d9e76c5a51916d3bcfef89423055d43f +Author: Bert Vermeulen +Date: Sun Jul 22 15:31:56 2012 +0200 + + sr: change session API/code to use sdi + +commit c06b0d13b5b6bc7b059f397111f4ff661d1bbcbc +Author: Bert Vermeulen +Date: Sun Jul 22 15:19:53 2012 +0200 + + sr: remove obsolete dev_status_get() API call from session driver + +commit c7ee3ddb948b2ff36acbbe79ecc812b477ff5708 +Author: Bert Vermeulen +Date: Sun Jul 22 15:15:26 2012 +0200 + + sr: cosmetic changes + +commit ff14f01b208faf9b26212c907d162de72d1ab538 +Author: Bert Vermeulen +Date: Sun Jul 22 15:05:47 2012 +0200 + + sr: change sr_datafeed_callback_t to use sdi + +commit a5b35a167a32ffbaee1ce9c0de8501f781f733d1 +Author: Bert Vermeulen +Date: Sun Jul 22 14:33:28 2012 +0200 + + sr: convert sr_dev_has_hwcap() to use sdi + +commit 92ae7984834778dc7da128159d8e90024318909d +Author: Bert Vermeulen +Date: Sun Jul 22 14:28:40 2012 +0200 + + sr: convert sr_parse_triggerstring() to use sdi + +commit 9e90dcba9ce9d8f4a56b0225f146a1f1f055d213 +Author: Bert Vermeulen +Date: Sun Jul 22 12:37:59 2012 +0200 + + sr/drivers: remove driver API call dev_status_get() + + It's obsolete: no frontend ever used it, and neither did libsigrok. + The sdi->status field is only used internally by some drivers, and + should probably be moved to the driver-specific context structs. + +commit 5d9ed643e9dddbdb43e8917cff197346bdc930e7 +Author: Bert Vermeulen +Date: Sun Jul 22 12:35:57 2012 +0200 + + ols: change driver dev_acquisition_start/_stop calls to use sdi + + ...yeah, forgot OLS. + +commit be5bf44d281cc0a85992666803afdd7dafcefaf9 +Author: Bert Vermeulen +Date: Sun Jul 22 12:23:59 2012 +0200 + + sr: add sr_dev_probe_enable(), abstraction wrapper around device probes + +commit 4d684427397079d4627cce3fd624cd7c05b2d4b1 +Author: Bert Vermeulen +Date: Sun Jul 22 12:18:34 2012 +0200 + + sr: convert session load/save code to use sr_dev_inst + +commit c4a1de59f80efead2ebdd8109110ff8632c1838e +Author: Bert Vermeulen +Date: Sun Jul 22 11:49:00 2012 +0200 + + genericdmm: cosmetic change + +commit 3f848bb7a9c248447ddd3af6964089cd713b9c5a +Author: Bert Vermeulen +Date: Sun Jul 22 02:09:58 2012 +0200 + + zeroplus: comment out 32-probe models for now + +commit 428edbe13de32b4349af56c9fb3569d63a54e4c8 +Author: Bert Vermeulen +Date: Sun Jul 22 02:08:59 2012 +0200 + + zeroplus-logic-cube: fix scan to correctly find model + +commit 3ffb6964a1585b5f6ffa0747c089a1cd557e4feb +Author: Bert Vermeulen +Date: Sat Jul 21 22:41:58 2012 +0200 + + sr/drivers: change driver dev_acquisition_start/_stop calls to use sdi + +commit 25a0f108f4512ade836fed128c3ad649dedcb788 +Author: Bert Vermeulen +Date: Sat Jul 21 22:04:47 2012 +0200 + + sr/drivers: change driver dev_open/dev_close calls to use sdi + +commit 58453e5876ffae9153e9f4ddc2ad8dc244c7f26d +Author: Bert Vermeulen +Date: Sat Jul 21 19:11:49 2012 +0200 + + sr: change sr_dev_trigger_set() to use sdi + +commit 5c3c1241d2e2b5d456865e876490492d76174257 +Author: Bert Vermeulen +Date: Fri Jul 20 21:37:36 2012 +0200 + + sr: change input/output modules to use struct sr_dev_inst * + +commit 6f4b1868e8ec8c132878d8b6d558f4af054cbd91 +Author: Bert Vermeulen +Date: Mon Jul 16 03:52:14 2012 +0200 + + sr/drivers: use sr_dev_inst instead of device index for dev_config_set() + + All driver API calls using device index as a parameter will instead use a + const struct sr_dev_inst. + +commit 9c4311c524cd2eea8ce2c80b1029c936769107db +Author: Bert Vermeulen +Date: Sun Jul 15 19:24:10 2012 +0200 + + chronovu-la8: adjust to multi-vid/pid patch + +commit 387014de6355545d95958ec2666836318c2b3902 +Author: Bert Vermeulen +Date: Sun Jul 15 04:33:38 2012 +0200 + + sr: use new info_get API call in session driver + +commit 444adea232d24951b056fd4d7e061608dfabef7f +Author: Bert Vermeulen +Date: Sun Jul 15 04:33:10 2012 +0200 + + zeroplus-logic-cube: don't use deprecated hwcap_get_all() driver API call + +commit 2ca4465b3d66d3b763e664c419b542a3d1c1baad +Author: Bert Vermeulen +Date: Sun Jul 15 04:32:53 2012 +0200 + + ols: don't use deprecated hwcap_get_all() driver API call + +commit 2ce9f04629e93c4d202608dec6fa72d52aa44c6c +Author: Bert Vermeulen +Date: Sun Jul 15 04:32:37 2012 +0200 + + hantek-dso: don't use deprecated hwcap_get_all() driver API call + +commit cbd798f4002c1abccaa20ebe874c0aa45060bb0e +Author: Bert Vermeulen +Date: Sun Jul 15 04:32:21 2012 +0200 + + fx2lafw: don't use deprecated hwcap_get_all() driver API call + +commit 46c7a4daa772df5853e62f384b123bf1f3d96753 +Author: Bert Vermeulen +Date: Sun Jul 15 04:31:58 2012 +0200 + + demo: don't use deprecated hwcap_get_all() driver API call + +commit 7566601c21fd748827065ca120b88a6a141c922e +Author: Bert Vermeulen +Date: Sun Jul 15 04:31:37 2012 +0200 + + chronovu-la8: don't use deprecated hwcap_get_all() driver API call + +commit b2b5445c304ee2a6fe352e9b33f1e695a6760da5 +Author: Bert Vermeulen +Date: Sun Jul 15 04:31:22 2012 +0200 + + asix-sigma: don't use deprecated hwcap_get_all() driver API call + +commit 2efc5948b6c2c436e339e333994ec7cc96db62be +Author: Bert Vermeulen +Date: Sun Jul 15 04:08:49 2012 +0200 + + ols: scan fix + +commit b0c8d7ac7f698f75aeb1c4b201c90360bae009e8 +Author: Bert Vermeulen +Date: Sun Jul 15 04:08:21 2012 +0200 + + hantek-dso: scan/info_get fixes + +commit 7dfcf010a0331359529f52f7a09d6d324d96284f +Author: Bert Vermeulen +Date: Sun Jul 15 04:07:51 2012 +0200 + + demo: scan/info_get fixes + +commit cfe8a84dd7b5a22e6a225d6b078bde6d0ad8fde4 +Author: Bert Vermeulen +Date: Sun Jul 15 04:07:34 2012 +0200 + + chronovu-la8: scan/info_get fixes + +commit d7bbecfdb9bcec55a0eb067853df85d8fd326f84 +Author: Bert Vermeulen +Date: Sun Jul 15 04:06:57 2012 +0200 + + asix-sigma: scan/info_get fixes + +commit 626409abfb93a09ba74a0714de75fcde9381bea9 +Author: Bert Vermeulen +Date: Sun Jul 15 03:53:09 2012 +0200 + + zeroplus-logic-cube: use new driver info_get() API call + +commit dddfb3dbf058a5a8f789cc4988ac3c6da836e267 +Author: Bert Vermeulen +Date: Sun Jul 15 03:52:57 2012 +0200 + + ols: use new driver info_get() API call + +commit 0b79bcbb9d2e52fdd722088e0c525d14579cec6b +Author: Bert Vermeulen +Date: Sun Jul 15 03:52:45 2012 +0200 + + hantek-dso: use new driver info_get() API call + +commit dfb0fa1a669fb2a78fdee88d9896efc1998d7cee +Author: Bert Vermeulen +Date: Sun Jul 15 03:52:37 2012 +0200 + + demo: use new driver info_get() API call + +commit 6a2761fd9921830f3724f3d153eee4ad98dbc6b1 +Author: Bert Vermeulen +Date: Sun Jul 15 03:52:22 2012 +0200 + + chronovu-la8: use new driver info_get() API call + +commit 4147960558ae0d8964e8344faa3515a8ec4d9efb +Author: Bert Vermeulen +Date: Sun Jul 15 03:52:04 2012 +0200 + + asix-sigma: use new driver info_get() API call + +commit eec944c5b8e4885e61faf3ab318be6007f221fd9 +Author: Bert Vermeulen +Date: Sat Jul 14 16:14:01 2012 +0200 + + asix-sigma: don't attempt to free static struct + + Added more debugging as well. + +commit 067d07166b8637a4146058b4fb4da2d628b34c37 +Author: Bert Vermeulen +Date: Sat Jul 14 15:49:30 2012 +0200 + + demo: use new scan API + +commit 7da6f9d54a6acb699116848141d6ae1650a8dc98 +Author: Bert Vermeulen +Date: Sat Jul 14 13:00:47 2012 +0200 + + zeroplus-logic-cube: init and scan fixes + + libusb context needs to be initialized only once, not ever scan. + Every scan invalidates the last one, so clean up any previous run's + results first. + +commit 4ca38984459adfeaf6a94c2163be855fe41aec59 +Author: Bert Vermeulen +Date: Sat Jul 14 12:45:07 2012 +0200 + + zeroplus-logic-cube: use new scan API + +commit 39cfdd75f9f2ee050968cbe0efdf208fa8d8d9e0 +Author: Bert Vermeulen +Date: Sat Jul 14 12:28:45 2012 +0200 + + hantek-dso: use new scan API + +commit 0448d11097b057606f7f643b0f0537706d95afa7 +Author: Bert Vermeulen +Date: Sat Jul 14 12:28:15 2012 +0200 + + asix-sigma: use new scan API + fixes + + Now freeing FTDI context and driver-private context. + +commit c4f3ed4bb075eb3b2015b0cacbf4a8cf4e29d7a4 +Author: Bert Vermeulen +Date: Sat Jul 14 12:27:02 2012 +0200 + + chronovu-la8: use new scan API + fixes + + Now freeing FTDI context and driver-private context. + +commit f8c617cf4c6b649d3456f1ca7082f6cfb6dac76d +Author: Bert Vermeulen +Date: Fri Jul 13 22:18:01 2012 +0200 + + hantek-dso: instance list fix + +commit 10e5cbede89976eeed3237d985da065238962dfe +Author: Bert Vermeulen +Date: Fri Jul 13 22:16:37 2012 +0200 + + ols: use new scan API + +commit ed300b9f6a1d87eb35465ac998e1fc20690852a7 +Author: Bert Vermeulen +Date: Fri Jul 13 14:18:27 2012 +0200 + + asix-sigma: use driver struct-based device instance list + +commit 765ef2f725a11aa9598bfc621136f93666a1bc86 +Author: Bert Vermeulen +Date: Fri Jul 13 14:15:54 2012 +0200 + + chronovu-la8: use driver struct-based device instance list + +commit dcf03d6dbdba67eb92ee887de1bc72816a3cd01b +Author: Bert Vermeulen +Date: Fri Jul 13 13:47:27 2012 +0200 + + demo: use driver struct-based device instance list + +commit 327565470858432ba926643b0a4c4bb6f33e53e0 +Author: Bert Vermeulen +Date: Fri Jul 13 13:43:41 2012 +0200 + + zeroplus-logic-cube: use driver struct-based device instance list + +commit 982947f7a221c4dbd2ea2fe9ecb4405ea8c2156a +Author: Bert Vermeulen +Date: Fri Jul 13 13:37:35 2012 +0200 + + hantek-dso: use driver struct-based device instance list + +commit e5e81856b4821932481ff4f349b7557e84038a04 +Author: Bert Vermeulen +Date: Fri Jul 13 13:26:30 2012 +0200 + + ols: use driver struct-based device instance list + +commit d6db79a48cf813af1afa8e6243863cd62d1110d8 +Author: Bert Vermeulen +Date: Fri Jul 13 02:37:17 2012 +0200 + + genericdmm: device scan fixes + +commit f1a14ea7ab390e3d873631eaf0f0f915031b8e6f +Author: Bert Vermeulen +Date: Fri Jul 13 02:34:58 2012 +0200 + + genericdmm: don't use deprecated hwcap_get_all() driver API call + +commit 6910bf6bf61320f4ab55c670187d404656183a1b +Author: Bert Vermeulen +Date: Fri Jul 13 02:34:10 2012 +0200 + + genericdmm: use new driver info_get() API call + +commit a27999e65768dcf38366e1844b97b3b8ea243dd2 +Author: Bert Vermeulen +Date: Fri Jul 13 02:31:16 2012 +0200 + + fx2lafw: don't use deprecated hwcap_get_all() driver API call + +commit c5e82ca5e3ba7cd154c0e8afc19859564fc36dab +Author: Bert Vermeulen +Date: Fri Jul 13 02:30:42 2012 +0200 + + fx2lafw: device scan fixes + +commit f69b47f0f88aba6738635ae0ab3c37ccc235a0f9 +Author: Bert Vermeulen +Date: Fri Jul 13 02:30:09 2012 +0200 + + fx2lafw: a device scan always invalidates any previous scans + +commit 6e9339aae20afeef872eeb806c4bcc043e210dd0 +Author: Bert Vermeulen +Date: Fri Jul 13 02:28:07 2012 +0200 + + fx2lafw: use new driver info_get() API call + +commit be34a1c74688351fdeb7482fda28f49aa762a831 +Author: Bert Vermeulen +Date: Fri Jul 13 02:08:27 2012 +0200 + + sr: deprecate driver API call hwcap_get_all() + + This is now handled with a call to info_get(SR_DI_HWCAPS). This brings + it in line with the new driver opts: info_get(SR_DI_HWOPTS). + +commit df12380181f0af94fca382cd2ae6425bb1b51f73 +Author: Bert Vermeulen +Date: Thu Jul 12 22:41:57 2012 +0200 + + sr: new sr_info_get() API call, wrapper for driver info_get() + + This will replace sr_dev_info_get(), the wrapper for driver dev_info_get() + +commit f92f4eab23165aefa271d87cc0e60cbb8e24d154 +Author: Bert Vermeulen +Date: Thu Jul 12 21:34:30 2012 +0200 + + sr: add new driver API call info_get() + + This will replace dev_info_get(), and will be used to fetch both + driver and device instance-specific information. The sr_dev_inst + argument is NULL in case of a driver info fetch. In line with the + libsigrok wrapper, this function returns an error code, using the + supplied void ** to return the requested data. + +commit 9e41fdba4080de96fde23f00415056f51d79b469 +Author: Bert Vermeulen +Date: Thu Jul 12 21:00:18 2012 +0200 + + sr: add driver field to sr_dev_inst, to bring it on a par with sr_dev. + +commit 8bfdc8c4a5fc4bee4b59838bd57c6762ea0cb206 +Author: Bert Vermeulen +Date: Thu Jul 12 20:54:45 2012 +0200 + + sr: split driver options into separate list + +commit 3a0fe4023d1dd02051c126fffead6de631840974 +Author: Bert Vermeulen +Date: Sun Jul 8 23:49:04 2012 +0200 + + genericdmm: use new scan API + +commit bbb40871c88bbb622a275785d4aaf1e5e5a927f9 +Author: Bert Vermeulen +Date: Sun Jul 8 23:48:04 2012 +0200 + + genericdmm: more flexible device discovery + +commit 75337758d8e88e01d9ac46669cd8a76d0b8b0ca5 +Author: Bert Vermeulen +Date: Sun Jul 8 23:33:48 2012 +0200 + + genericdmm: use driver struct-based device instance list + +commit a8cc8e44b942031746c18aa95bf02cc66043269c +Author: Bert Vermeulen +Date: Sun Jul 8 19:07:38 2012 +0200 + + fx2lafw: use driver struct-based device instance list + +commit 06717a8a605d03eb87e768119758ba8e9e47cb0b +Author: Bert Vermeulen +Date: Sun Jul 8 19:06:23 2012 +0200 + + fx2lafw: use new instance-based probe list + +commit 3a7a22cb07937fcecef8b17b25e9638245f7f8c1 +Author: Bert Vermeulen +Date: Sun Jul 8 19:03:36 2012 +0200 + + fx2lafw: use new init/scan API + +commit dd34b8d3c4da18f8cf339c5bb8f0d6268f3d13f6 +Author: Bert Vermeulen +Date: Sun Jul 8 16:40:54 2012 +0200 + + sr: add GSList of instances to the driver struct + + This gives the driver a private place to keep its instances, without + polluting the global namespace. + +commit 47211d65b4fdaca58694a51cdbf1ba8ee4270ee9 +Author: Bert Vermeulen +Date: Sun Jul 8 16:37:39 2012 +0200 + + sr: add probe list to device instance + + There is no point in libsigrok copying probe lists around. The driver now + builds a list of probes according to the model device it found, and will + make that available to a frontend. The frontend thus has a reference of + what the driver has, including default names, and doesn't need libsigrok + to provide an unnecessary level of abstraction. + + The sr_probe_new() library-private function is a helper for drivers. + +commit 80bf04263528998feb17cedc5b7aa9668dbc8d4d +Author: Bert Vermeulen +Date: Sun Jul 8 16:25:23 2012 +0200 + + sr: split driver init into init() and scan() + + init() now only does whatever administrative stuff it needs (typically not + much), and returns an error code. + + scan() can be called multiple times during the life of an application, and + returns a GSList of struct sr_dev_inst * of devices found during that scan. + The instances are a copy of the ones stored in the driver's own instance + list, to be freed by the caller with g_slist_free() only. + + The scan() call can be passed a GSList of struct sr_hwopt *, to direct the + scanning. + +commit b159add3d9e3804f7806e82b01374fa099610668 +Author: Bert Vermeulen +Date: Sun Jul 8 14:56:54 2012 +0200 + + sr: move SR_HWOPT into its own enum, and create struct sr_hwopt + + SR_HWOPT_* entries are driver options, not device instance parameters, so + they will never be mixed together. + + Also, driver options are always passed in a GSList, where the data field + is a struct sr_hwopt. + +commit 633b2fac75c59c550cb1245cb75caa3ceef57b3d +Author: Bert Vermeulen +Date: Sun Jul 8 04:17:56 2012 +0200 + + genericdmm: better subdriver API arguments + +commit 1ef445b3d696c91b6734eaafbfb5478d6506d5ee +Author: Bert Vermeulen +Date: Sun Jul 8 04:15:51 2012 +0200 + + genericdmm/fs9922: no initialization needed + +commit 7fc754a0db73b473fb5c70f59165b43dc682bf1a +Author: Bert Vermeulen +Date: Sun Jul 8 04:09:55 2012 +0200 + + genericdmm: allow for default options in DMM profiles + + Much better than the special-cased USB vid.pid + +commit 7356a55db8e1f0aa27abb8f3cd05bca848c4c2a0 +Author: Bert Vermeulen +Date: Sun Jul 8 04:01:04 2012 +0200 + + genericdmm: use vid.pid as USB conn spec + + : is just too hard for the CLI + +commit db1352007db0d7a263a6a4c2837e65fd6de4dc8f +Author: Bert Vermeulen +Date: Sun Jul 8 03:59:58 2012 +0200 + + genericdmm: fix header guard + +commit 61136ea6035778f2894a1e32b78f94a0640a5a91 +Author: Bert Vermeulen +Date: Thu Jul 5 11:27:48 2012 +0200 + + sr: add new driver API call: scan() + + This changes the semantics of the init() call as well. That now only + initializes the driver -- an administrative affair, no hardware gets + touched during this call. It returns a standard SR_OK or SR_ERR* code. + + The scan() call does a discovery run for devices it knows, and returns + the number found. It can be called at any time. + +commit 40dda2c3a509e9e031078427e32249e2ebc33ec5 +Author: Bert Vermeulen +Date: Tue Jul 3 12:55:46 2012 +0200 + + sr: remove unused argument from hardware driver function init() + + It was actually used in one way: the session file loaded abused it for + passing in the filename -- something it definitely wasn't intended for. + This now uses the proper way to pass arguments to a driver: the new + SR_HWCAP_SESSIONFILE. + + The OLS driver could also use it as an indication of the serial port to + use instead of actively probing all serial ports on the system, but there + wasn't any frontend code that passed in such a parameter, making it + entirely useless. That will soon be handled differently with the new + scan() API call, regardless. + +commit 0d012ede9d54c6c5c276be52778483fd020c40d7 +Author: Ivan Fedorov +Date: Fri Aug 3 01:31:36 2012 +0400 + + sr: fix gnuplot script for USBee DX and clones + + - Now channels order is right + - Added 16bit version + +commit 0e8d0e24d00dcf6dd661e4fb15cedf79ce45c248 +Author: Ivan Fedorov +Date: Thu Aug 2 23:49:00 2012 +0400 + + sr: fx2lafw: Add 16bit support for USBee DX and clones + + gnuplot script support only 8 channels + +commit c19298d1413e2783bf723f5eb4ee098d9b8f159b +Author: Ivan Fedorov +Date: Wed Aug 1 00:11:40 2012 +0400 + + sr: add gnuplot script for USBee DX and clones + +commit c9166745f23889e1c5abb010513733c829c00d1b +Author: Ivan Fedorov +Date: Wed Aug 1 00:11:33 2012 +0400 + + sr: fx2lafw: Add basic support for USBee DX and clones + +commit 0d1297a2916c18457735a51fdab9ee2c914a4599 +Author: Bert Vermeulen +Date: Sun Jul 29 02:45:40 2012 +0200 + + sr: always use uint64_t for samplerate + +commit b04781bb2ba910d17b0bc11b499b1be352faa9cc +Author: Bert Vermeulen +Date: Sun Jul 29 02:15:34 2012 +0200 + + sr: extra checks for properly handling driverless devices + +commit 3dafb92bde1533cc81a61e2dc0f7d3732873c7ed +Author: Bert Vermeulen +Date: Sun Jul 29 02:13:22 2012 +0200 + + sr: fix struct sr_input for parameter passing + +commit c506a6a688877793752d23e43d692c49d0f52dd2 +Author: Tomaž Šolc +Date: Wed Jul 4 16:29:13 2012 +0200 + + Allow setting samplerate when reading binary files + + I had a binary file that I needed to decode using UART decoder. UART + decoder needs to know the sample rate for the data, but currently it's + not possible to pass parameters to input formats and so the "binary" + file format always sets the samplerate to 0. + + This patch adds the possibility to append a colon-separated list of + key=value options to the -I argument, in the same way -d supports it. + Also, it makes the "binary" format support the "samplerate" option. + + I included the GHashTable containing input format options directly in + the sr_input struct. I'm not sure if that's the right way to do it. I + saw that -d uses a much more elaborate system with device capabilities + and typed options, but that seemed like an overkill for input formats. + +commit d67b663e21de64261847c7e68de3ba37883c48b7 +Author: Bert Vermeulen +Date: Tue Jul 24 00:50:02 2012 +0200 + + sr: chronovu-la8: fix segfault on discovery + + If the uninitialized value didn't happen to contain 0, and there + is no Chronovu LA8 connected, the la8_close() causes a segfault + in libftdi. + +commit 74e5f12d3d9643cb0e8ba57ced4ee80b6393cb11 +Author: Uwe Hermann +Date: Sun Jul 15 00:34:27 2012 +0200 + + sr: la8: Support for newer USB VID/PID of the device. + + Thanks to Jerry Jacobs for the patch! + +commit 43be303c84d328437e594111b94f278270817a86 +Author: Uwe Hermann +Date: Thu Jul 12 21:39:18 2012 +0200 + + sr: la8: Drop useless cast. + +commit b5a8e848256f54b32ca988be5a1ec2db5048873a +Author: Uwe Hermann +Date: Thu Jul 12 21:30:49 2012 +0200 + + sr: Add sr_strerror() and sr_strerror_name(). + +commit 9ffbde0e84ef6c711be4edbe3076e8c805efad63 +Author: Lars-Peter Clausen +Date: Thu Jul 5 21:15:09 2012 +0200 + + sr: session: Deprecate sr_session_halt() + + sr_session_halt() in its current state is kind of useless and even dangerous. + All it will do is mark the session as not running, but wont signal the devices + to stop to capture data. This is not so much of a problem with the blocking + sr_session_run(), but once there is support for asynchronous data acquisition by + attaching the session sources to the applications mainloop sr_session_halt() + basically becomes a no-op. sr_session_stop() already does what needs to be done, + marking the session as not running and signal the devices to stop acquisition, + so make sr_session_halt() an alias for sr_session_stop() and deprecate its + usage. + + Signed-off-by: Lars-Peter Clausen + +commit 9213ad012accac3dbfbc6b72d6e99228e87740a4 +Author: Lars-Peter Clausen +Date: Thu Jul 5 21:15:08 2012 +0200 + + sr: session: Do not cleanup the driver state in sr_session_stop() + + By cleaning up the driver state all devices will become inaccessible, which + means that is neither possible to query any information from it (like sample + rate) and it is also not possible to restart data acquisition. + + sr_session_save() tries to query the sample rate from the device, as a result + calling sr_session_save() after calling sr_session_stop() - which is for example + done by sigrok-cli - will cause a segfault. This patch resolves the issue. + + Signed-off-by: Lars-Peter Clausen + +commit ed229aaa8ff66116967f75112be953940d4a3149 +Author: Lars-Peter Clausen +Date: Thu Jul 5 21:15:07 2012 +0200 + + sr: session: Close a device when it is removed from a session + + A device is opened when it is added to a session, in the same fashion it should + be closed again when it is removed from a session. + + Also remove all still attached devices from a session when the session is + destroyed. + + Signed-off-by: Lars-Peter Clausen + +commit 615183ea163f805af8589576c173769b4adba7f1 +Author: Uwe Hermann +Date: Wed Jul 11 12:57:15 2012 +0200 + + sr: Drop mastech-va18b, code will be in genericdmm. + +commit 28b9dd18611da8e16038d62d58195bdef91552eb +Author: Bert Vermeulen +Date: Wed Jul 11 12:36:13 2012 +0200 + + sr: fix conditional build for ezusb and serial helpers + +commit b7e941113f2e4d534e109f4aeb8b0dc4cda36598 +Author: Lars-Peter Clausen +Date: Fri Jul 6 23:23:31 2012 +0200 + + sr: session: Moves sources to session struct + + The sources really belong to the session, so move them into the session struct. + + Signed-off-by: Lars-Peter Clausen + +commit e6e8f8e0531805a9215eebcb0d4d270a5afa6a8d +Author: Lars-Peter Clausen +Date: Fri Jul 6 23:23:30 2012 +0200 + + sr: demodevice: Make read channel non-blocking + + Both pipe channels are currently configured as blocking. We read from the pipe + in receive_data. Since the channel is configured as blocking we'll block in + receive_data until all data has been received. receive_data will be called from + the mainloop, so as consequence the mainloop will be blocked until the demo + device has finished sampling. This is not so much of a problem if we are + sampling in blocking mode (using sr_session_run()) and the demo device is the + only device in the session, but it will fail badly for all other configurations + (e.g. multiple devices or async sampling). + + Signed-off-by: Lars-Peter Clausen + +commit 93b03d091abb947fdf78e57f864313571fb903ab +Author: Lars-Peter Clausen +Date: Fri Jul 6 23:23:29 2012 +0200 + + sr: session: Realloc correct array for pollfds in _sr_session_source_remove + + Commit 7149ad7c ("sr: session: Keep a global pollfd array") contained a small + copy paste error. This patch fixes it. + + Signed-off-by: Lars-Peter Clausen + +commit e7d087bf0e35ff97abae8bdd0c50e400c87b4b4d +Author: Lars-Peter Clausen +Date: Thu Jul 5 21:38:36 2012 +0200 + + sr: fx2lafw: Free transfers in reverse order + + Free the USB transfers in the reverse order of which they were submitted. This + will avoid that while transfer 0 is cancelledd transfer 1 is started by the + host controller, and so on. + + Reported-by: Peter Stuge + Signed-off-by: Lars-Peter Clausen + +commit 1a895c6185f67ec7a90e624fd47af625ac6f9e0a +Author: Uwe Hermann +Date: Thu Jul 5 01:47:44 2012 +0200 + + sr: Minor cosmetics. + +commit 249ae2be8f0e5132d601ab431ac8783b5b1c7439 +Author: Lars-Peter Clausen +Date: Sat Jun 30 20:54:45 2012 +0200 + + sr: session/demo: Remove Windows specific hack + + The session and demo device code contain a hack to make the demo device work on + Windows. This was neccessary since polling on windows requires special handling + and we can not just pass in the raw fd to poll. + + With the previous patches which added support for non-fd based event sources + this hack is no longer required. The patch moves the GIOChannels used by the + demo device to the demo device context and uses sr_session_source_add_channel + to register a source for the channels instead of using the raw pipe fds. + + Signed-off-by: Lars-Peter Clausen + +commit aac0ea256327bdff8f2a98bf62c7ac6a42dd1e44 +Author: Lars-Peter Clausen +Date: Sat Jun 30 20:54:44 2012 +0200 + + sr: session: Add support for GPollFD or GIOChannel based sources + + A raw file descriptor to poll on is not always available, this patch adds + support for adding a source for a GIOChannel or GPollFD. + + Signed-off-by: Lars-Peter Clausen + +commit 0687dfcde9eeebc2ee5fdc93af4a9a322ce9d071 +Author: Lars-Peter Clausen +Date: Sat Jun 30 20:54:43 2012 +0200 + + sr: session: Keep a global pollfd array + + Currently we keep a file descriptor for each source and construct a pollfd array + from these during each loop iteration in sr_session_run(). This patch modifies + the code to keep a global pollfd array which is only modified when a source is + added or removed. On one hand this gets rid of the constant constructing and + subsequent freeing of the pollfd array in sr_session_run(), on the other hand it + will allow us to implement support for non-fd based pollfds. + + Signed-off-by: Lars-Peter Clausen + +commit 2bccd322bc40a2ebe41a9d3f1c4b12cd52cb2595 +Author: Lars-Peter Clausen +Date: Sat Jun 30 20:54:42 2012 +0200 + + sr: session: Use realloc to resize source array + + Use realloc to resize the source array when adding or removing a source. This + makes the code a bit smaller. In the remove function we now check whether the fd + is valid before doing anything else and if it is not simply do nothing. If it is + valid use memove to move the elements following the source one element down in + the array. Only after that has been done the array is re-allocated. + + Signed-off-by: Lars-Peter Clausen + +commit 45c59c8bdd01954f9214fe7b869d92c55415d109 +Author: Bert Vermeulen +Date: Thu Jul 5 00:55:07 2012 +0200 + + sr: moved sigrok.h so libsigrok/libsigrok.h + + All frontends will have to include from now on. + This header includes proto.h and version.h, both installed from the + distribution into $INCLUDE/libsigrok/ as well. + + The only dynamically changed header is now version.h, which has both + libsigrok and libtool compile-time versions in it. + +commit 8489264f1e3ef07ba8f1143ed62fa88d90980f94 +Author: Lars-Peter Clausen +Date: Tue Jul 3 23:59:12 2012 +0200 + + sr: demodevice: Reset sample limit when setting time limit and vice versa + + Only one limit should be active at a time. Make sure that the sample limit is + disabled when a time limit is set and vice versa. + + Signed-off-by: Lars-Peter Clausen + +commit 25f5d66a7752379abe454da0705df4ed15ce6426 +Author: Lars-Peter Clausen +Date: Tue Jul 3 23:58:40 2012 +0200 + + sr: fx2lafw: Fix potential leaks in acquisition_start error paths + + Call abort_acquisition if starting sampling fails in acquisition_start, this + will ensure that all already allocated resources are being freed again. + + Signed-off-by: Lars-Peter Clausen + +commit c03f045004a340bd418206cbd02eaefcede91a5b +Author: Lars-Peter Clausen +Date: Tue Jul 3 23:58:39 2012 +0200 + + sr: fx2lafw: Do not start a new acquisition if the old is still running + + This may happen if the acquisition_start is called right after calling + acquisition_stop and not all transfers have been freed or on repeated calls to + acquisition_start. If it happens we'll enter an undefined state and all kind of + strange behavior may occur, so error out in such a case. + + Signed-off-by: Lars-Peter Clausen + +commit 0caa1ef0cb0b2231e232a7d1681e4e13fe838035 +Author: Lars-Peter Clausen +Date: Tue Jul 3 23:58:38 2012 +0200 + + sr: fx2lafw: Abort pending transfers when sampling is stopped + + The recent reworks of the fx2lafw made sure that the total buffer size is large + enough hold 500ms of data. This was done to improve performance and stability. + That the timeout value for a transfer was also increased to over 500ms, a side + effect of this is that when sampling is stopped there will be a additional delay + of 500ms. This is because the driver waits for all transfers to be freed + before it sends a SR_DF_END packet. Once sampling has stopped this will only + happen once a transfer times out. This patch cancels all pending transfers when + sampling is stopped, this will cause them to be freed almost immediately and the + additional delay will disappear. + + Also make sure, that if we know, that we just have received the last transfer to + not resubmit this transfer again. + + Signed-off-by: Lars-Peter Clausen + +commit ca3d84cca1d2f7427f8c5266717cb787d2346e16 +Author: Bert Vermeulen +Date: Sun Jul 1 22:37:15 2012 +0200 + + sr: add genericdmm driver + +commit 45edd0b204b4166f2f590bf130b97ff90896a99f +Author: Bert Vermeulen +Date: Sun Jul 1 22:33:57 2012 +0200 + + sr: add HWCAP type SR_T_KEYVALUE (char **) + +commit f8c1fcda46584c3550a198625e0b5f0a58794b6e +Author: Bert Vermeulen +Date: Sun Jul 1 22:31:31 2012 +0200 + + sr: use proper definitions for parity setting + + ols driver fixed to use these as well. + +commit 5d4fb4fc0d4dd4fc323d5ecf862502ec317692de +Author: Bert Vermeulen +Date: Sun Jul 1 15:29:57 2012 +0200 + + fx2lafw: enable driver build by default + +commit 163f0523f6b26c0728153b5eafcf7a1b15645375 +Author: Uwe Hermann +Date: Thu Jun 28 22:57:03 2012 +0200 + + sr: Mastech VA18B: Partial protocol supports (WIP). + + Disable the driver for now, as it's not usable for the general public, yet. + +commit 99f5d45eccaf11ab72bfc8aeff6a07aa412d35b8 +Author: Uwe Hermann +Date: Thu Jun 28 01:47:38 2012 +0200 + + sr: hantek-dso: Fix copy-paste error. + +commit 2769eed9917aeb6e549b90be4925a4c192a92309 +Author: Lars-Peter Clausen +Date: Mon Jun 25 23:51:38 2012 +0200 + + sr: fx2lafw: Move empty_transfer_count to device ctx + + If one device is failing it should not affect the transfers of other devices. + + Signed-off-by: Lars-Peter Clausen + +commit 5af666a94e67e8a18c0dfa1f4314e1c3e93aa993 +Author: Lars-Peter Clausen +Date: Mon Jun 25 22:15:59 2012 +0200 + + sr: fx2lafw: Calculate buffer size and timeout based on sample rate + + Currently timeout and buffer size are hard-coded in the fx2lafw driver which is + non-optimal if we want to get good results at both high and low sample rates. + + The timeout is hard-coded to 40ms, which doesn't work well when sampling at + a low sample rate. E.g. at 20kHz filling all available buffer space alone takes + 6 seconds. So naturally we'll see a lot of transfers timeout in this case. + + The buffer size is hard-coded to 4096 bytes, which does not work well with high + sample rates. E.g. at 24MHz these 4096 bytes are enough space for 0.17ms of + data. The total buffer size is enough for about 5ms of data. Sooner or later the + application won't be able to resubmit a transfer within this time span and the + device will abort data acquisition. Usually this happens within the first few + seconds of sampling. + + This patch adds a few new helper functions which calculate the buffer size and + timeout based on the current sample rate. + + The buffer size is chosen to be large enough to hold about 10ms of data and it + also must be a multiple of 512 bytes since the firmware will send us the data + in 512 byte chunks. + + The timeout is set to the time it would take to fill the whole available buffer + space plus a 25% headroom to accommodate for jitter. This is more than enough, + but there is no need to make the timeout a tight deadline, since it is only + meant as a last resort in case the device stops submitting data. And in this + case data acquisition will be aborted anyway. + + The patch also limits the the number of transfers so that the total buffer + space is not much more of 500ms. This will ensure that we do not have to + wait too long when aborting data acquisition. + + This patch also significantly reduces the number of context switches when + sampling at a higher sample rate. On my system for example the CPU load of + sigrok-cli when sampling at 24MHz goes down from ~25% to 3-4%. + + Signed-off-by: Lars-Peter Clausen + +commit 7ce737a77c0d29276cdda4f3670c1ef41173bb9c +Author: Lars-Peter Clausen +Date: Sun Jun 24 16:45:08 2012 +0200 + + sr: fx2lafw: Handle the transfer's status + + While errors are usually already implicitly caught by looking at the packet + length field there is one error status which is worth special handling. If the + device has been removed there is not really a chance to recover from this error + so data acquisition can be stopped immediately. + + Signed-off-by: Lars-Peter Clausen + +commit 17dff8a1e6faaec02ed99715f2914b15b4cab82e +Author: Lars-Peter Clausen +Date: Sun Jun 24 12:19:09 2012 +0200 + + sr: fx2lafw: Avoid unnecessary alloc/free combo + + In receive_transfer for each completed transfer a new buffer is allocated and + the old one is freed. We can avoid this by simply reusing the buffer for the + next transfer. This is possible if we only resubmit the transfer after all + processing on the data buffer has been done. A new buffer is only allocated if + the size of the old one is not 4096 bytes. + + Signed-off-by: Lars-Peter Clausen + +commit f855de7575915a8b3a07ed32ff7ec6b431777317 +Author: Lars-Peter Clausen +Date: Sun Jun 24 12:08:59 2012 +0200 + + sr: fx2lafw: Properly free transfer + + When freeing a transfer we also have to free the transfer buffer. We also have + to keep track of the number of allocated transfers and if the freed transfer was + the last one stop acquisition. This patch introduces a helper function which + takes care of all of this. + + Signed-off-by: Lars-Peter Clausen + +commit bd47acabe33813acb7dd6a4ebf155418072b08b7 +Author: Lars-Peter Clausen +Date: Sun Jun 24 12:04:35 2012 +0200 + + sr: fx2lafw: Allocate header and packet struct on the stack + + The header and packet struct are only used in the scope of this function and + they are freed at the end of it. Also these structs are rather small, so they + can safely be allocated on the stack. By doing so memory leaks on the error + paths are avoided. + + Signed-off-by: Lars-Peter Clausen + +commit 0c156e06c55a5b69385778fb00292d5866660a7f +Author: Joel Holdsworth +Date: Wed Jun 27 21:39:26 2012 +0100 + + fx2lafw: Made libusb_claim_interface error messages more informative + +commit 88a13f30bdcad5de468221ef06e7dbc8859c3d8b +Author: Bert Vermeulen +Date: Wed Jun 27 19:36:30 2012 +0200 + + hantek-dso: add profiles for all five models in the series + + Also cleaned up profile struct, and use the new firmware filenames. + +commit 3b6c19303db9da2d70a65880fa85883273b17a5a +Author: Bert Vermeulen +Date: Wed Jun 27 01:02:39 2012 +0200 + + fx2lafw: fix broken firmware upload timeout + + Also corner case error init. + +commit fc8fe3e3141f998dd97004c4379cb4d3acbd62a9 +Author: Bert Vermeulen +Date: Wed Jun 27 00:55:15 2012 +0200 + + hantek-dso: get rid of broken GTV_TO_MSEC firmware upload timeout + +commit e749a8cb50029b6275a32a60c351d65f14fdf601 +Author: Bert Vermeulen +Date: Tue Jun 26 23:26:55 2012 +0200 + + hantek-dso: start sending the frame only from the trigger point + + Samples received before the trigger point are stored. From the + trigger point on, every chunk received from the device is sent + up the session bus. After the device has finished sending, the + stored samples are transmitted. + +commit fa114e4ab1ef0d30bb3cce8f926e43d66df9f787 +Author: Lars-Peter Clausen +Date: Thu Jun 21 19:54:29 2012 +0200 + + sr: fx2lafw: Set correct unitsize for trigger buffer + + Commit 88b75eb719 ("fx2lafw: Added device caps and added support for wide + sampling") increased the size of the trigger buffer from 8 to 16 bit, but forgot + to adjust the unitsize logic packet which is used to send the contents of the + trigger buffer. This patch sets the unitsize to sizeof() of the trigger buffer. + + Signed-off-by: Lars-Peter Clausen + +commit e05a174be2f9142471ad94a1af2b3722efd9c6ae +Author: Bert Vermeulen +Date: Sun Jun 24 18:57:37 2012 +0200 + + hantek-dso: fix triggerpoint conversion + +commit f3ab43a8fbc39fe786718a7a3f5528acb3150aa7 +Author: Lars-Peter Clausen +Date: Thu Jun 21 10:30:38 2012 +0200 + + sr: fx2lafw: Fix multistage trigger + + Multistage triggers currently do no work, because there is a return statement + in the middle of the trigger detector which will be hit as soon as the first + stage in a multistage trigger matches. This patch removes the return statement + so that the trigger detector can continue to try to match the next stage. In + order for this to work we also make sure that the trigger stage is only reset + if the current sample does not match. + + Signed-off-by: Lars-Peter Clausen + +commit e21e846330070e102b24e08605b76b362020f500 +Author: Bert Vermeulen +Date: Sat Jun 23 01:17:36 2012 +0200 + + sr/srd/cli: require glib version >= 2.28 + + Needed for g_get_monotonic_time(). Thanks to Tomaž Šolc. + +commit eabf24035b29020085f01dd6e5a2f3c7075db23e +Author: Lars-Peter Clausen +Date: Thu Jun 21 10:30:39 2012 +0200 + + sr: fx2lafw: Fix memory leaks in receive_transfer + + There are a few memory leaks in the receive_transfer transfer function. The most + serve of them is that a sample buffer is not freed if the triggered has not + matched yet, which causes a sigrok process which is waiting for a trigger to + consume several megabytes of memory within seconds. The other leaks are on the + error paths in that function. + + Signed-off-by: Lars-Peter Clausen + +commit 9edfee3ee31bc6cd7657392f2c9ac28ccf7a7dce +Author: Uwe Hermann +Date: Thu Jun 21 23:59:27 2012 +0200 + + sr: ols: Fix incorrect comment. + +commit eb1f1eb407965e72d31372b472b17989d3a2f3c8 +Author: Uwe Hermann +Date: Wed Jun 20 19:56:54 2012 +0200 + + sr: Unfinished Mastech VA18B (DMM) support. + +commit b908f067f25f7c307e46ba05a23fd3cc5187379f +Author: Uwe Hermann +Date: Thu Jun 21 22:36:13 2012 +0200 + + sr: chronovu-la8: Split code into api.c and driver.c. + + We should generally use api.c for API related functions and put the other + functions (mostly hardware-specific low-level code) into other C file(s) + for better readability. + +commit 9956f2851fb97a4b4090cedcde6f4b83cb08e971 +Author: Uwe Hermann +Date: Wed Jun 20 23:55:23 2012 +0200 + + sr: analog: Add MQ and UNIT enums. + + MQ is the measured quantity, e.g. voltage, current, temperature. + + UNIT is the unit in which these quantities are measured, e.g. volt, + ampere, celsius, kelvin, etc. etc. + + The same MQ can be specified in different UNITs by the driver, depending + on what the hardware reports. Conversion is left to the frontends. + +commit c13536fa9c5ec756ff169423d43fc14b10be8cfa +Author: Uwe Hermann +Date: Tue Jun 19 23:33:50 2012 +0200 + + sr: backend/zeroplus: Improve debug output. + +commit d27e406e13d1247a7839698d3643b8ebae7143af +Author: Bert Vermeulen +Date: Tue Jun 19 02:05:28 2012 +0200 + + sr: new output format 'float', just floating point values + + Also outputs FRAME-BEGIN and FRAME-END, if present in the stream. + +commit cdea754ae59dda3974b1c00cae2be1e72a539176 +Author: Bert Vermeulen +Date: Tue Jun 19 02:04:18 2012 +0200 + + sr: remove unused code + +commit 4368827aefc3488ae6b7b375590bbad1dd4d73fc +Author: Bert Vermeulen +Date: Tue Jun 19 01:06:02 2012 +0200 + + sr: only handling analog voltage units for now + +commit 6e6eeff47a93e48b31ef5d16feb707e8725dbbd3 +Author: Bert Vermeulen +Date: Mon Jun 18 23:09:37 2012 +0200 + + hantek-dso: capturestate packet also contains the trigger point + + Not yet used, but it's the key to knowing where in the frame to + start displaying; the frame is used as a circular buffer, and what + is sent is effectively a snapshot. + +commit a217bcdf104e757db9713ea767ee5709b137084b +Author: Bert Vermeulen +Date: Mon Jun 18 23:05:02 2012 +0200 + + hantek-dso: relays now set properly + + They appear to be arranged to switch on/off a hierarchical series of + devices that attenuate the channel by an order of magnitude. + +commit 384c28d9e74791a753bd25e471d20d970ab2346b +Author: Uwe Hermann +Date: Wed Jun 13 18:58:24 2012 +0200 + + sr: hantek-dso: Use portable g_ntohs() function. + + The ntohs() from is not available on MinGW/Windows. There + are ways to work around this, but as we use glib already, using g_ntohs() + is the best option anyway. + +commit c5841b28092ad9366cef5d512ddb10d6a34c9c0a +Author: Bert Vermeulen +Date: Tue Jun 5 18:17:01 2012 +0200 + + hantek-dso: calculate voltage based on vdiv setting + +commit a10c805636c7252cbd22582fc6360afc080ca48f +Author: Bert Vermeulen +Date: Tue Jun 5 18:16:23 2012 +0200 + + hantek-dso: default to DC coupling + +commit 1d97091e713d110a79f754472ea97f9286512567 +Author: Bert Vermeulen +Date: Tue Jun 5 18:15:58 2012 +0200 + + hantek-dso: fix CH2 vdiv setting + +commit 019d56633a81a240c6df4813c778cfb08bc130a6 +Author: Bert Vermeulen +Date: Tue Jun 5 18:15:04 2012 +0200 + + sr: add udev entry for Victor 70C multimeter + +commit 0026228ad01838dccaf761d17d97bda9bbbb7e72 +Author: Bert Vermeulen +Date: Tue Jun 5 18:14:23 2012 +0200 + + sr: fix udev rules for Hantek DSO-2090 + +commit aff5a729abfaa016555f5d4a6a1e2c953405179d +Author: Bert Vermeulen +Date: Tue Jun 5 17:37:28 2012 +0200 + + sr: add unit field to sr_df_analog packet + +commit 62bb8840e193cc73702b9e586882555bc18a8c61 +Author: Uwe Hermann +Date: Fri Jun 1 01:12:09 2012 +0200 + + sr: hantek-dso: Consistency renames, constification. + +commit 0236ab687fbbb0e68bd27791a6cd849fc5321cd3 +Author: Uwe Hermann +Date: Fri Jun 1 00:23:47 2012 +0200 + + cli/gtk/qt: Now all require libsigrok >= 0.2.0 (API changes). + +commit 63298404df6e4d8a4bd7358ad55e4076b4bf2993 +Author: Uwe Hermann +Date: Fri Jun 1 00:16:42 2012 +0200 + + sr: Increase pkg version to 0.2.0, increase lib version. + +commit 0a88ec3d9c97d20a26f2c0d8813ce7ba075421f6 +Author: Uwe Hermann +Date: Thu May 31 22:46:28 2012 +0200 + + sr: fx2lafw: Use gboolean, cosmetics, fix gcc warning. + +commit af36b8096942a704afa7e858fcd8fc8e15b92e09 +Author: Uwe Hermann +Date: Thu May 31 22:43:12 2012 +0200 + + hantek-dso: Update to constified libsigrok API. + +commit 88ff66c2c910f32b92faa6c4815f60cec47577c4 +Author: Uwe Hermann +Date: Thu May 31 22:40:41 2012 +0200 + + hantek-dso: Quickfix for build issue (will be removed later). + +commit f4575b6549ded99ec5380b4d6fafa899f5cb65ae +Author: Joel Holdsworth +Date: Thu May 10 16:34:24 2012 +0100 + + fx2lafw: Added a check to limit the sample rate during 16-bit sampling + +commit d1ddc7a9a8a7226fcb1f8b5a360c275684e77e9a +Author: Joel Holdsworth +Date: Mon May 7 16:01:10 2012 +0100 + + fx2lafw: Added device caps and added support for wide sampling + +commit a533743dd1680bb53f29b6a01cccbc5380027e77 +Author: Joel Holdsworth +Date: Mon May 7 15:07:06 2012 +0100 + + sr: Made sample rate lists const + +commit 1b79df2f57012926927983a8e2829004f0eee4fa +Author: Joel Holdsworth +Date: Mon May 7 15:02:02 2012 +0100 + + sr: Made the dev_config_set parameter a const pointer + +commit b7f578bef53ff0e645ca0cae3f9781f577b7367a +Author: Joel Holdsworth +Date: Mon May 7 13:35:56 2012 +0100 + + sr: Made the dev_info_get return value const + +commit 915f7cc87a8dce688ab99fc67005ef77e0d028a2 +Author: Joel Holdsworth +Date: Mon May 7 13:57:43 2012 +0100 + + sr: Made hwcap const + +commit 2715c0b86bafed70dc1d3737b59750570951f507 +Author: Bert Vermeulen +Date: Sun May 20 01:14:37 2012 +0200 + + hantek-dso: hopefully handle endianness in voltage setting + +commit 4a090d722d7d3f2d1011fc5ff1c9a39c809f07bd +Author: Bert Vermeulen +Date: Sun May 20 01:11:09 2012 +0200 + + hantek-dso: enable SR_HWCAP_COUPLING + +commit b58fbd99c8944a3ba584540aa7ceb34b5451fa3a +Author: Bert Vermeulen +Date: Thu May 17 03:17:09 2012 +0200 + + hantek-dso: support for SR_HWCAP_COUPLING + +commit e1c8b2abfbc5a0aa75cf6fbd8f88e45a8df0fd5b +Author: Bert Vermeulen +Date: Thu May 17 03:16:01 2012 +0200 + + sr: support for SR_HWCAP_COUPLING and SR_DI_COUPLING + +commit 313deed219c39a902e6b7c39cf519c3476b9798d +Author: Bert Vermeulen +Date: Thu May 17 02:03:12 2012 +0200 + + hantek-dso: support SR_HWCAP_VDIV + +commit bd8db307da41b3ca0f5401015f92e833e1db658e +Author: Bert Vermeulen +Date: Thu May 17 01:55:59 2012 +0200 + + sr: support for SR_HWCAP_VDIV and SR_DI_VDIVS + +commit 79afc8cac4912f5e1025c608a10b05506a191be9 +Author: Bert Vermeulen +Date: Thu May 17 01:54:57 2012 +0200 + + sr: add voltage parser and prettyprinter + +commit c1e486185ec4e4a894419f8d287c55ffb6282979 +Author: Bert Vermeulen +Date: Wed May 16 02:07:51 2012 +0200 + + sr: use SR_T_RATIONAL_PERIOD (new-style types) + + SR_T__ + +commit ebb781a69f1128fab5a9eedd39a548cba8ceccbb +Author: Bert Vermeulen +Date: Tue May 15 22:41:00 2012 +0200 + + hantek-dso: support for SR_HWCAP_FILTER + +commit 3c4976c9c4b9dd09204c7c3797f1122e4b641631 +Author: Bert Vermeulen +Date: Tue May 15 22:39:32 2012 +0200 + + sr: support for SR_HWCAP_FILTER and SR_DI_FILTERS + +commit a370ef19161cee7016b7d24a2b9cef95b1191f6d +Author: Bert Vermeulen +Date: Tue May 15 20:56:29 2012 +0200 + + hantek-dso: support for setting all CMD_SET_TRIGGER_SAMPLERATE params + +commit 76f4c61086b314e66e92dd571f37defd3f714554 +Author: Bert Vermeulen +Date: Tue May 15 20:46:14 2012 +0200 + + sr: add period parser + +commit 0fe11789961861a68d2de45136a7869f9b8c1717 +Author: Bert Vermeulen +Date: Tue May 15 20:45:46 2012 +0200 + + sr: add support for sr_rational and various HWCAPs and DIs + +commit bc79e906a0911b4218b42b63b2f27fb0016c59da +Author: Bert Vermeulen +Date: Mon May 14 02:33:37 2012 +0200 + + hantek-dso: proper protocol implementation of trigger/samplerate setting + +commit 6e71ef3b6f27c3f3e1c5d5dc4e2f60caf54fc818 +Author: Bert Vermeulen +Date: Tue May 1 20:35:04 2012 +0200 + + hantek-dso: fix channel selection + +commit ae88b97ba28ba098a54ec11af99bb195e6f9ab32 +Author: Bert Vermeulen +Date: Mon Apr 30 22:29:31 2012 +0200 + + hantek-dso: delimit frames with SR_DF_FRAME_* packets + +commit 6ea7669c9dc3dd59ad88869e29f5411114196f34 +Author: Bert Vermeulen +Date: Mon Apr 30 19:55:06 2012 +0200 + + support for frame begin/end packets + +commit 3b533202c8b32fbe785906e9930959aae077aeff +Author: Bert Vermeulen +Date: Mon Apr 23 01:05:58 2012 +0200 + + sr: initial support for Hantek 2xxx/5200 USB oscilloscopes + +commit f366e86c68071fa7888259aa3963b213caa81b51 +Author: Bert Vermeulen +Date: Sun Apr 22 20:06:19 2012 +0200 + + sr: change all drivers to use SR_DF_META_LOGIC + +commit ee7489d23449a3f5a81777fbdb3309dfe22bcecd +Author: Bert Vermeulen +Date: Sun Apr 22 18:11:31 2012 +0200 + + sr: SR_DF_ANALOG type, and meta types for analog+logic + +commit 7e41e319d9a76da527eaa6e2708e4909ffd0d971 +Author: Uwe Hermann +Date: Wed May 30 23:31:03 2012 +0200 + + sr: fx2lafw: Forgot to add (C) line to fx2lafw.h in recent commit. + +commit 0a8c0c324e16e4848498309dbb2efd27b4c812a9 +Author: Uwe Hermann +Date: Wed May 30 23:15:23 2012 +0200 + + sr: fx2lafw: Only check for correct major FW version. + + Changes in the minor version number are OK, as those should never + contain any incompatible/API changes. + +commit 8fdecced96a1e849f5474e57aeca456dd265d9b9 +Author: Uwe Hermann +Date: Wed May 30 22:55:03 2012 +0200 + + sr: Consistently use ZEROPLUS spelling. + + This is the version used throughout their website, let's use it. + +commit 921634ec10feb88dd2110d10d8b1914eaa742fb6 +Author: Uwe Hermann +Date: Wed May 30 22:42:19 2012 +0200 + + sr: Fix typos. + +commit cf94c8167bdd520e43cda5cdc9ef1ebf301b814d +Author: Uwe Hermann +Date: Wed May 30 22:40:59 2012 +0200 + + sr: fx2lafw: Add (C) line from old saleae driver it's based on. + +commit f9a33a4720403e7db4d69cb698b18dd724e16db7 +Author: Uwe Hermann +Date: Wed May 30 22:23:36 2012 +0200 + + sr: README: Add section about firmware files. + +commit 537096739ee5b841f9f51a864f785cf7c4b56864 +Author: Uwe Hermann +Date: Wed May 30 21:48:40 2012 +0200 + + sr: udev file: Minor fixes/additions. + +commit 02df29f0db42ae2f475df83e4cbe2d18994f7f53 +Author: Uwe Hermann +Date: Wed May 30 21:36:28 2012 +0200 + + sr: NEWS: Minor updates/fixes. + +commit 2f3a6df8e4f34c8902002de4dcc3fda94f195ae0 +Author: Uwe Hermann +Date: Wed May 30 09:26:15 2012 +0200 + + sr: Increase version number to 0.1.1. + +commit 5c4252cd8b7fafa9b37492c50a53f9165cd0e18d +Author: Uwe Hermann +Date: Wed May 30 09:25:11 2012 +0200 + + sr: Update NEWS in preparation of upcoming 0.1.1 release. + +commit f60fdf6ebe26a6b8693e515ed1eeedb906b7a17f +Author: Uwe Hermann +Date: Wed May 30 09:24:01 2012 +0200 + + sr: fx2lafw: s/MAX_RENUM_DELAY/MAX_RENUM_DELAY_MS/. + +commit e8bd58ffd2615ab2fbb0a963f359a705c584e4e1 +Author: Uwe Hermann +Date: Wed May 30 09:10:41 2012 +0200 + + sr: fx2lafw: Fix a firmware upload bug on 32bit systems. + + The glib GTimeVal data type (and some functions using it) will be faded + out from glib sooner or later, so it's not a good idea to use them anyway. + + In this specific case GTimeVal.tv_sec was overflowing, leading a check in + libsigrok to fail, and thus to FX2 firmware upload errors, i.e. + non-working fx2lafw devices. + + http://thread.gmane.org/gmane.comp.debugging.sigrok.devel/166 + + The root cause is that GTimeVal.tv_sec is a 'glong' (8 bytes on 64bit + systems, but only 4 on 32bit systems). + + We now use an int64_t (and g_get_monotonic_time() instead of the more + problematics g_get_current_time() which uses a GTimeVal). + + This has been verified to fix the issue on a 32bit system. + + Other uses of GTimeVal in libsigrok will be removed in a later release. + + Also, drop unneeded GTV_TO_MSEC. + +commit 36423d04e5411d9cd744bc6421f099b5d2c02730 +Author: Uwe Hermann +Date: Wed May 30 02:27:30 2012 +0200 + + sr: input/chronovu_la8.c: Add missing #include. + + This fixes a compiler warning. + +commit fb6f1978ed490a4cc80125e93239abfdad55e4b7 +Author: Uwe Hermann +Date: Wed May 30 00:00:33 2012 +0200 + + sr: New default firmware dir: $prefix/share/sigrok-firmware. + + We no longer expect firmware files to be in the + $prefix/share/libsigrok/firmware directory, as that would require an + additional (distro) package 'sigrok-firmware' or the like to install + files into another package's (libsigrok) path, which can be problematic. + + The current 'sigrok-firmware' repo's "make install" will already install + all files into $prefix/share/sigrok-firmware. + +commit c09584085ed0307ba05f3ebf88dcf54ce86aec07 +Author: Uwe Hermann +Date: Tue May 29 20:30:15 2012 +0200 + + sr/srd/cli/gtk: ChangeLog -> MAINTAINERCLEANFILES. + + If the (generated) ChangeLog file is marked for DISTCLEANFILES, it'll be + removed whenever "make distclean" is called (and is then gone forever if + you use the tarballs, for example). + +commit 3217b032053d6eb89ca31b01968715813bcbe1bb +Author: Uwe Hermann +Date: Tue May 29 00:21:21 2012 +0200 + + sr: la8 in: Files must be exactly 8388613 bytes. + + All ChronoVu LA8 files (*.kdt extension usually) are exactly 8388613 + bytes in size (8MB + 5 bytes). Check this, when trying to autodetect the + file format, to reduce the likelihood of 'chronovu-la8' being + autodetected on all binary files (instead of 'binary'). + +commit 9f05304e4e1b842f875cfdaccf9e93cae0012937 +Author: Uwe Hermann +Date: Mon May 28 23:40:12 2012 +0200 + + sr: ARMFLY AX-Pro is supported by fx2lafw (LA only). + +commit 432e5e95f53cd61160c1013921743267d84a7dd2 +Author: Pekka Nikander +Date: Fri May 11 19:23:21 2012 +0300 + + sr/srd/cli: Fix compiling with Homebrew. + + Add ACLOCAL_DIR setting and AM_PROG_AR macro for compiling with Homebrew + under Mac OS X. + + Applies essentially the same change to + {libsigrok,libsigrokdecode,sigrok-cli}/{autogen.sh,configure.ac} + + It may be that the same fix is needed for the other autogen.sh and/or + configure.ac files, but that hasn't been tested and therefore not in + this commit. + +commit 40cd2b545d4d6ddb0dce7b54bfc8f9be5b77444a +Author: Uwe Hermann +Date: Thu May 10 21:27:17 2012 +0200 + + NEWS: Add some news items. + +commit 37dc0b16a6d6aca8f98b4baee24028f3714f91d4 +Author: Uwe Hermann +Date: Fri May 11 00:19:01 2012 +0200 + + fx2lafw: Cosmetics. + +commit dc68c660d566424e9d83b19959a79d40e599c71c +Author: Joel Holdsworth +Date: Mon May 7 16:44:25 2012 +0100 + + fx2lafw: Added a gpif delay debug message + +commit 79dc64985f7e50943562169aebd7eefbd6e13490 +Author: Joel Holdsworth +Date: Mon May 7 16:42:50 2012 +0100 + + fx2lafw: Added support for 20kHz and 25kHz sampling + +commit 897c1a2ee5c7397a4ab281a5c83f8f5c34ea0aa1 +Author: Joel Holdsworth +Date: Mon May 7 12:40:52 2012 +0100 + + fx2lafw: Added support for 100kHz and 50kHz sampling + +commit 1e94408ae515157a9f27898b7b4c181e2aef980a +Author: Uwe Hermann +Date: Sun May 6 19:54:46 2012 +0200 + + sr: fx2lafw: Get/display FX2 REVID. + +commit 1663e4706cd966fcaed40d067ceea4b613e8125d +Author: Uwe Hermann +Date: Sun May 6 17:13:49 2012 +0200 + + sr: fx2lafw: Braintechnology USB-LPS support. + +commit 6352d030dfd11fb63a1beedd0e24b3e28be1a961 +Author: Uwe Hermann +Date: Wed May 2 19:02:03 2012 +0200 + + sr: We support both SIGMA and SIGMA2. + + Also, a few minor coding-style fixes etc. + +commit b5f6fcb1ac98a83747c778262a7cc91f6884e9e4 +Author: Uwe Hermann +Date: Tue May 1 19:09:06 2012 +0200 + + sr: udev: Add Ideofy LA-08 entry. + +commit 18a98412ec2ed644922b6fff44485318454975ab +Author: Uwe Hermann +Date: Tue May 1 19:05:09 2012 +0200 + + sr: udev: Add Velleman PCSU1000 entry. + +commit 1c41873612df34b90ec3ddaaf3f2d2e30dfc98e7 +Author: Uwe Hermann +Date: Tue May 1 19:03:44 2012 +0200 + + sr: udev: Fix alphabetical order. + +commit 585a9ec4a2076ca0ea23ef244d94521ea86316f8 +Author: Uwe Hermann +Date: Tue May 1 19:00:28 2012 +0200 + + sr: udev: Add Robomotic BugLogic 3. + +commit 6b73d9a598747b70436010f0cb27061d5dd93618 +Author: Bert Vermeulen +Date: Fri Apr 27 01:28:47 2012 +0200 + + fx2lafw: use iManufacturer/iProduct fields to identify our firmware + + It's more deterministic than the endpoint profile check we did before. Which + was also broken. + +commit 6752905e6be19617d83c48a6db5a20b8e932308b +Author: Uwe Hermann +Date: Thu Apr 26 23:18:05 2012 +0200 + + sr: zeroplus: Fix segfault, add debug output. + + There are various ZEROPLUS models with different probe numbers. For now + hardcode to 16 (for the popular LAP-C(16032)). This will need to be + fixed in a dynamic way later. + + This fixes a segfault due to only 16 probe-names being defined, but the + drivers returning 32 as probecount. + + Also, add some additional debug output. + +commit 993526f82421d3954b1032bfc1affb208916ebeb +Author: Bert Vermeulen +Date: Mon Apr 23 15:31:41 2012 +0200 + + sr: don't use deprecated glib functions + + As of the recent glib 2.32 release, these produce deprecation warnings + at compile time. + +commit 42cdeef6268a2fa28a42e472324c5122410847d0 +Author: Håvard Espeland +Date: Mon Apr 23 13:36:17 2012 +0200 + + sigma: Fix segfault when no Sigma present. + +commit 868501fa46bfb3c43bf4906e57587ef24463641c +Author: Håvard Espeland +Date: Sun Apr 22 15:10:46 2012 +0200 + + sigma: Bump copyright notice. + +commit e210c6c09003cbd4cfada74c42466ad407c73ad8 +Author: Håvard Espeland +Date: Sun Apr 22 14:31:40 2012 +0200 + + sr: Remove zlib dependency. + + No longer needed by Sigma driver. + +commit e3fff420dac8ba489674cf685529b3647fca185b +Author: Håvard Espeland +Date: Sun Apr 22 14:24:02 2012 +0200 + + sigma: Add support for SIGMA2 (req. new firmware). + +commit 3c36c403faf9ed06741aaeb8fbbaa10a18871a3c +Author: Håvard Espeland +Date: Sun Apr 22 13:08:16 2012 +0200 + + sigma: Use heap for datafeed packet and header. + +commit 805919b042386043f3f2fde8c13ca276a99e088c +Author: Håvard Espeland +Date: Sun Apr 22 13:05:10 2012 +0200 + + sigma: Fix bugs in receive_data callback. + + - Poll data position on Sigma for every iteration. + - Return TRUE when no data ready. + +commit 934cde02b80791943a023c2b4949fc5de43d5081 +Author: Uwe Hermann +Date: Thu Apr 19 00:55:29 2012 +0200 + + fx2lafw: supported_samplerates[] should be 0-terminated. + +commit f488762a17a3dce8a513aabcc0475f7382ec19bd +Author: Joel Holdsworth +Date: Wed Apr 18 22:28:52 2012 +0100 + + fx2lafw: Added support for default Cypess FX2 without EEPROM + +commit 824b1a8f5cc6073f6d6505d0efa74d67f4da0fb7 +Author: Joel Holdsworth +Date: Wed Apr 18 19:17:25 2012 +0100 + + sr: Deleted the saleae-logic driver, fx2lafw has superceded it. + +commit d56ee26599fa6dd560613adc14a4a28575063d5e +Author: Joel Holdsworth +Date: Wed Apr 18 19:10:15 2012 +0100 + + sr: Disable saleae-logic driver by default and enable fx2lafw + +commit 9304d576507db12f4072f427bcf1ce1645debce3 +Author: Joel Holdsworth +Date: Wed Apr 18 19:07:30 2012 +0100 + + fx2lafw: Added slower sample rates + +commit fefd54a0cdd4b2d30c36e53ea2ecdce6ff4b96ea +Author: Uwe Hermann +Date: Tue Apr 17 00:12:33 2012 +0200 + + sr: Initial 0.1.0 release. + +commit 69e70c233ef6186131369ad596a96a2632bdcf85 +Author: Uwe Hermann +Date: Mon Apr 16 23:16:00 2012 +0200 + + sr/srd: SR_API/SRD_API/etc. is a no-op on MinGW. + + This avoids warnings on a MinGW build. The feature depends on ELF files, + but MinGW/Windows uses PE files. + +commit 787c43905d6f61c08d3b66a4a09dc12038120861 +Author: Uwe Hermann +Date: Sun Apr 15 20:33:45 2012 +0200 + + sr: Add functions to query sr version(s). + +commit 0aeb0ccd5572a08c088e7903321a5998374f42e6 +Author: Uwe Hermann +Date: Sat Apr 7 17:40:52 2012 +0200 + + sr: sr_err() et. al. don't need trailing \n. + +commit bf978d355345a7cc3ae7dc6199cc25952aaa182f +Author: Uwe Hermann +Date: Sat Apr 7 17:35:14 2012 +0200 + + sr: sr_parse_triggerstring docs/improvements. + + Also fix smaller typos and cosmetics. + +commit 44dfd483db9e594acc809b9d76eb910a9b53165d +Author: Uwe Hermann +Date: Tue Apr 10 22:32:31 2012 +0200 + + sr: fx2lafw: Cosmetics. + +commit 13bf7eccbb08214c3d6d53da5b5b6a269a64a779 +Author: Joel Holdsworth +Date: Tue Apr 10 18:27:24 2012 +0100 + + fx2lafw: Added command to verify firmware version + +commit 6fbe5e6081b0f83fa97f0097bc87a21a45c48481 +Author: Joel Holdsworth +Date: Sun Apr 8 17:19:52 2012 +0100 + + fx2lafw: Safer use of libusb_get_device_list + +commit 105492034465fcdddfe89c916ed6da3242d39901 +Author: Uwe Hermann +Date: Sat Mar 31 12:09:37 2012 +0200 + + sr/srd: Fix 'make distcheck'. + +commit da90fb2a01523e3277ed849297646614dce9a15d +Author: Uwe Hermann +Date: Sat Mar 31 12:05:20 2012 +0200 + + sr/srd: Add ChangeLog to ignore list, it's generated. + +commit 2e26e0aa0b7ccbdb461fdf71dde59e0400ba50ee +Author: Uwe Hermann +Date: Sat Mar 31 11:57:46 2012 +0200 + + sr: Disable fx2lafw driver again (for now). + + After some more testing, it will probably be enabled by default and will + replace/deprecate the Saleae Logic driver at some point. + +commit c5d83a5a72b70b88cd1aa3299499b8b5389a0da3 +Author: Uwe Hermann +Date: Sat Mar 31 11:37:08 2012 +0200 + + sr: Add NEWS file. + +commit 6dddd902244f314eba721a0d8804731ea9c9912d +Author: Uwe Hermann +Date: Sat Mar 31 11:28:24 2012 +0200 + + sr: SR_PACKAGE_VERSION_* for consistency. + + No need to use the LIBSIGROK_ prefix here when we use SR_ everywhere + else. Also, better distinction between package version and lib version. + +commit da68656857cc0c70faa582d954c3b0bf5b6a1dbc +Author: Uwe Hermann +Date: Thu Mar 29 08:55:12 2012 +0200 + + sr: fx2lafw: Consistency fixes. + +commit 01c3e9dbd5bd583012fc1f46237bf4fde784d209 +Author: Uwe Hermann +Date: Wed Mar 28 21:55:48 2012 +0200 + + sr: s/_clear/_remove_all/ for consistency. + +commit 054e67090641e0a56a7e55789a3882ca138a0b11 +Author: Uwe Hermann +Date: Wed Mar 28 20:00:13 2012 +0200 + + sr: out: Use uint8_t (not char) for buffers. + +commit 69cfcfc8f0f3f4358714d706268fc05aaa70ca23 +Author: Uwe Hermann +Date: Wed Mar 28 18:52:17 2012 +0200 + + sr: Make wrappers honor return values. + +commit 0fc12d66f1cf0fa46d075f9a9f8b691a325f39b9 +Author: Uwe Hermann +Date: Wed Mar 28 02:32:52 2012 +0200 + + sr: Generate ChangeLog from git upon 'make dist'. + +commit 7ae2f9d56fed0e53ad3dab25de65504acc3022a0 +Author: Uwe Hermann +Date: Sun Mar 25 22:02:19 2012 +0200 + + sr: fx2lafw: Cosmetics. + +commit b04902b6469d4aed32e69125167f7ff71992fcba +Author: Uwe Hermann +Date: Sun Mar 25 15:23:31 2012 +0200 + + sr: fx2lafw: Use SR_PRIV where needed. + +commit 30da9658ad908864f78e3a99366f7787a80dcc43 +Author: Uwe Hermann +Date: Sun Mar 25 15:21:56 2012 +0200 + + sr: fx2lafw: command.h: Add missing include guards. + +commit f4a9e5c0aa81738d26e7893d6cf47ebdb4a91047 +Author: Uwe Hermann +Date: Sun Mar 25 15:20:55 2012 +0200 + + sr: fx2lafw: Cosmetics. + +commit 94c26b08fdc2568a33e176b895c63048a4b66464 +Author: Joel Holdsworth +Date: Sun Mar 25 19:39:06 2012 +0100 + + sr: Build ezusb.c for fx2lafw as well as saleae-logic + +commit ec888f62fe4298229e6ed0865937d74476715bf7 +Author: Joel Holdsworth +Date: Sun Mar 25 18:53:54 2012 +0100 + + salae: Only terminate session after all transfers have been aborted + +commit 3e6292b2967db0b86281988ebf816317956a8a51 +Author: Joel Holdsworth +Date: Sun Mar 25 18:52:30 2012 +0100 + + fx2lafw: Made finish_acquisition a static function + +commit 590b9f9a91a703ceea4c430566735d05a2acf82b +Author: Uwe Hermann +Date: Sat Mar 24 22:32:47 2012 +0100 + + sr: Fix some samplerate fields. + +commit 85a77720c678d1bb37c1445755ea2b38c658ca36 +Author: Uwe Hermann +Date: Sat Mar 24 19:42:26 2012 +0100 + + sr: sigrok.h: Add version macros. + +commit 4937b2355156f954d6fc3c1daf258d3825582743 +Author: Uwe Hermann +Date: Sat Mar 24 10:03:36 2012 +0100 + + sr: Rename sigrok.h. to sigrok.h.in, needed soon. + +commit cb61e9f7c3cfa2e3c9eee0bd221f47dd95f34073 +Author: Joel Holdsworth +Date: Sat Mar 24 10:04:36 2012 +0000 + + fx2lafw: Only terminate session after all transfers have been aborted + +commit 24125e05202626c9fea3f056ecc5d008f544970b +Author: Joel Holdsworth +Date: Sat Mar 24 10:07:22 2012 +0000 + + fx2lafw: Removed a line of redundant code + +commit 6c6781b6a7559b66645ec4dbebaf6dca0246cb5e +Author: Joel Holdsworth +Date: Wed Mar 21 20:42:41 2012 +0000 + + fx2lafw: Imported software triggering from fx2lafw + +commit 97fbf6704e5876f3cfbc519f05acaa2af65a6ff0 +Author: Uwe Hermann +Date: Wed Mar 21 23:42:19 2012 +0100 + + sr: udev: Add missing Hantek DSO-2090 entry. + +commit 8a6b5b50e1555744374781f0a438c8965f501e98 +Author: Uwe Hermann +Date: Wed Mar 21 22:33:51 2012 +0100 + + sr/srd: Remove API warnings from READMEs. + + We'll have a libsigrok and a libsigrokdecode release soon. After that, + any API changes must be properly documented and reflected in the + SO version (and package version) numbers of the libs. + +commit 2f8701d112cc1c4b61b36fe4c7096431833a8c9d +Author: Uwe Hermann +Date: Wed Mar 21 22:29:41 2012 +0100 + + sr: Various fixes in the udev file. + +commit 2e7cb0040a64062cb4b13fdff72995f4b5dc8769 +Author: Uwe Hermann +Date: Wed Mar 21 19:58:56 2012 +0100 + + cli: Fix -V/-h output a bit. + + Options and their defaults should not be documented there, but rather in + the manpage or such. + +commit b5750520bb0e2726ad6248e23f52a854535bc9a2 +Author: Uwe Hermann +Date: Wed Mar 21 19:45:46 2012 +0100 + + sr: Enable fx2lafw driver per default. + +commit 8ec95d22822ed5ebf4b6aeaff654608ad0225073 +Author: Uwe Hermann +Date: Wed Mar 21 19:28:43 2012 +0100 + + sr/srd: Small fixes, constifications, doc updates. + +commit a4d39856788e2182e53fa6a0f0a05f3867f31fc0 +Author: Uwe Hermann +Date: Wed Mar 21 18:40:25 2012 +0100 + + sr/cli/gtk/qt: Fix package version numbers / docs. + + The next (and first) libsigrok release will be called 0.1.0. + + The next (and first) libsigrokdecode release will be called 0.1.0. + + The next sigrok-cli release will be called 0.3.0 (as we already had a 0.1 + and 0.2 release of sigrok-cli; those did not yet use the libs, though). + + sigrok-gtk and sigrok-qt didn't have any releases yet, so their version + numbers are set to 0.1.0. + + Also, consistently use three numbers/digits for our version numbers. + +commit eb0a373189e0e1f346b6807b692c2ea0bdaa57b8 +Author: Uwe Hermann +Date: Tue Mar 20 18:09:18 2012 +0100 + + sr/cli: s/patternmode/pattern/ in a few places. + +commit ebc347388240e025181265f7d3d63a22f7bd5da9 +Author: Uwe Hermann +Date: Tue Mar 20 17:51:18 2012 +0100 + + sr: s/err/ret/ for consistency. + + We use ret, err, error, and others for return codes of functions. + Standardize on 'ret' for consistency reasons for now. + +commit d6eb0c333c8424d151637c18e1a1aef849d5fb31 +Author: Uwe Hermann +Date: Sun Mar 18 12:57:34 2012 +0100 + + sr: Fix handling of virtual devices. + + I.e., handling of sessions which use input from files (not from actual + logic analyzer hardware). + +commit 21b50ee1831602bd6c1f223fb200e2c298885aa3 +Merge: 9289e27 ecc16ed +Author: Bert Vermeulen +Date: Fri Mar 16 00:04:51 2012 +0100 + + Merge remote-tracking branch 'joel/public' + +commit ecc16ed07052ef399c36d36456aa943fcf81190c +Author: Joel Holdsworth +Date: Wed Mar 14 22:56:15 2012 +0000 + + fx2lafw: Upped NUM_SIMUL_TRANSFERS to 32 + +commit 9289e273bb6dfe9e8e46b5598830d4fb293175fc +Author: Uwe Hermann +Date: Wed Mar 14 22:22:32 2012 +0100 + + sr: session_driver: Naming consistency fixes. + + Use 'receive_data()', and 'cb_data' as all the other drivers do. + +commit 455b26edba718bd2dd2a33cb713d0ab077b4fd32 +Author: Uwe Hermann +Date: Wed Mar 14 22:09:52 2012 +0100 + + sr: demo: s/struct databag/struct context/. + +commit ab331b679c417282616efa7d05d456868fd42933 +Author: Uwe Hermann +Date: Wed Mar 14 22:08:31 2012 +0100 + + sr: demo: s/mydata/ctx/. + +commit 4101f961e8a414ae17b16c0feb1e10fd07d08d52 +Author: Uwe Hermann +Date: Wed Mar 14 20:02:48 2012 +0100 + + sr: s/SR_{USB,SERIAL}_INST/SR_INST_{USB,SERIAL}/. + +commit 4502e869210005559d9f1a0e66f1e6954e6368c0 +Author: Joel Holdsworth +Date: Mon Mar 12 21:49:34 2012 +0000 + + fx2lafw: Added CWAV USBee SX to the device list + +commit 0ca21631dda3d948f8a67de5d48a2198b1efa425 +Author: Joel Holdsworth +Date: Mon Mar 12 21:38:25 2012 +0000 + + fx2lafw: Corrected a comment + +commit 93a9f3daaf7fb679660f44c67ffa0ea1171e67b1 +Author: Joel Holdsworth +Date: Mon Mar 12 21:36:17 2012 +0000 + + fx2lafw: Added Saleae Logic (and clones) to the device list + +commit f8b07fc6c37cc40dbcc3c6bc607d6e3137b532e4 +Author: Joel Holdsworth +Date: Mon Mar 12 21:31:43 2012 +0000 + + fx2lafw: Moved firmware path into fx2lafw_profile + +commit 4679d14db3fcc6e8990b916e0c175848af52f464 +Author: Joel Holdsworth +Date: Mon Mar 12 21:06:45 2012 +0000 + + fx2lafw: Made fx2lafw profiles const + +commit 6ccfadaf667a615c00526a7fb9df0500f35cc0e3 +Author: Joel Holdsworth +Date: Mon Mar 12 21:04:53 2012 +0000 + + fx2lafw: Made string pointers constant + +commit 17b6c75a899bb5fb2b8b841b60e3e9fb52ca3e30 +Author: Joel Holdsworth +Date: Mon Mar 12 21:03:13 2012 +0000 + + fx2lafw: Added ESLA201A to device list + +commit 017375d17ebddce8f986568a476018593c8b5ffc +Author: Joel Holdsworth +Date: Sun Mar 11 19:00:52 2012 +0000 + + fx2lafw: Send start command after bulk transfer have been set up + +commit 13d0d2698c97a60cbb73423ffb78846347309c11 +Author: Matt Ranostay +Date: Thu Mar 8 22:26:30 2012 -0800 + + ols: fixed *ctx null dereferences that would SEGFAULT on probing for a OLS or attempting to read from it. + + Signed-off-by: Matt Ranostay + +commit 9031ce63f3cee037ffc3e565cf324cafe38522f5 +Author: Joel Holdsworth +Date: Sun Mar 4 18:02:44 2012 +0000 + + fx2lafw: Corrected check_conf_profile checks + +commit dba024420f934ff10f18eebbaad1f4e97c739259 +Author: Joel Holdsworth +Date: Sun Mar 4 14:10:44 2012 +0000 + + fx2lafw: Implemented control of sample rates + +commit f92994fd9174bc423e58c21eda83633afc9513da +Author: Joel Holdsworth +Date: Sun Mar 4 14:10:05 2012 +0000 + + fx2lafw: Ensure default sample rate is set + +commit d98c4e35ce3187a8d4618a6c26ce35de636d7b91 +Author: Joel Holdsworth +Date: Sat Mar 3 18:09:29 2012 +0000 + + fx2lafw: Removed CMD_STOP and renumbered commands + +commit 2e526f4a6a96bca01c81620ff820aa39e356977f +Author: Joel Holdsworth +Date: Sat Mar 3 15:22:51 2012 +0000 + + fx2lafw: Moved num_samples into context struct + +commit 266784d5947137040b4a72d0e00dc97c0c8b40ba +Author: Joel Holdsworth +Date: Sat Mar 3 15:18:19 2012 +0000 + + saleae-logic: Moved num_samples into context struct + +commit 19ccdf696c3b96459495fadbef56a6c607e87583 +Author: Joel Holdsworth +Date: Sat Mar 3 14:57:57 2012 +0000 + + fx2lafw: Removed CMD_SET_SAMPLERATE + +commit f6582cd7bf62bc945ecadda09123fde6c3676107 +Author: Joel Holdsworth +Date: Thu Mar 1 20:34:20 2012 +0000 + + fx2lafw: Implemented initial support for start capture + +commit 3f8d59721634e1d69251078c254caef81effc62c +Author: Joel Holdsworth +Date: Thu Mar 1 19:47:47 2012 +0000 + + sr: Added device IDs for CWAV USBee AX to udev rules + +commit 74fcfb806d5b66ae4372b982f7836be12328e664 +Author: Joel Holdsworth +Date: Thu Mar 1 19:45:08 2012 +0000 + + fx2lafw: Devices now retain the same PID/VID after fw load + +commit e318664793525543f7001371aee8cad79102266d +Author: Joel Holdsworth +Date: Wed Feb 29 22:47:05 2012 +0000 + + fx2lafw: Implemented SR_HWCAP_PROBECONFIG and SR_HWCAP_LIMIT_SAMPLES + +commit c8f2c9dda4027fe723aabccb4265629c374afcd9 +Author: Joel Holdsworth +Date: Sun Mar 4 14:34:16 2012 +0000 + + fx2lafw: Fixed a compiler error, and made cv_data consistent with saleae-logic.c + +commit 0abee5076fd7751bd77d0fee940d617a1a40ea34 +Author: Uwe Hermann +Date: Sun Mar 4 15:08:11 2012 +0100 + + sr: Fix some TODOs, improve comments/docs. + +commit b5118d6c013c4b5ae7ae146166750b3e392c4a14 +Author: Uwe Hermann +Date: Sat Mar 3 14:13:21 2012 +0100 + + sr/srd: s/handler/callback/. + + We should consistently use the same name for the same thing. + +commit 3cd3a20b350ed1e86675aee067f60ac5a2f576b1 +Author: Uwe Hermann +Date: Sat Mar 3 09:56:49 2012 +0100 + + sr: More callback param renames. + + Start/stop acquisition callbacks: Consistently name the 'void *' parameter + cb_data for now. The per-device-instance device pointer is called + 'session_dev_id' everywhere for now, but this should be renamed to + something more clear. + +commit 1f9813eb6cf2fa3b6511af46b19270feb9484c1e +Author: Uwe Hermann +Date: Wed Feb 29 22:32:34 2012 +0100 + + sr: Name all callback data 'cb_data'. + +commit 31ccebc4925d245fed02545415ce3ee14055d897 +Author: Uwe Hermann +Date: Wed Feb 29 22:08:45 2012 +0100 + + sr: s/sr_session_bus/sr_session_send/. + +commit d08490aabaa66b547c8299b757f62ff5319dbf0b +Author: Uwe Hermann +Date: Wed Feb 29 21:56:24 2012 +0100 + + sr/srd: Consistency fixes for callbacks. + + - Callback function pointer typedefs end with _t. + + - Variables holding callback functions are named 'cb' everywhere. + +commit cfe064d8e74d86ab6a65779663ca1fb82e36260a +Author: Uwe Hermann +Date: Wed Feb 29 19:56:15 2012 +0100 + + sr/cli/gtk/qt: s/hw/driver/ in some places. + +commit c496ac97a83aa33dd2add8074c454b7dc1b08fe6 +Author: Uwe Hermann +Date: Wed Feb 29 19:32:39 2012 +0100 + + sr: sr_hw_has_hwcap(): More docs, error checks. + +commit 2f8cf274094b945bc2e4d51fefb0408867b39cac +Author: Uwe Hermann +Date: Wed Feb 29 19:17:36 2012 +0100 + + sr: s/sr_dev_probe_name/sr_dev_probe_name_set/. + +commit 7b8ca864a00010d64172820bb82b30cb5f2d0009 +Author: Uwe Hermann +Date: Wed Feb 29 19:11:09 2012 +0100 + + sr: datastore: More error checks. + +commit c30b417f719e20f9f1d29fd8fa72c24278af3a0c +Author: Uwe Hermann +Date: Tue Feb 28 23:53:17 2012 +0100 + + sr: Rename hwplugin.c to hwdriver.c. + +commit c09f0b578c0e9c03590cb814f66004bb3f6815ff +Author: Uwe Hermann +Date: Tue Feb 28 23:52:30 2012 +0100 + + sr/cli/gtk/qt/: s/plugin/driver/. + +commit 2285cf9bc519edb88eccbe3bf2ddd6888e54cdf2 +Author: Bert Vermeulen +Date: Tue Feb 28 17:47:02 2012 +0100 + + sr: code cleanup + +commit d261dbbfcc7317f2fd9aa9c08473dc4a7b6b2b30 +Author: Uwe Hermann +Date: Tue Feb 28 01:09:29 2012 +0100 + + sr: Fix/document probe names. + +commit 6c39d99a2809c0065b8bd547c426a08f42445e92 +Author: Uwe Hermann +Date: Mon Feb 27 23:55:06 2012 +0100 + + sr: fx2lafw: Consistent #include guard naming. + +commit f9a69557d276ee27d551eb9ef68f2700324613b4 +Author: Uwe Hermann +Date: Mon Feb 27 23:53:44 2012 +0100 + + sr: fx2lafw: Use gboolean consistenly. + +commit 772a0e615397b63f5d5c9af1d25475e9e5dbe76b +Author: Uwe Hermann +Date: Mon Feb 27 23:40:38 2012 +0100 + + fx2lafw: Small consistency fixes. + +commit be4b99e897827b46c396a8c83cee0ce1c19d3afe +Author: Uwe Hermann +Date: Mon Feb 27 23:26:05 2012 +0100 + + fx2lafw: Compile fix. + +commit 5da939028db118a2e1445184b8d8406ecdcc9850 +Author: Joel Holdsworth +Date: Mon Feb 27 19:34:24 2012 +0000 + + fx2lafw: Implemented hw_dev_acquisition_stop + +commit 610dbb70914da9be34d9ac3f0c90a50356275277 +Author: Joel Holdsworth +Date: Mon Feb 27 19:32:58 2012 +0000 + + fx2lafw: Implemented hw_dev_acquisition_start + +commit 7cb621d418281f64144048e6257055b1b25b5da9 +Author: Joel Holdsworth +Date: Mon Feb 27 19:21:08 2012 +0000 + + fx2lafw: Basic implementation of hw_dev_config_set with SR_HWCAP_LIMIT_SAMPLES + +commit 62bc70e412e073580576fe8fda7c7bc7c9e2e30e +Author: Joel Holdsworth +Date: Mon Feb 27 19:02:52 2012 +0000 + + fx2lafw: Added more to hw_cleanup + +commit f1898235e85c884cca985e797848930a6b52139a +Author: Joel Holdsworth +Date: Mon Feb 27 19:00:22 2012 +0000 + + fx2lafw: Implemented hw_dev_close + +commit 43125c69937d1599985c281de956f630c00525d6 +Author: Joel Holdsworth +Date: Sun Feb 26 12:39:40 2012 +0000 + + fx2lafw: Implemented hw_dev_open + +commit 7f6a3b43ad9e26a2928672927960bcc02a2c7510 +Author: Joel Holdsworth +Date: Sun Feb 26 12:18:05 2012 +0000 + + sr: Moved GTV_TO_MSEC to sigrok-internal.h + +commit b1eeb67e926ddaddc11e8a509692fdcaf3e2226e +Author: Joel Holdsworth +Date: Sat Feb 25 11:58:55 2012 +0000 + + fx2lafw: Implemented firmware upload + +commit cdfdd71101b04f13663b19b0ceffcdf63628dc36 +Author: Joel Holdsworth +Date: Mon Feb 27 19:42:08 2012 +0000 + + fx2lafw: Renamed fx2lafw_dev to ctx in hw_dev_info_get + +commit 90282c82bce6cb108be2123d2393ce058c7aefdd +Author: Joel Holdsworth +Date: Mon Feb 27 19:41:10 2012 +0000 + + fx2lafw: Renamed fx2lafw_dev to ctx in hw_init + +commit cac0bbaafd0813bfdbfef1c7e235c5c886618354 +Author: Joel Holdsworth +Date: Mon Feb 27 20:50:00 2012 +0000 + + fx2lafw: Renamed dev_insts variable in hw_init + +commit c69e35a7147ca0c1554c8ba13a9210fafb6f9796 +Author: Uwe Hermann +Date: Mon Feb 27 22:27:33 2012 +0100 + + sr: sr_samplerate_string: Allow 3.15Hz etc. as output. + + This is required for some hardware, e.g. ChronoVu LA8, where + 33.333333 MHz or 2.439024 MHz are valid samplerates. This is because the + hardware takes a sampleperiod (in nanoseconds) as input, not a + samplerate (in Hz). + +commit aae2fed675fc63aae58569a03c71201dc449344b +Author: Joel Holdsworth +Date: Sat Feb 11 17:41:22 2012 +0000 + + fx2lafw: Implemented hw_get_status + +commit 8b35f474832e486116d72a76657fc75e95d4db3c +Author: Joel Holdsworth +Date: Sat Feb 11 17:39:39 2012 +0000 + + fx2lafw: Exposed capabilities data + +commit 187b358232aa90de8ee12df915506f839a98f2ad +Author: Joel Holdsworth +Date: Sat Feb 11 16:08:47 2012 +0000 + + fx2lafw: Added probing for fx2lafw devices + +commit f302a082567d10f90cd20fca5a7abd68d7267d96 +Author: Joel Holdsworth +Date: Sat Feb 11 12:08:49 2012 +0000 + + fx2lafw: Added empty hardware module for fx2lafw + +commit 04254c3f833fd048668507fcd925b290c55664d6 +Author: Uwe Hermann +Date: Thu Feb 23 21:54:07 2012 +0100 + + sr: la8: Improve comments and messages a bit. + +commit 050e9219d6bca0d6f986dca07fc2c501295c5bde +Author: Uwe Hermann +Date: Wed Feb 22 21:48:30 2012 +0100 + + sr: No need for dynamic hardware driver registration. + + We don't need or allow run-time registration of hardware + drivers/plugins, they're added at compile-time. + +commit 47671b0f26cc6b3e7cf16257f458eadefe623d9f +Author: Uwe Hermann +Date: Wed Feb 22 19:53:27 2012 +0100 + + sr: la8: Remove some unneeded checks. + +commit ea9cfed7a55260ab97f57150b57c42a28c3a85a7 +Author: Uwe Hermann +Date: Sat Feb 18 18:07:42 2012 +0100 + + sr: Consistent ctx name for per-dev-inst context. + +commit 6b3dfec8dee898726b7b606cdd230bf8bd73bcbc +Author: Uwe Hermann +Date: Sat Feb 18 12:17:56 2012 +0100 + + sr: Fix incorrectly renamed functions. + +commit ee61b340da0bf4f0eb728c375459388c6a7bfd84 +Author: Uwe Hermann +Date: Sat Feb 18 12:16:49 2012 +0100 + + sr: Remove unneeded temp. variable use. + +commit a9a245b428cb9645d73044f6741818d2499efefc +Author: Uwe Hermann +Date: Sat Feb 18 12:11:15 2012 +0100 + + sr: s/config_set/dev_config_set/. + + This functions is per-device-instance, so use dev_ as prefix as with + the other ones. + +commit 69040b7c8ff82aef2ad712b7881492d0fa4c86a8 +Author: Uwe Hermann +Date: Sat Feb 18 12:03:49 2012 +0100 + + sr: s/acquisition_*/dev_acquisition_*/. + + These functions are per-device-instance, so use dev_ as prefix as with + the other ones. + +commit e7eb703fff0167897f7e094e2edbf7d5798857ea +Author: Uwe Hermann +Date: Sat Feb 18 11:57:43 2012 +0100 + + sr: opendev/closedev -> dev_open/dev_close. + +commit 8105505d064ca8cc32799c119c5526fb337a5660 +Author: Uwe Hermann +Date: Sat Feb 18 11:46:51 2012 +0100 + + sr: s/st*_acquisition/acquisition_st*/. + +commit 5097b0d0912165429aceddb5febbf68467b623f5 +Author: Uwe Hermann +Date: Sat Feb 18 11:41:21 2012 +0100 + + sr/cli/gtk/qt: s/get_dev_info/dev_info_get/. + +commit a7d05fcb388f142012035a0ed31bcf74d42bbe73 +Author: Uwe Hermann +Date: Sat Feb 18 00:31:35 2012 +0100 + + sr/cli/gtk/qt: s/configuration/config/. + +commit ffedd0bf5d3abb1eae86db68e336285eddf41778 +Author: Uwe Hermann +Date: Sat Feb 18 00:17:18 2012 +0100 + + sr/cli/gtk: s/capability/hwcap/. + +commit 1d9a8a5fe1458d4b1ecd250161a7962988359350 +Author: Uwe Hermann +Date: Fri Feb 17 23:55:27 2012 +0100 + + sr/cli/gtk: A few more s/instance/inst/. + +commit bb7ef79377ae617e1275373e0b631beb7f909d73 +Author: Uwe Hermann +Date: Fri Feb 17 22:25:01 2012 +0100 + + sr/cli/gtk/qt: s/device/dev/ in many places. + + Also, a few s/instance/inst/ occurences. + +commit d68e2d1a21ac5c3f24d88b7689f98764e4d57c30 +Author: Uwe Hermann +Date: Fri Feb 17 21:02:52 2012 +0100 + + sr: Some more s/device_instance/dev_inst/. + +commit 44dae539254e324e0330e194f9c775be3d761503 +Author: Uwe Hermann +Date: Fri Feb 17 20:44:19 2012 +0100 + + sr: Random cosmetics, fix/amend Doxygen comments. + +commit 7b48d6e104fd461b0c12519b70dbd1c6c72824e1 +Author: Uwe Hermann +Date: Fri Feb 17 19:40:01 2012 +0100 + + sr: Prefix log messages with subsystem string. + +commit 93a04e3be9cdaa276d9e7fe14da053483b567b74 +Author: Bert Vermeulen +Date: Wed Feb 15 03:18:48 2012 +0100 + + sr: rename all sr_hwplugin(s)_* functions to sr_hw_* + +commit 9fc6aa0a566d093b36cdbdad46e0cbdc116ff538 +Author: Bert Vermeulen +Date: Tue Feb 14 13:18:17 2012 +0100 + + sr: la8: remove debug output when no device is found + +commit 341ce41545cab2bda88230c8434f36c64eadd8a1 +Author: Bert Vermeulen +Date: Tue Feb 14 12:26:22 2012 +0100 + + sr: don't free driver-specific per-device struct in drivers + + sr_dev_inst_free() takes care of that. + +commit da1466d677afadcb17b12ebc1223ab0bdafe21db +Author: Bert Vermeulen +Date: Tue Feb 14 00:23:51 2012 +0100 + + sr: rename more functions to sr_thing_action format + + Also improved the interface to find capabilities in a hardware plugin. + +commit d3683c42e74fa61c21fc0f1bf360ae201fc4b1d1 +Author: Bert Vermeulen +Date: Mon Feb 13 15:31:59 2012 +0100 + + sr: rename all sr_device_instance_* functions to sr_dev_inst_* + +commit c532476aa7b9a4afb1f32d5b634348d3e825d6bb +Author: Bert Vermeulen +Date: Mon Feb 13 15:23:16 2012 +0100 + + sr: rename hwplugin functions to sr_thing_action format + +commit e0c25ac99c64f024e30d84c96e3ec48b44fda8d5 +Author: Uwe Hermann +Date: Mon Feb 13 19:49:09 2012 +0100 + + sr: Add missing #include, fixes warning. + +commit 57ab7d9f925c0f93ec711c4e6914881e5ff5dfd9 +Author: Uwe Hermann +Date: Sun Feb 12 20:52:42 2012 +0100 + + sr: cleanup callback: Return int. + +commit 3010f21c9170e9f235d49bc7b333d17677c70e5c +Author: Uwe Hermann +Date: Sun Feb 12 13:31:58 2012 +0100 + + sr: stop_acquisition callback: Return int. + +commit c73d2ea421c2b425c3f0ae33bce2bfd0c448ca5f +Author: Bert Vermeulen +Date: Mon Feb 13 14:31:51 2012 +0100 + + sr: adjust copyright year + +commit 031685005b022b98b5b1604cc6226c0cc2b959f8 +Author: Bert Vermeulen +Date: Mon Feb 13 14:00:47 2012 +0100 + + sr: rename all sr_device_* functions to sr_dev_* + +commit a1645fcd81ed4be71d29380218acb078789a6268 +Author: Bert Vermeulen +Date: Mon Feb 13 03:36:32 2012 +0100 + + sr: more API cleanup and documentation + +commit b2ff95063a845ec7130d97fc3d8e9c65fe45f902 +Author: Bert Vermeulen +Date: Mon Feb 13 02:16:32 2012 +0100 + + sr: whitespace cleanup + +commit 996b0c7234c5cc420181b57370f6ba264aee24d2 +Author: Bert Vermeulen +Date: Mon Feb 13 02:13:51 2012 +0100 + + sr: clean up public/private split in headers + +commit 18beaeff948f5730e1ffbc1a50e8b86c7673f084 +Author: Bert Vermeulen +Date: Mon Feb 13 00:08:23 2012 +0100 + + sr: cleaned up session bus debug helper + +commit bb08ee2e534a7fca22cff2f8d963d64441b6d65a +Author: Bert Vermeulen +Date: Sun Feb 12 23:57:43 2012 +0100 + + sr: public/private API cleanup in hwplugin + +commit 6cfa474a809a56e1ea59f7356570a9fb4b6f2a3e +Author: Bert Vermeulen +Date: Sun Feb 12 22:36:19 2012 +0100 + + sr: rm unused sr_device_clear() and sr_device_probe_clear() + +commit 040ae8be943b499b5e786e4861ed1109ae4ebcce +Author: Bert Vermeulen +Date: Sun Feb 12 20:43:20 2012 +0100 + + sr: sigrok.h is no longer generated + +commit 133a37bfba1a7e1423716b2b872d3bb82a2e64d9 +Author: Uwe Hermann +Date: Sat Feb 11 20:06:46 2012 +0100 + + Use g_try_malloc/g_free/g_strdup consistently. + + Avoid plain malloc()/free() in sr/srd, especially in the API calls. + Also avoid g_malloc*() in favor of g_try_malloc*(). + + Use g_strdup() instead of strdup() so that we can use g_free() + consistently everywhere. + + Exceptions: Stuff that is allocated via other libs (not using glib), + should also be properly free'd using the respective free-ing function + (instead of g_free()). Examples: Stuff allocated by libusb, libftdi, etc. + + Also, use sr_err() instead of sr_warn() for actual errors. sr_warn() is + meant for non-fatal/uncritical warnings. + +commit cd853ff0b2b0ad2643d65e73159661e1a3c6bc66 +Author: Uwe Hermann +Date: Sat Feb 11 00:39:25 2012 +0100 + + sr: chronovu-la8: Add missing #include. + +commit 8c4b60039390eac40fe24c191e89edfd39eac8b8 +Author: Uwe Hermann +Date: Sat Feb 11 00:38:48 2012 +0100 + + sr: asix: Change a free() to g_free() as it should be. + + This also fixes a compiler warning (on FreeBSD at least). + +commit 44b6aafdb748d961547bb80d5b0a0511f35d9702 +Author: Uwe Hermann +Date: Sat Feb 11 00:34:16 2012 +0100 + + sr: FreeBSD has zlib, but no pkg-config file for it. + +commit bf3f06c9c2a73b7c30862daab1e2731768ba6abc +Author: Uwe Hermann +Date: Sat Feb 11 00:20:23 2012 +0100 + + sr: MinGW/Mac: No libusb_detach_kernel_driver() support. + +commit 12f3e8741b5ae651569ca65b94f22a4dc154da7a +Author: Uwe Hermann +Date: Wed Feb 8 22:08:55 2012 +0100 + + sr: Doxygen comments for loglevels. + +commit 0ae67ff784db96268d4dae4b7ac896a78828746d +Author: Uwe Hermann +Date: Wed Feb 8 22:04:13 2012 +0100 + + sr: Implement proper logging framework. + + This is pretty much identical to the current libsigrokdecode API/framework. + +commit d38cd6c1f6f3f23b2f659be2d189f56c7592b805 +Author: Uwe Hermann +Date: Tue Feb 7 23:50:47 2012 +0100 + + sr: saleae: Fix typo. + +commit 003f9bebf9f97225b08383573544c1ece7239aea +Author: Uwe Hermann +Date: Tue Feb 7 23:49:51 2012 +0100 + + sr: saleae: Support more recent firmwares. + +commit c32cc2504b471deab0f511037f843234c726c461 +Author: Uwe Hermann +Date: Mon Feb 6 23:50:22 2012 +0100 + + sr: udev file: Add QuantAsylum QA100, Rigol VS5202D. + +commit 657832184893c8a5e3b28ebf71109956a4a57246 +Author: Uwe Hermann +Date: Mon Feb 6 22:46:22 2012 +0100 + + sr: s/z60_sigrok.rules/z60_libsigrok.rules/. + +commit 7c1d391c8b33bf76f7c6617fe9d5174e16a04f95 +Author: Uwe Hermann +Date: Sat Feb 4 10:56:51 2012 +0100 + + sr: input/output: Mark more symbols with SR_PRIV. + +commit 0f8522bf74af8abfe8601e978b2e0d0e40b1a124 +Author: Uwe Hermann +Date: Sat Feb 4 10:41:30 2012 +0100 + + Project-wide consistent naming for #include guards. + + Document the naming scheme in HACKING. + +commit 5c64390e5ac8a0052d8b7eeb49c781d86027c814 +Author: Uwe Hermann +Date: Sat Feb 4 10:10:43 2012 +0100 + + sr/cli/gtk: Remove analog left-overs from API. + + This will come back in some form or another later, but for now + don't clutter the API with non-working stuff. Removing stuff from APIs + is not possible without breaking the API, adding stuff later is simpler. + +commit e7ee300a12391640ff499eaa4d54089fe7e825f2 +Author: Uwe Hermann +Date: Sun Feb 5 13:37:02 2012 +0100 + + sr: zeroplus: Drop unused global variable. + +commit 3d2efd7d15f1e35b4080c4632dd94376ae824fa2 +Author: Uwe Hermann +Date: Sun Feb 5 13:36:03 2012 +0100 + + sr: Compile fix for Windows/MinGW. + +commit dff75c0df1be07db2e63ef242e843c925779bddb +Author: Uwe Hermann +Date: Sun Feb 5 12:54:44 2012 +0100 + + autogen.sh: aclocal support for Windows XP/Vista/7. + +commit ca070ed9a0237e5cea10e5dd974e06da62de890d +Author: Uwe Hermann +Date: Thu Feb 2 21:15:04 2012 +0100 + + sr: Make more symbols private via static/SR_PRIV. + + Additional zeroplus fixes: + + - Remove unneeded function prototypes from .h files. + + - Remove unused variables and/or use standard libusb #defines instead. + + - Remove unused GL_* error code #defines. + +commit 185ae2c5c9ada0353b43e3736e838bbc8e370cb4 +Author: Uwe Hermann +Date: Thu Feb 2 21:08:33 2012 +0100 + + sr: zeroplus: Remove unused gl_open()/gl_close(). + + Merge the missing function calls into zeroplus.c's init functions. + +commit 1a081ca67d63a0bd933a3d715792d85afd437296 +Author: Uwe Hermann +Date: Wed Feb 1 23:40:35 2012 +0100 + + sr: Mark API functions with SR_API/SR_PRIV. + + Use SR_API to mark public API symbols, and SR_PRIV for private symbols. + + Variables and functions marked 'static' are private already and don't + need SR_PRIV. However, functions which are not static (because they need + to be used in other libsigrok-internal files) but are also not meant to + be part of the public libsigrok API, must use SR_PRIV. + + This uses the 'visibility' feature of gcc (requires gcc >= 4.0). + + Details: http://gcc.gnu.org/wiki/Visibility + +commit 0146970797e809555b2feea9fdbc3933f9e24e8b +Author: Bert Vermeulen +Date: Wed Feb 1 02:59:41 2012 +0100 + + sr: remove unused time/duration fields from datafeed packets + +commit 69890f7399f086c38670961dc72166f00de89af6 +Author: Uwe Hermann +Date: Sun Jan 29 23:06:10 2012 +0100 + + sr: Eliminate usb/serial instances from API. + + The API should be generic and only provide sr_device_instance_new() and + friends, but not sr_usb_device_instance_new(), sr_serial_device_instance_new(), + or others for other device types we may have in the future. The + frontends shouldn't have to know or care about this implementation detail. + + This also fixes the problem that parts of sigrok.h contained + '#ifdef HAVE_LIBUSB_1_0' and such, which is even less desirable for the API. + + The usb/serial instance specifics are now private, and each driver that + needs them keeps a pointer in its driver-specific context. + +commit c31e9ef49b84b61a353168956882140e2b5a93bb +Author: Uwe Hermann +Date: Tue Jan 31 01:54:08 2012 +0100 + + sr: zp: Add missing #include. + +commit fd9836bfab434ed227b685d184e266d3cbc4f6c8 +Author: Anatoly Sokolov +Date: Sun Jan 29 16:56:06 2012 +0400 + + Add sr_device_get_info + +commit bf43ea2317d35a3bc774a9c7e1cf6ff9b6204736 +Author: Uwe Hermann +Date: Sun Jan 29 19:14:25 2012 +0100 + + sr: zeroplus: Use device-specific context. + + Make the zeroplus driver use a "struct zp" with per-device-instance + data (such as samplerate, trigger settings, and so on), like the other + drivers do. + + Also, add a few more error checks. + +commit ae32d7d759f5722f9d82a2da8ec4bbdebcfd029b +Author: Uwe Hermann +Date: Sun Jan 29 12:47:53 2012 +0100 + + sr: la8: Fix typo. + +commit 73017cf914b014ff3366de981035ca23ac72a0be +Author: Uwe Hermann +Date: Sat Jan 28 23:29:28 2012 +0100 + + sr: zeroplus: Fix a segfault. + +commit ef7228ba49ddaced0f1972a4788ff2fdb8dcd57d +Author: Uwe Hermann +Date: Sat Jan 28 21:26:56 2012 +0100 + + Update/enforce/document our build requirements. + +commit fb93625d1afbe0bc2648b550102c100949066fbd +Author: Uwe Hermann +Date: Sat Jan 28 19:42:04 2012 +0100 + + sr: sigrok.h.in: Set SR_HWCAP_DUMMY to 0 explicitly. + +commit 660ef7d730969a401b3d64dc624138567dbbdb7a +Author: Uwe Hermann +Date: Sat Jan 28 19:40:05 2012 +0100 + + sr: sigrok.h.in: Drop obsolete 'GSList *analyzers'. + +commit a4cfb10f7fcb5dd5c7df403bff0787bb6b1c1949 +Author: Uwe Hermann +Date: Sat Jan 28 19:23:09 2012 +0100 + + sr: Drop analog left-overs from sigrok.h. + + For now, there's no analog/scope support in sigrok yet (will be added + later), so remove any such items from the public API (sigrok.h). + + Having '#if defined(HAVE_LA_ALSA)' in sigrok.h is a bug anyway, the API + must not have anything device-dependent in general, and sigrok.h + specifically must not have any #ifdefs for specific hardware. + +commit a141db8c4acb98c01dbc0a73f82111ee56f1050a +Author: Anatoly Sokolov +Date: Sat Jan 21 18:34:11 2012 +0400 + + add SR_HWCAP_DEMO_DEVICE capability + +commit f020a99773d1431ee58090e9515dc19b10e7463f +Author: Renato Caldas +Date: Thu Jan 12 11:50:50 2012 +0000 + + link-mso19: Fixed led toggling (the bit masking was not being proprly done). + +commit e084a8042ea0bccb306e39725de73546138e1adf +Author: Renato Caldas +Date: Wed Jan 18 16:03:39 2012 +0000 + + link-mso19: Prevent double free errors when freeing sdi->priv. + +commit 357285a944b514bb4498f16b6318829516e33e1a +Author: Renato Caldas +Date: Wed Jan 18 12:09:36 2012 +0000 + + link-mso19: Add debug messages. + +commit a29360733d32e8479147178774d6a72e62f4e56c +Author: Renato Caldas +Date: Tue Jan 17 13:41:38 2012 +0000 + + link-mso19: Properly initialize the protocol trigger block + +commit a84671913ef320d10607f9c8aabaf6bc3563099b +Author: Renato Caldas +Date: Tue Jan 17 13:16:41 2012 +0000 + + link-mso19: Added new register definitions and renamed variables to reflect new findings. + +commit 80aa5f23d1225776a7db0fc6faa763bb5c141dcf +Author: Renato Caldas +Date: Sat Jan 14 12:46:27 2012 +0000 + + link-mso19: Added struct definitions for the pattern generator config and the protocol trigger config. + +commit 66410a8617185da7abf4ca21da99e934b22351bb +Author: Uwe Hermann +Date: Thu Jan 19 00:32:02 2012 +0100 + + sr: g_free()/g_string_free() can handle NULL input. + +commit af1c793dfe27b622a48dd213c4d42bc012e81965 +Author: Bert Vermeulen +Date: Sun Jan 15 23:14:45 2012 +0100 + + clean up some dead code + +commit 8f81fe87287eba2113c3db9d2f894314b70afd19 +Author: Uwe Hermann +Date: Tue Jan 10 22:16:41 2012 +0100 + + sr: s/g_message/sr_dbg/. + + libsigrok should only use sr_*() for debug output. + +commit 8c76be539e8098c08f69f56053077211001ed52b +Author: Bert Vermeulen +Date: Sun Jan 8 22:05:00 2012 +0100 + + clean up drivers at the end of a session, and fix session file init. + +commit e0508e67998b6b2b5cdd65b4b094b50c07386385 +Author: Uwe Hermann +Date: Sat Jan 7 17:08:54 2012 +0100 + + sr: session: Make most functions return int. + + This allows us to return error codes etc. + + Add a little more error handling. + +commit b3b21462914d6ed89c85f3da27d46744b863f800 +Author: Uwe Hermann +Date: Sat Jan 7 14:15:10 2012 +0100 + + More .gitignore files cleanup. + +commit db4b455beeeb4ad632b4e394402b83a4305a40fc +Author: Bert Vermeulen +Date: Sat Jan 7 02:13:05 2012 +0100 + + remove obsolete libsigrokdecode struct + +commit 8ff6afc95d2a9213b8a583e88e9e1b4eb59aad17 +Author: Uwe Hermann +Date: Fri Jan 6 16:20:28 2012 +0100 + + sr: Consistently use 512kB as default chunk size. + +commit 1190dcf713a458d99c612f8f41c2d28e666aabfb +Author: Renato Caldas +Date: Fri Jan 6 11:07:37 2012 +0000 + + Added "autostuff" to the .gitignore. + +commit 446a037205a7488b424bde90d1b633f00640ef12 +Author: Renato Caldas +Date: Fri Jan 6 00:04:29 2012 +0000 + + session: Fixed error reporting. + +commit 42eb54fb62b84adb5aaa4bf9144752e46ade54ea +Author: Uwe Hermann +Date: Fri Jan 6 01:05:55 2012 +0100 + + mso-19: Fix whitespace. + +commit d88b9393241e250590333326a4f8d19b53b4bdc6 +Author: Renato Caldas +Date: Thu Jan 5 23:37:54 2012 +0000 + + link-mso19: fixed segmentation fault. + +commit e42ef08dba163e8c9ef933347732d9e8c58ab399 +Author: Renato Caldas +Date: Thu Jan 5 19:42:06 2012 +0000 + + link-mso19: Updated to the current structs (fixed compilation). + +commit 0c8dc7b4160c47a21925e22da7c1be73e4c3a39a +Author: Uwe Hermann +Date: Wed Jan 4 16:45:53 2012 +0100 + + udev: Add missing USB IDs for some devices. + +commit 8e43129c10669d767d7eb17e786f38b70d799e60 +Author: Uwe Hermann +Date: Wed Jan 4 15:26:41 2012 +0100 + + A few more fixes for configure.ac files. + + Add missing checks and quotes, remove superfluous checks, etc. + +commit dd8b5f565f60d536104b30bee8aadf4ea333aa7c +Author: Uwe Hermann +Date: Wed Jan 4 02:50:26 2012 +0100 + + sr/srd: Add Doxyfile to the tarball. + +commit 4abf8dd0a540db8c8f5af5e6bd78c6eb7b473d9f +Author: Uwe Hermann +Date: Wed Jan 4 02:41:33 2012 +0100 + + srd: Show config summary, libs, and Python info. + +commit 45aed0721c687a29bb394bff10cc129dab0f11c2 +Author: Uwe Hermann +Date: Wed Jan 4 00:49:21 2012 +0100 + + sr: configure.ac: Print more summary info. + + - Package version (major.minor.micro) + + - Library version (current:revision:age) + + - Installation prefix (usually /usr/local) + + - Detected libraries and their versions (only for pkg-config libs) + +commit 3af71f0da646de1e61ccbed2e85e3fca9798565c +Author: Uwe Hermann +Date: Wed Jan 4 00:05:43 2012 +0100 + + sr: configure.ac: Fix version number magic. + +commit d8521c939f19b08cb991df7d0731fa358381d61c +Author: Uwe Hermann +Date: Tue Jan 3 21:55:48 2012 +0100 + + Put most autotools files into autostuff/. + + This yields a slightly more "tidy" top-level directory. + +commit 8e190238d7b33ebb9f1baa2a28a37ffd041f7334 +Author: Uwe Hermann +Date: Tue Jan 3 20:06:36 2012 +0100 + + sr: Put files into .../share/libsigrok. + +commit 0da5b6a9f5a119ab485ed3dba08aeb4a3ad2c8f4 +Author: Uwe Hermann +Date: Tue Jan 3 20:01:02 2012 +0100 + + sr: Remove useless filename prefixes. + +commit cd315a80d87a24a19a7846497d74c5ca85d494a0 +Author: Uwe Hermann +Date: Tue Jan 3 19:56:01 2012 +0100 + + sr/srd: Fix left-over #includes. + + The libs themselves should use #include "sigrok.h" etc., while the + frontends must use #include and so on. + +commit 3b7c8f54fcf4c6de1ec67d11a9ec8975a2ddbb57 +Author: Uwe Hermann +Date: Mon Jan 2 14:25:52 2012 +0100 + + sr: Drop some obsolete and commented out code. + +commit 9f45fb3aea9aa628ec2323bac8f2c354f5f3983c +Author: Uwe Hermann +Date: Mon Jan 2 14:15:25 2012 +0100 + + sr: session: Add docs and some error checks. + +commit 13177edbdf23200001fcc141f61419beb93962b6 +Author: Uwe Hermann +Date: Fri Dec 30 22:38:25 2011 +0100 + + Split README, add appropriate ones per-project. + +commit f928befdadd7b9a50ded5fe730a0aeec06b1ed09 +Author: Uwe Hermann +Date: Fri Dec 30 22:12:37 2011 +0100 + + Update/fix .gitignore files. + +commit db8ae7b941a31b2bc64e14d60a1e962fd2b2dc38 +Author: Uwe Hermann +Date: Fri Dec 30 10:50:00 2011 +0100 + + sr/srd: Remove/fix non-applicable autotools stuff. + +commit 826938d81e2e5bf592fbed82523081fcb7fdf85e +Author: Uwe Hermann +Date: Fri Dec 30 10:42:39 2011 +0100 + + sr/srd: Move some files to their resp. dirs. + +commit 5e59cfbfc736aab9e79caef4ab6bdcbc500e254f +Author: Uwe Hermann +Date: Thu Dec 29 13:05:24 2011 +0100 + + Move most contrib/ stuff to libsigrok. + + The udev rules file is libsigrok-specific, the gnuplot files too. + + The nsis files stay in the top-level contrib/ for now, they're not + really part of any of the (sub-)projects, but rather are used to create + a single Windows .exe installer for all of them. + +commit c37d2b1ba12b62d63590509879bf58adf842896d +Author: Uwe Hermann +Date: Thu Dec 29 19:50:14 2011 +0100 + + probe names: Fix cosmetics, add docs, fix off-by-one. + +commit 464d12c72aa8d83acccccbbc0bc755fbb9d542c0 +Author: Kristoffer Sjöberg +Date: Thu Dec 29 17:04:31 2011 +0100 + + Move the probe naming to the creator of the device, and let each driver name its own probes. + +commit 2d83e0f963b39104ba065c61ef22456adcf15a8d +Author: Uwe Hermann +Date: Wed Dec 28 23:11:52 2011 +0100 + + Fix outdated ezusb_install_firmware() prototype. + +commit b7f09cf86dd57a59dc1bdece2cac9e4a176900b1 +Author: Uwe Hermann +Date: Wed Dec 28 23:07:08 2011 +0100 + + libsigrok: Fix #includes. + + In the lib, we should only #include "sigrok.h" or "sigrok-internal.h", + but not the (possibly installed and thus different/older versions) via + or . + + Frontends should of course use and . + +commit a0ecd83bc6e07ea412db5cd0108d50d89e36df8f +Author: Uwe Hermann +Date: Wed Dec 28 22:55:21 2011 +0100 + + Make more variables/functions static and non-global. + + The 'GSList *devices' from device.c was actually really global (i.e., + listed in sigrok.h), which is now fixed. + +commit c5d660ae244babd4afc7863ba23f66d31af6e29e +Author: Uwe Hermann +Date: Wed Dec 28 21:38:56 2011 +0100 + + Drop unused 'global' struct/variable. + + The libs shouldn't have any (externally visible) globals anyway. + +commit 155d1012f138fa94980c33a0e42b50ca0922ddce +Author: Uwe Hermann +Date: Wed Dec 28 21:37:37 2011 +0100 + + sigrok-proto.h: Drop obsolete prototype, move other one. + +commit 08d4cc1d146478aa9f6032fc65142293df822726 +Author: Uwe Hermann +Date: Wed Dec 28 21:34:37 2011 +0100 + + device: Make some parameters const. + +commit 0e3b143994797cd4685526b9a739089fe83385cf +Author: Uwe Hermann +Date: Wed Dec 28 17:16:33 2011 +0100 + + device: Change some functions to return int. + + The callers of these functions are yet to be changed so that they + actually check the return values and handle errors appropriately. + +commit 94799bc4dc6ab1ba64cdb7f0fb350d63d4fcee66 +Author: Uwe Hermann +Date: Wed Dec 28 16:19:15 2011 +0100 + + device: Add Doxygen comments, improve error handling. + + - Add Doxygen comments for all functions (some TODOs remain). + + - Check return code of more functions, handle invalid input. + +commit cb1e389c72ead8cf6eb440f3194f5056d86069ec +Author: Bert Vermeulen +Date: Thu Dec 15 03:31:31 2011 +0100 + + make time/duration work, at least when loading from a session file + + PD decode() call now takes 3 arguments: timeoffset, duration, data + as per the current API specification. + +commit 15278f3e9cf4c4a4a6c331e042f9935709343c82 +Author: Uwe Hermann +Date: Sun Dec 25 19:59:15 2011 +0100 + + datastore.c: Improve error handling and docs. + + - Add Doxygen comments for all functions (some TODOs remain). + + - Check for invalid input parameters (such as NULL pointers etc). + + - Return SR_ERR_ARG upon invalid input parameters. + + - Make sr_datastore_put() return int instead of void, so we can pass + an error code (SR_OK, SR_ERR_MALLOC, and so on) to the caller. + +commit 7a6ec0c376cec9e41a12a876edea34fecaf5c2aa +Author: Uwe Hermann +Date: Fri Dec 23 15:26:54 2011 +0100 + + sr_filter_probes(): Check for too many probes. + + Return SR_ERR_ARG if the number of enabled probes is higher than the + requested unit size supports. + +commit 488a13b110d3563194dd63e087e295a4aa114002 +Author: Uwe Hermann +Date: Thu Dec 22 14:10:16 2011 +0100 + + Improve sr_filter_probes error handling and docs. + + - Much more elaborate doxygen comments for the function and its + parameters, allowed input values, and so on. + + - Make 'probelist' const, the function doesn't modify it. + + - Check for invalid inputs such as NULL pointers. + + - Use g_try_malloc() and g_free() for the output buffer. Document who + is expected to g_free() the buffer. + +commit 25a605d187e9661757a1e5d4bd15fac2b533c296 +Author: Uwe Hermann +Date: Sun Dec 4 18:33:29 2011 +0100 + + libsigrok: Quickfix for a segfault in ChronoVu LA8. + +commit 276585ff209d02ea058f09820881ed536e48e3bb +Author: Gareth McMullin +Date: Mon Nov 28 21:52:35 2011 +1300 + + srd: Pass samplerate to decoder in metadata. + +commit f64c14141b0c90fa78cacbc502dd2a41239376fd +Author: Bert Vermeulen +Date: Sun Nov 27 19:31:25 2011 +0100 + + fix CLI size string specification + + accept "hz" as optional qualifier but nothing else + properly return an error instead of quietly returning zero size + +commit cb93f8a927e6fb2cb1d89176766c5c9c398db5c3 +Author: Uwe Hermann +Date: Thu Nov 24 22:57:48 2011 +0100 + + Other method to avoid "unused var" compiler warnings. + + The '(void)varname' method is nicer than 'varname = varname' and also + prevents warnings when compiling sigrok with clang instead of gcc. + +commit cc8a7d250cf7daff452ce376224c9853529204ca +Author: Uwe Hermann +Date: Thu Nov 24 22:42:02 2011 +0100 + + Add missing #includes to avoid clang warnings. + +commit e7bad06355ea218d83e6df1d1137e67a58513b35 +Author: Bert Vermeulen +Date: Sun Nov 20 03:16:33 2011 +0100 + + la8: device not found during init() scan is not an error + + fix some hardware plugin semantics + +commit e48846b1d211ce88e5ad427c034e0a2fb43bbe37 +Author: Uwe Hermann +Date: Sat Nov 19 16:19:24 2011 +0100 + + libsigrok: glib-2.0 is a hard requirement. + +commit 4d436e71ba6059b217a3d90775033e850944ad42 +Author: Gareth McMullin +Date: Sat Nov 19 13:41:41 2011 +1300 + + Changed SR_T_NULL to SR_T_BOOL and adjusted RLE option. + +commit 6bb5c5fadfe011ae7797138fb9e9ade32edb0caf +Author: Uwe Hermann +Date: Thu Nov 17 23:00:33 2011 +0100 + + Consistently use __func__ instead of __FUNCTION__. + + The __func__ form is standardized and more portable. + +commit a562c3a2e5e54dbb7e0553422ac0e0c845b180ad +Author: Uwe Hermann +Date: Thu Nov 17 22:54:17 2011 +0100 + + libsigrok: Use sr_err() et al instead of printf. + +commit 805e9640ff4a28dc470afb0b4f3b02aece44179b +Author: Gareth McMullin +Date: Thu Nov 17 21:18:46 2011 +1300 + + Fixed a crash when loading a second session file. + +commit 48ca6b54b0a5e7b0cd5f34fa4066523a1a3cc3a3 +Author: Uwe Hermann +Date: Tue Nov 15 22:46:57 2011 +0100 + + sigrok.h: Remove SIGROK_*VERSION #defines again. + + These version numbers represent the sigrok version (i.e., the version + of the tarball, such as "sigrok-0.2.0.tar.gz"), but _not_ the libsigrok + (libtool) library/API/ABI versions. Thus, they should not be in + libsigrok's include file (sigrok.h). + +commit 719c5a934c7705466a449854b876b9962eb4cb5e +Author: Uwe Hermann +Date: Tue Nov 15 21:05:40 2011 +0100 + + Fix some compiler warnings. + +commit 300007323ec5963e211b75d2e0d957721dea35fa +Author: Uwe Hermann +Date: Tue Nov 15 01:11:27 2011 +0100 + + libsigrok.pc: Add Required.private field entries. + + The "Required.private:" field in pkg-config .pc files is used for + declaring that we need the listed libs (pkg-config packages) for + static linking, but not for dynamic linking. + I.e., the "Required.private:" field should be used for libs which we + use internally in libsigrok, but which we do not "expose" ourselves. + + For now all libs are listed as "Required.private:" instead of + "Required:", but this may not be entirely correct and needs to be + checked carefully at some later date. + +commit 5c582d9f61fa7dad2a5cf07e1f464b6b6ffb1e28 +Author: Gareth McMullin +Date: Sun Nov 6 11:44:25 2011 +1300 + + Remove IO source if callback returns FALSE. + +commit 52f28f821f8923f52fce5b76909c00015231e299 +Author: Uwe Hermann +Date: Fri Apr 29 19:27:32 2011 +0200 + + sigrok.h: Add SIGROK_{MAJOR,MINOR,MICRO,}_VERSION #defines. + +commit 7583b99dbb2310ce2e34fd435c42634dec940ad6 +Author: Gareth McMullin +Date: Sun Oct 30 14:25:24 2011 +1300 + + OLS: Calculate actual sample rate used. + +commit baf1d71477ea5c1dea449bc9ce72b39d02751934 +Author: Uwe Hermann +Date: Sun Oct 30 02:10:32 2011 +0200 + + ols: Minor whitespace and coding style fixes. + +commit 3a4d09c0de68c3ae9f287d243967431b8e3de0b7 +Author: Gareth McMullin +Date: Sat Oct 29 15:57:17 2011 +1300 + + Run-Length Encoding support for the OLS. + +commit 221304219ef861c14a44017eb025631bbd2fa05c +Author: Gareth McMullin +Date: Sat Oct 29 15:21:16 2011 +1300 + + Prevent reading past end of OLS hardware buffer. + +commit 9a751023136a058dadf008a4ff983351947cc0df +Author: Jerry +Date: Mon Jun 20 23:43:44 2011 +0200 + + Mac OS X build fixes + +commit a634574eae69c9e712d5dbec8b97809840876c5f +Author: Bert Vermeulen +Date: Mon Jun 20 11:43:34 2011 +0200 + + saleae-logic: fix timing on packets when triggering is used + +commit 7d2afd6c954e4b1507b494c5c0d469c2ecf59cb2 +Author: Bert Vermeulen +Date: Mon Jun 20 11:42:43 2011 +0200 + + better session bus logging + +commit 9c939c5132d82575cc1ce8f8fef5b6c4289aec5b +Author: Bert Vermeulen +Date: Sun Jun 19 14:28:50 2011 +0200 + + use new datafeed packet format + +commit 38ab3ee79db2a08dd1f01fff08b7474093a48ce5 +Author: Bert Vermeulen +Date: Sun Jun 19 02:35:23 2011 +0200 + + new datafeed packet format + + struct sr_datafeed_packet now has timeoffset and duration fields, + expressed in picoseconds (1/10^12 seconds) + length and unitsize are now in a separate struct sr_datafeed_logic + +commit 60eb1eb5820be30671729c08b371b0ab3c14c860 +Author: Bert Vermeulen +Date: Sun Jun 19 00:55:36 2011 +0200 + + fix parameter type + +commit 8e49cebd10a1f34e9d5cdafeebc4c59a5c3c563c +Author: Bert Vermeulen +Date: Sun Jun 12 18:07:15 2011 +0200 + + whitespace + +commit 6d754b6d3a8f843cd5254617674f484cac9b12db +Author: Bert Vermeulen +Date: Sun Jun 12 18:04:19 2011 +0200 + + support for multiple FX2 devices + +commit e53c830f33d08633db4eb560f08d2518ff26ad9e +Author: Bert Vermeulen +Date: Sun Jun 5 02:08:08 2011 +0200 + + saleae-logic: use new logging system + +commit e10d6e32e4d8766e12b752da6d1806944b0ee85e +Author: Bert Vermeulen +Date: Sat Jun 4 23:20:00 2011 +0200 + + saleae-logic: support for other FX2 devices (bare FX2) + + This enables support for devices that have a different VID/PID + than the Saleae Logic, and yet another after firmware upload. + + After firmware upload is checked every 100ms whether it came back, + instead of always waiting for 2 seconds. + + If the kernel attaches a driver to a device we know, detact it first. + +commit 8722c31e26ecebfc75035a566d4d72d07761ef14 +Author: Bert Vermeulen +Date: Mon Apr 4 05:13:29 2011 +0200 + + better cleanup of device/plugin resources + +commit 896a19fd65790093b60ece2d1bdd36caba74eaf8 +Author: Uwe Hermann +Date: Mon May 9 00:59:41 2011 +0200 + + LA8: Remove trailing whitespace. + +commit d1175d5f7e184dff420038a801113f1d3c8a6ee8 +Author: Uwe Hermann +Date: Mon May 9 00:54:59 2011 +0200 + + LA8: Use sr_spew() where appropriate. + +commit f36cbf60cbd43be46ede083265549068db21f4b6 +Author: Uwe Hermann +Date: Mon May 9 00:52:55 2011 +0200 + + LA8: Improve trigger support and debug output. + +commit 06dd80d424a511736e0c61492bd618a5c3e65cff +Author: Uwe Hermann +Date: Sun May 8 20:26:22 2011 +0200 + + Add sr_spew/SR_LOG_SPEW for even more debug output. + + This is meant for really extensive debug output which can slow down + operation significantly and should thus only be enabled if really needed. + +commit a76983fd207554de93adabfd33d2abf8d0f3662a +Author: Uwe Hermann +Date: Sun May 8 20:20:26 2011 +0200 + + LA8: Eliminate magic numbers. + +commit 4d7b525ae9c0a85097280e77b9c158e9c4c8c6e5 +Author: Uwe Hermann +Date: Sun May 8 20:09:22 2011 +0200 + + LA8: Add trigger point support. + + Report trigger point/position via SR_DF_TRIGGER packet. + +commit 5a9660dd4e4977b9c3a86fe895e0b714e64a44a1 +Author: Uwe Hermann +Date: Fri May 6 20:38:48 2011 +0200 + + demo: Use memset(), might be faster. + +commit c03ed397330b031fa5f63a5dd548e05c2c2d6923 +Author: Uwe Hermann +Date: Fri May 6 20:34:12 2011 +0200 + + demo: Add all-low/all-high pattern support. + + Also, improve error handling a bit. + +commit c8f4624d9b265f63bc880df28bd9b1a7e29f1488 +Author: Uwe Hermann +Date: Thu May 5 13:02:48 2011 +0200 + + demo: s/genmode/pattern/. + +commit 0d31276b05643407ba4a4a9e3f0f95e259c8baa2 +Author: Uwe Hermann +Date: Wed May 4 22:37:12 2011 +0200 + + demo: Rename GENMODE_DEFAULT to GENMODE_SIGROK. + + Also, add (Doxygen) comments for the currently supported patterns that + the demo device/driver can generate. + +commit e88dadd77cd9fcb4fc0e85eeb6c41155847529ad +Author: Uwe Hermann +Date: Wed May 4 22:26:55 2011 +0200 + + Improve (Doxygen) comments for HWCAP entries. + +commit 68c12597efda33a30b6152cbac4b805604f3e671 +Author: Uwe Hermann +Date: Wed May 4 20:05:33 2011 +0200 + + demo: Eliminate unneeded tmp_u64. + +commit d3b1b51cbef3edfeefbc5b9edfdd8423c6d5e8e0 +Author: Uwe Hermann +Date: Wed May 4 19:46:33 2011 +0200 + + LA8: Free memory from g_*alloc*() via g_freee(). + +commit 340cfac0f0629aa3ee84a0a4db53381d04079fe3 +Author: Uwe Hermann +Date: Wed May 4 19:44:25 2011 +0200 + + log messages: Use device name, not vendor name. + + There can be multiple devices from the same vendor, obviously. + +commit 697785d1aedc0bf385ea21074d83d61b11d8ce29 +Author: Uwe Hermann +Date: Wed May 4 19:34:12 2011 +0200 + + libsigrok: closedev() now has a return code. + + This is useful to allow frontends to react upon close failures in a + way they see fit (e.g. a popup in the GUI, or error message in the CLI). + They can also still ignore the error if they want, of course. + +commit 1352eeddd4d164b58f2233ae109432b73faab539 +Author: Uwe Hermann +Date: Wed May 4 19:03:01 2011 +0200 + + libsigrok/cli: Implement loglevel support. + + libsigrok can now be told at which loglevel to work, i.e., how many + debug/error/warning output to generate. You can also query the current + loglevel. + + In sigrok-cli it is now possible to set the loglevel via -l. For example: + + - Disable all output: sigrok-cli -l 0 + - Only show errors: sigrok-cli -l 1 + - Show errors, warnings, info, and debug messages: sigrok-cli -l 4 + +commit 548b08e55cf05aeb8f57b26b29035c3fb153f0f5 +Author: Uwe Hermann +Date: Tue May 3 19:18:43 2011 +0200 + + Drop unneeded skeleton files. + + They're not too useful as they mostly consist of a list of function names, + and that list is already available in the respective struct. The wiki + API docs and the code in the various hardware/output drivers serve as + useful examples already, no need for additional files. + +commit 86f5e3d826fc9059e110f07221cb1a30652ceac2 +Author: Uwe Hermann +Date: Tue May 3 19:15:54 2011 +0200 + + libsigrok: Rename open/close to opendev/closedev. + +commit 6f42226475bea46cebd348c1c7556cf9a6fce118 +Author: Uwe Hermann +Date: Mon May 2 01:40:16 2011 +0200 + + demo: Add some more debug output. + +commit 02604ed6def368edd782bae3c43c7de86111691e +Author: Uwe Hermann +Date: Tue Apr 26 23:56:00 2011 +0200 + + Initial support for CSV as output format. + +commit f38bdf5678d35a1493c17a5c260fc1120d93bd93 +Author: Uwe Hermann +Date: Tue Apr 26 17:27:34 2011 +0200 + + Change left-over SIGROK_* to SR_*. + +commit 4362438f1e2da14d04678327c403f9d75c4c0a48 +Author: Uwe Hermann +Date: Mon Apr 25 00:16:47 2011 +0200 + + LA8: Shrink mangled_buf from 8MB to 4KB. + + It's not necessary to have an 8MB buffer. Also, make it static, don't + use malloc() here. + +commit da0918aae0d43ab25cb72ddf8773831f0364ebdb +Author: Uwe Hermann +Date: Sun Apr 24 22:53:27 2011 +0200 + + ASIX: Small consistency fixes. + +commit 4bc5fd4568350e3d4025ea72158a8a611650a912 +Author: Uwe Hermann +Date: Sun Apr 24 22:50:04 2011 +0200 + + LA8: Eliminate unused num_probes variable. + +commit 309397702f747ea6326492d841a31fddd2d76a9f +Author: Uwe Hermann +Date: Sun Apr 24 22:48:45 2011 +0200 + + LA8: Replace some sr_warn() with sr_err(). + +commit ecaf59db8d79286b69a489273f4262901c0588f8 +Author: Uwe Hermann +Date: Sun Apr 17 10:11:52 2011 +0200 + + LA8: probeconfig/trigger support. + + This should make proper trigger support work for ChronoVu LA8. + +commit 4af22da5950cf490f2300199dfacd705e1d220b3 +Author: Uwe Hermann +Date: Tue Apr 19 00:27:29 2011 +0200 + + Fix two small warnings. + +commit e519ba8645b56f6c9eaaf69d6357a1efa8df501e +Author: Uwe Hermann +Date: Tue Apr 19 00:14:15 2011 +0200 + + Hardware drivers: Use names for struct entries. + +commit c0a4b9716d32811d9b2320884d3bd0e599feedcf +Author: Uwe Hermann +Date: Sun Apr 17 14:51:54 2011 +0200 + + ols: Always use glib's memory allocation functions. + +commit ecad043fd0c05ba307c3730438c1547a5dbe2608 +Author: Uwe Hermann +Date: Sun Apr 17 10:22:10 2011 +0200 + + MSO19: Always use glib's memory allocation functions. + +commit 27a3a6fe4b767414318c84a08c0cbe2c5a64e4b7 +Author: Uwe Hermann +Date: Sat Apr 16 17:23:04 2011 +0200 + + demo: Always use glib's memory allocation functions. + +commit c548332c21acc2588114214b38eaa3237fc3f8b3 +Author: Uwe Hermann +Date: Sat Apr 16 16:07:28 2011 +0200 + + serial.c: Use g_try_malloc(). + +commit 12ad53f5a6390e95ea0451ab3bd2c18574294aa3 +Author: Uwe Hermann +Date: Sat Apr 16 16:04:32 2011 +0200 + + ASIX Sigma: Improve error handling a bit. + +commit 92b3101cfc71581a273e667f185b18be0f0c364f +Author: Uwe Hermann +Date: Sat Apr 16 15:58:26 2011 +0200 + + alsa: Always use glib's memory allocation functions. + +commit 2e82a17b5ae9d204c57b99db93f1063787f6c3d5 +Author: Uwe Hermann +Date: Sat Apr 16 14:24:58 2011 +0200 + + LA8: Always use glib's memory allocation functions. + +commit b53738baf76219237e0a6629905981d7a1f2508e +Author: Uwe Hermann +Date: Sat Apr 16 14:17:51 2011 +0200 + + Replace g_malloc{0,} with g_try_malloc{0,}. + + The g_malloc()/g_malloc0() versions exit/segfault if not enough memory + is available, which is not a good thing in libsigrok. + + Instead, we use the g_try_malloc()/g_try_malloc0() variants, which + return NULL if not enough memory is available, so that the caller can + handle the error properly. + +commit 50959ddcdc455c930397fbc9f85c3a745ff45fda +Author: Uwe Hermann +Date: Fri Apr 15 21:49:22 2011 +0200 + + gnuplot output: Optimize by only storing changes. + + Only output new lines in gnuplot output if there have been changes in + the samples (similar to what VCD does). As long as the first and last + sample are output, the resulting plot looks OK. + + This reduces the size of the output file from roughly 200MB to just 60KB + in one specific test setup (depends on the number of probes and on the + signal, of course). The time and CPU load required to generate the gnuplot + output and the resulting plot (PNG or other) is also drastically reduced + from multiple minutes to roughly 30 seconds (again, depends on various + things). + + Thanks Ken Mobley of ChronoVu for the report. + +commit 15f2d0c0f2e39bc4338b0781b581aced0fca8e0c +Author: Uwe Hermann +Date: Fri Apr 15 20:47:26 2011 +0200 + + Don't close/reset the FTDI device too often. + + Only call la8_close_usb_reset_sequencer() in hw_closedev(), it's not + needed in hw_stop_acquisition(). + + Thanks Ken Mobley of ChronoVu for the report. + +commit 2f5c8c9696f4a4a8ca7e3c7e6e7d2766a4927026 +Author: Uwe Hermann +Date: Fri Apr 15 20:05:45 2011 +0200 + + LA8: free() sample buffers in hw_closedev(). + + Thanks Ken Mobley of ChronoVu for the report. + +commit b08024a8363c7a019bebc05a25e2689e774326e8 +Author: Uwe Hermann +Date: Thu Apr 14 09:46:53 2011 +0200 + + libsigrok: Introduce sr_dbg/sr_info/sr_warn/sr_err. + + We should use these (internal) functions in libsigrok exclusively from + now on, i.e. no more use of glib's g_debug() etc. + + These functions are only for libsigrok, the frontends use whatever + logging mechanism is suitable there. + +commit 83e9d586385097b957774d150a718ebaa7fcc3c9 +Author: Uwe Hermann +Date: Mon Apr 11 00:21:19 2011 +0200 + + Add chronovu-la8 input file format support. + +commit 8c48f17944a224787aa430b3b3dc5f8709ccb700 +Author: Uwe Hermann +Date: Sun Apr 10 23:33:43 2011 +0200 + + Add chronovu-la8 output file format. + +commit 20ebd1fe1d9314f421cfdfc925eba6eee498ce80 +Author: Uwe Hermann +Date: Sun Apr 10 16:46:05 2011 +0200 + + gnuplot output: More error checks. + +commit cdb3573ceba61b02b80f7fc979d166db5b6ff3bc +Author: Uwe Hermann +Date: Wed Apr 6 21:51:36 2011 +0200 + + input/output formats: s/extension/id/. + + The struct entry 'extension' is not really a (filename) extension, but + rather a unique ID used for input or output formats, e.g. in the sigrok + CLI or GUI interface. Thus, rename it accordingly. + +commit 8703f512a7c0e05f5fc3a5bc36f9e81afee71da3 +Author: Uwe Hermann +Date: Wed Apr 6 20:01:31 2011 +0200 + + LA8: Use the new SR_ERR_ARG macro. + +commit f7d2982d42e876d8814cba203570a45284c79658 +Author: Uwe Hermann +Date: Wed Apr 6 19:53:31 2011 +0200 + + Add SR_ERR_ARG #define. + + Changing the number of SR_ERR_SAMPLERATE is not a problem ATM, as we + never had a public release of libsigrok, i.e. nobody relies on the API yet. + +commit 819184ee68f1fda1ebc5b0a5f6aed403ecc27403 +Author: Uwe Hermann +Date: Wed Apr 6 19:51:11 2011 +0200 + + Binary output: Add more error checks. + +commit d494a4aa9dcbd90126d86757d16fa3e0f0a419f3 +Author: Uwe Hermann +Date: Wed Apr 6 19:42:49 2011 +0200 + + input/output formats: Explicit struct member names. + + This makes it immediately clear what an entry is supposed to be, no + need to look it up in some header file. + +commit f4314d7e0611917bdc7713dbffe17559490666d6 +Author: Uwe Hermann +Date: Mon Apr 4 19:40:30 2011 +0200 + + Add initial support for the ChronoVu LA8. + +commit 8a7b47cdfae4a4a95e92958beab41a4985e8f8e3 +Author: Uwe Hermann +Date: Sun Apr 3 23:18:46 2011 +0200 + + Revert temporary changes for 0.2 release. + +commit 2f3aab0ee9797700238656218208a6ab17a607b3 +Author: Uwe Hermann +Date: Sun Apr 3 22:38:35 2011 +0200 + + Disable some stuff which should not be in 0.2. + + Disable decoders, disable lib building. + +commit 847c21bc65343fa1197aa8455012d06a887e6626 +Author: Uwe Hermann +Date: Sun Apr 3 20:15:12 2011 +0200 + + Hook up output/text directory with autotools. + + This is needed for 'make distcheck' to work. + + Also, add missing text.h to the list of source files. + +commit 4fe9a6da79561d82f2c88c39e222ae86c5507900 +Author: Bert Vermeulen +Date: Sun Apr 3 06:15:45 2011 +0200 + + OLS driver overhaul + + support for metadata in recent versions of the FPGA code + moved constants and structs out to separate header file + got rid of all device instance-specific globals + +commit f437ea3fe2cada77634eb3a06d34abf680b9c092 +Author: Bert Vermeulen +Date: Thu Mar 17 14:53:06 2011 +0100 + + small warning fix + +commit 4487177c795db2393fd7e4a3c7b46b56345dc8e1 +Author: Bert Vermeulen +Date: Mon Feb 14 05:55:01 2011 +0100 + + output_ols: disabled cursors don't really need to be listed + +commit 82957b65b111437ebe445b7f165719eec2d4e147 +Author: Uwe Hermann +Date: Fri Mar 25 13:44:16 2011 +0100 + + ASIX Sigma: Fix firmware loading bug. + + When no firmware file is found, return the right error code so sigrok + doesn't continue running with no firmware loaded. + + Thanks Martin Stensgård for the patch! + +commit 8bb416becf64c5095dc7f553a7899fbe9ebc28e0 +Author: Uwe Hermann +Date: Tue Feb 22 23:20:22 2011 +0100 + + Kill unused functions (avoid namespace pollution). + +commit 120b259ea8f17b74deca3ba4b71e78771539bde8 +Author: Uwe Hermann +Date: Tue Feb 22 23:13:34 2011 +0100 + + Drop obsolete vcd_header. + +commit d078d2e5f3842b1915ffa9961654f3aa4ed88e17 +Author: Uwe Hermann +Date: Tue Feb 22 23:12:41 2011 +0100 + + Make some more items 'static'. + +commit 25b4fb85572d0c86d9ccab2a48524f4dd9bef43c +Author: Uwe Hermann +Date: Tue Feb 22 23:01:29 2011 +0100 + + Add doxygen comment to sr_filter_probes(). + +commit cd009d55619181e2fa7e7112f32fe85e4b49cf14 +Author: Uwe Hermann +Date: Tue Feb 22 18:13:32 2011 +0100 + + sr_exit(): Return int to be able to report errors. + +commit f5a443f27ad0e99f8f0f93867a1f298d7a6a327a +Author: Uwe Hermann +Date: Tue Feb 22 18:08:41 2011 +0100 + + Make DATASTORE_CHUNKSIZE private. + +commit c91404191e6b31ffe40edd8de469876a02c81d57 +Author: Uwe Hermann +Date: Tue Feb 22 18:05:16 2011 +0100 + + Add SR_HZ macro for consistency. + +commit 59df0c77e2906323290544ea62801831818ec096 +Author: Uwe Hermann +Date: Tue Feb 22 17:57:03 2011 +0100 + + Add SR_ prefix to the KHZ/MHZ/GHZ macros. + +commit 9688b443f65c7779a07b0e3ef2b9f9721ff742cd +Author: Uwe Hermann +Date: Sun Feb 20 18:39:47 2011 +0100 + + Add SR_ prefix for MAX_NUM_PROBES/MAX_PROBENAME_LEN. + +commit 4cea9eb20dc8d816a67c57d111a3a4529d452e4d +Author: Uwe Hermann +Date: Sun Feb 20 18:29:05 2011 +0100 + + Make ARRAY_SIZE/ARRAY_AND_SIZE private. + + This is not libsigrok-specific and should not be part of our API. + +commit 54ac5277c5e462f1778300b9bc3fdd4709ecb2dc +Author: Uwe Hermann +Date: Sun Feb 20 18:24:25 2011 +0100 + + Constify some more 'char *' parameters. + +commit 809c5f2011198a064a2e5e4028f19e63eb532ec1 +Author: Uwe Hermann +Date: Sun Feb 20 14:20:15 2011 +0100 + + Add sr_ prefix for analog stuff some structs. + +commit a887e3da9714cdfc4ee2eed37e0aa40cf7a5aaea +Author: Uwe Hermann +Date: Sun Feb 20 14:14:13 2011 +0100 + + Add sr_ prefix to receive_data_callback typedef. + + Also, drop obsolete add_source() prototype from sigrok-cli.h. + +commit 13b0573369841c1e26834734699b0f34f35428eb +Author: Uwe Hermann +Date: Sun Feb 20 14:09:15 2011 +0100 + + Add sr_ prefix to datafeed_callback typedef. + +commit e5551f657d6f16ec752cbbd1c879827387fd0063 +Author: Uwe Hermann +Date: Sun Feb 20 14:04:12 2011 +0100 + + Drop obsolete source_callback_*(). + +commit c25d2039de05250357f5a215e2cfcf703fbc6625 +Author: Uwe Hermann +Date: Sun Feb 20 13:58:21 2011 +0100 + + Add sr_ prefix to filter_probes(). + +commit 8225e92175c64909eddaecf8bd512049acf653a2 +Author: Uwe Hermann +Date: Sun Feb 20 13:53:13 2011 +0100 + + Constify a few more 'char *' parameters. + +commit 8233ff53ae7c6e120af4784bc61a036882d5c234 +Author: Uwe Hermann +Date: Sun Feb 20 13:27:08 2011 +0100 + + Make load_hwplugins() private. + +commit ee4b6342afe8e42c0be481109b9b97e27cbb846a +Author: Uwe Hermann +Date: Sun Feb 20 13:24:26 2011 +0100 + + Add sr_ prefix to list_hwplugins(). + +commit 6f1be0a2d40b3998abd8d10b5479e4538bc4ff1e +Author: Uwe Hermann +Date: Sun Feb 20 13:19:27 2011 +0100 + + Add sr_ prefix to session_{add,remove}. + +commit 77b454421a2aa7d52873f036e5ba5f8030fe29a3 +Author: Uwe Hermann +Date: Sun Feb 20 13:08:44 2011 +0100 + + Disable analog bits/gnuplot output for now. + +commit 29cbfeaf5c6a5e9112a6830a8fe4b584b33daf2a +Author: Uwe Hermann +Date: Tue Feb 15 19:38:46 2011 +0100 + + Mark some private stuff 'static'. + +commit a65de0309b0629d8a5f744f4be7bad67fdd5c34e +Author: Uwe Hermann +Date: Tue Feb 15 19:24:52 2011 +0100 + + Add sr_ prefix for hwcap structs/functions. + +commit a46d35febf4096df1af6189770bc5c1f91908ff5 +Author: Uwe Hermann +Date: Sun Feb 20 21:00:32 2011 +0100 + + Drop prototype for non-existant make_metadata(). + +commit 218557b85a308adc6ac533eb3f33d3dee17c13f8 +Author: Uwe Hermann +Date: Sun Feb 13 11:27:52 2011 +0100 + + Quickfix for a segfault with file input via -i. + + Stuff like + + ./bin/sigrok-cli -i rnd.dd -a transitioncounter + + would segfault (rnd.dd consists of random bytes) because device->plugin + was NULL and was being dereferenced. + + Thanks Olivier Fauchon for reporting. + +commit 305bde4d42ac801312743cc05671de214f6501fd +Author: Bert Vermeulen +Date: Sat Feb 12 06:18:16 2011 +0100 + + implement version 1.3 of the OLS output format, now streaming + +commit 4bfbf9fce71f91b3e7b7e968d436f7c436fc9648 +Author: Bert Vermeulen +Date: Sat Feb 12 03:24:23 2011 +0100 + + demo: forgot second part of samplerate support + +commit e5d1717e6d436b4f529c00dd5cede669e74a1e58 +Author: Uwe Hermann +Date: Wed Feb 9 00:07:29 2011 +0100 + + Saleae: Make more private stuff static. + +commit ba0b1dc639d13caf9c9f564828dc82a55c771913 +Author: Uwe Hermann +Date: Tue Feb 8 23:46:29 2011 +0100 + + Doxygen config files: Initial configuration. + +commit df66e48b0c794cc91fbf5a3ceb8c9a8f3ada3458 +Author: Uwe Hermann +Date: Tue Feb 8 23:00:49 2011 +0100 + + Add doxygen config files for both libs. + +commit 03dbc020cde2f0d9857ffcfc273eed5f504a4860 +Author: Uwe Hermann +Date: Tue Feb 8 21:50:27 2011 +0100 + + Rename probe_find() to sr_device_probe_find(). + +commit dfcc0bf9d3b56c06daa1c4eec923ad21bf13dcd3 +Author: Uwe Hermann +Date: Tue Feb 8 21:47:50 2011 +0100 + + strutil.c: Fix typo, add some (API) docs/comments. + +commit c49111295f0b2e50044923897d99ca84f65b75db +Author: Uwe Hermann +Date: Tue Feb 8 21:22:10 2011 +0100 + + Add sr_ prefix for datastore API functions. + +commit 2bf4aca64ad435a09359662446762840ac55db1d +Author: Uwe Hermann +Date: Tue Feb 8 18:19:38 2011 +0100 + + Add sr_ prefix for device related API functions. + +commit 60679b18e6940d20ee36fa77ea7411b67cbb9c2a +Author: Uwe Hermann +Date: Tue Feb 8 18:07:19 2011 +0100 + + Add sr_ prefix to 'struct samplerates'. + +commit 8a2efef2d5900cb3dd935af92a0e22528660c4be +Author: Uwe Hermann +Date: Tue Feb 8 18:00:49 2011 +0100 + + Add sr_ prefix to session related API functions. + +commit 2872d21ebc4e9554f685551e4915f193357f13d9 +Author: Uwe Hermann +Date: Tue Feb 8 17:50:29 2011 +0100 + + Add sr_ prefix for 'struct session'. + +commit 1afe89897cf100b1a3a5896184ddaca5705681cc +Author: Uwe Hermann +Date: Tue Feb 8 17:47:38 2011 +0100 + + Add sr_ prefix for 'struct probe'. + +commit 3bbd9849e9dc5fdc9fe18a4394abe4d4b43ac9d4 +Author: Uwe Hermann +Date: Sun Feb 6 02:14:57 2011 +0100 + + Fix warnings: g_fopen() needs . + +commit 868d8cefec0d27bc5afed4fe1e906c7b68665cf6 +Author: Uwe Hermann +Date: Sat Feb 5 20:03:17 2011 +0100 + + Use glib's g_fopen() instead of fopen(). + +commit 45fdfa307de68cc5209142cc6bae13a3be274949 +Author: Uwe Hermann +Date: Fri Feb 4 23:52:16 2011 +0100 + + MinGW: Use "b" in all fopen() calls. + + This is required for proper operation on Windows/MinGW, and doesn't + affect other OSes, most POSIX systems simply ignore the "b". + +commit 0f33365007d72e3f114938a61b9c426b6f5e48c6 +Author: Uwe Hermann +Date: Fri Feb 4 20:11:17 2011 +0100 + + Revert FIRMWARE_DIR / DECODERS_DIR method for now. + + There were several issues with the other method, revert for now. + +commit d81d29333e255a236b029860683f4bfadd1c15e3 +Author: Bert Vermeulen +Date: Fri Feb 4 06:28:49 2011 +0100 + + demo: support setting sample rate + +commit 904e0b589ebfbfa5ced62b0fab50a204d8d8a4b5 +Author: Bert Vermeulen +Date: Tue Feb 1 18:27:12 2011 +0100 + + ols: default to 200KHz samplerate + +commit a9f54bcd7b83baf465e5096f604470cacb4951bf +Author: Uwe Hermann +Date: Wed Feb 2 13:13:13 2011 +0100 + + MinGW: Build fixes. + +commit 22b02383442ec55a11cc6dd2b4c467d1de0b5bd2 +Author: Uwe Hermann +Date: Wed Feb 2 10:25:52 2011 +0100 + + Fix build when no libusb-LA is compiled. + + Until now the build would break if the user doesn't enable at least one + of the libusb1.0-based LAs. I.e., you could not compile only OLS, or + only the demo driver. + +commit cddd1c5f4739e43365a48a9d17e49cb105d929c7 +Author: Bert Vermeulen +Date: Tue Feb 1 06:51:34 2011 +0100 + + demo: stored-pattern generator now keeps state + +commit 6e738600eb4b98f76ca6f0d7d38da7e7a2acd0ca +Author: Bert Vermeulen +Date: Tue Feb 1 06:13:32 2011 +0100 + + output_ols: now fully compliant with spec + +commit 3a285098170ee6d5c7eab3fd94606e61a4fbaa19 +Author: Bert Vermeulen +Date: Tue Feb 1 02:33:54 2011 +0100 + + don't just assume a device has a samplerate setting + +commit 4a1b18f86d71ce814ec65b5273c1fdc4ac224735 +Author: Bert Vermeulen +Date: Tue Feb 1 01:41:33 2011 +0100 + + don't force .sigrok extension when saving session file + +commit b8c2f85f561a3e2738b621a0d42e0c066c1fcee9 +Author: Bert Vermeulen +Date: Tue Feb 1 00:06:32 2011 +0100 + + session_driver: remove unneeded callbacks + +commit dd56a9320d3ecb8f9054600f118a219f0de4ec9f +Author: Bert Vermeulen +Date: Mon Jan 31 23:44:18 2011 +0100 + + fix device probe adding + +commit 7d6588743503514c9de5c4fc8a511e9b0bdad7e6 +Author: Bert Vermeulen +Date: Mon Jan 31 22:34:14 2011 +0100 + + implement session loading based on a virtual device driver + +commit 40f5ddac0125b1a7c9b2625dda631f3c0ba24a4b +Author: Bert Vermeulen +Date: Mon Jan 31 22:29:40 2011 +0100 + + move samplerate/period printers and parsers into libsigrok + +commit a59606dfff0fa324e0003904a8eb72d7159c3c1f +Author: Bert Vermeulen +Date: Sun Jan 30 21:57:45 2011 +0100 + + remove dead code + +commit 9f4bc44e3a4442eb2b4a1fc2bdfeefc2e2bad425 +Author: Uwe Hermann +Date: Mon Jan 31 14:14:28 2011 +0100 + + MinGW: Build fix. + +commit 01d9dc35ad8ba6817170ac9cca6c7e4fce989b78 +Author: Uwe Hermann +Date: Sun Jan 30 19:22:13 2011 +0100 + + Consistently use _exit prefix for functions. + +commit 5a2326a71b3a7d3bc6b367a7a3dfa6f137f5f0ec +Author: Uwe Hermann +Date: Sun Jan 30 17:58:41 2011 +0100 + + SR_ prefix for all public enums. + +commit 6c29007211e3a35bb90db53cd22042f04fbe4e44 +Author: Uwe Hermann +Date: Sun Jan 30 16:44:26 2011 +0100 + + Prefixes for *_device_instance. + +commit 5c2d46d1dbfa636fb3cdbeaffdc0e9ca77c66ee1 +Author: Uwe Hermann +Date: Sun Jan 30 16:19:42 2011 +0100 + + Prefix device structs with sr_. + +commit 9f8274a544865838f880c4849c28b6129141cf99 +Author: Uwe Hermann +Date: Sat Jan 29 17:10:24 2011 +0100 + + Add a field for the full name of a device. + + Also, show this long/full name in 'sigrok-cli -V'. + +commit b9c735a275512ce82da7f66275c7cb62eaf66b60 +Author: Uwe Hermann +Date: Sat Jan 29 17:03:26 2011 +0100 + + Prefix datafeed structs with sr_. + +commit d32d961d17e3c7f409912062e5c336c19b6ef270 +Author: Uwe Hermann +Date: Sat Jan 29 16:57:35 2011 +0100 + + get_sr_device_instance() -> sr_get_device_instance(). + +commit a00ba012288726678e1a270961c8d4f46f3dbd33 +Author: Uwe Hermann +Date: Sat Jan 29 16:43:45 2011 +0100 + + Change all sigrok_ prefixes to sr_. + +commit f50f3f40d9238b0c50be67e52bc132aadfcf2050 +Author: Uwe Hermann +Date: Sat Jan 29 16:36:57 2011 +0100 + + Add sr_ prefix to input/output structs. + +commit e46b8fb154ba90ffec9c1f805399dfa819e736f9 +Author: Uwe Hermann +Date: Sat Jan 29 16:23:12 2011 +0100 + + Change SIGROK_ prefix to SR_. + +commit 544a458212dc972b663e67cd522ba54cbd8a00de +Author: Bert Vermeulen +Date: Sun Jan 30 02:40:55 2011 +0100 + + move session main loop stuff into libsigrok (session_run) + +commit ff35879bb7374a430ef89633df273288d42d4988 +Author: Uwe Hermann +Date: Thu Jan 27 23:17:47 2011 +0100 + + Fix some compiler warnings. + +commit aa4b110766256f010af198e1e5f2ca64055403df +Author: Bert Vermeulen +Date: Mon Jan 24 07:46:16 2011 +0100 + + fix session saving and input file loading + + cli: -i option now properly takes the -o option into account, + so sigrok can now be used for protocol conversion with just + those two options. + +commit e54bcdc5d17daf9a0641763bc33f5c8a723c4cbb +Author: Bert Vermeulen +Date: Mon Jan 24 02:49:14 2011 +0100 + + cli: don't initialize and scan for hardware unless needed + + If the -d option is used, only initialize the specified plugin. + +commit eeebceea31bacfbe05ba6d7cbcf21de03910329a +Author: Uwe Hermann +Date: Sun Jan 23 19:53:50 2011 +0100 + + Introduce proper libtool versioning for the libs. + +commit da6923732120b9f169c5991000ecabd15c05ffc0 +Author: Uwe Hermann +Date: Sun Jan 23 18:21:58 2011 +0100 + + Build fix. + +commit 108a5bfbba72882d1bc903a0ae54d0a883ff0824 +Author: Bert Vermeulen +Date: Sun Jan 23 05:32:37 2011 +0100 + + fix compile warning on 32-bit platforms + +commit 070befcd1c4786645a9191b96885dd62490b0d41 +Author: Bert Vermeulen +Date: Sun Jan 23 05:32:13 2011 +0100 + + restore demo driver to working state + +commit 47697369b552515d76930951e75cf84b5a16953a +Author: Bert Vermeulen +Date: Sun Jan 23 04:58:32 2011 +0100 + + cli: revamp option syntax + + for device (-d) and format (-f), the syntax is: + + :key=value:key2=value2 + +commit cdbc51d97d027c3889aad43c9d9ed3344cfb5a91 +Author: Daniel Ribeiro +Date: Sat Jan 22 12:23:34 2011 -0200 + + alsa: hide a few compiler warnings + +commit 58330ab892c64461a73471a197fd8816630944a9 +Author: Daniel Ribeiro +Date: Sat Jan 22 12:21:04 2011 -0200 + + finish alsa driver implementation + + Yes, it works now. + +commit 6ea7e23526b6be4d6c762b1136e361e4d3caccf6 +Author: Bert Vermeulen +Date: Sat Jan 22 14:18:31 2011 +0100 + + Revert "re-enable filter and datastore for DF_LOGIC" + + This reverts commit 23da86dfc0a89c7ab951fea31a318a493830eb69. + +commit 97554432e8d8bcf7f5af2dd770bcf752c9cd7d75 +Author: Bert Vermeulen +Date: Fri Jan 21 22:59:18 2011 +0100 + + split output_text into more manageable pieces + +commit 921a4c741fee27ee2f248971f9ee309a1551f981 +Author: Daniel Ribeiro +Date: Sat Jan 22 01:01:53 2011 -0200 + + fix copynpaste glitch + +commit 6ed4f0443730685b6a4a00b316384d751aa787e3 +Author: Daniel Ribeiro +Date: Sat Jan 22 00:57:27 2011 -0200 + + initial version of alsa plugin. + + It does NOT work yet. + +commit cfd8b10a2e2e4cd710d148ec5d2e11e18d583414 +Author: Daniel Ribeiro +Date: Fri Jan 21 22:02:32 2011 -0200 + + alphabetical order + +commit 5819184b229d5d33ccb8e5ed5f7d715f501fedb5 +Author: Uwe Hermann +Date: Fri Jan 21 21:04:01 2011 +0100 + + Remove duplicate FIRMWARE_DIR includes. + + We use AC_DEFINE_UNQUOTED in configure.ac now to put the FIRMWARE_DIR #define + in the config.h file, which is included where we need the #define. + +commit 62eeeb171bd9a05d167990373e33bc1f956cbfee +Author: Daniel Ribeiro +Date: Fri Jan 21 18:04:09 2011 -0200 + + re-enable filter and datastore for DF_LOGIC + + This definitely isn't the proper fix, but it should allow DF_LOGIC + and DF_ANALOG to coexist. + +commit 81bbdf6a6a2a8651e3c1ab3a7f714a851da77141 +Author: Daniel Ribeiro +Date: Fri Jan 21 16:11:44 2011 -0200 + + add incomplete DF_ANALOG support to output_gnuplot.c + + RAW->Voltage conversion is not implemented yet, its hardcoded for + signed 16bit conversion. + +commit 8038e90aefdbddd68a9775aea4f588bdd89894fe +Author: Daniel Ribeiro +Date: Fri Jan 21 12:52:12 2011 -0200 + + add a sine wave to demo.c + +commit c3579621d569f4b1ef3c21c7e2ed3bdc855c617b +Author: Daniel Ribeiro +Date: Fri Jan 21 11:25:50 2011 -0200 + + reduce analog_sample sizes. + + To save resources, reduce the max ADC resolution and max probes + per device. Just increase when needed. + + Soft limit: 256 probes, 16bit adc + Hard limit: 2^64 probes, 64 bit adc + +commit 764f887f7bfe480690fdc90ccadadfc1f9b42c03 +Author: Daniel Ribeiro +Date: Fri Jan 21 01:30:56 2011 -0200 + + change demo.c to output analog packets + + You need to #define DEMO_ANALOG to generate DF_ANALOG packets. + +commit 6eb0e3ea9528e91ef1e44e224fe9d6b05e31596f +Author: Daniel Ribeiro +Date: Fri Jan 21 01:19:50 2011 -0200 + + change output_text.c to support analog + + Only the "bits" output format was converted. + Analog values, are scaled down to A-Z letters. + +commit 48d783e4b5e557b6b7beee3907f0e8bd88741426 +Author: Daniel Ribeiro +Date: Fri Jan 21 01:14:53 2011 -0200 + + introduce analog_sample datafeed packet + + These structs define the packet format used to exchange data using + the DF_ANALOG packet type. + +commit f3163a6c2ee7a1d7ec6865f11cfcf52b07dc31f5 +Author: Daniel Ribeiro +Date: Thu Jan 20 20:10:43 2011 -0200 + + make output_analog.c = output_text.c + +commit f95fd1aaf3830c4d1f451b4b15c56169c9e95b35 +Author: Uwe Hermann +Date: Thu Jan 20 23:23:06 2011 +0100 + + Install an empty firmware/ directory. + + This reduces the hassle for the users (and distro packages) a bit, you + only need to copy files into there now. + +commit a00b530c644076f04a8505bc3644d2dceb3f6ed7 +Author: Uwe Hermann +Date: Thu Jan 20 23:00:59 2011 +0100 + + lib headers: Add 'extern "C"' for C++ usage. + +commit bffed4fc107358b11ab007ef2cdef851572680ef +Author: Uwe Hermann +Date: Thu Jan 20 00:39:59 2011 +0100 + + Re-enable stuff we temporarily disabled for 0.1. + +commit 07c81bfad119a4ea66c76cc830506ce3b381b4c5 +Author: Uwe Hermann +Date: Wed Jan 19 23:55:03 2011 +0100 + + Disable Link Instruments MSO-19 for 0.1. + +commit 26ce0bbfd88121831c651c8042e3c843ccd5d2c2 +Author: Uwe Hermann +Date: Wed Jan 19 23:47:21 2011 +0100 + + demo: Small indentation fix. + +commit 1924f59f4b788046f5eaf7ef3272a14c79a7c6f3 +Author: Håvard Espeland +Date: Wed Jan 19 23:14:17 2011 +0100 + + Demo: Obery samplerate and fix race condition. + +commit 576790ff7b7e888eeefa79239ffed6d8550c1160 +Author: Bert Vermeulen +Date: Wed Jan 19 22:47:55 2011 +0100 + + disable MSO-19 specific stuff for 0.1 release + +commit c70fce6ba6f061f1fbd4dbdf08e5d2ffa0168f6a +Author: Uwe Hermann +Date: Wed Jan 19 19:20:44 2011 +0100 + + Don't install libs and headers in the 0.1 release. + + The library APIs are not yet usable or finalized, so don't expose the + libs for now. Instead, only install sigrok-cli, the manpages, and + the decoders. + +commit 058b70353dd462ab13f3badb43f2fea697161bd7 +Author: Uwe Hermann +Date: Wed Jan 19 01:16:19 2011 +0100 + + Move more non-public headers to sigrok-internal.h. + +commit 01bd1ed396f33efc7126703210f44c4b5730d064 +Author: Uwe Hermann +Date: Tue Jan 18 00:08:11 2011 +0100 + + Fix compiler warning. + +commit 32c0551ba66452acc24c9dc163ade3a637b1c7f2 +Author: Håvard Espeland +Date: Tue Jan 18 23:17:55 2011 +0100 + + output_vcd: Make timestamp work on 32-bit machine. + +commit 94ba4bd6897d87af2ca45acc0505139d04785d44 +Author: Håvard Espeland +Date: Tue Jan 18 23:12:57 2011 +0100 + + Sigma: Update set_configuration to reflect API. + +commit 7c70c53843766003b881ca2c47f2c4bb454a3360 +Author: Håvard Espeland +Date: Tue Jan 18 22:39:46 2011 +0100 + + Sigma: Set default samplerate to 200 KHz. + +commit 5b5ea7c6d25bb42de09b61d0a070d78252f2367b +Author: Håvard Espeland +Date: Tue Jan 18 22:24:23 2011 +0100 + + Sigma: Only send trigger packet if enabled. + + The Sigma hardware emits a default trigger event. + +commit abda62ced8a9cdbb13be49a503d6bc6a8a8f8f2e +Author: Håvard Espeland +Date: Tue Jan 18 22:17:43 2011 +0100 + + Sigma: Never send empty packets. + +commit afa8f8449aa6c04980a9d4639a901079a2afedc9 +Author: Håvard Espeland +Date: Tue Jan 18 22:14:36 2011 +0100 + + output_text: Mark trigger at correct position. + + ASCII output does not separate groups of samples with + and must be handled separately. + +commit 6ef7a8cb5d2f035734dd504d99b267a118b2dade +Author: Håvard Espeland +Date: Tue Jan 18 22:13:50 2011 +0100 + + output_text: Fix ASCII edge case. + +commit d4f228d094d53c95bdf4dd42525a271db716928d +Author: Håvard Espeland +Date: Mon Jan 17 22:56:14 2011 +0100 + + output_text: Add ASCII output. + +commit b9cc36296b6e08d194a2b8e6c1adeb010af9a630 +Author: Bert Vermeulen +Date: Mon Jan 17 02:20:52 2011 +0100 + + demo driver: support time limit + +commit 574ce4988ac771ea39e3423c196019555e81df8a +Author: Bert Vermeulen +Date: Mon Jan 17 02:18:02 2011 +0100 + + refuse to set sample limit under 4 (protocol can't handle it) + + also a bit of whitespace mangling. + +commit b33e7d7058a5a092eea7b8bce18cf95d70e5ff5a +Author: Håvard Espeland +Date: Sun Jan 16 17:55:51 2011 +0100 + + output_vcd: Emit timestamps as time, not sample num. + +commit 08b488b84896d0e29c401c67f7bda7fed968f9ca +Author: Håvard Espeland +Date: Sun Jan 16 17:34:49 2011 +0100 + + output_vcd: Remember samples between packets. + + Fixes two bugs in vcd output: + 1) Waveform did not match original input when viewed in gtkwave. + 2) No vcd output when using 1 MHz sampling on Sigma. + +commit 88c51afe876b6d6ba115f8152d89b9564ee00e4f +Author: Håvard Espeland +Date: Sun Jan 16 17:03:25 2011 +0100 + + Sigma: Support for decoding partial chunks. + + Samples are stored in chunks and the last samples do not fill up + a complete chunk. This patch adds support for decoding partial + chunks. + +commit 10c471ab131bd766c9207e05e485fd2467ba7d5b +Author: Uwe Hermann +Date: Sun Jan 16 14:18:26 2011 +0100 + + Fix warnings. + +commit d35aaf0256aa646af0f23035932271579ca65a3d +Author: Uwe Hermann +Date: Sun Jan 16 14:12:52 2011 +0100 + + demo: Use GIOChannels, makes it work on MinGW. + +commit fbf1ff5d2268c0fbf35b6210afa11da351b9b2ba +Author: Bert Vermeulen +Date: Sun Jan 16 04:34:45 2011 +0100 + + clean up output_vcd module + + use self-expanding strings, better standards conformance + +commit 98b8cbc17e03119fcaa735a4bc2f0451000ab54f +Author: Håvard Espeland +Date: Sat Jan 15 20:01:00 2011 +0100 + + Sigma: Limit number of edge triggers to 1. + + Actually, Sigma supports 2 rising/falling triggers, + but they are ORed and the current trigger syntax + does not permit ORed triggers. + +commit 31facdd3c5ca0c118d1216ce65c468db130bb751 +Author: Håvard Espeland +Date: Sat Jan 15 19:19:49 2011 +0100 + + Sigma: Download samples from partial chunks. + +commit ab224f7b61ee1d3cf46fff172e4d97c856031593 +Author: Uwe Hermann +Date: Sat Jan 15 18:18:09 2011 +0100 + + Initial support for the OLS output format. + + This is the file format for the OpenBench Logic Sniffer "Alternative" client. + Details: https://github.com/jawi/ols/wiki/OLS-data-file-format + + This is work-in-progress. + Currently the number of samples is hardcoded to 10000. Also, this will + require a real logic analyzer as input at the moment, and will not yet + work with the "demo" driver. + +commit 9d7ab9ba3b5208e99bc7fd33c6a831fe21a427f3 +Author: Håvard Espeland +Date: Sat Jan 15 18:24:01 2011 +0100 + + output_text: Allocate more memory for output + + The trigger line was forgotten. Allocate 512 bytes extra. + +commit 9996570987d362a324384ed041040e884628853e +Author: Håvard Espeland +Date: Sat Jan 15 17:02:18 2011 +0100 + + Sigma: Move sigma state to device specific struct + + Thanks to Daniel Ribeiro for contributing this patch. Some + modifications were done. + + Not tested on multiple Sigmas, because of lack of hardware. + +commit 3aa403e858a490aee17c23c11d3a09cdd4eb324d +Author: Håvard Espeland +Date: Sat Jan 15 16:10:57 2011 +0100 + + output_text: Allocate enough memory for output + +commit 858fb11c5e26009861b8b7aef7c07b701d2cda5a +Author: Uwe Hermann +Date: Sat Jan 15 15:44:21 2011 +0100 + + Drop unused debug.c. + + Even if we'd use it, it probably belongs into the frontend, not libsigrok. + +commit 484760d1a8a26ba830b3d63d1451dc30985babd1 +Author: Uwe Hermann +Date: Sat Jan 15 15:43:25 2011 +0100 + + Cosmetics. + +commit aa0b6b208e2ecaa7e56b020c204b6c3e702fb4ca +Author: Uwe Hermann +Date: Sat Jan 15 15:43:03 2011 +0100 + + sigrok-proto.h: Sort the prototypes, fix comments. + +commit 1483577eed7ac27b8107b1b76e1adc5369745c29 +Author: Uwe Hermann +Date: Sat Jan 15 15:06:58 2011 +0100 + + Start moving private stuff to sigrok-internal.h. + + This is work-in-progress, unfinished. + +commit f7606f9b75b1b4b2324635426f3cc52feda1e3aa +Author: Bert Vermeulen +Date: Sat Jan 15 15:21:54 2011 +0100 + + fix hex output + +commit c2bd92ec0867eff49ee58b557d6fb9aec2b63357 +Author: Uwe Hermann +Date: Sat Jan 15 14:41:57 2011 +0100 + + Slightly more consistent #include-guard naming. + +commit 917e0e71d53cb0a0ac7965cb4f36791b14f7e5ff +Author: Bert Vermeulen +Date: Sat Jan 15 14:28:03 2011 +0100 + + added example code for generating a stored pattern + +commit 9be9893eed4acf03533d1a2fb63719de6eb10753 +Author: Håvard Espeland +Date: Sat Jan 15 14:03:08 2011 +0100 + + Sigma: Check state in hw_closedev + + If the device is closed without previously running hw_openedev + the driver crashes (happens in cleanup). This patch checks + if the device has been opened. + +commit 02440dd88c93b049bdd71039ef036af1c8812189 +Author: Uwe Hermann +Date: Sat Jan 15 13:06:04 2011 +0100 + + demo: Cosmetics, constify. + +commit e15f48c268877632086e9cd0bb16356cd58cde5f +Author: Bert Vermeulen +Date: Sat Jan 15 05:12:41 2011 +0100 + + cleaned up demo driver + + removed unused samplerate + added patternmode (random and incremental) + +commit 925dbf9f97c18628ead7cb5a93f95052b48ca0e4 +Author: Bert Vermeulen +Date: Sat Jan 15 05:11:40 2011 +0100 + + add new HWCAP patternmode + +commit 63570167d67cacab2ac56eaabb6219c7593bca9e +Author: Uwe Hermann +Date: Sat Jan 15 03:44:19 2011 +0100 + + Cosmetics for the -D output. + +commit 17e1afcb81b8581091fcb660c2e61f05c75e00b5 +Author: Uwe Hermann +Date: Thu Jan 13 23:50:34 2011 +0100 + + Whitespace and consistency fixes. + + Also, drop a #include. It's unused anyway, and breaks the build + on MinGW/Windows as there is no poll.h there. + +commit 9ab95e54083b62c060cddd1e2762529c762d90be +Author: Bert Vermeulen +Date: Thu Jan 13 02:05:39 2011 +0100 + + make output modules a bit more crashproof + + the event handler in output modules is now optional. + +commit 2507648e63d7b9807808d2e74b168821e94d893d +Author: Bert Vermeulen +Date: Thu Jan 13 01:26:23 2011 +0100 + + use us instead of µs in periods (VCD can't handle it) + +commit 2119ab0364b6a161091a89a7018be14d49bdc7b3 +Author: Uwe Hermann +Date: Wed Jan 12 00:43:00 2011 +0100 + + MinGW/Windows: Serial port portability fixes. + + Add serial_read()/serial_write() which have different implementations on + MinGW/Windows. + + Add some more error code handling and documentation. + +commit ba3d481bb78a3bdb009c8d0aed3885a0a0192a04 +Author: Olivier Fauchon +Date: Wed Jan 12 00:25:15 2011 +0100 + + add ontinuous mode for demo driver + +commit 13a12913507682c319aaa890d897670bc8457adb +Author: Bert Vermeulen +Date: Tue Jan 11 23:58:41 2011 +0100 + + fully implement input_binary module + +commit 78ed6420358cd83bb74208e80cbcd7c068713769 +Author: Bert Vermeulen +Date: Tue Jan 11 23:49:32 2011 +0100 + + code cleanup + +commit a61b0e6a35fdf06c98a2304e186a3a17c9fbf8d8 +Author: Uwe Hermann +Date: Tue Jan 11 22:17:33 2011 +0100 + + configure: Add --enable-demo option. + +commit 1fdb75e14528abd62ebe727537512c741a5759da +Author: Uwe Hermann +Date: Tue Jan 11 01:25:10 2011 +0100 + + MinGW: Quickfix to make serial.c/ols.c compile. + + Note: It does NOT actually work, yet, it only compiles! + +commit 74b9b43836a55debd1e5c27637021ef505f6e7aa +Author: Bert Vermeulen +Date: Mon Jan 10 22:17:52 2011 +0100 + + cli: support --continuous option for continuous sampling + +commit 8a839354c122b533181fe02da82d0110a44911cf +Author: Uwe Hermann +Date: Mon Jan 10 23:20:37 2011 +0100 + + Cosmetics, whitespace, consistency fixes. + +commit fc96e6f8c8591c15930ff3dfe9e14303b29e70aa +Author: Uwe Hermann +Date: Mon Jan 10 22:49:38 2011 +0100 + + demo: Add missing copyright line. + +commit 2566bd4884bf33518488504575ba62e99ef43a7b +Merge: 01cf881 882e207 +Author: Daniel Ribeiro +Date: Mon Jan 10 15:58:05 2011 -0200 + + Merge branch 'master' of git://sigrok.git.sourceforge.net/gitroot/sigrok/sigrok + +commit 01cf8814949f4786da4a1be79a74030a691be152 +Author: Daniel Ribeiro +Date: Mon Jan 10 15:15:51 2011 -0200 + + Add incomplete mso-19 plugin + + * Both Analog and Logic capture works. + * Analog values are raw ADC, still useless. + * Triggers aren't implemented. + * Pattern Generator not implemented. + * Everything is broken. :) + +commit 3677f3ec3f76ec3efc8aea97a1b050f6949d773d +Author: Daniel Ribeiro +Date: Mon Jan 10 15:14:26 2011 -0200 + + Add HZ_TO_NS macro + +commit c2616fb9faca19945154974884a0816359cec1df +Author: Daniel Ribeiro +Date: Mon Jan 10 15:12:38 2011 -0200 + + update plugins and cli to use new DF_HEADER + +commit 921e753f7e2bef9590b1e344200b736a0faa18cc +Author: Daniel Ribeiro +Date: Mon Jan 10 15:08:43 2011 -0200 + + Support for analog probes + + Add a field to the probe struct to store the probe type. + Change DF_HEADER to report the quantity of each type of probe. + +commit ac4a2ea45a9320e87ec03cd820bf80c96eb65b21 +Author: Daniel Ribeiro +Date: Mon Jan 10 15:05:14 2011 -0200 + + serial.c: fix parity != none + + The flag write was wrong + +commit 882e2075bb51496e5eb9548b98204b90a4b60a82 +Author: Bert Vermeulen +Date: Mon Jan 10 13:47:24 2011 +0100 + + finish split of sigrok.h + +commit 10509bc2e445b20f90d2ce05561dfbb873180872 +Author: Bert Vermeulen +Date: Mon Jan 10 13:44:11 2011 +0100 + + split off prototypes into their own header file + +commit 655756e01d929607f67a9d576222917c72513b4b +Author: Bert Vermeulen +Date: Mon Jan 10 12:39:53 2011 +0100 + + cli: new option to list output modules + +commit 43275b4712b0ad5baea1c7d71fdb710249a46681 +Merge: e006af1 9d4bde7 +Author: Daniel Ribeiro +Date: Mon Jan 10 02:36:50 2011 -0200 + + Merge branch 'master' of git://sigrok.git.sourceforge.net/gitroot/sigrok/sigrok + +commit 9d4bde70fc2a46bae172ab1851f3aff9e3f9b3b5 +Author: Daniel Ribeiro +Date: Mon Jan 10 02:21:07 2011 -0200 + + Finish serial_set_params implementation + + Adds the most common baud rates and support bits, parity, stopbits + and flocontrol settings. + +commit e006af1116adb76014e77db718bb8673137a8bf5 +Merge: 1ff7712 9b36e36 +Author: Daniel Ribeiro +Date: Mon Jan 10 02:28:59 2011 -0200 + + Merge branch 'master' of git://sigrok.git.sourceforge.net/gitroot/sigrok/sigrok + +commit 9b36e360f3c23c3287e6e10acb0b57479c5d19ad +Author: Bert Vermeulen +Date: Mon Jan 10 05:27:22 2011 +0100 + + output_analog: allow samples per line arg (default analog10) + +commit 1ff7712c93fb61e7710de6c2b4241652445f368e +Author: Daniel Ribeiro +Date: Mon Jan 10 02:21:07 2011 -0200 + + Finish serial_set_params implementation + + Adds the most common baud rates and support bits, parity, stopbits + and flocontrol settings. + +commit 1437e8934bd01167f2126616c7e8b44ca342cd27 +Author: Bert Vermeulen +Date: Mon Jan 10 05:13:46 2011 +0100 + + add DF_ANALOG, and an analog output module + + Samples in DF_ANALOG packets are fixed in length to sizeof(double). + +commit f0411b1d170aa60c3aa79b12e88f53b225ea350d +Author: Bert Vermeulen +Date: Sun Jan 9 23:22:48 2011 +0100 + + output modules now register the DF type they can use + +commit 8d6725506115e97665be8ef35dbaaf694ba72a93 +Author: Daniel Ribeiro +Date: Sun Jan 9 03:50:45 2011 -0200 + + Add a per-instance pointer storage for hardware plugins. + + We need this to properly support more than one device connected + at the same time. + +commit dfa4b731da66ddf05ff04943bf0d385aa440c3ac +Author: Daniel Ribeiro +Date: Sun Jan 9 03:48:39 2011 -0200 + + Add ARRAY_AND_SIZE macro + + Just a handy macro + +commit 4c046c6bcc392666405154853faf7dc2522aa1d9 +Author: Bert Vermeulen +Date: Sun Jan 9 06:32:38 2011 +0100 + + change all DF_LOGIC* to a single DF_LOGIC type + + The datafeed packet has a new field 'unitsize' to denote the number of + bytes per sample in the payload. + +commit af812219f655b286f5a2a0146846d9b97e25435c +Author: Uwe Hermann +Date: Sat Jan 8 20:06:32 2011 +0100 + + Only build specific source files if needed. + +commit 7c17ac6cc4ecc30a1df1848ef3a3e0827351090c +Author: Uwe Hermann +Date: Sat Jan 8 19:15:39 2011 +0100 + + Only build hardware drivers if they're enabled. + +commit 5096c6a6c1f2efb01d5efdebb26e282296c2910e +Author: Uwe Hermann +Date: Sat Jan 8 19:01:07 2011 +0100 + + demo driver: Small cleanups, error handling. + +commit 85b5af068776cca18c704a101d6d56be1ec236b6 +Author: Uwe Hermann +Date: Sat Jan 8 18:29:10 2011 +0100 + + Make the demo driver work. + + When initialized, the driver starts a thread that generates signal data. + This data is written to a pipe (write file descriptor). + The other end of the pipe (read file descriptor), is connected to the + main polling code, like any other driver. + + Note: This patch adds a new dependency on libgthread. + + At the moment, you can list the driver's device: + + $ ./cli/sigrok-cli -D + The following devices were found: + ID Device + 0 Sigrok project Demo Driver v1.0 with 8 probes + + And use it for random signal generation: + + $ /opt/sigrok/bin/sigrok-cli -d 0 --samples 50 -f bits -p 1-8 + sigrok 0.1pre2 + Acquisition with 8/8 probes at 0 Hz + 1:10111100 11010110 00001011 00011110 00111010 11110100 10 + 2:11010110 00111111 01001010 11111101 11010011 00010010 11 + 3:11000101 01000001 10100011 10100100 10110000 11110011 00 + 4:00100111 11110100 10011101 01100111 00100101 01001110 10 + 5:00011100 00101100 10111000 11001101 01011101 01011011 01 + 6:10110101 10111110 10010110 10111000 11011010 10000100 11 + 7:11111111 01001111 11110110 11010010 10000101 01001111 00 + 8:01000101 01111110 01010111 00000111 00010010 00000101 11 + + The next step is to make demo driver customisable (per-probe signal clock, + reference sample signals : serial, I2C, CAN...). + + Thanks Olivier Fauchon for the patch. + +commit d4ae8eaa7c09e31ef246b7d56008a0aa21db9f0d +Author: Bert Vermeulen +Date: Sat Jan 8 15:48:39 2011 +0100 + + fix buffer size, various error checks + +commit 2a3f9541a4bece23b25e1b255c0fab31ba5a751b +Author: Bert Vermeulen +Date: Thu Jan 6 00:51:29 2011 +0100 + + add sigrok_period_string(), MAX_NUM_PROBES + +commit 5e2ddeb098b677faca5d044f3523f5f6f3382d90 +Author: Uwe Hermann +Date: Sat Jan 8 03:51:31 2011 +0100 + + Fix two more compiler warnings noticed on amd64. + +commit 340f6e7aeaf0c6cbbb27c5b535787bd09407994b +Author: Uwe Hermann +Date: Sat Jan 8 03:32:25 2011 +0100 + + Fix out-of-tree build. + + Use libtool "noinst" local helper libs and use one Makefile.am per + subdir, which is the usual/preferred method. These helper libraries are + purely local and will not be installed. + + This also fixes out-of-tree builds of sigrok, i.e. building in a + directory other than the sigrok source directory, e.g. + + $ cd /home/user + $ git clone ...sigrok + $ cd sigrok + $ ./autogen.sh + $ mkdir /tmp/foo + $ cd /tmp/foo + $ /home/user/sigrok/configure + $ make + $ make install + + This will place all build results (.o files, .la files, etc) in the + local build directory (/tmp/foo) instead of the source directory + (/home/user/sigrok in this example). The installation directory is + selected via the --prefix configure option (/usr/local per default). + +commit 757b8c628a5b64f8b6b166044b1b3ac1ccf797dc +Author: Uwe Hermann +Date: Fri Jan 7 19:55:25 2011 +0100 + + Cosmetics, whitespace, simplifications. + + Reduce code nesting a bit, constify some strings. + +commit 6239c175c1b967b577f760032d326322dd4c4576 +Author: Uwe Hermann +Date: Thu Jan 6 19:16:47 2011 +0100 + + Initial, unfinished demo/simulation hardware driver. + +commit 339729131d5acd50147e26ec238db569e273a459 +Author: Bert Vermeulen +Date: Wed Dec 29 01:22:58 2010 +0100 + + proper fix for output_text corner cases + limit probe names to 32 chars + +commit e6ac9ac808b900287a80ea44d9c661703e3a101c +Author: Bert Vermeulen +Date: Wed Dec 29 00:02:30 2010 +0100 + + consistent debug msgs, rename sump to ols + +commit ee5f5e81adc83e68c9af2c9305b0ddcb813d2b4a +Author: Bert Vermeulen +Date: Tue Dec 28 21:59:07 2010 +0100 + + fix corner cases/memory management (cli->text out) + +commit a5e18535ad897084b9a67dbee19bcc1ebd21ae7a +Author: Bert Vermeulen +Date: Mon Dec 27 23:44:50 2010 +0100 + + don't turn on/off libusb debugging + +commit f0551a6543206a0970410481b8e36bbfa6a609ea +Author: Bert Vermeulen +Date: Thu Aug 12 06:04:44 2010 +0200 + + oops, fix serial_flush() + +commit 06d64eb880876bd8a81c249e7b2f690eb03e12c1 +Author: Bert Vermeulen +Date: Thu Aug 12 06:02:25 2010 +0200 + + add serial_flush() + +commit e1aac2319a1e0f5e7d263b5fd50a62c8b42fe22e +Author: Bert Vermeulen +Date: Thu Aug 12 05:49:00 2010 +0200 + + increase length of datafeed packets to uint64_t + +commit a143e4e5ddb4743867b7578e0599a566c2c82c07 +Author: Bert Vermeulen +Date: Thu Aug 12 04:57:09 2010 +0200 + + don't push configuration to device until acq time + +commit f0d1b53e56045bc15fe156c3f6e855dfc91037be +Author: Bert Vermeulen +Date: Wed Aug 11 18:37:09 2010 +0200 + + OLS: fix multi-channel capture + +commit edc508d49cacf2ff7ff38dec5cb49ec317f4a39f +Author: Bert Vermeulen +Date: Wed Aug 11 04:04:20 2010 +0200 + + add debug logging (set SIGROK_DEBUG=2 to see) + +commit a803c0db4d5887c29b8c79626bfcc452845cfed2 +Author: Bert Vermeulen +Date: Thu Aug 5 03:54:33 2010 +0200 + + OLS: fix triggers, sample order, capture ratio + +commit 3245dfcb629ced90a2570dc04db99f59af60b888 +Author: Bert Vermeulen +Date: Thu Aug 5 03:52:32 2010 +0200 + + define pre/post-trigger capture ratio option + +commit b5698bd71e96561ba08a481abaa9c64ee687bda2 +Author: Bert Vermeulen +Date: Sun Jul 18 21:57:27 2010 +0200 + + saleae logic: fix triggers after style changes + +commit c4fffe1e9606e3e63a4cd0b760a37beb1f122cc5 +Author: Uwe Hermann +Date: Wed Jul 14 22:09:21 2010 +0200 + + hwplugin.c: Add missing config.h #include. + + This fixes a bug where no LA would be found or displayed in lists such + as 'sigrok-cli -H' or 'sigrok-cli -D'. + + Thanks Forrest Voight for spotting the bug. + +commit 960a75e4741edf7d3481339897328f0ea712e2c0 +Author: Uwe Hermann +Date: Fri Jun 25 01:11:11 2010 +0200 + + Only build hardware plugins if requested by user. + + Per default all plugins will be built, though. The user can override + this via the --disable-la-xxxx options. + +commit 5b907f9b07b0559f7230e827e5d02589d307e727 +Author: Uwe Hermann +Date: Mon May 31 11:34:10 2010 +0200 + + Add per-LA --enable-XXXX configure options. + +commit 38ba2522516b481fa3619bdec56d1e2a4b7a5f45 +Author: Uwe Hermann +Date: Thu May 27 01:51:55 2010 +0200 + + Use 'kHz' (not 'KHz') consistently. + +commit 49d0ce50d0e43c1a10dc2863afd20185051819aa +Author: Uwe Hermann +Date: Wed May 19 00:38:14 2010 +0200 + + Simplifications and small fixes. + +commit 5013f07422b5a62386f68d1663011d5ba885f1ef +Author: Uwe Hermann +Date: Wed May 19 00:23:27 2010 +0200 + + skeleton.c: Update to latest prototypes. + +commit 2458ea651409c8252d33dba5b5cfe9313f3e4899 +Author: Bert Vermeulen +Date: Sat May 15 23:30:17 2010 +0200 + + use flexible sample limit specification (k/m/g) + + HWCAP_LIMIT_SAMPLES is now passed to the driver as *uint64 + +commit 989938f6cd5f9bf76f42e29ab39eca4570e430e2 +Author: Uwe Hermann +Date: Mon May 17 23:59:56 2010 +0200 + + Cosmetics: Reduce nesting level a bit. + +commit 9a5c6dcf498b8dfebb8beb848ee6db6b59b173e5 +Author: Uwe Hermann +Date: Fri May 14 14:24:05 2010 +0200 + + Factor out opendev2/opendev3. + +commit 5e59f476152a343619f473c37f2b06e2b6ef15d3 +Author: Uwe Hermann +Date: Fri May 14 13:12:06 2010 +0200 + + opendev2/opendev3: Don't depend on global vars. + +commit 28fc6de055eae2d6ba97206bb636f28e12fd68a9 +Author: Uwe Hermann +Date: Fri May 14 13:07:03 2010 +0200 + + Cosmetics. + +commit d658e348a89c5dd3d248abdbbdf5423465a2d344 +Author: Uwe Hermann +Date: Tue May 11 18:07:54 2010 +0200 + + pkg-config: Add (semi-generated) libsigrok.pc. + +commit 1ebdb3fdc3e28d138046539d9a38610254d9c00a +Author: Uwe Hermann +Date: Tue May 11 17:13:35 2010 +0200 + + Drop unused and obsolete gmodule stuff. + +commit 5b15b41e623e755e31cdc699f9d542d69d7e61c7 +Author: Peter Stuge +Date: Sun May 9 23:11:08 2010 +0200 + + sump/ols: Wait 10ms for hw response to make pl2303 reliable + +commit 71dda1065642b33d4c82d514bcaf28e2d2b8729c +Author: Peter Stuge +Date: Sun May 9 23:04:24 2010 +0200 + + serial: Remove unneccesary nesting + +commit fbe2f7945d70500f6db374956a36d7bb131b09d5 +Author: Uwe Hermann +Date: Sun May 9 21:05:15 2010 +0200 + + VCD: Optimizations and fixes. + +commit 086eac7c7bef114dd96c6ddb639fa2fa35f9182b +Author: Uwe Hermann +Date: Sun May 9 20:52:36 2010 +0200 + + VCD/Gnuplot: Fix incorrect sample counter. + +commit 114fb93f67f8748352ad4f851afeab31df2f0385 +Author: Uwe Hermann +Date: Sun May 9 20:27:11 2010 +0200 + + Gnuplot: Nicer output formatting. + +commit fdebec21082fdc7bb2642e717565bdbc8b98f287 +Author: Uwe Hermann +Date: Sun May 9 19:36:43 2010 +0200 + + filter.c: Error handling, code simplification. + +commit 5f8c4cb3633cdde636c497cf7ec4eb79e30e32f6 +Author: Uwe Hermann +Date: Sun May 9 15:52:56 2010 +0200 + + Gnuplot: Improve column/probe name display. + + This fixes incorrect probe name display if the user explicitly named + probes via '-p 1=CLK' etc. + +commit e734b81a685c9a1bcb4bd899ba162f5c7769b2d1 +Author: Uwe Hermann +Date: Sun May 9 15:38:33 2010 +0200 + + output_text: More error handling. + +commit caf62e22c4dad949c8b1282e621e2dbf47daac30 +Author: Uwe Hermann +Date: Sun May 9 15:12:10 2010 +0200 + + output_gnuplot: Simplify event(). + +commit d20ba6490ac948783435c72340d3e37b67cd6a62 +Author: Uwe Hermann +Date: Sun May 9 15:11:47 2010 +0200 + + output_binary: Code simplifications. + +commit 1e32053cd0a8e42e628cf832d81360b96c8de97d +Author: Uwe Hermann +Date: Sun May 9 15:02:17 2010 +0200 + + Gnuplot quickfix: Increase malloc()'ed size. + +commit 5cca9adbf27252349729cdb1e1c6ca0a526561b1 +Author: Uwe Hermann +Date: Sun May 9 14:54:16 2010 +0200 + + VCD/Gnuplot: Store time/date in output. + +commit 607b58de58f22baa026d24ac7b8e0ae123c9ede0 +Author: Uwe Hermann +Date: Sun May 9 14:42:46 2010 +0200 + + VCD/Gnuplot: Cosmetics, code simplifications. + +commit a821069b3411e127512dc2c436a76d25fdac0a5a +Author: Uwe Hermann +Date: Sun May 9 14:35:02 2010 +0200 + + Gnuplot output: More error handling. + +commit 2aebf78d9d10eb838b2fe58683d7af06015cd214 +Author: Uwe Hermann +Date: Sun May 9 13:32:58 2010 +0200 + + datastore_new(): Use int as return value. + +commit 33247d6acf94bb9119ba7e1a8239b474bdcfa430 +Author: Uwe Hermann +Date: Sun May 9 13:25:03 2010 +0200 + + Datastore: More error checking. + +commit 6b5e3ceefcdee5e942b9cbff5c697016dacee774 +Author: Uwe Hermann +Date: Sat May 8 16:09:25 2010 +0200 + + VCD: Improve error handling/checking. + + Check malloc()/calloc() return values and so on. Also, add missing + free() calls and some TODOs. Simplify some code. + +commit d2b36a10d72133feeea3610bdc81a484b6f8fc72 +Author: Bert Vermeulen +Date: Wed May 5 22:06:38 2010 -0700 + + output_text: always print sigrok version + +commit c9c1c6458c15958d19d8cbac50f2e301479892a1 +Author: Bert Vermeulen +Date: Wed May 5 21:43:25 2010 -0700 + + output_binary: rm TODO item + + Yes, disabled probes are stripped by the filter before the + output module even gets data. + +commit 7aae74622ecf04f51d5b7df650ea8bd98baa0fcf +Author: Bert Vermeulen +Date: Wed May 5 19:56:48 2010 -0700 + + output: if device has no plugin, don't report samplerate + +commit db91a1c3c1e798610542b9749191fc89f15c5ccd +Author: Bert Vermeulen +Date: Wed May 5 19:55:58 2010 -0700 + + input: use dummy device when loading from file + +commit 873080cc03a7c7889ef775a4584d1036b1d1315f +Author: Bert Vermeulen +Date: Wed May 5 19:54:19 2010 -0700 + + allow devices without a plugin + + this is needed to support file loading: we want a device struct + so we can enumerate probes from the file, but there is no plugin + since the data come in from a device. + +commit e273a9040e10c1297c758fe35eb522bd5470e708 +Author: Håvard Espeland +Date: Tue May 4 19:44:39 2010 +0200 + + Output: Fix invalid pointer dereferencing in vcd and gnuplot. + +commit bdfc7a89745a0fae422806c883cbd946f16eace3 +Author: Håvard Espeland +Date: Mon May 3 21:35:02 2010 +0200 + + Sigma: Small cleanups. + +commit 36b1c8e61b277aabc84d181992795447e7339e5d +Author: Håvard Espeland +Date: Mon May 3 21:30:37 2010 +0200 + + Sigma: Use software trigger to pinpoint exact sample. + +commit 6aac77375bb6f9545475d8d4d5e565f896b28be0 +Author: Håvard Espeland +Date: Mon May 3 19:04:10 2010 +0200 + + Sigma: Add state machine for tracking Sigma status. + +commit a42aec7f6e61b83fcd00e20827b31cc0ee3852d0 +Author: Håvard Espeland +Date: Mon May 3 15:06:43 2010 +0200 + + Sigma: Merge storage of rise/fall triggers. + +commit 4ae1f451363013d2f0fff180942e5b140e39f049 +Author: Håvard Espeland +Date: Sun May 2 19:21:05 2010 +0200 + + Sigma: Minor cleanups. + +commit 11fc8d9d938c2e254c62a40f569a964db79a489e +Author: Håvard Espeland +Date: Sun May 2 19:12:36 2010 +0200 + + Sigma: Set capture ratio correctly. + +commit c53d793f037878992a40c37aa4c0f5f5a3d1c2d8 +Author: Håvard Espeland +Date: Sun May 2 14:58:59 2010 +0200 + + Sigma: 50 MHZ falling/rising edge trigger support. + + Falling/rising edge and value/mask triggers can be combined, e.g.: + --triggers 1=0,2=r,3=1,4=1 + +commit f758d0744de812ded8938d06a5a72df3f8dd84c1 +Author: Håvard Espeland +Date: Sun May 2 12:59:33 2010 +0200 + + Sigma: Fix simple trigger LUT calculation. + +commit ee492173a1834514dadbec95388c8a0f00e8af64 +Author: Håvard Espeland +Date: Sat May 1 22:38:43 2010 +0200 + + Sigma: Value/mask trigger support in 50 MHz mode. + +commit eec5275e2f3dfa1b9bb51a1b054dc7d8bd3bac20 +Author: Håvard Espeland +Date: Sat May 1 14:22:22 2010 +0200 + + Sigma: Small cleanups. + +commit e65679b15e16d4b898ebdc1456018b9a8d364b1b +Author: Uwe Hermann +Date: Sat May 1 02:41:37 2010 +0200 + + Saleae: Rename firmware file to saleae-logic.fw. + + This is done for consistency with the ASIX SIGMA firmware file names, + and also for brevity. + +commit 34e4813f2e8b75981ed92d625c5fd55146a35e66 +Author: Bert Vermeulen +Date: Fri Apr 30 15:54:39 2010 -0700 + + inout module infrastructure + binary input module + +commit 5045c217e69d6bbb5ca52c75799a4d64c72bfafd +Author: Håvard Espeland +Date: Fri Apr 30 22:18:55 2010 +0200 + + cli: Show trigger event in bits plugin. + +commit 57bbf56b8420e75bcad45b417c0d36c0a55a3910 +Author: Håvard Espeland +Date: Fri Apr 30 22:18:10 2010 +0200 + + Sigma: Add triggers support for 100 and 200 MHz. + +commit ed09fd07f7122dd9ade0f15a2b885f33abed86e9 +Author: Håvard Espeland +Date: Fri Apr 30 23:51:57 2010 +0200 + + Sigma: Minor cleanup and add more samplesrates. + +commit 9ddb2a125d0cc01f76acc43670c4609cc4a7b49b +Author: Uwe Hermann +Date: Thu Apr 29 00:32:44 2010 +0200 + + Sigma: Small cosmetic fixes. + +commit edca2c5c2261ef4d6862d97e6d28d5a1c148a2f1 +Author: Håvard Espeland +Date: Wed Apr 28 22:45:13 2010 +0200 + + Sigma: Support for low samplerates + + Lowest samplerate supported in driver is 250 KHz + +commit f78898e947a52e1713f6b2eef66d473e1dfcd7bf +Author: Håvard Espeland +Date: Wed Apr 28 21:21:19 2010 +0200 + + Sigma: Support 50 and 200 MHz modes + +commit a8116d764ba3fc33bb6719f9e47ba1a5069981d1 +Author: Håvard Espeland +Date: Wed Apr 28 21:20:27 2010 +0200 + + Sigma: Rename firmware files + +commit e8397563a219d07179aa273d30396c3c21fb91ba +Author: Håvard Espeland +Date: Wed Apr 28 20:01:15 2010 +0200 + + Sigma: Upload 50, 100 or 200 MHz firmware + +commit f6564c8d1933921ee9e34e93effeef8cee4cc3ba +Author: Håvard Espeland +Date: Wed Apr 28 19:48:59 2010 +0200 + + Sigma: Move upload firmware into a function + +commit fefa18001aa343a476e3742de3ac946ae7ff2709 +Author: Uwe Hermann +Date: Wed Apr 28 00:17:28 2010 +0200 + + ASIX SIGMA: Coding style fixes (via indent mostly). + + Also, end all/most comments with full stop and avoid variable/array + definitions in the middle of functions. + +commit 204b1629bd4ef6b61c297fd830a3dae9edafc388 +Author: Uwe Hermann +Date: Tue Apr 27 22:46:59 2010 +0200 + + asix-sigma.h: Add missing license header. + +commit 911f18341b4def1c3184702c555b163de83a0f71 +Author: Uwe Hermann +Date: Tue Apr 27 22:44:15 2010 +0200 + + ASIX Sigma: Use common license header format. + +commit 28a35d8ab35483b6d50e5b8404542cc11875fa5d +Author: Håvard Espeland +Date: Tue Apr 27 21:43:24 2010 +0200 + + This commit adds initial support for the Asix Sigma Logic Analyzer. Currently, only 200 MHz is supported, and only with software trigger. Firmware for the device will be distributed separately, with permission from the vendor. + + Signed-off-by: Håvard Espeland + +commit 926b866cb624cebf2efca098088dba11afa8ae96 +Author: Uwe Hermann +Date: Thu Apr 22 03:39:02 2010 +0200 + + Win: Fix compile, serial port code (unfinished). + +commit 9601818842c469339038e85b3c110b66d1a31d4b +Author: Bert Vermeulen +Date: Sun Apr 18 10:57:13 2010 -0700 + + simplify code for unused features + +commit eee4890f2fac030ea77a31a3c6c478b4cb628011 +Author: Bert Vermeulen +Date: Sat Apr 17 23:07:00 2010 -0700 + + fix broken samplerate calculation + +commit 9c48090a8816949bccdec612edc165897fe8ce58 +Author: Bert Vermeulen +Date: Sat Apr 17 22:09:33 2010 -0700 + + fix double DF_END and libusb timeout + +commit 9a4988343fe72bf2e7e5364dbdaa4ce0d4d6c59d +Author: Uwe Hermann +Date: Thu Apr 15 23:24:44 2010 +0200 + + Oops, bugfixes. + +commit 408e719989d0b4d4408439bf84b87edea8ce85d6 +Author: Uwe Hermann +Date: Thu Apr 15 23:21:30 2010 +0200 + + Refactoring and code simplifications. + +commit fed16f06e236f3f2ccc25a63ca7ec7a020124fdc +Author: Uwe Hermann +Date: Thu Apr 15 22:59:43 2010 +0200 + + Saleae/Zeroplus: Coding style fixes. + +commit 43fc7885d31c1f6af0715b583a9d153ba59eda5c +Author: Uwe Hermann +Date: Thu Apr 15 22:16:35 2010 +0200 + + OLS: Coding style fixes. + +commit 986f7270bf871046e5cf1f154b6ed6226f63c7a5 +Author: Uwe Hermann +Date: Thu Apr 15 20:55:57 2010 +0200 + + hardware/common: Coding style fixes. + +commit 99c1fc59ed59785d44610ac07556143cb1617f01 +Author: Uwe Hermann +Date: Thu Apr 15 20:36:04 2010 +0200 + + output: Coding style fixes. + +commit 62c820258238485d3352f4a68a65d299b136b792 +Author: Uwe Hermann +Date: Thu Apr 15 20:16:53 2010 +0200 + + libsigrok: More coding style fixes. + +commit 1b452b8510922bac08db87f8ea769515c795e22f +Author: Uwe Hermann +Date: Thu Apr 15 20:07:16 2010 +0200 + + libsigrok: Coding style fixes. + +commit d86dc674a204bec034730f303f69cf61984fd819 +Author: Uwe Hermann +Date: Thu Apr 15 19:49:14 2010 +0200 + + Fix insufficient braces in KHZ() et al. + +commit fdd20b52391b9d491b37fb7d3e157ea5db098062 +Author: Uwe Hermann +Date: Tue Apr 13 00:34:20 2010 +0200 + + Add ARRAY_SIZE helper. + +commit 02076d69f9505bc20ce0e9f67fa131054d8baeab +Author: Uwe Hermann +Date: Mon Apr 12 23:21:12 2010 +0200 + + Rename "bin" output module to "bits" everywhere. + +commit 1c5b9d302c410cdd1cba441f618e0e3f7afa137d +Author: Uwe Hermann +Date: Mon Apr 12 21:22:58 2010 +0200 + + Add raw binary output format. + + Also, rename the "bin" format to "bits" for now to avoid confusion. + +commit afc8e4deb68271ba7696e38cc02053b97cfc1a19 +Author: Uwe Hermann +Date: Fri Apr 9 22:18:46 2010 +0200 + + Fix all warnings and re-enable -Wextra. + +commit 86c5e279085a05c19d1d071831411fb617816ded +Author: Uwe Hermann +Date: Fri Apr 9 21:20:22 2010 +0200 + + zeroplus: Fix compiler warnings. + +commit 08cfe6a2b755367eba4098195557f4e8e426eea4 +Author: Uwe Hermann +Date: Fri Apr 9 21:16:11 2010 +0200 + + Factor out trigger_helper() to reduce nesting. + +commit edf60d0575d039229da3676867a5eb094d0c3c5e +Author: Uwe Hermann +Date: Fri Apr 9 20:44:51 2010 +0200 + + Factor out common ezusb_upload_firmware(). + +commit 9d2933fbe9719df679cde8fbffde8c191d6a56d3 +Author: Uwe Hermann +Date: Fri Apr 9 20:36:29 2010 +0200 + + ezusb.c: Coding style fixes. + +commit 904299164f5718109fea2b23bc34e1522c548db4 +Author: Uwe Hermann +Date: Fri Apr 9 20:31:43 2010 +0200 + + sl_open_device(): Refactoring to reduce nesting. + +commit f6958dabcd0ce8e2613ee6b958bef7c80b9f9e18 +Author: Uwe Hermann +Date: Fri Apr 9 19:25:29 2010 +0200 + + Simplify code by reducing nesting level. + +commit 6f5f21f996cb06b518739440e7983fa61d61aea1 +Author: Uwe Hermann +Date: Fri Apr 9 19:04:36 2010 +0200 + + Coding style fixes, aided by 'indent'. + + The following shell alias can be used: + + alias INDENT='indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs' + +commit d02a535e05513ba8d2d4a82b49180d60ef410e1c +Author: Bert Vermeulen +Date: Fri Apr 9 05:15:27 2010 +0200 + + move posix-specific serial port comms to serial.c + +commit 54dc4bc703f7797a71129ee92412999d6ea64458 +Author: Bert Vermeulen +Date: Thu Apr 8 16:58:07 2010 +0200 + + switch to SIGROK_ERR + +commit 6937bb757e577ba3cf4036d24cc9852159182f47 +Author: Bert Vermeulen +Date: Thu Apr 8 16:49:39 2010 +0200 + + various fixes, basic acquisition works + +commit 54b38f64aa25d1cceebf1b31bcee0f11d67e432c +Author: Bert Vermeulen +Date: Thu Apr 8 16:44:13 2010 +0200 + + use strdup() instead of g_strdup() + +commit 37aea2d35c981239e630254fe74f0a411bbc34cb +Author: Bert Vermeulen +Date: Thu Apr 8 16:42:22 2010 +0200 + + better buffer size calculation + +commit d2cd86ac26a00a95cb0497ba5cb807d4587b67ce +Author: Bert Vermeulen +Date: Sun Apr 4 20:51:04 2010 +0200 + + fix off-by-one error + +commit 25e7d9b115e5ea08be2d92ffe286aa1bf95778f4 +Author: Uwe Hermann +Date: Wed Apr 7 19:43:41 2010 +0200 + + Factor out common sigrok_samplerate_string(). + +commit bc010c054be68082451dd56e586f03038ec7fb45 +Author: Uwe Hermann +Date: Tue Apr 6 15:02:14 2010 +0200 + + VCD output: Handle disabled probes correctly. + +commit e2ad47b5b0ad98fc99579d4cd9ebee7db2a03d82 +Author: Uwe Hermann +Date: Tue Apr 6 14:38:47 2010 +0200 + + Gnuplot output format support. + +commit 2b3414a497f639233c824bc930cecf5f17b5a79d +Author: Uwe Hermann +Date: Tue Apr 6 01:29:32 2010 +0200 + + libsigrokdecode: Add initial return code list. + +commit e31b636df6651ae17f9bb28c51157a51fc92c421 +Author: Uwe Hermann +Date: Mon Apr 5 16:41:54 2010 +0200 + + Start unification of libsigrok return codes. + + We have SIGROK_OK for functions calls where no errors occured. All + error code names start with SIGROK_ERR and are globally unique, + negative values. + + The value SIGROK_ERR is a generic/unspecified error code, all others, + such as SIGROK_ERR_MALLOC, refer to a specific error condition. + + This commit renames the old SIGROK_NOK etc. + +commit 5a8fda158bd9cc040b36fb3b016808c59ccf89f3 +Author: Uwe Hermann +Date: Mon Apr 5 16:20:09 2010 +0200 + + Allow output_format.init() to return errors. + +commit 4c100f3244ad816070fe2e30713705e109d5b4fb +Author: Uwe Hermann +Date: Mon Apr 5 15:31:39 2010 +0200 + + More consistent spelling of "samplerate". + +commit 4c9ffa83cf5b63445a1463af18a910a8cc786e31 +Author: Uwe Hermann +Date: Sun Apr 4 13:19:20 2010 +0200 + + Initial Value Change Dump (VCD) output support. + +commit a695d6c0751494a07493d809520d1ead9b281e7f +Author: Uwe Hermann +Date: Fri Apr 2 20:26:48 2010 +0200 + + Rename libbackend to libsigrok. + +commit a1bb33afbde769156ad4bef7a60579da64aebbb7 +Author: Uwe Hermann +Date: Fri Apr 2 20:18:27 2010 +0200 + + Start of code base layout restructuring. diff --git a/libsigrok4DSLogic/INSTALL b/libsigrok4DSLogic/INSTALL new file mode 100644 index 00000000..a1e89e18 --- /dev/null +++ b/libsigrok4DSLogic/INSTALL @@ -0,0 +1,370 @@ +Installation Instructions +************************* + +Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, +Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. Some packages provide this +`INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + + The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. + + 4. Type `make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the `make install' phase executed with root + privileges. + + 5. Optionally, type `make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior `make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type `make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide `make + distcheck', which can by used by developers to test that all other + targets like `make install' and `make uninstall' work correctly. + This target is generally not run by end users. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. This +is known as a "VPATH" build. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX', where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the +default for these options is expressed in terms of `${prefix}', so that +specifying just `--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to `configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +`make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, `make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +`${prefix}'. Any directories that were specified during `configure', +but not in terms of `${prefix}', must each be overridden at install +time for the entire installation to be relocated. The approach of +makefile variable overrides for each directory variable is required by +the GNU Coding Standards, and ideally causes no recompilation. +However, some platforms have known limitations with the semantics of +shared libraries that end up requiring recompilation when using this +method, particularly noticeable in packages that use GNU Libtool. + + The second method involves providing the `DESTDIR' variable. For +example, `make install DESTDIR=/alternate/directory' will prepend +`/alternate/directory' before all installation names. The approach of +`DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of `${prefix}' +at `configure' time. + +Optional Features +================= + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of `make' will be. For these packages, running `./configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with `make V=1'; while running `./configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with `make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + HP-UX `make' updates targets which have the same time stamps as +their prerequisites, which makes it generally unusable when shipped +generated files such as `configure' are involved. Use GNU `make' +instead. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put `/usr/ucb' early in your `PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in `/usr/bin'. So, if you need `/usr/ucb' +in your `PATH', put it _after_ `/usr/bin'. + + On Haiku, software installed for all users goes in `/boot/common', +not `/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/libsigrok4DSLogic/Makefile.am b/libsigrok4DSLogic/Makefile.am new file mode 100644 index 00000000..52c9f0e4 --- /dev/null +++ b/libsigrok4DSLogic/Makefile.am @@ -0,0 +1,68 @@ +## +## This file is part of the libsigrok4DSLogic project. +## +## Copyright (C) 2010-2012 Bert Vermeulen +## Copyright (C) 2012 Alexandru Gagniuc +## +## 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 . +## + +ACLOCAL_AMFLAGS = -I autostuff + +AM_CPPFLAGS = -I$(top_srcdir) + +SUBDIRS = hardware input output tests + +lib_LTLIBRARIES = libsigrok4DSLogic.la + +libsigrok4DSLogic_la_SOURCES = \ + backend.c \ + device.c \ + session.c \ + session_file.c \ + session_driver.c \ + hwdriver.c \ + filter.c \ + strutil.c \ + log.c \ + trigger.c \ + version.c \ + error.c \ + std.c + +libsigrok4DSLogic_la_LIBADD = \ + $(LIBOBJS) \ + hardware/libsigrok4DSLogichardware.la \ + input/libsigrok4DSLogicinput.la \ + output/libsigrok4DSLogicoutput.la + +libsigrok4DSLogic_la_LDFLAGS = $(SR_LIB_LDFLAGS) + +library_includedir = $(includedir)/libsigrok4DSLogic +library_include_HEADERS = libsigrok.h proto.h version.h +noinst_HEADERS = libsigrok-internal.h + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libsigrok4DSLogic.pc + +EXTRA_DIST = Doxyfile README.devices + +MAINTAINERCLEANFILES = ChangeLog + +.PHONY: ChangeLog +ChangeLog: + git --git-dir $(top_srcdir)/.git log > ChangeLog || touch ChangeLog + +dist-hook: ChangeLog + diff --git a/libsigrok4DSLogic/NEWS b/libsigrok4DSLogic/NEWS new file mode 100644 index 00000000..cc96bc22 --- /dev/null +++ b/libsigrok4DSLogic/NEWS @@ -0,0 +1,176 @@ +0.2.0 (2013-05-04) +------------------ + +Note: This release DOES change the libsigrok API. That means it is NOT + backwards-compatible and frontends will need updates. + + * Support for analog sources (oscilloscopes, DMMs, data loggers) was added. + * New supported hardware: + - Logic analyzers: + - CWAV USBee DX + - ZEROPLUS LAP-16128U + - Oscilloscopes: + - Hantek DSO-2090 (USB scope) + - Rigol DS1052D + - Rigol DS1052E + - Rigol DS1102D + - Rigol DS1102E + - Multimeters: + - Agilent U1231A + - Agilent U1232A + - Agilent U1233A + - Brymen BM857 + - Digitek DT4000ZC + - Fluke 187 + - Fluke 189 + - Fluke 287 + - Fluke 289 + - Fluke ScopeMeter 199B + - MASTECH MAS345 + - Metex ME-31 + - Metex M-3640D + - PCE PCE-DM32 + - PeakTech 3410 + - PeakTech 4370 + - RadioShack 22-168 + - RadioShack 22-805 + - RadioShack 22-812 + - Tecpel DMM-8060 + - Tecpel DMM-8061 + - TekPower TP4000ZC + - UNI-T UT61D + - UNI-T UT61E + - V&A VA18B + - Victor 70C + - Victor 86C + - Voltcraft VC-820 + - Voltcraft VC-840 + - Sound level meters: + - Colead SL-5868P + - Tondaj SL-814 + - Temperature/humidity/CO loggers: + - Lascar EL-USB and EL-USB CO series (various models) + - MIC 98581 + - MIC 98583 + * The limitation of max. 64 digital probes has been removed in many places. + * Added generic DMM protocol parsers usable for various DMMs, over various + cables and/or transports (e.g. same protocol over serial or USB/HID): + - Cyrustek ES51922 binary protocol. + - Fortune Semiconductor FS9721_LP3/FS9721B binary protocol. + - Fortune Semiconductor FS9922-DMM3/DMM4 binary protocol. + - Metex 14-byte ASCII protocol. + - RadioShack 22-812 binary protocol. + * zeroplus-logic-cube driver: + - Fix acquisition at some specific samplerates. Only report valid ones. + - Default to a samplerate of 1MHz. + - Fix trigger code. + - Add pre-trigger (capture ratio) setting. + - Add support for the ZEROPLUS LAP-16128U. + * fx2lafw driver: + - Add support for the CWAV USBee DX. This requires the latest version of + the fx2lafw firmware files. + - Add support for wide sampling (i.e. 16 probes instead of just 8). + - Fix multi-stage (software) triggers. + - Fix various memory leaks, firmware upload timeout bugs, and other issues. + - Various performance and memory usage improvements in the driver. + * chronovu-la8 driver: + - Add support for newer LA8 versions with USB VID/PID 0403:8867. + * demo driver: + - Various bugfixes when setting time/sample limits. + * openbench-logic-sniffer driver: + - Don't try to scan all available serial ports for OLS devices. Instead, + the serial port to use now has to be specified by the user. + - Allow disabling RLE. + * udev rules file: Add many new entries for additional devices. + * New output formats: + - analog: Prints analog values and their unit (e.g. from scopes or DMMs). + * New input formats: + - vcd: Value Change Dump format + - wav: Waveform audio file format (for analog data) + * 'binary' input format: Add support for a 'samplerate' option. + * API related changes: + - There is generated Doxygen API documentation now. + - The header that frontends should include is: . + There are other headers which are installed, but those are not meant to + be included directly by the frontends. + - There were numerous API changes, additions and removals, too many to list + here. Please check the source code or Doxygen API documentation for the + current set of API functions. + * Serial port code: + - Various improvements and fixes related to multiple parameters such as + directions, baudrate, flow control, and others. + - Add support for more baudrates (e.g. very low ones such as 600/1200) + that are used in some devices. + - Add support for setting DTR/RTS. + * gnuplot files: Add sample files for CWAV USBee DX (for 8/16 bit sampling). + * Documentation updates: + - Add a README.devices file which contains various notes for users of + libsigrok about device- and/or driver-specific issues. + - Update README, HACKING, and other documents. + - Updated build dependencies list. + - The following libs are needed in more recent versions now: + - glib (required): Now must be >= 2.32.0. + - libusb-1.0 (optional): Now must be >= 1.0.9. + - The following new libs were added as (optional) dependencies: + - libasound / alsa-lib (optional): >= 1.0 + - check (optional, only needed for unit tests): >= 0.9.4 + * Portability: + - Various compile fixes for Windows, FreeBSD/NetBSD/OpenBSD, and Mac OS X. + - Simplify/allow/fix cross-compilation of libsigrok. + - Various bugfixes for 32bit systems. + - Various endianness fixes. + * configure: + - Add a --disable-all-drivers option. This can be overridden by + additional --enable- options to selectively enable only some. + - Improve autodetection of libraries, and only enable drivers for which + all required libraries were found. + * Add a test suite for libsigrok with a few unit tests (the list will grow). + +0.1.1 (2012-05-30) +------------------ + +Note: This release does NOT change the libsigrok API. + + * The 'saleae-logic' driver (which depends on the Saleae firmware), has + been replaced with the new 'fx2lafw' driver, which uses an open-source + firmware for Cypress FX2 chips which is also named 'fx2lafw'. + Details: http://sigrok.org/wiki/Fx2lafw + This new driver (+ firmware) currently supports the following devices: + - ARMFLY AX-Pro + - Braintechnology USB-LPS + - EE Electronics ESLA100 + - EE Electronics ESLA201A + - Robomotic MiniLogic + - Robomotic BugLogic 3 + - Saleae Logic + - USBee AX + - USBee SX + - All Cypress FX2 eval boards with stock Cypress VID/PID, including: + - Lcsoft Mini Board + - Braintechnology USB Interface V2.x + Only acquisition with 8 probes is supported so far. Support for 16 probes + and support for analog signal acquisition (on devices which have these + capabilities) will be added later. + * ASIX SIGMA driver: + - Add support for the ASIX SIGMA2. This requires the latest version of + the SIGMA/SIGMA2 firmware files. + Details: http://sigrok.org/wiki/Firmware + - Various bugfixes. + * ZEROPLUS Logic Cube LAP-C (16032): Fix a segfault. + * udev file: Add entries for Robomotic BugLogic 3, Velleman PCSU1000, + Ideofy LA-08, ARMFLY AX-Pro, and Braintechnology USB Interface V2.x. + * The zlib dependency has been removed (no longer needed). + * Fix compiling with "Homebrew" (Mac OS X). + * libsigrok now expects firmware files in $prefix/share/sigrok-firmware by + default (was $prefix/share/libsigrok/firmware before). + * Fix a Makefile.am bug which caused the generated ChangeLog files being + accidentally deleted upon 'make distclean'. + * ChronoVu LA8 input file format: Improve autodetection of the file format. + We now only accept files of the size 8388613 bytes (all LA8 files have + exactly this amount of bytes). + +0.1.0 (2012-04-17) +------------------ + + * Initial release. + diff --git a/libsigrok4DSLogic/README b/libsigrok4DSLogic/README new file mode 100644 index 00000000..437294c4 --- /dev/null +++ b/libsigrok4DSLogic/README @@ -0,0 +1,100 @@ +------------------------------------------------------------------------------- +README +------------------------------------------------------------------------------- +libsigrok4DSLogic is a shared library which provides the basic API +for DSLogic hardware. +libsigrok4DSLogic is based on libsigrok, a shared library from the sigrok project. + +The sigrok project aims at creating a portable, cross-platform, +Free/Libre/Open-Source signal analysis software suite that supports various +device types (such as logic analyzers, oscilloscopes, multimeters, and more). + +libsigrok is a shared library written in C which provides the basic API +for talking to hardware and reading/writing the acquired data into various +input/output file formats. + + +Status +------ + +libsigrok is in a usable state and has had official tarball releases. + +While the API can change from release to release, this will always be +properly documented and reflected in the package version number and +in the shared library / libtool / .so-file version numbers. + +However, there are _NO_ guarantees at all for stable APIs in git snapshots! +Distro packagers should only use released tarballs (no git snapshots). + + +Requirements +------------ + + - git + - gcc (>= 4.0) + - make + - autoconf >= 2.63 + - automake >= 1.11 + - libtool + - pkg-config >= 0.22 + - libglib >= 2.32.0 + - libzip >= 0.8 + - libusb-1.0 >= 1.0.9 (optional, used by most drivers) + - libftdi >= 0.16 (optional, used by some drivers) + - libasound / alsa-lib >= 1.0 (optional, only used by the alsa driver) + - check >= 0.9.4 (optional, only needed to run unit tests) + + +Building and installing +----------------------- +Get the libsigrok4DSLogic source code from: www.dreamsourcelab.com/download.html +In order to build it, run: + + $ cd libsigrok + $ ./autogen.sh + $ ./configure + $ make + +For installing libsigrok4DSLogic: + + $ make install + +See INSTALL or the following wiki page for more (OS-specific) instructions: + + http://sigrok.org/wiki/Building + + +Copyright and license +--------------------- + +libsigrok4DSLogic is licensed under the terms of the GNU General Public License +(GPL), version 3 or later. + +While some individual source code files are licensed under the GPLv2+, and +some files are licensed under the GPLv3+, this doesn't change the fact that +the library as a whole is licensed under the terms of the GPLv3+. + +Please see the individual source files for the full list of copyright holders. + + +Mailing lists +------------- + +There are two mailing lists for sigrok/libsigrok: + + https://lists.sourceforge.net/lists/listinfo/sigrok-devel + https://lists.sourceforge.net/lists/listinfo/sigrok-commits + + +IRC +--- + +You can find the sigrok developers in the #sigrok IRC channel on Freenode. + + +Website +------- + + http://sigrok.org/wiki/Libsigrok + http://dreamsourcelab.com + diff --git a/libsigrok4DSLogic/autogen.sh b/libsigrok4DSLogic/autogen.sh new file mode 100644 index 00000000..f683d318 --- /dev/null +++ b/libsigrok4DSLogic/autogen.sh @@ -0,0 +1,60 @@ +#!/bin/sh +## +## This file is part of the libsigrok project. +## +## Copyright (C) 2010-2012 Bert Vermeulen +## +## 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 . +## + +OS=`uname` + +LIBTOOLIZE=libtoolize +ACLOCAL_DIR= + +if [ "x$OS" = "xDarwin" ]; then + LIBTOOLIZE=glibtoolize + + if [ -d /sw/share/aclocal ]; then + # fink installs aclocal macros here + ACLOCAL_DIR="-I /sw/share/aclocal" + elif [ -d /opt/local/share/aclocal ]; then + # Macports installs aclocal macros here + ACLOCAL_DIR="-I /opt/local/share/aclocal" + elif [ -d /usr/local/share/aclocal ]; then + # Homebrew installs aclocal macros here + ACLOCAL_DIR="-I /usr/local/share/aclocal" + elif [ -d /usr/share/aclocal ]; then + # Xcode installs aclocal macros here + ACLOCAL_DIR="-I /usr/share/aclocal" + fi + +elif [ "x$OS" = "xMINGW32_NT-5.1" ]; then + # Windows XP + ACLOCAL_DIR="-I /usr/local/share/aclocal" +elif [ "x$OS" = "xMINGW32_NT-6.0" ]; then + # Windows Vista + ACLOCAL_DIR="-I /usr/local/share/aclocal" +elif [ "x$OS" = "xMINGW32_NT-6.1" ]; then + # Windows 7 + ACLOCAL_DIR="-I /usr/local/share/aclocal" +fi + +echo "Generating build system..." +${LIBTOOLIZE} --install --copy --quiet || exit 1 +aclocal ${ACLOCAL_DIR} || exit 1 +autoheader || exit 1 +automake --add-missing --copy || exit 1 +autoconf || exit 1 + diff --git a/libsigrok4DSLogic/backend.c b/libsigrok4DSLogic/backend.c new file mode 100644 index 00000000..ca1460f8 --- /dev/null +++ b/libsigrok4DSLogic/backend.c @@ -0,0 +1,404 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2010-2012 Bert Vermeulen + * Copyright (C) 2012 Peter Stuge + * + * 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 . + */ + +#include +#include "config.h" /* Needed for HAVE_LIBUSB_1_0 and others. */ +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/** + * @mainpage libsigrok API + * + * @section sec_intro Introduction + * + * The sigrok project aims at creating a + * portable, cross-platform, Free/Libre/Open-Source signal analysis software + * suite that supports various device types (such as logic analyzers, + * oscilloscopes, multimeters, and more). + * + * libsigrok is a shared + * library written in C which provides the basic API for talking to + * supported hardware + * and reading/writing the acquired data into various + * input/output + * file formats. + * + * @section sec_api API reference + * + * See the "Modules" page for an introduction to various libsigrok + * related topics and the detailed API documentation of the respective + * functions. + * + * You can also browse the API documentation by file, or review all + * data structures. + * + * @section sec_mailinglists Mailing lists + * + * There are two mailing lists for sigrok/libsigrok: sigrok-devel and sigrok-commits. + * + * @section sec_irc IRC + * + * You can find the sigrok developers in the + * \#sigrok + * IRC channel on Freenode. + * + * @section sec_website Website + * + * sigrok.org/wiki/Libsigrok + */ + +/** + * @file + * + * Initializing and shutting down libsigrok. + */ + +/** + * @defgroup grp_init Initialization + * + * Initializing and shutting down libsigrok. + * + * Before using any of the libsigrok functionality, sr_init() must + * be called to initialize the library, which will return a struct sr_context + * when the initialization was successful. + * + * When libsigrok functionality is no longer needed, sr_exit() should be + * called, which will (among other things) free the struct sr_context. + * + * Example for a minimal program using libsigrok: + * + * @code{.c} + * #include + * #include + * + * int main(int argc, char **argv) + * { + * int ret; + * struct sr_context *sr_ctx; + * + * if ((ret = sr_init(&sr_ctx)) != SR_OK) { + * printf("Error initializing libsigrok (%s): %s.", + * sr_strerror_name(ret), sr_strerror(ret)); + * return 1; + * } + * + * // Use libsigrok functions here... + * + * if ((ret = sr_exit(sr_ctx)) != SR_OK) { + * printf("Error shutting down libsigrok (%s): %s.", + * sr_strerror_name(ret), sr_strerror(ret)); + * return 1; + * } + * + * return 0; + * } + * @endcode + * + * @{ + */ + +/** + * Sanity-check all libsigrok drivers. + * + * @return SR_OK if all drivers are OK, SR_ERR if one or more have issues. + */ +static int sanity_check_all_drivers(void) +{ + int i, errors, ret = SR_OK; + struct sr_dev_driver **drivers; + const char *d; + + sr_spew("Sanity-checking all drivers."); + + drivers = sr_driver_list(); + for (i = 0; drivers[i]; i++) { + errors = 0; + + d = (drivers[i]->name) ? drivers[i]->name : "NULL"; + + if (!drivers[i]->name) { + sr_err("No name in driver %d ('%s').", i, d); + errors++; + } + if (!drivers[i]->longname) { + sr_err("No longname in driver %d ('%s').", i, d); + errors++; + } + if (drivers[i]->api_version < 1) { + sr_err("API version in driver %d ('%s') < 1.", i, d); + errors++; + } + if (!drivers[i]->init) { + sr_err("No init in driver %d ('%s').", i, d); + errors++; + } + if (!drivers[i]->cleanup) { + sr_err("No cleanup in driver %d ('%s').", i, d); + errors++; + } + if (!drivers[i]->scan) { + sr_err("No scan in driver %d ('%s').", i, d); + errors++; + } + if (!drivers[i]->dev_list) { + sr_err("No dev_list in driver %d ('%s').", i, d); + errors++; + } + if (!drivers[i]->dev_clear) { + sr_err("No dev_clear in driver %d ('%s').", i, d); + errors++; + } + /* Note: config_get() is optional. */ + if (!drivers[i]->config_set) { + sr_err("No config_set in driver %d ('%s').", i, d); + errors++; + } + if (!drivers[i]->config_list) { + sr_err("No config_list in driver %d ('%s').", i, d); + errors++; + } + if (!drivers[i]->dev_open) { + sr_err("No dev_open in driver %d ('%s').", i, d); + errors++; + } + if (!drivers[i]->dev_close) { + sr_err("No dev_close in driver %d ('%s').", i, d); + errors++; + } + if (!drivers[i]->dev_acquisition_start) { + sr_err("No dev_acquisition_start in driver %d ('%s').", + i, d); + errors++; + } + if (!drivers[i]->dev_acquisition_stop) { + sr_err("No dev_acquisition_stop in driver %d ('%s').", + i, d); + errors++; + } + + /* Note: 'priv' is allowed to be NULL. */ + + if (errors == 0) + continue; + + ret = SR_ERR; + } + + return ret; +} + +/** + * Sanity-check all libsigrok input modules. + * + * @return SR_OK if all modules are OK, SR_ERR if one or more have issues. + */ +static int sanity_check_all_input_modules(void) +{ + int i, errors, ret = SR_OK; + struct sr_input_format **inputs; + const char *d; + + sr_spew("Sanity-checking all input modules."); + + inputs = sr_input_list(); + for (i = 0; inputs[i]; i++) { + errors = 0; + + d = (inputs[i]->id) ? inputs[i]->id : "NULL"; + + if (!inputs[i]->id) { + sr_err("No ID in module %d ('%s').", i, d); + errors++; + } + if (!inputs[i]->description) { + sr_err("No description in module %d ('%s').", i, d); + errors++; + } + if (!inputs[i]->format_match) { + sr_err("No format_match in module %d ('%s').", i, d); + errors++; + } + if (!inputs[i]->init) { + sr_err("No init in module %d ('%s').", i, d); + errors++; + } + if (!inputs[i]->loadfile) { + sr_err("No loadfile in module %d ('%s').", i, d); + errors++; + } + + if (errors == 0) + continue; + + ret = SR_ERR; + } + + return ret; +} + +/** + * Sanity-check all libsigrok output modules. + * + * @return SR_OK if all modules are OK, SR_ERR if one or more have issues. + */ +static int sanity_check_all_output_modules(void) +{ + int i, errors, ret = SR_OK; + struct sr_output_format **outputs; + const char *d; + + sr_spew("Sanity-checking all output modules."); + + outputs = sr_output_list(); + for (i = 0; outputs[i]; i++) { + errors = 0; + + d = (outputs[i]->id) ? outputs[i]->id : "NULL"; + + if (!outputs[i]->id) { + sr_err("No ID in module %d ('%s').", i, d); + errors++; + } + if (!outputs[i]->description) { + sr_err("No description in module %d ('%s').", i, d); + errors++; + } + if (outputs[i]->df_type < 10000 || outputs[i]->df_type > 10007) { + sr_err("Invalid df_type %d in module %d ('%s').", + outputs[i]->df_type, i, d); + errors++; + } + + /* All modules must provide a data or recv API callback. */ + if (!outputs[i]->data && !outputs[i]->receive) { + sr_err("No data/receive in module %d ('%s').", i, d); + errors++; + } + + /* + * Currently most API calls are optional (their function + * pointers can thus be NULL) in theory: init, event, cleanup. + */ + + if (errors == 0) + continue; + + ret = SR_ERR; + } + + return ret; +} + +/** + * Initialize libsigrok. + * + * This function must be called before any other libsigrok function. + * + * @param ctx Pointer to a libsigrok context struct pointer. Must not be NULL. + * This will be a pointer to a newly allocated libsigrok context + * object upon success, and is undefined upon errors. + * + * @return SR_OK upon success, a (negative) error code otherwise. Upon errors + * the 'ctx' pointer is undefined and should not be used. Upon success, + * the context will be free'd by sr_exit() as part of the libsigrok + * shutdown. + * + * @since 0.1.0 (but the API changed in 0.2.0) + */ +SR_API int sr_init(struct sr_context **ctx) +{ + int ret = SR_ERR; + struct sr_context *context; + + if (!ctx) { + sr_err("%s(): libsigrok context was NULL.", __func__); + return SR_ERR; + } + + if (sanity_check_all_drivers() < 0) { + sr_err("Internal driver error(s), aborting."); + return ret; + } + + if (sanity_check_all_input_modules() < 0) { + sr_err("Internal input module error(s), aborting."); + return ret; + } + + if (sanity_check_all_output_modules() < 0) { + sr_err("Internal output module error(s), aborting."); + return ret; + } + + /* + 1 to handle when struct sr_context has no members. */ + context = g_try_malloc0(sizeof(struct sr_context) + 1); + + if (!context) { + ret = SR_ERR_MALLOC; + goto done; + } + +#ifdef HAVE_LIBUSB_1_0 + ret = libusb_init(&context->libusb_ctx); + if (LIBUSB_SUCCESS != ret) { + sr_err("libusb_init() returned %s.\n", libusb_error_name(ret)); + ret = SR_ERR; + goto done; + } +#endif + + *ctx = context; + context = NULL; + ret = SR_OK; + +done: + if (context) + g_free(context); + return ret; +} + +/** + * Shutdown libsigrok. + * + * @param ctx Pointer to a libsigrok context struct. Must not be NULL. + * + * @return SR_OK upon success, a (negative) error code otherwise. + * + * @since 0.1.0 (but the API changed in 0.2.0) + */ +SR_API int sr_exit(struct sr_context *ctx) +{ + if (!ctx) { + sr_err("%s(): libsigrok context was NULL.", __func__); + return SR_ERR; + } + + sr_hw_cleanup_all(); + +#ifdef HAVE_LIBUSB_1_0 + libusb_exit(ctx->libusb_ctx); +#endif + + g_free(ctx); + + return SR_OK; +} + +/** @} */ diff --git a/libsigrok4DSLogic/config.h b/libsigrok4DSLogic/config.h new file mode 100644 index 00000000..09361c25 --- /dev/null +++ b/libsigrok4DSLogic/config.h @@ -0,0 +1,193 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +#ifndef SR_CONFIG_H +#define SR_CONFIG_H /* To stop multiple inclusions. */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Demo driver support */ +#define HAVE_LA_DEMO 1 + +/* Specifies whether we have libserialport. */ +/* #undef HAVE_LIBSERIALPORT */ + +/* Specifies whether we have a libusb.h header. */ +#define HAVE_LIBUSB_1_0 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strcspn' function. */ +#define HAVE_STRCSPN 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strncasecmp' function. */ +#define HAVE_STRNCASECMP 1 + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the `strtol' function. */ +#define HAVE_STRTOL 1 + +/* Define to 1 if you have the `strtoul' function. */ +#define HAVE_STRTOUL 1 + +/* Define to 1 if you have the `strtoull' function. */ +#define HAVE_STRTOULL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Name of package */ +#define PACKAGE "libsigrok4DSLogic" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "support@dreamsourcelab.com" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libsigrok4DSLogic" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libsigrok4DSLogic 0.2.0" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libsigrok4DSLogic" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "http://www.dreamsourcelab.com" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.2.0" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "0.2.0" + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT32_T */ + +/* Define for Solaris 2.5.1 so the uint64_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT64_T */ + +/* Define for Solaris 2.5.1 so the uint8_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT8_T */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to the type of a signed integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int16_t */ + +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int32_t */ + +/* Define to the type of a signed integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int64_t */ + +/* Define to the type of a signed integer type of width exactly 8 bits if such + a type exists and the standard includes do not define it. */ +/* #undef int8_t */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* Define to the type of an unsigned integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint16_t */ + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint32_t */ + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint64_t */ + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint8_t */ + +#endif /* SR_CONFIG_H */ diff --git a/libsigrok4DSLogic/config.h.in b/libsigrok4DSLogic/config.h.in new file mode 100644 index 00000000..6fc86bd2 --- /dev/null +++ b/libsigrok4DSLogic/config.h.in @@ -0,0 +1,192 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +#ifndef SR_CONFIG_H +#define SR_CONFIG_H /* To stop multiple inclusions. */ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Demo driver support */ +#undef HAVE_LA_DEMO + +/* Specifies whether we have libserialport. */ +#undef HAVE_LIBSERIALPORT + +/* Specifies whether we have a libusb.h header. */ +#undef HAVE_LIBUSB_1_0 + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the `strcspn' function. */ +#undef HAVE_STRCSPN + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strncasecmp' function. */ +#undef HAVE_STRNCASECMP + +/* Define to 1 if you have the `strstr' function. */ +#undef HAVE_STRSTR + +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL + +/* Define to 1 if you have the `strtoul' function. */ +#undef HAVE_STRTOUL + +/* Define to 1 if you have the `strtoull' function. */ +#undef HAVE_STRTOULL + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT32_T + +/* Define for Solaris 2.5.1 so the uint64_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT64_T + +/* Define for Solaris 2.5.1 so the uint8_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT8_T + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to the type of a signed integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +#undef int16_t + +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef int32_t + +/* Define to the type of a signed integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#undef int64_t + +/* Define to the type of a signed integer type of width exactly 8 bits if such + a type exists and the standard includes do not define it. */ +#undef int8_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* Define to the type of an unsigned integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +#undef uint16_t + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef uint32_t + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#undef uint64_t + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +#undef uint8_t + +#endif /* SR_CONFIG_H */ diff --git a/libsigrok4DSLogic/configure b/libsigrok4DSLogic/configure new file mode 100644 index 00000000..050b2dba --- /dev/null +++ b/libsigrok4DSLogic/configure @@ -0,0 +1,16363 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.68 for libsigrok4DSLogic 0.2.0. +# +# Report bugs to . +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: support@dreamsourcelab.com about your system, including +$0: any error possibly output before this message. Then +$0: install a modern shell, or manually run the script +$0: under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + +SHELL=${CONFIG_SHELL-/bin/sh} + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='libsigrok4DSLogic' +PACKAGE_TARNAME='libsigrok4DSLogic' +PACKAGE_VERSION='0.2.0' +PACKAGE_STRING='libsigrok4DSLogic 0.2.0' +PACKAGE_BUGREPORT='support@dreamsourcelab.com' +PACKAGE_URL='http://www.dreamsourcelab.com' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +SR_PACKAGE_VERSION +SR_PACKAGE_VERSION_MICRO +SR_PACKAGE_VERSION_MINOR +SR_PACKAGE_VERSION_MAJOR +AM_LIBTOOLFLAGS +MAKEFLAGS +FIRMWARE_DIR +HW_DEMO_FALSE +HW_DEMO_TRUE +SR_PKGLIBS +HAVE_CHECK_FALSE +HAVE_CHECK_TRUE +check_LIBS +check_CFLAGS +libusb_LIBS +libusb_CFLAGS +NEED_SERIAL_FALSE +NEED_SERIAL_TRUE +libserialport_LIBS +libserialport_CFLAGS +libzip_LIBS +libzip_CFLAGS +GLIB_COMPILE_RESOURCES +GLIB_MKENUMS +GOBJECT_QUERY +GLIB_GENMARSHAL +GLIB_LIBS +GLIB_CFLAGS +SR_LIB_LDFLAGS +SR_LIB_VERSION +SR_LIB_VERSION_AGE +SR_LIB_VERSION_REVISION +SR_LIB_VERSION_CURRENT +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +MANIFEST_TOOL +RANLIB +DLLTOOL +OBJDUMP +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +EGREP +GREP +SED +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +LIBTOOL +LN_S +CPP +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +ac_ct_AR +AR +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_silent_rules +enable_dependency_tracking +enable_shared +enable_static +with_pic +enable_fast_install +with_gnu_ld +with_sysroot +enable_libtool_lock +enable_all_drivers +enable_demo +enable_glibtest +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +libzip_CFLAGS +libzip_LIBS +libserialport_CFLAGS +libserialport_LIBS +libusb_CFLAGS +libusb_LIBS +check_CFLAGS +check_LIBS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures libsigrok4DSLogic 0.2.0 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root + [DATAROOTDIR/doc/libsigrok4DSLogic] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of libsigrok4DSLogic 0.2.0:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-silent-rules less verbose build output (undo: `make V=1') + --disable-silent-rules verbose build output (undo: `make V=0') + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-all-drivers enable all drivers by default [default=yes] + --enable-demo enable demo driver support [default=yes] + --disable-glibtest do not try to compile and run a test GLIB program + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot=DIR Search for dependent libraries within DIR + (or the compiler's sysroot if not specified). + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + libzip_CFLAGS + C compiler flags for libzip, overriding pkg-config + libzip_LIBS linker flags for libzip, overriding pkg-config + libserialport_CFLAGS + C compiler flags for libserialport, overriding pkg-config + libserialport_LIBS + linker flags for libserialport, overriding pkg-config + libusb_CFLAGS + C compiler flags for libusb, overriding pkg-config + libusb_LIBS linker flags for libusb, overriding pkg-config + check_CFLAGS + C compiler flags for check, overriding pkg-config + check_LIBS linker flags for check, overriding pkg-config + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +libsigrok4DSLogic home page: . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +libsigrok4DSLogic configure 0.2.0 +generated by GNU Autoconf 2.68 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ----------------------------------------- ## +## Report this to support@dreamsourcelab.com ## +## ----------------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_find_intX_t LINENO BITS VAR +# ----------------------------------- +# Finds a signed integer type with width BITS, setting cache variable VAR +# accordingly. +ac_fn_c_find_intX_t () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 +$as_echo_n "checking for int$2_t... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + # Order is important - never check a type that is potentially smaller + # than half of the expected target width. + for ac_type in int$2_t 'int' 'long int' \ + 'long long int' 'short int' 'signed char'; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default + enum { N = $2 / 2 - 1 }; +int +main () +{ +static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default + enum { N = $2 / 2 - 1 }; +int +main () +{ +static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) + < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + case $ac_type in #( + int$2_t) : + eval "$3=yes" ;; #( + *) : + eval "$3=\$ac_type" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no"; then : + +else + break +fi + done +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_find_intX_t + +# ac_fn_c_find_uintX_t LINENO BITS VAR +# ------------------------------------ +# Finds an unsigned integer type with width BITS, setting cache variable VAR +# accordingly. +ac_fn_c_find_uintX_t () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 +$as_echo_n "checking for uint$2_t... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + # Order is important - never check a type that is potentially smaller + # than half of the expected target width. + for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ + 'unsigned long long int' 'unsigned short int' 'unsigned char'; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + case $ac_type in #( + uint$2_t) : + eval "$3=yes" ;; #( + *) : + eval "$3=\$ac_type" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no"; then : + +else + break +fi + done +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_find_uintX_t + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by libsigrok4DSLogic $as_me 0.2.0, which was +generated by GNU Autoconf 2.68. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_config_headers="$ac_config_headers config.h" + + +ac_aux_dir= +for ac_dir in autostuff "$srcdir"/autostuff; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in autostuff \"$srcdir\"/autostuff" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + + +# We require at least automake 1.11 (needed for 'silent rules'). +am__api_version='1.11' + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +alias in your environment" "$LINENO" 5 + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='libsigrok4DSLogic' + VERSION='0.2.0' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in +yes) AM_DEFAULT_VERBOSITY=0;; +no) AM_DEFAULT_VERBOSITY=1;; +*) AM_DEFAULT_VERBOSITY=0;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar lib "link -lib" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar lib "link -lib" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 +$as_echo_n "checking the archiver ($AR) interface... " >&6; } +if ${am_cv_ar_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + am_cv_ar_interface=ar + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int some_variable = 0; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar + else + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 +$as_echo "$am_cv_ar_interface" >&6; } + +case $am_cv_ar_interface in +ar) + ;; +lib) + # Microsoft lib, so override with the ar-lib wrapper script. + # FIXME: It is wrong to rewrite AR. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__AR in this case, + # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something + # similar. + AR="$am_aux_dir/ar-lib $AR" + ;; +unknown) + as_fn_error $? "could not determine $AR interface" "$LINENO" 5 + ;; +esac + + + + + +# Enable more compiler warnings via -Wall and -Wextra. Add -fvisibility=hidden +# and enforce use of SR_API to explicitly mark all public API functions. +CFLAGS="$CFLAGS -Wall -Wextra -fvisibility=hidden" + +# Checks for programs. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + + +# Required for per-target flags or subdir-objects with C sources. +if test "x$CC" != xcc; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 +$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 +$as_echo_n "checking whether cc understands -c and -o together... " >&6; } +fi +set dummy $CC; ac_cc=`$as_echo "$2" | + sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +# Make sure it works both with $CC and with simple cc. +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' +rm -f conftest2.* +if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; +then + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + if test "x$CC" != xcc; then + # Test first that cc exists at all. + if { ac_try='cc -c conftest.$ac_ext >&5' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' + rm -f conftest2.* + if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; + then + # cc works too. + : + else + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no + fi + fi + fi +else + eval ac_cv_prog_cc_${ac_cc}_c_o=no +fi +rm -f core conftest* + +fi +if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h + +fi + +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o +if test "$am_t" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi + + + +# Initialize libtool. +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.4.2' +macro_revision='1.3337' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case "$ECHO" in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if ${ac_cv_path_FGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if ${lt_cv_path_NM+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if ${lt_cv_nm_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if ${lt_cv_sys_max_cmd_len+:} false; then : + $as_echo_n "(cached) " >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 +$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 +$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 +$as_echo "$lt_shell_append" >&6; } + + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if ${lt_cv_ld_reload_flag+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if ${lt_cv_deplibs_check_method+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} +: ${AR_FLAGS=cru} + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if ${lt_cv_sys_global_symbol_pipe+:} false; then : + $as_echo_n "(cached) " >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; +else + with_sysroot=no +fi + + +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 +$as_echo "${with_sysroot}" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } + + + + + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if ${lt_cv_cc_needs_belf+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes +else + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi + + + + + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if ${lt_cv_apple_cc_single_mod+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&5 + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if ${lt_cv_ld_exported_symbols_list+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes +else + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&5 + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + + + +# Set options + + + + enable_dlopen=no + + + enable_win32_dll=no + + + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + + + + + + + + + # Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + pic_mode=default +fi + + +test -z "$pic_mode" && pic_mode=default + + + + + + + + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if ${lt_cv_objdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if ${lt_cv_prog_compiler_pic_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + linux* | k*bsd*-gnu | gnu*) + link_all_deplibs=no + ;; + esac + + ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='${wl}--export-all-symbols' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + link_all_deplibs=no + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler__b=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } + +if test x"$lt_cv_prog_compiler__b" = xyes; then + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test "$lt_cv_irix_exported_symbol" = yes; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='${wl}-Blargedynsym' + ;; + esac + fi + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([A-Za-z]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } + +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if ${ac_cv_lib_dld_shl_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if ${ac_cv_lib_svld_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_svld_dlopen=yes +else + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if ${ac_cv_lib_dld_dld_link+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int +main () +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_dld_link=yes +else + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self_static+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report which library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + +# Initialize pkg-config. +# We require at least 0.22, as "Requires.private" behaviour changed there. + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.22 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi + +# Library version for libsigrok (NOT the same as the package version). +# Carefully read the libtool docs before updating these numbers! +# The algorithm for determining which number to change (and how) is nontrivial! +# http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info +SR_LIB_VERSION_CURRENT=1 +SR_LIB_VERSION_REVISION=2 +SR_LIB_VERSION_AGE=0 +SR_LIB_VERSION="$SR_LIB_VERSION_CURRENT:$SR_LIB_VERSION_REVISION:$SR_LIB_VERSION_AGE" +SR_LIB_LDFLAGS="-version-info $SR_LIB_VERSION" + + + + + + +# Check whether --enable-all-drivers was given. +if test "${enable_all_drivers+set}" = set; then : + enableval=$enable_all_drivers; HW_ENABLED_DEFAULT="$enableval" +else + HW_ENABLED_DEFAULT="yes" +fi + + +# Check whether --enable-demo was given. +if test "${enable_demo+set}" = set; then : + enableval=$enable_demo; HW_DEMO="$enableval" +else + HW_DEMO=$HW_ENABLED_DEFAULT +fi + +# Checks for libraries. + +case "$host" in +*mingw*) + # We need to link against the Winsock2 library for SCPI over TCP. + LIBS="$LIBS -lws2_32";; +esac + +# This variable collects the pkg-config names of all detected libs. +# It is then used to construct the "Requires.private:" field in the +# libsigrok4DSLogic.pc file. +SR_PKGLIBS="" + +# libm (the standard math library) is always needed. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pow" >&5 +$as_echo_n "checking for library containing pow... " >&6; } +if ${ac_cv_search_pow+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pow (); +int +main () +{ +return pow (); + ; + return 0; +} +_ACEOF +for ac_lib in '' m; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_pow=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_pow+:} false; then : + break +fi +done +if ${ac_cv_search_pow+:} false; then : + +else + ac_cv_search_pow=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pow" >&5 +$as_echo "$ac_cv_search_pow" >&6; } +ac_res=$ac_cv_search_pow +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + +# libglib-2.0 is always needed. Abort if it's not found. +# Note: glib-2.0 is part of the libsigrok API (hard pkg-config requirement). +# We require at least 2.32.0 due to e.g. g_variant_new_fixed_array(). +# Check whether --enable-glibtest was given. +if test "${enable_glibtest+set}" = set; then : + enableval=$enable_glibtest; +else + enable_glibtest=yes +fi + + + pkg_config_args=glib-2.0 + for module in . + do + case "$module" in + gmodule) + pkg_config_args="$pkg_config_args gmodule-2.0" + ;; + gmodule-no-export) + pkg_config_args="$pkg_config_args gmodule-no-export-2.0" + ;; + gobject) + pkg_config_args="$pkg_config_args gobject-2.0" + ;; + gthread) + pkg_config_args="$pkg_config_args gthread-2.0" + ;; + gio*) + pkg_config_args="$pkg_config_args $module-2.0" + ;; + esac + done + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.16 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi + + no_glib="" + + if test "x$PKG_CONFIG" = x ; then + no_glib=yes + PKG_CONFIG=no + fi + + min_glib_version=2.32.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB - version >= $min_glib_version" >&5 +$as_echo_n "checking for GLIB - version >= $min_glib_version... " >&6; } + + if test x$PKG_CONFIG != xno ; then + ## don't try to run the test against uninstalled libtool libs + if $PKG_CONFIG --uninstalled $pkg_config_args; then + echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" + enable_glibtest=no + fi + + if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then + : + else + no_glib=yes + fi + fi + + if test x"$no_glib" = x ; then + GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` + GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` + GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` + GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0` + + GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` + GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` + glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + if test "x$enable_glibtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$GLIB_LIBS $LIBS" + rm -f conf.glibtest + if test "$cross_compiling" = yes; then : + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include + +int +main () +{ + unsigned int major, minor, micro; + char *tmp_version; + + fclose (fopen ("conf.glibtest", "w")); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_glib_version"); + if (sscanf(tmp_version, "%u.%u.%u", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_glib_version"); + exit(1); + } + + if ((glib_major_version != $glib_config_major_version) || + (glib_minor_version != $glib_config_minor_version) || + (glib_micro_version != $glib_config_micro_version)) + { + printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", + $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, + glib_major_version, glib_minor_version, glib_micro_version); + printf ("*** was found! If pkg-config was correct, then it is best\n"); + printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); + printf("*** to point to the correct configuration files\n"); + } + else if ((glib_major_version != GLIB_MAJOR_VERSION) || + (glib_minor_version != GLIB_MINOR_VERSION) || + (glib_micro_version != GLIB_MICRO_VERSION)) + { + printf("*** GLIB header files (version %d.%d.%d) do not match\n", + GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); + printf("*** library (version %d.%d.%d)\n", + glib_major_version, glib_minor_version, glib_micro_version); + } + else + { + if ((glib_major_version > major) || + ((glib_major_version == major) && (glib_minor_version > minor)) || + ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n", + glib_major_version, glib_minor_version, glib_micro_version); + printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n", + major, minor, micro); + printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); + printf("*** correct copy of pkg-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + no_glib=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_glib" = x ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&5 +$as_echo "yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&6; } + CFLAGS="$CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + if test "$PKG_CONFIG" = "no" ; then + echo "*** A new enough version of pkg-config was not found." + echo "*** See http://www.freedesktop.org/software/pkgconfig/" + else + if test -f conf.glibtest ; then + : + else + echo "*** Could not run GLIB test program, checking why..." + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$LIBS $GLIB_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main () +{ + return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GLIB or finding the wrong" + echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" +else + echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GLIB is incorrectly installed." +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GLIB_CFLAGS="" + GLIB_LIBS="" + GLIB_GENMARSHAL="" + GOBJECT_QUERY="" + GLIB_MKENUMS="" + GLIB_COMPILE_RESOURCES="" + : + fi + + + + + + + rm -f conf.glibtest + + +# libzip is always needed. Abort if it's not found. + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libzip" >&5 +$as_echo_n "checking for libzip... " >&6; } + +if test -n "$libzip_CFLAGS"; then + pkg_cv_libzip_CFLAGS="$libzip_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzip >= 0.10\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libzip >= 0.10") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_libzip_CFLAGS=`$PKG_CONFIG --cflags "libzip >= 0.10" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$libzip_LIBS"; then + pkg_cv_libzip_LIBS="$libzip_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzip >= 0.10\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libzip >= 0.10") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_libzip_LIBS=`$PKG_CONFIG --libs "libzip >= 0.10" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + libzip_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libzip >= 0.10" 2>&1` + else + libzip_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libzip >= 0.10" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$libzip_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (libzip >= 0.10) were not met: + +$libzip_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables libzip_CFLAGS +and libzip_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables libzip_CFLAGS +and libzip_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + libzip_CFLAGS=$pkg_cv_libzip_CFLAGS + libzip_LIBS=$pkg_cv_libzip_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$CFLAGS $libzip_CFLAGS"; LIBS="$LIBS $libzip_LIBS"; + SR_PKGLIBS="$SR_PKGLIBS libzip" +fi + +# libserialport is only needed for some hardware drivers. Disable the +# respective drivers if it is not found. + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libserialport" >&5 +$as_echo_n "checking for libserialport... " >&6; } + +if test -n "$libserialport_CFLAGS"; then + pkg_cv_libserialport_CFLAGS="$libserialport_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libserialport >= 0.1.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libserialport >= 0.1.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_libserialport_CFLAGS=`$PKG_CONFIG --cflags "libserialport >= 0.1.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$libserialport_LIBS"; then + pkg_cv_libserialport_LIBS="$libserialport_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libserialport >= 0.1.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libserialport >= 0.1.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_libserialport_LIBS=`$PKG_CONFIG --libs "libserialport >= 0.1.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + libserialport_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libserialport >= 0.1.0" 2>&1` + else + libserialport_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libserialport >= 0.1.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$libserialport_PKG_ERRORS" >&5 + + have_libserialport="no" +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_libserialport="no" +else + libserialport_CFLAGS=$pkg_cv_libserialport_CFLAGS + libserialport_LIBS=$pkg_cv_libserialport_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_libserialport="yes"; CFLAGS="$CFLAGS $libserialport_CFLAGS"; + LIBS="$LIBS $libserialport_LIBS"; + SR_PKGLIBS="$SR_PKGLIBS libserialport" +fi + +# Define HAVE_LIBSERIALPORT in config.h if we found libserialport. +if test "x$have_libserialport" != "xno"; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSERIALPORT 1 +_ACEOF + +fi + +# Serial port helper code is only compiled in if libserialport was found. + if test "x$have_libserialport" != xno; then + NEED_SERIAL_TRUE= + NEED_SERIAL_FALSE='#' +else + NEED_SERIAL_TRUE='#' + NEED_SERIAL_FALSE= +fi + + +# libusb-1.0 is only needed for some hardware drivers. Disable the respective +# drivers if it is not found. +case "$host" in +*freebsd*) + # FreeBSD comes with an "integrated" libusb-1.0-style USB API. + # This means libusb-1.0 is always available, no need to check for it, + # and no need to (potentially) disable any drivers if it's not found. + +cat >>confdefs.h <<_ACEOF +#define HAVE_LIBUSB_1_0 1 +_ACEOF + + ;; +*) + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libusb" >&5 +$as_echo_n "checking for libusb... " >&6; } + +if test -n "$libusb_CFLAGS"; then + pkg_cv_libusb_CFLAGS="$libusb_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0 >= 1.0.9\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libusb-1.0 >= 1.0.9") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_libusb_CFLAGS=`$PKG_CONFIG --cflags "libusb-1.0 >= 1.0.9" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$libusb_LIBS"; then + pkg_cv_libusb_LIBS="$libusb_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0 >= 1.0.9\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libusb-1.0 >= 1.0.9") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_libusb_LIBS=`$PKG_CONFIG --libs "libusb-1.0 >= 1.0.9" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + libusb_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libusb-1.0 >= 1.0.9" 2>&1` + else + libusb_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libusb-1.0 >= 1.0.9" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$libusb_PKG_ERRORS" >&5 + + have_libusb1_0="no" +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_libusb1_0="no" +else + libusb_CFLAGS=$pkg_cv_libusb_CFLAGS + libusb_LIBS=$pkg_cv_libusb_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_libusb1_0="yes"; CFLAGS="$CFLAGS $libusb_CFLAGS"; + LIBS="$LIBS $libusb_LIBS"; + SR_PKGLIBS="$SR_PKGLIBS libusb-1.0" +fi + + # Define HAVE_LIBUSB_1_0 in config.h if we found libusb-1.0. + if test "x$have_libusb1_0" != "xno"; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_LIBUSB_1_0 1 +_ACEOF + + fi + ;; +esac + + + +# The Check unit testing framework is optional. Disable if not found. + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for check" >&5 +$as_echo_n "checking for check... " >&6; } + +if test -n "$check_CFLAGS"; then + pkg_cv_check_CFLAGS="$check_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"check >= 0.9.4\""; } >&5 + ($PKG_CONFIG --exists --print-errors "check >= 0.9.4") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_check_CFLAGS=`$PKG_CONFIG --cflags "check >= 0.9.4" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$check_LIBS"; then + pkg_cv_check_LIBS="$check_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"check >= 0.9.4\""; } >&5 + ($PKG_CONFIG --exists --print-errors "check >= 0.9.4") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_check_LIBS=`$PKG_CONFIG --libs "check >= 0.9.4" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + check_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "check >= 0.9.4" 2>&1` + else + check_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "check >= 0.9.4" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$check_PKG_ERRORS" >&5 + + have_check="no" +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_check="no" +else + check_CFLAGS=$pkg_cv_check_CFLAGS + check_LIBS=$pkg_cv_check_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_check="yes"; CFLAGS="$CFLAGS $check_CFLAGS"; + LIBS="$LIBS $check_LIBS" +fi + if test x"$have_check" = "xyes"; then + HAVE_CHECK_TRUE= + HAVE_CHECK_FALSE='#' +else + HAVE_CHECK_TRUE='#' + HAVE_CHECK_FALSE= +fi + + +# The OLS driver uses serial port file descriptors directly, and therefore +# will not currently work on Windows. + + + + +# Now set AM_CONDITIONALs and AC_DEFINEs for the enabled/disabled drivers. + + + + if test x$HW_DEMO = xyes; then + HW_DEMO_TRUE= + HW_DEMO_FALSE='#' +else + HW_DEMO_TRUE='#' + HW_DEMO_FALSE= +fi + +if test "x$HW_DEMO" = "xyes"; then + +$as_echo "#define HAVE_LA_DEMO 1" >>confdefs.h + +fi + + + +# Checks for header files. +# These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h. +for ac_header in fcntl.h sys/time.h termios.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +# Checks for typedefs, structures, and compiler characteristics. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +$as_echo_n "checking whether byte ordering is bigendian... " >&6; } +if ${ac_cv_c_bigendian+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef _BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes; then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; + +int +main () +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_c_bigendian=no +else + ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +$as_echo "$ac_cv_c_bigendian" >&6; } + case $ac_cv_c_bigendian in #( + yes) + $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h +;; #( + no) + ;; #( + universal) + +$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + + ;; #( + *) + as_fn_error $? "unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t" +case $ac_cv_c_int8_t in #( + no|yes) ;; #( + *) + +cat >>confdefs.h <<_ACEOF +#define int8_t $ac_cv_c_int8_t +_ACEOF +;; +esac + +ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t" +case $ac_cv_c_int16_t in #( + no|yes) ;; #( + *) + +cat >>confdefs.h <<_ACEOF +#define int16_t $ac_cv_c_int16_t +_ACEOF +;; +esac + +ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" +case $ac_cv_c_int32_t in #( + no|yes) ;; #( + *) + +cat >>confdefs.h <<_ACEOF +#define int32_t $ac_cv_c_int32_t +_ACEOF +;; +esac + +ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t" +case $ac_cv_c_int64_t in #( + no|yes) ;; #( + *) + +cat >>confdefs.h <<_ACEOF +#define int64_t $ac_cv_c_int64_t +_ACEOF +;; +esac + +ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" +case $ac_cv_c_uint8_t in #( + no|yes) ;; #( + *) + +$as_echo "#define _UINT8_T 1" >>confdefs.h + + +cat >>confdefs.h <<_ACEOF +#define uint8_t $ac_cv_c_uint8_t +_ACEOF +;; + esac + +ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" +case $ac_cv_c_uint16_t in #( + no|yes) ;; #( + *) + + +cat >>confdefs.h <<_ACEOF +#define uint16_t $ac_cv_c_uint16_t +_ACEOF +;; + esac + +ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" +case $ac_cv_c_uint32_t in #( + no|yes) ;; #( + *) + +$as_echo "#define _UINT32_T 1" >>confdefs.h + + +cat >>confdefs.h <<_ACEOF +#define uint32_t $ac_cv_c_uint32_t +_ACEOF +;; + esac + +ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" +case $ac_cv_c_uint64_t in #( + no|yes) ;; #( + *) + +$as_echo "#define _UINT64_T 1" >>confdefs.h + + +cat >>confdefs.h <<_ACEOF +#define uint64_t $ac_cv_c_uint64_t +_ACEOF +;; + esac + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + + +# Checks for library functions. +for ac_func in gettimeofday memset strchr strcspn strdup strerror strncasecmp strstr strtol strtoul strtoull +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +FIRMWARE_DIR="$datadir/sigrok-firmware" + +MAKEFLAGS='--no-print-directory' + +AM_LIBTOOLFLAGS='--silent' + + +SR_PACKAGE_VERSION_MAJOR=0 +SR_PACKAGE_VERSION_MINOR=2 +SR_PACKAGE_VERSION_MICRO=0 +SR_PACKAGE_VERSION=0.2.0 + + + + + + +ac_config_files="$ac_config_files Makefile version.h hardware/Makefile hardware/demo/Makefile input/Makefile output/Makefile output/text/Makefile libsigrok4DSLogic.pc tests/Makefile" + + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${NEED_SERIAL_TRUE}" && test -z "${NEED_SERIAL_FALSE}"; then + as_fn_error $? "conditional \"NEED_SERIAL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_CHECK_TRUE}" && test -z "${HAVE_CHECK_FALSE}"; then + as_fn_error $? "conditional \"HAVE_CHECK\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HW_DEMO_TRUE}" && test -z "${HW_DEMO_FALSE}"; then + as_fn_error $? "conditional \"HW_DEMO\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by libsigrok4DSLogic $as_me 0.2.0, which was +generated by GNU Autoconf 2.68. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to . +libsigrok4DSLogic home page: ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +libsigrok4DSLogic config.status 0.2.0 +configured by $0, generated by GNU Autoconf 2.68, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in SHELL \ +ECHO \ +PATH_SEPARATOR \ +SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +OBJDUMP \ +deplibs_check_method \ +file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +DLLTOOL \ +sharedlib_from_linklib_cmd \ +AR \ +AR_FLAGS \ +archiver_list_spec \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +nm_file_list_spec \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postlink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile' + + + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "version.h") CONFIG_FILES="$CONFIG_FILES version.h" ;; + "hardware/Makefile") CONFIG_FILES="$CONFIG_FILES hardware/Makefile" ;; + "hardware/demo/Makefile") CONFIG_FILES="$CONFIG_FILES hardware/demo/Makefile" ;; + "input/Makefile") CONFIG_FILES="$CONFIG_FILES input/Makefile" ;; + "output/Makefile") CONFIG_FILES="$CONFIG_FILES output/Makefile" ;; + "output/text/Makefile") CONFIG_FILES="$CONFIG_FILES output/text/Makefile" ;; + "libsigrok4DSLogic.pc") CONFIG_FILES="$CONFIG_FILES libsigrok4DSLogic.pc" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool 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 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="" + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The PATH separator for the build system. +PATH_SEPARATOR=$lt_PATH_SEPARATOR + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive. +AR_FLAGS=$lt_AR_FLAGS + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and in which our libraries should be installed. +lt_sysroot=$lt_sysroot + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + if test x"$xsi_shell" = xyes; then + sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ +func_dirname ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_basename ()$/,/^} # func_basename /c\ +func_basename ()\ +{\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ +func_dirname_and_basename ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ +func_stripname ()\ +{\ +\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ +\ # positional parameters, so assign one to ordinary parameter first.\ +\ func_stripname_result=${3}\ +\ func_stripname_result=${func_stripname_result#"${1}"}\ +\ func_stripname_result=${func_stripname_result%"${2}"}\ +} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ +func_split_long_opt ()\ +{\ +\ func_split_long_opt_name=${1%%=*}\ +\ func_split_long_opt_arg=${1#*=}\ +} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ +func_split_short_opt ()\ +{\ +\ func_split_short_opt_arg=${1#??}\ +\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ +} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ +func_lo2o ()\ +{\ +\ case ${1} in\ +\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ +\ *) func_lo2o_result=${1} ;;\ +\ esac\ +} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_xform ()$/,/^} # func_xform /c\ +func_xform ()\ +{\ + func_xform_result=${1%.*}.lo\ +} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_arith ()$/,/^} # func_arith /c\ +func_arith ()\ +{\ + func_arith_result=$(( $* ))\ +} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_len ()$/,/^} # func_len /c\ +func_len ()\ +{\ + func_len_result=${#1}\ +} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + +fi + +if test x"$lt_shell_append" = xyes; then + sed -e '/^func_append ()$/,/^} # func_append /c\ +func_append ()\ +{\ + eval "${1}+=\\${2}"\ +} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ +func_append_quoted ()\ +{\ +\ func_quote_for_eval "${2}"\ +\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ +} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 +$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} +fi + + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + +echo +echo "libsigrok configuration summary:" +echo +echo " - Package version (major.minor.micro): $SR_PACKAGE_VERSION" +echo " - Library version (current:revision:age): $SR_LIB_VERSION" +echo " - Prefix: $prefix" +echo " - Building on: $build" +echo " - Building for: $host" +echo +echo "Detected libraries:" +echo + +# Note: This only works for libs with pkg-config integration. +for lib in "glib-2.0 >= 2.32.0" "libzip >= 0.10" "libserialport >= 0.1.0" "libusb-1.0 >= 1.0.9" "libftdi >= 0.16" "libudev >= 151" "alsa >= 1.0" "check >= 0.9.4"; do + if `$PKG_CONFIG --exists $lib`; then + ver=`$PKG_CONFIG --modversion $lib` + answer="yes ($ver)" + else + answer="no" + fi + echo " - $lib: $answer" +done + +echo -e "\nEnabled hardware drivers:\n" +echo " - demo............................ $HW_DEMO" +echo + diff --git a/libsigrok4DSLogic/configure.ac b/libsigrok4DSLogic/configure.ac new file mode 100644 index 00000000..a54b23a4 --- /dev/null +++ b/libsigrok4DSLogic/configure.ac @@ -0,0 +1,254 @@ +## +## This file is part of the libsigrok project. +## +## Copyright (C) 2010-2012 Bert Vermeulen +## Copyright (C) 2012 Alexandru Gagniuc +## +## 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 . +## + +# We require at least autoconf 2.63 (AC_INIT format changed there). +AC_PREREQ([2.63]) + +# libsigrok package version number (NOT the same as shared lib version!). +m4_define([sr_package_version_major], [0]) +m4_define([sr_package_version_minor], [2]) +m4_define([sr_package_version_micro], [0]) +m4_define([sr_package_version], [sr_package_version_major.sr_package_version_minor.sr_package_version_micro]) + +AC_INIT([libsigrok4DSLogic], [sr_package_version], [support@dreamsourcelab.com], + [libsigrok4DSLogic], [http://www.dreamsourcelab.com]) +AC_CONFIG_HEADER([config.h]) +AC_CONFIG_MACRO_DIR([autostuff]) +AC_CONFIG_AUX_DIR([autostuff]) + +# We require at least automake 1.11 (needed for 'silent rules'). +AM_INIT_AUTOMAKE([1.11 -Wall -Werror check-news color-tests]) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) + +AH_TOP([#ifndef SR_CONFIG_H +#define SR_CONFIG_H /* To stop multiple inclusions. */]) +AH_BOTTOM([#endif /* SR_CONFIG_H */]) + +# Enable more compiler warnings via -Wall and -Wextra. Add -fvisibility=hidden +# and enforce use of SR_API to explicitly mark all public API functions. +CFLAGS="$CFLAGS -Wall -Wextra -fvisibility=hidden" + +# Checks for programs. +AC_PROG_CC +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_LN_S + +# Required for per-target flags or subdir-objects with C sources. +AM_PROG_CC_C_O + +# Initialize libtool. +LT_INIT + +# Initialize pkg-config. +# We require at least 0.22, as "Requires.private" behaviour changed there. +PKG_PROG_PKG_CONFIG([0.22]) + +# Library version for libsigrok (NOT the same as the package version). +# Carefully read the libtool docs before updating these numbers! +# The algorithm for determining which number to change (and how) is nontrivial! +# http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info +SR_LIB_VERSION_CURRENT=1 +SR_LIB_VERSION_REVISION=2 +SR_LIB_VERSION_AGE=0 +SR_LIB_VERSION="$SR_LIB_VERSION_CURRENT:$SR_LIB_VERSION_REVISION:$SR_LIB_VERSION_AGE" +SR_LIB_LDFLAGS="-version-info $SR_LIB_VERSION" +AC_SUBST(SR_LIB_VERSION_CURRENT) +AC_SUBST(SR_LIB_VERSION_REVISION) +AC_SUBST(SR_LIB_VERSION_AGE) +AC_SUBST(SR_LIB_VERSION) +AC_SUBST(SR_LIB_LDFLAGS) + +AC_ARG_ENABLE(all-drivers, AC_HELP_STRING([--enable-all-drivers], + [enable all drivers by default [default=yes]]), + [HW_ENABLED_DEFAULT="$enableval"], + [HW_ENABLED_DEFAULT="yes"]) + +AC_ARG_ENABLE(demo, AC_HELP_STRING([--enable-demo], + [enable demo driver support [default=yes]]), + [HW_DEMO="$enableval"], + [HW_DEMO=$HW_ENABLED_DEFAULT]) +# Checks for libraries. + +case "$host" in +*mingw*) + # We need to link against the Winsock2 library for SCPI over TCP. + LIBS="$LIBS -lws2_32";; +esac + +# This variable collects the pkg-config names of all detected libs. +# It is then used to construct the "Requires.private:" field in the +# libsigrok4DSLogic.pc file. +SR_PKGLIBS="" + +# libm (the standard math library) is always needed. +AC_SEARCH_LIBS([pow], [m]) + +# libglib-2.0 is always needed. Abort if it's not found. +# Note: glib-2.0 is part of the libsigrok API (hard pkg-config requirement). +# We require at least 2.32.0 due to e.g. g_variant_new_fixed_array(). +AM_PATH_GLIB_2_0([2.32.0], + [CFLAGS="$CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"]) + +# libzip is always needed. Abort if it's not found. +PKG_CHECK_MODULES([libzip], [libzip >= 0.10], + [CFLAGS="$CFLAGS $libzip_CFLAGS"; LIBS="$LIBS $libzip_LIBS"; + SR_PKGLIBS="$SR_PKGLIBS libzip"]) + +# libserialport is only needed for some hardware drivers. Disable the +# respective drivers if it is not found. +PKG_CHECK_MODULES([libserialport], [libserialport >= 0.1.0], + [have_libserialport="yes"; CFLAGS="$CFLAGS $libserialport_CFLAGS"; + LIBS="$LIBS $libserialport_LIBS"; + SR_PKGLIBS="$SR_PKGLIBS libserialport"], + [have_libserialport="no"]) + +# Define HAVE_LIBSERIALPORT in config.h if we found libserialport. +if test "x$have_libserialport" != "xno"; then + AC_DEFINE_UNQUOTED(HAVE_LIBSERIALPORT, [1], + [Specifies whether we have libserialport.]) +fi + +# Serial port helper code is only compiled in if libserialport was found. +AM_CONDITIONAL(NEED_SERIAL, test "x$have_libserialport" != xno) + +# libusb-1.0 is only needed for some hardware drivers. Disable the respective +# drivers if it is not found. +case "$host" in +*freebsd*) + # FreeBSD comes with an "integrated" libusb-1.0-style USB API. + # This means libusb-1.0 is always available, no need to check for it, + # and no need to (potentially) disable any drivers if it's not found. + AC_DEFINE_UNQUOTED(HAVE_LIBUSB_1_0, [1], + [Specifies whether we have a libusb.h header.]) + ;; +*) + PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9], + [have_libusb1_0="yes"; CFLAGS="$CFLAGS $libusb_CFLAGS"; + LIBS="$LIBS $libusb_LIBS"; + SR_PKGLIBS="$SR_PKGLIBS libusb-1.0"], + [have_libusb1_0="no"]) + + # Define HAVE_LIBUSB_1_0 in config.h if we found libusb-1.0. + if test "x$have_libusb1_0" != "xno"; then + AC_DEFINE_UNQUOTED(HAVE_LIBUSB_1_0, [1], + [Specifies whether we have a libusb.h header.]) + fi + ;; +esac + + + +# The Check unit testing framework is optional. Disable if not found. +PKG_CHECK_MODULES([check], [check >= 0.9.4], + [have_check="yes"; CFLAGS="$CFLAGS $check_CFLAGS"; + LIBS="$LIBS $check_LIBS"], [have_check="no"]) +AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes") + +# The OLS driver uses serial port file descriptors directly, and therefore +# will not currently work on Windows. + + +AC_SUBST(SR_PKGLIBS) + +# Now set AM_CONDITIONALs and AC_DEFINEs for the enabled/disabled drivers. + + + +AM_CONDITIONAL(HW_DEMO, test x$HW_DEMO = xyes) +if test "x$HW_DEMO" = "xyes"; then + AC_DEFINE(HAVE_LA_DEMO, 1, [Demo driver support]) +fi + + + +# Checks for header files. +# These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h. +AC_CHECK_HEADERS([fcntl.h sys/time.h termios.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_BIGENDIAN +AC_C_INLINE +AC_TYPE_INT8_T +AC_TYPE_INT16_T +AC_TYPE_INT32_T +AC_TYPE_INT64_T +AC_TYPE_UINT8_T +AC_TYPE_UINT16_T +AC_TYPE_UINT32_T +AC_TYPE_UINT64_T +AC_TYPE_SIZE_T + +# Checks for library functions. +AC_CHECK_FUNCS([gettimeofday memset strchr strcspn strdup strerror strncasecmp strstr strtol strtoul strtoull]) + +AC_SUBST(FIRMWARE_DIR, "$datadir/sigrok-firmware") +AC_SUBST(MAKEFLAGS, '--no-print-directory') +AC_SUBST(AM_LIBTOOLFLAGS, '--silent') + +SR_PACKAGE_VERSION_MAJOR=sr_package_version_major +SR_PACKAGE_VERSION_MINOR=sr_package_version_minor +SR_PACKAGE_VERSION_MICRO=sr_package_version_micro +SR_PACKAGE_VERSION=sr_package_version + +AC_SUBST(SR_PACKAGE_VERSION_MAJOR) +AC_SUBST(SR_PACKAGE_VERSION_MINOR) +AC_SUBST(SR_PACKAGE_VERSION_MICRO) +AC_SUBST(SR_PACKAGE_VERSION) + +AC_CONFIG_FILES([Makefile version.h hardware/Makefile + hardware/demo/Makefile + input/Makefile + output/Makefile + output/text/Makefile + libsigrok4DSLogic.pc + tests/Makefile + ]) + +AC_OUTPUT + +echo +echo "libsigrok configuration summary:" +echo +echo " - Package version (major.minor.micro): $SR_PACKAGE_VERSION" +echo " - Library version (current:revision:age): $SR_LIB_VERSION" +echo " - Prefix: $prefix" +echo " - Building on: $build" +echo " - Building for: $host" +echo +echo "Detected libraries:" +echo + +# Note: This only works for libs with pkg-config integration. +for lib in "glib-2.0 >= 2.32.0" "libzip >= 0.10" "libserialport >= 0.1.0" "libusb-1.0 >= 1.0.9" "libftdi >= 0.16" "libudev >= 151" "alsa >= 1.0" "check >= 0.9.4"; do + if `$PKG_CONFIG --exists $lib`; then + ver=`$PKG_CONFIG --modversion $lib` + answer="yes ($ver)" + else + answer="no" + fi + echo " - $lib: $answer" +done + +echo -e "\nEnabled hardware drivers:\n" +echo " - demo............................ $HW_DEMO" +echo + diff --git a/libsigrok4DSLogic/device.c b/libsigrok4DSLogic/device.c new file mode 100644 index 00000000..cca0bcd3 --- /dev/null +++ b/libsigrok4DSLogic/device.c @@ -0,0 +1,403 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2013 Bert Vermeulen + * + * 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 . + */ + +#include +#include +#include "config.h" /* Needed for HAVE_LIBUSB_1_0 and others. */ +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "device: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +/** + * @file + * + * Device handling in libsigrok. + */ + +/** + * @defgroup grp_devices Devices + * + * Device handling in libsigrok. + * + * @{ + */ + +/** @private */ +SR_PRIV struct sr_probe *sr_probe_new(int index, int type, + gboolean enabled, const char *name) +{ + struct sr_probe *probe; + + if (!(probe = g_try_malloc0(sizeof(struct sr_probe)))) { + sr_err("Probe malloc failed."); + return NULL; + } + + probe->index = index; + probe->type = type; + probe->enabled = enabled; + if (name) + probe->name = g_strdup(name); + + return probe; +} + +/** + * Set the name of the specified probe in the specified device. + * + * If the probe already has a different name assigned to it, it will be + * removed, and the new name will be saved instead. + * + * @param sdi The device instance the probe is connected to. + * @param probenum The number of the probe whose name to set. + * Note that the probe numbers start at 0. + * @param name The new name that the specified probe should get. A copy + * of the string is made. + * + * @return SR_OK on success, or SR_ERR_ARG on invalid arguments. + * + * @since 0.1.0 (but the API changed in 0.2.0) + */ +SR_API int sr_dev_probe_name_set(const struct sr_dev_inst *sdi, + int probenum, const char *name) +{ + GSList *l; + struct sr_probe *probe; + int ret; + + if (!sdi) { + sr_err("%s: sdi was NULL", __func__); + return SR_ERR_ARG; + } + + ret = SR_ERR_ARG; + for (l = sdi->probes; l; l = l->next) { + probe = l->data; + if (probe->index == probenum) { + g_free(probe->name); + probe->name = g_strdup(name); + ret = SR_OK; + break; + } + } + + return ret; +} + +/** + * Enable or disable a probe on the specified device. + * + * @param sdi The device instance the probe is connected to. + * @param probenum The probe number, starting from 0. + * @param state TRUE to enable the probe, FALSE to disable. + * + * @return SR_OK on success, or SR_ERR_ARG on invalid arguments. + * + * @since 0.2.0 + */ +SR_API int sr_dev_probe_enable(const struct sr_dev_inst *sdi, int probenum, + gboolean state) +{ + GSList *l; + struct sr_probe *probe; + int ret; + + if (!sdi) + return SR_ERR_ARG; + + ret = SR_ERR_ARG; + for (l = sdi->probes; l; l = l->next) { + probe = l->data; + if (probe->index == probenum) { + probe->enabled = state; + ret = SR_OK; + break; + } + } + + return ret; +} + +/** + * Add a trigger to the specified device (and the specified probe). + * + * If the specified probe of this device already has a trigger, it will + * be silently replaced. + * + * @param sdi Must not be NULL. + * @param probenum The probe number, starting from 0. + * @param trigger Trigger string, in the format used by sigrok-cli + * + * @return SR_OK on success, or SR_ERR_ARG on invalid arguments. + * + * @since 0.1.0 (but the API changed in 0.2.0) + */ +SR_API int sr_dev_trigger_set(const struct sr_dev_inst *sdi, int probenum, + const char *trigger) +{ + GSList *l; + struct sr_probe *probe; + int ret; + + if (!sdi) + return SR_ERR_ARG; + + ret = SR_ERR_ARG; + for (l = sdi->probes; l; l = l->next) { + probe = l->data; + if (probe->index == probenum) { + /* If the probe already has a trigger, kill it first. */ + g_free(probe->trigger); + probe->trigger = g_strdup(trigger); + ret = SR_OK; + break; + } + } + + return ret; +} + +/** + * Determine whether the specified device instance has the specified + * capability. + * + * @param sdi Pointer to the device instance to be checked. Must not be NULL. + * If the device's 'driver' field is NULL (virtual device), this + * function will always return FALSE (virtual devices don't have + * a hardware capabilities list). + * @param key The option that should be checked for support on the + * specified device. + * + * @return TRUE if the device has the specified option, FALSE otherwise. + * FALSE is also returned on invalid input parameters or other + * error conditions. + * + * @since 0.1.0 (but the API changed in 0.2.0) + */ +SR_API gboolean sr_dev_has_option(const struct sr_dev_inst *sdi, int key) +{ + GVariant *gvar; + const int *devopts; + gsize num_opts, i; + int ret; + + if (!sdi || !sdi->driver || !sdi->driver->config_list) + return FALSE; + + if (sdi->driver->config_list(SR_CONF_DEVICE_OPTIONS, &gvar, NULL) != SR_OK) + return FALSE; + + ret = FALSE; + devopts = g_variant_get_fixed_array(gvar, &num_opts, sizeof(int32_t)); + for (i = 0; i < num_opts; i++) { + if (devopts[i] == key) { + ret = TRUE; + break; + } + } + g_variant_unref(gvar); + + return ret; +} + +/** @private */ +SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int mode, int index, int status, + const char *vendor, const char *model, const char *version) +{ + struct sr_dev_inst *sdi; + + if (!(sdi = g_try_malloc(sizeof(struct sr_dev_inst)))) { + sr_err("Device instance malloc failed."); + return NULL; + } + + sdi->driver = NULL; + sdi->mode = mode; + sdi->index = index; + sdi->status = status; + sdi->inst_type = -1; + sdi->vendor = vendor ? g_strdup(vendor) : NULL; + sdi->model = model ? g_strdup(model) : NULL; + sdi->version = version ? g_strdup(version) : NULL; + sdi->probes = NULL; + sdi->conn = NULL; + sdi->priv = NULL; + + return sdi; +} + +/** @private */ +SR_PRIV void sr_dev_probes_free(struct sr_dev_inst *sdi) +{ + struct sr_probe *probe; + GSList *l; + + for (l = sdi->probes; l; l = l->next) { + probe = l->data; + g_free(probe->name); + g_free(probe); + } + + sdi->probes = NULL; +} + +SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi) +{ + struct sr_probe *probe; + GSList *l; + + for (l = sdi->probes; l; l = l->next) { + probe = l->data; + g_free(probe->name); + g_free(probe); + } + + g_free(sdi->priv); + g_free(sdi->vendor); + g_free(sdi->model); + g_free(sdi->version); + g_free(sdi); +} + +#ifdef HAVE_LIBUSB_1_0 + +/** @private */ +SR_PRIV struct sr_usb_dev_inst *sr_usb_dev_inst_new(uint8_t bus, + uint8_t address, struct libusb_device_handle *hdl) +{ + struct sr_usb_dev_inst *udi; + + if (!(udi = g_try_malloc(sizeof(struct sr_usb_dev_inst)))) { + sr_err("USB device instance malloc failed."); + return NULL; + } + + udi->bus = bus; + udi->address = address; + udi->devhdl = hdl; + + return udi; +} + +/** @private */ +SR_PRIV void sr_usb_dev_inst_free(struct sr_usb_dev_inst *usb) +{ + (void)usb; + + /* Nothing to do for this device instance type. */ +} + +#endif + +/** + * @private + * + * Both parameters are copied to newly allocated strings, and freed + * automatically by sr_serial_dev_inst_free(). + * + * @param pathname OS-specific serial port specification. Examples: + * "/dev/ttyUSB0", "/dev/ttyACM1", "/dev/tty.Modem-0", "COM1". + * @param serialcomm A serial communication parameters string, in the form + * of /, for example + * "9600/8n1" or "600/7o2". This is an optional parameter; + * it may be filled in later. + * + * @return A pointer to a newly initialized struct sr_serial_dev_inst, + * or NULL on error. + */ +SR_PRIV struct sr_serial_dev_inst *sr_serial_dev_inst_new(const char *port, + const char *serialcomm) +{ + struct sr_serial_dev_inst *serial; + + if (!port) { + sr_err("Serial port required."); + return NULL; + } + + if (!(serial = g_try_malloc0(sizeof(struct sr_serial_dev_inst)))) { + sr_err("Serial device instance malloc failed."); + return NULL; + } + + serial->port = g_strdup(port); + if (serialcomm) + serial->serialcomm = g_strdup(serialcomm); + serial->fd = -1; + + return serial; +} + +/** @private */ +SR_PRIV void sr_serial_dev_inst_free(struct sr_serial_dev_inst *serial) +{ + g_free(serial->port); + g_free(serial->serialcomm); + g_free(serial); +} + +SR_API GSList *sr_dev_list(const struct sr_dev_driver *driver) +{ + if (driver && driver->dev_list) + return driver->dev_list(); + else + return NULL; +} + +SR_API int sr_dev_clear(const struct sr_dev_driver *driver) +{ + if (driver && driver->dev_clear) + return driver->dev_clear(); + else + return SR_OK; +} + +SR_API int sr_dev_open(struct sr_dev_inst *sdi) +{ + int ret; + + if (!sdi || !sdi->driver || !sdi->driver->dev_open) + return SR_ERR; + + ret = sdi->driver->dev_open(sdi); + + return ret; +} + +SR_API int sr_dev_close(struct sr_dev_inst *sdi) +{ + int ret; + + if (!sdi || !sdi->driver || !sdi->driver->dev_close) + return SR_ERR; + + ret = sdi->driver->dev_close(sdi); + + return ret; +} + +/** @} */ diff --git a/libsigrok4DSLogic/error.c b/libsigrok4DSLogic/error.c new file mode 100644 index 00000000..d7d792d5 --- /dev/null +++ b/libsigrok4DSLogic/error.c @@ -0,0 +1,155 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2012 Uwe Hermann + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libsigrok.h" + +/** + * @file + * + * Error handling in libsigrok. + */ + +/** + * @defgroup grp_error Error handling + * + * Error handling in libsigrok. + * + * libsigrok functions usually return @ref SR_OK upon success, or a negative + * error code on failure. + * + * @{ + */ + +/** + * Return a human-readable error string for the given libsigrok error code. + * + * @param error_code A libsigrok error code number, such as SR_ERR_MALLOC. + * + * @return A const string containing a short, human-readable (English) + * description of the error, such as "memory allocation error". + * The string must NOT be free'd by the caller! + * + * @see sr_strerror_name + * + * @since 0.2.0 + */ +SR_API const char *sr_strerror(int error_code) +{ + const char *str; + + /* + * Note: All defined SR_* error macros from libsigrok.h must have + * an entry in this function, as well as in sr_strerror_name(). + */ + + switch (error_code) { + case SR_OK: + str = "no error"; + break; + case SR_ERR: + str = "generic/unspecified error"; + break; + case SR_ERR_MALLOC: + str = "memory allocation error"; + break; + case SR_ERR_ARG: + str = "invalid argument"; + break; + case SR_ERR_BUG: + str = "internal error"; + break; + case SR_ERR_SAMPLERATE: + str = "invalid samplerate"; + break; + case SR_ERR_NA: + str = "not applicable"; + break; + case SR_ERR_DEV_CLOSED: + str = "device closed but should be open"; + break; + default: + str = "unknown error"; + break; + } + + return str; +} + +/** + * Return the "name" string of the given libsigrok error code. + * + * For example, the "name" of the SR_ERR_MALLOC error code is "SR_ERR_MALLOC", + * the name of the SR_OK code is "SR_OK", and so on. + * + * This function can be used for various purposes where the "name" string of + * a libsigrok error code is useful. + * + * @param error_code A libsigrok error code number, such as SR_ERR_MALLOC. + * + * @return A const string containing the "name" of the error code as string. + * The string must NOT be free'd by the caller! + * + * @see sr_strerror + * + * @since 0.2.0 + */ +SR_API const char *sr_strerror_name(int error_code) +{ + const char *str; + + /* + * Note: All defined SR_* error macros from libsigrok.h must have + * an entry in this function, as well as in sr_strerror(). + */ + + switch (error_code) { + case SR_OK: + str = "SR_OK"; + break; + case SR_ERR: + str = "SR_ERR"; + break; + case SR_ERR_MALLOC: + str = "SR_ERR_MALLOC"; + break; + case SR_ERR_ARG: + str = "SR_ERR_ARG"; + break; + case SR_ERR_BUG: + str = "SR_ERR_BUG"; + break; + case SR_ERR_SAMPLERATE: + str = "SR_ERR_SAMPLERATE"; + break; + case SR_ERR_NA: + str = "SR_ERR_NA"; + break; + case SR_ERR_DEV_CLOSED: + str = "SR_ERR_DEV_CLOSED"; + break; + default: + str = "unknown error code"; + break; + } + + return str; +} + +/** @} */ diff --git a/libsigrok4DSLogic/filter.c b/libsigrok4DSLogic/filter.c new file mode 100644 index 00000000..11cad5c3 --- /dev/null +++ b/libsigrok4DSLogic/filter.c @@ -0,0 +1,170 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2010-2012 Bert Vermeulen + * + * 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 . + */ + +#include +#include +#include +#include +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "filter: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +/** + * @file + * + * Helper functions to filter out unused probes from samples. + */ + +/** + * @defgroup grp_filter Probe filter + * + * Helper functions to filter out unused probes from samples. + * + * @{ + */ + +/** + * Remove unused probes from samples. + * + * Convert sample from maximum probes -- the way the hardware driver sent + * it -- to a sample taking up only as much space as required, with + * unused probes removed. + * + * The "unit size" is the number of bytes used to store probe values. + * For example, a unit size of 1 means one byte is used (which can store + * 8 probe values, each of them is 1 bit). A unit size of 2 means we can + * store 16 probe values, 3 means we can store 24 probe values, and so on. + * + * If the data coming from the logic analyzer has a unit size of 4 for + * example (as the device has 32 probes), but only 2 of them are actually + * used in an acquisition, this function can convert the samples to only + * use up 1 byte per sample (unit size = 1) instead of 4 bytes per sample. + * + * The output will contain the probe values in the order specified via the + * probelist. For example, if in_unitsize = 4, probelist = [5, 16, 30], and + * out_unitsize = 1, then the output samples (each of them one byte in size) + * will have the following format: bit 0 = value of probe 5, bit 1 = value + * of probe 16, bit 2 = value of probe 30. Unused bit(s) in the output byte(s) + * are zero. + * + * The caller must make sure that length_in is not bigger than the memory + * actually allocated for the input data (data_in), as this function does + * not check that. + * + * @param in_unitsize The unit size (>= 1) of the input (data_in). + * @param out_unitsize The unit size (>= 1) the output shall have (data_out). + * The requested unit size must be big enough to hold as + * much data as is specified by the number of enabled + * probes in 'probelist'. + * @param probe_array Pointer to a list of probe numbers, numbered starting + * from 0. The list is terminated with -1. + * @param data_in Pointer to the input data buffer. Must not be NULL. + * @param length_in The input data length (>= 1), in number of bytes. + * @param data_out Variable which will point to the newly allocated buffer + * of output data. The caller is responsible for g_free()'ing + * the buffer when it's no longer needed. Must not be NULL. + * @param length_out Pointer to the variable which will contain the output + * data length (in number of bytes) when the function + * returns SR_OK. Must not be NULL. + * + * @return SR_OK upon success, SR_ERR_MALLOC upon memory allocation errors, + * or SR_ERR_ARG upon invalid arguments. + * If something other than SR_OK is returned, the values of + * out_unitsize, data_out, and length_out are undefined. + * + * @since 0.1.0 (but the API changed in 0.2.0) + */ +SR_API int sr_filter_probes(unsigned int in_unitsize, unsigned int out_unitsize, + const GArray *probe_array, const uint8_t *data_in, + uint64_t length_in, uint8_t **data_out, + uint64_t *length_out) +{ + unsigned int in_offset, out_offset; + int *probelist, out_bit; + unsigned int i; + uint64_t sample_in, sample_out; + + if (!probe_array) { + sr_err("%s: probe_array was NULL", __func__); + return SR_ERR_ARG; + } + probelist = (int *)probe_array->data; + + if (!data_in) { + sr_err("%s: data_in was NULL", __func__); + return SR_ERR_ARG; + } + + if (!data_out) { + sr_err("%s: data_out was NULL", __func__); + return SR_ERR_ARG; + } + + if (!length_out) { + sr_err("%s: length_out was NULL", __func__); + return SR_ERR_ARG; + } + + /* Are there more probes than the target unit size supports? */ + if (probe_array->len > out_unitsize * 8) { + sr_err("%s: too many probes (%d) for the target unit " + "size (%d)", __func__, probe_array->len, out_unitsize); + return SR_ERR_ARG; + } + + if (!(*data_out = g_try_malloc(length_in))) { + sr_err("%s: data_out malloc failed", __func__); + return SR_ERR_MALLOC; + } + + if (probe_array->len == in_unitsize * 8) { + /* All probes are used -- no need to compress anything. */ + memcpy(*data_out, data_in, length_in); + *length_out = length_in; + return SR_OK; + } + + /* If we reached this point, not all probes are used, so "compress". */ + in_offset = out_offset = 0; + while (in_offset <= length_in - in_unitsize) { + memcpy(&sample_in, data_in + in_offset, in_unitsize); + sample_out = out_bit = 0; + for (i = 0; i < probe_array->len; i++) { + if (sample_in & (1 << (probelist[i]))) + sample_out |= (1 << out_bit); + out_bit++; + } + memcpy((*data_out) + out_offset, &sample_out, out_unitsize); + in_offset += in_unitsize; + out_offset += out_unitsize; + } + *length_out = out_offset; + + return SR_OK; +} + +/** @} */ diff --git a/libsigrok4DSLogic/hardware/Makefile.am b/libsigrok4DSLogic/hardware/Makefile.am new file mode 100644 index 00000000..4f5d0a7b --- /dev/null +++ b/libsigrok4DSLogic/hardware/Makefile.am @@ -0,0 +1,32 @@ +## +## This file is part of the libsigrok project. +## +## Copyright (C) 2011 Uwe Hermann +## Copyright (C) 2012 Alexandru Gagniuc +## +## 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 . +## + +SUBDIRS = \ + demo + +noinst_LTLIBRARIES = libsigrok4DSLogichardware.la + +libsigrok4DSLogichardware_la_SOURCES = + +libsigrok4DSLogichardware_la_LIBADD = + +if HW_DEMO +libsigrok4DSLogichardware_la_LIBADD += demo/libsigrok4DSLogic_hw_demo.la +endif diff --git a/libsigrok4DSLogic/hardware/demo/Makefile.am b/libsigrok4DSLogic/hardware/demo/Makefile.am new file mode 100644 index 00000000..9bb85dd7 --- /dev/null +++ b/libsigrok4DSLogic/hardware/demo/Makefile.am @@ -0,0 +1,32 @@ +## +## This file is part of the libsigrok project. +## +## Copyright (C) 2011 Uwe Hermann +## +## 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 . +## + +if HW_DEMO + +# Local lib, this is NOT meant to be installed! +noinst_LTLIBRARIES = libsigrok4DSLogic_hw_demo.la + +libsigrok4DSLogic_hw_demo_la_SOURCES = \ + demo.c + +libsigrok4DSLogic_hw_demo_la_CFLAGS = \ + -I$(top_srcdir) + +endif + diff --git a/libsigrok4DSLogic/hardware/demo/demo.c b/libsigrok4DSLogic/hardware/demo/demo.c new file mode 100644 index 00000000..67df85e4 --- /dev/null +++ b/libsigrok4DSLogic/hardware/demo/demo.c @@ -0,0 +1,705 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2010 Uwe Hermann + * Copyright (C) 2011 Olivier Fauchon + * Copyright (C) 2012 Alexandru Gagniuc + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include +#ifdef _WIN32 +#include +#include +#define pipe(fds) _pipe(fds, 4096, _O_BINARY) +#endif +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "demo: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +/* TODO: Number of probes should be configurable. */ +#define NUM_PROBES 16 + +#define DEMONAME "Demo device" + +/* The size of chunks to send through the session bus. */ +/* TODO: Should be configurable. */ +#define BUFSIZE 1024*1024 + +#define PERIOD 4000 + +#define PI 3.14159265 + +#define CONST_LEN 50 + +/* Supported patterns which we can generate */ +enum { + PATTERN_SINE = 0, + PATTERN_SQUARE = 1, + PATTERN_TRIANGLE = 2, + PATTERN_SAWTOOTH = 3, + PATTERN_RANDOM = 4, +}; +static const char *pattern_strings[] = { + "Sine", + "Square", + "Triangle", + "Sawtooth", + "Random", +}; + +/* Private, per-device-instance driver context. */ +struct dev_context { + struct sr_dev_inst *sdi; + int pipe_fds[2]; + GIOChannel *channel; + uint64_t cur_samplerate; + uint64_t limit_samples; + uint64_t limit_msec; + uint8_t sample_generator; + uint64_t samples_counter; + void *cb_data; + int64_t starttime; + int stop; + + int trigger_stage; + uint16_t trigger_mask; + uint16_t trigger_value; + uint16_t trigger_edge; +}; + +static const int hwcaps[] = { + SR_CONF_LOGIC_ANALYZER, + SR_CONF_DEMO_DEV, + SR_CONF_SAMPLERATE, + SR_CONF_PATTERN_MODE, + SR_CONF_LIMIT_SAMPLES, + SR_CONF_LIMIT_MSEC, + SR_CONF_CONTINUOUS, +}; + +static const int hwoptions[] = { + SR_CONF_PATTERN_MODE, +}; + +static const uint64_t samplerates[] = { + SR_KHZ(10), + SR_KHZ(20), + SR_KHZ(50), + SR_KHZ(100), + SR_KHZ(200), + SR_KHZ(500), + SR_MHZ(1), + SR_MHZ(2), + SR_MHZ(5), + SR_MHZ(10), + SR_MHZ(20), + SR_MHZ(50), + SR_MHZ(100), + SR_MHZ(200), +}; + + + +/* We name the probes 0-7 on our demo driver. */ +static const char *probe_names[NUM_PROBES + 1] = { + "Channel 0", "Channel 1", "Channel 2", "Channel 3", + "Channel 4", "Channel 5", "Channel 6", "Channel 7", + "Channel 8", "Channel 9", "Channel 10", "Channel 11", + "Channel 12", "Channel 13", "Channel 14", "Channel 15", + NULL, +}; + +/* Private, per-device-instance driver context. */ +/* TODO: struct context as with the other drivers. */ + +/* List of struct sr_dev_inst, maintained by dev_open()/dev_close(). */ +SR_PRIV struct sr_dev_driver demo_driver_info; +static struct sr_dev_driver *di = &demo_driver_info; + +extern struct ds_trigger *trigger; + +static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data); + +static int clear_instances(void) +{ + /* Nothing needed so far. */ + + return SR_OK; +} + +static int hw_init(struct sr_context *sr_ctx) +{ + return std_hw_init(sr_ctx, di, LOG_PREFIX); +} + +static GSList *hw_scan(GSList *options) +{ + struct sr_dev_inst *sdi; + struct sr_probe *probe; + struct drv_context *drvc; + struct dev_context *devc; + GSList *devices; + int i; + + (void)options; + + drvc = di->priv; + + devices = NULL; + + sdi = sr_dev_inst_new(LOGIC, 0, SR_ST_ACTIVE, DEMONAME, NULL, NULL); + if (!sdi) { + sr_err("Device instance creation failed."); + return NULL; + } + sdi->driver = di; + + devices = g_slist_append(devices, sdi); + drvc->instances = g_slist_append(drvc->instances, sdi); + + if (!(devc = g_try_malloc(sizeof(struct dev_context)))) { + sr_err("Device context malloc failed."); + return NULL; + } + + devc->sdi = sdi; + devc->cur_samplerate = SR_MHZ(200); + devc->limit_samples = 0; + devc->limit_msec = 0; + devc->sample_generator = PATTERN_SINE; + + sdi->priv = devc; + + if (sdi->mode == LOGIC) { + for (i = 0; probe_names[i]; i++) { + if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE, + probe_names[i]))) + return NULL; + sdi->probes = g_slist_append(sdi->probes, probe); + } + } else if (sdi->mode == ANALOG) { + for (i = 0; i < DS_MAX_ANALOG_PROBES_NUM; i++) { + if (!(probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE, + probe_names[i]))) + return NULL; + sdi->probes = g_slist_append(sdi->probes, probe); + } + } + + return devices; +} + +static GSList *hw_dev_list(void) +{ + return ((struct drv_context *)(di->priv))->instances; +} + +static int hw_dev_open(struct sr_dev_inst *sdi) +{ + (void)sdi; + + sdi->status = SR_ST_ACTIVE; + + return SR_OK; +} + +static int hw_dev_close(struct sr_dev_inst *sdi) +{ + (void)sdi; + + sdi->status = SR_ST_INACTIVE; + + return SR_OK; +} + +static int hw_cleanup(void) +{ + GSList *l; + struct sr_dev_inst *sdi; + struct drv_context *drvc; + int ret = SR_OK; + + if (!(drvc = di->priv)) + return SR_OK; + + /* Properly close and free all devices. */ + for (l = drvc->instances; l; l = l->next) { + if (!(sdi = l->data)) { + /* Log error, but continue cleaning up the rest. */ + sr_err("%s: sdi was NULL, continuing", __func__); + ret = SR_ERR_BUG; + continue; + } + sr_dev_inst_free(sdi); + } + g_slist_free(drvc->instances); + drvc->instances = NULL; + + return ret; +} + +static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi) +{ + struct dev_context *const devc = sdi->priv; + + switch (id) { + case SR_CONF_SAMPLERATE: + *data = g_variant_new_uint64(devc->cur_samplerate); + break; + case SR_CONF_LIMIT_SAMPLES: + *data = g_variant_new_uint64(devc->limit_samples); + break; + case SR_CONF_LIMIT_MSEC: + *data = g_variant_new_uint64(devc->limit_msec); + break; + case SR_CONF_DEVICE_MODE: + *data = g_variant_new_string(mode_strings[sdi->mode]); + break; + case SR_CONF_PATTERN_MODE: + *data = g_variant_new_string(pattern_strings[devc->sample_generator]); + break; + default: + return SR_ERR_NA; + } + + return SR_OK; +} + +static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi) +{ + int i, ret; + const char *stropt; + struct sr_probe *probe; + + struct dev_context *const devc = sdi->priv; + + if (sdi->status != SR_ST_ACTIVE) + return SR_ERR_DEV_CLOSED; + + if (id == SR_CONF_SAMPLERATE) { + devc->cur_samplerate = g_variant_get_uint64(data); + sr_dbg("%s: setting samplerate to %" PRIu64, __func__, + devc->cur_samplerate); + ret = SR_OK; + } else if (id == SR_CONF_LIMIT_SAMPLES) { + devc->limit_msec = 0; + devc->limit_samples = g_variant_get_uint64(data); + sr_dbg("%s: setting limit_samples to %" PRIu64, __func__, + devc->limit_samples); + ret = SR_OK; + } else if (id == SR_CONF_LIMIT_MSEC) { + devc->limit_msec = g_variant_get_uint64(data); + devc->limit_samples = 0; + sr_dbg("%s: setting limit_msec to %" PRIu64, __func__, + devc->limit_msec); + ret = SR_OK; + } else if (id == SR_CONF_DEVICE_MODE) { + stropt = g_variant_get_string(data, NULL); + ret = SR_OK; + if (!strcmp(stropt, mode_strings[LOGIC])) { + sdi->mode = LOGIC; + sr_dev_probes_free(sdi); + for (i = 0; probe_names[i]; i++) { + if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE, + probe_names[i]))) + ret = SR_ERR; + else + sdi->probes = g_slist_append(sdi->probes, probe); + } + } else if (!strcmp(stropt, mode_strings[ANALOG])) { + sdi->mode = ANALOG; + sr_dev_probes_free(sdi); + for (i = 0; i < DS_MAX_ANALOG_PROBES_NUM; i++) { + if (!(probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE, + probe_names[i]))) + ret = SR_ERR; + else + sdi->probes = g_slist_append(sdi->probes, probe); + } + } else { + ret = SR_ERR; + } + sr_dbg("%s: setting mode to %d", __func__, sdi->mode); + }else if (id == SR_CONF_PATTERN_MODE) { + stropt = g_variant_get_string(data, NULL); + ret = SR_OK; + if (!strcmp(stropt, pattern_strings[PATTERN_SINE])) { + devc->sample_generator = PATTERN_SINE; + } else if (!strcmp(stropt, pattern_strings[PATTERN_SQUARE])) { + devc->sample_generator = PATTERN_SQUARE; + } else if (!strcmp(stropt, pattern_strings[PATTERN_TRIANGLE])) { + devc->sample_generator = PATTERN_TRIANGLE; + } else if (!strcmp(stropt, pattern_strings[PATTERN_SAWTOOTH])) { + devc->sample_generator = PATTERN_SAWTOOTH; + } else if (!strcmp(stropt, pattern_strings[PATTERN_RANDOM])) { + devc->sample_generator = PATTERN_RANDOM; + } else { + ret = SR_ERR; + } + sr_dbg("%s: setting pattern to %d", + __func__, devc->sample_generator); + } else { + ret = SR_ERR_NA; + } + + return ret; +} + +static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi) +{ + GVariant *gvar; + GVariantBuilder gvb; + + (void)sdi; + + switch (key) { + case SR_CONF_DEVICE_OPTIONS: +// *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, +// hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_from_data(G_VARIANT_TYPE("ai"), + hwcaps, ARRAY_SIZE(hwcaps)*sizeof(int32_t), TRUE, NULL, NULL); + break; + case SR_CONF_DEVICE_CONFIGS: +// *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, +// hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_from_data(G_VARIANT_TYPE("ai"), + hwoptions, ARRAY_SIZE(hwoptions)*sizeof(int32_t), TRUE, NULL, NULL); + break; + case SR_CONF_SAMPLERATE: + g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}")); +// gvar = g_variant_new_fixed_array(G_VARIANT_TYPE("t"), samplerates, +// ARRAY_SIZE(samplerates), sizeof(uint64_t)); + gvar = g_variant_new_from_data(G_VARIANT_TYPE("at"), + samplerates, ARRAY_SIZE(samplerates)*sizeof(uint64_t), TRUE, NULL, NULL); + g_variant_builder_add(&gvb, "{sv}", "samplerates", gvar); + *data = g_variant_builder_end(&gvb); + break; + case SR_CONF_DEVICE_MODE: + *data = g_variant_new_strv(mode_strings, ARRAY_SIZE(mode_strings)); + break; + case SR_CONF_PATTERN_MODE: + *data = g_variant_new_strv(pattern_strings, ARRAY_SIZE(pattern_strings)); + break; + default: + return SR_ERR_NA; + } + + return SR_OK; +} + +static void samples_generator(uint16_t *buf, uint64_t size, + struct dev_context *devc) +{ + static uint16_t p = 0; + uint64_t i; + uint16_t demo_data; + + switch (devc->sample_generator) { + case PATTERN_SINE: /* Sine */ + for (i = 0; i < size; i++) { + if (i%CONST_LEN == 0) { + demo_data = 0x8000 * sin(2 * PI * p / 0xffff) + 0x8000; + p += CONST_LEN; + } + *(buf + i) = demo_data; + } + break; + case PATTERN_SQUARE: + for (i = 0; i < size; i++) { + if (i%CONST_LEN == 0) { + demo_data = p > 0x7fff ? 0xf000 : 0x1000; + p += CONST_LEN; + } + *(buf + i) = demo_data; + } + break; + case PATTERN_TRIANGLE: + for (i = 0; i < size; i++) { + if (i%CONST_LEN == 0) { + demo_data = p > 0x7fff ? 0xffff * (2.0f * (0x10000 - p) / 0x10000) : + 0xffff * (2.0f * p / 0x10000); + p += CONST_LEN; + } + *(buf + i) = demo_data; + } + break; + case PATTERN_SAWTOOTH: + for (i = 0; i < size; i++) { + if (i%CONST_LEN == 0) { + demo_data = p; + p += CONST_LEN; + } + *(buf + i) = demo_data; + } + break; + case PATTERN_RANDOM: /* Random */ + for (i = 0; i < size; i++) { + if (i%CONST_LEN == 0) + demo_data = (uint16_t)(rand() * (0x10000 * 1.0f / RAND_MAX)); + *(buf + i) = demo_data; + } + break; + default: + sr_err("Unknown pattern: %d.", devc->sample_generator); + break; + } +} + +/* Callback handling data */ +static int receive_data(int fd, int revents, const struct sr_dev_inst *sdi) +{ + struct dev_context *devc = sdi->priv; + struct sr_datafeed_packet packet; + struct sr_datafeed_logic logic; + struct sr_datafeed_analog analog; + //uint16_t buf[BUFSIZE]; + uint16_t *buf; + static uint64_t samples_to_send, expected_samplenum, sending_now; + int64_t time, elapsed; + static uint16_t last_sample = 0; + uint16_t cur_sample; + int i; + + (void)fd; + (void)revents; + + if (!(buf = g_try_malloc(BUFSIZE*sizeof(uint16_t)))) { + sr_err("buf for receive_data malloc failed."); + return FALSE; + } + + /* How many "virtual" samples should we have collected by now? */ + time = g_get_monotonic_time(); + elapsed = time - devc->starttime; + devc->starttime = time; + expected_samplenum = elapsed * devc->cur_samplerate / 1000000; + /* Of those, how many do we still have to send? */ + //samples_to_send = (expected_samplenum - devc->samples_counter) / CONST_LEN * CONST_LEN; + samples_to_send = expected_samplenum / CONST_LEN * CONST_LEN; + + if (devc->limit_samples) { + if (sdi->mode == LOGIC) + samples_to_send = MIN(samples_to_send, + devc->limit_samples - devc->samples_counter); + else if (sdi->mode == ANALOG) + samples_to_send = MIN(samples_to_send, + devc->limit_samples); + } + + while (samples_to_send > 0) { + sending_now = MIN(samples_to_send, BUFSIZE); + samples_generator(buf, sending_now, devc); + + if (devc->trigger_stage != 0) { + for (i = 0; i < sending_now; i++) { + if (devc->trigger_edge == 0) { + if ((*(buf + i) | devc->trigger_mask) == + (devc->trigger_value | devc->trigger_mask)) { + devc->trigger_stage = 0; + break; + } + } else { + cur_sample = *(buf + i); + if (((last_sample & devc->trigger_edge) == + (~devc->trigger_value & devc->trigger_edge)) && + ((cur_sample | devc->trigger_mask) == + (devc->trigger_value | devc->trigger_mask)) && + ((cur_sample & devc->trigger_edge) == + (devc->trigger_value & devc->trigger_edge))) { + devc->trigger_stage = 0; + break; + } + last_sample = cur_sample; + } + } + if (devc->trigger_stage == 0) { + struct ds_trigger_pos demo_trigger_pos; + demo_trigger_pos.real_pos = i; + packet.type = SR_DF_TRIGGER; + packet.payload = &demo_trigger_pos; + sr_session_send(sdi, &packet); + } + } + + if (devc->trigger_stage == 0){ + samples_to_send -= sending_now; + if (sdi->mode == LOGIC) { + packet.type = SR_DF_LOGIC; + packet.payload = &logic; + logic.length = sending_now * (NUM_PROBES >> 3); + logic.unitsize = (NUM_PROBES >> 3); + logic.data = buf; + } else if (sdi->mode == ANALOG) { + packet.type = SR_DF_ANALOG; + packet.payload = &analog; + analog.probes = sdi->probes; + analog.num_samples = sending_now; + analog.mq = SR_MQ_VOLTAGE; + analog.unit = SR_UNIT_VOLT; + analog.mqflags = SR_MQFLAG_AC; + analog.data = buf; + } + + sr_session_send(sdi, &packet); + if (sdi->mode == LOGIC) + devc->samples_counter += sending_now; + else if (sdi->mode == ANALOG) + devc->samples_counter = (devc->samples_counter + sending_now) % devc->limit_samples; + } else { + break; + } + } + + if (sdi->mode == LOGIC && + devc->limit_samples && + devc->samples_counter >= devc->limit_samples) { + sr_info("Requested number of samples reached."); + hw_dev_acquisition_stop(sdi, NULL); + g_free(buf); + return TRUE; + } + + g_free(buf); + + return TRUE; +} + +static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, + void *cb_data) +{ + struct dev_context *const devc = sdi->priv; + + (void)cb_data; + + if (sdi->status != SR_ST_ACTIVE) + return SR_ERR_DEV_CLOSED; + + //devc->cb_data = cb_data; + devc->samples_counter = 0; + devc->stop = FALSE; + + /* + * trigger setting + */ + if (!trigger->trigger_en || sdi->mode == ANALOG) { + devc->trigger_stage = 0; + } else { + devc->trigger_mask = ds_trigger_get_mask0(TriggerStages); + devc->trigger_value = ds_trigger_get_value0(TriggerStages); + devc->trigger_edge = ds_trigger_get_edge0(TriggerStages); + if (devc->trigger_edge != 0) + devc->trigger_stage = 2; + else + devc->trigger_stage = 1; + } + + /* + * Setting two channels connected by a pipe is a remnant from when the + * demo driver generated data in a thread, and collected and sent the + * data in the main program loop. + * They are kept here because it provides a convenient way of setting + * up a timeout-based polling mechanism. + */ + if (pipe(devc->pipe_fds)) { + /* TODO: Better error message. */ + sr_err("%s: pipe() failed", __func__); + return SR_ERR; + } + + devc->channel = g_io_channel_unix_new(devc->pipe_fds[0]); + + g_io_channel_set_flags(devc->channel, G_IO_FLAG_NONBLOCK, NULL); + + /* Set channel encoding to binary (default is UTF-8). */ + g_io_channel_set_encoding(devc->channel, NULL, NULL); + + /* Make channels to unbuffered. */ + g_io_channel_set_buffered(devc->channel, FALSE); + + sr_session_source_add_channel(devc->channel, G_IO_IN | G_IO_ERR, + 100, receive_data, sdi); + + /* Send header packet to the session bus. */ + //std_session_send_df_header(cb_data, LOG_PREFIX); + std_session_send_df_header(sdi, LOG_PREFIX); + + /* We use this timestamp to decide how many more samples to send. */ + devc->starttime = g_get_monotonic_time(); + + return SR_OK; +} + +static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) +{ + struct dev_context *const devc = sdi->priv; + struct sr_datafeed_packet packet; + + (void)cb_data; + + sr_dbg("Stopping aquisition."); + + devc->stop = TRUE; + sr_session_source_remove_channel(devc->channel); + g_io_channel_shutdown(devc->channel, FALSE, NULL); + g_io_channel_unref(devc->channel); + devc->channel = NULL; + + /* Send last packet. */ + packet.type = SR_DF_END; + sr_session_send(sdi, &packet); + + return SR_OK; +} + +static int hw_dev_test(struct sr_dev_inst *sdi) +{ + if (sdi) + return SR_OK; + else + return SR_ERR; +} + +SR_PRIV struct sr_dev_driver demo_driver_info = { + .name = "demo", + .longname = "Demo driver and pattern generator", + .api_version = 1, + .init = hw_init, + .cleanup = hw_cleanup, + .scan = hw_scan, + .dev_list = hw_dev_list, + .dev_clear = clear_instances, + .config_get = config_get, + .config_set = config_set, + .config_list = config_list, + .dev_open = hw_dev_open, + .dev_close = hw_dev_close, + .dev_test = hw_dev_test, + .dev_acquisition_start = hw_dev_acquisition_start, + .dev_acquisition_stop = hw_dev_acquisition_stop, + .priv = NULL, +}; diff --git a/libsigrok4DSLogic/hwdriver.c b/libsigrok4DSLogic/hwdriver.c new file mode 100644 index 00000000..d362f13b --- /dev/null +++ b/libsigrok4DSLogic/hwdriver.c @@ -0,0 +1,403 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2013 Bert Vermeulen + * + * 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 . + */ + +#include +#include +#include +#include +#include +#include +#include "config.h" /* Needed for HAVE_LIBUSB_1_0 and others. */ +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "hwdriver: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +/** + * @file + * + * Hardware driver handling in libsigrok. + */ + +/** + * @defgroup grp_driver Hardware drivers + * + * Hardware driver handling in libsigrok. + * + * @{ + */ + +static struct sr_config_info sr_config_info_data[] = { + {SR_CONF_CONN, SR_T_CHAR, "conn", + "Connection", NULL}, + {SR_CONF_SERIALCOMM, SR_T_CHAR, "serialcomm", + "Serial communication", NULL}, + {SR_CONF_SAMPLERATE, SR_T_UINT64, "samplerate", + "Sample rate", NULL}, + {SR_CONF_CLOCK_TYPE, SR_T_BOOL, "clocktype", + "Using External Clock", NULL}, + {SR_CONF_CAPTURE_RATIO, SR_T_UINT64, "captureratio", + "Pre-trigger capture ratio", NULL}, + {SR_CONF_DEVICE_MODE, SR_T_CHAR, "device", + "Device Mode", NULL}, + {SR_CONF_PATTERN_MODE, SR_T_CHAR, "pattern", + "Pattern mode", NULL}, + {SR_CONF_TRIGGER_TYPE, SR_T_CHAR, "triggertype", + "Trigger types", NULL}, + {SR_CONF_RLE, SR_T_BOOL, "rle", + "Run Length Encoding", NULL}, + {SR_CONF_TRIGGER_SLOPE, SR_T_UINT64, "triggerslope", + "Trigger slope", NULL}, + {SR_CONF_TRIGGER_SOURCE, SR_T_CHAR, "triggersource", + "Trigger source", NULL}, + {SR_CONF_HORIZ_TRIGGERPOS, SR_T_FLOAT, "horiz_triggerpos", + "Horizontal trigger position", NULL}, + {SR_CONF_BUFFERSIZE, SR_T_UINT64, "buffersize", + "Buffer size", NULL}, + {SR_CONF_TIMEBASE, SR_T_RATIONAL_PERIOD, "timebase", + "Time base", NULL}, + {SR_CONF_FILTER, SR_T_CHAR, "filter", + "Filter targets", NULL}, + {SR_CONF_VDIV, SR_T_RATIONAL_VOLT, "vdiv", + "Volts/div", NULL}, + {SR_CONF_COUPLING, SR_T_CHAR, "coupling", + "Coupling", NULL}, + {SR_CONF_DATALOG, SR_T_BOOL, "datalog", + "Datalog", NULL}, + {0, 0, NULL, NULL, NULL}, +}; + +/** @cond PRIVATE */ +#ifdef HAVE_LA_DEMO +extern SR_PRIV struct sr_dev_driver demo_driver_info; +#endif +#ifdef HAVE_LA_DSLOGIC +extern SR_PRIV struct sr_dev_driver DSLogic_driver_info; +#endif +/** @endcond */ + +static struct sr_dev_driver *drivers_list[] = { +#ifdef HAVE_LA_DEMO + &demo_driver_info, +#endif +#ifdef HAVE_LA_DSLOGIC + &DSLogic_driver_info, +#endif + NULL, +}; + +/** + * Return the list of supported hardware drivers. + * + * @return Pointer to the NULL-terminated list of hardware driver pointers. + */ +SR_API struct sr_dev_driver **sr_driver_list(void) +{ + + return drivers_list; +} + +/** + * Initialize a hardware driver. + * + * This usually involves memory allocations and variable initializations + * within the driver, but _not_ scanning for attached devices. + * The API call sr_driver_scan() is used for that. + * + * @param ctx A libsigrok context object allocated by a previous call to + * sr_init(). Must not be NULL. + * @param driver The driver to initialize. This must be a pointer to one of + * the entries returned by sr_driver_list(). Must not be NULL. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid parameters, + * SR_ERR_BUG upon internal errors, or another negative error code + * upon other errors. + */ +SR_API int sr_driver_init(struct sr_context *ctx, struct sr_dev_driver *driver) +{ + int ret; + + if (!ctx) { + sr_err("Invalid libsigrok context, can't initialize."); + return SR_ERR_ARG; + } + + if (!driver) { + sr_err("Invalid driver, can't initialize."); + return SR_ERR_ARG; + } + + sr_spew("Initializing driver '%s'.", driver->name); + if ((ret = driver->init(ctx)) < 0) + sr_err("Failed to initialize the driver: %d.", ret); + + return ret; +} + +/** + * Tell a hardware driver to scan for devices. + * + * In addition to the detection, the devices that are found are also + * initialized automatically. On some devices, this involves a firmware upload, + * or other such measures. + * + * The order in which the system is scanned for devices is not specified. The + * caller should not assume or rely on any specific order. + * + * Before calling sr_driver_scan(), the user must have previously initialized + * the driver by calling sr_driver_init(). + * + * @param driver The driver that should scan. This must be a pointer to one of + * the entries returned by sr_driver_list(). Must not be NULL. + * @param options A list of 'struct sr_hwopt' options to pass to the driver's + * scanner. Can be NULL/empty. + * + * @return A GSList * of 'struct sr_dev_inst', or NULL if no devices were + * found (or errors were encountered). This list must be freed by the + * caller using g_slist_free(), but without freeing the data pointed + * to in the list. + */ +SR_API GSList *sr_driver_scan(struct sr_dev_driver *driver, GSList *options) +{ + GSList *l; + + if (!driver) { + sr_err("Invalid driver, can't scan for devices."); + return NULL; + } + + if (!driver->priv) { + sr_err("Driver not initialized, can't scan for devices."); + return NULL; + } + + l = driver->scan(options); + + sr_spew("Scan of '%s' found %d devices.", driver->name, + g_slist_length(l)); + + return l; +} + +/** @private */ +SR_PRIV void sr_hw_cleanup_all(void) +{ + int i; + struct sr_dev_driver **drivers; + + drivers = sr_driver_list(); + for (i = 0; drivers[i]; i++) { + if (drivers[i]->cleanup) + drivers[i]->cleanup(); + } +} + +/** A floating reference can be passed in for data. */ +SR_PRIV struct sr_config *sr_config_new(int key, GVariant *data) +{ + struct sr_config *src; + + if (!(src = g_try_malloc(sizeof(struct sr_config)))) + return NULL; + src->key = key; + src->data = g_variant_ref_sink(data); + + return src; +} + +SR_PRIV void sr_config_free(struct sr_config *src) +{ + + if (!src || !src->data) { + sr_err("%s: invalid data!", __func__); + return; + } + + g_variant_unref(src->data); + g_free(src); + +} + +/** + * Returns information about the given driver or device instance. + * + * @param driver The sr_dev_driver struct to query. + * @param key The configuration key (SR_CONF_*). + * @param data Pointer to a GVariant where the value will be stored. Must + * not be NULL. The caller is given ownership of the GVariant + * and must thus decrease the refcount after use. However if + * this function returns an error code, the field should be + * considered unused, and should not be unreferenced. + * @param sdi (optional) If the key is specific to a device, this must + * contain a pointer to the struct sr_dev_inst to be checked. + * Otherwise it must be NULL. + * + * @return SR_OK upon success or SR_ERR in case of error. Note SR_ERR_ARG + * may be returned by the driver indicating it doesn't know that key, + * but this is not to be flagged as an error by the caller; merely + * as an indication that it's not applicable. + */ +SR_API int sr_config_get(const struct sr_dev_driver *driver, int key, + GVariant **data, const struct sr_dev_inst *sdi) +{ + int ret; + + if (!driver || !data) + return SR_ERR; + + if (!driver->config_get) + return SR_ERR_ARG; + + if ((ret = driver->config_get(key, data, sdi)) == SR_OK) { + /* Got a floating reference from the driver. Sink it here, + * caller will need to unref when done with it. */ + g_variant_ref_sink(*data); + } + + return ret; +} + +/** + * Set a configuration key in a device instance. + * + * @param sdi The device instance. + * @param key The configuration key (SR_CONF_*). + * @param data The new value for the key, as a GVariant with GVariantType + * appropriate to that key. A floating reference can be passed + * in; its refcount will be sunk and unreferenced after use. + * + * @return SR_OK upon success or SR_ERR in case of error. Note SR_ERR_ARG + * may be returned by the driver indicating it doesn't know that key, + * but this is not to be flagged as an error by the caller; merely + * as an indication that it's not applicable. + */ +SR_API int sr_config_set(const struct sr_dev_inst *sdi, int key, GVariant *data) +{ + int ret; + + g_variant_ref_sink(data); + + if (!sdi || !sdi->driver || !data) + ret = SR_ERR; + else if (!sdi->driver->config_set) + ret = SR_ERR_ARG; + else + ret = sdi->driver->config_set(key, data, sdi); + + g_variant_unref(data); + + return ret; +} + +/** + * List all possible values for a configuration key. + * + * @param driver The sr_dev_driver struct to query. + * @param key The configuration key (SR_CONF_*). + * @param data A pointer to a GVariant where the list will be stored. The + * caller is given ownership of the GVariant and must thus + * unref the GVariant after use. However if this function + * returns an error code, the field should be considered + * unused, and should not be unreferenced. + * @param sdi (optional) If the key is specific to a device, this must + * contain a pointer to the struct sr_dev_inst to be checked. + * + * @return SR_OK upon success or SR_ERR in case of error. Note SR_ERR_ARG + * may be returned by the driver indicating it doesn't know that key, + * but this is not to be flagged as an error by the caller; merely + * as an indication that it's not applicable. + */ +SR_API int sr_config_list(const struct sr_dev_driver *driver, int key, + GVariant **data, const struct sr_dev_inst *sdi) +{ + int ret; + + if (!driver || !data) + ret = SR_ERR; + else if (!driver->config_list) + ret = SR_ERR_ARG; + else if ((ret = driver->config_list(key, data, sdi)) == SR_OK) + g_variant_ref_sink(*data); + + return ret; +} + +/** + * Get information about a configuration key. + * + * @param key The configuration key. + * + * @return A pointer to a struct sr_config_info, or NULL if the key + * was not found. + */ +SR_API const struct sr_config_info *sr_config_info_get(int key) +{ + int i; + + for (i = 0; sr_config_info_data[i].key; i++) { + if (sr_config_info_data[i].key == key) + return &sr_config_info_data[i]; + } + + return NULL; +} + +/** + * Get information about an configuration key, by name. + * + * @param optname The configuration key. + * + * @return A pointer to a struct sr_config_info, or NULL if the key + * was not found. + */ +SR_API const struct sr_config_info *sr_config_info_name_get(const char *optname) +{ + int i; + + for (i = 0; sr_config_info_data[i].key; i++) { + if (!strcmp(sr_config_info_data[i].id, optname)) + return &sr_config_info_data[i]; + } + + return NULL; +} + +/* Unnecessary level of indirection follows. */ + +/** @private */ +SR_PRIV int sr_source_remove(int fd) +{ + return sr_session_source_remove(fd); +} + +/** @private */ +SR_PRIV int sr_source_add(int fd, int events, int timeout, + sr_receive_data_callback_t cb, void *cb_data) +{ + return sr_session_source_add(fd, events, timeout, cb, cb_data); +} + +/** @} */ diff --git a/libsigrok4DSLogic/input/Makefile.am b/libsigrok4DSLogic/input/Makefile.am new file mode 100644 index 00000000..f878db35 --- /dev/null +++ b/libsigrok4DSLogic/input/Makefile.am @@ -0,0 +1,32 @@ +## +## This file is part of the libsigrok project. +## +## Copyright (C) 2011 Uwe Hermann +## Copyright (C) 2013 Bert Vermeulen +## +## 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 . +## + +# Local lib, this is NOT meant to be installed! +noinst_LTLIBRARIES = libsigrok4DSLogicinput.la + +libsigrok4DSLogicinput_la_SOURCES = \ + in_binary.c \ + in_vcd.c \ + in_wav.c \ + input.c + +libsigrok4DSLogicinput_la_CFLAGS = \ + -I$(top_srcdir) + diff --git a/libsigrok4DSLogic/input/in_binary.c b/libsigrok4DSLogic/input/in_binary.c new file mode 100644 index 00000000..2d52c306 --- /dev/null +++ b/libsigrok4DSLogic/input/in_binary.c @@ -0,0 +1,158 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2013 Bert Vermeulen + * + * 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 . + */ + +#include +#include +#include +#include +#include +#include +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "input/binary: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +#define CHUNKSIZE (512 * 1024) +#define DEFAULT_NUM_PROBES 8 + +struct context { + uint64_t samplerate; +}; + +static int format_match(const char *filename) +{ + (void)filename; + + /* This module will handle anything you throw at it. */ + return TRUE; +} + +static int init(struct sr_input *in, const char *filename) +{ + struct sr_probe *probe; + int num_probes, i; + char name[SR_MAX_PROBENAME_LEN + 1]; + char *param; + struct context *ctx; + + (void)filename; + + if (!(ctx = g_try_malloc0(sizeof(*ctx)))) { + sr_err("Input format context malloc failed."); + return SR_ERR_MALLOC; + } + + num_probes = DEFAULT_NUM_PROBES; + ctx->samplerate = 0; + + if (in->param) { + param = g_hash_table_lookup(in->param, "numprobes"); + if (param) { + num_probes = strtoul(param, NULL, 10); + if (num_probes < 1) + return SR_ERR; + } + + param = g_hash_table_lookup(in->param, "samplerate"); + if (param) { + if (sr_parse_sizestring(param, &ctx->samplerate) != SR_OK) + return SR_ERR; + } + } + + /* Create a virtual device. */ + in->sdi = sr_dev_inst_new(LOGIC, 0, SR_ST_ACTIVE, NULL, NULL, NULL); + in->internal = ctx; + + for (i = 0; i < num_probes; i++) { + snprintf(name, SR_MAX_PROBENAME_LEN, "%d", i); + /* TODO: Check return value. */ + if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE, name))) + return SR_ERR; + in->sdi->probes = g_slist_append(in->sdi->probes, probe); + } + + return SR_OK; +} + +static int loadfile(struct sr_input *in, const char *filename) +{ + struct sr_datafeed_packet packet; + struct sr_datafeed_meta meta; + struct sr_datafeed_logic logic; + struct sr_config *src; + unsigned char buffer[CHUNKSIZE]; + int fd, size, num_probes; + struct context *ctx; + + ctx = in->internal; + + if ((fd = open(filename, O_RDONLY)) == -1) + return SR_ERR; + + num_probes = g_slist_length(in->sdi->probes); + + /* Send header packet to the session bus. */ + std_session_send_df_header(in->sdi, LOG_PREFIX); + + if (ctx->samplerate) { + packet.type = SR_DF_META; + packet.payload = &meta; + src = sr_config_new(SR_CONF_SAMPLERATE, + g_variant_new_uint64(ctx->samplerate)); + meta.config = g_slist_append(NULL, src); + sr_session_send(in->sdi, &packet); + sr_config_free(src); + } + + /* Chop up the input file into chunks & send it to the session bus. */ + packet.type = SR_DF_LOGIC; + packet.payload = &logic; + logic.unitsize = (num_probes + 7) / 8; + logic.data = buffer; + while ((size = read(fd, buffer, CHUNKSIZE)) > 0) { + logic.length = size; + sr_session_send(in->sdi, &packet); + } + close(fd); + + /* Send end packet to the session bus. */ + packet.type = SR_DF_END; + sr_session_send(in->sdi, &packet); + + g_free(ctx); + in->internal = NULL; + + return SR_OK; +} + +SR_PRIV struct sr_input_format input_binary = { + .id = "binary", + .description = "Raw binary", + .format_match = format_match, + .init = init, + .loadfile = loadfile, +}; diff --git a/libsigrok4DSLogic/input/in_vcd.c b/libsigrok4DSLogic/input/in_vcd.c new file mode 100644 index 00000000..a143b1cb --- /dev/null +++ b/libsigrok4DSLogic/input/in_vcd.c @@ -0,0 +1,609 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2012 Petteri Aimonen + * + * 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 . + */ + +/* The VCD input module has the following options: + * + * numprobes: Maximum number of probes to use. The probes are + * detected in the same order as they are listed + * in the $var sections of the VCD file. + * + * skip: Allows skipping until given timestamp in the file. + * This can speed up analyzing of long captures. + * + * Value < 0: Skip until first timestamp listed in + * the file. (default) + * + * Value = 0: Do not skip, instead generate samples + * beginning from timestamp 0. + * + * Value > 0: Start at the given timestamp. + * + * downsample: Divide the samplerate by the given factor. + * This can speed up analyzing of long captures. + * + * compress: Compress idle periods longer than this value. + * This can speed up analyzing of long captures. + * Default 0 = don't compress. + * + * Based on Verilog standard IEEE Std 1364-2001 Version C + * + * Supported features: + * - $var with 'wire' and 'reg' types of scalar variables + * - $timescale definition for samplerate + * - multiple character variable identifiers + * + * Most important unsupported features: + * - vector variables (bit vectors etc.) + * - analog, integer and real number variables + * - $dumpvars initial value declaration + * - $scope namespaces + */ + +/* */ + +#include +#include +#include +#include +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "input/vcd: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +#define DEFAULT_NUM_PROBES 8 + +/* Read until specific type of character occurs in file. + * Skip input if dest is NULL. + * Modes: + * 'W' read until whitespace + * 'N' read until non-whitespace, and ungetc() the character + * '$' read until $end + */ +static gboolean read_until(FILE *file, GString *dest, char mode) +{ + char prev[4] = ""; + long startpos = ftell(file); + for(;;) + { + int c = fgetc(file); + + if (c == EOF) + { + if (mode == '$') + sr_err("Unexpected EOF, read started at %ld.", startpos); + return FALSE; + } + + if (mode == 'W' && g_ascii_isspace(c)) + return TRUE; + + if (mode == 'N' && !g_ascii_isspace(c)) + { + ungetc(c, file); + return TRUE; + } + + if (mode == '$') + { + prev[0] = prev[1]; prev[1] = prev[2]; prev[2] = prev[3]; prev[3] = c; + if (prev[0] == '$' && prev[1] == 'e' && prev[2] == 'n' && prev[3] == 'd') + { + if (dest != NULL) + g_string_truncate(dest, dest->len - 3); + + return TRUE; + } + } + + if (dest != NULL) + g_string_append_c(dest, c); + } +} + +/* Reads a single VCD section from input file and parses it to structure. + * e.g. $timescale 1ps $end => "timescale" "1ps" + */ +static gboolean parse_section(FILE *file, gchar **name, gchar **contents) +{ + gboolean status; + GString *sname, *scontents; + + /* Skip any initial white-space */ + if (!read_until(file, NULL, 'N')) return FALSE; + + /* Section tag should start with $. */ + if (fgetc(file) != '$') + { + sr_err("Expected $ at beginning of section."); + return FALSE; + } + + /* Read the section tag */ + sname = g_string_sized_new(32); + status = read_until(file, sname, 'W'); + + /* Skip whitespace before content */ + status = status && read_until(file, NULL, 'N'); + + /* Read the content */ + scontents = g_string_sized_new(128); + status = status && read_until(file, scontents, '$'); + g_strchomp(scontents->str); + + /* Release strings if status is FALSE, return them if status is TRUE */ + *name = g_string_free(sname, !status); + *contents = g_string_free(scontents, !status); + return status; +} + +struct probe +{ + gchar *name; + gchar *identifier; +}; + +struct context +{ + uint64_t samplerate; + int maxprobes; + int probecount; + int downsample; + unsigned compress; + int64_t skip; + GSList *probes; +}; + +static void free_probe(void *data) +{ + struct probe *probe = data; + g_free(probe->name); + g_free(probe->identifier); + g_free(probe); +} + +static void release_context(struct context *ctx) +{ + g_slist_free_full(ctx->probes, free_probe); + g_free(ctx); +} + +/* Remove empty parts from an array returned by g_strsplit. */ +static void remove_empty_parts(gchar **parts) +{ + gchar **src = parts; + gchar **dest = parts; + while (*src != NULL) + { + if (**src != '\0') + { + *dest++ = *src; + } + + src++; + } + + *dest = NULL; +} + +/* Parse VCD header to get values for context structure. + * The context structure should be zeroed before calling this. + */ +static gboolean parse_header(FILE *file, struct context *ctx) +{ + uint64_t p, q; + gchar *name = NULL, *contents = NULL; + gboolean status = FALSE; + struct probe *probe; + + while (parse_section(file, &name, &contents)) + { + sr_dbg("Section '%s', contents '%s'.", name, contents); + + if (g_strcmp0(name, "enddefinitions") == 0) + { + status = TRUE; + break; + } + else if (g_strcmp0(name, "timescale") == 0) + { + /* The standard allows for values 1, 10 or 100 + * and units s, ms, us, ns, ps and fs. */ + if (sr_parse_period(contents, &p, &q) == SR_OK) + { + ctx->samplerate = q / p; + if (q % p != 0) + { + /* Does not happen unless time value is non-standard */ + sr_warn("Inexact rounding of samplerate, %" PRIu64 " / %" PRIu64 " to %" PRIu64 " Hz.", + q, p, ctx->samplerate); + } + + sr_dbg("Samplerate: %" PRIu64, ctx->samplerate); + } + else + { + sr_err("Parsing timescale failed."); + } + } + else if (g_strcmp0(name, "var") == 0) + { + /* Format: $var type size identifier reference $end */ + gchar **parts = g_strsplit_set(contents, " \r\n\t", 0); + remove_empty_parts(parts); + + if (g_strv_length(parts) != 4) + { + sr_warn("$var section should have 4 items"); + } + else if (g_strcmp0(parts[0], "reg") != 0 && g_strcmp0(parts[0], "wire") != 0) + { + sr_info("Unsupported signal type: '%s'", parts[0]); + } + else if (strtol(parts[1], NULL, 10) != 1) + { + sr_info("Unsupported signal size: '%s'", parts[1]); + } + else if (ctx->probecount >= ctx->maxprobes) + { + sr_warn("Skipping '%s' because only %d probes requested.", parts[3], ctx->maxprobes); + } + else + { + sr_info("Probe %d is '%s' identified by '%s'.", ctx->probecount, parts[3], parts[2]); + probe = g_malloc(sizeof(struct probe)); + probe->identifier = g_strdup(parts[2]); + probe->name = g_strdup(parts[3]); + ctx->probes = g_slist_append(ctx->probes, probe); + ctx->probecount++; + } + + g_strfreev(parts); + } + + g_free(name); name = NULL; + g_free(contents); contents = NULL; + } + + g_free(name); + g_free(contents); + + return status; +} + +static int format_match(const char *filename) +{ + FILE *file; + gchar *name = NULL, *contents = NULL; + gboolean status; + + file = fopen(filename, "r"); + if (file == NULL) + return FALSE; + + /* If we can parse the first section correctly, + * then it is assumed to be a VCD file. + */ + status = parse_section(file, &name, &contents); + status = status && (*name != '\0'); + + g_free(name); + g_free(contents); + fclose(file); + + return status; +} + +static int init(struct sr_input *in, const char *filename) +{ + struct sr_probe *probe; + int num_probes, i; + char name[SR_MAX_PROBENAME_LEN + 1]; + char *param; + struct context *ctx; + + (void)filename; + + if (!(ctx = g_try_malloc0(sizeof(*ctx)))) { + sr_err("Input format context malloc failed."); + return SR_ERR_MALLOC; + } + + num_probes = DEFAULT_NUM_PROBES; + ctx->samplerate = 0; + ctx->downsample = 1; + ctx->skip = -1; + + if (in->param) { + param = g_hash_table_lookup(in->param, "numprobes"); + if (param) { + num_probes = strtoul(param, NULL, 10); + if (num_probes < 1) + { + release_context(ctx); + return SR_ERR; + } + } + + param = g_hash_table_lookup(in->param, "downsample"); + if (param) { + ctx->downsample = strtoul(param, NULL, 10); + if (ctx->downsample < 1) + { + ctx->downsample = 1; + } + } + + param = g_hash_table_lookup(in->param, "compress"); + if (param) { + ctx->compress = strtoul(param, NULL, 10); + } + + param = g_hash_table_lookup(in->param, "skip"); + if (param) { + ctx->skip = strtoul(param, NULL, 10) / ctx->downsample; + } + } + + /* Maximum number of probes to parse from the VCD */ + ctx->maxprobes = num_probes; + + /* Create a virtual device. */ + in->sdi = sr_dev_inst_new(LOGIC, 0, SR_ST_ACTIVE, NULL, NULL, NULL); + in->internal = ctx; + + for (i = 0; i < num_probes; i++) { + snprintf(name, SR_MAX_PROBENAME_LEN, "%d", i); + + if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE, name))) + { + release_context(ctx); + return SR_ERR; + } + + in->sdi->probes = g_slist_append(in->sdi->probes, probe); + } + + return SR_OK; +} + +#define CHUNKSIZE 1024 + +/* Send N samples of the given value. */ +static void send_samples(const struct sr_dev_inst *sdi, uint64_t sample, uint64_t count) +{ + struct sr_datafeed_packet packet; + struct sr_datafeed_logic logic; + uint64_t buffer[CHUNKSIZE]; + uint64_t i; + unsigned chunksize = CHUNKSIZE; + + if (count < chunksize) + chunksize = count; + + for (i = 0; i < chunksize; i++) + { + buffer[i] = sample; + } + + packet.type = SR_DF_LOGIC; + packet.payload = &logic; + logic.unitsize = sizeof(uint64_t); + logic.data = buffer; + + while (count) + { + if (count < chunksize) + chunksize = count; + + logic.length = sizeof(uint64_t) * chunksize; + + sr_session_send(sdi, &packet); + count -= chunksize; + } +} + +/* Parse the data section of VCD */ +static void parse_contents(FILE *file, const struct sr_dev_inst *sdi, struct context *ctx) +{ + GString *token = g_string_sized_new(32); + + uint64_t prev_timestamp = 0; + uint64_t prev_values = 0; + + /* Read one space-delimited token at a time. */ + while (read_until(file, NULL, 'N') && read_until(file, token, 'W')) + { + if (token->str[0] == '#' && g_ascii_isdigit(token->str[1])) + { + /* Numeric value beginning with # is a new timestamp value */ + uint64_t timestamp; + timestamp = strtoull(token->str + 1, NULL, 10); + + if (ctx->downsample > 1) + timestamp /= ctx->downsample; + + /* Skip < 0 => skip until first timestamp. + * Skip = 0 => don't skip + * Skip > 0 => skip until timestamp >= skip. + */ + if (ctx->skip < 0) + { + ctx->skip = timestamp; + prev_timestamp = timestamp; + } + else if (ctx->skip > 0 && timestamp < (uint64_t)ctx->skip) + { + prev_timestamp = ctx->skip; + } + else if (timestamp == prev_timestamp) + { + /* Ignore repeated timestamps (e.g. sigrok outputs these) */ + } + else + { + if (ctx->compress != 0 && timestamp - prev_timestamp > ctx->compress) + { + /* Compress long idle periods */ + prev_timestamp = timestamp - ctx->compress; + } + + sr_dbg("New timestamp: %" PRIu64, timestamp); + + /* Generate samples from prev_timestamp up to timestamp - 1. */ + send_samples(sdi, prev_values, timestamp - prev_timestamp); + prev_timestamp = timestamp; + } + } + else if (token->str[0] == '$' && token->len > 1) + { + /* This is probably a $dumpvars, $comment or similar. + * $dump* contain useful data, but other tags will be skipped until $end. */ + if (g_strcmp0(token->str, "$dumpvars") == 0 || + g_strcmp0(token->str, "$dumpon") == 0 || + g_strcmp0(token->str, "$dumpoff") == 0 || + g_strcmp0(token->str, "$end") == 0) + { + /* Ignore, parse contents as normally. */ + } + else + { + /* Skip until $end */ + read_until(file, NULL, '$'); + } + } + else if (strchr("bBrR", token->str[0]) != NULL) + { + /* A vector value. Skip it and also the following identifier. */ + read_until(file, NULL, 'N'); + read_until(file, NULL, 'W'); + } + else if (strchr("01xXzZ", token->str[0]) != NULL) + { + /* A new 1-bit sample value */ + int i, bit; + GSList *l; + struct probe *probe; + + bit = (token->str[0] == '1'); + + g_string_erase(token, 0, 1); + if (token->len == 0) + { + /* There was a space between value and identifier. + * Read in the rest. + */ + read_until(file, NULL, 'N'); + read_until(file, token, 'W'); + } + + for (i = 0, l = ctx->probes; i < ctx->probecount && l; i++, l = l->next) + { + probe = l->data; + + if (g_strcmp0(token->str, probe->identifier) == 0) + { + sr_dbg("Probe %d new value %d.", i, bit); + + /* Found our probe */ + if (bit) + prev_values |= (1 << i); + else + prev_values &= ~(1 << i); + + break; + } + } + + if (i == ctx->probecount) + { + sr_dbg("Did not find probe for identifier '%s'.", token->str); + } + } + else + { + sr_warn("Skipping unknown token '%s'.", token->str); + } + + g_string_truncate(token, 0); + } + + g_string_free(token, TRUE); +} + +static int loadfile(struct sr_input *in, const char *filename) +{ + struct sr_datafeed_packet packet; + struct sr_datafeed_meta meta; + struct sr_config *src; + FILE *file; + struct context *ctx; + uint64_t samplerate; + + ctx = in->internal; + + if ((file = fopen(filename, "r")) == NULL) + return SR_ERR; + + if (!parse_header(file, ctx)) + { + sr_err("VCD parsing failed"); + fclose(file); + return SR_ERR; + } + + /* Send header packet to the session bus. */ + std_session_send_df_header(in->sdi, LOG_PREFIX); + + /* Send metadata about the SR_DF_LOGIC packets to come. */ + packet.type = SR_DF_META; + packet.payload = &meta; + samplerate = ctx->samplerate / ctx->downsample; + src = sr_config_new(SR_CONF_SAMPLERATE, g_variant_new_uint64(samplerate)); + meta.config = g_slist_append(NULL, src); + sr_session_send(in->sdi, &packet); + sr_config_free(src); + + /* Parse the contents of the VCD file */ + parse_contents(file, in->sdi, ctx); + + /* Send end packet to the session bus. */ + packet.type = SR_DF_END; + sr_session_send(in->sdi, &packet); + + fclose(file); + release_context(ctx); + in->internal = NULL; + + return SR_OK; +} + +SR_PRIV struct sr_input_format input_vcd = { + .id = "vcd", + .description = "Value Change Dump", + .format_match = format_match, + .init = init, + .loadfile = loadfile, +}; diff --git a/libsigrok4DSLogic/input/in_wav.c b/libsigrok4DSLogic/input/in_wav.c new file mode 100644 index 00000000..773b6b8e --- /dev/null +++ b/libsigrok4DSLogic/input/in_wav.c @@ -0,0 +1,211 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2013 Bert Vermeulen + * + * 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 . + */ + +#include +#include +#include +#include +#include +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "input/wav: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +#define CHUNK_SIZE 4096 + +struct context { + uint64_t samplerate; + int samplesize; + int num_channels; +}; + +static int get_wav_header(const char *filename, char *buf) +{ + struct stat st; + int fd, l; + + l = strlen(filename); + if (l <= 4 || strcasecmp(filename + l - 4, ".wav")) + return SR_ERR; + + if (stat(filename, &st) == -1) + return SR_ERR; + if (st.st_size <= 45) + /* Minimum size of header + 1 8-bit mono PCM sample. */ + return SR_ERR; + + if ((fd = open(filename, O_RDONLY)) == -1) + return SR_ERR; + + l = read(fd, buf, 40); + close(fd); + if (l != 40) + return SR_ERR; + + return SR_OK; +} + +static int format_match(const char *filename) +{ + char buf[40]; + + if (get_wav_header(filename, buf) != SR_OK) + return FALSE; + + if (strncmp(buf, "RIFF", 4)) + return FALSE; + if (strncmp(buf + 8, "WAVE", 4)) + return FALSE; + if (strncmp(buf + 12, "fmt ", 4)) + return FALSE; + if (GUINT16_FROM_LE(*(uint16_t *)(buf + 20)) != 1) + /* Not PCM. */ + return FALSE; + if (strncmp(buf + 36, "data", 4)) + return FALSE; + + return TRUE; +} + +static int init(struct sr_input *in, const char *filename) +{ + struct sr_probe *probe; + struct context *ctx; + char buf[40], probename[8]; + int i; + + if (get_wav_header(filename, buf) != SR_OK) + return SR_ERR; + + if (!(ctx = g_try_malloc0(sizeof(struct context)))) + return SR_ERR_MALLOC; + + /* Create a virtual device. */ + in->sdi = sr_dev_inst_new(LOGIC, 0, SR_ST_ACTIVE, NULL, NULL, NULL); + in->sdi->priv = ctx; + + ctx->samplerate = GUINT32_FROM_LE(*(uint32_t *)(buf + 24)); + ctx->samplesize = GUINT16_FROM_LE(*(uint16_t *)(buf + 34)) / 8; + if (ctx->samplesize != 1 && ctx->samplesize != 2 && ctx->samplesize != 4) { + sr_err("only 8, 16 or 32 bits per sample supported."); + return SR_ERR; + } + + if ((ctx->num_channels = GUINT16_FROM_LE(*(uint16_t *)(buf + 22))) > 20) { + sr_err("%d channels seems crazy.", ctx->num_channels); + return SR_ERR; + } + + for (i = 0; i < ctx->num_channels; i++) { + snprintf(probename, 8, "CH%d", i + 1); + if (!(probe = sr_probe_new(0, SR_PROBE_ANALOG, TRUE, probename))) + return SR_ERR; + in->sdi->probes = g_slist_append(in->sdi->probes, probe); + } + + return SR_OK; +} + +static int loadfile(struct sr_input *in, const char *filename) +{ + struct sr_datafeed_packet packet; + struct sr_datafeed_meta meta; + struct sr_datafeed_analog analog; + struct sr_config *src; + struct context *ctx; + float fdata[CHUNK_SIZE]; + uint64_t sample; + int num_samples, chunk_samples, s, c, fd, l; + char buf[CHUNK_SIZE]; + + ctx = in->sdi->priv; + + /* Send header packet to the session bus. */ + std_session_send_df_header(in->sdi, LOG_PREFIX); + + packet.type = SR_DF_META; + packet.payload = &meta; + src = sr_config_new(SR_CONF_SAMPLERATE, + g_variant_new_uint64(ctx->samplerate)); + meta.config = g_slist_append(NULL, src); + sr_session_send(in->sdi, &packet); + sr_config_free(src); + + if ((fd = open(filename, O_RDONLY)) == -1) + return SR_ERR; + + lseek(fd, 40, SEEK_SET); + l = read(fd, buf, 4); + num_samples = GUINT32_FROM_LE((uint32_t)*(buf)); + num_samples /= ctx->samplesize / ctx->num_channels; + while (TRUE) { + if ((l = read(fd, buf, CHUNK_SIZE)) < 1) + break; + chunk_samples = l / ctx->samplesize / ctx->num_channels; + for (s = 0; s < chunk_samples; s++) { + for (c = 0; c < ctx->num_channels; c++) { + sample = 0; + memcpy(&sample, buf + s * ctx->samplesize + c, ctx->samplesize); + switch (ctx->samplesize) { + case 1: + /* 8-bit PCM samples are unsigned. */ + fdata[s + c] = (uint8_t)sample / 255.0; + break; + case 2: + fdata[s + c] = GINT16_FROM_LE(sample) / 32767.0; + break; + case 4: + fdata[s + c] = GINT32_FROM_LE(sample) / 65535.0; + break; + } + } + } + packet.type = SR_DF_ANALOG; + packet.payload = &analog; + analog.probes = in->sdi->probes; + analog.num_samples = chunk_samples; + analog.mq = 0; + analog.unit = 0; + analog.data = fdata; + sr_session_send(in->sdi, &packet); + } + + close(fd); + packet.type = SR_DF_END; + sr_session_send(in->sdi, &packet); + + return SR_OK; +} + + +SR_PRIV struct sr_input_format input_wav = { + .id = "wav", + .description = "WAV file", + .format_match = format_match, + .init = init, + .loadfile = loadfile, +}; + diff --git a/libsigrok4DSLogic/input/input.c b/libsigrok4DSLogic/input/input.c new file mode 100644 index 00000000..68ae49e4 --- /dev/null +++ b/libsigrok4DSLogic/input/input.c @@ -0,0 +1,72 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2010-2012 Bert Vermeulen + * + * 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 . + */ + +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/** + * @file + * + * Input file/data format handling. + */ + +/** + * @defgroup grp_input Input formats + * + * Input file/data format handling. + * + * libsigrok can process acquisition data in several different ways. + * Aside from acquiring data from a hardware device, it can also take it from + * a file in various formats (binary, CSV, VCD, and so on). + * + * Like everything in libsigrok that handles data, processing is done in a + * streaming manner -- input should be supplied to libsigrok a chunk at a time. + * This way anything that processes data can do so in real time, without the + * user having to wait for the whole thing to be finished. + * + * Every input module is "pluggable", meaning it's handled as being separate + * from the main libsigrok, but linked in to it statically. To keep things + * modular and separate like this, functions within an input module should be + * declared static, with only the respective 'struct sr_input_format' being + * exported for use into the wider libsigrok namespace. + * + * @{ + */ + +/** @cond PRIVATE */ + +extern SR_PRIV struct sr_input_format input_binary; +extern SR_PRIV struct sr_input_format input_vcd; +extern SR_PRIV struct sr_input_format input_wav; +/* @endcond */ + +static struct sr_input_format *input_module_list[] = { + &input_vcd, + &input_wav, + /* This one has to be last, because it will take any input. */ + &input_binary, + NULL, +}; + +SR_API struct sr_input_format **sr_input_list(void) +{ + return input_module_list; +} + +/** @} */ diff --git a/libsigrok4DSLogic/libsigrok-internal.h b/libsigrok4DSLogic/libsigrok-internal.h new file mode 100644 index 00000000..aa8086ea --- /dev/null +++ b/libsigrok4DSLogic/libsigrok-internal.h @@ -0,0 +1,194 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2013 Bert Vermeulen + * + * 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 . + */ + +#ifndef LIBSIGROK_SIGROK_INTERNAL_H +#define LIBSIGROK_SIGROK_INTERNAL_H + +#include +#include +#include "config.h" /* Needed for HAVE_LIBUSB_1_0 and others. */ +#ifdef HAVE_LIBUSB_1_0 +#include +#endif + +/** + * @file + * + * libsigrok private header file, only to be used internally. + */ + +/*--- Macros ----------------------------------------------------------------*/ + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) +#endif + +#ifndef ARRAY_AND_SIZE +#define ARRAY_AND_SIZE(a) (a), ARRAY_SIZE(a) +#endif + +struct sr_context { +#ifdef HAVE_LIBUSB_1_0 + libusb_context *libusb_ctx; +#endif +}; + +#ifdef HAVE_LIBUSB_1_0 +struct sr_usb_dev_inst { + uint8_t bus; + uint8_t address; + struct libusb_device_handle *devhdl; +}; +#endif + +#define SERIAL_PARITY_NONE 0 +#define SERIAL_PARITY_EVEN 1 +#define SERIAL_PARITY_ODD 2 +struct sr_serial_dev_inst { + char *port; + char *serialcomm; + int fd; +}; + +/* Private driver context. */ +struct drv_context { + struct sr_context *sr_ctx; + GSList *instances; +}; + +/*--- log.c -----------------------------------------------------------------*/ + +SR_PRIV int sr_log(int loglevel, const char *format, ...); +SR_PRIV int sr_spew(const char *format, ...); +SR_PRIV int sr_dbg(const char *format, ...); +SR_PRIV int sr_info(const char *format, ...); +SR_PRIV int sr_warn(const char *format, ...); +SR_PRIV int sr_err(const char *format, ...); + +/*--- device.c --------------------------------------------------------------*/ + +SR_PRIV struct sr_probe *sr_probe_new(int index, int type, + gboolean enabled, const char *name); +SR_PRIV void sr_dev_probes_free(struct sr_dev_inst *sdi); + +/* Generic device instances */ +SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int mode, int index, int status, + const char *vendor, const char *model, const char *version); +SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi); + +#ifdef HAVE_LIBUSB_1_0 +/* USB-specific instances */ +SR_PRIV struct sr_usb_dev_inst *sr_usb_dev_inst_new(uint8_t bus, + uint8_t address, struct libusb_device_handle *hdl); +SR_PRIV GSList *sr_usb_find_usbtmc(libusb_context *usb_ctx); +SR_PRIV void sr_usb_dev_inst_free(struct sr_usb_dev_inst *usb); +#endif + +/* Serial-specific instances */ +SR_PRIV struct sr_serial_dev_inst *sr_serial_dev_inst_new(const char *port, + const char *serialcomm); +SR_PRIV void sr_serial_dev_inst_free(struct sr_serial_dev_inst *serial); + + +/*--- hwdriver.c ------------------------------------------------------------*/ + +SR_PRIV void sr_hw_cleanup_all(void); +SR_PRIV struct sr_config *sr_config_new(int key, GVariant *data); +SR_PRIV void sr_config_free(struct sr_config *src); +SR_PRIV int sr_source_remove(int fd); +SR_PRIV int sr_source_add(int fd, int events, int timeout, + sr_receive_data_callback_t cb, void *cb_data); + +/*--- session.c -------------------------------------------------------------*/ + +SR_PRIV int sr_session_send(const struct sr_dev_inst *sdi, + const struct sr_datafeed_packet *packet); +SR_PRIV int sr_session_stop_sync(void); + +/*--- std.c -----------------------------------------------------------------*/ + +typedef int (*dev_close_t)(struct sr_dev_inst *sdi); +typedef void (*std_dev_clear_t)(void *priv); + +SR_PRIV int std_hw_init(struct sr_context *sr_ctx, struct sr_dev_driver *di, + const char *prefix); +SR_PRIV int std_hw_dev_acquisition_stop_serial(struct sr_dev_inst *sdi, + void *cb_data, dev_close_t hw_dev_close_fn, + struct sr_serial_dev_inst *serial, const char *prefix); +SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi, + const char *prefix); +SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver, + std_dev_clear_t clear_private); + +/*--- trigger.c -------------------------------------------------*/ +SR_PRIV uint64_t sr_trigger_get_mask0(uint16_t stage); +SR_PRIV uint64_t sr_trigger_get_mask1(uint16_t stage); +SR_PRIV uint64_t sr_trigger_get_value0(uint16_t stage); +SR_PRIV uint64_t sr_trigger_get_value1(uint16_t stage); +SR_PRIV uint64_t sr_trigger_get_edge0(uint16_t stage); +SR_PRIV uint64_t sr_trigger_get_edge1(uint16_t stage); + +/*--- hardware/common/serial.c ----------------------------------------------*/ + +enum { + SERIAL_RDWR = 1, + SERIAL_RDONLY = 2, + SERIAL_NONBLOCK = 4, +}; + +typedef gboolean (*packet_valid_t)(const uint8_t *buf); + +SR_PRIV int serial_open(struct sr_serial_dev_inst *serial, int flags); +SR_PRIV int serial_close(struct sr_serial_dev_inst *serial); +SR_PRIV int serial_flush(struct sr_serial_dev_inst *serial); +SR_PRIV int serial_write(struct sr_serial_dev_inst *serial, + const void *buf, size_t count); +SR_PRIV int serial_read(struct sr_serial_dev_inst *serial, void *buf, + size_t count); +SR_PRIV int serial_set_params(struct sr_serial_dev_inst *serial, int baudrate, + int bits, int parity, int stopbits, int flowcontrol, int rts, int dtr); +SR_PRIV int serial_set_paramstr(struct sr_serial_dev_inst *serial, + const char *paramstr); +SR_PRIV int serial_readline(struct sr_serial_dev_inst *serial, char **buf, + int *buflen, gint64 timeout_ms); +SR_PRIV int serial_stream_detect(struct sr_serial_dev_inst *serial, + uint8_t *buf, size_t *buflen, + size_t packet_size, packet_valid_t is_valid, + uint64_t timeout_ms, int baudrate); + +/*--- hardware/common/ezusb.c -----------------------------------------------*/ + +#ifdef HAVE_LIBUSB_1_0 +SR_PRIV int ezusb_reset(struct libusb_device_handle *hdl, int set_clear); +SR_PRIV int ezusb_install_firmware(libusb_device_handle *hdl, + const char *filename); +SR_PRIV int ezusb_upload_firmware(libusb_device *dev, int configuration, + const char *filename); +#endif + +/*--- hardware/common/usb.c -------------------------------------------------*/ + +#ifdef HAVE_LIBUSB_1_0 +SR_PRIV GSList *sr_usb_find(libusb_context *usb_ctx, const char *conn); +SR_PRIV int sr_usb_open(libusb_context *usb_ctx, struct sr_usb_dev_inst *usb); +#endif + + + +#endif diff --git a/libsigrok4DSLogic/libsigrok.h b/libsigrok4DSLogic/libsigrok.h new file mode 100644 index 00000000..523aabcb --- /dev/null +++ b/libsigrok4DSLogic/libsigrok.h @@ -0,0 +1,914 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2013 Bert Vermeulen + * + * 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 . + */ + +#ifndef LIBSIGROK_SIGROK_H +#define LIBSIGROK_SIGROK_H + +#include +#include +#include +#include +#include + +#ifdef WIN32 +#define WINVER 0x0500 +#define _WIN32_WINNT WINVER +#include +#else +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file + * + * The public libsigrok header file to be used by frontends. + * + * This is the only file that libsigrok users (frontends) are supposed to + * use and \#include. There are other header files which get installed with + * libsigrok, but those are not meant to be used directly by frontends. + * + * The correct way to get/use the libsigrok API functions is: + * + * @code{.c} + * #include + * @endcode + */ + +/* + * All possible return codes of libsigrok functions must be listed here. + * Functions should never return hardcoded numbers as status, but rather + * use these enum values. All error codes are negative numbers. + * + * The error codes are globally unique in libsigrok, i.e. if one of the + * libsigrok functions returns a "malloc error" it must be exactly the same + * return value as used by all other functions to indicate "malloc error". + * There must be no functions which indicate two different errors via the + * same return code. + * + * Also, for compatibility reasons, no defined return codes are ever removed + * or reused for different errors later. You can only add new entries and + * return codes, but never remove or redefine existing ones. + */ + +/** Status/error codes returned by libsigrok functions. */ +enum { + SR_OK = 0, /**< No error. */ + SR_ERR = -1, /**< Generic/unspecified error. */ + SR_ERR_MALLOC = -2, /**< Malloc/calloc/realloc error. */ + SR_ERR_ARG = -3, /**< Function argument error. */ + SR_ERR_BUG = -4, /**< Errors hinting at internal bugs. */ + SR_ERR_SAMPLERATE = -5, /**< Incorrect samplerate. */ + SR_ERR_NA = -6, /**< Not applicable. */ + SR_ERR_DEV_CLOSED = -7, /**< Device is closed, but needs to be open. */ + + /* + * Note: When adding entries here, don't forget to also update the + * sr_strerror() and sr_strerror_name() functions in error.c. + */ +}; + +#define SR_MAX_PROBENAME_LEN 32 +#define DS_MAX_ANALOG_PROBES_NUM 8 +#define TriggerStages 16 +#define TriggerProbes 16 +#define TriggerCountBits 16 + +/* Handy little macros */ +#define SR_HZ(n) (n) +#define SR_KHZ(n) ((n) * (uint64_t)(1000ULL)) +#define SR_MHZ(n) ((n) * (uint64_t)(1000000ULL)) +#define SR_GHZ(n) ((n) * (uint64_t)(1000000000ULL)) + +#define SR_HZ_TO_NS(n) ((uint64_t)(1000000000ULL) / (n)) + +/** libsigrok loglevels. */ +enum { + SR_LOG_NONE = 0, /**< Output no messages at all. */ + SR_LOG_ERR = 1, /**< Output error messages. */ + SR_LOG_WARN = 2, /**< Output warnings. */ + SR_LOG_INFO = 3, /**< Output informational messages. */ + SR_LOG_DBG = 4, /**< Output debug messages. */ + SR_LOG_SPEW = 5, /**< Output very noisy debug messages. */ +}; + +/* + * Use SR_API to mark public API symbols, and SR_PRIV for private symbols. + * + * Variables and functions marked 'static' are private already and don't + * need SR_PRIV. However, functions which are not static (because they need + * to be used in other libsigrok-internal files) but are also not meant to + * be part of the public libsigrok API, must use SR_PRIV. + * + * This uses the 'visibility' feature of gcc (requires gcc >= 4.0). + * + * This feature is not available on MinGW/Windows, as it is a feature of + * ELF files and MinGW/Windows uses PE files. + * + * Details: http://gcc.gnu.org/wiki/Visibility + */ + +/* Marks public libsigrok API symbols. */ +#ifndef _WIN32 +#define SR_API __attribute__((visibility("default"))) +#else +#define SR_API +#endif + +/* Marks private, non-public libsigrok symbols (not part of the API). */ +#ifndef _WIN32 +#define SR_PRIV __attribute__((visibility("hidden"))) +#else +#define SR_PRIV +#endif + +typedef int (*sr_receive_data_callback_t)(int fd, int revents, const struct sr_dev_inst *sdi); + +/** Data types used by sr_config_info(). */ +enum { + SR_T_UINT64 = 10000, + SR_T_CHAR, + SR_T_BOOL, + SR_T_FLOAT, + SR_T_RATIONAL_PERIOD, + SR_T_RATIONAL_VOLT, + SR_T_KEYVALUE, +}; + +/** Value for sr_datafeed_packet.type. */ +enum { + SR_DF_HEADER = 10000, + SR_DF_END, + SR_DF_META, + SR_DF_TRIGGER, + SR_DF_LOGIC, + SR_DF_ANALOG, + SR_DF_FRAME_BEGIN, + SR_DF_FRAME_END, +}; + +/** Values for sr_datafeed_analog.mq. */ +enum { + SR_MQ_VOLTAGE = 10000, + SR_MQ_CURRENT, + SR_MQ_RESISTANCE, + SR_MQ_CAPACITANCE, + SR_MQ_TEMPERATURE, + SR_MQ_FREQUENCY, + SR_MQ_DUTY_CYCLE, + SR_MQ_CONTINUITY, + SR_MQ_PULSE_WIDTH, + SR_MQ_CONDUCTANCE, + /** Electrical power, usually in W, or dBm. */ + SR_MQ_POWER, + /** Gain (a transistor's gain, or hFE, for example). */ + SR_MQ_GAIN, + /** Logarithmic representation of sound pressure relative to a + * reference value. */ + SR_MQ_SOUND_PRESSURE_LEVEL, + SR_MQ_CARBON_MONOXIDE, + SR_MQ_RELATIVE_HUMIDITY, +}; + +/** Values for sr_datafeed_analog.unit. */ +enum { + SR_UNIT_VOLT = 10000, + SR_UNIT_AMPERE, + SR_UNIT_OHM, + SR_UNIT_FARAD, + SR_UNIT_KELVIN, + SR_UNIT_CELSIUS, + SR_UNIT_FAHRENHEIT, + SR_UNIT_HERTZ, + SR_UNIT_PERCENTAGE, + SR_UNIT_BOOLEAN, + SR_UNIT_SECOND, + /** Unit of conductance, the inverse of resistance. */ + SR_UNIT_SIEMENS, + /** + * An absolute measurement of power, in decibels, referenced to + * 1 milliwatt (dBu). + */ + SR_UNIT_DECIBEL_MW, + /** Voltage in decibel, referenced to 1 volt (dBV). */ + SR_UNIT_DECIBEL_VOLT, + /** + * Measurements that intrinsically do not have units attached, such + * as ratios, gains, etc. Specifically, a transistor's gain (hFE) is + * a unitless quantity, for example. + */ + SR_UNIT_UNITLESS, + /** Sound pressure level relative so 20 micropascals. */ + SR_UNIT_DECIBEL_SPL, + /** + * Normalized (0 to 1) concentration of a substance or compound with 0 + * representing a concentration of 0%, and 1 being 100%. This is + * represented as the fraction of number of particles of the substance. + */ + SR_UNIT_CONCENTRATION, +}; + +/** Values for sr_datafeed_analog.flags. */ +enum { + /** Voltage measurement is alternating current (AC). */ + SR_MQFLAG_AC = 0x01, + /** Voltage measurement is direct current (DC). */ + SR_MQFLAG_DC = 0x02, + /** This is a true RMS measurement. */ + SR_MQFLAG_RMS = 0x04, + /** Value is voltage drop across a diode, or NAN. */ + SR_MQFLAG_DIODE = 0x08, + /** Device is in "hold" mode (repeating the last measurement). */ + SR_MQFLAG_HOLD = 0x10, + /** Device is in "max" mode, only updating upon a new max value. */ + SR_MQFLAG_MAX = 0x20, + /** Device is in "min" mode, only updating upon a new min value. */ + SR_MQFLAG_MIN = 0x40, + /** Device is in autoranging mode. */ + SR_MQFLAG_AUTORANGE = 0x80, + /** Device is in relative mode. */ + SR_MQFLAG_RELATIVE = 0x100, + /** Sound pressure level is A-weighted in the frequency domain, + * according to IEC 61672:2003. */ + SR_MQFLAG_SPL_FREQ_WEIGHT_A = 0x200, + /** Sound pressure level is C-weighted in the frequency domain, + * according to IEC 61672:2003. */ + SR_MQFLAG_SPL_FREQ_WEIGHT_C = 0x400, + /** Sound pressure level is Z-weighted (i.e. not at all) in the + * frequency domain, according to IEC 61672:2003. */ + SR_MQFLAG_SPL_FREQ_WEIGHT_Z = 0x800, + /** Sound pressure level is not weighted in the frequency domain, + * albeit without standards-defined low and high frequency limits. */ + SR_MQFLAG_SPL_FREQ_WEIGHT_FLAT = 0x1000, + /** Sound pressure level measurement is S-weighted (1s) in the + * time domain. */ + SR_MQFLAG_SPL_TIME_WEIGHT_S = 0x2000, + /** Sound pressure level measurement is F-weighted (125ms) in the + * time domain. */ + SR_MQFLAG_SPL_TIME_WEIGHT_F = 0x4000, + /** Sound pressure level is time-averaged (LAT), also known as + * Equivalent Continuous A-weighted Sound Level (LEQ). */ + SR_MQFLAG_SPL_LAT = 0x8000, + /** Sound pressure level represented as a percentage of measurements + * that were over a preset alarm level. */ + SR_MQFLAG_SPL_PCT_OVER_ALARM = 0x10000, +}; + +struct sr_context; + +struct sr_datafeed_packet { + uint16_t type; + const void *payload; +}; + +struct sr_datafeed_header { + int feed_version; + struct timeval starttime; +}; + +struct sr_datafeed_meta { + GSList *config; +}; + +struct sr_datafeed_logic { + uint64_t length; + uint16_t unitsize; + uint16_t data_error; + void *data; +}; + +struct sr_datafeed_trigger { + +}; + +struct sr_datafeed_analog { + /** The probes for which data is included in this packet. */ + GSList *probes; + int num_samples; + /** Measured quantity (voltage, current, temperature, and so on). */ + int mq; + /** Unit in which the MQ is measured. */ + int unit; + /** Bitmap with extra information about the MQ. */ + uint64_t mqflags; + /** The analog value(s). The data is interleaved according to + * the probes list. */ + float *data; +}; + +/** Input (file) format struct. */ +struct sr_input { + /** + * A pointer to this input format's 'struct sr_input_format'. + * The frontend can use this to call the module's callbacks. + */ + struct sr_input_format *format; + + GHashTable *param; + + struct sr_dev_inst *sdi; + + void *internal; +}; + +struct sr_input_format { + /** The unique ID for this input format. Must not be NULL. */ + char *id; + + /** + * A short description of the input format, which can (for example) + * be displayed to the user by frontends. Must not be NULL. + */ + char *description; + + /** + * Check if this input module can load and parse the specified file. + * + * @param filename The name (and path) of the file to check. + * + * @return TRUE if this module knows the format, FALSE if it doesn't. + */ + int (*format_match) (const char *filename); + + /** + * Initialize the input module. + * + * @param in A pointer to a valid 'struct sr_input' that the caller + * has to allocate and provide to this function. It is also + * the responsibility of the caller to free it later. + * @param filename The name (and path) of the file to use. + * + * @return SR_OK upon success, a negative error code upon failure. + */ + int (*init) (struct sr_input *in, const char *filename); + + /** + * Load a file, parsing the input according to the file's format. + * + * This function will send datafeed packets to the session bus, so + * the calling frontend must have registered its session callbacks + * beforehand. + * + * The packet types sent across the session bus by this function must + * include at least SR_DF_HEADER, SR_DF_END, and an appropriate data + * type such as SR_DF_LOGIC. It may also send a SR_DF_TRIGGER packet + * if appropriate. + * + * @param in A pointer to a valid 'struct sr_input' that the caller + * has to allocate and provide to this function. It is also + * the responsibility of the caller to free it later. + * @param filename The name (and path) of the file to use. + * + * @return SR_OK upon success, a negative error code upon failure. + */ + int (*loadfile) (struct sr_input *in, const char *filename); +}; + +/** Output (file) format struct. */ +struct sr_output { + /** + * A pointer to this output format's 'struct sr_output_format'. + * The frontend can use this to call the module's callbacks. + */ + struct sr_output_format *format; + + /** + * The device for which this output module is creating output. This + * can be used by the module to find out probe names and numbers. + */ + struct sr_dev_inst *sdi; + + /** + * An optional parameter which the frontend can pass in to the + * output module. How the string is interpreted is entirely up to + * the module. + */ + char *param; + + /** + * A generic pointer which can be used by the module to keep internal + * state between calls into its callback functions. + * + * For example, the module might store a pointer to a chunk of output + * there, and only flush it when it reaches a certain size. + */ + void *internal; +}; + +struct sr_output_format { + /** + * A unique ID for this output format. Must not be NULL. + * + * It can be used by frontends to select this output format for use. + * + * For example, calling sigrok-cli with -O hex will + * select the hexadecimal text output format. + */ + char *id; + + /** + * A short description of the output format. Must not be NULL. + * + * This can be displayed by frontends, e.g. when selecting the output + * format for saving a file. + */ + char *description; + + int df_type; + + /** + * This function is called once, at the beginning of an output stream. + * + * The device struct will be available in the output struct passed in, + * as well as the param field -- which may be NULL or an empty string, + * if no parameter was passed. + * + * The module can use this to initialize itself, create a struct for + * keeping state and storing it in the internal field. + * + * @param o Pointer to the respective 'struct sr_output'. + * + * @return SR_OK upon success, a negative error code otherwise. + */ + int (*init) (struct sr_output *o); + + /** + * Whenever a chunk of data comes in, it will be passed to the + * output module via this function. The data_in and + * length_in values refers to this data; the module + * must not alter or g_free() this buffer. + * + * The function must allocate a buffer for storing its output, and + * pass along a pointer to this buffer in the data_out + * parameter, as well as storing the length of the buffer in + * length_out. The calling frontend will g_free() + * this buffer when it's done with it. + * + * IMPORTANT: The memory allocation much happen using a glib memory + * allocation call (not a "normal" malloc) since g_free() will be + * used to free the memory! + * + * If there is no output, this function MUST store NULL in the + * data_out parameter, so the caller knows not to try + * and g_free() it. + * + * Note: This API call is obsolete, use receive() instead. + * + * @param o Pointer to the respective 'struct sr_output'. + * @param data_in Pointer to the input data buffer. + * @param length_in Length of the input. + * @param data_out Pointer to the allocated output buffer. + * @param length_out Length (in bytes) of the output. + * + * @return SR_OK upon success, a negative error code otherwise. + */ + int (*data) (struct sr_output *o, const uint8_t *data_in, + uint64_t length_in, uint8_t **data_out, + uint64_t *length_out); + + /** + * This function is called when an event occurs in the datafeed + * which the output module may need to be aware of. No data is + * passed in, only the fact that the event occurs. The following + * events can currently be passed in: + * + * - SR_DF_TRIGGER: At this point in the datafeed, the trigger + * matched. The output module may mark this in some way, e.g. by + * plotting a red line on a graph. + * + * - SR_DF_END: This marks the end of the datafeed. No more calls + * into the output module will be done, so this is a good time to + * free up any memory used to keep state, for example. + * + * Any output generated by this function must have a reference to + * it stored in the data_out and length_out + * parameters, or NULL if no output was generated. + * + * Note: This API call is obsolete, use receive() instead. + * + * @param o Pointer to the respective 'struct sr_output'. + * @param event_type Type of event that occured. + * @param data_out Pointer to the allocated output buffer. + * @param length_out Length (in bytes) of the output. + * + * @return SR_OK upon success, a negative error code otherwise. + */ + int (*event) (struct sr_output *o, int event_type, uint8_t **data_out, + uint64_t *length_out); + + /** + * This function is passed a copy of every packed in the data feed. + * Any output generated by the output module in response to the + * packet should be returned in a newly allocated GString + * out, which will be freed by the caller. + * + * Packets not of interest to the output module can just be ignored, + * and the out parameter set to NULL. + * + * @param o Pointer to the respective 'struct sr_output'. + * @param sdi The device instance that generated the packet. + * @param packet The complete packet. + * @param out A pointer where a GString * should be stored if + * the module generates output, or NULL if not. + * + * @return SR_OK upon success, a negative error code otherwise. + */ + int (*receive) (struct sr_output *o, const struct sr_dev_inst *sdi, + const struct sr_datafeed_packet *packet, GString **out); + + /** + * This function is called after the caller is finished using + * the output module, and can be used to free any internal + * resources the module may keep. + * + * @return SR_OK upon success, a negative error code otherwise. + */ + int (*cleanup) (struct sr_output *o); +}; + +enum { + SR_PROBE_LOGIC = 10000, + SR_PROBE_ANALOG, +}; + +enum { + LOGIC = 0, + ANALOG = 1, +}; + +static const char *mode_strings[] = { + "Logic Analyzer", + "Oscilloscope", +}; + +struct sr_probe { + /* The index field will go: use g_slist_length(sdi->probes) instead. */ + int index; + int type; + gboolean enabled; + char *name; + char *trigger; +}; + +struct sr_config { + int key; + GVariant *data; +}; + +struct sr_config_info { + int key; + int datatype; + char *id; + char *name; + char *description; +}; + +enum { + /*--- Device classes ------------------------------------------------*/ + + /** The device can act as logic analyzer. */ + SR_CONF_LOGIC_ANALYZER = 10000, + + /** The device can act as an oscilloscope. */ + SR_CONF_OSCILLOSCOPE, + + /** The device can act as a multimeter. */ + SR_CONF_MULTIMETER, + + /** The device is a demo device. */ + SR_CONF_DEMO_DEV, + + /** The device can act as a sound level meter. */ + SR_CONF_SOUNDLEVELMETER, + + /** The device can measure temperature. */ + SR_CONF_THERMOMETER, + + /** The device can measure humidity. */ + SR_CONF_HYGROMETER, + + /*--- Driver scan options -------------------------------------------*/ + + /** + * Specification on how to connect to a device. + * + * In combination with SR_CONF_SERIALCOMM, this is a serial port in + * the form which makes sense to the OS (e.g., /dev/ttyS0). + * Otherwise this specifies a USB device, either in the form of + * @verbatim .
@endverbatim (decimal, e.g. 1.65) or + * @verbatim . @endverbatim + * (hexadecimal, e.g. 1d6b.0001). + */ + SR_CONF_CONN = 20000, + + /** + * Serial communication specification, in the form: + * + * @verbatim / @endverbatim + * + * Example: 9600/8n1 + * + * The string may also be followed by one or more special settings, + * in the form "/key=value". Supported keys and their values are: + * + * rts 0,1 set the port's RTS pin to low or high + * dtr 0,1 set the port's DTR pin to low or high + * flow 0 no flow control + * 1 hardware-based (RTS/CTS) flow control + * 2 software-based (XON/XOFF) flow control + * + * This is always an optional parameter, since a driver typically + * knows the speed at which the device wants to communicate. + */ + SR_CONF_SERIALCOMM, + + /*--- Device configuration ------------------------------------------*/ + + /** The device supports setting its samplerate, in Hz. */ + SR_CONF_SAMPLERATE = 30000, + + /** The device supports setting a pre/post-trigger capture ratio. */ + SR_CONF_CAPTURE_RATIO, + + /** */ + SR_CONF_DEVICE_MODE, + + /** The device supports setting a pattern (pattern generator mode). */ + SR_CONF_PATTERN_MODE, + + /** The device supports Run Length Encoding. */ + SR_CONF_RLE, + + /** The device supports setting trigger slope. */ + SR_CONF_TRIGGER_SLOPE, + + /** Trigger source. */ + SR_CONF_TRIGGER_SOURCE, + + /** Horizontal trigger position. */ + SR_CONF_HORIZ_TRIGGERPOS, + + /** Buffer size. */ + SR_CONF_BUFFERSIZE, + + /** Time base. */ + SR_CONF_TIMEBASE, + + /** Filter. */ + SR_CONF_FILTER, + + /** Volts/div. */ + SR_CONF_VDIV, + + /** Coupling. */ + SR_CONF_COUPLING, + + /** Trigger types. */ + SR_CONF_TRIGGER_TYPE, + + /** The device supports setting its sample interval, in ms. */ + SR_CONF_SAMPLE_INTERVAL, + + /** Number of timebases, as related to SR_CONF_TIMEBASE. */ + SR_CONF_NUM_TIMEBASE, + + /** Number of vertical divisions, as related to SR_CONF_VDIV. */ + SR_CONF_NUM_VDIV, + + /** clock type (internal/external) */ + SR_CONF_CLOCK_TYPE, + + /*--- Special stuff -------------------------------------------------*/ + + /** Scan options supported by the driver. */ + SR_CONF_SCAN_OPTIONS = 40000, + + /** Device options for a particular device. */ + SR_CONF_DEVICE_OPTIONS, + SR_CONF_DEVICE_CONFIGS, + + /** Session filename. */ + SR_CONF_SESSIONFILE, + + /** The device supports specifying a capturefile to inject. */ + SR_CONF_CAPTUREFILE, + + /** The device supports specifying the capturefile unit size. */ + SR_CONF_CAPTURE_UNITSIZE, + + /** The device supports setting the number of probes. */ + SR_CONF_CAPTURE_NUM_PROBES, + + /*--- Acquisition modes ---------------------------------------------*/ + + /** + * The device supports setting a sample time limit (how long + * the sample acquisition should run, in ms). + */ + SR_CONF_LIMIT_MSEC = 50000, + + /** + * The device supports setting a sample number limit (how many + * samples should be acquired). + */ + SR_CONF_LIMIT_SAMPLES, + + /** + * The device supports setting a frame limit (how many + * frames should be acquired). + */ + SR_CONF_LIMIT_FRAMES, + + /** + * The device supports continuous sampling. Neither a time limit + * nor a sample number limit has to be supplied, it will just acquire + * samples continuously, until explicitly stopped by a certain command. + */ + SR_CONF_CONTINUOUS, + + /** The device has internal storage, into which data is logged. This + * starts or stops the internal logging. */ + SR_CONF_DATALOG, +}; + +struct sr_dev_inst { + struct sr_dev_driver *driver; + int index; + int status; + int inst_type; + int mode; + char *vendor; + char *model; + char *version; + GSList *probes; + void *conn; + void *priv; +}; + +/** Types of device instances (sr_dev_inst). */ +enum { + /** Device instance type for USB devices. */ + SR_INST_USB = 10000, + /** Device instance type for serial port devices. */ + SR_INST_SERIAL, +}; + +/** Device instance status. */ +enum { + /** The device instance was not found. */ + SR_ST_NOT_FOUND = 10000, + /** The device instance was found, but is still booting. */ + SR_ST_INITIALIZING, + /** The device instance is live, but not in use. */ + SR_ST_INACTIVE, + /** The device instance is actively in use in a session. */ + SR_ST_ACTIVE, + /** The device is winding down its session. */ + SR_ST_STOPPING, +}; + +struct sr_dev_driver { + /* Driver-specific */ + char *name; + char *longname; + int api_version; + int (*init) (struct sr_context *sr_ctx); + int (*cleanup) (void); + GSList *(*scan) (GSList *options); + GSList *(*dev_list) (void); + int (*dev_clear) (void); + int (*config_get) (int id, GVariant **data, + const struct sr_dev_inst *sdi); + int (*config_set) (int id, GVariant *data, + const struct sr_dev_inst *sdi); + int (*config_list) (int info_id, GVariant **data, + const struct sr_dev_inst *sdi); + + /* Device-specific */ + int (*dev_open) (struct sr_dev_inst *sdi); + int (*dev_close) (struct sr_dev_inst *sdi); + int (*dev_test) (struct sr_dev_inst *sdi); + int (*dev_acquisition_start) (const struct sr_dev_inst *sdi, + void *cb_data); + int (*dev_acquisition_stop) (struct sr_dev_inst *sdi, + void *cb_data); + + /* Dynamic */ + void *priv; +}; + +struct sr_session { + /** List of struct sr_dev pointers. */ + GSList *devs; + /** List of struct datafeed_callback pointers. */ + GSList *datafeed_callbacks; + GTimeVal starttime; + + unsigned int num_sources; + + /* + * Both "sources" and "pollfds" are of the same size and contain pairs + * of descriptor and callback function. We can not embed the GPollFD + * into the source struct since we want to be able to pass the array + * of all poll descriptors to g_poll(). + */ + struct source *sources; + GPollFD *pollfds; + int source_timeout; + + /* + * These are our synchronization primitives for stopping the session in + * an async fashion. We need to make sure the session is stopped from + * within the session thread itself. + */ +// GMutex stop_mutex; + gboolean abort_session; +}; + +enum { + SIMPLE_TRIGGER = 0, + ADV_TRIGGER, +}; + +struct ds_trigger { + uint16_t trigger_en; + uint16_t trigger_mode; + uint16_t trigger_pos; + uint16_t trigger_stages; + unsigned char trigger_logic[TriggerStages+1]; + unsigned char trigger0_inv[TriggerStages+1]; + unsigned char trigger1_inv[TriggerStages+1]; + char trigger0[TriggerStages+1][TriggerProbes]; + char trigger1[TriggerStages+1][TriggerProbes]; + uint16_t trigger0_count[TriggerStages+1]; + uint16_t trigger1_count[TriggerStages+1]; +}; + +struct ds_trigger_pos { + uint32_t real_pos; + uint32_t ram_saddr; + unsigned char first_block[504]; +}; + +//struct libusbhp_t; +typedef void (*libusbhp_hotplug_cb_fn)(struct libusbhp_device_t *device, + void *user_data); +#ifdef __linux__ +#include + +struct dev_list_t { + char *path; + unsigned short vid; + unsigned short pid; + struct dev_list_t *next; +}; +#endif/*__linux__*/ + +struct libusbhp_t { +#ifdef __linux__ + struct udev* hotplug; + struct udev_monitor* hotplug_monitor; + struct dev_list_t *devlist; +#endif/*__linux__*/ +#ifdef _WIN32 + HWND hwnd; + HDEVNOTIFY hDeviceNotify; + WNDCLASSEX wcex; +#endif/*_WIN32*/ + libusbhp_hotplug_cb_fn attach; + libusbhp_hotplug_cb_fn detach; + void *user_data; +}; + +struct libusbhp_device_t { + unsigned short idVendor; + unsigned short idProduct; +}; + +#include "proto.h" +#include "version.h" + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libsigrok4DSLogic/libsigrok4DSLogic.pc b/libsigrok4DSLogic/libsigrok4DSLogic.pc new file mode 100644 index 00000000..4f42e939 --- /dev/null +++ b/libsigrok4DSLogic/libsigrok4DSLogic.pc @@ -0,0 +1,15 @@ +prefix=/usr/local +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: libsigrok4DSLogic +Description: Backend library of DSLogic software based on libsigrok +URL: http://www.dreamsourcelab.com +Requires: glib-2.0 +Requires.private: libzip libusb-1.0 +Version: 0.2.0 +Libs: -L${libdir} -lsigrok4DSLogic +Libs.private: -lm +Cflags: -I${includedir} + diff --git a/libsigrok4DSLogic/libsigrok4DSLogic.pc.in b/libsigrok4DSLogic/libsigrok4DSLogic.pc.in new file mode 100644 index 00000000..92a23611 --- /dev/null +++ b/libsigrok4DSLogic/libsigrok4DSLogic.pc.in @@ -0,0 +1,15 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libsigrok4DSLogic +Description: Backend library of DSLogic software based on libsigrok +URL: http://www.dreamsourcelab.com +Requires: glib-2.0 +Requires.private: @SR_PKGLIBS@ +Version: @VERSION@ +Libs: -L${libdir} -lsigrok4DSLogic +Libs.private: -lm +Cflags: -I${includedir} + diff --git a/libsigrok4DSLogic/libusbhp.c b/libsigrok4DSLogic/libusbhp.c new file mode 100644 index 00000000..c93f0795 --- /dev/null +++ b/libsigrok4DSLogic/libusbhp.c @@ -0,0 +1,392 @@ +/* + * This file is part of the DSLogic project. + */ + +#include "libsigrok.h" +#include "hardware/DSLogic/dslogic.h" + +#ifdef __linux__ +#include +#include +#include +#include +#include +#endif/*__linux__*/ + +#ifdef _WIN32 +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#endif/*_WIN32*/ + + + +#ifdef __linux__ +static void dev_list_add(struct libusbhp_t *h, const char *path, + unsigned short vid, unsigned short pid) +{ + struct dev_list_t *dev = + (struct dev_list_t*)malloc(sizeof(struct dev_list_t)); + dev->path = strdup(path); + dev->vid = vid; + dev->pid = pid; + dev->next = NULL; + + struct dev_list_t *p = h->devlist; + if(!p) { + h->devlist = dev; + return; + } + + while(p->next) { + p = p->next; + } + + p->next = dev; +} + +static int dev_list_remove(struct libusbhp_t *h, const char *path) +{ + struct dev_list_t *p = h->devlist; + if(!p) return 1; + + if(!strcmp(p->path, path)) { + h->devlist = p->next; + free(p->path); + free(p); + return 0; + } + + while(p->next) { + if(!strcmp(p->next->path, path)) { + struct dev_list_t *pp = p->next; + p->next = pp->next; + free(pp->path); + free(pp->next); + free(pp); + return 0; + } + p = p->next; + } + + // Not found + return 1; +} + +static int dev_list_find(struct libusbhp_t *h, const char *path, + unsigned short *vid, unsigned short *pid) +{ + struct dev_list_t *p = h->devlist; + while(p) { + if(!strcmp(p->path, path)) { + *vid = p->vid; + *pid = p->pid; + return 0; + } + p = p->next; + } + + // Not found + return 1; +} +#endif/*__linux__*/ + +#ifdef _WIN32 +SR_PRIV LRESULT CALLBACK WinProcCallback(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) +{ + struct libusbhp_t *h = (struct libusbhp_t*)GetWindowLong(hwnd, GWL_USERDATA); + + switch(msg) { + case WM_DEVICECHANGE: + { + PDEV_BROADCAST_HDR phdr = (PDEV_BROADCAST_HDR)lp; + + if(!phdr || phdr->dbch_devicetype != DBT_DEVTYP_DEVICEINTERFACE) break; + + PDEV_BROADCAST_DEVICEINTERFACE devif = + (PDEV_BROADCAST_DEVICEINTERFACE)lp; + + HDEVINFO devinfolist = SetupDiCreateDeviceInfoList(NULL, NULL); + + SP_DEVICE_INTERFACE_DATA devifdata; + memset(&devifdata, 0, sizeof(devifdata)); + devifdata.cbSize = sizeof(devifdata); + BOOL b = SetupDiOpenDeviceInterface(devinfolist, devif->dbcc_name, 0, + &devifdata); + + DWORD required; + SP_DEVICE_INTERFACE_DETAIL_DATA devdetaildata; + memset(&devdetaildata, 0, sizeof(devdetaildata)); + devdetaildata.cbSize = sizeof(devdetaildata); + + SP_DEVINFO_DATA devinfodata; + memset(&devinfodata, 0, sizeof(devinfodata)); + devinfodata.cbSize = sizeof(devinfodata); + b = SetupDiGetDeviceInterfaceDetail(devinfolist, &devifdata, + &devdetaildata, + sizeof(devdetaildata), + &required, &devinfodata); + + TCHAR deviceidw[1024]; + b = SetupDiGetDeviceInstanceIdW(devinfolist, &devinfodata, deviceidw, + sizeof(deviceidw), NULL); + + char deviceid[1024]; + //size_t sz; + //wcstombs_s(&sz, deviceid, deviceidw, sizeof(deviceid) - 1); + wcstombs(deviceid, deviceidw, sizeof(deviceid) - 1); + + char *vid = strstr(deviceid, "VID_"); + if(vid != NULL) vid += 4; + + char *pid = strstr(deviceid, "PID_"); + if(pid != NULL) pid += 4; + + struct libusbhp_device_t *device = NULL; + + if(pid || vid) { + device = + (struct libusbhp_device_t*)malloc(sizeof(struct libusbhp_device_t)); + } + + if(pid) { + pid[4] = '\0'; + device->idProduct = (unsigned short)strtol(pid, NULL, 16); + } + + if(vid) { + vid[4] = '\0'; + device->idVendor = (unsigned short)strtol(vid, NULL, 16); + } + + if ((device->idVendor == supported_fx2[0].vid) && + (device->idProduct == supported_fx2[0].pid)) { + switch(wp) { + case DBT_DEVICEARRIVAL: + if(h->attach) h->attach(device, h->user_data); + break; + case DBT_DEVICEREMOVECOMPLETE: + if(h->detach) h->detach(device, h->user_data); + break; + case DBT_DEVNODES_CHANGED: + default: + break; + } + } + + if(device) free(device); + } + break; + default: + break; + } + + return DefWindowProc(hwnd, msg, wp, lp); +} +#endif/*OS_WINDOWS*/ + +SR_API int libusbhp_init(struct libusbhp_t **handle) +{ + struct libusbhp_t *h = (struct libusbhp_t *)malloc(sizeof(struct libusbhp_t)); + + h->attach = NULL; + h->detach = NULL; + h->user_data = NULL; + +#ifdef __linux__ + h->devlist = NULL; + + // create the udev object + h->hotplug = udev_new(); + if(!h->hotplug) + { + printf("Cannot create udev object\n"); + free(h); + return 1; + } + + // create the udev monitor + h->hotplug_monitor = udev_monitor_new_from_netlink(h->hotplug, "udev"); + + // start receiving hotplug events + udev_monitor_filter_add_match_subsystem_devtype(h->hotplug_monitor, + "usb", "usb_device"); + udev_monitor_enable_receiving(h->hotplug_monitor); + + struct udev_enumerate *de = udev_enumerate_new (h->hotplug); + udev_enumerate_add_match_subsystem(de, "usb"); + udev_enumerate_scan_devices(de); + + struct udev_list_entry *lst = udev_enumerate_get_list_entry(de); + while(lst) { + struct udev_device *dev = + udev_device_new_from_syspath(h->hotplug, + udev_list_entry_get_name(lst)); + + if(udev_device_get_devnode(dev)) { + unsigned short idVendor = + strtol(udev_device_get_sysattr_value(dev, "idVendor"), NULL, 16); + unsigned short idProduct = + strtol(udev_device_get_sysattr_value(dev, "idProduct"), NULL, 16); + + dev_list_add(h, udev_device_get_devnode(dev), idVendor, idProduct); + } + + udev_device_unref(dev); + + lst = udev_list_entry_get_next(lst); + } + + udev_enumerate_unref(de); + +#endif/*__linux__*/ + +#ifdef _WIN32 + memset(&h->wcex, 0, sizeof(h->wcex)); + h->wcex.cbSize = sizeof(WNDCLASSEX); + h->wcex.lpfnWndProc = WinProcCallback; + h->wcex.hInstance = GetModuleHandle(NULL); + h->wcex.lpszClassName = TEXT("UsbHotplugClass"); + h->wcex.cbWndExtra = sizeof(struct libusbhp_t*); // Size of data. + + RegisterClassEx(&h->wcex); + + h->hwnd = + CreateWindowEx(0, h->wcex.lpszClassName, TEXT("UsbHotplug"), 0, 0, 0, 0, + 0, 0, NULL, GetModuleHandle(NULL), NULL); + + SetWindowLong(h->hwnd, GWL_USERDATA, (LONG)h); + + + DEV_BROADCAST_DEVICEINTERFACE *filter = + (DEV_BROADCAST_DEVICEINTERFACE*)malloc(sizeof(DEV_BROADCAST_DEVICEINTERFACE)); + + memset(filter, 0, sizeof(DEV_BROADCAST_DEVICEINTERFACE)); + filter->dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE); + filter->dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE; + filter->dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE; + + h->hDeviceNotify = + RegisterDeviceNotification(h->hwnd, filter, DEVICE_NOTIFY_WINDOW_HANDLE); + + if(h->hDeviceNotify == 0) { + //printf("RegisterDeviceNotification error\n"); + free(h); + return 1; + } +#endif/*_WIN32*/ + + *handle = h; + return 0; +} + +SR_API void libusbhp_exit(struct libusbhp_t *h) +{ +#ifdef __linux__ + // destroy the udev monitor + udev_monitor_unref(h->hotplug_monitor); + + // destroy the udev object + udev_unref(h->hotplug); +#endif/*__linux__*/ + +#ifdef _WIN32 + UnregisterDeviceNotification(h->hDeviceNotify); + DestroyWindow(h->hwnd); + UnregisterClass(h->wcex.lpszClassName, h->wcex.hInstance); +#endif/*_WIN32*/ + + free(h); +} + +SR_API int libusbhp_handle_events_timeout(struct libusbhp_t *h, struct timeval *tv) +{ + int ms = tv->tv_sec * 1000 + tv->tv_usec / 1000; + +#ifdef __linux__ + // create the poll item + struct pollfd items[1]; + items[0].fd = udev_monitor_get_fd(h->hotplug_monitor); + items[0].events = POLLIN; + items[0].revents = 0; + + // while there are hotplug events to process + while(poll(items, 1, ms) > 0) { + // receive the relevant device + struct udev_device* dev = udev_monitor_receive_device(h->hotplug_monitor); + if(!dev) { + // error receiving device, skip it + continue; + } + + if(!strcmp(udev_device_get_action(dev), "add")) { + struct libusbhp_device_t device; + + device.idVendor = + strtol(udev_device_get_sysattr_value(dev, "idVendor"), NULL, 16); + device.idProduct = + strtol(udev_device_get_sysattr_value(dev, "idProduct"), NULL, 16); + + dev_list_add(h, udev_device_get_devnode(dev), + device.idVendor, device.idProduct); + + if(h->attach) h->attach(&device, h->user_data); + } + + if(!strcmp(udev_device_get_action(dev), "remove")) { + struct libusbhp_device_t device; + + int res = dev_list_find(h, udev_device_get_devnode(dev), + &device.idVendor, &device.idProduct); + + if(res) { + if(h->detach) h->detach(NULL, h->user_data); + } else { + dev_list_remove(h, udev_device_get_devnode(dev)); + if(h->detach) h->detach(&device, h->user_data); + } + } + + // destroy the relevant device + udev_device_unref(dev); + + // clear the revents + items[0].revents = 0; + } +#endif/*__linux__*/ + +#ifdef _WIN32 + UINT_PTR timer = SetTimer(h->hwnd, 0, ms, NULL); + + MSG msg; + int ret = GetMessage(&msg, NULL, 0, 0); + + if(ret <= 0) return 0; + + TranslateMessage(&msg); + DispatchMessage(&msg); + + KillTimer(h->hwnd, timer); +#endif/*_WIN32*/ + + return 0; +} + +SR_API void libusbhp_register_hotplug_listeners(struct libusbhp_t *handle, + libusbhp_hotplug_cb_fn connected_cb, + libusbhp_hotplug_cb_fn disconnected_cb, + void *user_data) +{ + handle->attach = connected_cb; + handle->detach = disconnected_cb; + handle->user_data = user_data; +} diff --git a/libsigrok4DSLogic/log.c b/libsigrok4DSLogic/log.c new file mode 100644 index 00000000..d6b29302 --- /dev/null +++ b/libsigrok4DSLogic/log.c @@ -0,0 +1,299 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2011-2012 Uwe Hermann + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/** + * @file + * + * Controlling the libsigrok message logging functionality. + */ + +/** + * @defgroup grp_logging Logging + * + * Controlling the libsigrok message logging functionality. + * + * @{ + */ + +/* Currently selected libsigrok loglevel. Default: SR_LOG_WARN. */ +static int sr_loglevel = SR_LOG_WARN; /* Show errors+warnings per default. */ + +/* Function prototype. */ +static int sr_logv(void *cb_data, int loglevel, const char *format, + va_list args); + +/* Pointer to the currently selected log callback. Default: sr_logv(). */ +static sr_log_callback_t sr_log_callback = sr_logv; + +/* + * Pointer to private data that can be passed to the log callback. + * This can be used (for example) by C++ GUIs to pass a "this" pointer. + */ +static void *sr_log_callback_data = NULL; + +/* Log domain (a short string that is used as prefix for all messages). */ +/** @cond PRIVATE */ +#define LOGDOMAIN_MAXLEN 30 +#define LOGDOMAIN_DEFAULT "sr: " +/** @endcond */ +static char sr_log_domain[LOGDOMAIN_MAXLEN + 1] = LOGDOMAIN_DEFAULT; + +/** + * Set the libsigrok loglevel. + * + * This influences the amount of log messages (debug messages, error messages, + * and so on) libsigrok will output. Using SR_LOG_NONE disables all messages. + * + * Note that this function itself will also output log messages. After the + * loglevel has changed, it will output a debug message with SR_LOG_DBG for + * example. Whether this message is shown depends on the (new) loglevel. + * + * @param loglevel The loglevel to set (SR_LOG_NONE, SR_LOG_ERR, SR_LOG_WARN, + * SR_LOG_INFO, SR_LOG_DBG, or SR_LOG_SPEW). + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid loglevel. + * + * @since 0.1.0 + */ +SR_API int sr_log_loglevel_set(int loglevel) +{ + if (loglevel < SR_LOG_NONE || loglevel > SR_LOG_SPEW) { + sr_err("Invalid loglevel %d.", loglevel); + return SR_ERR_ARG; + } + + sr_loglevel = loglevel; + + sr_dbg("libsigrok loglevel set to %d.", loglevel); + + return SR_OK; +} + +/** + * Get the libsigrok loglevel. + * + * @return The currently configured libsigrok loglevel. + * + * @since 0.1.0 + */ +SR_API int sr_log_loglevel_get(void) +{ + return sr_loglevel; +} + +/** + * Set the libsigrok logdomain string. + * + * @param logdomain The string to use as logdomain for libsigrok log + * messages from now on. Must not be NULL. The maximum + * length of the string is 30 characters (this does not + * include the trailing NUL-byte). Longer strings are + * silently truncated. + * In order to not use a logdomain, pass an empty string. + * The function makes its own copy of the input string, i.e. + * the caller does not need to keep it around. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid logdomain. + * + * @since 0.1.0 + */ +SR_API int sr_log_logdomain_set(const char *logdomain) +{ + if (!logdomain) { + sr_err("log: %s: logdomain was NULL", __func__); + return SR_ERR_ARG; + } + + /* TODO: Error handling. */ + snprintf((char *)&sr_log_domain, LOGDOMAIN_MAXLEN, "%s", logdomain); + + sr_dbg("Log domain set to '%s'.", (const char *)&sr_log_domain); + + return SR_OK; +} + +/** + * Get the currently configured libsigrok logdomain. + * + * @return A copy of the currently configured libsigrok logdomain + * string. The caller is responsible for g_free()ing the string when + * it is no longer needed. + * + * @since 0.1.0 + */ +SR_API char *sr_log_logdomain_get(void) +{ + return g_strdup((const char *)&sr_log_domain); +} + +/** + * Set the libsigrok log callback to the specified function. + * + * @param cb Function pointer to the log callback function to use. + * Must not be NULL. + * @param cb_data Pointer to private data to be passed on. This can be used by + * the caller to pass arbitrary data to the log functions. This + * pointer is only stored or passed on by libsigrok, and is + * never used or interpreted in any way. The pointer is allowed + * to be NULL if the caller doesn't need/want to pass any data. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments. + * + * @since 0.1.0 + */ +SR_API int sr_log_callback_set(sr_log_callback_t cb, void *cb_data) +{ + if (!cb) { + sr_err("log: %s: cb was NULL", __func__); + return SR_ERR_ARG; + } + + /* Note: 'cb_data' is allowed to be NULL. */ + + sr_log_callback = cb; + sr_log_callback_data = cb_data; + + return SR_OK; +} + +/** + * Set the libsigrok log callback to the default built-in one. + * + * Additionally, the internal 'sr_log_callback_data' pointer is set to NULL. + * + * @return SR_OK upon success, a negative error code otherwise. + * + * @since 0.1.0 + */ +SR_API int sr_log_callback_set_default(void) +{ + /* + * Note: No log output in this function, as it should safely work + * even if the currently set log callback is buggy/broken. + */ + sr_log_callback = sr_logv; + sr_log_callback_data = NULL; + + return SR_OK; +} + +static int sr_logv(void *cb_data, int loglevel, const char *format, va_list args) +{ + int ret; + + /* This specific log callback doesn't need the void pointer data. */ + (void)cb_data; + + /* Only output messages of at least the selected loglevel(s). */ + if (loglevel > sr_loglevel) + return SR_OK; /* TODO? */ + + if (sr_log_domain[0] != '\0') + fprintf(stderr, "%s", sr_log_domain); + ret = vfprintf(stderr, format, args); + fprintf(stderr, "\n"); + + return ret; +} + +/** @private */ +SR_PRIV int sr_log(int loglevel, const char *format, ...) +{ + int ret; + va_list args; + + va_start(args, format); + ret = sr_log_callback(sr_log_callback_data, loglevel, format, args); + va_end(args); + + return ret; +} + +/** @private */ +SR_PRIV int sr_spew(const char *format, ...) +{ + int ret; + va_list args; + + va_start(args, format); + ret = sr_log_callback(sr_log_callback_data, SR_LOG_SPEW, format, args); + va_end(args); + + return ret; +} + +/** @private */ +SR_PRIV int sr_dbg(const char *format, ...) +{ + int ret; + va_list args; + + va_start(args, format); + ret = sr_log_callback(sr_log_callback_data, SR_LOG_DBG, format, args); + va_end(args); + + return ret; +} + +/** @private */ +SR_PRIV int sr_info(const char *format, ...) +{ + int ret; + va_list args; + + va_start(args, format); + ret = sr_log_callback(sr_log_callback_data, SR_LOG_INFO, format, args); + va_end(args); + + return ret; +} + +/** @private */ +SR_PRIV int sr_warn(const char *format, ...) +{ + int ret; + va_list args; + + va_start(args, format); + ret = sr_log_callback(sr_log_callback_data, SR_LOG_WARN, format, args); + va_end(args); + + return ret; +} + +/** @private */ +SR_PRIV int sr_err(const char *format, ...) +{ + int ret; + va_list args; + + va_start(args, format); + ret = sr_log_callback(sr_log_callback_data, SR_LOG_ERR, format, args); + va_end(args); + + return ret; +} + +/** @} */ diff --git a/libsigrok4DSLogic/output/Makefile.am b/libsigrok4DSLogic/output/Makefile.am new file mode 100644 index 00000000..2bbe59c8 --- /dev/null +++ b/libsigrok4DSLogic/output/Makefile.am @@ -0,0 +1,37 @@ +## +## This file is part of the libsigrok project. +## +## Copyright (C) 2011 Uwe Hermann +## +## 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 . +## + +SUBDIRS = text + +# Local lib, this is NOT meant to be installed! +noinst_LTLIBRARIES = libsigrok4DSLogicoutput.la + +libsigrok4DSLogicoutput_la_SOURCES = \ + out_binary.c \ + out_vcd.c \ + out_csv.c \ + out_analog.c \ + output.c + +libsigrok4DSLogicoutput_la_CFLAGS = \ + -I$(top_srcdir) + +libsigrok4DSLogicoutput_la_LIBADD = \ + text/libsigrok4DSLogicoutputtext.la + diff --git a/libsigrok4DSLogic/output/out_analog.c b/libsigrok4DSLogic/output/out_analog.c new file mode 100644 index 00000000..684f8826 --- /dev/null +++ b/libsigrok4DSLogic/output/out_analog.c @@ -0,0 +1,251 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2012 Bert Vermeulen + * + * 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 . + */ + +#include +#include +#include +#include +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "output/analog: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +struct context { + int num_enabled_probes; + GPtrArray *probelist; +}; + +static int init(struct sr_output *o) +{ + struct context *ctx; + struct sr_probe *probe; + GSList *l; + + sr_spew("Initializing output module."); + + if (!o || !o->sdi) + return SR_ERR_ARG; + + if (!(ctx = g_try_malloc0(sizeof(struct context)))) { + sr_err("Output module context malloc failed."); + return SR_ERR_MALLOC; + } + o->internal = ctx; + + /* Get the number of probes and their names. */ + ctx->probelist = g_ptr_array_new(); + for (l = o->sdi->probes; l; l = l->next) { + probe = l->data; + if (!probe || !probe->enabled) + continue; + g_ptr_array_add(ctx->probelist, probe->name); + ctx->num_enabled_probes++; + } + + return SR_OK; +} + +static void si_printf(float value, GString *out, char *unitstr) +{ + float v; + + if (signbit(value)) + v = -(value); + else + v = value; + + if (v < 1e-12 || v > 1e+12) + g_string_append_printf(out, "%f %s", value, unitstr); + else if (v > 1e+9) + g_string_append_printf(out, "%f G%s", value / 1e+9, unitstr); + else if (v > 1e+6) + g_string_append_printf(out, "%f M%s", value / 1e+6, unitstr); + else if (v > 1e+3) + g_string_append_printf(out, "%f k%s", value / 1e+3, unitstr); + else if (v < 1e-9) + g_string_append_printf(out, "%f n%s", value * 1e+9, unitstr); + else if (v < 1e-6) + g_string_append_printf(out, "%f u%s", value * 1e+6, unitstr); + else if (v < 1e-3) + g_string_append_printf(out, "%f m%s", value * 1e+3, unitstr); + else + g_string_append_printf(out, "%f %s", value, unitstr); + +} + +static void fancyprint(int unit, int mqflags, float value, GString *out) +{ + switch (unit) { + case SR_UNIT_VOLT: + si_printf(value, out, "V"); + break; + case SR_UNIT_AMPERE: + si_printf(value, out, "A"); + break; + case SR_UNIT_OHM: + si_printf(value, out, ""); + g_string_append_unichar(out, 0x2126); + break; + case SR_UNIT_FARAD: + si_printf(value, out, "F"); + break; + case SR_UNIT_KELVIN: + si_printf(value, out, "K"); + break; + case SR_UNIT_CELSIUS: + si_printf(value, out, ""); + g_string_append_unichar(out, 0x00b0); + g_string_append_c(out, 'C'); + break; + case SR_UNIT_FAHRENHEIT: + si_printf(value, out, ""); + g_string_append_unichar(out, 0x00b0); + g_string_append_c(out, 'F'); + break; + case SR_UNIT_HERTZ: + si_printf(value, out, "Hz"); + break; + case SR_UNIT_PERCENTAGE: + g_string_append_printf(out, "%f%%", value); + break; + case SR_UNIT_BOOLEAN: + if (value > 0) + g_string_append_printf(out, "TRUE"); + else + g_string_append_printf(out, "FALSE"); + break; + case SR_UNIT_SECOND: + si_printf(value, out, "s"); + break; + case SR_UNIT_SIEMENS: + si_printf(value, out, "S"); + break; + case SR_UNIT_DECIBEL_MW: + si_printf(value, out, "dBu"); + break; + case SR_UNIT_DECIBEL_VOLT: + si_printf(value, out, "dBV"); + break; + case SR_UNIT_DECIBEL_SPL: + if (mqflags & SR_MQFLAG_SPL_FREQ_WEIGHT_A) + si_printf(value, out, "dB(A)"); + else if (mqflags & SR_MQFLAG_SPL_FREQ_WEIGHT_C) + si_printf(value, out, "dB(C)"); + else if (mqflags & SR_MQFLAG_SPL_FREQ_WEIGHT_Z) + si_printf(value, out, "dB(Z)"); + else + /* No frequency weighting, or non-standard "flat" */ + si_printf(value, out, "dB(SPL)"); + if (mqflags & SR_MQFLAG_SPL_TIME_WEIGHT_S) + g_string_append(out, " S"); + else if (mqflags & SR_MQFLAG_SPL_TIME_WEIGHT_F) + g_string_append(out, " F"); + if (mqflags & SR_MQFLAG_SPL_LAT) + g_string_append(out, " LAT"); + else if (mqflags & SR_MQFLAG_SPL_PCT_OVER_ALARM) + /* Not a standard function for SLMs, so this is + * a made-up notation. */ + g_string_append(out, " %oA"); + break; + case SR_UNIT_CONCENTRATION: + g_string_append_printf(out, "%f ppm", value * 1000000); + break; + default: + si_printf(value, out, ""); + break; + } + if ((mqflags & (SR_MQFLAG_AC | SR_MQFLAG_DC)) == (SR_MQFLAG_AC | SR_MQFLAG_DC)) + g_string_append_printf(out, " AC+DC"); + else if (mqflags & SR_MQFLAG_AC) + g_string_append_printf(out, " AC"); + else if (mqflags & SR_MQFLAG_DC) + g_string_append_printf(out, " DC"); + g_string_append_c(out, '\n'); +} + +static int receive(struct sr_output *o, const struct sr_dev_inst *sdi, + const struct sr_datafeed_packet *packet, GString **out) +{ + const struct sr_datafeed_analog *analog; + struct sr_probe *probe; + GSList *l; + const float *fdata; + int i, p; + + (void)sdi; + + *out = NULL; + if (!o || !o->sdi) + return SR_ERR_ARG; + + switch (packet->type) { + case SR_DF_FRAME_BEGIN: + *out = g_string_new("FRAME-BEGIN\n"); + break; + case SR_DF_FRAME_END: + *out = g_string_new("FRAME-END\n"); + break; + case SR_DF_ANALOG: + analog = packet->payload; + fdata = (const float *)analog->data; + *out = g_string_sized_new(512); + for (i = 0; i < analog->num_samples; i++) { + for (l = analog->probes, p = 0; l; l = l->next, p++) { + probe = l->data; + g_string_append_printf(*out, "%s: ", probe->name); + fancyprint(analog->unit, analog->mqflags, + fdata[i + p], *out); + } + } + break; + } + + return SR_OK; +} + +static int cleanup(struct sr_output *o) +{ + struct context *ctx; + + if (!o || !o->sdi) + return SR_ERR_ARG; + ctx = o->internal; + + g_ptr_array_free(ctx->probelist, 1); + g_free(ctx); + o->internal = NULL; + + return SR_OK; +} + +SR_PRIV struct sr_output_format output_analog = { + .id = "analog", + .description = "Analog data", + .df_type = SR_DF_ANALOG, + .init = init, + .receive = receive, + .cleanup = cleanup +}; diff --git a/libsigrok4DSLogic/output/out_binary.c b/libsigrok4DSLogic/output/out_binary.c new file mode 100644 index 00000000..2fd858eb --- /dev/null +++ b/libsigrok4DSLogic/output/out_binary.c @@ -0,0 +1,77 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2010 Uwe Hermann + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "output/binary: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +static int data(struct sr_output *o, const uint8_t *data_in, + uint64_t length_in, uint8_t **data_out, uint64_t *length_out) +{ + uint8_t *outbuf; + + (void)o; + + if (!data_in) { + sr_err("%s: data_in was NULL", __func__); + return SR_ERR_ARG; + } + + if (!length_out) { + sr_err("%s: length_out was NULL", __func__); + return SR_ERR_ARG; + } + + if (length_in == 0) { + sr_err("%s: length_in was 0", __func__); + return SR_ERR_ARG; + } + + if (!(outbuf = g_try_malloc0(length_in))) { + sr_err("%s: outbuf malloc failed", __func__); + return SR_ERR_MALLOC; + } + + memcpy(outbuf, data_in, length_in); + *data_out = outbuf; + *length_out = length_in; + + return SR_OK; +} + +SR_PRIV struct sr_output_format output_binary = { + .id = "binary", + .description = "Raw binary", + .df_type = SR_DF_LOGIC, + .init = NULL, + .data = data, + .event = NULL, +}; diff --git a/libsigrok4DSLogic/output/out_csv.c b/libsigrok4DSLogic/output/out_csv.c new file mode 100644 index 00000000..0a7c5044 --- /dev/null +++ b/libsigrok4DSLogic/output/out_csv.c @@ -0,0 +1,225 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2011 Uwe Hermann + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include "config.h" /* Needed for PACKAGE_STRING and others. */ +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "output/csv: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +struct context { + unsigned int num_enabled_probes; + unsigned int unitsize; + uint64_t samplerate; + GString *header; + char separator; +}; + +/* + * TODO: + * - Option to specify delimiter character and/or string. + * - Option to (not) print metadata as comments. + * - Option to specify the comment character(s), e.g. # or ; or C/C++-style. + * - Option to (not) print samplenumber / time as extra column. + * - Option to "compress" output (only print changed samples, VCD-like). + * - Option to print comma-separated bits, or whole bytes/words (for 8/16 + * probe LAs) as ASCII/hex etc. etc. + * - Trigger support. + */ + +static int init(struct sr_output *o) +{ + struct context *ctx; + struct sr_probe *probe; + GSList *l; + GVariant *gvar; + int num_probes; + time_t t; + + if (!o) { + sr_err("%s: o was NULL", __func__); + return SR_ERR_ARG; + } + + if (!o->sdi) { + sr_err("%s: o->sdi was NULL", __func__); + return SR_ERR_ARG; + } + + if (!(ctx = g_try_malloc0(sizeof(struct context)))) { + sr_err("%s: ctx malloc failed", __func__); + return SR_ERR_MALLOC; + } + + o->internal = ctx; + + /* Get the number of probes, and the unitsize. */ + for (l = o->sdi->probes; l; l = l->next) { + probe = l->data; + if (probe->enabled) + ctx->num_enabled_probes++; + } + + ctx->unitsize = (ctx->num_enabled_probes + 7) / 8; + + num_probes = g_slist_length(o->sdi->probes); + + if (sr_config_get(o->sdi->driver, SR_CONF_SAMPLERATE, &gvar, + o->sdi) == SR_OK) { + ctx->samplerate = g_variant_get_uint64(gvar); + g_variant_unref(gvar); + } else + ctx->samplerate = 0; + + ctx->separator = ','; + ctx->header = g_string_sized_new(512); + + t = time(NULL); + + /* Some metadata */ + g_string_append_printf(ctx->header, "; CSV, generated by %s on %s", + PACKAGE_STRING, ctime(&t)); + g_string_append_printf(ctx->header, "; Samplerate: %"PRIu64"\n", + ctx->samplerate); + + /* Columns / channels */ + g_string_append_printf(ctx->header, "; Channels (%d/%d): ", + ctx->num_enabled_probes, num_probes); + for (l = o->sdi->probes; l; l = l->next) { + probe = l->data; + if (probe->enabled) + g_string_append_printf(ctx->header, "%s, ", probe->name); + } + g_string_append_printf(ctx->header, "\n"); + + return SR_OK; +} + +static int event(struct sr_output *o, int event_type, uint8_t **data_out, + uint64_t *length_out) +{ + struct context *ctx; + + if (!o) { + sr_err("%s: o was NULL", __func__); + return SR_ERR_ARG; + } + + if (!(ctx = o->internal)) { + sr_err("%s: o->internal was NULL", __func__); + return SR_ERR_ARG; + } + + if (!data_out) { + sr_err("%s: data_out was NULL", __func__); + return SR_ERR_ARG; + } + + switch (event_type) { + case SR_DF_TRIGGER: + sr_dbg("%s: SR_DF_TRIGGER event", __func__); + /* TODO */ + *data_out = NULL; + *length_out = 0; + break; + case SR_DF_END: + sr_dbg("%s: SR_DF_END event", __func__); + /* TODO */ + *data_out = NULL; + *length_out = 0; + g_free(o->internal); + o->internal = NULL; + break; + default: + sr_err("%s: unsupported event type: %d", __func__, event_type); + *data_out = NULL; + *length_out = 0; + break; + } + + return SR_OK; +} + +static int data(struct sr_output *o, const uint8_t *data_in, + uint64_t length_in, uint8_t **data_out, uint64_t *length_out) +{ + struct context *ctx; + GString *outstr; + uint64_t sample, i; + int j; + + if (!o) { + sr_err("%s: o was NULL", __func__); + return SR_ERR_ARG; + } + + if (!(ctx = o->internal)) { + sr_err("%s: o->internal was NULL", __func__); + return SR_ERR_ARG; + } + + if (!data_in) { + sr_err("%s: data_in was NULL", __func__); + return SR_ERR_ARG; + } + + if (ctx->header) { + /* First data packet. */ + outstr = ctx->header; + ctx->header = NULL; + } else { + outstr = g_string_sized_new(512); + } + + for (i = 0; i <= length_in - ctx->unitsize; i += ctx->unitsize) { + memcpy(&sample, data_in + i, ctx->unitsize); + for (j = ctx->num_enabled_probes - 1; j >= 0; j--) { + g_string_append_printf(outstr, "%d%c", + (int)((sample & (1 << j)) >> j), + ctx->separator); + } + g_string_append_printf(outstr, "\n"); + } + + *data_out = (uint8_t *)outstr->str; + *length_out = outstr->len; + g_string_free(outstr, FALSE); + + return SR_OK; +} + +SR_PRIV struct sr_output_format output_csv = { + .id = "csv", + .description = "Comma-separated values (CSV)", + .df_type = SR_DF_LOGIC, + .init = init, + .data = data, + .event = event, +}; diff --git a/libsigrok4DSLogic/output/out_vcd.c b/libsigrok4DSLogic/output/out_vcd.c new file mode 100644 index 00000000..04d7fcbb --- /dev/null +++ b/libsigrok4DSLogic/output/out_vcd.c @@ -0,0 +1,231 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2010 Uwe Hermann + * Copyright (C) 2013 Bert Vermeulen + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include "config.h" /* Needed for PACKAGE and others. */ +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "output/vcd: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +struct context { + int num_enabled_probes; + GArray *probeindices; + GString *header; + uint8_t *prevsample; + int period; + uint64_t samplerate; + unsigned int unitsize; +}; + +static const char *vcd_header_comment = "\ +$comment\n Acquisition with %d/%d probes at %s\n$end\n"; + +static int init(struct sr_output *o) +{ + struct context *ctx; + struct sr_probe *probe; + GSList *l; + GVariant *gvar; + int num_probes, i; + char *samplerate_s, *frequency_s, *timestamp; + time_t t; + + if (!(ctx = g_try_malloc0(sizeof(struct context)))) { + sr_err("%s: ctx malloc failed", __func__); + return SR_ERR_MALLOC; + } + + o->internal = ctx; + ctx->num_enabled_probes = 0; + ctx->probeindices = g_array_new(FALSE, FALSE, sizeof(int)); + + for (l = o->sdi->probes; l; l = l->next) { + probe = l->data; + if (!probe->enabled) + continue; + ctx->probeindices = g_array_append_val( + ctx->probeindices, probe->index); + ctx->num_enabled_probes++; + } + if (ctx->num_enabled_probes > 94) { + sr_err("VCD only supports 94 probes."); + return SR_ERR; + } + + ctx->unitsize = (ctx->num_enabled_probes + 7) / 8; + ctx->header = g_string_sized_new(512); + num_probes = g_slist_length(o->sdi->probes); + + /* timestamp */ + t = time(NULL); + timestamp = g_strdup(ctime(&t)); + timestamp[strlen(timestamp)-1] = 0; + g_string_printf(ctx->header, "$date %s $end\n", timestamp); + g_free(timestamp); + + /* generator */ + g_string_append_printf(ctx->header, "$version %s %s $end\n", + PACKAGE, PACKAGE_VERSION); + + if (sr_config_get(o->sdi->driver, SR_CONF_SAMPLERATE, &gvar, + o->sdi) == SR_OK) { + ctx->samplerate = g_variant_get_uint64(gvar); + g_variant_unref(gvar); + if (!((samplerate_s = sr_samplerate_string(ctx->samplerate)))) { + g_string_free(ctx->header, TRUE); + g_free(ctx); + return SR_ERR; + } + g_string_append_printf(ctx->header, vcd_header_comment, + ctx->num_enabled_probes, num_probes, samplerate_s); + g_free(samplerate_s); + } + + /* timescale */ + /* VCD can only handle 1/10/100 (s - fs), so scale up first */ + if (ctx->samplerate > SR_MHZ(1)) + ctx->period = SR_GHZ(1); + else if (ctx->samplerate > SR_KHZ(1)) + ctx->period = SR_MHZ(1); + else + ctx->period = SR_KHZ(1); + if (!(frequency_s = sr_period_string(ctx->period))) { + g_string_free(ctx->header, TRUE); + g_free(ctx); + return SR_ERR; + } + g_string_append_printf(ctx->header, "$timescale %s $end\n", frequency_s); + g_free(frequency_s); + + /* scope */ + g_string_append_printf(ctx->header, "$scope module %s $end\n", PACKAGE); + + /* Wires / channels */ + for (i = 0, l = o->sdi->probes; l; l = l->next, i++) { + probe = l->data; + if (!probe->enabled) + continue; + g_string_append_printf(ctx->header, "$var wire 1 %c %s $end\n", + (char)('!' + i), probe->name); + } + + g_string_append(ctx->header, "$upscope $end\n" + "$enddefinitions $end\n$dumpvars\n"); + + if (!(ctx->prevsample = g_try_malloc0(ctx->unitsize))) { + g_string_free(ctx->header, TRUE); + g_free(ctx); + sr_err("%s: ctx->prevsample malloc failed", __func__); + return SR_ERR_MALLOC; + } + + return SR_OK; +} + +static int receive(struct sr_output *o, const struct sr_dev_inst *sdi, + const struct sr_datafeed_packet *packet, GString **out) +{ + const struct sr_datafeed_logic *logic; + struct context *ctx; + unsigned int i; + int p, curbit, prevbit, index; + uint8_t *sample; + static uint64_t samplecount = 0; + + (void)sdi; + + *out = NULL; + if (!o || !o->internal) + return SR_ERR_ARG; + ctx = o->internal; + + if (packet->type == SR_DF_END) { + *out = g_string_new("$dumpoff\n$end\n"); + return SR_OK; + } else if (packet->type != SR_DF_LOGIC) + return SR_OK; + + if (ctx->header) { + /* The header is still here, this must be the first packet. */ + *out = ctx->header; + ctx->header = NULL; + } else { + *out = g_string_sized_new(512); + } + + logic = packet->payload; + for (i = 0; i <= logic->length - logic->unitsize; i += logic->unitsize) { + samplecount++; + + sample = logic->data + i; + + for (p = 0; p < ctx->num_enabled_probes; p++) { + index = g_array_index(ctx->probeindices, int, p); + curbit = (sample[p / 8] & (((uint8_t) 1) << index)) >> index; + prevbit = (ctx->prevsample[p / 8] & (((uint64_t) 1) << index)) >> index; + + /* VCD only contains deltas/changes of signals. */ + if (prevbit == curbit) + continue; + + /* Output which signal changed to which value. */ + g_string_append_printf(*out, "#%" PRIu64 "\n%i%c\n", + (uint64_t)(((float)samplecount / ctx->samplerate) + * ctx->period), curbit, (char)('!' + p)); + } + + memcpy(ctx->prevsample, sample, ctx->unitsize); + } + + return SR_OK; +} + +static int cleanup(struct sr_output *o) +{ + struct context *ctx; + + if (!o || !o->internal) + return SR_ERR_ARG; + + ctx = o->internal; + g_free(ctx); + + return SR_OK; +} + +struct sr_output_format output_vcd = { + .id = "vcd", + .description = "Value Change Dump (VCD)", + .df_type = SR_DF_LOGIC, + .init = init, + .receive = receive, + .cleanup = cleanup, +}; diff --git a/libsigrok4DSLogic/output/output.c b/libsigrok4DSLogic/output/output.c new file mode 100644 index 00000000..62ce0c18 --- /dev/null +++ b/libsigrok4DSLogic/output/output.c @@ -0,0 +1,80 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2010-2012 Bert Vermeulen + * + * 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 . + */ + +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/** + * @file + * + * Output file/data format handling. + */ + +/** + * @defgroup grp_output Output formats + * + * Output file/data format handling. + * + * libsigrok supports several output (file) formats, e.g. binary, VCD, + * gnuplot, and so on. It provides an output API that frontends can use. + * New output formats can be added/implemented in libsigrok without having + * to change the frontends at all. + * + * All output modules are fed data in a stream. Devices that can stream data + * into libsigrok live, instead of storing and then transferring the whole + * buffer, can thus generate output live. + * + * Output modules are responsible for allocating enough memory to store + * their own output, and passing a pointer to that memory (and length) of + * the allocated memory back to the caller. The caller is then expected to + * free this memory when finished with it. + * + * @{ + */ + +/** @cond PRIVATE */ +extern SR_PRIV struct sr_output_format output_text_bits; +extern SR_PRIV struct sr_output_format output_text_hex; +extern SR_PRIV struct sr_output_format output_text_ascii; +extern SR_PRIV struct sr_output_format output_binary; +extern SR_PRIV struct sr_output_format output_vcd; + +extern SR_PRIV struct sr_output_format output_csv; +extern SR_PRIV struct sr_output_format output_analog; +/* extern SR_PRIV struct sr_output_format output_analog_gnuplot; */ +/* @endcond */ + +static struct sr_output_format *output_module_list[] = { + &output_text_bits, + &output_text_hex, + &output_text_ascii, + &output_binary, + &output_vcd, + &output_csv, + &output_analog, + /* &output_analog_gnuplot, */ + NULL, +}; + +SR_API struct sr_output_format **sr_output_list(void) +{ + return output_module_list; +} + +/** @} */ diff --git a/libsigrok4DSLogic/output/text/Makefile.am b/libsigrok4DSLogic/output/text/Makefile.am new file mode 100644 index 00000000..a6edae8d --- /dev/null +++ b/libsigrok4DSLogic/output/text/Makefile.am @@ -0,0 +1,33 @@ +## +## This file is part of the libsigrok project. +## +## Copyright (C) 2011 Uwe Hermann +## +## 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 2 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, write to the Free Software +## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +## + +# Local lib, this is NOT meant to be installed! +noinst_LTLIBRARIES = libsigrok4DSLogicoutputtext.la + +libsigrok4DSLogicoutputtext_la_SOURCES = \ + text.c \ + text.h \ + bits.c \ + hex.c \ + ascii.c + +libsigrok4DSLogicoutputtext_la_CFLAGS = \ + -I$(top_srcdir) + diff --git a/libsigrok4DSLogic/output/text/ascii.c b/libsigrok4DSLogic/output/text/ascii.c new file mode 100644 index 00000000..bd87024d --- /dev/null +++ b/libsigrok4DSLogic/output/text/ascii.c @@ -0,0 +1,136 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2010-2012 Bert Vermeulen + * Copyright (C) 2011 Håvard Espeland + * + * 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 . + */ + +#include +#include +#include +#include "libsigrok.h" +#include "libsigrok-internal.h" +#include "text.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "output/ascii: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +SR_PRIV int init_ascii(struct sr_output *o) +{ + return init(o, DEFAULT_BPL_ASCII, MODE_ASCII); +} + +SR_PRIV int data_ascii(struct sr_output *o, const uint8_t *data_in, + uint64_t length_in, uint8_t **data_out, + uint64_t *length_out) +{ + struct context *ctx; + unsigned int outsize, offset, p; + int max_linelen; + const uint8_t *sample; + uint8_t *outbuf; + + ctx = o->internal; + max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line + + ctx->samples_per_line / 8; + /* + * Calculate space needed for probes. Set aside 512 bytes for + * extra output, e.g. trigger. + */ + outsize = 512 + (1 + (length_in / ctx->unitsize) / ctx->samples_per_line) + * (ctx->num_enabled_probes * max_linelen); + + if (!(outbuf = g_try_malloc0(outsize + 1))) { + sr_err("%s: outbuf malloc failed", __func__); + return SR_ERR_MALLOC; + } + + outbuf[0] = '\0'; + if (ctx->header) { + /* The header is still here, this must be the first packet. */ + strncpy((char *)outbuf, ctx->header, outsize); + g_free(ctx->header); + ctx->header = NULL; + } + + if (length_in >= ctx->unitsize) { + for (offset = 0; offset <= length_in - ctx->unitsize; + offset += ctx->unitsize) { + sample = data_in + offset; + + char tmpval[ctx->num_enabled_probes]; + + for (p = 0; p < ctx->num_enabled_probes; p++) { + uint8_t curbit = (sample[p / 8] & ((uint8_t) 1 << (p % 8))); + uint8_t prevbit = (ctx->prevsample[p / 8] & + ((uint8_t) 1 << (p % 8))); + + if (curbit < prevbit && ctx->line_offset > 0) { + ctx->linebuf[p * ctx->linebuf_len + + ctx->line_offset-1] = '\\'; + } + + if (curbit > prevbit) { + tmpval[p] = '/'; + } else { + if (curbit) + tmpval[p] = '"'; + else + tmpval[p] = '.'; + } + } + + /* End of line. */ + if (ctx->spl_cnt >= ctx->samples_per_line) { + flush_linebufs(ctx, outbuf); + ctx->line_offset = ctx->spl_cnt = 0; + ctx->mark_trigger = -1; + } + + for (p = 0; p < ctx->num_enabled_probes; p++) { + ctx->linebuf[p * ctx->linebuf_len + + ctx->line_offset] = tmpval[p]; + } + + ctx->line_offset++; + ctx->spl_cnt++; + + memcpy(ctx->prevsample, sample, ctx->unitsize); + } + } else { + sr_info("Short buffer (length_in=%" PRIu64 ").", length_in); + } + + *data_out = outbuf; + *length_out = strlen((const char *)outbuf); + + return SR_OK; +} + +SR_PRIV struct sr_output_format output_text_ascii = { + .id = "ascii", + .description = "ASCII", + .df_type = SR_DF_LOGIC, + .init = init_ascii, + .data = data_ascii, + .event = event, +}; diff --git a/libsigrok4DSLogic/output/text/bits.c b/libsigrok4DSLogic/output/text/bits.c new file mode 100644 index 00000000..3afb9016 --- /dev/null +++ b/libsigrok4DSLogic/output/text/bits.c @@ -0,0 +1,119 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2010-2012 Bert Vermeulen + * Copyright (C) 2011 Håvard Espeland + * + * 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 . + */ + +#include +#include +#include +#include "libsigrok.h" +#include "libsigrok-internal.h" +#include "text.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "output/bits: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +SR_PRIV int init_bits(struct sr_output *o) +{ + return init(o, DEFAULT_BPL_BITS, MODE_BITS); +} + +SR_PRIV int data_bits(struct sr_output *o, const uint8_t *data_in, + uint64_t length_in, uint8_t **data_out, + uint64_t *length_out) +{ + struct context *ctx; + unsigned int outsize, offset, p; + int max_linelen; + const uint8_t *sample; + uint8_t *outbuf, c; + + ctx = o->internal; + max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line + + ctx->samples_per_line / 8; + /* + * Calculate space needed for probes. Set aside 512 bytes for + * extra output, e.g. trigger. + */ + outsize = 512 + (1 + (length_in / ctx->unitsize) / ctx->samples_per_line) + * (ctx->num_enabled_probes * max_linelen); + + if (!(outbuf = g_try_malloc0(outsize + 1))) { + sr_err("%s: outbuf malloc failed", __func__); + return SR_ERR_MALLOC; + } + + outbuf[0] = '\0'; + if (ctx->header) { + /* The header is still here, this must be the first packet. */ + strncpy((char *)outbuf, ctx->header, outsize); + g_free(ctx->header); + ctx->header = NULL; + } + + if (length_in >= ctx->unitsize) { + for (offset = 0; offset <= length_in - ctx->unitsize; + offset += ctx->unitsize) { + sample = data_in + offset; + for (p = 0; p < ctx->num_enabled_probes; p++) { + c = (sample[p / 8] & ((uint8_t) 1 << (p % 8))) ? '1' : '0'; + ctx->linebuf[p * ctx->linebuf_len + + ctx->line_offset] = c; + } + ctx->line_offset++; + ctx->spl_cnt++; + + /* Add a space every 8th bit. */ + if ((ctx->spl_cnt & 7) == 0) { + for (p = 0; p < ctx->num_enabled_probes; p++) + ctx->linebuf[p * ctx->linebuf_len + + ctx->line_offset] = ' '; + ctx->line_offset++; + } + + /* End of line. */ + if (ctx->spl_cnt >= ctx->samples_per_line) { + flush_linebufs(ctx, outbuf); + ctx->line_offset = ctx->spl_cnt = 0; + ctx->mark_trigger = -1; + } + } + } else { + sr_info("Short buffer (length_in=%" PRIu64 ").", length_in); + } + + *data_out = outbuf; + *length_out = strlen((const char *)outbuf); + + return SR_OK; +} + +SR_PRIV struct sr_output_format output_text_bits = { + .id = "bits", + .description = "Bits", + .df_type = SR_DF_LOGIC, + .init = init_bits, + .data = data_bits, + .event = event, +}; diff --git a/libsigrok4DSLogic/output/text/hex.c b/libsigrok4DSLogic/output/text/hex.c new file mode 100644 index 00000000..3ddaf47f --- /dev/null +++ b/libsigrok4DSLogic/output/text/hex.c @@ -0,0 +1,112 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2010-2012 Bert Vermeulen + * Copyright (C) 2011 Håvard Espeland + * + * 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 . + */ + +#include +#include +#include +#include "libsigrok.h" +#include "libsigrok-internal.h" +#include "text.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "output/hex: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +SR_PRIV int init_hex(struct sr_output *o) +{ + return init(o, DEFAULT_BPL_HEX, MODE_HEX); +} + +SR_PRIV int data_hex(struct sr_output *o, const uint8_t *data_in, + uint64_t length_in, uint8_t **data_out, + uint64_t *length_out) +{ + struct context *ctx; + unsigned int outsize, offset, p; + int max_linelen; + const uint8_t *sample; + uint8_t *outbuf; + + ctx = o->internal; + max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line + + ctx->samples_per_line / 2; + outsize = length_in / ctx->unitsize * ctx->num_enabled_probes + / ctx->samples_per_line * max_linelen + 512; + + if (!(outbuf = g_try_malloc0(outsize + 1))) { + sr_err("%s: outbuf malloc failed", __func__); + return SR_ERR_MALLOC; + } + + outbuf[0] = '\0'; + if (ctx->header) { + /* The header is still here, this must be the first packet. */ + strncpy((char *)outbuf, ctx->header, outsize); + g_free(ctx->header); + ctx->header = NULL; + } + + ctx->line_offset = 0; + for (offset = 0; offset <= length_in - ctx->unitsize; + offset += ctx->unitsize) { + sample = data_in + offset; + for (p = 0; p < ctx->num_enabled_probes; p++) { + ctx->linevalues[p] <<= 1; + if (sample[p / 8] & ((uint8_t) 1 << (p % 8))) + ctx->linevalues[p] |= 1; + sprintf((char *)ctx->linebuf + (p * ctx->linebuf_len) + + ctx->line_offset, "%.2x", ctx->linevalues[p]); + } + ctx->spl_cnt++; + + /* Add a space after every complete hex byte. */ + if ((ctx->spl_cnt & 7) == 0) { + for (p = 0; p < ctx->num_enabled_probes; p++) + ctx->linebuf[p * ctx->linebuf_len + + ctx->line_offset + 2] = ' '; + ctx->line_offset += 3; + } + + /* End of line. */ + if (ctx->spl_cnt >= ctx->samples_per_line) { + flush_linebufs(ctx, outbuf); + ctx->line_offset = ctx->spl_cnt = 0; + } + } + + *data_out = outbuf; + *length_out = strlen((const char *)outbuf); + + return SR_OK; +} + +SR_PRIV struct sr_output_format output_text_hex = { + .id = "hex", + .description = "Hexadecimal", + .df_type = SR_DF_LOGIC, + .init = init_hex, + .data = data_hex, + .event = event, +}; diff --git a/libsigrok4DSLogic/output/text/text.c b/libsigrok4DSLogic/output/text/text.c new file mode 100644 index 00000000..a2b8b20e --- /dev/null +++ b/libsigrok4DSLogic/output/text/text.c @@ -0,0 +1,208 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2013 Bert Vermeulen + * Copyright (C) 2011 Håvard Espeland + * + * 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 . + */ + +#include +#include +#include +#include +#include "config.h" /* Needed for PACKAGE_STRING and others. */ +#include "libsigrok.h" +#include "libsigrok-internal.h" +#include "text.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "output/text: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +SR_PRIV void flush_linebufs(struct context *ctx, uint8_t *outbuf) +{ + static int max_probename_len = 0; + int len, i; + GSList *l; + char *probe_name; + + if (ctx->linebuf[0] == 0) + return; + + if (max_probename_len == 0) { + /* First time through... */ + for (l = ctx->probenames; l; l = l->next) { + probe_name = l->data; + len = strlen(probe_name); + if (len > max_probename_len) + max_probename_len = len; + } + } + + for (i = 0, l = ctx->probenames; l; l = l->next, i++) { + probe_name = l->data; + sprintf((char *)outbuf + strlen((const char *)outbuf), + "%*s:%s\n", max_probename_len, + probe_name, ctx->linebuf + i * ctx->linebuf_len); + } + + /* Mark trigger with a ^ character. */ + if (ctx->mark_trigger != -1) + { + int space_offset = ctx->mark_trigger / 8; + + if (ctx->mode == MODE_ASCII) + space_offset = 0; + + sprintf((char *)outbuf + strlen((const char *)outbuf), + "T:%*s^\n", ctx->mark_trigger + space_offset, ""); + } + + memset(ctx->linebuf, 0, i * ctx->linebuf_len); +} + +SR_PRIV int init(struct sr_output *o, int default_spl, enum outputmode mode) +{ + struct context *ctx; + struct sr_probe *probe; + GSList *l; + GVariant *gvar; + uint64_t samplerate; + int num_probes, ret; + char *samplerate_s; + + if (!(ctx = g_try_malloc0(sizeof(struct context)))) { + sr_err("%s: ctx malloc failed", __func__); + return SR_ERR_MALLOC; + } + + o->internal = ctx; + ctx->num_enabled_probes = 0; + ctx->probenames = NULL; + + for (l = o->sdi->probes; l; l = l->next) { + probe = l->data; + if (!probe->enabled) + continue; + ctx->probenames = g_slist_append(ctx->probenames, probe->name); + ctx->num_enabled_probes++; + } + + ctx->unitsize = (ctx->num_enabled_probes + 7) / 8; + ctx->line_offset = 0; + ctx->spl_cnt = 0; + ctx->mark_trigger = -1; + ctx->mode = mode; + + ret = SR_OK; + if (o->param && o->param[0]) { + ctx->samples_per_line = strtoul(o->param, NULL, 10); + if (ctx->samples_per_line < 1) { + ret = SR_ERR; + goto err; + } + } else + ctx->samples_per_line = default_spl; + + if (!(ctx->header = g_try_malloc0(512))) { + sr_err("%s: ctx->header malloc failed", __func__); + ret = SR_ERR_MALLOC; + goto err; + } + + snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING); + num_probes = g_slist_length(o->sdi->probes); + if (sr_config_get(o->sdi->driver, SR_CONF_SAMPLERATE, &gvar, + o->sdi) == SR_OK) { + samplerate = g_variant_get_uint64(gvar); + g_variant_unref(gvar); + if (!(samplerate_s = sr_samplerate_string(samplerate))) { + ret = SR_ERR; + goto err; + } + snprintf(ctx->header + strlen(ctx->header), + 511 - strlen(ctx->header), + "Acquisition with %d/%d probes at %s\n", + ctx->num_enabled_probes, num_probes, samplerate_s); + g_free(samplerate_s); + } + + ctx->linebuf_len = ctx->samples_per_line * 2 + 4; + if (!(ctx->linebuf = g_try_malloc0(num_probes * ctx->linebuf_len))) { + sr_err("%s: ctx->linebuf malloc failed", __func__); + ret = SR_ERR_MALLOC; + goto err; + } + + if (!(ctx->linevalues = g_try_malloc0(num_probes))) { + sr_err("%s: ctx->linevalues malloc failed", __func__); + ret = SR_ERR_MALLOC; + } + + if (mode == MODE_ASCII && + !(ctx->prevsample = g_try_malloc0(num_probes / 8))) { + sr_err("%s: ctx->prevsample malloc failed", __func__); + ret = SR_ERR_MALLOC; + } + +err: + if (ret != SR_OK) { + g_free(ctx->header); + g_free(ctx); + } + + return ret; +} + +SR_PRIV int event(struct sr_output *o, int event_type, uint8_t **data_out, + uint64_t *length_out) +{ + struct context *ctx; + int outsize; + uint8_t *outbuf; + + ctx = o->internal; + switch (event_type) { + case SR_DF_TRIGGER: + ctx->mark_trigger = ctx->spl_cnt; + *data_out = NULL; + *length_out = 0; + break; + case SR_DF_END: + outsize = ctx->num_enabled_probes + * (ctx->samples_per_line + 20) + 512; + if (!(outbuf = g_try_malloc0(outsize))) { + sr_err("%s: outbuf malloc failed", __func__); + return SR_ERR_MALLOC; + } + flush_linebufs(ctx, outbuf); + *data_out = outbuf; + *length_out = strlen((const char *)outbuf); + g_free(o->internal); + o->internal = NULL; + break; + default: + *data_out = NULL; + *length_out = 0; + break; + } + + return SR_OK; +} diff --git a/libsigrok4DSLogic/output/text/text.h b/libsigrok4DSLogic/output/text/text.h new file mode 100644 index 00000000..8d5c9876 --- /dev/null +++ b/libsigrok4DSLogic/output/text/text.h @@ -0,0 +1,69 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2010-2012 Bert Vermeulen + * + * 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 . + */ + +#ifndef LIBSIGROK_OUTPUT_TEXT_TEXT_H +#define LIBSIGROK_OUTPUT_TEXT_TEXT_H + +#define DEFAULT_BPL_BITS 64 +#define DEFAULT_BPL_HEX 192 +#define DEFAULT_BPL_ASCII 74 + +enum outputmode { + MODE_BITS = 1, + MODE_HEX, + MODE_ASCII, +}; + +struct context { + unsigned int num_enabled_probes; + int samples_per_line; + unsigned int unitsize; + int line_offset; + int linebuf_len; + GSList *probenames; + uint8_t *linebuf; + int spl_cnt; + uint8_t *linevalues; + char *header; + int mark_trigger; + uint8_t *prevsample; + enum outputmode mode; +}; + +SR_PRIV void flush_linebufs(struct context *ctx, uint8_t *outbuf); +SR_PRIV int init(struct sr_output *o, int default_spl, enum outputmode mode); +SR_PRIV int event(struct sr_output *o, int event_type, uint8_t **data_out, + uint64_t *length_out); + +SR_PRIV int init_bits(struct sr_output *o); +SR_PRIV int data_bits(struct sr_output *o, const uint8_t *data_in, + uint64_t length_in, uint8_t **data_out, + uint64_t *length_out); + +SR_PRIV int init_hex(struct sr_output *o); +SR_PRIV int data_hex(struct sr_output *o, const uint8_t *data_in, + uint64_t length_in, uint8_t **data_out, + uint64_t *length_out); + +SR_PRIV int init_ascii(struct sr_output *o); +SR_PRIV int data_ascii(struct sr_output *o, const uint8_t *data_in, + uint64_t length_in, uint8_t **data_out, + uint64_t *length_out); + +#endif diff --git a/libsigrok4DSLogic/proto.h b/libsigrok4DSLogic/proto.h new file mode 100644 index 00000000..322dc2d2 --- /dev/null +++ b/libsigrok4DSLogic/proto.h @@ -0,0 +1,179 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2013 Bert Vermeulen + * + * 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 . + */ + +#ifndef LIBSIGROK_SIGROK_PROTO_H +#define LIBSIGROK_SIGROK_PROTO_H + +/** + * @file + * + * Header file containing API function prototypes. + */ + +/*--- backend.c -------------------------------------------------------------*/ + +SR_API int sr_init(struct sr_context **ctx); +SR_API int sr_exit(struct sr_context *ctx); + +/*--- log.c -----------------------------------------------------------------*/ + +typedef int (*sr_log_callback_t)(void *cb_data, int loglevel, + const char *format, va_list args); + +SR_API int sr_log_loglevel_set(int loglevel); +SR_API int sr_log_loglevel_get(void); +SR_API int sr_log_callback_set(sr_log_callback_t cb, void *cb_data); +SR_API int sr_log_callback_set_default(void); +SR_API int sr_log_logdomain_set(const char *logdomain); +SR_API char *sr_log_logdomain_get(void); + +/*--- device.c --------------------------------------------------------------*/ + +SR_API int sr_dev_probe_name_set(const struct sr_dev_inst *sdi, + int probenum, const char *name); +SR_API int sr_dev_probe_enable(const struct sr_dev_inst *sdi, int probenum, + gboolean state); +SR_API int sr_dev_trigger_set(const struct sr_dev_inst *sdi, int probenum, + const char *trigger); +SR_API gboolean sr_dev_has_option(const struct sr_dev_inst *sdi, int key); +SR_API GSList *sr_dev_list(const struct sr_dev_driver *driver); +SR_API int sr_dev_clear(const struct sr_dev_driver *driver); +SR_API int sr_dev_open(struct sr_dev_inst *sdi); +SR_API int sr_dev_close(struct sr_dev_inst *sdi); + +/*--- filter.c --------------------------------------------------------------*/ + +SR_API int sr_filter_probes(unsigned int in_unitsize, unsigned int out_unitsize, + const GArray *probe_array, const uint8_t *data_in, + uint64_t length_in, uint8_t **data_out, + uint64_t *length_out); + +/*--- hwdriver.c ------------------------------------------------------------*/ + +SR_API struct sr_dev_driver **sr_driver_list(void); +SR_API int sr_driver_init(struct sr_context *ctx, + struct sr_dev_driver *driver); +SR_API GSList *sr_driver_scan(struct sr_dev_driver *driver, GSList *options); +SR_API int sr_config_get(const struct sr_dev_driver *driver, int key, + GVariant **data, const struct sr_dev_inst *sdi); +SR_API int sr_config_set(const struct sr_dev_inst *sdi, int key, + GVariant *data); +SR_API int sr_config_list(const struct sr_dev_driver *driver, int key, + GVariant **data, const struct sr_dev_inst *sdi); +SR_API const struct sr_config_info *sr_config_info_get(int key); +SR_API const struct sr_config_info *sr_config_info_name_get(const char *optname); + +/*--- session.c -------------------------------------------------------------*/ + +typedef void (*sr_datafeed_callback_t)(const struct sr_dev_inst *sdi, + const struct sr_datafeed_packet *packet, void *cb_data); + +/* Session setup */ +SR_API int sr_session_load(const char *filename); +SR_API struct sr_session *sr_session_new(void); +SR_API int sr_session_destroy(void); +SR_API int sr_session_dev_remove_all(void); +SR_API int sr_session_dev_add(const struct sr_dev_inst *sdi); + +/* Datafeed setup */ +SR_API int sr_session_datafeed_callback_remove_all(void); +SR_API int sr_session_datafeed_callback_add(sr_datafeed_callback_t cb, + void *cb_data); + +/* Session control */ +SR_API int sr_session_start(void); +SR_API int sr_session_run(void); +SR_API int sr_session_stop(void); +SR_API int sr_session_save(const char *filename, const struct sr_dev_inst *sdi, + unsigned char *buf, int unitsize, int units); +SR_API int sr_session_source_add(int fd, int events, int timeout, + sr_receive_data_callback_t cb, const struct sr_dev_inst *sdi); +SR_API int sr_session_source_add_pollfd(GPollFD *pollfd, int timeout, + sr_receive_data_callback_t cb, const struct sr_dev_inst *sdi); +SR_API int sr_session_source_add_channel(GIOChannel *channel, int events, + int timeout, sr_receive_data_callback_t cb, const struct sr_dev_inst *sdi); +SR_API int sr_session_source_remove(int fd); +SR_API int sr_session_source_remove_pollfd(GPollFD *pollfd); +SR_API int sr_session_source_remove_channel(GIOChannel *channel); + +/*--- input/input.c ---------------------------------------------------------*/ + +SR_API struct sr_input_format **sr_input_list(void); + +/*--- output/output.c -------------------------------------------------------*/ + +SR_API struct sr_output_format **sr_output_list(void); + +/*--- strutil.c -------------------------------------------------------------*/ + +SR_API char *sr_si_string_u64(uint64_t x, const char *unit); +SR_API char *sr_samplerate_string(uint64_t samplerate); +SR_API char *sr_period_string(uint64_t frequency); +SR_API char *sr_voltage_string(uint64_t v_p, uint64_t v_q); +SR_API char **sr_parse_triggerstring(const struct sr_dev_inst *sdi, + const char *triggerstring); +SR_API int sr_parse_sizestring(const char *sizestring, uint64_t *size); +SR_API uint64_t sr_parse_timestring(const char *timestring); +SR_API gboolean sr_parse_boolstring(const char *boolstring); +SR_API int sr_parse_period(const char *periodstr, uint64_t *p, uint64_t *q); +SR_API int sr_parse_voltage(const char *voltstr, uint64_t *p, uint64_t *q); + +/*--- version.c -------------------------------------------------------------*/ + +SR_API int sr_package_version_major_get(void); +SR_API int sr_package_version_minor_get(void); +SR_API int sr_package_version_micro_get(void); +SR_API const char *sr_package_version_string_get(void); + +SR_API int sr_lib_version_current_get(void); +SR_API int sr_lib_version_revision_get(void); +SR_API int sr_lib_version_age_get(void); +SR_API const char *sr_lib_version_string_get(void); + +/*--- error.c ---------------------------------------------------------------*/ + +SR_API const char *sr_strerror(int error_code); +SR_API const char *sr_strerror_name(int error_code); + +/*--- libusbhp.c ------------------------------------------------------------*/ +SR_API int libusbhp_init(struct libusbhp_t **handle); + +SR_API void libusbhp_exit(struct libusbhp_t *handle); + +SR_API int libusbhp_handle_events_timeout(struct libusbhp_t *handle, struct timeval *tv); + +SR_API void libusbhp_register_hotplug_listeners(struct libusbhp_t *handle, + libusbhp_hotplug_cb_fn connected_cb, + libusbhp_hotplug_cb_fn disconnected_cb, + void *user_data); + +/*--- trigger.c ------------------------------------------------------------*/ +SR_API int ds_trigger_init(void); +SR_API int ds_trigger_destroy(void); +SR_API int ds_trigger_stage_set_value(uint16_t stage, uint16_t probes, char *trigger0, char *trigger1); +SR_API int ds_trigger_stage_set_logic(uint16_t stage, uint16_t probes, unsigned char trigger_logic); +SR_API int ds_trigger_stage_set_inv(uint16_t stage, uint16_t probes, unsigned char trigger0_inv, unsigned char trigger1_inv); +SR_API int ds_trigger_stage_set_count(uint16_t stage, uint16_t probes, uint16_t trigger0_count, uint16_t trigger1_count); +SR_API int ds_trigger_probe_set(uint16_t probe, unsigned char trigger0, unsigned char trigger1); +SR_API int ds_trigger_set_stage(uint16_t stages); +SR_API int ds_trigger_set_pos(uint16_t position); +SR_API int ds_trigger_set_en(uint16_t enable); +SR_API int ds_trigger_set_mode(uint16_t mode); + +#endif diff --git a/libsigrok4DSLogic/session.c b/libsigrok4DSLogic/session.c new file mode 100644 index 00000000..29e19085 --- /dev/null +++ b/libsigrok4DSLogic/session.c @@ -0,0 +1,731 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2010-2012 Bert Vermeulen + * + * 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 . + */ + +#include +#include +#include +#include +#include +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "session: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +/** + * @file + * + * Creating, using, or destroying libsigrok sessions. + */ + +/** + * @defgroup grp_session Session handling + * + * Creating, using, or destroying libsigrok sessions. + * + * @{ + */ + +struct source { + int timeout; + sr_receive_data_callback_t cb; + void *cb_data; + + /* This is used to keep track of the object (fd, pollfd or channel) which is + * being polled and will be used to match the source when removing it again. + */ + gintptr poll_object; +}; + +struct datafeed_callback { + sr_datafeed_callback_t cb; + void *cb_data; +}; + +/* There can only be one session at a time. */ +/* 'session' is not static, it's used elsewhere (via 'extern'). */ +struct sr_session *session; + +/** + * Create a new session. + * + * @todo Should it use the file-global "session" variable or take an argument? + * The same question applies to all the other session functions. + * + * @return A pointer to the newly allocated session, or NULL upon errors. + */ +SR_API struct sr_session *sr_session_new(void) +{ + if (!(session = g_try_malloc0(sizeof(struct sr_session)))) { + sr_err("Session malloc failed."); + return NULL; + } + + session->source_timeout = -1; + session->abort_session = FALSE; +// g_mutex_init(&session->stop_mutex); + + return session; +} + +/** + * Destroy the current session. + * + * This frees up all memory used by the session. + * + * @return SR_OK upon success, SR_ERR_BUG if no session exists. + */ +SR_API int sr_session_destroy(void) +{ + if (!session) { + sr_err("%s: session was NULL", __func__); + return SR_ERR_BUG; + } + + sr_session_dev_remove_all(); + + sr_session_datafeed_callback_remove_all(); + + if (session->sources) { + g_free(session->sources); + session->sources = NULL; + } + + if (session->pollfds) { + g_free(session->pollfds); + session->pollfds = NULL; + } + + /* TODO: Error checks needed? */ + +// g_mutex_clear(&session->stop_mutex); + + g_free(session); + session = NULL; + + return SR_OK; +} + +/** + * Remove all the devices from the current session. + * + * The session itself (i.e., the struct sr_session) is not free'd and still + * exists after this function returns. + * + * @return SR_OK upon success, SR_ERR_BUG if no session exists. + */ +SR_API int sr_session_dev_remove_all(void) +{ + if (!session) { + sr_err("%s: session was NULL", __func__); + return SR_ERR_BUG; + } + + g_slist_free(session->devs); + session->devs = NULL; + + return SR_OK; +} + +/** + * Add a device instance to the current session. + * + * @param sdi The device instance to add to the current session. Must not + * be NULL. Also, sdi->driver and sdi->driver->dev_open must + * not be NULL. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments. + */ +SR_API int sr_session_dev_add(const struct sr_dev_inst *sdi) +{ + + if (!sdi) { + sr_err("%s: sdi was NULL", __func__); + return SR_ERR_ARG; + } + + if (!session) { + sr_err("%s: session was NULL", __func__); + return SR_ERR_BUG; + } + + /* If sdi->driver is NULL, this is a virtual device. */ + if (!sdi->driver) { + sr_dbg("%s: sdi->driver was NULL, this seems to be " + "a virtual device; continuing", __func__); + /* Just add the device, don't run dev_open(). */ + session->devs = g_slist_append(session->devs, (gpointer)sdi); + return SR_OK; + } + + /* sdi->driver is non-NULL (i.e. we have a real device). */ + if (!sdi->driver->dev_open) { + sr_err("%s: sdi->driver->dev_open was NULL", __func__); + return SR_ERR_BUG; + } + + session->devs = g_slist_append(session->devs, (gpointer)sdi); + + return SR_OK; +} + +/** + * Remove all datafeed callbacks in the current session. + * + * @return SR_OK upon success, SR_ERR_BUG if no session exists. + */ +SR_API int sr_session_datafeed_callback_remove_all(void) +{ + if (!session) { + sr_err("%s: session was NULL", __func__); + return SR_ERR_BUG; + } + + g_slist_free_full(session->datafeed_callbacks, g_free); + session->datafeed_callbacks = NULL; + + return SR_OK; +} + +/** + * Add a datafeed callback to the current session. + * + * @param cb Function to call when a chunk of data is received. + * Must not be NULL. + * @param cb_data Opaque pointer passed in by the caller. + * + * @return SR_OK upon success, SR_ERR_BUG if no session exists. + */ +SR_API int sr_session_datafeed_callback_add(sr_datafeed_callback_t cb, void *cb_data) +{ + struct datafeed_callback *cb_struct; + + if (!session) { + sr_err("%s: session was NULL", __func__); + return SR_ERR_BUG; + } + + if (!cb) { + sr_err("%s: cb was NULL", __func__); + return SR_ERR_ARG; + } + + if (!(cb_struct = g_try_malloc0(sizeof(struct datafeed_callback)))) + return SR_ERR_MALLOC; + + cb_struct->cb = cb; + cb_struct->cb_data = cb_data; + + session->datafeed_callbacks = + g_slist_append(session->datafeed_callbacks, cb_struct); + + return SR_OK; +} + +static int sr_session_run_poll(void) +{ + unsigned int i; + int ret; + + while (session->num_sources > 0) { + ret = g_poll(session->pollfds, session->num_sources, + session->source_timeout); + for (i = 0; i < session->num_sources; i++) { + if (session->pollfds[i].revents > 0 || (ret == 0 + && session->source_timeout == session->sources[i].timeout)) { + /* + * Invoke the source's callback on an event, + * or if the poll timed out and this source + * asked for that timeout. + */ + if (!session->sources[i].cb(session->pollfds[i].fd, + session->pollfds[i].revents, + session->sources[i].cb_data)) + sr_session_source_remove(session->sources[i].poll_object); + } + /* + * We want to take as little time as possible to stop + * the session if we have been told to do so. Therefore, + * we check the flag after processing every source, not + * just once per main event loop. + */ +// g_mutex_lock(&session->stop_mutex); + if (session->abort_session) { + sr_session_stop_sync(); + /* But once is enough. */ + session->abort_session = FALSE; + } +// g_mutex_unlock(&session->stop_mutex); + } + } + + return SR_OK; +} + +/** + * Start a session. + * + * There can only be one session at a time. + * + * @return SR_OK upon success, SR_ERR upon errors. + */ +SR_API int sr_session_start(void) +{ + struct sr_dev_inst *sdi; + GSList *l; + int ret; + + if (!session) { + sr_err("%s: session was NULL; a session must be " + "created before starting it.", __func__); + return SR_ERR_BUG; + } + + if (!session->devs) { + sr_err("%s: session->devs was NULL; a session " + "cannot be started without devices.", __func__); + return SR_ERR_BUG; + } + + sr_info("Starting."); + + ret = SR_OK; + for (l = session->devs; l; l = l->next) { + sdi = l->data; + if ((ret = sdi->driver->dev_acquisition_start(sdi, sdi)) != SR_OK) { + sr_err("%s: could not start an acquisition " + "(%d)", __func__, ret); + break; + } + } + + /* TODO: What if there are multiple devices? Which return code? */ + + return ret; +} + +/** + * Run the session. + * + * @return SR_OK upon success, SR_ERR_BUG upon errors. + */ +SR_API int sr_session_run(void) +{ + if (!session) { + sr_err("%s: session was NULL; a session must be " + "created first, before running it.", __func__); + return SR_ERR_BUG; + } + + if (!session->devs) { + /* TODO: Actually the case? */ + sr_err("%s: session->devs was NULL; a session " + "cannot be run without devices.", __func__); + return SR_ERR_BUG; + } + + sr_info("Running."); + + /* Do we have real sources? */ + if (session->num_sources == 1 && session->pollfds[0].fd == -1) { + /* Dummy source, freewheel over it. */ + while (session->num_sources) + session->sources[0].cb(-1, 0, session->sources[0].cb_data); + } else { + /* Real sources, use g_poll() main loop. */ + sr_session_run_poll(); + } + + return SR_OK; +} + +/** + * Stop the current session. + * + * The current session is stopped immediately, with all acquisition sessions + * being stopped and hardware drivers cleaned up. + * + * This must be called from within the session thread, to prevent freeing + * resources that the session thread will try to use. + * + * @return SR_OK upon success, SR_ERR_BUG if no session exists. + */ +SR_PRIV int sr_session_stop_sync(void) +{ + struct sr_dev_inst *sdi; + GSList *l; + + if (!session) { + sr_err("%s: session was NULL", __func__); + return SR_ERR_BUG; + } + + sr_info("Stopping."); + + for (l = session->devs; l; l = l->next) { + sdi = l->data; + if (sdi->driver) { + if (sdi->driver->dev_acquisition_stop) + sdi->driver->dev_acquisition_stop(sdi, NULL); + } + } + + return SR_OK; +} + +/** + * Stop the current session. + * + * The current session is stopped immediately, with all acquisition sessions + * being stopped and hardware drivers cleaned up. + * + * If the session is run in a separate thread, this function will not block + * until the session is finished executing. It is the caller's responsibility + * to wait for the session thread to return before assuming that the session is + * completely decommissioned. + * + * @return SR_OK upon success, SR_ERR_BUG if no session exists. + */ +SR_API int sr_session_stop(void) +{ + if (!session) { + sr_err("%s: session was NULL", __func__); + return SR_ERR_BUG; + } + +// g_mutex_lock(&session->stop_mutex); + session->abort_session = TRUE; +// g_mutex_unlock(&session->stop_mutex); + + return SR_OK; +} + +/** + * Debug helper. + * + * @param packet The packet to show debugging information for. + */ +static void datafeed_dump(const struct sr_datafeed_packet *packet) +{ + const struct sr_datafeed_logic *logic; + const struct sr_datafeed_analog *analog; + + switch (packet->type) { + case SR_DF_HEADER: + sr_dbg("bus: Received SR_DF_HEADER packet."); + break; + case SR_DF_TRIGGER: + sr_dbg("bus: Received SR_DF_TRIGGER packet."); + break; + case SR_DF_META: + sr_dbg("bus: Received SR_DF_META packet."); + break; + case SR_DF_LOGIC: + logic = packet->payload; + sr_dbg("bus: Received SR_DF_LOGIC packet (%" PRIu64 " bytes).", + logic->length); + break; + case SR_DF_ANALOG: + analog = packet->payload; + sr_dbg("bus: Received SR_DF_ANALOG packet (%d samples).", + analog->num_samples); + break; + case SR_DF_END: + sr_dbg("bus: Received SR_DF_END packet."); + break; + case SR_DF_FRAME_BEGIN: + sr_dbg("bus: Received SR_DF_FRAME_BEGIN packet."); + break; + case SR_DF_FRAME_END: + sr_dbg("bus: Received SR_DF_FRAME_END packet."); + break; + default: + sr_dbg("bus: Received unknown packet type: %d.", packet->type); + break; + } +} + +/** + * Send a packet to whatever is listening on the datafeed bus. + * + * Hardware drivers use this to send a data packet to the frontend. + * + * @param sdi TODO. + * @param packet The datafeed packet to send to the session bus. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments. + * + * @private + */ +SR_PRIV int sr_session_send(const struct sr_dev_inst *sdi, + const struct sr_datafeed_packet *packet) +{ + GSList *l; + struct datafeed_callback *cb_struct; + + if (!sdi) { + sr_err("%s: sdi was NULL", __func__); + return SR_ERR_ARG; + } + + if (!packet) { + sr_err("%s: packet was NULL", __func__); + return SR_ERR_ARG; + } + + for (l = session->datafeed_callbacks; l; l = l->next) { + if (sr_log_loglevel_get() >= SR_LOG_DBG) + datafeed_dump(packet); + cb_struct = l->data; + cb_struct->cb(sdi, packet, cb_struct->cb_data); + } + + return SR_OK; +} + +/** + * Add an event source for a file descriptor. + * + * @param pollfd The GPollFD. + * @param timeout Max time to wait before the callback is called, ignored if 0. + * @param cb Callback function to add. Must not be NULL. + * @param cb_data Data for the callback function. Can be NULL. + * @param poll_object TODO. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or + * SR_ERR_MALLOC upon memory allocation errors. + */ +static int _sr_session_source_add(GPollFD *pollfd, int timeout, + sr_receive_data_callback_t cb, const struct sr_dev_inst *sdi, gintptr poll_object) +{ + struct source *new_sources, *s; + GPollFD *new_pollfds; + + if (!cb) { + sr_err("%s: cb was NULL", __func__); + return SR_ERR_ARG; + } + + /* Note: cb_data can be NULL, that's not a bug. */ + + new_pollfds = g_try_realloc(session->pollfds, + sizeof(GPollFD) * (session->num_sources + 1)); + if (!new_pollfds) { + sr_err("%s: new_pollfds malloc failed", __func__); + return SR_ERR_MALLOC; + } + + new_sources = g_try_realloc(session->sources, sizeof(struct source) * + (session->num_sources + 1)); + if (!new_sources) { + sr_err("%s: new_sources malloc failed", __func__); + return SR_ERR_MALLOC; + } + + new_pollfds[session->num_sources] = *pollfd; + s = &new_sources[session->num_sources++]; + s->timeout = timeout; + s->cb = cb; + s->cb_data = sdi; + s->poll_object = poll_object; + session->pollfds = new_pollfds; + session->sources = new_sources; + + if (timeout != session->source_timeout && timeout > 0 + && (session->source_timeout == -1 || timeout < session->source_timeout)) + session->source_timeout = timeout; + + return SR_OK; +} + +/** + * Add an event source for a file descriptor. + * + * @param fd The file descriptor. + * @param events Events to check for. + * @param timeout Max time to wait before the callback is called, ignored if 0. + * @param cb Callback function to add. Must not be NULL. + * @param cb_data Data for the callback function. Can be NULL. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or + * SR_ERR_MALLOC upon memory allocation errors. + */ +SR_API int sr_session_source_add(int fd, int events, int timeout, + sr_receive_data_callback_t cb, const struct sr_dev_inst *sdi) +{ + GPollFD p; + + p.fd = fd; + p.events = events; + + return _sr_session_source_add(&p, timeout, cb, sdi, (gintptr)fd); +} + +/** + * Add an event source for a GPollFD. + * + * @param pollfd The GPollFD. + * @param timeout Max time to wait before the callback is called, ignored if 0. + * @param cb Callback function to add. Must not be NULL. + * @param cb_data Data for the callback function. Can be NULL. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or + * SR_ERR_MALLOC upon memory allocation errors. + */ +SR_API int sr_session_source_add_pollfd(GPollFD *pollfd, int timeout, + sr_receive_data_callback_t cb, const struct sr_dev_inst *sdi) +{ + return _sr_session_source_add(pollfd, timeout, cb, + sdi, (gintptr)pollfd); +} + +/** + * Add an event source for a GIOChannel. + * + * @param channel The GIOChannel. + * @param events Events to poll on. + * @param timeout Max time to wait before the callback is called, ignored if 0. + * @param cb Callback function to add. Must not be NULL. + * @param cb_data Data for the callback function. Can be NULL. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or + * SR_ERR_MALLOC upon memory allocation errors. + */ +SR_API int sr_session_source_add_channel(GIOChannel *channel, int events, + int timeout, sr_receive_data_callback_t cb, const struct sr_dev_inst *sdi) +{ + GPollFD p; + +#ifdef _WIN32 + g_io_channel_win32_make_pollfd(channel, events, &p); +#else + p.fd = g_io_channel_unix_get_fd(channel); + p.events = events; +#endif + + return _sr_session_source_add(&p, timeout, cb, sdi, (gintptr)channel); +} + +/** + * Remove the source belonging to the specified channel. + * + * @todo Add more error checks and logging. + * + * @param channel The channel for which the source should be removed. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or + * SR_ERR_MALLOC upon memory allocation errors, SR_ERR_BUG upon + * internal errors. + */ +static int _sr_session_source_remove(gintptr poll_object) +{ + struct source *new_sources; + GPollFD *new_pollfds; + unsigned int old; + + if (!session->sources || !session->num_sources) { + sr_err("%s: sources was NULL", __func__); + return SR_ERR_BUG; + } + + for (old = 0; old < session->num_sources; old++) { + if (session->sources[old].poll_object == poll_object) + break; + } + + /* fd not found, nothing to do */ + if (old == session->num_sources) + return SR_OK; + + session->num_sources -= 1; + + if (old != session->num_sources) { + memmove(&session->pollfds[old], &session->pollfds[old+1], + (session->num_sources - old) * sizeof(GPollFD)); + memmove(&session->sources[old], &session->sources[old+1], + (session->num_sources - old) * sizeof(struct source)); + } + + new_pollfds = g_try_realloc(session->pollfds, sizeof(GPollFD) * session->num_sources); + if (!new_pollfds && session->num_sources > 0) { + sr_err("%s: new_pollfds malloc failed", __func__); + return SR_ERR_MALLOC; + } + + new_sources = g_try_realloc(session->sources, sizeof(struct source) * session->num_sources); + if (!new_sources && session->num_sources > 0) { + sr_err("%s: new_sources malloc failed", __func__); + return SR_ERR_MALLOC; + } + + session->pollfds = new_pollfds; + session->sources = new_sources; + + return SR_OK; +} + +/** + * Remove the source belonging to the specified file descriptor. + * + * @param fd The file descriptor for which the source should be removed. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or + * SR_ERR_MALLOC upon memory allocation errors, SR_ERR_BUG upon + * internal errors. + */ +SR_API int sr_session_source_remove(int fd) +{ + return _sr_session_source_remove((gintptr)fd); +} + +/** + * Remove the source belonging to the specified poll descriptor. + * + * @param pollfd The poll descriptor for which the source should be removed. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or + * SR_ERR_MALLOC upon memory allocation errors, SR_ERR_BUG upon + * internal errors. + */ +SR_API int sr_session_source_remove_pollfd(GPollFD *pollfd) +{ + return _sr_session_source_remove((gintptr)pollfd); +} + +/** + * Remove the source belonging to the specified channel. + * + * @param channel The channel for which the source should be removed. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or + * SR_ERR_MALLOC upon memory allocation errors, SR_ERR_BUG upon + * internal errors. + */ +SR_API int sr_session_source_remove_channel(GIOChannel *channel) +{ + return _sr_session_source_remove((gintptr)channel); +} + +/** @} */ diff --git a/libsigrok4DSLogic/session_driver.c b/libsigrok4DSLogic/session_driver.c new file mode 100644 index 00000000..b040c072 --- /dev/null +++ b/libsigrok4DSLogic/session_driver.c @@ -0,0 +1,286 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2013 Bert Vermeulen + * + * 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 . + */ + +#include +#include +#include +#include +#include +#include +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "virtual-session: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +/* size of payloads sent across the session bus */ +/** @cond PRIVATE */ +#define CHUNKSIZE (512 * 1024) +/** @endcond */ + +struct session_vdev { + char *sessionfile; + char *capturefile; + struct zip *archive; + struct zip_file *capfile; + int bytes_read; + uint64_t samplerate; + uint64_t total_samples; + int unitsize; + int num_probes; +}; + +static GSList *dev_insts = NULL; +static const int hwcaps[] = { + SR_CONF_CAPTUREFILE, + SR_CONF_CAPTURE_UNITSIZE, + 0, +}; + +static int receive_data(int fd, int revents, const struct sr_dev_inst *cb_sdi) +{ + struct sr_dev_inst *sdi; + struct session_vdev *vdev; + struct sr_datafeed_packet packet; + struct sr_datafeed_logic logic; + GSList *l; + void *buf; + int ret, got_data; + + (void)fd; + (void)revents; + + sr_dbg("Feed chunk."); + + got_data = FALSE; + for (l = dev_insts; l; l = l->next) { + sdi = l->data; + vdev = sdi->priv; + if (!vdev) + /* already done with this instance */ + continue; + + if (!(buf = g_try_malloc(CHUNKSIZE))) { + sr_err("%s: buf malloc failed", __func__); + return FALSE; + } + + ret = zip_fread(vdev->capfile, buf, CHUNKSIZE); + if (ret > 0) { + got_data = TRUE; + packet.type = SR_DF_LOGIC; + packet.payload = &logic; + logic.length = ret; + logic.unitsize = vdev->unitsize; + logic.data = buf; + vdev->bytes_read += ret; + sr_session_send(cb_sdi, &packet); + } else { + /* done with this capture file */ + zip_fclose(vdev->capfile); + g_free(vdev->capturefile); + g_free(vdev); + sdi->priv = NULL; + } + } + + if (!got_data) { + packet.type = SR_DF_END; + sr_session_send(cb_sdi, &packet); + sr_session_source_remove(-1); + } + + return TRUE; +} + +/* driver callbacks */ +static int hw_cleanup(void); + +static int hw_init(struct sr_context *sr_ctx) +{ + (void)sr_ctx; + + return SR_OK; +} + +static int hw_cleanup(void) +{ + GSList *l; + + for (l = dev_insts; l; l = l->next) + sr_dev_inst_free(l->data); + g_slist_free(dev_insts); + dev_insts = NULL; + + return SR_OK; +} + +static int hw_dev_open(struct sr_dev_inst *sdi) +{ + if (!(sdi->priv = g_try_malloc0(sizeof(struct session_vdev)))) { + sr_err("%s: sdi->priv malloc failed", __func__); + return SR_ERR_MALLOC; + } + + dev_insts = g_slist_append(dev_insts, sdi); + + return SR_OK; +} + +static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi) +{ + struct session_vdev *vdev; + + switch (id) { + case SR_CONF_SAMPLERATE: + if (sdi) { + vdev = sdi->priv; + *data = g_variant_new_uint64(vdev->samplerate); + } else + return SR_ERR; + break; + case SR_CONF_LIMIT_SAMPLES: + if (sdi) { + vdev = sdi->priv; + *data = g_variant_new_uint64(vdev->total_samples); + } else + return SR_ERR; + break; + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + +static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi) +{ + struct session_vdev *vdev; + + vdev = sdi->priv; + + switch (id) { + case SR_CONF_SAMPLERATE: + vdev->samplerate = g_variant_get_uint64(data); + sr_info("Setting samplerate to %" PRIu64 ".", vdev->samplerate); + break; + case SR_CONF_SESSIONFILE: + vdev->sessionfile = g_strdup(g_variant_get_string(data, NULL)); + sr_info("Setting sessionfile to '%s'.", vdev->sessionfile); + break; + case SR_CONF_CAPTUREFILE: + vdev->capturefile = g_strdup(g_variant_get_string(data, NULL)); + sr_info("Setting capturefile to '%s'.", vdev->capturefile); + break; + case SR_CONF_CAPTURE_UNITSIZE: + vdev->unitsize = g_variant_get_uint64(data); + break; + case SR_CONF_LIMIT_SAMPLES: + vdev->total_samples = g_variant_get_uint64(data); + break; + case SR_CONF_CAPTURE_NUM_PROBES: + vdev->num_probes = g_variant_get_uint64(data); + break; + default: + sr_err("Unknown capability: %d.", id); + return SR_ERR; + } + + return SR_OK; +} + +static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi) +{ + + (void)sdi; + + switch (key) { + case SR_CONF_DEVICE_OPTIONS: +// *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, +// hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_from_data(G_VARIANT_TYPE("ai"), + hwcaps, ARRAY_SIZE(hwcaps)*sizeof(int32_t), TRUE, NULL, NULL); + break; + default: + return SR_ERR_ARG; + } + + return SR_OK; +} + +static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, + void *cb_data) +{ + struct zip_stat zs; + struct session_vdev *vdev; + int ret; + + vdev = sdi->priv; + + sr_info("Opening archive %s file %s", vdev->sessionfile, + vdev->capturefile); + + if (!(vdev->archive = zip_open(vdev->sessionfile, 0, &ret))) { + sr_err("Failed to open session file '%s': " + "zip error %d\n", vdev->sessionfile, ret); + return SR_ERR; + } + + if (zip_stat(vdev->archive, vdev->capturefile, 0, &zs) == -1) { + sr_err("Failed to check capture file '%s' in " + "session file '%s'.", vdev->capturefile, vdev->sessionfile); + return SR_ERR; + } + + if (!(vdev->capfile = zip_fopen(vdev->archive, vdev->capturefile, 0))) { + sr_err("Failed to open capture file '%s' in " + "session file '%s'.", vdev->capturefile, vdev->sessionfile); + return SR_ERR; + } + + /* Send header packet to the session bus. */ + std_session_send_df_header(sdi, LOG_PREFIX); + + /* freewheeling source */ + sr_session_source_add(-1, 0, 0, receive_data, sdi); + + return SR_OK; +} + +/** @private */ +SR_PRIV struct sr_dev_driver session_driver = { + .name = "virtual-session", + .longname = "Session-emulating driver", + .api_version = 1, + .init = hw_init, + .cleanup = hw_cleanup, + .config_get = config_get, + .config_set = config_set, + .config_list = config_list, + .dev_open = hw_dev_open, + .dev_close = NULL, + .dev_acquisition_start = hw_dev_acquisition_start, + .dev_acquisition_stop = NULL, +}; diff --git a/libsigrok4DSLogic/session_file.c b/libsigrok4DSLogic/session_file.c new file mode 100644 index 00000000..43ba01c3 --- /dev/null +++ b/libsigrok4DSLogic/session_file.c @@ -0,0 +1,286 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2013 Bert Vermeulen + * + * 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 . + */ + +#include +#include +#include +#include +#include +#include +#include "config.h" /* Needed for PACKAGE_VERSION and others. */ +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "session-file: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +/** + * @file + * + * Loading and saving libsigrok session files. + */ + +/** + * @addtogroup grp_session + * + * @{ + */ + +extern struct sr_session *session; +extern SR_PRIV struct sr_dev_driver session_driver; + +/** + * Load the session from the specified filename. + * + * @param filename The name of the session file to load. Must not be NULL. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, + * SR_ERR_MALLOC upon memory allocation errors, or SR_ERR upon + * other errors. + */ +SR_API int sr_session_load(const char *filename) +{ + GKeyFile *kf; + GPtrArray *capturefiles; + struct zip *archive; + struct zip_file *zf; + struct zip_stat zs; + struct sr_dev_inst *sdi; + struct sr_probe *probe; + int ret, probenum, devcnt, version, i, j; + uint64_t tmp_u64, total_probes, enabled_probes, p; + char **sections, **keys, *metafile, *val, s[11]; + char probename[SR_MAX_PROBENAME_LEN + 1]; + + if (!filename) { + sr_err("%s: filename was NULL", __func__); + return SR_ERR_ARG; + } + + if (!(archive = zip_open(filename, 0, &ret))) { + sr_dbg("Failed to open session file: zip error %d", ret); + return SR_ERR; + } + + /* read "metadata" */ + if (zip_stat(archive, "header", 0, &zs) == -1) { + sr_dbg("Not a valid DSLogic session file."); + return SR_ERR; + } + + if (!(metafile = g_try_malloc(zs.size))) { + sr_err("%s: metafile malloc failed", __func__); + return SR_ERR_MALLOC; + } + + zf = zip_fopen_index(archive, zs.index, 0); + zip_fread(zf, metafile, zs.size); + zip_fclose(zf); + + kf = g_key_file_new(); + if (!g_key_file_load_from_data(kf, metafile, zs.size, 0, NULL)) { + sr_dbg("Failed to parse metadata."); + return SR_ERR; + } + + sr_session_new(); + + devcnt = 0; + capturefiles = g_ptr_array_new_with_free_func(g_free); + sections = g_key_file_get_groups(kf, NULL); + for (i = 0; sections[i]; i++) { + if (!strcmp(sections[i], "version")) + /* nothing really interesting in here yet */ + continue; + if (!strncmp(sections[i], "header", 6)) { + /* device section */ + sdi = NULL; + enabled_probes = total_probes = 0; + keys = g_key_file_get_keys(kf, sections[i], NULL, NULL); + for (j = 0; keys[j]; j++) { + val = g_key_file_get_string(kf, sections[i], keys[j], NULL); + if (!strcmp(keys[j], "capturefile")) { + sdi = sr_dev_inst_new(LOGIC, devcnt, SR_ST_ACTIVE, NULL, NULL, NULL); + sdi->driver = &session_driver; + if (devcnt == 0) + /* first device, init the driver */ + sdi->driver->init(NULL); + sr_dev_open(sdi); + sr_session_dev_add(sdi); + sdi->driver->config_set(SR_CONF_SESSIONFILE, + g_variant_new_string(filename), sdi); + sdi->driver->config_set(SR_CONF_CAPTUREFILE, + g_variant_new_string(val), sdi); + g_ptr_array_add(capturefiles, val); + } else if (!strcmp(keys[j], "samplerate")) { + sr_parse_sizestring(val, &tmp_u64); + sdi->driver->config_set(SR_CONF_SAMPLERATE, + g_variant_new_uint64(tmp_u64), sdi); + } else if (!strcmp(keys[j], "unitsize")) { + tmp_u64 = strtoull(val, NULL, 10); + sdi->driver->config_set(SR_CONF_CAPTURE_UNITSIZE, + g_variant_new_uint64(tmp_u64), sdi); + } else if (!strcmp(keys[j], "total samples")) { + tmp_u64 = strtoull(val, NULL, 10); + sdi->driver->config_set(SR_CONF_LIMIT_SAMPLES, + g_variant_new_uint64(tmp_u64), sdi); + } else if (!strcmp(keys[j], "total probes")) { + total_probes = strtoull(val, NULL, 10); + sdi->driver->config_set(SR_CONF_CAPTURE_NUM_PROBES, + g_variant_new_uint64(total_probes), sdi); + for (p = 0; p < total_probes; p++) { + snprintf(probename, SR_MAX_PROBENAME_LEN, "%" PRIu64, p); + if (!(probe = sr_probe_new(p, SR_PROBE_LOGIC, TRUE, + probename))) + return SR_ERR; + sdi->probes = g_slist_append(sdi->probes, probe); + } + } else if (!strncmp(keys[j], "probe", 5)) { + if (!sdi) + continue; + enabled_probes++; + tmp_u64 = strtoul(keys[j]+5, NULL, 10); + /* sr_session_save() */ + sr_dev_probe_name_set(sdi, tmp_u64 - 1, val); + } else if (!strncmp(keys[j], "trigger", 7)) { + probenum = strtoul(keys[j]+7, NULL, 10); + sr_dev_trigger_set(sdi, probenum, val); + } + } + g_strfreev(keys); + /* Disable probes not specifically listed. */ + if (total_probes) + for (p = enabled_probes; p < total_probes; p++) + sr_dev_probe_enable(sdi, p, FALSE); + } + devcnt++; + } + g_strfreev(sections); + g_key_file_free(kf); + + return SR_OK; +} + +/** + * Save the current session to the specified file. + * + * @param filename The name of the filename to save the current session as. + * Must not be NULL. + * @param sdi The device instance from which the data was captured. + * @param buf The data to be saved. + * @param unitsize The number of bytes per sample. + * @param units The number of samples. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or SR_ERR + * upon other errors. + */ +SR_API int sr_session_save(const char *filename, const struct sr_dev_inst *sdi, + unsigned char *buf, int unitsize, int units) +{ + GSList *l; + GVariant *gvar; + FILE *meta; + struct sr_probe *probe; + struct zip *zipfile; + struct zip_source *versrc, *metasrc, *logicsrc; + int tmpfile, ret, probecnt; + uint64_t samplerate; + char rawname[16], metafile[32], *s; + + if (!filename) { + sr_err("%s: filename was NULL", __func__); + return SR_ERR_ARG; + } + + /* Quietly delete it first, libzip wants replace ops otherwise. */ + unlink(filename); + if (!(zipfile = zip_open(filename, ZIP_CREATE, &ret))) + return SR_ERR; + + /* init "metadata" */ + strcpy(metafile, "DSLogic-meta-XXXXXX"); + if ((tmpfile = g_mkstemp(metafile)) == -1) + return SR_ERR; + close(tmpfile); + meta = g_fopen(metafile, "wb"); + fprintf(meta, "[version]\n"); + fprintf(meta, "DSLogic version = %s\n", PACKAGE_VERSION); + + /* metadata */ + fprintf(meta, "[header]\n"); + if (sdi->driver) + fprintf(meta, "driver = %s\n", sdi->driver->name); + + /* metadata */ + fprintf(meta, "capturefile = data\n"); + fprintf(meta, "unitsize = %d\n", unitsize); + fprintf(meta, "total samples = %d\n", units); + fprintf(meta, "total probes = %d\n", g_slist_length(sdi->probes)); + if (sr_dev_has_option(sdi, SR_CONF_SAMPLERATE)) { + if (sr_config_get(sdi->driver, SR_CONF_SAMPLERATE, + &gvar, sdi) == SR_OK) { + samplerate = g_variant_get_uint64(gvar); + s = sr_samplerate_string(samplerate); + fprintf(meta, "samplerate = %s\n", s); + g_free(s); + g_variant_unref(gvar); + } + } + probecnt = 1; + for (l = sdi->probes; l; l = l->next) { + probe = l->data; + if (probe->enabled) { + if (probe->name) + fprintf(meta, "probe%d = %s\n", probecnt, probe->name); + if (probe->trigger) + fprintf(meta, " trigger%d = %s\n", probecnt, probe->trigger); + probecnt++; + } + } + + if (!(logicsrc = zip_source_buffer(zipfile, buf, + units * unitsize, FALSE))) + return SR_ERR; + snprintf(rawname, 15, "data"); + if (zip_add(zipfile, rawname, logicsrc) == -1) + return SR_ERR; + fclose(meta); + + if (!(metasrc = zip_source_file(zipfile, metafile, 0, -1))) + return SR_ERR; + if (zip_add(zipfile, "header", metasrc) == -1) + return SR_ERR; + + if ((ret = zip_close(zipfile)) == -1) { + sr_info("error saving zipfile: %s", zip_strerror(zipfile)); + return SR_ERR; + } + + unlink(metafile); + + return SR_OK; +} + +/** @} */ diff --git a/libsigrok4DSLogic/std.c b/libsigrok4DSLogic/std.c new file mode 100644 index 00000000..cfe031d9 --- /dev/null +++ b/libsigrok4DSLogic/std.c @@ -0,0 +1,225 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2013 Uwe Hermann + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/** + * Standard sr_driver_init() API helper. + * + * This function can be used to simplify most driver's hw_init() API callback. + * + * It creates a new 'struct drv_context' (drvc), assigns sr_ctx to it, and + * then 'drvc' is assigned to the 'struct sr_dev_driver' (di) that is passed. + * + * @param sr_ctx The libsigrok context to assign. + * @param di The driver instance to use. + * @param prefix A driver-specific prefix string used for log messages. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or + * SR_ERR_MALLOC upon memory allocation errors. + */ +SR_PRIV int std_hw_init(struct sr_context *sr_ctx, struct sr_dev_driver *di, + const char *prefix) +{ + struct drv_context *drvc; + + if (!di) { + sr_err("%sInvalid driver, cannot initialize.", prefix); + return SR_ERR_ARG; + } + + if (!(drvc = g_try_malloc(sizeof(struct drv_context)))) { + sr_err("%sDriver context malloc failed.", prefix); + return SR_ERR_MALLOC; + } + + drvc->sr_ctx = sr_ctx; + drvc->instances = NULL; + di->priv = drvc; + + return SR_OK; +} + +/** + * Standard API helper for sending an SR_DF_HEADER packet. + * + * This function can be used to simplify most driver's + * hw_dev_acquisition_start() API callback. + * + * @param sdi The device instance to use. + * @param prefix A driver-specific prefix string used for log messages. + * Must not be NULL. An empty string is allowed. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or + * SR_ERR upon other errors. + */ +SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi, + const char *prefix) +{ + int ret; + struct sr_datafeed_packet packet; + struct sr_datafeed_header header; + + if (!prefix) { + sr_err("Invalid prefix."); + return SR_ERR_ARG; + } + + sr_dbg("%sStarting acquisition.", prefix); + + /* Send header packet to the session bus. */ + sr_dbg("%sSending SR_DF_HEADER packet.", prefix); + packet.type = SR_DF_HEADER; + packet.payload = (uint8_t *)&header; + header.feed_version = 1; + gettimeofday(&header.starttime, NULL); + + if ((ret = sr_session_send(sdi, &packet)) < 0) { + sr_err("%sFailed to send header packet: %d.", prefix, ret); + return ret; + } + + return SR_OK; +} + +/* + * Standard sr_session_stop() API helper. + * + * This function can be used to simplify most (serial port based) driver's + * hw_dev_acquisition_stop() API callback. + * + * @param sdi The device instance for which acquisition should stop. + * Must not be NULL. + * @param cb_data Opaque 'cb_data' pointer. Must not be NULL. + * @param hw_dev_close_fn Function pointer to the driver's hw_dev_close(). + * Must not be NULL. + * @param serial The serial device instance (struct serial_dev_inst *). + * Must not be NULL. + * @param prefix A driver-specific prefix string used for log messages. + * Must not be NULL. An empty string is allowed. + * + * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments, or + * SR_ERR upon other errors. + */ +SR_PRIV int std_hw_dev_acquisition_stop_serial(struct sr_dev_inst *sdi, + void *cb_data, dev_close_t hw_dev_close_fn, + struct sr_serial_dev_inst *serial, const char *prefix) +{ + int ret; + struct sr_datafeed_packet packet; + + if (!prefix) { + sr_err("Invalid prefix."); + return SR_ERR_ARG; + } + + if (sdi->status != SR_ST_ACTIVE) { + sr_err("%sDevice inactive, can't stop acquisition.", prefix); + return SR_ERR; + } + + sr_dbg("%sStopping acquisition.", prefix); + + if ((ret = sr_source_remove(serial->fd)) < 0) { + sr_err("%sFailed to remove source: %d.", prefix, ret); + return ret; + } + + if ((ret = hw_dev_close_fn(sdi)) < 0) { + sr_err("%sFailed to close device: %d.", prefix, ret); + return ret; + } + + /* Send SR_DF_END packet to the session bus. */ + sr_dbg("%sSending SR_DF_END packet.", prefix); + packet.type = SR_DF_END; + packet.payload = NULL; + if ((ret = sr_session_send(cb_data, &packet)) < 0) { + sr_err("%sFailed to send SR_DF_END packet: %d.", prefix, ret); + return ret; + } + + return SR_OK; +} + +/* + * Standard driver dev_clear() helper. + * + * This function can be used to implement the dev_clear() driver API + * callback. dev_close() is called before every sr_dev_inst is cleared. + * + * The only limitation is driver-specific device contexts (sdi->priv). + * These are freed, but any dynamic allocation within structs stored + * there cannot be freed. + * + * @param driver The driver which will have its instances released. + * + * @return SR_OK on success. + */ +SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver, + std_dev_clear_t clear_private) +{ + struct sr_dev_inst *sdi; + struct drv_context *drvc; + struct dev_context *devc; + GSList *l; + int ret; + + if (!(drvc = driver->priv)) + /* Driver was never initialized, nothing to do. */ + return SR_OK; + + ret = SR_OK; + for (l = drvc->instances; l; l = l->next) { + /* Log errors, but continue cleaning up the rest. */ + if (!(sdi = l->data)) { + ret = SR_ERR_BUG; + continue; + } + if (!(devc = sdi->priv)) { + ret = SR_ERR_BUG; + continue; + } + if (driver->dev_close) + driver->dev_close(sdi); + + if (sdi->conn) { + if (sdi->inst_type == SR_INST_USB) +#if HAVE_LIBUSB_1_0 + sr_usb_dev_inst_free(sdi->conn); +#else + ; +#endif + else if (sdi->inst_type == SR_INST_SERIAL) + sr_serial_dev_inst_free(sdi->conn); + } + if (clear_private) + clear_private(sdi->priv); + sdi = l->data; + sr_dev_inst_free(sdi); + } + + g_slist_free(drvc->instances); + drvc->instances = NULL; + + return ret; +} diff --git a/libsigrok4DSLogic/strutil.c b/libsigrok4DSLogic/strutil.c new file mode 100644 index 00000000..b7b0af16 --- /dev/null +++ b/libsigrok4DSLogic/strutil.c @@ -0,0 +1,454 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2010 Uwe Hermann + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "strutil: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +/** + * @file + * + * Helper functions for handling or converting libsigrok-related strings. + */ + +/** + * @defgroup grp_strutil String utilities + * + * Helper functions for handling or converting libsigrok-related strings. + * + * @{ + */ + +/** + * Convert a numeric value value to its "natural" string representation. + * in SI units + * + * E.g. a value of 3000000, with units set to "W", would be converted + * to "3 MW", 20000 to "20 kW", 31500 would become "31.5 kW". + * + * @param x The value to convert. + * @param unit The unit to append to the string, or NULL if the string + * has no units. + * + * @return A g_try_malloc()ed string representation of the samplerate value, + * or NULL upon errors. The caller is responsible to g_free() the + * memory. + */ +SR_API char *sr_si_string_u64(uint64_t x, const char *unit) +{ + if (unit == NULL) + unit = ""; + + if ((x >= SR_GHZ(1)) && (x % SR_GHZ(1) == 0)) { + return g_strdup_printf("%" PRIu64 " G%s", x / SR_GHZ(1), unit); + } else if ((x >= SR_GHZ(1)) && (x % SR_GHZ(1) != 0)) { + return g_strdup_printf("%" PRIu64 ".%" PRIu64 " G%s", + x / SR_GHZ(1), x % SR_GHZ(1), unit); + } else if ((x >= SR_MHZ(1)) && (x % SR_MHZ(1) == 0)) { + return g_strdup_printf("%" PRIu64 " M%s", + x / SR_MHZ(1), unit); + } else if ((x >= SR_MHZ(1)) && (x % SR_MHZ(1) != 0)) { + return g_strdup_printf("%" PRIu64 ".%" PRIu64 " M%s", + x / SR_MHZ(1), x % SR_MHZ(1), unit); + } else if ((x >= SR_KHZ(1)) && (x % SR_KHZ(1) == 0)) { + return g_strdup_printf("%" PRIu64 " k%s", + x / SR_KHZ(1), unit); + } else if ((x >= SR_KHZ(1)) && (x % SR_KHZ(1) != 0)) { + return g_strdup_printf("%" PRIu64 ".%" PRIu64 " k%s", + x / SR_KHZ(1), x % SR_KHZ(1), unit); + } else { + return g_strdup_printf("%" PRIu64 " %s", x, unit); + } + + sr_err("%s: Error creating SI units string.", __func__); + return NULL; +} + +/** + * Convert a numeric samplerate value to its "natural" string representation. + * + * E.g. a value of 3000000 would be converted to "3 MHz", 20000 to "20 kHz", + * 31500 would become "31.5 kHz". + * + * @param samplerate The samplerate in Hz. + * + * @return A g_try_malloc()ed string representation of the samplerate value, + * or NULL upon errors. The caller is responsible to g_free() the + * memory. + */ +SR_API char *sr_samplerate_string(uint64_t samplerate) +{ + return sr_si_string_u64(samplerate, "Hz"); +} + +/** + * Convert a numeric frequency value to the "natural" string representation + * of its period. + * + * E.g. a value of 3000000 would be converted to "3 us", 20000 to "50 ms". + * + * @param frequency The frequency in Hz. + * + * @return A g_try_malloc()ed string representation of the frequency value, + * or NULL upon errors. The caller is responsible to g_free() the + * memory. + */ +SR_API char *sr_period_string(uint64_t frequency) +{ + char *o; + int r; + + /* Allocate enough for a uint64_t as string + " ms". */ + if (!(o = g_try_malloc0(30 + 1))) { + sr_err("%s: o malloc failed", __func__); + return NULL; + } + + if (frequency >= SR_GHZ(1)) + r = snprintf(o, 30, "%" PRIu64 " ns", frequency / 1000000000); + else if (frequency >= SR_MHZ(1)) + r = snprintf(o, 30, "%" PRIu64 " us", frequency / 1000000); + else if (frequency >= SR_KHZ(1)) + r = snprintf(o, 30, "%" PRIu64 " ms", frequency / 1000); + else + r = snprintf(o, 30, "%" PRIu64 " s", frequency); + + if (r < 0) { + /* Something went wrong... */ + g_free(o); + return NULL; + } + + return o; +} + +/** + * Convert a numeric voltage value to the "natural" string representation + * of its voltage value. The voltage is specified as a rational number's + * numerator and denominator. + * + * E.g. a value of 300000 would be converted to "300mV", 2 to "2V". + * + * @param v_p The voltage numerator. + * @param v_q The voltage denominator. + * + * @return A g_try_malloc()ed string representation of the voltage value, + * or NULL upon errors. The caller is responsible to g_free() the + * memory. + */ +SR_API char *sr_voltage_string(uint64_t v_p, uint64_t v_q) +{ + int r; + char *o; + + if (!(o = g_try_malloc0(30 + 1))) { + sr_err("%s: o malloc failed", __func__); + return NULL; + } + + if (v_q == 1000) + r = snprintf(o, 30, "%" PRIu64 "mV", v_p); + else if (v_q == 1) + r = snprintf(o, 30, "%" PRIu64 "V", v_p); + else + r = snprintf(o, 30, "%gV", (float)v_p / (float)v_q); + + if (r < 0) { + /* Something went wrong... */ + g_free(o); + return NULL; + } + + return o; +} + +/** + * Parse a trigger specification string. + * + * @param sdi The device instance for which the trigger specification is + * intended. Must not be NULL. Also, sdi->driver and + * sdi->driver->info_get must not be NULL. + * @param triggerstring The string containing the trigger specification for + * one or more probes of this device. Entries for multiple probes are + * comma-separated. Triggers are specified in the form key=value, + * where the key is a probe number (or probe name) and the value is + * the requested trigger type. Valid trigger types currently + * include 'r' (rising edge), 'f' (falling edge), 'c' (any pin value + * change), '0' (low value), or '1' (high value). + * Example: "1=r,sck=f,miso=0,7=c" + * + * @return Pointer to a list of trigger types (strings), or NULL upon errors. + * The pointer list (if non-NULL) has as many entries as the + * respective device has probes (all physically available probes, + * not just enabled ones). Entries of the list which don't have + * a trigger value set in 'triggerstring' are NULL, the other entries + * contain the respective trigger type which is requested for the + * respective probe (e.g. "r", "c", and so on). + */ +SR_API char **sr_parse_triggerstring(const struct sr_dev_inst *sdi, + const char *triggerstring) +{ + GSList *l; + GVariant *gvar; + struct sr_probe *probe; + int max_probes, probenum, i; + char **tokens, **triggerlist, *trigger, *tc; + const char *trigger_types; + gboolean error; + + max_probes = g_slist_length(sdi->probes); + error = FALSE; + + if (!(triggerlist = g_try_malloc0(max_probes * sizeof(char *)))) { + sr_err("%s: triggerlist malloc failed", __func__); + return NULL; + } + + if (sdi->driver->config_list(SR_CONF_TRIGGER_TYPE, &gvar, sdi) != SR_OK) { + sr_err("%s: Device doesn't support any triggers.", __func__); + return NULL; + } + trigger_types = g_variant_get_string(gvar, NULL); + + tokens = g_strsplit(triggerstring, ",", max_probes); + for (i = 0; tokens[i]; i++) { + probenum = -1; + for (l = sdi->probes; l; l = l->next) { + probe = (struct sr_probe *)l->data; + if (probe->enabled + && !strncmp(probe->name, tokens[i], + strlen(probe->name))) { + probenum = probe->index; + break; + } + } + + if (probenum < 0 || probenum >= max_probes) { + sr_err("Invalid probe."); + error = TRUE; + break; + } + + if ((trigger = strchr(tokens[i], '='))) { + for (tc = ++trigger; *tc; tc++) { + if (strchr(trigger_types, *tc) == NULL) { + sr_err("Unsupported trigger " + "type '%c'.", *tc); + error = TRUE; + break; + } + } + if (!error) + triggerlist[probenum] = g_strdup(trigger); + } + } + g_strfreev(tokens); + g_variant_unref(gvar); + + if (error) { + for (i = 0; i < max_probes; i++) + g_free(triggerlist[i]); + g_free(triggerlist); + triggerlist = NULL; + } + + return triggerlist; +} + +/** + * Convert a "natural" string representation of a size value to uint64_t. + * + * E.g. a value of "3k" or "3 K" would be converted to 3000, a value + * of "15M" would be converted to 15000000. + * + * Value representations other than decimal (such as hex or octal) are not + * supported. Only 'k' (kilo), 'm' (mega), 'g' (giga) suffixes are supported. + * Spaces (but not other whitespace) between value and suffix are allowed. + * + * @param sizestring A string containing a (decimal) size value. + * @param size Pointer to uint64_t which will contain the string's size value. + * + * @return SR_OK upon success, SR_ERR upon errors. + */ +SR_API int sr_parse_sizestring(const char *sizestring, uint64_t *size) +{ + int multiplier, done; + char *s; + + *size = strtoull(sizestring, &s, 10); + multiplier = 0; + done = FALSE; + while (s && *s && multiplier == 0 && !done) { + switch (*s) { + case ' ': + break; + case 'k': + case 'K': + multiplier = SR_KHZ(1); + break; + case 'm': + case 'M': + multiplier = SR_MHZ(1); + break; + case 'g': + case 'G': + multiplier = SR_GHZ(1); + break; + default: + done = TRUE; + s--; + } + s++; + } + if (multiplier > 0) + *size *= multiplier; + + if (*s && strcasecmp(s, "Hz")) + return SR_ERR; + + return SR_OK; +} + +/** + * Convert a "natural" string representation of a time value to an + * uint64_t value in milliseconds. + * + * E.g. a value of "3s" or "3 s" would be converted to 3000, a value + * of "15ms" would be converted to 15. + * + * Value representations other than decimal (such as hex or octal) are not + * supported. Only lower-case "s" and "ms" time suffixes are supported. + * Spaces (but not other whitespace) between value and suffix are allowed. + * + * @param timestring A string containing a (decimal) time value. + * @return The string's time value as uint64_t, in milliseconds. + * + * @todo Add support for "m" (minutes) and others. + * @todo Add support for picoseconds? + * @todo Allow both lower-case and upper-case? If no, document it. + */ +SR_API uint64_t sr_parse_timestring(const char *timestring) +{ + uint64_t time_msec; + char *s; + + /* TODO: Error handling, logging. */ + + time_msec = strtoull(timestring, &s, 10); + if (time_msec == 0 && s == timestring) + return 0; + + if (s && *s) { + while (*s == ' ') + s++; + if (!strcmp(s, "s")) + time_msec *= 1000; + else if (!strcmp(s, "ms")) + ; /* redundant */ + else + return 0; + } + + return time_msec; +} + +SR_API gboolean sr_parse_boolstring(const char *boolstr) +{ + if (!boolstr) + return FALSE; + + if (!g_ascii_strncasecmp(boolstr, "true", 4) || + !g_ascii_strncasecmp(boolstr, "yes", 3) || + !g_ascii_strncasecmp(boolstr, "on", 2) || + !g_ascii_strncasecmp(boolstr, "1", 1)) + return TRUE; + + return FALSE; +} + +SR_API int sr_parse_period(const char *periodstr, uint64_t *p, uint64_t *q) +{ + char *s; + + *p = strtoull(periodstr, &s, 10); + if (*p == 0 && s == periodstr) + /* No digits found. */ + return SR_ERR_ARG; + + if (s && *s) { + while (*s == ' ') + s++; + if (!strcmp(s, "fs")) + *q = 1000000000000000ULL; + else if (!strcmp(s, "ps")) + *q = 1000000000000ULL; + else if (!strcmp(s, "ns")) + *q = 1000000000ULL; + else if (!strcmp(s, "us")) + *q = 1000000; + else if (!strcmp(s, "ms")) + *q = 1000; + else if (!strcmp(s, "s")) + *q = 1; + else + /* Must have a time suffix. */ + return SR_ERR_ARG; + } + + return SR_OK; +} + + +SR_API int sr_parse_voltage(const char *voltstr, uint64_t *p, uint64_t *q) +{ + char *s; + + *p = strtoull(voltstr, &s, 10); + if (*p == 0 && s == voltstr) + /* No digits found. */ + return SR_ERR_ARG; + + if (s && *s) { + while (*s == ' ') + s++; + if (!strcasecmp(s, "mv")) + *q = 1000L; + else if (!strcasecmp(s, "v")) + *q = 1; + else + /* Must have a base suffix. */ + return SR_ERR_ARG; + } + + return SR_OK; +} + +/** @} */ diff --git a/libsigrok4DSLogic/tests/Makefile.am b/libsigrok4DSLogic/tests/Makefile.am new file mode 100644 index 00000000..25f9438e --- /dev/null +++ b/libsigrok4DSLogic/tests/Makefile.am @@ -0,0 +1,40 @@ +## +## This file is part of the libsigrok project. +## +## Copyright (C) 2013 Uwe Hermann +## +## 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 2 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, write to the Free Software +## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +## + +if HAVE_CHECK + +TESTS = check_main + +check_PROGRAMS = ${TESTS} + +check_main_SOURCES = \ + $(top_builddir)/libsigrok.h \ + lib.c \ + lib.h \ + check_main.c \ + check_core.c \ + check_strutil.c \ + check_driver_all.c + +check_main_CFLAGS = @check_CFLAGS@ + +check_main_LDADD = $(top_builddir)/libsigrok4DSLogic.la @check_LIBS@ + +endif diff --git a/libsigrok4DSLogic/tests/check_core.c b/libsigrok4DSLogic/tests/check_core.c new file mode 100644 index 00000000..8bc1d5ae --- /dev/null +++ b/libsigrok4DSLogic/tests/check_core.c @@ -0,0 +1,182 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2013 Uwe Hermann + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include "../libsigrok.h" + +/* + * Check various basic init related things. + * + * - Check whether an sr_init() call with a proper sr_ctx works. + * If it returns != SR_OK (or segfaults) this test will fail. + * The sr_init() call (among other things) also runs sanity checks on + * all libsigrok hardware drivers and errors out upon issues. + * + * - Check whether a subsequent sr_exit() with that sr_ctx works. + * If it returns != SR_OK (or segfaults) this test will fail. + */ +START_TEST(test_init_exit) +{ + int ret; + struct sr_context *sr_ctx; + + ret = sr_init(&sr_ctx); + fail_unless(ret == SR_OK, "sr_init() failed: %d.", ret); + ret = sr_exit(sr_ctx); + fail_unless(ret == SR_OK, "sr_exit() failed: %d.", ret); +} +END_TEST + +/* + * Check whether two nested sr_init() and sr_exit() calls work. + * The two functions have two different contexts. + * If any function returns != SR_OK (or segfaults) this test will fail. + */ +START_TEST(test_init_exit_2) +{ + int ret; + struct sr_context *sr_ctx1, *sr_ctx2; + + ret = sr_init(&sr_ctx1); + fail_unless(ret == SR_OK, "sr_init() 1 failed: %d.", ret); + ret = sr_init(&sr_ctx2); + fail_unless(ret == SR_OK, "sr_init() 2 failed: %d.", ret); + ret = sr_exit(sr_ctx2); + fail_unless(ret == SR_OK, "sr_exit() 2 failed: %d.", ret); + ret = sr_exit(sr_ctx1); + fail_unless(ret == SR_OK, "sr_exit() 1 failed: %d.", ret); +} +END_TEST + +/* + * Same as above, but sr_exit() in the "wrong" order. + * This should work fine, it's not a bug to do this. + */ +START_TEST(test_init_exit_2_reverse) +{ + int ret; + struct sr_context *sr_ctx1, *sr_ctx2; + + ret = sr_init(&sr_ctx1); + fail_unless(ret == SR_OK, "sr_init() 1 failed: %d.", ret); + ret = sr_init(&sr_ctx2); + fail_unless(ret == SR_OK, "sr_init() 2 failed: %d.", ret); + ret = sr_exit(sr_ctx1); + fail_unless(ret == SR_OK, "sr_exit() 1 failed: %d.", ret); + ret = sr_exit(sr_ctx2); + fail_unless(ret == SR_OK, "sr_exit() 2 failed: %d.", ret); +} +END_TEST + +/* + * Check whether three nested sr_init() and sr_exit() calls work. + * The three functions have three different contexts. + * If any function returns != SR_OK (or segfaults) this test will fail. + */ +START_TEST(test_init_exit_3) +{ + int ret; + struct sr_context *sr_ctx1, *sr_ctx2, *sr_ctx3; + + ret = sr_init(&sr_ctx1); + fail_unless(ret == SR_OK, "sr_init() 1 failed: %d.", ret); + ret = sr_init(&sr_ctx2); + fail_unless(ret == SR_OK, "sr_init() 2 failed: %d.", ret); + ret = sr_init(&sr_ctx3); + fail_unless(ret == SR_OK, "sr_init() 3 failed: %d.", ret); + ret = sr_exit(sr_ctx3); + fail_unless(ret == SR_OK, "sr_exit() 3 failed: %d.", ret); + ret = sr_exit(sr_ctx2); + fail_unless(ret == SR_OK, "sr_exit() 2 failed: %d.", ret); + ret = sr_exit(sr_ctx1); + fail_unless(ret == SR_OK, "sr_exit() 1 failed: %d.", ret); +} +END_TEST + +/* + * Same as above, but sr_exit() in the "wrong" order. + * This should work fine, it's not a bug to do this. + */ +START_TEST(test_init_exit_3_reverse) +{ + int ret; + struct sr_context *sr_ctx1, *sr_ctx2, *sr_ctx3; + + ret = sr_init(&sr_ctx1); + fail_unless(ret == SR_OK, "sr_init() 1 failed: %d.", ret); + ret = sr_init(&sr_ctx2); + fail_unless(ret == SR_OK, "sr_init() 2 failed: %d.", ret); + ret = sr_init(&sr_ctx3); + fail_unless(ret == SR_OK, "sr_init() 3 failed: %d.", ret); + ret = sr_exit(sr_ctx1); + fail_unless(ret == SR_OK, "sr_exit() 1 failed: %d.", ret); + ret = sr_exit(sr_ctx2); + fail_unless(ret == SR_OK, "sr_exit() 2 failed: %d.", ret); + ret = sr_exit(sr_ctx3); + fail_unless(ret == SR_OK, "sr_exit() 3 failed: %d.", ret); +} +END_TEST + +/* Check whether sr_init(NULL) fails as it should. */ +START_TEST(test_init_null) +{ + int ret; + + ret = sr_log_loglevel_set(SR_LOG_NONE); + fail_unless(ret == SR_OK, "sr_log_loglevel_set() failed: %d.", ret); + + ret = sr_init(NULL); + fail_unless(ret != SR_OK, "sr_init(NULL) should have failed."); +} +END_TEST + +/* Check whether sr_exit(NULL) fails as it should. */ +START_TEST(test_exit_null) +{ + int ret; + + ret = sr_log_loglevel_set(SR_LOG_NONE); + fail_unless(ret == SR_OK, "sr_log_loglevel_set() failed: %d.", ret); + + ret = sr_exit(NULL); + fail_unless(ret != SR_OK, "sr_exit(NULL) should have failed."); +} +END_TEST + +Suite *suite_core(void) +{ + Suite *s; + TCase *tc; + + s = suite_create("core"); + + tc = tcase_create("init_exit"); + tcase_add_test(tc, test_init_exit); + tcase_add_test(tc, test_init_exit_2); + tcase_add_test(tc, test_init_exit_2_reverse); + tcase_add_test(tc, test_init_exit_3); + tcase_add_test(tc, test_init_exit_3_reverse); + tcase_add_test(tc, test_init_null); + tcase_add_test(tc, test_exit_null); + suite_add_tcase(s, tc); + + return s; +} diff --git a/libsigrok4DSLogic/tests/check_driver_all.c b/libsigrok4DSLogic/tests/check_driver_all.c new file mode 100644 index 00000000..d15daaa6 --- /dev/null +++ b/libsigrok4DSLogic/tests/check_driver_all.c @@ -0,0 +1,96 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2013 Uwe Hermann + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include "../libsigrok.h" +#include "lib.h" + +struct sr_context *sr_ctx; + +static void setup(void) +{ + int ret; + + ret = sr_init(&sr_ctx); + fail_unless(ret == SR_OK, "sr_init() failed: %d.", ret); +} + +static void teardown(void) +{ + int ret; + + ret = sr_exit(sr_ctx); + fail_unless(ret == SR_OK, "sr_exit() failed: %d.", ret); +} + +/* Check whether at least one driver is available. */ +START_TEST(test_driver_available) +{ + struct sr_dev_driver **drivers; + + drivers = sr_driver_list(); + fail_unless(drivers != NULL, "No drivers found."); +} +END_TEST + +/* Check whether initializing all drivers works. */ +START_TEST(test_driver_init_all) +{ + srtest_driver_init_all(sr_ctx); +} +END_TEST + +/* + * Check whether setting a samplerate works. + * + * Additionally, this also checks whether SR_CONF_SAMPLERATE can be both + * set and read back properly. + */ +#if 0 +START_TEST(test_config_get_set_samplerate) +{ + /* + * Note: This currently only works for the demo driver. + * For other drivers, a scan is needed and the respective + * hardware must be attached to the host running the testsuite. + */ + srtest_check_samplerate(sr_ctx, "demo", SR_KHZ(19)); +} +END_TEST +#endif + +Suite *suite_driver_all(void) +{ + Suite *s; + TCase *tc; + + s = suite_create("driver-all"); + + tc = tcase_create("config"); + tcase_add_checked_fixture(tc, setup, teardown); + tcase_add_test(tc, test_driver_available); + tcase_add_test(tc, test_driver_init_all); + // TODO: Currently broken. + // tcase_add_test(tc, test_config_get_set_samplerate); + suite_add_tcase(s, tc); + + return s; +} diff --git a/libsigrok4DSLogic/tests/check_main.c b/libsigrok4DSLogic/tests/check_main.c new file mode 100644 index 00000000..e07a6b88 --- /dev/null +++ b/libsigrok4DSLogic/tests/check_main.c @@ -0,0 +1,48 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2013 Uwe Hermann + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include "../libsigrok.h" + +Suite *suite_core(void); +Suite *suite_strutil(void); +Suite *suite_driver_all(void); + +int main(void) +{ + int ret; + Suite *s; + SRunner *srunner; + + s = suite_create("mastersuite"); + srunner = srunner_create(s); + + /* Add all testsuites to the master suite. */ + srunner_add_suite(srunner, suite_core()); + srunner_add_suite(srunner, suite_strutil()); + srunner_add_suite(srunner, suite_driver_all()); + + srunner_run_all(srunner, CK_VERBOSE); + ret = srunner_ntests_failed(srunner); + srunner_free(srunner); + + return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/libsigrok4DSLogic/tests/check_strutil.c b/libsigrok4DSLogic/tests/check_strutil.c new file mode 100644 index 00000000..a439d6e1 --- /dev/null +++ b/libsigrok4DSLogic/tests/check_strutil.c @@ -0,0 +1,192 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2013 Uwe Hermann + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include "../libsigrok.h" + +struct sr_context *sr_ctx; + +static void setup(void) +{ + int ret; + + ret = sr_init(&sr_ctx); + fail_unless(ret == SR_OK, "sr_init() failed: %d.", ret); +} + +static void teardown(void) +{ + int ret; + + ret = sr_exit(sr_ctx); + fail_unless(ret == SR_OK, "sr_exit() failed: %d.", ret); +} + +static void test_samplerate(uint64_t samplerate, const char *expected) +{ + char *s; + + s = sr_samplerate_string(samplerate); + fail_unless(s != NULL); + fail_unless(!strcmp(s, expected), + "Invalid result for '%s': %s.", expected, s); + g_free(s); +} + +/* + * Check various inputs for sr_samplerate_string(): + * + * - One, two, or three digit results (e.g. 5/55/555 MHz). + * - Results which contain commas (e.g. 1.234 / 12.34 / 123.4 kHz). + * - Results with zeroes right after the comma (e.g. 1.034 Hz). + * See also: http://sigrok.org/bugzilla/show_bug.cgi?id=73 + * - Results with trailing zeroes (e.g. 1.230 kHz). + * (This is currently allowed, but might be changed later) + * - Results with zeroes in the middle (e.g. 1.204 kHz). + * - All of the above, but using SR_MHZ() and friends. + * See also: http://sigrok.org/bugzilla/show_bug.cgi?id=72 + * + * All of the above tests are done for the Hz/kHz/MHz/GHz ranges. + */ + +START_TEST(test_hz) +{ + test_samplerate(0, "0 Hz"); + test_samplerate(1, "1 Hz"); + test_samplerate(23, "23 Hz"); + test_samplerate(644, "644 Hz"); + test_samplerate(604, "604 Hz"); + test_samplerate(550, "550 Hz"); + + /* Again, but now using SR_HZ(). */ + test_samplerate(SR_HZ(0), "0 Hz"); + test_samplerate(SR_HZ(1), "1 Hz"); + test_samplerate(SR_HZ(23), "23 Hz"); + test_samplerate(SR_HZ(644), "644 Hz"); + test_samplerate(SR_HZ(604), "604 Hz"); + test_samplerate(SR_HZ(550), "550 Hz"); +} +END_TEST + +START_TEST(test_khz) +{ + test_samplerate(1000, "1 kHz"); + test_samplerate(99000, "99 kHz"); + test_samplerate(225000, "225 kHz"); + test_samplerate(1234, "1.234 kHz"); + test_samplerate(12345, "12.345 kHz"); + test_samplerate(123456, "123.456 kHz"); + test_samplerate(1034, "1.034 kHz"); + test_samplerate(1004, "1.004 kHz"); + test_samplerate(1230, "1.230 kHz"); + + /* Again, but now using SR_KHZ(). */ + test_samplerate(SR_KHZ(1), "1 kHz"); + test_samplerate(SR_KHZ(99), "99 kHz"); + test_samplerate(SR_KHZ(225), "225 kHz"); + test_samplerate(SR_KHZ(1.234), "1.234 kHz"); + test_samplerate(SR_KHZ(12.345), "12.345 kHz"); + test_samplerate(SR_KHZ(123.456), "123.456 kHz"); + test_samplerate(SR_KHZ(1.204), "1.204 kHz"); + test_samplerate(SR_KHZ(1.034), "1.034 kHz"); + test_samplerate(SR_KHZ(1.004), "1.004 kHz"); + test_samplerate(SR_KHZ(1.230), "1.230 kHz"); +} +END_TEST + +START_TEST(test_mhz) +{ + test_samplerate(1000000, "1 MHz"); + test_samplerate(28000000, "28 MHz"); + test_samplerate(775000000, "775 MHz"); + test_samplerate(1234567, "1.234567 MHz"); + test_samplerate(12345678, "12.345678 MHz"); + test_samplerate(123456789, "123.456789 MHz"); + test_samplerate(1230007, "1.230007 MHz"); + test_samplerate(1034567, "1.034567 MHz"); + test_samplerate(1000007, "1.000007 MHz"); + test_samplerate(1234000, "1.234000 MHz"); + + /* Again, but now using SR_MHZ(). */ + test_samplerate(SR_MHZ(1), "1 MHz"); + test_samplerate(SR_MHZ(28), "28 MHz"); + test_samplerate(SR_MHZ(775), "775 MHz"); + test_samplerate(SR_MHZ(1.234567), "1.234567 MHz"); + test_samplerate(SR_MHZ(12.345678), "12.345678 MHz"); + test_samplerate(SR_MHZ(123.456789), "123.456789 MHz"); + test_samplerate(SR_MHZ(1.230007), "1.230007 MHz"); + test_samplerate(SR_MHZ(1.034567), "1.034567 MHz"); + test_samplerate(SR_MHZ(1.000007), "1.000007 MHz"); + test_samplerate(SR_MHZ(1.234000), "1.234000 MHz"); +} +END_TEST + +START_TEST(test_ghz) +{ + /* Note: Numbers > 2^32 need a ULL suffix. */ + + test_samplerate(1000000000, "1 GHz"); + test_samplerate(5000000000ULL, "5 GHz"); + test_samplerate(72000000000ULL, "72 GHz"); + test_samplerate(388000000000ULL, "388 GHz"); + test_samplerate(4417594444ULL, "4.417594444 GHz"); + test_samplerate(44175944444ULL, "44.175944444 GHz"); + test_samplerate(441759444441ULL, "441.759444441 GHz"); + test_samplerate(441759000001ULL, "441.759000001 GHz"); + test_samplerate(441050000000ULL, "441.05 GHz"); + test_samplerate(441000000005ULL, "441.000000005 GHz"); + test_samplerate(441500000000ULL, "441.500000000 GHz"); + + /* Again, but now using SR_GHZ(). */ + test_samplerate(SR_GHZ(1), "1 GHz"); + test_samplerate(SR_GHZ(5), "5 GHz"); + test_samplerate(SR_GHZ(72), "72 GHz"); + test_samplerate(SR_GHZ(388), "388 GHz"); + test_samplerate(SR_GHZ(4.417594444), "4.417594444 GHz"); + test_samplerate(SR_GHZ(44.175944444), "44.175944444 GHz"); + test_samplerate(SR_GHZ(441.759444441), "441.759444441 GHz"); + test_samplerate(SR_GHZ(441.759000001), "441.759000001 GHz"); + test_samplerate(SR_GHZ(441.050000000), "441.05 GHz"); + test_samplerate(SR_GHZ(441.000000005), "441.000000005 GHz"); + test_samplerate(SR_GHZ(441.500000000), "441.500000000 GHz"); + + /* Now check the biggest-possible samplerate (2^64 Hz). */ + test_samplerate(18446744073709551615ULL, "18446744073.709551615 GHz"); + test_samplerate(SR_GHZ(18446744073ULL), "18446744073 GHz"); +} +END_TEST + +Suite *suite_strutil(void) +{ + Suite *s; + TCase *tc; + + s = suite_create("strutil"); + + tc = tcase_create("sr_samplerate_string"); + tcase_add_checked_fixture(tc, setup, teardown); + tcase_add_test(tc, test_hz); + tcase_add_test(tc, test_khz); + tcase_add_test(tc, test_mhz); + tcase_add_test(tc, test_ghz); + suite_add_tcase(s, tc); + + return s; +} diff --git a/libsigrok4DSLogic/tests/lib.c b/libsigrok4DSLogic/tests/lib.c new file mode 100644 index 00000000..523d4399 --- /dev/null +++ b/libsigrok4DSLogic/tests/lib.c @@ -0,0 +1,122 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2013 Uwe Hermann + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include "../libsigrok.h" + +/* Get a libsigrok driver by name. */ +struct sr_dev_driver *srtest_driver_get(const char *drivername) +{ + struct sr_dev_driver **drivers, *driver = NULL; + int i; + + drivers = sr_driver_list(); + fail_unless(drivers != NULL, "No drivers found."); + + for (i = 0; drivers[i]; i++) { + if (strcmp(drivers[i]->name, drivername)) + continue; + driver = drivers[i]; + } + fail_unless(driver != NULL, "Driver '%s' not found.", drivername); + + return driver; +} + +/* Initialize a libsigrok driver. */ +void srtest_driver_init(struct sr_context *sr_ctx, struct sr_dev_driver *driver) +{ + int ret; + + ret = sr_driver_init(sr_ctx, driver); + fail_unless(ret == SR_OK, "Failed to init '%s' driver: %d.", + driver->name, ret); +} + +/* Initialize all libsigrok drivers. */ +void srtest_driver_init_all(struct sr_context *sr_ctx) +{ + struct sr_dev_driver **drivers, *driver; + int i, ret; + + drivers = sr_driver_list(); + fail_unless(drivers != NULL, "No drivers found."); + + for (i = 0; drivers[i]; i++) { + driver = drivers[i]; + ret = sr_driver_init(sr_ctx, driver); + fail_unless(ret == SR_OK, "Failed to init '%s' driver: %d.", + driver->name, ret); + } +} + +/* Set the samplerate for the respective driver to the specified value. */ +void srtest_set_samplerate(struct sr_dev_driver *driver, uint64_t samplerate) +{ + int ret; + struct sr_dev_inst *sdi; + GVariant *gvar; + + sdi = g_slist_nth_data(driver->priv, 0); + + gvar = g_variant_new_uint64(samplerate); + ret = driver->config_set(SR_CONF_SAMPLERATE, gvar, sdi); + g_variant_unref(gvar); + + fail_unless(ret == SR_OK, "%s: Failed to set SR_CONF_SAMPLERATE: %d.", + driver->name, ret); +} + +/* Get the respective driver's current samplerate. */ +uint64_t srtest_get_samplerate(struct sr_dev_driver *driver) +{ + int ret; + uint64_t samplerate; + struct sr_dev_inst *sdi; + GVariant *gvar; + + sdi = g_slist_nth_data(driver->priv, 0); + + ret = driver->config_get(SR_CONF_SAMPLERATE, &gvar, sdi); + samplerate = g_variant_get_uint64(gvar); + g_variant_unref(gvar); + + fail_unless(ret == SR_OK, "%s: Failed to get SR_CONF_SAMPLERATE: %d.", + driver->name, ret); + + return samplerate; +} + +/* Check whether the respective driver can set/get the correct samplerate. */ +void srtest_check_samplerate(struct sr_context *sr_ctx, const char *drivername, + uint64_t samplerate) +{ + struct sr_dev_driver *driver; + uint64_t s; + + driver = srtest_driver_get(drivername); + srtest_driver_init(sr_ctx, driver);; + srtest_set_samplerate(driver, samplerate); + s = srtest_get_samplerate(driver); + fail_unless(s == samplerate, "%s: Incorrect samplerate: %" PRIu64 ".", + drivername, s); +} diff --git a/libsigrok4DSLogic/tests/lib.h b/libsigrok4DSLogic/tests/lib.h new file mode 100644 index 00000000..beaa0f53 --- /dev/null +++ b/libsigrok4DSLogic/tests/lib.h @@ -0,0 +1,34 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2013 Uwe Hermann + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef LIBSIGROK_TESTS_LIB_H +#define LIBSIGROK_TESTS_LIB_H + +#include "../libsigrok.h" + +struct sr_dev_driver *srtest_driver_get(const char *drivername); +void srtest_driver_init(struct sr_context *sr_ctx, struct sr_dev_driver *driver); +void srtest_driver_init_all(struct sr_context *sr_ctx); +void srtest_set_samplerate(struct sr_dev_driver *driver, uint64_t samplerate); +uint64_t srtest_get_samplerate(struct sr_dev_driver *driver); +void srtest_check_samplerate(struct sr_context *sr_ctx, const char *drivername, + uint64_t samplerate); + +#endif diff --git a/libsigrok4DSLogic/trigger.c b/libsigrok4DSLogic/trigger.c new file mode 100644 index 00000000..d8a2aae5 --- /dev/null +++ b/libsigrok4DSLogic/trigger.c @@ -0,0 +1,291 @@ +/* + * This file is part of the DSLogic project. + */ + +#include +#include +#include +#include +#include +#include +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/* Message logging helpers with subsystem-specific prefix string. */ +#define LOG_PREFIX "session: " +#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args) +#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args) +#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args) +#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args) +#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args) +#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args) + +/** + * @file + * + * init, set DSLogic trigger. + */ + +/** + * @defgroup Trigger handling + * + * init, set DSLogic trigger + * + * @{ + */ + +struct ds_trigger *trigger; + +/** + * recovery trigger to initial status. + * + * @return SR_OK upon success. + */ +SR_API int ds_trigger_init(void) +{ + int i, j; + + if (!(trigger = g_try_malloc0(sizeof(struct ds_trigger)))) { + sr_err("Trigger malloc failed."); + return SR_ERR_MALLOC; + } + + trigger->trigger_en = 0; + trigger->trigger_mode = SIMPLE_TRIGGER; + trigger->trigger_pos = 0; + trigger->trigger_stages = 0; + + for (i = 0; i <= TriggerStages; i++) { + for (j = 0; j < TriggerProbes; j++) { + trigger->trigger0[i][j] = 'X'; + trigger->trigger1[i][j] = 'X'; + } + trigger->trigger0_count[i] = 0; + trigger->trigger1_count[i] = 0; + trigger->trigger0_inv[i] = 0; + trigger->trigger1_inv[i] = 0; + trigger->trigger_logic[i] = 1; + } + + + return SR_OK; +} + +SR_API int ds_trigger_destroy(void) +{ + if (trigger) + g_free(trigger); + + return SR_OK; +} + +/** + * set trigger based on stage + * + * @return SR_OK upon success. + */ +SR_API int ds_trigger_stage_set_value(uint16_t stage, uint16_t probes, char *trigger0, char *trigger1) +{ + assert(stage < TriggerStages); + assert(probes <= TriggerProbes); + + int j; + + for (j = 0; j< probes; j++) { + trigger->trigger0[stage][probes - j - 1] = *(trigger0 + j * 2); + trigger->trigger1[stage][probes - j - 1] = *(trigger1 + j * 2); + } + + return SR_OK; +} +SR_API int ds_trigger_stage_set_logic(uint16_t stage, uint16_t probes, unsigned char trigger_logic) +{ + assert(stage < TriggerStages); + assert(probes <= TriggerProbes); + + trigger->trigger_logic[stage] = trigger_logic; + + return SR_OK; +} +SR_API int ds_trigger_stage_set_inv(uint16_t stage, uint16_t probes, unsigned char trigger0_inv, unsigned char trigger1_inv) +{ + assert(stage < TriggerStages); + assert(probes <= TriggerProbes); + + trigger->trigger0_inv[stage] = trigger0_inv; + trigger->trigger1_inv[stage] = trigger1_inv; + + return SR_OK; +} +SR_API int ds_trigger_stage_set_count(uint16_t stage, uint16_t probes, uint16_t trigger0_count, uint16_t trigger1_count) +{ + assert(stage < TriggerStages); + assert(probes <= TriggerProbes); + + trigger->trigger0_count[stage] = trigger0_count; + trigger->trigger1_count[stage] = trigger1_count; + + return SR_OK; +} + +/** + * set trigger based on probe + * + * @return SR_OK upon success. + */ +SR_API int ds_trigger_probe_set(uint16_t probe, unsigned char trigger0, unsigned char trigger1) +{ + assert(probe < TriggerProbes); + + trigger->trigger0[TriggerStages][probe] = trigger0; + trigger->trigger1[TriggerStages][probe] = trigger1; + + return SR_OK; +} + +/** + * set trigger stage + * + * @return SR_OK upon success. + */ +SR_API int ds_trigger_set_stage(uint16_t stages) +{ + assert(stages <= TriggerStages); + + trigger->trigger_stages = stages; + + return SR_OK; +} + +/** + * set trigger position + * + * @return SR_OK upon success. + */ +SR_API int ds_trigger_set_pos(uint16_t position) +{ + assert(position <= 100); + assert(position >= 0); + + trigger->trigger_pos = position; + + return SR_OK; +} + +/** + * set trigger en + * + * @return SR_OK upon success. + */ +SR_API int ds_trigger_set_en(uint16_t enable) +{ + + trigger->trigger_en = enable; + + return SR_OK; +} + +/** + * set trigger mode + * + * @return SR_OK upon success. + */ +SR_API int ds_trigger_set_mode(uint16_t mode) +{ + + trigger->trigger_mode = mode; + + return SR_OK; +} + +/* + * + */ +SR_PRIV uint64_t ds_trigger_get_mask0(uint16_t stage) +{ + assert(stage <= TriggerStages); + + uint64_t mask = 0; + int i; + + for (i = TriggerProbes - 1; i >= 0 ; i--) { + mask = (mask << 1); + mask += (trigger->trigger0[stage][i] == 'X' | trigger->trigger0[stage][i] == 'C'); + } + + return mask; +} +SR_PRIV uint64_t ds_trigger_get_mask1(uint16_t stage) +{ + assert(stage <= TriggerStages); + + uint64_t mask = 0; + int i; + + for (i = TriggerProbes - 1; i >= 0 ; i--) { + mask = (mask << 1); + mask += (trigger->trigger1[stage][i] == 'X' | trigger->trigger1[stage][i] == 'C'); + } + + return mask; +} +SR_PRIV uint64_t ds_trigger_get_value0(uint16_t stage) +{ + assert(stage <= TriggerStages); + + uint64_t value = 0; + int i; + + for (i = TriggerProbes - 1; i >= 0 ; i--) { + value = (value << 1); + value += (trigger->trigger0[stage][i] == '1' | trigger->trigger0[stage][i] == 'R'); + } + + return value; +} +SR_PRIV uint64_t ds_trigger_get_value1(uint16_t stage) +{ + assert(stage <= TriggerStages); + + uint64_t value = 0; + int i; + + for (i = TriggerProbes - 1; i >= 0 ; i--) { + value = (value << 1); + value += (trigger->trigger1[stage][i] == '1' | trigger->trigger1[stage][i] == 'R'); + } + + return value; +} +SR_PRIV uint64_t ds_trigger_get_edge0(uint16_t stage) +{ + assert(stage <= TriggerStages); + + uint64_t edge = 0; + int i; + + for (i = TriggerProbes - 1; i >= 0 ; i--) { + edge = (edge << 1); + edge += (trigger->trigger0[stage][i] == 'R' | trigger->trigger0[stage][i] == 'F' | + trigger->trigger0[stage][i] == 'C'); + } + + return edge; +} +SR_PRIV uint64_t ds_trigger_get_edge1(uint16_t stage) +{ + assert(stage <= TriggerStages); + + uint64_t edge = 0; + int i; + + for (i = TriggerProbes - 1; i >= 0 ; i--) { + edge = (edge << 1); + edge += (trigger->trigger1[stage][i] == 'R' | trigger->trigger1[stage][i] == 'F' | + trigger->trigger1[stage][i] == 'C'); + } + + return edge; +} + +/** @} */ diff --git a/libsigrok4DSLogic/version.c b/libsigrok4DSLogic/version.c new file mode 100644 index 00000000..3da0c173 --- /dev/null +++ b/libsigrok4DSLogic/version.c @@ -0,0 +1,147 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2012 Uwe Hermann + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libsigrok.h" + +/** + * @file + * + * Version number querying functions, definitions, and macros. + */ + +/** + * @defgroup grp_versions Versions + * + * Version number querying functions, definitions, and macros. + * + * This set of API calls returns two different version numbers related + * to libsigrok. The "package version" is the release version number of the + * libsigrok tarball in the usual "major.minor.micro" format, e.g. "0.1.0". + * + * The "library version" is independent of that; it is the libtool version + * number in the "current:revision:age" format, e.g. "2:0:0". + * See http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning for details. + * + * Both version numbers (and/or individual components of them) can be + * retrieved via the API calls at runtime, and/or they can be checked at + * compile/preprocessor time using the respective macros. + * + * @{ + */ + +/** + * Get the major libsigrok package version number. + * + * @return The major package version number. + * + * @since 0.1.0 + */ +SR_API int sr_package_version_major_get(void) +{ + return SR_PACKAGE_VERSION_MAJOR; +} + +/** + * Get the minor libsigrok package version number. + * + * @return The minor package version number. + * + * @since 0.1.0 + */ +SR_API int sr_package_version_minor_get(void) +{ + return SR_PACKAGE_VERSION_MINOR; +} + +/** + * Get the micro libsigrok package version number. + * + * @return The micro package version number. + * + * @since 0.1.0 + */ +SR_API int sr_package_version_micro_get(void) +{ + return SR_PACKAGE_VERSION_MICRO; +} + +/** + * Get the libsigrok package version number as a string. + * + * @return The package version number string. The returned string is + * static and thus should NOT be free'd by the caller. + * + * @since 0.1.0 + */ +SR_API const char *sr_package_version_string_get(void) +{ + return SR_PACKAGE_VERSION_STRING; +} + +/** + * Get the "current" part of the libsigrok library version number. + * + * @return The "current" library version number. + * + * @since 0.1.0 + */ +SR_API int sr_lib_version_current_get(void) +{ + return SR_LIB_VERSION_CURRENT; +} + +/** + * Get the "revision" part of the libsigrok library version number. + * + * @return The "revision" library version number. + * + * @since 0.1.0 + */ +SR_API int sr_lib_version_revision_get(void) +{ + return SR_LIB_VERSION_REVISION; +} + +/** + * Get the "age" part of the libsigrok library version number. + * + * @return The "age" library version number. + * + * @since 0.1.0 + */ +SR_API int sr_lib_version_age_get(void) +{ + return SR_LIB_VERSION_AGE; +} + +/** + * Get the libsigrok library version number as a string. + * + * @return The library version number string. The returned string is + * static and thus should NOT be free'd by the caller. + * + * @since 0.1.0 + */ +SR_API const char *sr_lib_version_string_get(void) +{ + return SR_LIB_VERSION_STRING; +} + +/** @} */ diff --git a/libsigrok4DSLogic/version.h b/libsigrok4DSLogic/version.h new file mode 100644 index 00000000..8597d4f8 --- /dev/null +++ b/libsigrok4DSLogic/version.h @@ -0,0 +1,69 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2010-2012 Bert Vermeulen + * + * 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 . + */ + +#ifndef LIBSIGROK_VERSION_H +#define LIBSIGROK_VERSION_H + +/** + * @file + * + * Version number definitions and macros. + */ + +/** + * @ingroup grp_versions + * + * @{ + */ + +/* + * Package version macros (can be used for conditional compilation). + */ + +/** The libsigrok package 'major' version number. */ +#define SR_PACKAGE_VERSION_MAJOR 0 + +/** The libsigrok package 'minor' version number. */ +#define SR_PACKAGE_VERSION_MINOR 2 + +/** The libsigrok package 'micro' version number. */ +#define SR_PACKAGE_VERSION_MICRO 0 + +/** The libsigrok package version ("major.minor.micro") as string. */ +#define SR_PACKAGE_VERSION_STRING "0.2.0" + +/* + * Library/libtool version macros (can be used for conditional compilation). + */ + +/** The libsigrok libtool 'current' version number. */ +#define SR_LIB_VERSION_CURRENT 1 + +/** The libsigrok libtool 'revision' version number. */ +#define SR_LIB_VERSION_REVISION 2 + +/** The libsigrok libtool 'age' version number. */ +#define SR_LIB_VERSION_AGE 0 + +/** The libsigrok libtool version ("current:revision:age") as string. */ +#define SR_LIB_VERSION_STRING "1:2:0" + +/** @} */ + +#endif diff --git a/libsigrok4DSLogic/version.h.in b/libsigrok4DSLogic/version.h.in new file mode 100644 index 00000000..d0440913 --- /dev/null +++ b/libsigrok4DSLogic/version.h.in @@ -0,0 +1,69 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2010-2012 Bert Vermeulen + * + * 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 . + */ + +#ifndef LIBSIGROK_VERSION_H +#define LIBSIGROK_VERSION_H + +/** + * @file + * + * Version number definitions and macros. + */ + +/** + * @ingroup grp_versions + * + * @{ + */ + +/* + * Package version macros (can be used for conditional compilation). + */ + +/** The libsigrok package 'major' version number. */ +#define SR_PACKAGE_VERSION_MAJOR @SR_PACKAGE_VERSION_MAJOR@ + +/** The libsigrok package 'minor' version number. */ +#define SR_PACKAGE_VERSION_MINOR @SR_PACKAGE_VERSION_MINOR@ + +/** The libsigrok package 'micro' version number. */ +#define SR_PACKAGE_VERSION_MICRO @SR_PACKAGE_VERSION_MICRO@ + +/** The libsigrok package version ("major.minor.micro") as string. */ +#define SR_PACKAGE_VERSION_STRING "@SR_PACKAGE_VERSION@" + +/* + * Library/libtool version macros (can be used for conditional compilation). + */ + +/** The libsigrok libtool 'current' version number. */ +#define SR_LIB_VERSION_CURRENT @SR_LIB_VERSION_CURRENT@ + +/** The libsigrok libtool 'revision' version number. */ +#define SR_LIB_VERSION_REVISION @SR_LIB_VERSION_REVISION@ + +/** The libsigrok libtool 'age' version number. */ +#define SR_LIB_VERSION_AGE @SR_LIB_VERSION_AGE@ + +/** The libsigrok libtool version ("current:revision:age") as string. */ +#define SR_LIB_VERSION_STRING "@SR_LIB_VERSION@" + +/** @} */ + +#endif