diff options
156 files changed, 1259 insertions, 4519 deletions
diff --git a/firmware/fx2/.gitignore b/firmware/fx2/.gitignore index affc0b779..e9fd37231 100644 --- a/firmware/fx2/.gitignore +++ b/firmware/fx2/.gitignore @@ -1,30 +1,2 @@ -/Makefile -/Makefile.in -/aclocal.m4 -/configure -/config.h.in -/stamp-h.in -/libtool -/config.log -/config.h -/config.cache -/config.status -/missing -/stamp-h -/stamp-h1 -/.la -/.lo -/.deps -/.libs -/*.la -/*.lo -/autom4te.cache -/*.cache -/missing -/make.log -/usrp.pc -/INSTALL -/config.guess -/config.sub -/install-sh -/ltmain.sh +/build +*.sym diff --git a/firmware/fx2/AUTHORS b/firmware/fx2/AUTHORS index e69de29bb..c9cd35778 100644 --- a/firmware/fx2/AUTHORS +++ b/firmware/fx2/AUTHORS @@ -0,0 +1,4 @@ +Eric Blossom <eb@comsec.org> +Josh Blum <josh@joshknows.com> +Thomas Tsou <ttsou@vt.edu> +Nick Foster <nick@nerdnetworks.org> diff --git a/firmware/fx2/CMakeLists.txt b/firmware/fx2/CMakeLists.txt new file mode 100644 index 000000000..80f16363f --- /dev/null +++ b/firmware/fx2/CMakeLists.txt @@ -0,0 +1,47 @@ +# +# Copyright 2010 Ettus Research LLC +# +# 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 <http://www.gnu.org/licenses/>. +# + +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/config/Toolchain-sdcc.cmake) +PROJECT(USRP1 C) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/config/") +INCLUDE(FindPythonInterp) + +######################################################################## +# Set toolchain to use SDCC +######################################################################## +# we're doing mixed ASM and C +ENABLE_LANGUAGE(ASM_SDCC) + +######################################################################## +# C flags and linking flags +######################################################################## +ADD_DEFINITIONS(-DHAVE_USRP2) +set(CMAKE_C_LINK_FLAGS "--code-loc 0x0000 --code-size 0x1800 --xram-loc 0x1800 --xram-size 0x0800 -Wl '-b USBDESCSEG = 0xE000'") +set(CMAKE_C_FLAGS "--no-xinit-opt") + +######################################################################## +# Setup precompile tools +######################################################################## +set(REG_GENERATOR ${CMAKE_SOURCE_DIR}/utils/generate_regs.py) +set(EDIT_GPIF_USRP1 ${CMAKE_SOURCE_DIR}/utils/edit-gpif.py) +set(BUILD_EEPROM ${CMAKE_SOURCE_DIR}/utils/build_eeprom.py) + +######################################################################## +# Add the subdirectories +######################################################################## +ADD_SUBDIRECTORY(usrp1) diff --git a/firmware/fx2/COPYING b/firmware/fx2/COPYING deleted file mode 100644 index 94a9ed024..000000000 --- a/firmware/fx2/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - 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. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - 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 <http://www.gnu.org/licenses/>. - -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: - - <program> Copyright (C) <year> <name of author> - 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 -<http://www.gnu.org/licenses/>. - - 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 -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/firmware/fx2/ChangeLog b/firmware/fx2/ChangeLog deleted file mode 100644 index e69de29bb..000000000 --- a/firmware/fx2/ChangeLog +++ /dev/null diff --git a/firmware/fx2/Makefile.am b/firmware/fx2/Makefile.am deleted file mode 100644 index 9c0da3573..000000000 --- a/firmware/fx2/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright 2003 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -SUBDIRS = include lib src diff --git a/firmware/fx2/Makefile.common b/firmware/fx2/Makefile.common deleted file mode 100644 index fb83b9470..000000000 --- a/firmware/fx2/Makefile.common +++ /dev/null @@ -1,122 +0,0 @@ -# -*- Makefile -*- -# -# Copyright 2004,2006,2007,2008,2009,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -AM_CFLAGS = @autoconf_default_CFLAGS@ @lf_CFLAGS@ -AM_CXXFLAGS = @autoconf_default_CXXFLAGS@ @lf_CXXFLAGS@ - -# Sets ABI version in SONAME and appends -LIBVER to filename -LTVERSIONFLAGS = -version-info 0:0:0 -release $(LIBVER) - -# includes -grincludedir = $(includedir)/gnuradio - -if PYTHON -# swig includes -swigincludedir = $(grincludedir)/swig - -# Install the gnuradio stuff in the appropriate subdirectory -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio - -grpythondir = $(pythondir)/gnuradio -grpyexecdir = $(pyexecdir)/gnuradio - -# Install the non-gnuradio usrp stuff in the appropriate subdirectory -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/usrpm - -usrppythondir = $(pythondir)/usrpm -usrppyexecdir = $(pyexecdir)/usrpm -endif - -# gcell includes -gcellincludedir = $(includedir)/gcell -gcellspuincludedir = $(includedir)/gcell/spu - -# Cell spu libs -libspudir = $(libdir)spu - -# This used to be set in configure.ac but is now defined here for all -# Makefiles when this fragment is included. -STD_DEFINES_AND_INCLUDES = $(DEFINES) $(BOOST_CPPFLAGS) \ - $(GNURADIO_INCLUDES) $(GRUEL_INCLUDES) - -# when including for compilation from pre-installed libraries and such, -# need to make sure those are put last on the compile command -WITH_INCLUDES = @with_INCLUDES@ -WITH_SWIG_INCLUDES = @with_SWIG_INCLUDES@ - -# Where to find gnuradio include files in the current build tree -# top_srcdir for original stuff, top_builddir for generated files -GNURADIO_INCLUDES = @gnuradio_core_INCLUDES@ - -# How to link in GNU Radio core library from inside the tree -GNURADIO_CORE_LA = @gnuradio_core_LA@ - -# How to link in the USRP library from inside the tree -GRUEL_INCLUDES = @gruel_INCLUDES@ -GRUEL_LA = @gruel_LA@ - -# How to link in the USRP library from inside the tree -USRP_INCLUDES = @usrp_INCLUDES@ -USRP_LA = @usrp_LA@ - -# How to link the gcell library from inside the tree (the PPU part) -GCELL_INCLUDES = @gcell_INCLUDES@ -GCELL_LA = @gcell_LA@ - -# How to link the gcell library from inside the tree (the SPU part) -GCELL_SPU_INCLUDES = @gcell_spu_INCLUDES@ -GCELL_SPU_LA = @gcell_spu_LA@ - -# libtool aware wrapper for ppu-embedspu -GCELL_EMBEDSPU_LIBTOOL = @abs_top_srcdir@/gcell/lib/runtime/gcell-embedspu-libtool - -# Fix for BSD make not defining $(RM). We define it now in configure.ac -# using AM_PATH_PROG, but now here have to add a -f to be like GNU make -RM=$(RM_PROG) -f - -RUN_GUILE = GUILE_LOAD_PATH="@abs_top_srcdir@/gruel/src/scheme" @GUILE@ -e main -s - -# Base directory for example applications -exampledir = $(datadir)/gnuradio/examples - -# Base directory for documentation (docdir undefined in autoconf < 1.60) -docdir ?= $(datadir)/doc/$(PACKAGE) -gr_docdir = $(docdir)-$(DOCVER) - -# System configuration files -gr_prefsdir = $(GR_PREFSDIR) - -# Data directory for grc block wrappers -grc_blocksdir = $(pkgdatadir)/grc/blocks - -# Other common defines; use "+=" to add to these -STAMPS = -MOSTLYCLEANFILES = $(BUILT_SOURCES) $(STAMPS) *.pyc *.pyo *~ *.tmp *.loT - -# Don't distribute the files defined in the variable 'no_dist_files' -dist-hook: - @for file in $(no_dist_files); do \ - echo $(RM) $(distdir)/$$file; \ - $(RM) $(distdir)/$$file; \ - done; diff --git a/firmware/fx2/NEWS b/firmware/fx2/NEWS deleted file mode 100644 index e69de29bb..000000000 --- a/firmware/fx2/NEWS +++ /dev/null diff --git a/firmware/fx2/README b/firmware/fx2/README deleted file mode 100644 index e69de29bb..000000000 --- a/firmware/fx2/README +++ /dev/null diff --git a/firmware/fx2/bootstrap b/firmware/fx2/bootstrap deleted file mode 100755 index 7daff90d1..000000000 --- a/firmware/fx2/bootstrap +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -# Copyright 2001,2005,2008 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. - - -rm -fr config.cache autom4te*.cache - -aclocal -I config -autoconf -autoheader -libtoolize --automake -automake --add-missing -Wno-portability -Wno-override -Wnone -#automake --add-missing -Wno-portability diff --git a/firmware/fx2/lib/.gitignore b/firmware/fx2/common/.gitignore index 04f253234..04f253234 100644 --- a/firmware/fx2/lib/.gitignore +++ b/firmware/fx2/common/.gitignore diff --git a/firmware/fx2/src/common/_startup.a51 b/firmware/fx2/common/_startup.a51 index 30a907857..30a907857 100644 --- a/firmware/fx2/src/common/_startup.a51 +++ b/firmware/fx2/common/_startup.a51 diff --git a/firmware/fx2/src/common/_startup.a51.brittle b/firmware/fx2/common/_startup.a51.brittle index 2996275cf..2996275cf 100644 --- a/firmware/fx2/src/common/_startup.a51.brittle +++ b/firmware/fx2/common/_startup.a51.brittle diff --git a/firmware/fx2/lib/delay.c b/firmware/fx2/common/delay.c index 13cf0eec8..13cf0eec8 100644 --- a/firmware/fx2/lib/delay.c +++ b/firmware/fx2/common/delay.c diff --git a/firmware/fx2/include/delay.h b/firmware/fx2/common/delay.h index f5df779e1..f5df779e1 100644 --- a/firmware/fx2/include/delay.h +++ b/firmware/fx2/common/delay.h diff --git a/firmware/fx2/src/usrp1/eeprom_boot.a51 b/firmware/fx2/common/eeprom_boot.a51 index 65e452668..65e452668 100644 --- a/firmware/fx2/src/usrp1/eeprom_boot.a51 +++ b/firmware/fx2/common/eeprom_boot.a51 diff --git a/firmware/fx2/src/usrp1/eeprom_init.c b/firmware/fx2/common/eeprom_init.c index a6f6cbe2d..07902dcca 100644 --- a/firmware/fx2/src/usrp1/eeprom_init.c +++ b/firmware/fx2/common/eeprom_init.c @@ -22,7 +22,6 @@ #include "usrp_common.h" #include "usrp_commands.h" -#include "spi.h" /* * the host side fpga loader code pushes an MD5 hash of the bitstream @@ -32,39 +31,6 @@ xdata at USRP_HASH_SLOT_0_ADDR unsigned char hash0[USRP_HASH_SIZE]; -#define enable_codecs() USRP_PA &= ~(bmPA_SEN_CODEC_A | bmPA_SEN_CODEC_B) -#define disable_all() USRP_PA |= (bmPA_SEN_CODEC_A | bmPA_SEN_CODEC_B) - -static void -write_byte_msb (unsigned char v); - -void -write_both_9862s (unsigned char header_lo, unsigned char v) -{ - enable_codecs (); - - write_byte_msb (header_lo); - write_byte_msb (v); - - disable_all (); -} - -// ---------------------------------------------------------------- - -static void -write_byte_msb (unsigned char v) -{ - unsigned char n = 8; - do { - v = (v << 1) | (v >> 7); // rotate left (MSB into bottom bit) - bitS_OUT = v & 0x1; - bitS_CLK = 1; - bitS_CLK = 0; - } while (--n != 0); -} - -// ---------------------------------------------------------------- - #define REG_RX_PWR_DN 1 #define REG_TX_PWR_DN 8 #define REG_TX_MODULATOR 20 @@ -90,15 +56,8 @@ void eeprom_init (void) // USBCS &= ~bmRENUM; // chip firmware handles commands USBCS = 0; // chip firmware handles commands - USRP_PC &= ~bmPC_nRESET; // active low reset - USRP_PC |= bmPC_nRESET; - - // init_spi (); - bitS_OUT = 0; /* idle state has CLK = 0 */ - - write_both_9862s (REG_RX_PWR_DN, 0x01); - write_both_9862s (REG_TX_PWR_DN, 0x0f); // pwr dn digital and analog_both - write_both_9862s (REG_TX_MODULATOR, 0x00); // coarse & fine modulators disabled + //USRP_PC &= ~bmPC_nRESET; // active low reset + //USRP_PC |= bmPC_nRESET; // zero firmware hash slot i = 0; diff --git a/firmware/fx2/src/common/fpga.h b/firmware/fx2/common/fpga.h index 6cd5de8e2..6cd5de8e2 100644 --- a/firmware/fx2/src/common/fpga.h +++ b/firmware/fx2/common/fpga.h diff --git a/firmware/fx2/src/common/fpga_load.h b/firmware/fx2/common/fpga_load.h index 7c36a04c8..7c36a04c8 100644 --- a/firmware/fx2/src/common/fpga_load.h +++ b/firmware/fx2/common/fpga_load.h diff --git a/firmware/fx2/include/fpga_regs0.h b/firmware/fx2/common/fpga_regs0.h index 883798301..883798301 100644 --- a/firmware/fx2/include/fpga_regs0.h +++ b/firmware/fx2/common/fpga_regs0.h diff --git a/firmware/fx2/include/fpga_regs_common.h b/firmware/fx2/common/fpga_regs_common.h index b4a496af7..b4a496af7 100644 --- a/firmware/fx2/include/fpga_regs_common.h +++ b/firmware/fx2/common/fpga_regs_common.h diff --git a/firmware/fx2/include/fpga_regs_common.v b/firmware/fx2/common/fpga_regs_common.v index 8035d8565..8035d8565 100644 --- a/firmware/fx2/include/fpga_regs_common.v +++ b/firmware/fx2/common/fpga_regs_common.v diff --git a/firmware/fx2/include/fpga_regs_standard.h b/firmware/fx2/common/fpga_regs_standard.h index 7485e2bab..7485e2bab 100644 --- a/firmware/fx2/include/fpga_regs_standard.h +++ b/firmware/fx2/common/fpga_regs_standard.h diff --git a/firmware/fx2/include/fpga_regs_standard.v b/firmware/fx2/common/fpga_regs_standard.v index d09aa6116..d09aa6116 100644 --- a/firmware/fx2/include/fpga_regs_standard.v +++ b/firmware/fx2/common/fpga_regs_standard.v diff --git a/firmware/fx2/include/fx2regs.h b/firmware/fx2/common/fx2regs.h index 2f210f567..2f210f567 100644 --- a/firmware/fx2/include/fx2regs.h +++ b/firmware/fx2/common/fx2regs.h diff --git a/firmware/fx2/lib/fx2utils.c b/firmware/fx2/common/fx2utils.c index 64ffcc896..64ffcc896 100644 --- a/firmware/fx2/lib/fx2utils.c +++ b/firmware/fx2/common/fx2utils.c diff --git a/firmware/fx2/include/fx2utils.h b/firmware/fx2/common/fx2utils.h index b184dec27..b184dec27 100644 --- a/firmware/fx2/include/fx2utils.h +++ b/firmware/fx2/common/fx2utils.h diff --git a/firmware/fx2/lib/i2c.c b/firmware/fx2/common/i2c.c index 0f238b5cf..0f238b5cf 100644 --- a/firmware/fx2/lib/i2c.c +++ b/firmware/fx2/common/i2c.c diff --git a/firmware/fx2/include/i2c.h b/firmware/fx2/common/i2c.h index 273526dad..273526dad 100644 --- a/firmware/fx2/include/i2c.h +++ b/firmware/fx2/common/i2c.h diff --git a/firmware/fx2/src/common/init_gpif.c b/firmware/fx2/common/init_gpif.c index edde919be..edde919be 100644 --- a/firmware/fx2/src/common/init_gpif.c +++ b/firmware/fx2/common/init_gpif.c diff --git a/firmware/fx2/lib/isr.c b/firmware/fx2/common/isr.c index 05412daf5..05412daf5 100644 --- a/firmware/fx2/lib/isr.c +++ b/firmware/fx2/common/isr.c diff --git a/firmware/fx2/include/isr.h b/firmware/fx2/common/isr.h index 856532890..856532890 100644 --- a/firmware/fx2/include/isr.h +++ b/firmware/fx2/common/isr.h diff --git a/firmware/fx2/src/usrp1/spi.c b/firmware/fx2/common/spi.c index 0aaffea5d..0c4f63d5a 100644 --- a/firmware/fx2/src/usrp1/spi.c +++ b/firmware/fx2/common/spi.c @@ -21,7 +21,7 @@ */ #include "spi.h" -#include "usrp_rev2_regs.h" +#include "usrp_regs.h" static void setup_enables (unsigned char enables) diff --git a/firmware/fx2/src/usrp1/spi.h b/firmware/fx2/common/spi.h index 5342b82b8..5342b82b8 100644 --- a/firmware/fx2/src/usrp1/spi.h +++ b/firmware/fx2/common/spi.h diff --git a/firmware/fx2/include/syncdelay.h b/firmware/fx2/common/syncdelay.h index 0af7d099f..0af7d099f 100644 --- a/firmware/fx2/include/syncdelay.h +++ b/firmware/fx2/common/syncdelay.h diff --git a/firmware/fx2/lib/timer.c b/firmware/fx2/common/timer.c index 97e2f7cf9..97e2f7cf9 100644 --- a/firmware/fx2/lib/timer.c +++ b/firmware/fx2/common/timer.c diff --git a/firmware/fx2/include/timer.h b/firmware/fx2/common/timer.h index 3181874d5..3181874d5 100644 --- a/firmware/fx2/include/timer.h +++ b/firmware/fx2/common/timer.h diff --git a/firmware/fx2/lib/usb_common.c b/firmware/fx2/common/usb_common.c index 3b0547b2f..3b0547b2f 100644 --- a/firmware/fx2/lib/usb_common.c +++ b/firmware/fx2/common/usb_common.c diff --git a/firmware/fx2/include/usb_common.h b/firmware/fx2/common/usb_common.h index ae07b236c..ae07b236c 100644 --- a/firmware/fx2/include/usb_common.h +++ b/firmware/fx2/common/usb_common.h diff --git a/firmware/fx2/include/usb_descriptors.h b/firmware/fx2/common/usb_descriptors.h index 0b8c6212f..0b8c6212f 100644 --- a/firmware/fx2/include/usb_descriptors.h +++ b/firmware/fx2/common/usb_descriptors.h diff --git a/firmware/fx2/include/usb_requests.h b/firmware/fx2/common/usb_requests.h index 7a543abb0..7a543abb0 100644 --- a/firmware/fx2/include/usb_requests.h +++ b/firmware/fx2/common/usb_requests.h diff --git a/firmware/fx2/include/usrp_commands.h b/firmware/fx2/common/usrp_commands.h index 02778c7e3..02778c7e3 100644 --- a/firmware/fx2/include/usrp_commands.h +++ b/firmware/fx2/common/usrp_commands.h diff --git a/firmware/fx2/src/usrp1/usrp_common.h b/firmware/fx2/common/usrp_common.h index 738ba6b37..fd203927f 100644 --- a/firmware/fx2/src/usrp1/usrp_common.h +++ b/firmware/fx2/common/usrp_common.h @@ -27,9 +27,9 @@ #ifndef _USRPCOMMON_H_ #define _USRPCOMMON_H_ -#include <usrp_config.h> -#include <usrp_rev2_regs.h> -#include <syncdelay.h> +#include "usrp_config.h" +#include "usrp_regs.h" +#include "syncdelay.h" /* * From TRM page 15-105: diff --git a/firmware/fx2/include/usrp_config.h b/firmware/fx2/common/usrp_config.h index e77f8e4c5..e77f8e4c5 100644 --- a/firmware/fx2/include/usrp_config.h +++ b/firmware/fx2/common/usrp_config.h diff --git a/firmware/fx2/src/common/usrp_globals.h b/firmware/fx2/common/usrp_globals.h index 445e9e6b4..445e9e6b4 100644 --- a/firmware/fx2/src/common/usrp_globals.h +++ b/firmware/fx2/common/usrp_globals.h diff --git a/firmware/fx2/include/usrp_i2c_addr.h b/firmware/fx2/common/usrp_i2c_addr.h index 0a4f3ea59..0a4f3ea59 100644 --- a/firmware/fx2/include/usrp_i2c_addr.h +++ b/firmware/fx2/common/usrp_i2c_addr.h diff --git a/firmware/fx2/include/usrp_ids.h b/firmware/fx2/common/usrp_ids.h index 46a069434..ffeb47f3c 100644 --- a/firmware/fx2/include/usrp_ids.h +++ b/firmware/fx2/common/usrp_ids.h @@ -37,7 +37,7 @@ #define USB_PID_FSF_EXP_0 0x0000 // Experimental 0 #define USB_PID_FSF_EXP_1 0x0001 // Experimental 1 #define USB_PID_FSF_USRP 0x0002 // Universal Software Radio Peripheral -#define USB_PID_FSF_USRP_reserved 0x0003 // Universal Software Radio Peripheral +#define USB_PID_FSF_USRP1P 0x0003 // USRP1P #define USB_PID_FSF_SSRP 0x0004 // Simple Software Radio Peripheral #define USB_PID_FSF_SSRP_reserved 0x0005 // Simple Software Radio Peripheral #define USB_PID_FSF_HPSDR 0x0006 // High Performance Software Defined Radio (Internal Boot) diff --git a/firmware/fx2/include/usrp_interfaces.h b/firmware/fx2/common/usrp_interfaces.h index 8666e0490..8666e0490 100644 --- a/firmware/fx2/include/usrp_interfaces.h +++ b/firmware/fx2/common/usrp_interfaces.h diff --git a/firmware/fx2/include/usrp_spi_defs.h b/firmware/fx2/common/usrp_spi_defs.h index 963463ef2..963463ef2 100644 --- a/firmware/fx2/include/usrp_spi_defs.h +++ b/firmware/fx2/common/usrp_spi_defs.h diff --git a/firmware/fx2/src/common/vectors.a51 b/firmware/fx2/common/vectors.a51 index e9382ab84..4eec9fdbf 100644 --- a/firmware/fx2/src/common/vectors.a51 +++ b/firmware/fx2/common/vectors.a51 @@ -29,7 +29,6 @@ ;;; ---------------------------------------------------------------- ;;; standard FX2 interrupt vectors ;;; ---------------------------------------------------------------- - .area CSEG (CODE) .area GSINIT (CODE) .area CSEG (CODE) diff --git a/firmware/fx2/config/.gitignore b/firmware/fx2/config/.gitignore deleted file mode 100644 index 16f775e32..000000000 --- a/firmware/fx2/config/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -/*.cache -/*.la -/*.lo -/*.pc -/.deps -/.la -/.libs -/.lo -/Makefile -/Makefile.in -/libtool.m4 -/lt~obsolete.m4 -/ltsugar.m4 -/ltversion.m4 -/ltoptions.m4 diff --git a/firmware/fx2/config/CMakeASM_SDCCInformation.cmake b/firmware/fx2/config/CMakeASM_SDCCInformation.cmake new file mode 100644 index 000000000..d9f28b8d3 --- /dev/null +++ b/firmware/fx2/config/CMakeASM_SDCCInformation.cmake @@ -0,0 +1,28 @@ +# +# Copyright 2010 Ettus Research LLC +# +# 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 <http://www.gnu.org/licenses/>. +# + +# support for the SDCC assembler, asx8051 +SET( ASM_DIALECT "_SDCC" ) +SET( CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS a51 ) + +#i don't want to talk about it. i had such high hopes for CMake. +SET( CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> -plosgff <SOURCE>" "${CMAKE_COMMAND} -DFILE=<OBJECT> -DSOURCE=<SOURCE> -P ${CMAKE_SOURCE_DIR}/config/Rename.cmake") + +INCLUDE( CMakeASMInformation ) +SET( CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION ".rel" ) #must go here because the include appears to overwrite it, although it shouldn't +# for future use +SET( ASM_DIALECT ) diff --git a/firmware/fx2/config/CMakeDetermineASM_SDCCCompiler.cmake b/firmware/fx2/config/CMakeDetermineASM_SDCCCompiler.cmake new file mode 100644 index 000000000..ab301b9f3 --- /dev/null +++ b/firmware/fx2/config/CMakeDetermineASM_SDCCCompiler.cmake @@ -0,0 +1,22 @@ + +#============================================================================= +# Copyright 2008-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# Find the MS assembler (masm or masm64) + +SET(ASM_DIALECT "_SDCC") + +SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT asx8051) + +INCLUDE(CMakeDetermineASMCompiler) +SET(ASM_DIALECT) diff --git a/firmware/fx2/config/CMakeTestASM_SDCCCompiler.cmake b/firmware/fx2/config/CMakeTestASM_SDCCCompiler.cmake new file mode 100644 index 000000000..1cb71cd9d --- /dev/null +++ b/firmware/fx2/config/CMakeTestASM_SDCCCompiler.cmake @@ -0,0 +1,23 @@ + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This file is used by EnableLanguage in cmGlobalGenerator to +# determine that that selected ASM-ATT compiler can actually compile +# and link the most basic of programs. If not, a fatal error +# is set and cmake stops processing commands and will not generate +# any makefiles or projects. + +SET(ASM_DIALECT "_SDCC") +INCLUDE(CMakeTestASMCompiler) +SET(ASM_DIALECT) diff --git a/firmware/fx2/config/Makefile.am b/firmware/fx2/config/Makefile.am deleted file mode 100644 index 487ceed1b..000000000 --- a/firmware/fx2/config/Makefile.am +++ /dev/null @@ -1,49 +0,0 @@ -# -# Copyright 2001,2006,2008,2009,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/Makefile.common - -# Install m4 macros in this directory -m4datadir = $(datadir)/aclocal - -# List your m4 macros here -m4macros = \ - grc_build.m4 \ - grc_fx2.m4 \ - gr_git.m4 \ - gr_lib64.m4 \ - gr_no_undefined.m4 \ - gr_pwin32.m4 \ - gr_python.m4 \ - gr_require_mc4020.m4 \ - gr_scripting.m4 \ - gr_set_md_cpu.m4 \ - gr_standalone.m4 \ - lf_cc.m4 \ - lf_cxx.m4 \ - lf_warnings.m4 \ - lf_x11.m4 \ - mkstemp.m4 \ - onceonly.m4 \ - pkg.m4 \ - usrp_sdcc.m4 - -EXTRA_DIST = $(m4macros) diff --git a/firmware/fx2/config/Rename.cmake b/firmware/fx2/config/Rename.cmake new file mode 100644 index 000000000..36cd33527 --- /dev/null +++ b/firmware/fx2/config/Rename.cmake @@ -0,0 +1,37 @@ +# +# Copyright 2010 Ettus Research LLC +# +# 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 <http://www.gnu.org/licenses/>. +# + +#go and fetch the real compiler outputs because the compiler does things wrong and CMake is too damn brittle to cope +#just incidentally, why the heck does aslink look for a .lst input? why should it care? + +#first the .rel +get_filename_component(source_noext ${SOURCE} NAME_WE) +get_filename_component(source_path ${SOURCE} PATH) +set(compiled_ext .rel) +list(APPEND compiled_filepath ${source_path}/${source_noext}${compiled_ext}) +#EXECUTE_PROCESS(COMMAND echo Moving ${compiled_filepath} to ${FILE}) +EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E rename ${compiled_filepath} ${FILE}) + +#now do the same for the .lst +set(compiled_lst .lst) +get_filename_component(src_ext ${SOURCE} EXT) +get_filename_component(lst_noext ${FILE} NAME_WE) +get_filename_component(lst_path ${FILE} PATH) +list(APPEND compiled_lstpath ${source_path}/${source_noext}${compiled_lst}) +list(APPEND compiled_outputlstpath ${lst_path}/${lst_noext}${src_ext}${compiled_lst}) +#EXECUTE_PROCESS(COMMAND echo Moving ${compiled_lstpath} to ${compiled_outputlstpath}) +EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E rename ${compiled_lstpath} ${compiled_outputlstpath}) diff --git a/firmware/fx2/config/Toolchain-sdcc.cmake b/firmware/fx2/config/Toolchain-sdcc.cmake new file mode 100644 index 000000000..733d8f563 --- /dev/null +++ b/firmware/fx2/config/Toolchain-sdcc.cmake @@ -0,0 +1,32 @@ +# +# Copyright 2010 Ettus Research LLC +# +# 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 <http://www.gnu.org/licenses/>. +# + +# the name of the target operating system +SET(CMAKE_SYSTEM_NAME Generic) +# which compilers to use for C and C++ +SET(CMAKE_C_COMPILER sdcc) + +# here is where the target environment is located +SET(CMAKE_FIND_ROOT_PATH /usr/bin /usr/share/sdcc) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + diff --git a/firmware/fx2/config/gr_git.m4 b/firmware/fx2/config/gr_git.m4 deleted file mode 100644 index 5e8aa663b..000000000 --- a/firmware/fx2/config/gr_git.m4 +++ /dev/null @@ -1,58 +0,0 @@ -dnl Copyright 2009,2010 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with GNU Radio; see the file COPYING. If not, write to -dnl the Free Software Foundation, Inc., 51 Franklin Street, -dnl Boston, MA 02110-1301, USA. - - -AC_DEFUN([GR_GIT],[ - dnl Identify git binary - AC_PATH_PROG([GIT],[git]) - - dnl If it exists, get either 'git describe' or fallback to current commit - if test x$GIT != x ; then - AC_MSG_CHECKING([existence of git version control directory]) - if test -d $srcdir/.git ; then - AC_MSG_RESULT([ok]) - AC_MSG_CHECKING([git description of current commit]) - if (cd $srcdir && $GIT describe >/dev/null 2>&1); then - GIT_DESCRIBE=`cd $srcdir && $GIT describe --abbrev=8 --long` - GIT_TAG=`echo $GIT_DESCRIBE | cut -f 1 -d '-'` - GIT_SEQNO=`echo $GIT_DESCRIBE | cut -f 2 -d '-'` - GIT_COMMIT=`echo $GIT_DESCRIBE | cut -f 3 -d '-' | cut -f 2- -d 'g'` - # Release candidate tags create an extra -rcX field - if test x`echo $GIT_DESCRIBE | cut -f 1- -d '-' --output-delimiter=' ' | wc -w` = x4; then - GIT_TAG=`echo $GIT_DESCRIBE | cut -f -2 -d '-'` - GIT_SEQNO=`echo $GIT_DESCRIBE | cut -f 3 -d '-'` - GIT_COMMIT=`echo $GIT_DESCRIBE | cut -f 4 -d '-' | cut -f 2- -d 'g'` - fi - AC_MSG_RESULT([$GIT_DESCRIBE]) - else - AC_MSG_RESULT([unable to find, using current commit]) - GIT_TAG='' - GIT_SEQNO='' - GIT_COMMIT=`cd $srcdir && $GIT describe --always --abbrev=8` - fi - else - AC_MSG_RESULT([not found]) - fi - - AC_SUBST([GIT_DESCRIBE]) - AC_SUBST([GIT_TAG]) - AC_SUBST([GIT_SEQNO]) - AC_SUBST([GIT_COMMIT]) - fi -]) diff --git a/firmware/fx2/config/gr_lib64.m4 b/firmware/fx2/config/gr_lib64.m4 deleted file mode 100644 index 751f774b4..000000000 --- a/firmware/fx2/config/gr_lib64.m4 +++ /dev/null @@ -1,85 +0,0 @@ -dnl -dnl Copyright 2005,2008 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with GNU Radio; see the file COPYING. If not, write to -dnl the Free Software Foundation, Inc., 51 Franklin Street, -dnl Boston, MA 02110-1301, USA. -dnl - -dnl GR_LIB64() -dnl -dnl Checks to see if we're on a x86_64 or powerpc64 machine, and if so, determine -dnl if libdir should end in "64" or not. -dnl -dnl Sets gr_libdir_suffix to "" or "64" and calls AC_SUBST(gr_libdir_suffix) -dnl May append "64" to libdir. -dnl -dnl The current heuristic is: -dnl if the host_cpu isn't x86_64 or powerpc64, then "" -dnl if the host_os isn't linux, then "" -dnl if we're cross-compiling, ask the linker, by way of the selected compiler -dnl if we're x86_64 and there's a /lib64 and it's not a symlink, then "64", else "" -dnl else ask the compiler -dnl -AC_DEFUN([GR_LIB64],[ - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_PROG_CXX]) - - AC_MSG_CHECKING([gr_libdir_suffix]) - gr_libdir_suffix="" - AC_SUBST(gr_libdir_suffix) - - case "$host_os" in - linux*) is_linux=yes ;; - *) is_linux=no ;; - esac - - if test "$is_linux" = no || test "$host_cpu" != "x86_64" && test "$host_cpu" != "powerpc64"; then - gr_libdir_suffix="" - elif test "$cross_compiling" = yes; then - _GR_LIB64_ASK_COMPILER - elif test "$host_cpu" = "x86_64"; then - if test -d /lib64 && test ! -L /lib64; then - gr_libdir_suffix=64 - fi - else - _GR_LIB64_ASK_COMPILER - fi - AC_MSG_RESULT([$gr_libdir_suffix]) - - - AC_MSG_CHECKING([whether to append 64 to libdir]) - t=${libdir##*/lib} - if test "$t" != 64 && test "$gr_libdir_suffix" = "64"; then - libdir=${libdir}64 - AC_MSG_RESULT([yes. Setting libdir to $libdir]) - else - AC_MSG_RESULT([no]) - fi -]) - -dnl If we're using g++, extract the first SEARCH_DIR("...") entry from the linker script -dnl and see if it contains a suffix after the final .../lib part of the path. -dnl (This works because the linker script varies depending on whether we're generating -dnl 32-bit or 64-bit executables) -dnl -AC_DEFUN([_GR_LIB64_ASK_COMPILER],[ - if test "$ac_cv_cxx_compiler_gnu" = "yes"; - then - gr_libdir_suffix=`$CXX -Wl,--verbose 2>/dev/null | sed -n -e '/SEARCH_DIR/{s/;.*$//; s,^.*/,,; s/".*$//; s/^lib//; p}'` - fi -]) - diff --git a/firmware/fx2/config/gr_no_undefined.m4 b/firmware/fx2/config/gr_no_undefined.m4 deleted file mode 100644 index c8d745d5f..000000000 --- a/firmware/fx2/config/gr_no_undefined.m4 +++ /dev/null @@ -1,44 +0,0 @@ -dnl -dnl Copyright 2005 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with GNU Radio; see the file COPYING. If not, write to -dnl the Free Software Foundation, Inc., 51 Franklin Street, -dnl Boston, MA 02110-1301, USA. -dnl - -# GR_NO_UNDEFINED() -# -# Detemine whether we need to use the -no-undefined linker flag -# when building shared libraries. -# Sets NO_UNDEFINED to "" or "-no-undefined" -# -# As far as I can tell, we need -no-undefined only when building -# windows DLLs. This occurs when using MinGW and Cygwin. -# -# For now, we stub this out. - -AC_DEFUN([GR_NO_UNDEFINED],[ - AC_REQUIRE([AC_CANONICAL_HOST]) - no_undefined="" - case "${host_os}" in - *mingw* | *cygwin*) - - # on MinGW/Cygwin extra LDFLAGS are required - no_undefined="-no-undefined" - ;; - esac - AC_SUBST(NO_UNDEFINED,[$no_undefined]) -]) diff --git a/firmware/fx2/config/gr_pwin32.m4 b/firmware/fx2/config/gr_pwin32.m4 deleted file mode 100644 index 495e9dd4d..000000000 --- a/firmware/fx2/config/gr_pwin32.m4 +++ /dev/null @@ -1,149 +0,0 @@ -# Check for (mingw)win32 POSIX replacements. -*- Autoconf -*- - -# Copyright 2003,2004,2005 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. - - -AC_DEFUN([GR_PWIN32], -[ -AC_REQUIRE([AC_HEADER_TIME]) -AC_CHECK_HEADERS([sys/types.h fcntl.h io.h]) -AC_CHECK_HEADERS([windows.h]) -AC_CHECK_HEADERS([winioctl.h winbase.h], [], [], [ - #if HAVE_WINDOWS_H - #include <windows.h> - #endif -]) - -AC_CHECK_FUNCS([getopt usleep gettimeofday nanosleep rand srand random srandom sleep sigaction]) -AC_CHECK_TYPES([struct timezone, struct timespec, ssize_t],[],[],[ - #if HAVE_SYS_TYPES_H - # include <sys/types.h> - #endif - #if TIME_WITH_SYS_TIME - # include <sys/time.h> - # include <time.h> - #else - # if HAVE_SYS_TIME_H - # include <sys/time.h> - # else - # include <time.h> - # endif - #endif -]) - -dnl Checks for replacements -AC_REPLACE_FUNCS([getopt usleep gettimeofday]) - - -AC_MSG_CHECKING(for Sleep) -AC_TRY_LINK([ #include <windows.h> - #include <winbase.h> - ], [ Sleep(0); ], - [AC_DEFINE(HAVE_SSLEEP,1,[Define to 1 if you have win32 Sleep]) - AC_MSG_RESULT(yes)], - AC_MSG_RESULT(no) - ) - -dnl Under Win32, mkdir prototype in io.h has only one arg -AC_MSG_CHECKING(whether mkdir accepts only one arg) -AC_TRY_COMPILE([#include <sys/types.h> - #include <sys/stat.h> - #include <fcntl.h>], [ - mkdir("") - ], [ AC_MSG_RESULT(yes) - AC_DEFINE(MKDIR_TAKES_ONE_ARG,[],[Define if mkdir accepts only one arg]) ], - [ AC_MSG_RESULT(no) - ]) - -AH_BOTTOM( -[ -/* Define missing prototypes, implemented in replacement lib */ -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef HAVE_GETOPT -int getopt (int argc, char * const argv[], const char * optstring); -extern char * optarg; -extern int optind, opterr, optopt; -#endif - -#ifndef HAVE_USLEEP -int usleep(unsigned long usec); /* SUSv2 */ -#endif - -#ifndef HAVE_NANOSLEEP -#ifndef HAVE_STRUCT_TIMESPEC -#if HAVE_SYS_TYPES_H -# include <sys/types.h> /* need time_t */ -#endif -struct timespec { - time_t tv_sec; - long tv_nsec; -}; -#endif -#if HAVE_UNISTD_H -#include <unistd.h> -#endif -static inline int nanosleep(const struct timespec *req, struct timespec *rem) { return usleep(req->tv_sec*1000000+req->tv_nsec/1000); } -#endif - -#if defined(HAVE_SSLEEP) && !defined(HAVE_SLEEP) -#ifdef HAVE_WINBASE_H -#include <windows.h> -#include <winbase.h> -#endif -/* TODO: what about SleepEx? */ -static inline unsigned int sleep (unsigned int nb_sec) { Sleep(nb_sec*1000); return 0; } -#endif - -#ifndef HAVE_GETTIMEOFDAY -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#ifndef HAVE_STRUCT_TIMEZONE -struct timezone { - int tz_minuteswest; - int tz_dsttime; -}; -#endif -int gettimeofday(struct timeval *tv, struct timezone *tz); -#endif - -#if !defined(HAVE_RANDOM) && defined(HAVE_RAND) -#include <stdlib.h> -static inline long int random (void) { return rand(); } -#endif - -#if !defined(HAVE_SRANDOM) && defined(HAVE_SRAND) -static inline void srandom (unsigned int seed) { srand(seed); } -#endif - -#ifndef HAVE_SSIZE_T -typedef size_t ssize_t; -#endif - -#ifdef __cplusplus -} -#endif -]) - - -]) diff --git a/firmware/fx2/config/gr_python.m4 b/firmware/fx2/config/gr_python.m4 deleted file mode 100644 index 43ccfc015..000000000 --- a/firmware/fx2/config/gr_python.m4 +++ /dev/null @@ -1,172 +0,0 @@ -dnl -dnl Copyright 2003,2004,2005 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with GNU Radio; see the file COPYING. If not, write to -dnl the Free Software Foundation, Inc., 51 Franklin Street, -dnl Boston, MA 02110-1301, USA. -dnl - -# PYTHON_DEVEL() -# -# Checks for Python and tries to get the include path to 'Python.h'. -# It sets the $(PYTHON_CPPFLAGS), $(PYTHON_LDFLAGS) and $(pythondir) output variables, -# -AC_DEFUN([PYTHON_DEVEL],[ - AC_REQUIRE([AM_PATH_PYTHON]) - AC_REQUIRE([AC_CANONICAL_HOST]) - - AC_ARG_WITH(pythondir, - AC_HELP_STRING([--with-pythondir=DIR], - [python installation directory (cross-compiling) [[default=$prefix/lib/python2.5/site-packages]]]), - [with_pythondir=${withval}],[with_pythondir=${prefix}/lib/python2.5/site-packages]) - - # if we're cross-compiling, asking the host python about any of - # this is completely useless... - - if test x$cross_compiling != xno - then - pythondir=$with_pythondir - pyexecdir=$with_pythondir - AC_SUBST(PYTHON_CPPFLAGS) - AC_SUBST(PYTHON_LDFLAGS) - else - - # For Fedora Core 5 and 6, see ticket:39 in Trac - if test -f '/etc/redhat-release'; then - if (echo $pyexecdir | grep -q lib64); then - pythondir="$pyexecdir" - fi - fi - - # Check for Python include path - AC_MSG_CHECKING([for Python include path]) - if test -z "$PYTHON" ; then - AC_MSG_ERROR([cannot find Python path]) - fi - - # ask distutils which include path we should use - python_cmd=' -import distutils.sysconfig -import os -path = distutils.sysconfig.get_python_inc(plat_specific=False) -if os.sep == "\\": - path = path.replace("\\", "/") -print path -' - python_path=`$PYTHON -c "$python_cmd"` - AC_MSG_RESULT([$python_path]) - if test -z "$python_path" ; then - AC_MSG_ERROR([cannot find Python include path]) - fi - - AC_SUBST(PYTHON_CPPFLAGS,[-I$python_path]) - - # Check for Python headers usability - python_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS" - AC_CHECK_HEADERS([Python.h], [], - [AC_MSG_ERROR([cannot find usable Python headers])]) - CPPFLAGS="$python_save_CPPFLAGS" - - # Only set this on mingw and cygwin hosts, (only implemented - # for mingw host, for crosscompiling you need to trick this) - - PYTHON_LDFLAGS="" - case $host_os in - *mingw* | *cygwin* ) - AC_MSG_CHECKING([for Python LDFLAGS]) - - python_cmd=' -import distutils.sysconfig -import os -path = distutils.sysconfig.get_config_var("LIBPL") -if path == None: - path = distutils.sysconfig.PREFIX + "/libs" -if os.sep == "\\": - path = path.replace("\\", "/") -print path -' - python_stdlib_path=`$PYTHON -c "$python_cmd"` - - python_version_nodot=`echo $PYTHON_VERSION | sed "s,\.,,"` - libpython_name="python$PYTHON_VERSION" - - # Standard install of python for win32 has libpython24.a - # instead of libpython2.4.a so we check for the library - # without the dot in the version number. - - python_stdlib_filename=`find $python_stdlib_path -type f -name libpython$python_version_nodot.* -print | sed "1q"` - if test -n "$python_stdlib_filename" ; then - libpython_name="python$python_version_nodot" - fi - - PYTHON_LDFLAGS="-L$python_stdlib_path -l$libpython_name" - AC_MSG_RESULT($PYTHON_LDFLAGS) - # Replace all backslashes in PYTHON Paths with forward slashes - pythondir=`echo $pythondir |sed 's,\\\\,/,g'` - pkgpythondir=`echo $pkgpythondir |sed 's,\\\\,/,g'` - pyexecdir=`echo $pyexecdir |sed 's,\\\\,/,g'` - pkgpyexecdir=`echo $pkgpyexecdir |sed 's,\\\\,/,g'` - ;; - esac - - case $host_os in - *mingw* ) - # Python 2.5 requires ".pyd" instead of ".dll" for extensions - PYTHON_LDFLAGS="-shrext .pyd ${PYTHON_LDFLAGS}" - esac - - AC_SUBST(PYTHON_LDFLAGS) - fi -]) - -# PYTHON_CHECK_MODULE -# -# Determines if a particular Python module can be imported -# -# $1 - module name -# $2 - module description -# $3 - action if found -# $4 - action if not found -# $5 - test command - -AC_DEFUN([PYTHON_CHECK_MODULE],[ - AC_MSG_CHECKING([for $2]) - dnl ######################################## - dnl # import and test checking - dnl ######################################## - if test "$5"; then - python_cmd=' -try: - import $1 - assert $5 -except: exit(1)' - dnl ######################################## - dnl # import checking only - dnl ######################################## - else - python_cmd=' -try: import $1 -except: exit(1)' - fi - if ! $PYTHON -c "$python_cmd" 2> /dev/null; then - AC_MSG_RESULT([no]) - $4 - else - AC_MSG_RESULT([yes]) - $3 - fi -]) diff --git a/firmware/fx2/config/gr_scripting.m4 b/firmware/fx2/config/gr_scripting.m4 deleted file mode 100644 index 2803e975f..000000000 --- a/firmware/fx2/config/gr_scripting.m4 +++ /dev/null @@ -1,26 +0,0 @@ -dnl -dnl Copyright 2003 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with GNU Radio; see the file COPYING. If not, write to -dnl the Free Software Foundation, Inc., 51 Franklin Street, -dnl Boston, MA 02110-1301, USA. -dnl - -AC_DEFUN([GR_SCRIPTING],[ - AC_REQUIRE([AC_PROG_LN_S]) - AC_REQUIRE([AC_PROG_CXX]) - AC_REQUIRE([AC_PROG_LIBTOOL]) -]) diff --git a/firmware/fx2/config/gr_standalone.m4 b/firmware/fx2/config/gr_standalone.m4 deleted file mode 100644 index 370f7fb03..000000000 --- a/firmware/fx2/config/gr_standalone.m4 +++ /dev/null @@ -1,116 +0,0 @@ -dnl -dnl Copyright 2008 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License along -dnl with this program; if not, write to the Free Software Foundation, Inc., -dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -dnl - -dnl -dnl GR_STANDALONE([package],[version]) -dnl -dnl Handles the bulk of the configure.ac work for an out-of-tree build -dnl -dnl N.B., this is an m4_define because if it were an AC_DEFUN it would -dnl get called too late to be useful. - -m4_define([GR_STANDALONE], -[ - AC_INIT([$1],[$2]) - AC_PREREQ(2.57) - AC_CONFIG_SRCDIR([config/gr_standalone.m4]) - AC_CONFIG_AUX_DIR([.]) - AM_CONFIG_HEADER(config.h) - - AC_CANONICAL_BUILD - AC_CANONICAL_HOST - AC_CANONICAL_TARGET - - AM_INIT_AUTOMAKE - - LF_CONFIGURE_CC - LF_CONFIGURE_CXX - GR_LIB64 dnl check for lib64 suffix after choosing compilers - - dnl add ${prefix}/lib${gr_libdir_suffix}/pkgconfig to the head of the PKG_CONFIG_PATH - if test x${PKG_CONFIG_PATH} = x; then - PKG_CONFIG_PATH=${prefix}/lib${gr_libdir_suffix}/pkgconfig - else - PKG_CONFIG_PATH=${prefix}/lib${gr_libdir_suffix}/pkgconfig:${PKG_CONFIG_PATH} - fi - export PKG_CONFIG_PATH - - LF_SET_WARNINGS - GR_SET_GPROF - GR_SET_PROF - AM_PROG_AS - AC_PROG_LN_S - AC_PROG_MAKE_SET - AC_PROG_INSTALL - AC_PATH_PROG([RM_PROG], [rm]) - - AC_LIBTOOL_WIN32_DLL - AC_ENABLE_SHARED dnl do build shared libraries - AC_DISABLE_STATIC dnl don't build static libraries - m4_ifdef([LT_INIT],[LT_INIT],[AC_PROG_LIBTOOL]) - dnl GR_FORTRAN - - GR_NO_UNDEFINED dnl do we need the -no-undefined linker flag - GR_SCRIPTING dnl Locate python, SWIG, etc - - AC_ARG_WITH([python], - AC_HELP_STRING([--with-python], [Should we use python? [[default=yes]]]), - [case "$with_python" in - (no | yes) ;; - (*) AC_MSG_ERROR([Invalid argument ($with_python) to --with-python]) ;; - esac], - [with_python=yes]) - - AM_CONDITIONAL([USE_PYTHON], [test "$with_python" = yes]) - - - dnl Set the c++ compiler that we use for the build system when cross compiling - if test "x$CXX_FOR_BUILD" = x - then - CXX_FOR_BUILD=${CXX} - fi - AC_SUBST(CXX_FOR_BUILD) - - dnl Checks for header files. - AC_HEADER_STDC - - dnl Checks for typedefs, structures, and compiler characteristics. - AC_C_CONST - AC_C_INLINE - AC_TYPE_SIZE_T - AC_HEADER_TIME - AC_C_BIGENDIAN - - dnl Check for Mingw support - GR_PWIN32 - - AC_CHECK_PROG([XMLTO],[xmlto],[yes],[]) - AM_CONDITIONAL([HAS_XMLTO], [test x$XMLTO = xyes]) - - dnl Define where to look for cppunit includes and libs - dnl sets CPPUNIT_CFLAGS and CPPUNIT_LIBS - dnl Try using pkg-config first, then fall back to cppunit-config. - PKG_CHECK_EXISTS(cppunit, - [PKG_CHECK_MODULES(CPPUNIT, cppunit >= 1.9.14)], - [AM_PATH_CPPUNIT([1.9.14],[], - [AC_MSG_ERROR([GNU Radio requires cppunit. Stop])])]) - - PKG_CHECK_MODULES(GNURADIO_CORE, gnuradio-core >= 3) -]) diff --git a/firmware/fx2/config/grc_build.m4 b/firmware/fx2/config/grc_build.m4 deleted file mode 100644 index 77b59db6b..000000000 --- a/firmware/fx2/config/grc_build.m4 +++ /dev/null @@ -1,287 +0,0 @@ -dnl Copyright 2006,2008,2009 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with GNU Radio; see the file COPYING. If not, write to -dnl the Free Software Foundation, Inc., 51 Franklin Street, -dnl Boston, MA 02110-1301, USA. - -dnl Create --enable-foo argument for named component, create variables as needed -dnl $1 is component name -AC_DEFUN([GRC_ENABLE], [ - _GRC_ENABLE($1,m4_bpatsubst($1,-,_)) -]) -dnl $2 is the '_'d component name -dnl on exit variable enable_$2 will be set to [yes|no]; -dnl passed will be [yes|no] (same as enable_$2) - -AC_DEFUN([_GRC_ENABLE],[ - passed=yes - AC_ARG_ENABLE([$1], - AC_HELP_STRING([--enable-$1], - [Stop if $1 fails configuration]), - [],[ - [enable_]$2=$enable_all_components - if test x$enable_all_components = xno; then - passed=no - fi - ]) -]) -dnl Component specific configuration -dnl The order of the GR_ macros determines the order of compilation -dnl For -any- checks on $enable_all_components -dnl use the following guildlines: -dnl yes : --enable-all-components was specified, so error out if any -dnl components do not pass configuration checks. -dnl no : --disable-all-components was specified, so try to build the -dnl --enable'd components, and error out if any do not pass -dnl configuration checks. -dnl "" : this option was not specified on the command line; try to -dnl build all components that are not --with'd, but don't -dnl error out if any component does not pass configuration checks. -dnl -dnl For each --enable-foo component, if that flag is not specified on -dnl the command line, the related variable $enable_foo will be set to -dnl $enable_all_components . - -dnl Create --with-foo argument for named compoment, create variables as needed -dnl $1 is component name -dnl $2 is what to do on success -dnl $3 is the PKG_CONFIG name; if not given, then $1 -AC_DEFUN([GRC_WITH], [ - if test [x]$3 = x; then - pc_comp_name="$1" - else - pc_comp_name="$3" - fi - _GRC_WITH($1,[$2],${pc_comp_name},m4_bpatsubst($1,-,_)) -]) -dnl $3 is the pkg-config component name -dnl $4 is the '_'d component name -dnl on exit variable passed will be [yes|no|with]: -dnl yes: if --enable-$1 and/or --enable-all-components was specified, -dnl but --with was not; -dnl with: if --with-$1 was specified, and passed checks; -dnl no: all other conditions -AC_DEFUN([_GRC_WITH],[ - AC_ARG_WITH([$1], - AC_HELP_STRING([--with-$1@<:@=PATH@:>@], - [Use package $1 if installed in PATH (if specified) or PKG_CONFIG_PATH (if PATH not specified); stop if $1 not found]), - [if test "x$withval" != "xyes"; then - [with_]$4[_val]=$withval - [with_]$4=yes - fi], - []) - if test x$[with_]$4 = xyes; then - if test x$[enable_]$4 = xyes; then - AC_MSG_ERROR([Component $1: Cannot use both --enable and --with]) - else - _GRC_WITH_PKG_CONFIG_CHECK($1,$3,$4) - ifelse([$2], , :, [$2]) - fi - fi -]) - -dnl Use 'pkgconfig' to check for a package -dnl $1 is the --with component name -dnl $2 is the pkg-config component name, if provided; otherwise use $1 for this -dnl on success, resulting INCLUDES, INCLUDEDIR, LA, and LIBDIRPATH variables -dnl will be set; on failure, will exit with an error. -AC_DEFUN([GRC_WITH_PKG_CONFIG_CHECK], [ - if test [x]$2 = x; then - pc_comp_name="$1" - else - pc_comp_name="$2" - fi - _GRC_WITH_PKG_CONFIG_CHECK($1,${pc_comp_name},m4_bpatsubst($1,-,_)) -]) -dnl $2 is the pkg-config component name -dnl $3 is the '_'d component name -AC_DEFUN([_GRC_WITH_PKG_CONFIG_CHECK],[ - dnl save PKG_CONFIG_PATH, restore at the end - s_PKG_CONFIG_PATH=$PKG_CONFIG_PATH - - dnl create the PKG_CONFIG_PATH, via this component arg, if provided; - dnl else use the environment PKG_CONFIG_PATH - l_PKG_CONFIG_PATH=$[with_]$3[_val] - if test "x$l_PKG_CONFIG_PATH" != "x"; then - export PKG_CONFIG_PATH=$l_PKG_CONFIG_PATH - - dnl verify that the file exists; if not, no point in continuing - if ! test -r ${l_PKG_CONFIG_PATH}/$2[.pc]; then - AC_MSG_ERROR([Component $1: PKGCONFIG cannot find info for $2, with provided PKG_CONFIG_PATH = @<:@ $l_PKG_CONFIG_PATH @:>@ .]) - fi - fi - - dnl do the check; error out if not found - PKG_CHECK_EXISTS($2, [passed=with; check1=yes], [ - check1=no - dnl pkg-config returned an error; this might be that the .pc - dnl file was not valid, or the Requires: were not met. - dnl If the arg was provided and the input PKG_CONFIG_PATH , then try - dnl again appending the whole PKG_CONFIG_PATH. - if test "x$l_PKG_CONFIG_PATH" != "x"; then - if test "x$s_PKG_CONFIG_PATH" != "x"; then - export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${s_PKG_CONFIG_PATH} - PKG_CHECK_EXISTS($2, passed=with, passed=no) - fi - fi - if test $passed != with; then - AC_MSG_ERROR([Component $1: PKGCONFIG cannot find info for $2, with PKG_CONFIG_PATH = @<:@ $PKG_CONFIG_PATH @:>@ .]) - fi - dnl pkg-config Requires are now met; save the new PKG_CONFIG_PATH - s_PKG_CONFIG_PATH=$PKG_CONFIG_PATH - ]) - - dnl if PKG_CHECK_EXISTS returned, then this component's .pc file was - dnl found in the provided 'arg' PKG_CONFIG_PATH; - dnl retrieve various parameters - $3[_INCLUDES]=`$PKG_CONFIG --cflags-only-I $2` - $3[_LA]=`$PKG_CONFIG --libs $2` - $3[_INCLUDEDIR]=`$PKG_CONFIG --variable=includedir $2` - - if test x$check1 = xyes; then - dnl prepend the args PKG_CONFIG_PATH to the saved one, if the - dnl saved version was not empty - if test "x$s_PKG_CONFIG_PATH" != "x"; then - export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${s_PKG_CONFIG_PATH} - fi - fi -]) - -dnl Check the $prefix versus the --with libdirpath for this component -dnl $1 is the prefix -dnl $2 is the --with component name -dnl $3 is the --with component library path -AC_DEFUN([GRC_PREFIX_LDFLAGS],[ - $2[_LIBDIRPATH]=$3 - dnl create LDFLAGS for this --with, if different from the provided $prefix - if test [x]$1[/lib] != [x]$3; then - $2[_LDFLAG]=[-L]$3 - else - $2[_LDFLAG]= - fi -]) - -dnl Check to make sure this dependency is fulfilled for this component -dnl $1 is the component's name -dnl $2 is the component dependency name -dnl On input and exit, $passed will be: -dnl with : if --with passed muster -dnl yes : if --enable passed muster -dnl no : otherwise -dnl If trying --with, will error-out if any dependency was not --with'd -AC_DEFUN([GRC_CHECK_DEPENDENCY],[ -dnl f0=[enable_]m4_bpatsubst($1,-,_) -dnl f1=[$enable_]m4_bpatsubst($1,-,_) -dnl echo -dnl echo "$1 : Checking Dependency $2" -dnl echo "$1 : enable_all_components is '$enable_all_components'" -dnl echo "$1 : $f0 is '$f1'" -dnl echo "$1 : passed is '$passed'" -dnl echo - if test $passed != no; then - if test $passed = yes; then - dnl make sure this dependency was not skipped - if test [x$]m4_bpatsubst($2,-,_)[_skipped] = xyes; then - AC_MSG_RESULT([Component $1 requires $2, which is not being built or specified via pre-installed files.]) - passed=no - fi - else - dnl make sure this dependency was --with'd only; not --enable'd - if test [x$]m4_bpatsubst($2,-,_)[_with] = xno; then - AC_MSG_ERROR([Component $1 requires $2 to be included as --with-$2@<:@=arg@:>@]) - fi - fi - fi -]) - -dnl Check to make sure GUILE is available -dnl $1 is the component name -AC_DEFUN([GRC_CHECK_GUILE],[ - if test x"$GUILE" = x; then - AC_MSG_RESULT([Component $1 requires guile, which was not found.]) - passed=no - fi -]) - -dnl Add the specified "with" list; clear the provided variable -dnl $1 is the component name -dnl $2 is the path list name suffix -dnl $3 is the separator (for paths, ":"; for includes " ") -AC_DEFUN([GRC_ADD_TO_LIST],[ - if test "x${$1[_]$2}" != "x"; then - if test "x$[with_]$2" = "x"; then - [with_]$2="${$1[_]$2}" - else - [with_]$2="${$1[_]$2}"$3"$[with_]$2" - fi - $1[_]$2= - fi -]) - -dnl Conditionally build named component. -dnl $1 is component name -dnl $2 is executed if configuration passes and build is desired -AC_DEFUN([GRC_BUILD_CONDITIONAL],[ - _GRC_BUILD_CONDITIONAL($1, $2, m4_bpatsubst($1,-,_)) -]) -dnl $3=m4_bpatsubst($1,-,_) -dnl Use $passed=no to indicate configuration failure; -dnl Use $passed=with to indicate the use of pre-installed libraries and headers; -dnl Any other value of $passed, including blank, assumes success; -dnl Defines $3_with=[yes|no] depending on if $passed=with or not (respectively) -dnl Defines $3_skipped=[yes|no] depending on if $passed=no or not (respectively) -AC_DEFUN([_GRC_BUILD_CONDITIONAL],[ - $3[_with]=no - if test $passed = no; then - if test x$[enable_]$3 = xyes; then - AC_MSG_ERROR([Component $1 has errors; stopping.]) - else - AC_MSG_RESULT([Not building component $1.]) - fi - else - if test $passed = with; then - with_dirs="$with_dirs $1" - GRC_ADD_TO_LIST($3, INCLUDES, " ") - GRC_ADD_TO_LIST($3, SWIG_INCLUDES, " ") - GRC_ADD_TO_LIST($3, PYDIRPATH, ":") - GRC_ADD_TO_LIST($3, SWIGDIRPATH, ":") - GRC_ADD_TO_LIST($3, LIBDIRPATH, ":") - AC_MSG_RESULT([Component $1 will be included from a pre-installed library and includes.]) - $3[_with]=yes - else - $3[_LDFLAG]= - if test x$[enable_]$3 != xno; then - ifelse([$2], , :, [$2]) - build_dirs="$build_dirs $1" - AC_MSG_RESULT([Component $1 passed configuration checks; building.]) - else - passed=no - AC_MSG_RESULT([Component $1 passed configuration checks; but not building.]) - fi - fi - fi - if test $passed = no; then - skipped_dirs="$skipped_dirs $1" - $3[_skipped]=yes - else - $3[_skipped]=no - fi - AC_SUBST($3[_INCLUDES]) - AC_SUBST($3[_LA]) - AC_SUBST($3[_INCLUDEDIR]) - AC_SUBST($3[_LIBDIRPATH]) - AC_SUBST($3[_LDFLAG]) -]) diff --git a/firmware/fx2/config/grc_fx2.m4 b/firmware/fx2/config/grc_fx2.m4 deleted file mode 100644 index 00a41c973..000000000 --- a/firmware/fx2/config/grc_fx2.m4 +++ /dev/null @@ -1,58 +0,0 @@ -dnl Copyright 2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with GNU Radio; see the file COPYING. If not, write to -dnl the Free Software Foundation, Inc., 51 Franklin Street, -dnl Boston, MA 02110-1301, USA. - -AC_DEFUN([GRC_FX2],[ - GRC_ENABLE(usrp) - - GRC_WITH(usrp) - - dnl If execution gets to here, $passed will be: - dnl with : if the --with code didn't error out - dnl yes : if the --enable code passed muster and all dependencies are met - dnl no : otherwise - if test $passed = yes; then - dnl gnulib. - dnl FIXME: this needs to fail gracefully and continue, not implemented yet - UTILS_FUNC_MKSTEMP - - dnl These checks don't fail - AC_C_BIGENDIAN - AC_CHECK_HEADERS([byteswap.h linux/compiler.h]) - AC_CHECK_FUNCS([getrusage sched_setscheduler pthread_setschedparam]) - AC_CHECK_FUNCS([sigaction snprintf]) - - dnl Make sure SDCC >= 2.4.0 is available. - USRP_SDCC([2.4.0],[],[passed=no;AC_MSG_RESULT([Unable to find firmware compiler SDCC.])]) - fi - if test $passed != with; then - dnl how and where to find INCLUDES and LA - usrp_INCLUDES=" \ - -I\${abs_top_srcdir}/include" - fi - - AC_CONFIG_FILES([ \ - include/Makefile \ - lib/Makefile \ - src/Makefile \ - src/common/Makefile \ - src/usrp1/Makefile \ - ]) - - GRC_BUILD_CONDITIONAL(usrp) -]) diff --git a/firmware/fx2/config/lf_cc.m4 b/firmware/fx2/config/lf_cc.m4 deleted file mode 100644 index b75e1a4c5..000000000 --- a/firmware/fx2/config/lf_cc.m4 +++ /dev/null @@ -1,41 +0,0 @@ -dnl Autoconf support for C++ -dnl Copyright (C) 1988 Eleftherios Gkioulekas <lf@amath.washington.edu> -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3 of the License, or -dnl (at your option) any later version. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301, USA. -dnl -dnl As a special exception to the GNU General Public License, if you -dnl distribute this file as part of a program that contains a configuration -dnl script generated by Autoconf, you may include it under the same -dnl distribution terms that you use for the rest of that program. - -# ------------------------------------------------------------------------- -# Use this macro to configure your C compiler -# When called the macro does the following things: -# 1. It finds an appropriate C compiler. -# If you passed the flag --with-cc=foo then it uses that -# particular compiler -# 2. Check whether the compiler works. -# 3. Checks whether the compiler accepts the -g -# ------------------------------------------------------------------------- - -AC_DEFUN([LF_CONFIGURE_CC],[ - dnl Sing the song - AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AC_PROG_CPP])dnl - AC_REQUIRE([AC_AIX])dnl - AC_REQUIRE([AC_ISC_POSIX])dnl - AC_REQUIRE([AC_HEADER_STDC])dnl -]) - diff --git a/firmware/fx2/config/lf_cxx.m4 b/firmware/fx2/config/lf_cxx.m4 deleted file mode 100644 index dfc6bfbfe..000000000 --- a/firmware/fx2/config/lf_cxx.m4 +++ /dev/null @@ -1,67 +0,0 @@ -dnl Autoconf support for C++ -dnl Copyright (C) 1988 Eleftherios Gkioulekas <lf@amath.washington.edu> -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3 of the License, or -dnl (at your option) any later version. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301, USA. -dnl -dnl As a special exception to the GNU General Public License, if you -dnl distribute this file as part of a program that contains a configuration -dnl script generated by Autoconf, you may include it under the same -dnl distribution terms that you use for the rest of that program. - -# ----------------------------------------------------------------- -# This macro should be called to configure your C++ compiler. -# When called, the macro does the following things: -# 1. It finds an appropriate C++ compiler -# If you passed the flag --with-cxx=foo, then it uses that -# particular compiler -# 2. Checks whether the compiler accepts the -g -# ------------------------------------------------------------------ - -AC_DEFUN([LF_CONFIGURE_CXX],[ - AC_REQUIRE([AC_PROG_CXX])dnl - AC_REQUIRE([AC_PROG_CXXCPP])dnl - LF_CXX_PORTABILITY -]) - -# ----------------------------------------------------------------------- -# This macro tests the C++ compiler for various portability problem. -# ----------------------------------------------------------------------- - - -AC_DEFUN([LF_CXX_PORTABILITY],[ - - dnl - dnl Check for common C++ portability problems - dnl - - dnl AC_LANG_PUSH - dnl AC_LANG_CPLUSPLUS - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - - - dnl Test whether C++ has std::isnan - AC_MSG_CHECKING(whether C++ has std::isnan) - AC_TRY_COMPILE([#include <cmath>], [ - std::isnan(0); -], [ AC_MSG_RESULT(yes) - AC_DEFINE(CXX_HAS_STD_ISNAN,[],[Define if has std::isnan]) ], - [ AC_MSG_RESULT(no) ]) - - dnl Done with the portability checks - dnl AC_LANG_POP([C++]) - AC_LANG_RESTORE -]) - diff --git a/firmware/fx2/config/lf_warnings.m4 b/firmware/fx2/config/lf_warnings.m4 deleted file mode 100644 index d40c77f14..000000000 --- a/firmware/fx2/config/lf_warnings.m4 +++ /dev/null @@ -1,121 +0,0 @@ -dnl Copyright (C) 1988 Eleftherios Gkioulekas <lf@amath.washington.edu> -dnl Copyright (C) 2009 Free Software Foundation, Inc. -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3 of the License, or -dnl (at your option) any later version. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301, USA. -dnl -dnl As a special exception to the GNU General Public License, if you -dnl distribute this file as part of a program that contains a configuration -dnl script generated by Autoconf, you may include it under the same -dnl distribution terms that you use for the rest of that program. - -# -------------------------------------------------------------------------- -# Check whether the C++ compiler accepts a certain flag -# If it does it adds the flag to lf_CXXFLAGS -# If it does not then it returns an error to lf_ok -# Usage: -# LF_CHECK_CXX_FLAG(-flag1 -flag2 -flag3 ...) -# ------------------------------------------------------------------------- - -AC_DEFUN([LF_CHECK_CXX_FLAG],[ - echo 'void f(){}' > conftest.cc - for i in $1 - do - AC_MSG_CHECKING([whether $CXX accepts $i]) - if test -z "`${CXX} $i -c conftest.cc 2>&1`" - then - lf_CXXFLAGS="${lf_CXXFLAGS} $i" - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - done - rm -f conftest.cc conftest.o - AC_SUBST(lf_CXXFLAGS) -]) - -# -------------------------------------------------------------------------- -# Check whether the C compiler accepts a certain flag -# If it does it adds the flag to lf_CFLAGS -# If it does not then it returns an error to lf_ok -# Usage: -# LF_CHECK_CC_FLAG(-flag1 -flag2 -flag3 ...) -# ------------------------------------------------------------------------- - -AC_DEFUN([LF_CHECK_CC_FLAG],[ - echo 'void f(){}' > conftest.c - for i in $1 - do - AC_MSG_CHECKING([whether $CC accepts $i]) - if test -z "`${CC} $i -c conftest.c 2>&1`" - then - lf_CFLAGS="${lf_CFLAGS} $i" - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - done - rm -f conftest.c conftest.o - AC_SUBST(lf_CFLAGS) -]) - -# -------------------------------------------------------------------------- -# Check whether the Fortran compiler accepts a certain flag -# If it does it adds the flag to lf_FFLAGS -# If it does not then it returns an error to lf_ok -# Usage: -# LF_CHECK_F77_FLAG(-flag1 -flag2 -flag3 ...) -# ------------------------------------------------------------------------- - -AC_DEFUN([LF_CHECK_F77_FLAG],[ - cat << EOF > conftest.f -c....:++++++++++++++++++++++++ - PROGRAM MAIN - PRINT*,'Hello World!' - END -EOF - for i in $1 - do - AC_MSG_CHECKING([whether $F77 accepts $i]) - if test -z "`${F77} $i -c conftest.f 2>&1`" - then - lf_FFLAGS="${lf_FFLAGS} $i" - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - done - rm -f conftest.f conftest.o - AC_SUBST(lf_FFLAGS) -]) - -# ---------------------------------------------------------------------- -# Enable compiler warnings. -# Call this command AFTER you have configured ALL your compilers. -# ---------------------------------------------------------------------- - -AC_DEFUN([LF_SET_WARNINGS],[ - dnl Warnings for the two main compilers - dnl add -Wextra when you're got time to fix a bunch of them ;-) - cc_warning_flags="-Wall -Werror-implicit-function-declaration" - cxx_warning_flags="-Wall -Woverloaded-virtual" - if test -n "${CC}" - then - LF_CHECK_CC_FLAG($cc_warning_flags) - fi - if test -n "${CXX}" - then - LF_CHECK_CXX_FLAG($cxx_warning_flags) - fi -]) diff --git a/firmware/fx2/config/mkstemp.m4 b/firmware/fx2/config/mkstemp.m4 deleted file mode 100644 index 4af0f0a9b..000000000 --- a/firmware/fx2/config/mkstemp.m4 +++ /dev/null @@ -1,89 +0,0 @@ -#serial 4 - -# On some hosts (e.g., HP-UX 10.20, SunOS 4.1.4, Solaris 2.5.1), mkstemp has a -# silly limit that it can create no more than 26 files from a given template. -# Other systems lack mkstemp altogether. -# On OSF1/Tru64 V4.0F, the system-provided mkstemp function can create -# only 32 files per process. -# On systems like the above, arrange to use the replacement function. -AC_DEFUN([UTILS_FUNC_MKSTEMP], -[dnl - AC_REPLACE_FUNCS(mkstemp) - if test $ac_cv_func_mkstemp = no; then - utils_cv_func_mkstemp_limitations=yes - else - AC_CACHE_CHECK([for mkstemp limitations], - utils_cv_func_mkstemp_limitations, - [ - AC_TRY_RUN([ -# include <stdlib.h> - int main () - { - int i; - for (i = 0; i < 70; i++) - { - char template[] = "conftestXXXXXX"; - int fd = mkstemp (template); - if (fd == -1) - exit (1); - close (fd); - } - exit (0); - } - ], - utils_cv_func_mkstemp_limitations=no, - utils_cv_func_mkstemp_limitations=yes, - utils_cv_func_mkstemp_limitations=yes - ) - ] - ) - fi - - if test $utils_cv_func_mkstemp_limitations = yes; then - AC_LIBOBJ(mkstemp) - AC_LIBOBJ(tempname) - AC_DEFINE(mkstemp, rpl_mkstemp, - [Define to rpl_mkstemp if the replacement function should be used.]) - gl_PREREQ_MKSTEMP - jm_PREREQ_TEMPNAME - fi -]) - -# Prerequisites of lib/mkstemp.c. -AC_DEFUN([gl_PREREQ_MKSTEMP], -[ - AH_BOTTOM( - [ - #ifndef HAVE_MKSTEMP - #ifdef __cplusplus - extern "C" { - #endif - int rpl_mkstemp (char *templ); - #ifdef __cplusplus - } - #endif - #endif - ]) -]) - -# Prerequisites of lib/tempname.c. -AC_DEFUN([jm_PREREQ_TEMPNAME], -[ - AC_REQUIRE([AC_HEADER_STAT]) - AC_CHECK_HEADERS_ONCE(fcntl.h sys/time.h unistd.h) - AC_CHECK_HEADERS(stdint.h) - AC_CHECK_FUNCS(__secure_getenv gettimeofday lstat) - AC_CHECK_DECLS_ONCE(getenv) - # AC_REQUIRE([jm_AC_TYPE_UINTMAX_T]) - - dnl Under Win32, mkdir prototype in io.h has only one arg - AC_MSG_CHECKING(whether mkdir accepts only one arg) - AC_TRY_COMPILE([#include <sys/types.h> - #include <sys/stat.h> - #include <fcntl.h>], [ - mkdir("") - ], [ AC_MSG_RESULT(yes) - AC_DEFINE(MKDIR_TAKES_ONE_ARG,[],[Define if mkdir accepts only one arg]) ], - [ AC_MSG_RESULT(no) - ]) -]) diff --git a/firmware/fx2/config/onceonly.m4 b/firmware/fx2/config/onceonly.m4 deleted file mode 100644 index f6fec37cb..000000000 --- a/firmware/fx2/config/onceonly.m4 +++ /dev/null @@ -1,63 +0,0 @@ -# onceonly.m4 serial 3 -dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl This file defines some "once only" variants of standard autoconf macros. -dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS -dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS -dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS -dnl AC_REQUIRE([AC_HEADER_STDC]) like AC_HEADER_STDC -dnl The advantage is that the check for each of the headers/functions/decls -dnl will be put only once into the 'configure' file. It keeps the size of -dnl the 'configure' file down, and avoids redundant output when 'configure' -dnl is run. -dnl The drawback is that the checks cannot be conditionalized. If you write -dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi -dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to -dnl empty, and the check will be inserted before the body of the AC_DEFUNed -dnl function. - -dnl Autoconf version 2.57 or newer is recommended. -AC_PREREQ(2.54) - -# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of -# AC_CHECK_HEADERS(HEADER1 HEADER2 ...). -AC_DEFUN([AC_CHECK_HEADERS_ONCE], [ - : - AC_FOREACH([gl_HEADER_NAME], [$1], [ - AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(defn([gl_HEADER_NAME]), - [-./], [___])), [ - AC_CHECK_HEADERS(gl_HEADER_NAME) - ]) - AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME, - [-./], [___]))) - ]) -]) - -# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of -# AC_CHECK_FUNCS(FUNC1 FUNC2 ...). -AC_DEFUN([AC_CHECK_FUNCS_ONCE], [ - : - AC_FOREACH([gl_FUNC_NAME], [$1], [ - AC_DEFUN([gl_CHECK_FUNC_]defn([gl_FUNC_NAME]), [ - AC_CHECK_FUNCS(defn([gl_FUNC_NAME])) - ]) - AC_REQUIRE([gl_CHECK_FUNC_]defn([gl_FUNC_NAME])) - ]) -]) - -# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of -# AC_CHECK_DECLS(DECL1, DECL2, ...). -AC_DEFUN([AC_CHECK_DECLS_ONCE], [ - : - AC_FOREACH([gl_DECL_NAME], [$1], [ - AC_DEFUN([gl_CHECK_DECL_]defn([gl_DECL_NAME]), [ - AC_CHECK_DECLS(defn([gl_DECL_NAME])) - ]) - AC_REQUIRE([gl_CHECK_DECL_]defn([gl_DECL_NAME])) - ]) -]) diff --git a/firmware/fx2/config/pkg.m4 b/firmware/fx2/config/pkg.m4 deleted file mode 100644 index 2d4d96109..000000000 --- a/firmware/fx2/config/pkg.m4 +++ /dev/null @@ -1,201 +0,0 @@ -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# -# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. -# Copyright © 2008 Free Software Foundation, Inc. -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- -AC_DEFUN([PKG_PROG_PKG_CONFIG], -[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=m4_default([$1], [0.18]) - AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - PKG_CONFIG="" - fi - -fi[]dnl -])# PKG_PROG_PKG_CONFIG - -# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -# Check to see whether a particular set of modules exists. Similar -# to PKG_CHECK_MODULES(), but does not set variables or print errors. -# -# -# Similar to PKG_CHECK_MODULES, make sure that the first instance of -# this or PKG_CHECK_MODULES is called, or make sure to call -# PKG_CHECK_EXISTS manually -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_EXISTS], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -if test -n "$PKG_CONFIG" && \ - AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then - m4_ifval([$2], [$2], [:]) -m4_ifvaln([$3], [else - $3])dnl -fi]) - - -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- -m4_define([_PKG_CONFIG], -[if test -n "$PKG_CONFIG"; then - if test -n "$$1"; then - pkg_cv_[]$1="$$1" - else - PKG_CHECK_EXISTS([$3], - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], - [pkg_failed=yes]) - fi -else - pkg_failed=untried -fi[]dnl -])# _PKG_CONFIG - -# _PKG_SHORT_ERRORS_SUPPORTED -# ----------------------------- -AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi[]dnl -])# _PKG_SHORT_ERRORS_SUPPORTED - - -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# E.g., -# PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) -# defines: -# -# GSTUFF_LIBS -# GSTUFF_CFLAGS -# GSTUFF_INCLUDEDIR -# GSTUFF_CPPFLAGS # the -I, -D and -U's out of CFLAGS -# -# see pkg-config man page also defines GSTUFF_PKG_ERRORS on error -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac -# -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_MODULES],[ -AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl - -AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl -AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl -AC_ARG_VAR([$1][_INCLUDEDIR], [includedir for $1, overriding pkg-config])dnl - -pkg_failed=no -AC_MSG_CHECKING([for $1]) - -_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) - -if test x$cross_compiling = xyes -then - dnl _PKG_CONFIG([$1][_LIBS], [libs-only-l --static], [$2]) - _PKG_CONFIG([$1][_LIBS], [libs --static], [$2]) - dnl prune out any -L/lib or -L/usr/lib since they're pointing to the wrong filesystem root - _pkg_tmp= - for flag in [$]pkg_cv_[$1][_LIBS]; do - case $flag in - (-L/lib* | -L/usr/lib* ) ;; # ignore - (*) _pkg_tmp="$_pkg_tmp $flag" ;; - esac - done - pkg_cv_[$1][_LIBS]="$_pkg_tmp" -else - _PKG_CONFIG([$1][_LIBS], [libs --static], [$2]) -fi - -_PKG_CONFIG([$1][_INCLUDEDIR], [variable=includedir], [$2]) - - -m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS -and $1[]_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details.]) - -if test $pkg_failed = yes; then - _PKG_SHORT_ERRORS_SUPPORTED - if test $_pkg_short_errors_supported = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` - else - $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - fi - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD - - ifelse([$4], , [AC_MSG_ERROR(dnl -[Package requirements ($2) were not met: - -$$1_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -_PKG_TEXT -])], - [AC_MSG_RESULT([no]) - $4]) -elif test $pkg_failed = untried; then - ifelse([$4], , [AC_MSG_FAILURE(dnl -[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. - -_PKG_TEXT - -To get pkg-config, see <http://pkg-config.freedesktop.org/>.])], - [$4]) -else - $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS - $1[]_LIBS=$pkg_cv_[]$1[]_LIBS - $1[]_INCLUDEDIR=$pkg_cv_[]$1[]_INCLUDEDIR - - $1[]_CPPFLAGS="" - for flag in $$1[]_CFLAGS; do - case $flag in - -I* | -D* | -U*) $1[]_CPPFLAGS="$$1[]_CPPFLAGS $flag" ;; - esac - done - pkg_cv_[]$1[]_CPPFLAGS=$$1[]_CPPFLAGS - AC_SUBST($1[]_CPPFLAGS) - - AC_MSG_RESULT([yes]) - ifelse([$3], , :, [$3]) -fi[]dnl -])# PKG_CHECK_MODULES diff --git a/firmware/fx2/config/usrp_sdcc.m4 b/firmware/fx2/config/usrp_sdcc.m4 deleted file mode 100644 index 86f6429e5..000000000 --- a/firmware/fx2/config/usrp_sdcc.m4 +++ /dev/null @@ -1,75 +0,0 @@ -# Check for sdcc support. -*- Autoconf -*- - -# Copyright 2004 Free Software Foundation, Inc. - -# 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, 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 Street, Boston, MA -# 02110-1301, USA. - -AC_DEFUN([USRP_SDCC], -[ - sdccok=yes - AC_CHECK_PROG(XCC, sdcc, sdcc -mmcs51 --no-xinit-opt,no) - AC_CHECK_PROG(XAS, asx8051, asx8051 -plosgff,no) - - if test "$XCC" = "no" -o "$XAS" = "no" ; then - AC_MSG_RESULT([USRP requires sdcc. sdcc not found. See http://sdcc.sf.net]) - sdccok=no - else - sdcc_version_min=$1 - - sdcc_version=`sdcc --version 2>&1 | \ - sed 's/\(SDCC.* \)\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\)\( .*$\)/\2/'` - - AC_MSG_CHECKING([sdcc_version "$sdcc_version"]) - - sdcc_major_version=`echo $sdcc_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - sdcc_minor_version=`echo $sdcc_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - sdcc_micro_version=`echo $sdcc_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - - sdcc_major_min=`echo $sdcc_version_min | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - sdcc_minor_min=`echo $sdcc_version_min | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - sdcc_micro_min=`echo $sdcc_version_min | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - - sdcc_version_proper=`expr \ - "$sdcc_major_version" \> "$sdcc_major_min" \| \ - "$sdcc_major_version" \= "$sdcc_major_min" \& \ - "$sdcc_minor_version" \> "$sdcc_minor_min" \| \ - "$sdcc_major_version" \= "$sdcc_major_min" \& \ - "$sdcc_minor_version" \= "$sdcc_minor_min" \& \ - "$sdcc_micro_version" \>= "$sdcc_micro_min" ` - - if test "$sdcc_version_proper" = "1" ; then - AC_MSG_RESULT([$sdcc_major_version.$sdcc_minor_version.$sdcc_micro_version]) - else - sdccok=no - AC_MSG_RESULT([USRP requires sdcc >= $sdcc_version_min. sdcc not found. See http://sdcc.sf.net]) - fi - - AC_SUBST(XCC) - AC_SUBST(XAS) - fi - - if test $sdccok = yes; then - ifelse([$2], , :, [$2]) - else - ifelse([$3], , :, [$3]) - fi -]) diff --git a/firmware/fx2/configure.ac b/firmware/fx2/configure.ac deleted file mode 100644 index a4fa59c2e..000000000 --- a/firmware/fx2/configure.ac +++ /dev/null @@ -1,335 +0,0 @@ -dnl Copyright 2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with GNU Radio; see the file COPYING. If not, write to -dnl the Free Software Foundation, Inc., 51 Franklin Street, -dnl Boston, MA 02110-1301, USA. - -AC_INIT -AC_PREREQ(2.57) -AM_CONFIG_HEADER(config.h) - -AC_CANONICAL_BUILD -AC_CANONICAL_HOST -AC_CANONICAL_TARGET - -dnl ustar required to have pathnames > 99 chars -_AM_SET_OPTION([tar-ustar]) -AM_INIT_AUTOMAKE(gnuradio,$RELEASE) - -DEFINES="" -AC_SUBST(DEFINES) - -dnl Remember if the user explicity set CFLAGS -if test -n "${CFLAGS}"; then - user_set_cflags=yes -fi -dnl Remember if the user explicity set CXXFLAGS -if test -n "${CXXFLAGS}"; then - user_set_cxxflags=yes -fi - - -LF_CONFIGURE_CC -LF_CONFIGURE_CXX -GR_LIB64 dnl check for lib64 suffix after choosing compilers - - -dnl The three macros above are known to override CFLAGS if the user -dnl didn't specify them. Though I'm sure somebody thought this was -dnl a good idea, it makes it hard to use other than -g -O2 when compiling -dnl selected files. Thus we "undo" the damage here... -dnl -dnl If the user specified CFLAGS, we use them. -dnl See Makefile.common for the rest of the magic. -if test "$user_set_cflags" != yes; then - autoconf_default_CFLAGS="$CFLAGS" - CFLAGS="" -fi -AC_SUBST(autoconf_default_CFLAGS) - - -dnl The three macros above are known to override CXXFLAGS if the user -dnl didn't specify them. Though I'm sure somebody thought this was -dnl a good idea, it makes it hard to use other than -g -O2 when compiling -dnl selected files. Thus we "undo" the damage here... -dnl -dnl If the user specified CXXFLAGS, we use them. Otherwise when compiling -dnl the output of swig use use -O1 if we're using g++. -dnl See Makefile.common for the rest of the magic. -if test "$user_set_cxxflags" != yes; then - autoconf_default_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="" - if test "$GXX" = yes; then - case "$host_cpu" in - powerpc*) - dnl "-O1" is broken on the PPC for some reason - dnl (at least as of g++ 4.1.1) - swig_CXXFLAGS="-g1 -O2 -Wno-strict-aliasing -Wno-parentheses" - ;; - *) - swig_CXXFLAGS="-g -O1 -Wno-strict-aliasing -Wno-parentheses" - ;; - esac - fi -fi -AC_SUBST(autoconf_default_CXXFLAGS) -AC_SUBST(swig_CXXFLAGS) - -dnl add ${prefix}/lib${gr_libdir_suffix}/pkgconfig to the head of the PKG_CONFIG_PATH -if test x${PKG_CONFIG_PATH} = x; then - PKG_CONFIG_PATH=${prefix}/lib${gr_libdir_suffix}/pkgconfig -else - PKG_CONFIG_PATH=${prefix}/lib${gr_libdir_suffix}/pkgconfig:${PKG_CONFIG_PATH} -fi -export PKG_CONFIG_PATH - -LF_SET_WARNINGS -AM_PROG_AS -AC_PROG_LN_S -AC_PROG_MAKE_SET -AC_PROG_INSTALL - -# AC_PROG_MKDIR_P -# is a backport of autoconf-2.60's AC_PROG_MKDIR_P. -# Remove this macro when we can assume autoconf >= 2.60. -m4_ifdef([AC_PROG_MKDIR_P], [], [ - AC_DEFUN([AC_PROG_MKDIR_P], - [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake - MKDIR_P='$(mkdir_p)' - AC_SUBST([MKDIR_P])]) -]) -AC_PROG_MKDIR_P - -AC_PATH_PROG([RM_PROG], [rm]) - -AC_LIBTOOL_WIN32_DLL -dnl AC_DISABLE_SHARED dnl don't build shared libraries -AC_ENABLE_SHARED dnl do build shared libraries -AC_DISABLE_STATIC dnl don't build static libraries -m4_ifdef([LT_INIT],[LT_INIT],[AC_PROG_LIBTOOL]) -dnl GR_FORTRAN - -GR_NO_UNDEFINED dnl do we need the -no-undefined linker flag -GR_SCRIPTING - - -AM_CONDITIONAL([PYTHON], [test x$enable_python = xyes]) - -dnl Checks for libraries. -AC_CHECK_LIB(socket,socket) - -dnl Set the c++ compiler that we use for the build system when cross compiling -if test x$CXX_FOR_BUILD = x -then - if test x$cross_compiling = xno; then - CXX_FOR_BUILD=${CXX} - else - CXX_FOR_BUILD=g++ - fi -fi -AC_SUBST(CXX_FOR_BUILD) - -dnl Checks for header files. -AC_HEADER_STDC -AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(fcntl.h limits.h strings.h time.h sys/ioctl.h sys/time.h unistd.h) -AC_CHECK_HEADERS(linux/ppdev.h dev/ppbus/ppi.h sys/mman.h sys/select.h sys/types.h) -AC_CHECK_HEADERS(sys/resource.h stdint.h sched.h signal.h sys/syscall.h malloc.h) -AC_CHECK_HEADERS(windows.h) -AC_CHECK_HEADERS(vec_types.h) -AC_CHECK_HEADERS(netdb.h netinet/in.h arpa/inet.h sys/types.h sys/socket.h) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_C_INLINE -AC_TYPE_SIZE_T -AC_HEADER_TIME -AC_C_BIGENDIAN([GR_ARCH_BIGENDIAN=1],[GR_ARCH_BIGENDIAN=0]) -AC_SUBST(GR_ARCH_BIGENDIAN) -AC_STRUCT_TM - -dnl Checks for library functions. -AC_FUNC_ALLOCA -AC_FUNC_SETVBUF_REVERSED -AC_FUNC_VPRINTF -AC_CHECK_FUNCS([mmap select socket strcspn strerror strspn getpagesize sysconf]) -AC_CHECK_FUNCS([snprintf gettimeofday nanosleep sched_setscheduler]) -AC_CHECK_FUNCS([modf sqrt sigaction sigprocmask pthread_sigmask]) -AC_CHECK_FUNCS([sched_setaffinity]) - -AC_CHECK_LIB(m, sincos, [AC_DEFINE([HAVE_SINCOS],[1],[Define to 1 if your system has `sincos'.])]) -AC_CHECK_LIB(m, sincosf,[AC_DEFINE([HAVE_SINCOSF],[1],[Define to 1 if your system has `sincosf'.])]) -AC_CHECK_LIB(m, sinf, [AC_DEFINE([HAVE_SINF],[1],[Define to 1 if your system has `sinf'.])]) -AC_CHECK_LIB(m, cosf, [AC_DEFINE([HAVE_COSF],[1],[Define to 1 if your system has `cosf'.])]) -AC_CHECK_LIB(m, trunc, [AC_DEFINE([HAVE_TRUNC],[1],[Define to 1 if your system has `trunc'.])]) -AC_CHECK_LIB(m, exp10, [AC_DEFINE([HAVE_EXP10],[1],[Define to 1 if your system has 'exp10'.])]) -AC_CHECK_LIB(m, log2, [AC_DEFINE([HAVE_LOG2],[1],[Define to 1 if your system has 'log2'.])]) -#AC_FUNC_MKTIME - -AH_BOTTOM([ -#ifndef HAVE_TRUNC -#include <math.h> -inline static double trunc(double x) -{ - return x >= 0 ? floor(x) : ceil(x); -} -#endif - -#ifndef HAVE_EXP10 -#include <math.h> -inline static double exp10(double x) -{ - return pow(10.0, x); -} -#endif - -#ifdef HAVE_WINDOWS_H -#define NOMINMAX -#endif -]) - -dnl Do we have "dot", part of the graphviz package from AT&T? -dnl Doxgen will use it to draw pretty diagrams ;-) -AC_CHECK_PROG(HAVE_DOT, [dot],[YES],[NO]) - -PKG_CHECK_MODULES(FFTW3F, fftw3f >= 3.0) -AC_SUBST(FFTW3F_LIBS) - -dnl Define where to look for cppunit includes and libs -dnl sets CPPUNIT_CFLAGS and CPPUNIT_LIBS -dnl Try using pkg-config first, then fall back to cppunit-config. -PKG_CHECK_EXISTS(cppunit, - [PKG_CHECK_MODULES(CPPUNIT, cppunit >= 1.9.14)], - [AM_PATH_CPPUNIT([1.9.14],[], - [AC_MSG_ERROR([GNU Radio requires cppunit. Stop])])]) - -CPPUNIT_INCLUDES=$CPPUNIT_CFLAGS -AC_SUBST(CPPUNIT_INCLUDES) - -dnl see if GUILE is installed -AC_PATH_PROG(GUILE,guile) - - -BUILD_DATE=`date -R -u` -AC_SUBST(BUILD_DATE) - -dnl SYSCONFDIR substitution -if test "${sysconfdir}" == "\${prefix}/etc" ; then - if test "${prefix}" == "NONE" ; then - SYSCONFDIR=["$ac_default_prefix/etc"] - else - SYSCONFDIR=["${prefix}/etc"] - fi -else - SYSCONFDIR=[${sysconfdir}] -fi -AC_SUBST(SYSCONFDIR) - -dnl System configuration files -GR_PREFSDIR=[$SYSCONFDIR/${PACKAGE}/conf.d] -AC_SUBST(GR_PREFSDIR) - -dnl Component specific configuration -dnl The order of the GR_ macros determines the order of compilation -dnl For -any- checks on $enable_all_components -dnl use the following guidelines: -dnl yes : --enable-all-components was specified, so error out if any -dnl components do not pass configuration checks. -dnl no : --disable-all-components was specified, so try to build the -dnl --enable'd components, and error out if any do not pass -dnl configuration checks. -dnl "" : this option was not specified on the command line; try to -dnl build all components that are not --with'd, but don't -dnl error out if any component does not pass configuration checks. -dnl -dnl For each --enable-foo component, if that flag is not specified on -dnl the command line, the related variable $enable_foo will be set to -dnl $enable_all_components . - -AC_ARG_ENABLE( - [all-components], - [ --enable-all-components Build all configurable components (default), or stop on failed dependencies] -) - -build_dirs="config" -GRC_FX2 - -# Each component is now either to be built, was skipped, will be -# included from pre-installed libraries and includes, or failed -# dependencies. -AC_SUBST([build_dirs], [$build_dirs]) -AC_SUBST([skipped_dirs], [$skipped_dirs]) -AC_SUBST([with_dirs], [$with_dirs]) - -# fix for older autotools that don't define these by default -AC_SUBST(abs_top_srcdir) -AC_SUBST(abs_top_builddir) -AC_SUBST(MKDIR_P) - -# 'with' variables - the pre-installed libraries, includes, and paths -# - must always come last in the lists, so they require special -# treatment. -AC_SUBST(with_INCLUDES) -AC_SUBST(with_PYDIRPATH) -AC_SUBST(with_LIBDIRPATH) - -# Local files tweaked by AC -AC_CONFIG_FILES([\ - Makefile \ - config/Makefile \ -]) - -AC_OUTPUT - -echo -echo "*********************************************************************" -echo The following GNU Radio components have been successfully configured: -echo -for dir in $build_dirs -do - echo $dir -done -echo -echo You my now run the 'make' command to build these components. -echo -if test "$skipped_dirs" != ""; then - echo "*********************************************************************" - echo The following components were skipped either because you asked not - echo to build them or they didn\'t pass configuration checks: - echo - for dir in $skipped_dirs - do - echo $dir - done - echo - echo These components will not be built. - echo -fi -if test "$with_dirs" != ""; then - echo "*********************************************************************" - echo The following components will be included from pre-installed - echo libraries and includes: - echo - for dir in $with_dirs - do - echo $dir - done - echo - echo These components will not be built. - echo -fi - -echo Configured GNU Radio release $RELEASE for build. diff --git a/firmware/fx2/include/.gitignore b/firmware/fx2/include/.gitignore deleted file mode 100644 index 75bb241c8..000000000 --- a/firmware/fx2/include/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/Makefile -/Makefile.in -/aclocal.m4 -/configure -/config.h.in -/stamp-h.in -/libtool -/config.log -/config.h -/config.cache -/config.status -/missing -/stamp-h -/stamp-h1 -/.la -/.lo -/.deps -/.libs -/*.la -/*.lo -/autom4te.cache -/*.cache -/missing -/make.log -/usrp.pc diff --git a/firmware/fx2/include/Makefile.am b/firmware/fx2/include/Makefile.am deleted file mode 100644 index e17726c07..000000000 --- a/firmware/fx2/include/Makefile.am +++ /dev/null @@ -1,61 +0,0 @@ -# -# Copyright 2003 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -usrpincludedir = $(includedir)/usrp - -usrpinclude_HEADERS = \ - usrp_i2c_addr.h \ - usrp_spi_defs.h \ - fpga_regs_common.h \ - fpga_regs_standard.h - - -noinst_HEADERS = \ - delay.h \ - fpga_regs_common.v \ - fpga_regs_standard.v \ - fpga_regs0.h \ - fx2regs.h \ - fx2utils.h \ - i2c.h \ - isr.h \ - syncdelay.h \ - timer.h \ - usb_common.h \ - usb_descriptors.h \ - usb_requests.h \ - usrp_commands.h \ - usrp_config.h \ - usrp_ids.h \ - usrp_interfaces.h - - -CODE_GENERATOR = \ - generate_regs.py - -EXTRA_DIST = \ - $(CODE_GENERATOR) - -fpga_regs_common.v: fpga_regs_common.h generate_regs.py - PYTHONPATH=$(top_srcdir)/usrp/firmware/include $(PYTHON) $(srcdir)/generate_regs.py $(srcdir)/fpga_regs_common.h $@ - -fpga_regs_standard.v: fpga_regs_standard.h generate_regs.py - PYTHONPATH=$(top_srcdir)/usrp/firmware/include $(PYTHON) $(srcdir)/generate_regs.py $(srcdir)/fpga_regs_standard.h $@ diff --git a/firmware/fx2/lib/Makefile.am b/firmware/fx2/lib/Makefile.am deleted file mode 100644 index f9e1b2317..000000000 --- a/firmware/fx2/lib/Makefile.am +++ /dev/null @@ -1,79 +0,0 @@ -# -# Copyright 2003 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -EXTRA_DIST = \ - delay.c \ - fx2utils.c \ - i2c.c \ - isr.c \ - timer.c \ - usb_common.c - - - -DEFINES= -FW_INCLUDES=-I$(top_srcdir)/include - -# with EA = 0, the FX2 implements a portion of the 8051 "external memory" -# on chip. This memory is mapped like this: -# -# The bottom 8K of memory (0x0000 - 0x1fff) is used for both data and -# code accesses. There's also 512 bytes for data only from 0xe000 - 0xe1ff. -# -# We tell the linker to start the xdata segment at 0x1800, 6K up from -# the bottom. - -LINKOPTS = --code-loc 0x0000 --code-size 0x1800 --xram-loc 0x1800 --xram-size 0x0800 - -LIBRARY = libfx2.lib - -LIBOBJS = \ - delay.rel \ - fx2utils.rel \ - i2c.rel \ - isr.rel \ - timer.rel \ - usb_common.rel - - - -all: libfx2.lib - -.c.rel: - $(XCC) $(FW_INCLUDES) $(DEFINES) -c $< -o $@ - -$(LIBRARY): $(LIBOBJS) - -rm -f $(LIBRARY) - touch $(LIBRARY) - for obj in $(LIBOBJS); do basename $$obj .rel >> $(LIBRARY) ; done - - -CLEANFILES = \ - *.ihx *.lnk *.lst *.map *.mem *.rel *.rst *.sym *.asm *.lib - -DISTCLEANFILES = \ - *.ihx *.lnk *.lst *.map *.mem *.rel *.rst *.sym *.asm *.lib - -install: all - - -# dependencies - diff --git a/firmware/fx2/lib/i2c-compiler-bug.c b/firmware/fx2/lib/i2c-compiler-bug.c deleted file mode 100644 index 360b779bc..000000000 --- a/firmware/fx2/lib/i2c-compiler-bug.c +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio 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, or (at your option) - * any later version. - * - * GNU Radio 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 Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include "i2c.h" -#include "fx2regs.h" -#include <string.h> - - -// issue a stop bus cycle and wait for completion - - -// returns non-zero if successful, else 0 -unsigned char -i2c_read (unsigned char addr, xdata unsigned char *buf, unsigned char len) -{ - volatile unsigned char junk; - - if (len == 0) // reading zero bytes always works - return 1; - - // memset (buf, 0, len); // FIXME, remove - - while (I2CS & bmSTOP) // wait for stop to clear - ; - - - I2CS = bmSTART; - I2DAT = (addr << 1) | 1; // write address and direction (1's the read bit) - - while ((I2CS & bmDONE) == 0) - ; - - if ((I2CS & bmBERR) || (I2CS & bmACK) == 0) // no device answered... - goto fail; - - if (len == 1) - I2CS |= bmLASTRD; - - junk = I2DAT; // trigger the first read cycle - -#if 1 - while (len != 1){ - while ((I2CS & bmDONE) == 0) - ; - - if (I2CS & bmBERR) - goto fail; - - len--; - if (len == 1) - I2CS |= bmLASTRD; - - *buf++ = I2DAT; // get data, trigger another read - } -#endif - - // wait for final byte - - while ((I2CS & bmDONE) == 0) - ; - - if (I2CS & bmBERR) - goto fail; - - I2CS |= bmSTOP; - *buf = I2DAT; - - return 1; - - fail: - I2CS |= bmSTOP; - return 0; -} - - - -// returns non-zero if successful, else 0 -unsigned char -i2c_write (unsigned char addr, xdata const unsigned char *buf, unsigned char len) -{ - while (I2CS & bmSTOP) // wait for stop to clear - ; - - I2CS = bmSTART; - I2DAT = (addr << 1) | 0; // write address and direction (0's the write bit) - - while ((I2CS & bmDONE) == 0) - ; - - if ((I2CS & bmBERR) || (I2CS & bmACK) == 0) // no device answered... - goto fail; - - while (len > 0){ - I2DAT = *buf++; - len--; - - while ((I2CS & bmDONE) == 0) - ; - - if ((I2CS & bmBERR) || (I2CS & bmACK) == 0) // no device answered... - goto fail; - } - - I2CS |= bmSTOP; - return 1; - - fail: - I2CS |= bmSTOP; - return 0; -} diff --git a/firmware/fx2/src/.gitignore b/firmware/fx2/src/.gitignore deleted file mode 100644 index d46c52c00..000000000 --- a/firmware/fx2/src/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -/*.ihx -/*.lnk -/*.lst -/*.map -/*.mem -/*.rel -/*.rst -/*.sym -/blink_leds.asm -/usrp_common.asm -/command_loop.asm -/fpga.asm -/*.asm -/usrp_gpif.c -/usrp_gpif_inline.h -/Makefile -/Makefile.in diff --git a/firmware/fx2/src/Makefile.am b/firmware/fx2/src/Makefile.am deleted file mode 100644 index 5dcff2c85..000000000 --- a/firmware/fx2/src/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright 2004 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -SUBDIRS = common usrp1 diff --git a/firmware/fx2/src/common/.gitignore b/firmware/fx2/src/common/.gitignore deleted file mode 100644 index d46c52c00..000000000 --- a/firmware/fx2/src/common/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -/*.ihx -/*.lnk -/*.lst -/*.map -/*.mem -/*.rel -/*.rst -/*.sym -/blink_leds.asm -/usrp_common.asm -/command_loop.asm -/fpga.asm -/*.asm -/usrp_gpif.c -/usrp_gpif_inline.h -/Makefile -/Makefile.in diff --git a/firmware/fx2/src/common/Makefile.am b/firmware/fx2/src/common/Makefile.am deleted file mode 100644 index 95232324d..000000000 --- a/firmware/fx2/src/common/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -# -# Copyright 2004 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -EXTRA_DIST = \ - _startup.a51 \ - blink_leds.c \ - check_mdelay.c \ - check_udelay.c \ - edit-gpif \ - fpga.h \ - fpga_load.h \ - fpga_load.c \ - gpif.c \ - gpif.gpf \ - init_gpif.c \ - usrp_common.c \ - usrp_globals.h \ - vectors.a51 \ - build_eeprom.py - -all: usrp_gpif.c - -usrp_gpif.c usrp_gpif_inline.h : gpif.c - srcdir=$(srcdir) $(PYTHON) $(srcdir)/edit-gpif $(srcdir)/gpif.c usrp_gpif.c usrp_gpif_inline.h - -CLEANFILES = \ - *.ihx *.lnk *.lst *.map *.mem *.rel *.rst *.sym *.asm *.lib \ - usrp_gpif.c usrp_gpif_inline.h - -DISTCLEANFILES = \ - *.ihx *.lnk *.lst *.map *.mem *.rel *.rst *.sym *.asm *.lib \ - usrp_gpif.c usrp_gpif_inline.h diff --git a/firmware/fx2/src/common/blink_leds.c b/firmware/fx2/src/common/blink_leds.c deleted file mode 100644 index 255c69733..000000000 --- a/firmware/fx2/src/common/blink_leds.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * USRP - Universal Software Radio Peripheral - * - * Copyright (C) 2003 Free Software Foundation, Inc. - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301 USA - */ - -#include "usrp_common.h" - -void -main (void) -{ - unsigned short counter = 0; - - init_usrp (); - - while (1){ - unsigned char counter_high = counter >> 8; - set_led_0 (counter_high & 0x40); - set_led_1 (counter_high & 0x80); - counter++; - } -} diff --git a/firmware/fx2/src/common/check_mdelay.c b/firmware/fx2/src/common/check_mdelay.c deleted file mode 100644 index de1af47f6..000000000 --- a/firmware/fx2/src/common/check_mdelay.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * USRP - Universal Software Radio Peripheral - * - * Copyright (C) 2003 Free Software Foundation, Inc. - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301 USA - */ - -#include "usrp_common.h" -#include "delay.h" - -void -main (void) -{ - init_usrp (); - - // CPUCS = 0; // 12 MHz - // CPUCS = bmCLKSPD0; // 24 MHz - CPUCS = bmCLKSPD1; // 48 MHz - - while (1){ - USRP_LED_REG ^= bmLED0; - mdelay (10); - } -} diff --git a/firmware/fx2/src/common/check_udelay.c b/firmware/fx2/src/common/check_udelay.c deleted file mode 100644 index 46885a067..000000000 --- a/firmware/fx2/src/common/check_udelay.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * USRP - Universal Software Radio Peripheral - * - * Copyright (C) 2003 Free Software Foundation, Inc. - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301 USA - */ - -#include "usrp_common.h" -#include "delay.h" - -void -main (void) -{ - init_usrp (); - - // CPUCS = 0; // 12 MHz - // CPUCS = bmCLKSPD0; // 24 MHz - CPUCS = bmCLKSPD1; // 48 MHz - - while (1){ - USRP_LED_REG ^= bmLED0; - udelay (250); - } -} diff --git a/firmware/fx2/src/common/gpif.c b/firmware/fx2/src/common/gpif.c deleted file mode 100755 index 489e6e81a..000000000 --- a/firmware/fx2/src/common/gpif.c +++ /dev/null @@ -1,292 +0,0 @@ -// This program configures the General Programmable Interface (GPIF) for FX2. -// Please do not modify sections of text which are marked as "DO NOT EDIT ...". -// -// DO NOT EDIT ... -// GPIF Initialization -// Interface Timing Async -// Internal Ready Init IntRdy=1 -// CTL Out Tristate-able Binary -// SingleWrite WF Select 1 -// SingleRead WF Select 0 -// FifoWrite WF Select 3 -// FifoRead WF Select 2 -// Data Bus Idle Drive Tristate -// END DO NOT EDIT - -// DO NOT EDIT ... -// GPIF Wave Names -// Wave 0 = singlerd -// Wave 1 = singlewr -// Wave 2 = FIFORd -// Wave 3 = FIFOWr - -// GPIF Ctrl Outputs Level -// CTL 0 = WEN# CMOS -// CTL 1 = REN# CMOS -// CTL 2 = OE# CMOS -// CTL 3 = CLRST CMOS -// CTL 4 = unused CMOS -// CTL 5 = BOGUS CMOS - -// GPIF Rdy Inputs -// RDY0 = EF# -// RDY1 = FF# -// RDY2 = unused -// RDY3 = unused -// RDY4 = unused -// RDY5 = TCXpire -// FIFOFlag = FIFOFlag -// IntReady = IntReady -// END DO NOT EDIT -// DO NOT EDIT ... -// -// GPIF Waveform 0: singlerd -// -// Interval 0 1 2 3 4 5 6 Idle (7) -// _________ _________ _________ _________ _________ _________ _________ _________ -// -// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val -// DataMode NO Data NO Data NO Data NO Data NO Data NO Data NO Data -// NextData SameData SameData SameData SameData SameData SameData SameData -// Int Trig No Int No Int No Int No Int No Int No Int No Int -// IF/Wait Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 -// Term A -// LFunc -// Term B -// Branch1 -// Branch0 -// Re-Exec -// Sngl/CRC Default Default Default Default Default Default Default -// WEN# 0 0 0 0 0 0 0 0 -// REN# 0 0 0 0 0 0 0 0 -// OE# 0 0 0 0 0 0 0 0 -// CLRST 0 0 0 0 0 0 0 0 -// unused 0 0 0 0 0 0 0 0 -// BOGUS 0 0 0 0 0 0 0 0 -// -// END DO NOT EDIT -// DO NOT EDIT ... -// -// GPIF Waveform 1: singlewr -// -// Interval 0 1 2 3 4 5 6 Idle (7) -// _________ _________ _________ _________ _________ _________ _________ _________ -// -// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val -// DataMode Activate Activate Activate Activate Activate Activate Activate -// NextData SameData SameData SameData SameData SameData SameData SameData -// Int Trig No Int No Int No Int No Int No Int No Int No Int -// IF/Wait Wait 1 IF Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 -// Term A EF# -// LFunc AND -// Term B EF# -// Branch1 ThenIdle -// Branch0 ElseIdle -// Re-Exec No -// Sngl/CRC Default Default Default Default Default Default Default -// WEN# 0 1 1 1 1 1 1 0 -// REN# 0 0 0 0 0 0 0 0 -// OE# 0 0 0 0 0 0 0 0 -// CLRST 0 0 0 0 0 0 0 0 -// unused 0 0 0 0 0 0 0 0 -// BOGUS 0 0 0 0 0 0 0 0 -// -// END DO NOT EDIT -// DO NOT EDIT ... -// -// GPIF Waveform 2: FIFORd -// -// Interval 0 1 2 3 4 5 6 Idle (7) -// _________ _________ _________ _________ _________ _________ _________ _________ -// -// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val -// DataMode NO Data Activate NO Data NO Data NO Data NO Data NO Data -// NextData SameData SameData SameData SameData SameData SameData SameData -// Int Trig No Int No Int No Int No Int No Int No Int No Int -// IF/Wait Wait 1 IF Wait 1 IF Wait 1 Wait 1 Wait 1 -// Term A TCXpire TCXpire -// LFunc AND AND -// Term B TCXpire TCXpire -// Branch1 Then 2 ThenIdle -// Branch0 Else 1 ElseIdle -// Re-Exec No No -// Sngl/CRC Default Default Default Default Default Default Default -// WEN# 0 0 0 0 0 0 0 0 -// REN# 0 0 0 0 0 0 0 0 -// OE# 1 1 1 0 0 0 0 0 -// CLRST 0 0 0 0 0 0 0 0 -// unused 0 0 0 0 0 0 0 0 -// BOGUS 0 0 0 0 0 0 0 0 -// -// END DO NOT EDIT -// DO NOT EDIT ... -// -// GPIF Waveform 3: FIFOWr -// -// Interval 0 1 2 3 4 5 6 Idle (7) -// _________ _________ _________ _________ _________ _________ _________ _________ -// -// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val -// DataMode NO Data Activate Activate Activate Activate Activate Activate -// NextData SameData SameData SameData SameData SameData SameData SameData -// Int Trig No Int No Int No Int No Int No Int No Int No Int -// IF/Wait Wait 1 IF Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 -// Term A TCXpire -// LFunc AND -// Term B TCXpire -// Branch1 ThenIdle -// Branch0 Else 1 -// Re-Exec No -// Sngl/CRC Default Default Default Default Default Default Default -// WEN# 0 0 0 0 0 0 0 0 -// REN# 0 0 0 0 0 0 0 0 -// OE# 0 0 0 0 0 0 0 0 -// CLRST 0 0 0 0 0 0 0 0 -// unused 0 0 0 0 0 0 0 0 -// BOGUS 0 0 0 0 0 0 0 0 -// -// END DO NOT EDIT - -// GPIF Program Code - -// DO NOT EDIT ... -#include "fx2.h" -#include "fx2regs.h" -#include "fx2sdly.h" // SYNCDELAY macro -// END DO NOT EDIT - -// DO NOT EDIT ... -const char xdata WaveData[128] = -{ -// Wave 0 -/* LenBr */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07, -/* Opcode*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* Output*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, -// Wave 1 -/* LenBr */ 0x01, 0x3F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07, -/* Opcode*/ 0x22, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, -/* Output*/ 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, -/* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, -// Wave 2 -/* LenBr */ 0x01, 0x11, 0x01, 0x3F, 0x01, 0x01, 0x01, 0x07, -/* Opcode*/ 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, -/* Output*/ 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, -/* LFun */ 0x00, 0x2D, 0x00, 0x2D, 0x00, 0x00, 0x00, 0x3F, -// Wave 3 -/* LenBr */ 0x01, 0x39, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07, -/* Opcode*/ 0x00, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, -/* Output*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* LFun */ 0x00, 0x2D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, -}; -// END DO NOT EDIT - -// DO NOT EDIT ... -const char xdata FlowStates[36] = -{ -/* Wave 0 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* Wave 1 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* Wave 2 FlowStates */ 0x81,0x2D,0x26,0x00,0x04,0x04,0x03,0x02,0x00, -/* Wave 3 FlowStates */ 0x81,0x2D,0x21,0x00,0x04,0x04,0x03,0x02,0x00, -}; -// END DO NOT EDIT - -// DO NOT EDIT ... -const char xdata InitData[7] = -{ -/* Regs */ 0xA0,0x00,0x00,0x00,0xEE,0x4E,0x00 -}; -// END DO NOT EDIT - -// TO DO: You may add additional code below. - -void GpifInit( void ) -{ - BYTE i; - - // Registers which require a synchronization delay, see section 15.14 - // FIFORESET FIFOPINPOLAR - // INPKTEND OUTPKTEND - // EPxBCH:L REVCTL - // GPIFTCB3 GPIFTCB2 - // GPIFTCB1 GPIFTCB0 - // EPxFIFOPFH:L EPxAUTOINLENH:L - // EPxFIFOCFG EPxGPIFFLGSEL - // PINFLAGSxx EPxFIFOIRQ - // EPxFIFOIE GPIFIRQ - // GPIFIE GPIFADRH:L - // UDMACRCH:L EPxGPIFTRIG - // GPIFTRIG - - // Note: The pre-REVE EPxGPIFTCH/L register are affected, as well... - // ...these have been replaced by GPIFTC[B3:B0] registers - - // 8051 doesn't have access to waveform memories 'til - // the part is in GPIF mode. - - IFCONFIG = 0xEE; - // IFCLKSRC=1 , FIFOs executes on internal clk source - // xMHz=1 , 48MHz internal clk rate - // IFCLKOE=0 , Don't drive IFCLK pin signal at 48MHz - // IFCLKPOL=0 , Don't invert IFCLK pin signal from internal clk - // ASYNC=1 , master samples asynchronous - // GSTATE=1 , Drive GPIF states out on PORTE[2:0], debug WF - // IFCFG[1:0]=10, FX2 in GPIF master mode - - GPIFABORT = 0xFF; // abort any waveforms pending - - GPIFREADYCFG = InitData[ 0 ]; - GPIFCTLCFG = InitData[ 1 ]; - GPIFIDLECS = InitData[ 2 ]; - GPIFIDLECTL = InitData[ 3 ]; - GPIFWFSELECT = InitData[ 5 ]; - GPIFREADYSTAT = InitData[ 6 ]; - - // use dual autopointer feature... - AUTOPTRSETUP = 0x07; // inc both pointers, - // ...warning: this introduces pdata hole(s) - // ...at E67B (XAUTODAT1) and E67C (XAUTODAT2) - - // source - AUTOPTRH1 = MSB( &WaveData ); - AUTOPTRL1 = LSB( &WaveData ); - - // destination - AUTOPTRH2 = 0xE4; - AUTOPTRL2 = 0x00; - - // transfer - for ( i = 0x00; i < 128; i++ ) - { - EXTAUTODAT2 = EXTAUTODAT1; - } - -// Configure GPIF Address pins, output initial value, - PORTCCFG = 0xFF; // [7:0] as alt. func. GPIFADR[7:0] - OEC = 0xFF; // and as outputs - PORTECFG |= 0x80; // [8] as alt. func. GPIFADR[8] - OEE |= 0x80; // and as output - -// ...OR... tri-state GPIFADR[8:0] pins -// PORTCCFG = 0x00; // [7:0] as port I/O -// OEC = 0x00; // and as inputs -// PORTECFG &= 0x7F; // [8] as port I/O -// OEE &= 0x7F; // and as input - -// GPIF address pins update when GPIFADRH/L written - SYNCDELAY; // - GPIFADRH = 0x00; // bits[7:1] always 0 - SYNCDELAY; // - GPIFADRL = 0x00; // point to PERIPHERAL address 0x0000 - -// Configure GPIF FlowStates registers for Wave 0 of WaveData - FLOWSTATE = FlowStates[ 0 ]; - FLOWLOGIC = FlowStates[ 1 ]; - FLOWEQ0CTL = FlowStates[ 2 ]; - FLOWEQ1CTL = FlowStates[ 3 ]; - FLOWHOLDOFF = FlowStates[ 4 ]; - FLOWSTB = FlowStates[ 5 ]; - FLOWSTBEDGE = FlowStates[ 6 ]; - FLOWSTBHPERIOD = FlowStates[ 7 ]; -} - diff --git a/firmware/fx2/src/common/gpif.gpf b/firmware/fx2/src/common/gpif.gpf Binary files differdeleted file mode 100755 index a954ac193..000000000 --- a/firmware/fx2/src/common/gpif.gpf +++ /dev/null diff --git a/firmware/fx2/src/usrp1/.gitignore b/firmware/fx2/src/usrp1/.gitignore deleted file mode 100644 index 54a9e9415..000000000 --- a/firmware/fx2/src/usrp1/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -/*.ihx -/*.lnk -/*.lst -/*.map -/*.mem -/*.rel -/*.rst -/*.sym -/blink_leds.asm -/usrp_common.asm -/command_loop.asm -/fpga.asm -/*.asm -/Makefile -/Makefile.in -/usrp_gpif.c -/usrp_gpif_inline.h -/Makefile.in -/burn-usrp2-eeprom -/burn-usrp4-eeprom diff --git a/firmware/fx2/src/usrp1/Makefile.am b/firmware/fx2/src/usrp1/Makefile.am deleted file mode 100644 index a964f9198..000000000 --- a/firmware/fx2/src/usrp1/Makefile.am +++ /dev/null @@ -1,141 +0,0 @@ -# -# Copyright 2003,2006 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -#firmwaredir = $(prefix)/share/uhd/images -#firmware_DATA = usrp1_fw.ihx - -#eepromdir = $(firmwaredir) -#eepromfile = eeprom_boot.ihx -#eeprom_DATA = usrp1_eeprom.bin - -EXTRA_DIST = \ - edit-gpif \ - _startup.a51 \ - blink_leds.c \ - board_specific.c \ - check_mdelay.c \ - check_udelay.c \ - eeprom_boot.a51 \ - eeprom_init.c \ - eeprom_io.c \ - eeprom_io.h \ - fpga_load.c \ - fpga_rev2.c \ - fpga_rev2.h \ - gpif.c \ - init_gpif.c \ - spi.c \ - spi.h \ - usb_descriptors.a51 \ - usrp_common.c \ - usrp_common.h \ - usrp_gpif.c \ - usrp_main.c \ - usrp_rev2_regs.h \ - vectors.a51 - - -DEFINES=-DHAVE_USRP2 -FW_INCLUDES=-I$(top_srcdir)/include \ - -I$(top_srcdir)/src/usrp1 \ - -I$(top_srcdir)/src/common \ - -I$(top_builddir)/src/common - -# with EA = 0, the FX2 implements a portion of the 8051 "external memory" -# on chip. This memory is mapped like this: -# -# The bottom 8K of memory (0x0000 - 0x1fff) is used for both data and -# code accesses. There's also 512 bytes for data only from 0xe000 - 0xe1ff. -# -# We tell the linker to start the xdata segment at 0x1800, 6K up from -# the bottom. - -MEMOPTS = --code-loc 0x0000 --code-size 0x1800 --xram-loc 0x1800 --xram-size 0x0800 \ - -Wl '-b USBDESCSEG = 0xE000' - -LIBOPTS = -L ../../lib libfx2.lib -LIBDEP = ../../lib/libfx2.lib - -LINKOPTS = $(MEMOPTS) $(LIBOPTS) - -EXECUTABLES = \ - std.ihx \ - blink_leds.ihx \ - check_mdelay.ihx \ - check_udelay.ihx \ - eeprom_boot.ihx - -STARTUP = _startup.rel - -.c.rel: - $(XCC) $(FW_INCLUDES) $(DEFINES) \ - -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< - -.a51.rel: - test -f `basename '$<'` || $(LN_S) '$<' . - test -f ../common/`basename '$<'` -o \ - \! -f `dirname '$<'`/../common/`basename '$<'` \ - || $(LN_S) `dirname '$<'`/../common/`basename '$<'` ../common/`basename '$<'` - $(XAS) `basename '$<'` - - -EEPROM_BOOT_OBJS = eeprom_boot.rel eeprom_init.rel $(STARTUP) - -eeprom_boot.ihx: $(EEPROM_BOOT_OBJS) $(LIBDEP) - $(XCC) $(LINKOPTS) -o $@ $(EEPROM_BOOT_OBJS) - -usrp1_eeprom.bin: eeprom_boot.bin - $(PYTHON) ../common/build_eeprom.py -r4 $< $@ - -eeprom_boot.bin: eeprom_boot.ihx - objcopy -I ihex -O binary $< $@ - -USRP_OBJS = \ - vectors.rel \ - usrp_main.rel usrp_common.rel board_specific.rel \ - fpga_load.rel fpga_rev2.rel init_gpif.rel usrp_gpif.rel \ - usb_descriptors.rel spi.rel eeprom_io.rel $(STARTUP) - -std.ihx: $(USRP_OBJS) $(LIBDEP) - $(XCC) $(LINKOPTS) -o $@ $(USRP_OBJS) - -CLEANFILES = \ - *.ihx *.lnk *.lst *.map *.mem *.rel *.rst *.sym *.asm *.lib *.bin \ - usrp_gpif.c usrp_gpif_inline.h - -DISTCLEANFILES = \ - *.ihx *.lnk *.lst *.map *.mem *.rel *.rst *.sym *.asm *.lib *.bin - -# build gpif stuff - -all: usrp_gpif.c std.ihx usrp1_eeprom.bin - -usrp_gpif.c usrp_gpif_inline.h : gpif.c - srcdir=$(srcdir) $(PYTHON) $(srcdir)/edit-gpif $(srcdir)/gpif.c usrp_gpif.c usrp_gpif_inline.h - -# dependencies - -usrp_main.rel: usrp_gpif_inline.h - -#usrp_main.rel: fpga.h usrp_common.h ../../include/usrp_commands.h usrp_gpif_inline.h ../../include/usrp_config.h usrp_rev2_regs.h ../../include/fx2regs.h -#usrp_common.rel: usrp_common.h ../../include/usrp_commands.h ../../include/usrp_config.h usrp_rev2_regs.h ../../include/fx2regs.h -#fpga.rel: usrp_common.h ../../include/usrp_commands.h fpga.h ../../include/usrp_config.h usrp_rev2_regs.h ../../include/fx2regs.h -#init_gpif.rel: usrp_common.h ../../include/usrp_config.h usrp_rev2_regs.h ../../include/fx2regs.h diff --git a/firmware/fx2/src/usrp1/_startup.a51 b/firmware/fx2/src/usrp1/_startup.a51 deleted file mode 100644 index 4f5309922..000000000 --- a/firmware/fx2/src/usrp1/_startup.a51 +++ /dev/null @@ -1 +0,0 @@ - .include "../common/_startup.a51" diff --git a/firmware/fx2/src/usrp1/blink_leds.c b/firmware/fx2/src/usrp1/blink_leds.c deleted file mode 100644 index c633d5d48..000000000 --- a/firmware/fx2/src/usrp1/blink_leds.c +++ /dev/null @@ -1 +0,0 @@ -#include "../common/blink_leds.c" diff --git a/firmware/fx2/src/usrp1/check_mdelay.c b/firmware/fx2/src/usrp1/check_mdelay.c deleted file mode 100644 index ea4ccdb14..000000000 --- a/firmware/fx2/src/usrp1/check_mdelay.c +++ /dev/null @@ -1 +0,0 @@ -#include "../common/check_mdelay.c" diff --git a/firmware/fx2/src/usrp1/check_udelay.c b/firmware/fx2/src/usrp1/check_udelay.c deleted file mode 100644 index d01622e5e..000000000 --- a/firmware/fx2/src/usrp1/check_udelay.c +++ /dev/null @@ -1 +0,0 @@ -#include "../common/check_udelay.c" diff --git a/firmware/fx2/src/usrp1/edit-gpif b/firmware/fx2/src/usrp1/edit-gpif deleted file mode 100755 index 5367b75a5..000000000 --- a/firmware/fx2/src/usrp1/edit-gpif +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env python -# -*- Python -*- -# -# Copyright 2003 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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, or (at your option) -# any later version. -# -# GNU Radio 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 Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# Edit the gpif.c file generated by the Cypress GPIF Designer Tool and -# produce usrp_gpif.c, and usrp_gpif_inline.h, files suitable for our -# uses. - -import re -import string -import sys - -def check_flow_state (line, flow_state_dict): - mo = re.match (r'/\* Wave (\d) FlowStates \*/ (.*),', line) - if mo: - wave = int (mo.group (1)) - data = mo.group (2) - split = data.split (',', 8) - v = map (lambda x : int (x, 16), split) - # print "%s, %s" % (wave, data) - # print "split: ", split - # print "v : ", v - flow_state_dict[wave] = v - - -def delta (xseq, yseq): - # set subtraction - z = [] - for x in xseq: - if x not in yseq: - z.append (x) - return z - - -def write_define (output, name, pairs): - output.write ('#define %s()\t\\\n' % name) - output.write ('do {\t\t\t\t\t\\\n') - for reg, val in pairs: - output.write ('%14s = 0x%02x;\t\t\t\\\n' % (reg, val)) - output.write ('} while (0)\n\n') - -def write_inlines (output, dict): - regs = ['FLOWSTATE', 'FLOWLOGIC', 'FLOWEQ0CTL', 'FLOWEQ1CTL', 'FLOWHOLDOFF', - 'FLOWSTB', 'FLOWSTBEDGE', 'FLOWSTBHPERIOD', 'GPIFHOLDAMOUNT'] - - READ_FLOW_STATE = 2 - WRITE_FLOW_STATE = 3 - - read_info = zip (regs, dict[READ_FLOW_STATE]) - write_info = zip (regs, dict[WRITE_FLOW_STATE]) - - output.write ('''/* - * Machine generated by "edit-gpif". Do not edit by hand. - */ - -''') - write_define (output, 'setup_flowstate_common', read_info) - write_define (output, 'setup_flowstate_read', delta (read_info, write_info)) - write_define (output, 'setup_flowstate_write', delta (write_info, read_info)) - - -def edit_gpif (input_name, output_name, inline_name): - input = open (input_name, 'r') - output = open (output_name, 'w') - inline = open (inline_name, 'w') - flow_state_dict = {} - - output.write ('''/* - * Machine generated by "edit-gpif". Do not edit by hand. - */ - -''') - - while 1: - line = input.readline () - line = string.replace (line, '\r','') - line = re.sub (r' *$', r'', line) - - check_flow_state (line, flow_state_dict) - - line = re.sub (r'#include', r'// #include', line) - line = re.sub (r'xdata ', r'', line) - if re.search (r'GpifInit', line): - break - - output.write (line) - - output.close () - write_inlines (inline, flow_state_dict) - inline.close () - - -# gpif.c usrp_gpif.c usrp_gpif_inline.h -edit_gpif (sys.argv[1], sys.argv[2], sys.argv[3]) diff --git a/firmware/fx2/src/usrp1/fpga_load.c b/firmware/fx2/src/usrp1/fpga_load.c deleted file mode 100644 index b0256e925..000000000 --- a/firmware/fx2/src/usrp1/fpga_load.c +++ /dev/null @@ -1 +0,0 @@ -#include "../common/fpga_load.c" diff --git a/firmware/fx2/src/usrp1/init_gpif.c b/firmware/fx2/src/usrp1/init_gpif.c deleted file mode 100644 index 0f5944b3b..000000000 --- a/firmware/fx2/src/usrp1/init_gpif.c +++ /dev/null @@ -1 +0,0 @@ -#include "../common/init_gpif.c" diff --git a/firmware/fx2/src/usrp1/usrp_common.c b/firmware/fx2/src/usrp1/usrp_common.c deleted file mode 100644 index f389d9253..000000000 --- a/firmware/fx2/src/usrp1/usrp_common.c +++ /dev/null @@ -1 +0,0 @@ -#include "../common/usrp_common.c" diff --git a/firmware/fx2/src/usrp1/vectors.a51 b/firmware/fx2/src/usrp1/vectors.a51 deleted file mode 100644 index fa579ba8a..000000000 --- a/firmware/fx2/src/usrp1/vectors.a51 +++ /dev/null @@ -1 +0,0 @@ - .include "../common/vectors.a51" diff --git a/firmware/fx2/usrp1/CMakeLists.txt b/firmware/fx2/usrp1/CMakeLists.txt new file mode 100644 index 000000000..6607bc7f2 --- /dev/null +++ b/firmware/fx2/usrp1/CMakeLists.txt @@ -0,0 +1,84 @@ +# +# Copyright 2010 Ettus Research LLC +# +# 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 <http://www.gnu.org/licenses/>. +# + +include_directories(${CMAKE_SOURCE_DIR}/common) + +#for usrp_common.h and the regs files... +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +#now make a lib to link against +set(libusrp1_sources + ${CMAKE_SOURCE_DIR}/common/delay.c + ${CMAKE_SOURCE_DIR}/common/fx2utils.c + ${CMAKE_SOURCE_DIR}/common/i2c.c + ${CMAKE_SOURCE_DIR}/common/init_gpif.c + ${CMAKE_SOURCE_DIR}/common/isr.c + ${CMAKE_SOURCE_DIR}/common/timer.c + ${CMAKE_SOURCE_DIR}/common/usb_common.c +# ${CMAKE_SOURCE_DIR}/common/spi.c +# ${CMAKE_SOURCE_DIR}/common/vectors.a51 +) + +#file(GLOB libusrp1_c_sources ${CMAKE_SOURCE_DIR}/common/*.c) +#file(GLOB libusrp1_a51_sources ${CMAKE_SOURCE_DIR}/common/*.a51) +#list(APPEND libusrp1_sources ${libusrp1_c_sources} ${libusrp1_a51_sources}) + +add_library(libusrp1 STATIC ${libusrp1_sources}) + +# edit-gpif hacks up gpif.c for our purposes. no major surgery, just moving stuff around. +set(GPIF_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/gpif.c) +set(GPIF_SOURCE_OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/usrp_gpif.c) +set(GPIF_HEADER_OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/usrp_gpif_inline.h) + +add_custom_command( + OUTPUT ${GPIF_SOURCE_OUTPUT} + DEPENDS ${EDIT_GPIF_USRP1} + COMMAND ${PYTHON_EXECUTABLE} ${EDIT_GPIF_USRP1} ${GPIF_SOURCE} ${GPIF_SOURCE_OUTPUT} ${GPIF_HEADER_OUTPUT} + COMMENT "Generating ${GPIF_SOURCE_OUTPUT}" +) + +#file(GLOB usrp1_sources *.c) +set(usrp1_sources + ${CMAKE_SOURCE_DIR}/common/vectors.a51 + board_specific.c + eeprom_io.c + fpga_load.c + fpga_rev2.c + usrp_common.c + usrp_gpif.c + usrp_main.c + usb_descriptors.a51 + ${CMAKE_SOURCE_DIR}/common/spi.c + ${CMAKE_SOURCE_DIR}/common/_startup.a51 +) +add_executable(usrp1_fw ${usrp1_sources}) +target_link_libraries(usrp1_fw libusrp1) + +set(eeprom1_sources + ${CMAKE_SOURCE_DIR}/common/eeprom_boot.a51 + ${CMAKE_SOURCE_DIR}/common/eeprom_init.c + ${CMAKE_SOURCE_DIR}/common/_startup.a51 +) + +add_custom_target(usrp1_eeprom ALL + DEPENDS usrp1_boot + COMMAND objcopy -I ihex -O binary usrp1_boot.ihx usrp1_boot.bin + COMMAND ${PYTHON_EXECUTABLE} ${BUILD_EEPROM} -r1 usrp1_boot.bin usrp1_eeprom.bin +) + +add_executable(usrp1_boot ${eeprom1_sources}) +target_link_libraries(usrp1_boot libusrp1) diff --git a/firmware/fx2/src/usrp1/board_specific.c b/firmware/fx2/usrp1/board_specific.c index ef0081d84..ef0081d84 100644 --- a/firmware/fx2/src/usrp1/board_specific.c +++ b/firmware/fx2/usrp1/board_specific.c diff --git a/firmware/fx2/src/usrp1/eeprom_io.c b/firmware/fx2/usrp1/eeprom_io.c index 9eeb53636..9eeb53636 100644 --- a/firmware/fx2/src/usrp1/eeprom_io.c +++ b/firmware/fx2/usrp1/eeprom_io.c diff --git a/firmware/fx2/src/usrp1/eeprom_io.h b/firmware/fx2/usrp1/eeprom_io.h index 558017b12..558017b12 100644 --- a/firmware/fx2/src/usrp1/eeprom_io.h +++ b/firmware/fx2/usrp1/eeprom_io.h diff --git a/firmware/fx2/src/common/fpga_load.c b/firmware/fx2/usrp1/fpga_load.c index c3ae9e707..c3ae9e707 100644 --- a/firmware/fx2/src/common/fpga_load.c +++ b/firmware/fx2/usrp1/fpga_load.c diff --git a/firmware/fx2/src/usrp1/fpga_rev2.c b/firmware/fx2/usrp1/fpga_rev2.c index cca961dc4..cca961dc4 100644 --- a/firmware/fx2/src/usrp1/fpga_rev2.c +++ b/firmware/fx2/usrp1/fpga_rev2.c diff --git a/firmware/fx2/src/usrp1/fpga_rev2.h b/firmware/fx2/usrp1/fpga_rev2.h index 54ec3f9fa..54ec3f9fa 100644 --- a/firmware/fx2/src/usrp1/fpga_rev2.h +++ b/firmware/fx2/usrp1/fpga_rev2.h diff --git a/firmware/fx2/src/usrp1/gpif.c b/firmware/fx2/usrp1/gpif.c index f6745a43b..f6745a43b 100644 --- a/firmware/fx2/src/usrp1/gpif.c +++ b/firmware/fx2/usrp1/gpif.c diff --git a/firmware/fx2/src/usrp1/gpif.gpf b/firmware/fx2/usrp1/gpif.gpf Binary files differindex 854e25399..854e25399 100755 --- a/firmware/fx2/src/usrp1/gpif.gpf +++ b/firmware/fx2/usrp1/gpif.gpf diff --git a/firmware/fx2/src/usrp1/usb_descriptors.a51 b/firmware/fx2/usrp1/usb_descriptors.a51 index a60adbef8..a60adbef8 100644 --- a/firmware/fx2/src/usrp1/usb_descriptors.a51 +++ b/firmware/fx2/usrp1/usb_descriptors.a51 diff --git a/firmware/fx2/src/common/usrp_common.c b/firmware/fx2/usrp1/usrp_common.c index 0998653c2..0998653c2 100644 --- a/firmware/fx2/src/common/usrp_common.c +++ b/firmware/fx2/usrp1/usrp_common.c diff --git a/firmware/fx2/usrp1/usrp_gpif.c b/firmware/fx2/usrp1/usrp_gpif.c new file mode 100644 index 000000000..1191c8b28 --- /dev/null +++ b/firmware/fx2/usrp1/usrp_gpif.c @@ -0,0 +1,206 @@ +/* + * Machine generated by "edit-gpif". Do not edit by hand. + */ + +// This program configures the General Programmable Interface (GPIF) for FX2. +// Please do not modify sections of text which are marked as "DO NOT EDIT ...". +// +// DO NOT EDIT ... +// GPIF Initialization +// Interface Timing Async +// Internal Ready Init IntRdy=1 +// CTL Out Tristate-able Binary +// SingleWrite WF Select 1 +// SingleRead WF Select 0 +// FifoWrite WF Select 3 +// FifoRead WF Select 2 +// Data Bus Idle Drive Tristate +// END DO NOT EDIT + +// DO NOT EDIT ... +// GPIF Wave Names +// Wave 0 = singlerd +// Wave 1 = singlewr +// Wave 2 = FIFORd +// Wave 3 = FIFOWr + +// GPIF Ctrl Outputs Level +// CTL 0 = WEN# CMOS +// CTL 1 = REN# CMOS +// CTL 2 = OE# CMOS +// CTL 3 = CLRST CMOS +// CTL 4 = unused CMOS +// CTL 5 = BOGUS CMOS + +// GPIF Rdy Inputs +// RDY0 = EF# +// RDY1 = FF# +// RDY2 = unused +// RDY3 = unused +// RDY4 = unused +// RDY5 = TCXpire +// FIFOFlag = FIFOFlag +// IntReady = IntReady +// END DO NOT EDIT +// DO NOT EDIT ... +// +// GPIF Waveform 0: singlerd +// +// Interval 0 1 2 3 4 5 6 Idle (7) +// _________ _________ _________ _________ _________ _________ _________ _________ +// +// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val +// DataMode NO Data NO Data NO Data NO Data NO Data NO Data NO Data +// NextData SameData SameData SameData SameData SameData SameData SameData +// Int Trig No Int No Int No Int No Int No Int No Int No Int +// IF/Wait Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 +// Term A +// LFunc +// Term B +// Branch1 +// Branch0 +// Re-Exec +// Sngl/CRC Default Default Default Default Default Default Default +// WEN# 0 0 0 0 0 0 0 0 +// REN# 0 0 0 0 0 0 0 0 +// OE# 0 0 0 0 0 0 0 0 +// CLRST 0 0 0 0 0 0 0 0 +// unused 0 0 0 0 0 0 0 0 +// BOGUS 0 0 0 0 0 0 0 0 +// +// END DO NOT EDIT +// DO NOT EDIT ... +// +// GPIF Waveform 1: singlewr +// +// Interval 0 1 2 3 4 5 6 Idle (7) +// _________ _________ _________ _________ _________ _________ _________ _________ +// +// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val +// DataMode Activate Activate Activate Activate Activate Activate Activate +// NextData SameData SameData SameData SameData SameData SameData SameData +// Int Trig No Int No Int No Int No Int No Int No Int No Int +// IF/Wait Wait 1 IF Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 +// Term A EF# +// LFunc AND +// Term B EF# +// Branch1 ThenIdle +// Branch0 ElseIdle +// Re-Exec No +// Sngl/CRC Default Default Default Default Default Default Default +// WEN# 0 1 1 1 1 1 1 0 +// REN# 0 0 0 0 0 0 0 0 +// OE# 0 0 0 0 0 0 0 0 +// CLRST 0 0 0 0 0 0 0 0 +// unused 0 0 0 0 0 0 0 0 +// BOGUS 0 0 0 0 0 0 0 0 +// +// END DO NOT EDIT +// DO NOT EDIT ... +// +// GPIF Waveform 2: FIFORd +// +// Interval 0 1 2 3 4 5 6 Idle (7) +// _________ _________ _________ _________ _________ _________ _________ _________ +// +// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val +// DataMode NO Data Activate NO Data NO Data NO Data NO Data NO Data +// NextData SameData SameData SameData SameData SameData SameData SameData +// Int Trig No Int No Int No Int No Int No Int No Int No Int +// IF/Wait Wait 1 IF Wait 1 IF Wait 1 Wait 1 Wait 1 +// Term A TCXpire TCXpire +// LFunc AND AND +// Term B TCXpire TCXpire +// Branch1 Then 2 ThenIdle +// Branch0 Else 1 ElseIdle +// Re-Exec No No +// Sngl/CRC Default Default Default Default Default Default Default +// WEN# 0 0 0 0 0 0 0 0 +// REN# 1 0 0 0 0 0 0 0 +// OE# 1 1 1 0 0 0 0 0 +// CLRST 0 0 0 0 0 0 0 0 +// unused 0 0 0 0 0 0 0 0 +// BOGUS 0 0 0 0 0 0 0 0 +// +// END DO NOT EDIT +// DO NOT EDIT ... +// +// GPIF Waveform 3: FIFOWr +// +// Interval 0 1 2 3 4 5 6 Idle (7) +// _________ _________ _________ _________ _________ _________ _________ _________ +// +// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val +// DataMode NO Data Activate Activate Activate Activate Activate Activate +// NextData SameData SameData SameData SameData SameData SameData SameData +// Int Trig No Int No Int No Int No Int No Int No Int No Int +// IF/Wait Wait 1 IF Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 +// Term A TCXpire +// LFunc AND +// Term B TCXpire +// Branch1 ThenIdle +// Branch0 Else 1 +// Re-Exec No +// Sngl/CRC Default Default Default Default Default Default Default +// WEN# 0 0 0 0 0 0 0 0 +// REN# 0 0 0 0 0 0 0 0 +// OE# 0 0 0 0 0 0 0 0 +// CLRST 0 0 0 0 0 0 0 0 +// unused 0 0 0 0 0 0 0 0 +// BOGUS 0 0 0 0 0 0 0 0 +// +// END DO NOT EDIT + +// GPIF Program Code + +// DO NOT EDIT ... +// #include "fx2.h" +// #include "fx2regs.h" +// #include "fx2sdly.h" // SYNCDELAY macro +// END DO NOT EDIT + +// DO NOT EDIT ... +const char WaveData[128] = +{ +// Wave 0 +/* LenBr */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07, +/* Opcode*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +/* Output*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +/* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, +// Wave 1 +/* LenBr */ 0x01, 0x3F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07, +/* Opcode*/ 0x22, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, +/* Output*/ 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, +/* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, +// Wave 2 +/* LenBr */ 0x01, 0x11, 0x01, 0x3F, 0x01, 0x01, 0x01, 0x07, +/* Opcode*/ 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, +/* Output*/ 0x06, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, +/* LFun */ 0x00, 0x2D, 0x00, 0x2D, 0x00, 0x00, 0x00, 0x3F, +// Wave 3 +/* LenBr */ 0x01, 0x39, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07, +/* Opcode*/ 0x00, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, +/* Output*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +/* LFun */ 0x00, 0x2D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, +}; +// END DO NOT EDIT + +// DO NOT EDIT ... +const char FlowStates[36] = +{ +/* Wave 0 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* Wave 1 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* Wave 2 FlowStates */ 0x81,0x2D,0x26,0x00,0x04,0x04,0x03,0x02,0x00, +/* Wave 3 FlowStates */ 0x81,0x2D,0x21,0x00,0x04,0x04,0x03,0x02,0x00, +}; +// END DO NOT EDIT + +// DO NOT EDIT ... +const char InitData[7] = +{ +/* Regs */ 0xA0,0x00,0x00,0x00,0xEE,0x4E,0x00 +}; +// END DO NOT EDIT + +// TO DO: You may add additional code below. + diff --git a/firmware/fx2/usrp1/usrp_gpif_inline.h b/firmware/fx2/usrp1/usrp_gpif_inline.h new file mode 100644 index 000000000..77a741a8b --- /dev/null +++ b/firmware/fx2/usrp1/usrp_gpif_inline.h @@ -0,0 +1,27 @@ +/* + * Machine generated by "edit-gpif". Do not edit by hand. + */ + +#define setup_flowstate_common() \ +do { \ + FLOWSTATE = 0x81; \ + FLOWLOGIC = 0x2d; \ + FLOWEQ0CTL = 0x26; \ + FLOWEQ1CTL = 0x00; \ + FLOWHOLDOFF = 0x04; \ + FLOWSTB = 0x04; \ + FLOWSTBEDGE = 0x03; \ +FLOWSTBHPERIOD = 0x02; \ +GPIFHOLDAMOUNT = 0x00; \ +} while (0) + +#define setup_flowstate_read() \ +do { \ + FLOWEQ0CTL = 0x26; \ +} while (0) + +#define setup_flowstate_write() \ +do { \ + FLOWEQ0CTL = 0x21; \ +} while (0) + diff --git a/firmware/fx2/src/usrp1/usrp_main.c b/firmware/fx2/usrp1/usrp_main.c index b8c2e98ec..3eb8c001f 100644 --- a/firmware/fx2/src/usrp1/usrp_main.c +++ b/firmware/fx2/usrp1/usrp_main.c @@ -19,6 +19,7 @@ */ #include "usrp_common.h" +#include "usrp_regs.h" #include "usrp_commands.h" #include "fpga.h" #include "usrp_gpif_inline.h" diff --git a/firmware/fx2/src/usrp1/usrp_rev2_regs.h b/firmware/fx2/usrp1/usrp_regs.h index a4f1d9896..a4f1d9896 100644 --- a/firmware/fx2/src/usrp1/usrp_rev2_regs.h +++ b/firmware/fx2/usrp1/usrp_regs.h diff --git a/firmware/fx2/src/common/build_eeprom.py b/firmware/fx2/utils/build_eeprom.py index ae62587db..298ccc00c 100755 --- a/firmware/fx2/src/common/build_eeprom.py +++ b/firmware/fx2/utils/build_eeprom.py @@ -28,7 +28,7 @@ from optparse import OptionParser # USB Vendor and Product ID's VID = 0xfffe # Free Software Folks -PID = 0x0002 # Universal Software Radio Peripheral + def msb (x): return (x >> 8) & 0xff @@ -46,9 +46,14 @@ def build_eeprom_image (filename, rev): f = open(filename, 'rb') bytes = f.read() - devid = rev + devid = 4 #for compatibility start_addr = 0 #prove me wrong + if(rev == 1): + PID = 0x0002 #USRP1 + else: + PID = 0x0003 #USRP1P + rom_header = [ 0xC2, # boot from EEPROM lsb (VID), @@ -87,7 +92,7 @@ if __name__ == '__main__': usage = "usage: %prog -r REV [options] bootfile.bin outfile.bin" parser = OptionParser (usage=usage) parser.add_option ("-r", "--rev", type="int", default=-1, - help="Specify USRP revision number REV (2 or 4)") + help="Specify USRP revision, 1 for USRP1, 2 for USRP1P") (options, args) = parser.parse_args () if len (args) != 2: parser.print_help () diff --git a/firmware/fx2/src/common/edit-gpif b/firmware/fx2/utils/edit-gpif.py index 5367b75a5..5367b75a5 100755 --- a/firmware/fx2/src/common/edit-gpif +++ b/firmware/fx2/utils/edit-gpif.py diff --git a/firmware/fx2/include/generate_regs.py b/firmware/fx2/utils/generate_regs.py index 656cd5e81..656cd5e81 100755 --- a/firmware/fx2/include/generate_regs.py +++ b/firmware/fx2/utils/generate_regs.py diff --git a/firmware/microblaze/apps/txrx_uhd.c b/firmware/microblaze/apps/txrx_uhd.c index 1dd6e80ac..b7837f207 100644 --- a/firmware/microblaze/apps/txrx_uhd.c +++ b/firmware/microblaze/apps/txrx_uhd.c @@ -422,6 +422,7 @@ link_changed_callback(int speed) link_is_up = speed != 0; hal_set_leds(link_is_up ? LED_RJ45 : 0x0, LED_RJ45); printf("\neth link changed: speed = %d\n", speed); + if (link_is_up) send_gratuitous_arp(); } static void setup_network(void){ @@ -479,15 +480,18 @@ main(void) printf("FPGA compatibility number: %d\n", USRP2_FPGA_COMPAT_NUM); printf("Firmware compatibility number: %d\n", USRP2_FW_COMPAT_NUM); - ethernet_register_link_changed_callback(link_changed_callback); - ethernet_init(); - + //1) register the addresses into the network stack register_mac_addr(ethernet_mac_addr()); register_ip_addr(get_ip_addr()); + //2) register callbacks for udp ports we service register_udp_listener(USRP2_UDP_CTRL_PORT, handle_udp_ctrl_packet); register_udp_listener(USRP2_UDP_DATA_PORT, handle_udp_data_packet); + //3) setup ethernet hardware to bring the link up + ethernet_register_link_changed_callback(link_changed_callback); + ethernet_init(); + // initialize double buffering state machine for ethernet -> DSP Tx dbsm_init(&dsp_tx_sm, DSP_TX_BUF_0, @@ -536,7 +540,7 @@ main(void) } if (pending & PIC_OVERRUN_INT){ - dbsm_handle_rx_overrun(&dsp_rx_sm); + //dbsm_handle_rx_overrun(&dsp_rx_sm); pic_regs->pending = PIC_OVERRUN_INT; // clear pending interrupt // FIXME Figure out how to handle this robustly. diff --git a/firmware/microblaze/lib/Makefile.inc b/firmware/microblaze/lib/Makefile.inc index a576d1ccb..2b5685d3f 100644 --- a/firmware/microblaze/lib/Makefile.inc +++ b/firmware/microblaze/lib/Makefile.inc @@ -26,6 +26,7 @@ COMMON_SRCS = \ $(top_srcdir)/lib/clocks.c \ $(top_srcdir)/lib/dbsm.c \ $(top_srcdir)/lib/eeprom.c \ + $(top_srcdir)/lib/eth_addrs.c \ $(top_srcdir)/lib/eth_mac.c \ $(top_srcdir)/lib/_exit.c \ $(top_srcdir)/lib/exit.c \ diff --git a/firmware/microblaze/lib/eth_addrs.c b/firmware/microblaze/lib/eth_addrs.c new file mode 100644 index 000000000..c6320e4fa --- /dev/null +++ b/firmware/microblaze/lib/eth_addrs.c @@ -0,0 +1,125 @@ +/* + * Copyright 2010 Ettus Research LLC + * Copyright 2007 Free Software Foundation, Inc. + * + * 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 <http://www.gnu.org/licenses/>. + */ + +#include "ethernet.h" +#include "memory_map.h" +#include "nonstdio.h" +#include <stdbool.h> +#include "i2c.h" +#include "usrp2/fw_common.h" + +//////////////////////////////////////////////////////////////////////// +// EEPROM Layout +//////////////////////////////////////////////////////////////////////// +#define USRP2_EE_MBOARD_MAC_ADDR 0x02 //6 bytes +#define USRP2_EE_MBOARD_IP_ADDR 0x0C //uint32, big-endian + +static bool +unprogrammed(const void *t, size_t len) +{ + int i; + uint8_t *p = (uint8_t *)t; + bool all_zeros = true; + bool all_ones = true; + for (i = 0; i < len; i++){ + all_zeros &= p[i] == 0x00; + all_ones &= p[i] == 0xff; + } + return all_ones | all_zeros; +} + +//////////////////// MAC Addr Stuff /////////////////////// + +static int8_t src_mac_addr_initialized = false; +static eth_mac_addr_t src_mac_addr = {{ + 0x00, 0x50, 0xC2, 0x85, 0x3f, 0xff + }}; + +const eth_mac_addr_t * +ethernet_mac_addr(void) +{ + if (!src_mac_addr_initialized){ // fetch from eeprom + src_mac_addr_initialized = true; + + // if we're simulating, don't read the EEPROM model, it's REALLY slow + if (hwconfig_simulation_p()) + return &src_mac_addr; + + eth_mac_addr_t tmp; + bool ok = eeprom_read(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_MAC_ADDR, &tmp, sizeof(tmp)); + if (!ok || unprogrammed(&tmp, sizeof(tmp))){ + // use the default + } + else + src_mac_addr = tmp; + } + + return &src_mac_addr; +} + +bool +ethernet_set_mac_addr(const eth_mac_addr_t *t) +{ + bool ok = eeprom_write(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_MAC_ADDR, t, sizeof(eth_mac_addr_t)); + if (ok){ + src_mac_addr = *t; + src_mac_addr_initialized = true; + //eth_mac_set_addr(t); //this breaks the link + } + + return ok; +} + +//////////////////// IP Addr Stuff /////////////////////// + +static int8_t src_ip_addr_initialized = false; +static struct ip_addr src_ip_addr = { + (192 << 24 | 168 << 16 | 10 << 8 | 2 << 0) +}; + + +const struct ip_addr *get_ip_addr(void) +{ + if (!src_ip_addr_initialized){ // fetch from eeprom + src_ip_addr_initialized = true; + + // if we're simulating, don't read the EEPROM model, it's REALLY slow + if (hwconfig_simulation_p()) + return &src_ip_addr; + + struct ip_addr tmp; + bool ok = eeprom_read(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_IP_ADDR, &tmp, sizeof(tmp)); + if (!ok || unprogrammed(&tmp, sizeof(tmp))){ + // use the default + } + else + src_ip_addr = tmp; + } + + return &src_ip_addr; +} + +bool set_ip_addr(const struct ip_addr *t){ + bool ok = eeprom_write(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_IP_ADDR, t, sizeof(struct ip_addr)); + if (ok){ + src_ip_addr = *t; + src_ip_addr_initialized = true; + } + + return ok; +} diff --git a/firmware/microblaze/lib/net_common.c b/firmware/microblaze/lib/net_common.c index 6c9509c92..beaaa5948 100644 --- a/firmware/microblaze/lib/net_common.c +++ b/firmware/microblaze/lib/net_common.c @@ -351,6 +351,22 @@ send_arp_reply(struct arp_eth_ipv4 *req, eth_mac_addr_t our_mac) send_pkt(t, ETHERTYPE_ARP, &reply, sizeof(reply), 0, 0, 0, 0); } +void send_gratuitous_arp(void){ + struct arp_eth_ipv4 req _AL4; + req.ar_hrd = ARPHRD_ETHER; + req.ar_pro = ETHERTYPE_IPV4; + req.ar_hln = sizeof(eth_mac_addr_t); + req.ar_pln = sizeof(struct ip_addr); + req.ar_op = ARPOP_REQUEST; + memcpy(req.ar_sha, ethernet_mac_addr(), sizeof(eth_mac_addr_t)); + memcpy(req.ar_sip, get_ip_addr(), sizeof(struct ip_addr)); + memset(req.ar_tha, 0x00, sizeof(eth_mac_addr_t)); + memcpy(req.ar_tip, get_ip_addr(), sizeof(struct ip_addr)); + + //send the request with a broadcast ethernet mac address + eth_mac_addr_t t; memset(&t, 0xff, sizeof(t)); + send_pkt(t, ETHERTYPE_ARP, &req, sizeof(req), 0, 0, 0, 0); +} static void handle_arp_packet(struct arp_eth_ipv4 *p, size_t size) diff --git a/firmware/microblaze/lib/net_common.h b/firmware/microblaze/lib/net_common.h index 112669b46..3040e5ef3 100644 --- a/firmware/microblaze/lib/net_common.h +++ b/firmware/microblaze/lib/net_common.h @@ -47,4 +47,6 @@ void send_udp_pkt(int src_port, struct socket_address dst, void handle_eth_packet(uint32_t *p, size_t nlines); +void send_gratuitous_arp(void); + #endif /* INCLUDED_NET_COMMON_H */ diff --git a/firmware/microblaze/lib/u2_init.c b/firmware/microblaze/lib/u2_init.c index 8d666b76b..c9b4beb2b 100644 --- a/firmware/microblaze/lib/u2_init.c +++ b/firmware/microblaze/lib/u2_init.c @@ -28,16 +28,6 @@ #include "usrp2/fw_common.h" #include "nonstdio.h" -unsigned char u2_hw_rev_major; -unsigned char u2_hw_rev_minor; - -static inline void -get_hw_rev(void) -{ - bool ok = eeprom_read(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV_LSB, &u2_hw_rev_minor, 1); - ok &= eeprom_read(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV_MSB, &u2_hw_rev_major, 1); -} - /* * We ought to arrange for this to be called before main, but for now, * we require that the user's main call u2_init as the first thing... @@ -60,7 +50,6 @@ u2_init(void) pic_init(); // progammable interrupt controller i2c_init(); hal_enable_ints(); - get_hw_rev(); bp_init(); // buffer pool diff --git a/firmware/microblaze/lib/u2_init.h b/firmware/microblaze/lib/u2_init.h index 334791189..848bd88de 100644 --- a/firmware/microblaze/lib/u2_init.h +++ b/firmware/microblaze/lib/u2_init.h @@ -20,9 +20,6 @@ #include <stdbool.h> -extern unsigned char u2_hw_rev_major; -extern unsigned char u2_hw_rev_minor; - /*! * one-time init */ diff --git a/firmware/microblaze/usrp2/Makefile.am b/firmware/microblaze/usrp2/Makefile.am index 8da013980..ba426b75c 100644 --- a/firmware/microblaze/usrp2/Makefile.am +++ b/firmware/microblaze/usrp2/Makefile.am @@ -22,10 +22,11 @@ AM_CFLAGS = \ AM_LDFLAGS = \ $(COMMON_LFLAGS) \ - libusrp2.a \ -Wl,-defsym -Wl,_TEXT_START_ADDR=0x0050 \ -Wl,-defsym -Wl,_STACK_SIZE=3072 +LDADD = libusrp2.a + ######################################################################## # USRP2 specific library and programs ######################################################################## diff --git a/firmware/microblaze/usrp2/ethernet.c b/firmware/microblaze/usrp2/ethernet.c index d60d7dc4c..5d4654bda 100644 --- a/firmware/microblaze/usrp2/ethernet.c +++ b/firmware/microblaze/usrp2/ethernet.c @@ -16,16 +16,12 @@ */ #include "ethernet.h" -#include "memory_map.h" #include "eth_phy.h" #include "eth_mac.h" #include "eth_mac_regs.h" #include "pic.h" #include "hal_io.h" #include "nonstdio.h" -#include <stdbool.h> -#include "i2c.h" -#include "usrp2/fw_common.h" #define VERBOSE 1 @@ -269,101 +265,6 @@ ethernet_init(void) eth_mac_miim_write(PHY_CTRL, t | MII_CR_RESTART_AUTO_NEG); } -static bool -unprogrammed(const void *t, size_t len) -{ - int i; - uint8_t *p = (uint8_t *)t; - bool all_zeros = true; - bool all_ones = true; - for (i = 0; i < len; i++){ - all_zeros &= p[i] == 0x00; - all_ones &= p[i] == 0xff; - } - return all_ones | all_zeros; -} - -//////////////////// MAC Addr Stuff /////////////////////// - -static int8_t src_mac_addr_initialized = false; -static eth_mac_addr_t src_mac_addr = {{ - 0x00, 0x50, 0xC2, 0x85, 0x3f, 0xff - }}; - -const eth_mac_addr_t * -ethernet_mac_addr(void) -{ - if (!src_mac_addr_initialized){ // fetch from eeprom - src_mac_addr_initialized = true; - - // if we're simulating, don't read the EEPROM model, it's REALLY slow - if (hwconfig_simulation_p()) - return &src_mac_addr; - - eth_mac_addr_t tmp; - bool ok = eeprom_read(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_MAC_ADDR, &tmp, sizeof(tmp)); - if (!ok || unprogrammed(&tmp, sizeof(tmp))){ - // use the default - } - else - src_mac_addr = tmp; - } - - return &src_mac_addr; -} - -bool -ethernet_set_mac_addr(const eth_mac_addr_t *t) -{ - bool ok = eeprom_write(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_MAC_ADDR, t, sizeof(eth_mac_addr_t)); - if (ok){ - src_mac_addr = *t; - src_mac_addr_initialized = true; - //eth_mac_set_addr(t); //this breaks the link - } - - return ok; -} - -//////////////////// IP Addr Stuff /////////////////////// - -static int8_t src_ip_addr_initialized = false; -static struct ip_addr src_ip_addr = { - (192 << 24 | 168 << 16 | 10 << 8 | 2 << 0) -}; - - -const struct ip_addr *get_ip_addr(void) -{ - if (!src_ip_addr_initialized){ // fetch from eeprom - src_ip_addr_initialized = true; - - // if we're simulating, don't read the EEPROM model, it's REALLY slow - if (hwconfig_simulation_p()) - return &src_ip_addr; - - struct ip_addr tmp; - bool ok = eeprom_read(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_IP_ADDR, &tmp, sizeof(tmp)); - if (!ok || unprogrammed(&tmp, sizeof(tmp))){ - // use the default - } - else - src_ip_addr = tmp; - } - - return &src_ip_addr; -} - -bool set_ip_addr(const struct ip_addr *t){ - bool ok = eeprom_write(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_IP_ADDR, t, sizeof(struct ip_addr)); - if (ok){ - src_ip_addr = *t; - src_ip_addr_initialized = true; - } - - return ok; -} - int ethernet_check_errors(void) { diff --git a/host/docs/CMakeLists.txt b/host/docs/CMakeLists.txt index 65db3befc..4d3269543 100644 --- a/host/docs/CMakeLists.txt +++ b/host/docs/CMakeLists.txt @@ -20,6 +20,7 @@ ######################################################################## SET(manual_sources index.rst + identification.rst build.rst coding.rst dboards.rst diff --git a/host/docs/identification.rst b/host/docs/identification.rst new file mode 100644 index 000000000..49d36ec1a --- /dev/null +++ b/host/docs/identification.rst @@ -0,0 +1,97 @@ +======================================================================== +UHD - Device Identification Notes +======================================================================== + +.. contents:: Table of Contents + +------------------------------------------------------------------------ +Identifying USRPs +------------------------------------------------------------------------ +Every device has several ways of identifying it on the host system: + +* **Serial:** A globally unique identifier. +* **Address:** A unique identifier on a network. +* **Name:** An optional user-set identifier. + +The address is only applicable for network-based devices. +See the USRP2 application notes. + +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Device discovery via command line +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +A "find devices" utility application comes bundled with the UHD. +The find devices application will search for all devices on the host system and print the results. + +:: + + uhd_find_devices + +Device address arguments can be supplied to narrow the scope of the search. + +:: + + uhd_find_devices --args="type=usrp1" + + -- OR -- + + uhd_find_devices --args="serial=12345678" + +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Device discovery through the API +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The device::find() API call searches for devices and returns a list of discovered devices. + +:: + + uhd::device_addr_t hint; //an empty hint discovers all devices + uhd::device_addrs_t dev_addrs = uhd::device::find(hint); + +The hint argument can be populated to narrow the scope of the search. + +:: + + uhd::device_addr_t hint; + hint["type"] = "usrp1"; + uhd::device_addrs_t dev_addrs = uhd::device::find(hint); + + -- OR -- + + uhd::device_addr_t hint; + hint["serial"] = "12345678"; + uhd::device_addrs_t dev_addrs = uhd::device::find(hint); + +------------------------------------------------------------------------ +Naming a USRP +------------------------------------------------------------------------ +For convenience purposes, users may assign a custom name to their USRPs. +The USRP can then be identified via name, rather than a difficult to remember serial or address. + +A name has the following properties: + +* is composed of ASCII characters +* is between 0 and 20 characters +* is not required to be unique + +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Set a custom name +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Run the following commands: +:: + + cd <prefix>/share/uhd/utils + ./usrp_burn_mb_eeprom --args=<optional device args> --key=name --val=lab1_xcvr + +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Discovery via name +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The keyword "name" can be used to narrow the scope of the search. +Example with the find devices utility: +:: + + uhd_find_devices --args="name=lab1_xcvr" + + -- OR -- + + uhd_find_devices --args="type=usrp1, name=lab1_xcvr" diff --git a/host/docs/index.rst b/host/docs/index.rst index 7f8129e2d..9d6d14d0f 100644 --- a/host/docs/index.rst +++ b/host/docs/index.rst @@ -21,6 +21,7 @@ Building the UHD Application Notes ^^^^^^^^^^^^^^^^^^^^^ * `General Application Notes <./general.html>`_ +* `Device Identification Notes <./identification.html>`_ * `Firmware and FPGA Image Notes <./images.html>`_ * `USRP1 Application Notes <./usrp1.html>`_ * `USRP2 Application Notes <./usrp2.html>`_ diff --git a/host/docs/usrp1.rst b/host/docs/usrp1.rst index 3443fd871..be684e20e 100644 --- a/host/docs/usrp1.rst +++ b/host/docs/usrp1.rst @@ -4,36 +4,6 @@ UHD - USRP1 Application Notes .. contents:: Table of Contents ------------------------------------------------------------------------- -Addressing the device ------------------------------------------------------------------------- -A USRP1 can be identified though its 8 digit serial number, -designated by the "serial" key in the device address. - -The device address string representation for a USRP1 with serial 12345678: - -:: - - serial=12345678 - -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Change the serial number -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The USRP1 serial number can be changed to any 8 byte string. Examples: - -:: - - cd <prefix>/share/uhd/utils - ./usrp1_serial_burner --new=87654321 - - -- OR -- - - ./usrp1_serial_burner --new=Beatrice - - -- OR -- - - ./usrp1_serial_burner --old=12345678 --new=87654321 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Specify a non-standard image ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/host/docs/usrp2.rst b/host/docs/usrp2.rst index ada98000d..f0d1e2744 100644 --- a/host/docs/usrp2.rst +++ b/host/docs/usrp2.rst @@ -97,7 +97,7 @@ Run the following commands: :: cd <prefix>/share/uhd/utils - ./usrp_addr_burner --addr=192.168.10.2 --new-ip=192.168.10.3 + ./usrp_burn_mb_eeprom --args=<optional device args> --key=ip-addr --val=192.168.10.3 **Method 2 (Linux Only):** This method assumes that you do not know the IP address of your USRP2. diff --git a/host/include/uhd/usrp/CMakeLists.txt b/host/include/uhd/usrp/CMakeLists.txt index abddf3951..cdf31df87 100644 --- a/host/include/uhd/usrp/CMakeLists.txt +++ b/host/include/uhd/usrp/CMakeLists.txt @@ -34,6 +34,7 @@ INSTALL(FILES ### utilities ### dsp_utils.hpp + mboard_eeprom.hpp misc_utils.hpp subdev_spec.hpp tune_helper.hpp diff --git a/host/include/uhd/usrp/mboard_eeprom.hpp b/host/include/uhd/usrp/mboard_eeprom.hpp new file mode 100644 index 000000000..f44275aad --- /dev/null +++ b/host/include/uhd/usrp/mboard_eeprom.hpp @@ -0,0 +1,64 @@ +// +// Copyright 2010 Ettus Research LLC +// +// 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 <http://www.gnu.org/licenses/>. +// + +#ifndef INCLUDED_UHD_USRP_MBOARD_EEPROM_HPP +#define INCLUDED_UHD_USRP_MBOARD_EEPROM_HPP + +#include <uhd/config.hpp> +#include <uhd/types/dict.hpp> +#include <uhd/types/serial.hpp> +#include <string> + +namespace uhd{ namespace usrp{ + + /*! + * The motherboard EEPROM object: + * Knows how to read and write the EEPROM for various USRPs. + * The class inherits from a string, string dictionary. + * Use the dictionary interface to get and set values. + * Commit to the EEPROM to save changed settings. + */ + struct UHD_API mboard_eeprom_t : uhd::dict<std::string, std::string>{ + + //! Possible EEPROM maps types + enum map_type{ + MAP_NXXX, + MAP_B1XX + }; + + //! Make a new empty mboard eeprom + mboard_eeprom_t(void); + + /*! + * Make a new mboard EEPROM handler. + * \param iface the interface to i2c + * \param map the map type enum + */ + mboard_eeprom_t(i2c_iface &iface, map_type map); + + /*! + * Write the contents of this object to the EEPROM. + * \param iface the interface to i2c + * \param map the map type enum + */ + void commit(i2c_iface &iface, map_type map); + + }; + +}} //namespace + +#endif /* INCLUDED_UHD_USRP_MBOARD_EEPROM_HPP */ diff --git a/host/include/uhd/usrp/mboard_props.hpp b/host/include/uhd/usrp/mboard_props.hpp index 0f250f439..df94d1678 100644 --- a/host/include/uhd/usrp/mboard_props.hpp +++ b/host/include/uhd/usrp/mboard_props.hpp @@ -44,7 +44,8 @@ namespace uhd{ namespace usrp{ MBOARD_PROP_CLOCK_CONFIG = 'C', //rw, clock_config_t MBOARD_PROP_TIME_NOW = 't', //rw, time_spec_t MBOARD_PROP_TIME_NEXT_PPS = 'T', //wo, time_spec_t - MBOARD_PROP_STREAM_CMD = 's' //wo, stream_cmd_t + MBOARD_PROP_STREAM_CMD = 's', //wo, stream_cmd_t + MBOARD_PROP_EEPROM_MAP = 'M' //wr, mboard_eeprom_t::sptr }; }} //namespace diff --git a/host/lib/types.cpp b/host/lib/types.cpp index 4188568aa..e5e6a2512 100644 --- a/host/lib/types.cpp +++ b/host/lib/types.cpp @@ -250,22 +250,19 @@ mac_addr_t mac_addr_t::from_bytes(const byte_vector_t &bytes){ mac_addr_t mac_addr_t::from_string(const std::string &mac_addr_str){ - byte_vector_t bytes = boost::assign::list_of - (0x00)(0x50)(0xC2)(0x85)(0x30)(0x00); // Matt's IAB + byte_vector_t bytes; try{ - //only allow patterns of xx:xx or xx:xx:xx:xx:xx:xx - //the IAB above will fill in for the shorter pattern - if (mac_addr_str.size() != 5 and mac_addr_str.size() != 17) - throw std::runtime_error("expected exactly 5 or 17 characters"); + if (mac_addr_str.size() != 17){ + throw std::runtime_error("expected exactly 17 characters"); + } //split the mac addr hex string at the colons - size_t i = 0; BOOST_FOREACH(const std::string &hex_str, std::split_string(mac_addr_str, ":")){ int hex_num; std::istringstream iss(hex_str); iss >> std::hex >> hex_num; - bytes[i++] = boost::uint8_t(hex_num); + bytes.push_back(boost::uint8_t(hex_num)); } } diff --git a/host/lib/usrp/CMakeLists.txt b/host/lib/usrp/CMakeLists.txt index eeb181e0b..3d832c356 100644 --- a/host/lib/usrp/CMakeLists.txt +++ b/host/lib/usrp/CMakeLists.txt @@ -23,6 +23,7 @@ LIBUHD_APPEND_SOURCES( ${CMAKE_SOURCE_DIR}/lib/usrp/dboard_id.cpp ${CMAKE_SOURCE_DIR}/lib/usrp/dboard_manager.cpp ${CMAKE_SOURCE_DIR}/lib/usrp/dsp_utils.cpp + ${CMAKE_SOURCE_DIR}/lib/usrp/mboard_eeprom.cpp ${CMAKE_SOURCE_DIR}/lib/usrp/misc_utils.cpp ${CMAKE_SOURCE_DIR}/lib/usrp/multi_usrp.cpp ${CMAKE_SOURCE_DIR}/lib/usrp/single_usrp.cpp diff --git a/host/lib/usrp/mboard_eeprom.cpp b/host/lib/usrp/mboard_eeprom.cpp new file mode 100644 index 000000000..076d0b279 --- /dev/null +++ b/host/lib/usrp/mboard_eeprom.cpp @@ -0,0 +1,194 @@ +// +// Copyright 2010 Ettus Research LLC +// +// 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 <http://www.gnu.org/licenses/>. +// + +#include <uhd/usrp/mboard_eeprom.hpp> +#include <uhd/types/mac_addr.hpp> +#include <uhd/utils/algorithm.hpp> +#include <boost/asio/ip/address_v4.hpp> +#include <boost/assign/list_of.hpp> +#include <boost/lexical_cast.hpp> +#include <boost/foreach.hpp> + +using namespace uhd; +using namespace uhd::usrp; + +/*********************************************************************** + * Constants + **********************************************************************/ +static const size_t SERIAL_LEN = 9; +static const size_t NAME_MAX_LEN = 32 - SERIAL_LEN; + +/*********************************************************************** + * Utility functions + **********************************************************************/ + +//! create a string from a byte vector, return empty if invalid ascii +static const std::string bytes_to_string(const byte_vector_t &bytes){ + std::string out; + BOOST_FOREACH(boost::uint8_t byte, bytes){ + if (byte < 32 or byte > 127) return out; + out += byte; + } + return out; +} + +//! create a byte vector from a string, null terminate unless max length +static const byte_vector_t string_to_bytes(const std::string &string, size_t max_length){ + byte_vector_t bytes; + for (size_t i = 0; i < std::min(string.size(), max_length); i++){ + bytes.push_back(string[i]); + } + if (bytes.size() < max_length - 1) bytes.push_back('\0'); + return bytes; +} + +/*********************************************************************** + * Implementation of NXXX load/store + **********************************************************************/ +static const boost::uint8_t NXXX_EEPROM_ADDR = 0x50; + +static const uhd::dict<std::string, boost::uint8_t> USRP_NXXX_OFFSETS = boost::assign::map_list_of + ("rev-lsb-msb", 0x00) + ("mac-addr", 0x02) + ("ip-addr", 0x08) + //leave space here for other addresses (perhaps) + ("serial", 0x18) + ("name", 0x18 + SERIAL_LEN) +; + +static void load_nxxx(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){ + //extract the revision number + byte_vector_t rev_lsb_msb = iface.read_eeprom(NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["rev-lsb-msb"], 2); + boost::uint16_t rev = (boost::uint16_t(rev_lsb_msb.at(0)) << 0) | (boost::uint16_t(rev_lsb_msb.at(1)) << 8); + mb_eeprom["rev"] = boost::lexical_cast<std::string>(rev); + + //extract the addresses + mb_eeprom["mac-addr"] = mac_addr_t::from_bytes(iface.read_eeprom( + NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["mac-addr"], 6 + )).to_string(); + + boost::asio::ip::address_v4::bytes_type ip_addr_bytes; + std::copy(iface.read_eeprom(NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["ip-addr"], 4), ip_addr_bytes); + mb_eeprom["ip-addr"] = boost::asio::ip::address_v4(ip_addr_bytes).to_string(); + + //extract the serial + mb_eeprom["serial"] = bytes_to_string(iface.read_eeprom( + NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["serial"], SERIAL_LEN + )); + + //extract the name + mb_eeprom["name"] = bytes_to_string(iface.read_eeprom( + NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["name"], NAME_MAX_LEN + )); + + //empty serial correction: use the mac address + if (mb_eeprom["serial"].empty()) mb_eeprom["serial"] = mb_eeprom["mac-addr"]; +} + +static void store_nxxx(const mboard_eeprom_t &mb_eeprom, i2c_iface &iface){ + //parse the revision number + if (mb_eeprom.has_key("rev")){ + boost::uint16_t rev = boost::lexical_cast<boost::uint16_t>(mb_eeprom["rev"]); + byte_vector_t rev_lsb_msb = boost::assign::list_of + (boost::uint8_t(rev >> 0)) + (boost::uint8_t(rev >> 8)) + ; + iface.write_eeprom(NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["rev-lsb-msb"], rev_lsb_msb); + } + + //store the addresses + if (mb_eeprom.has_key("mac-addr")) iface.write_eeprom( + NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["mac-addr"], + mac_addr_t::from_string(mb_eeprom["mac-addr"]).to_bytes() + ); + + if (mb_eeprom.has_key("ip-addr")){ + byte_vector_t ip_addr_bytes(4); + std::copy(boost::asio::ip::address_v4::from_string(mb_eeprom["ip-addr"]).to_bytes(), ip_addr_bytes); + iface.write_eeprom(NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["ip-addr"], ip_addr_bytes); + } + + //store the serial + if (mb_eeprom.has_key("serial")) iface.write_eeprom( + NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["serial"], + string_to_bytes(mb_eeprom["serial"], SERIAL_LEN) + ); + + //store the name + if (mb_eeprom.has_key("name")) iface.write_eeprom( + NXXX_EEPROM_ADDR, USRP_NXXX_OFFSETS["name"], + string_to_bytes(mb_eeprom["name"], NAME_MAX_LEN) + ); +} + +/*********************************************************************** + * Implementation of B1XX load/store + **********************************************************************/ +static const boost::uint8_t B1XX_EEPROM_ADDR = 0x50; +static const size_t B1XXX_SERIAL_LEN = 8; + +static const uhd::dict<std::string, boost::uint8_t> USRP_B1XX_OFFSETS = boost::assign::map_list_of + ("serial", 0xf8) + ("name", 0xf8 - NAME_MAX_LEN) +; + +static void load_b1xx(mboard_eeprom_t &mb_eeprom, i2c_iface &iface){ + //extract the serial + mb_eeprom["serial"] = bytes_to_string(iface.read_eeprom( + B1XX_EEPROM_ADDR, USRP_B1XX_OFFSETS["serial"], B1XXX_SERIAL_LEN + )); + + //extract the name + mb_eeprom["name"] = bytes_to_string(iface.read_eeprom( + B1XX_EEPROM_ADDR, USRP_B1XX_OFFSETS["name"], NAME_MAX_LEN + )); +} + +static void store_b1xx(const mboard_eeprom_t &mb_eeprom, i2c_iface &iface){ + //store the serial + if (mb_eeprom.has_key("serial")) iface.write_eeprom( + B1XX_EEPROM_ADDR, USRP_B1XX_OFFSETS["serial"], + string_to_bytes(mb_eeprom["serial"], B1XXX_SERIAL_LEN) + ); + + //store the name + if (mb_eeprom.has_key("name")) iface.write_eeprom( + B1XX_EEPROM_ADDR, USRP_B1XX_OFFSETS["name"], + string_to_bytes(mb_eeprom["name"], NAME_MAX_LEN) + ); +} + +/*********************************************************************** + * Implementation of mboard eeprom + **********************************************************************/ +mboard_eeprom_t::mboard_eeprom_t(void){ + /* NOP */ +} + +mboard_eeprom_t::mboard_eeprom_t(i2c_iface &iface, map_type map){ + switch(map){ + case MAP_NXXX: load_nxxx(*this, iface); break; + case MAP_B1XX: load_b1xx(*this, iface); break; + } +} + +void mboard_eeprom_t::commit(i2c_iface &iface, map_type map){ + switch(map){ + case MAP_NXXX: store_nxxx(*this, iface); break; + case MAP_B1XX: store_b1xx(*this, iface); break; + } +} diff --git a/host/lib/usrp/usrp1/CMakeLists.txt b/host/lib/usrp/usrp1/CMakeLists.txt index 67487f99e..022015231 100644 --- a/host/lib/usrp/usrp1/CMakeLists.txt +++ b/host/lib/usrp/usrp1/CMakeLists.txt @@ -40,7 +40,7 @@ ENDIF(ENABLE_USRP1 AND NOT HAVE_USB_SUPPORT) IF(ENABLE_USRP1) MESSAGE(STATUS " Building USRP1 support.") - INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../firmware/fx2/include) + INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../firmware/fx2/common) LIBUHD_APPEND_SOURCES( ${CMAKE_SOURCE_DIR}/lib/usrp/usrp1/clock_ctrl.cpp diff --git a/host/lib/usrp/usrp1/mboard_impl.cpp b/host/lib/usrp/usrp1/mboard_impl.cpp index 669b20efa..c1f0f1d38 100644 --- a/host/lib/usrp/usrp1/mboard_impl.cpp +++ b/host/lib/usrp/usrp1/mboard_impl.cpp @@ -262,24 +262,10 @@ void usrp1_impl::mboard_get(const wax::obj &key_, wax::obj &val) { named_prop_t key = named_prop_t::extract(key_); - if(key_.type() == typeid(std::string)) { - if(key.as<std::string>() == "serial") { - uhd::byte_vector_t buf; - buf.insert(buf.begin(), 248); - boost::this_thread::sleep(boost::posix_time::milliseconds(100)); - _iface->write_i2c(I2C_DEV_EEPROM, buf); - boost::this_thread::sleep(boost::posix_time::milliseconds(100)); - buf = _iface->read_i2c(I2C_DEV_EEPROM, 8); - val = std::string(buf.begin(), buf.end()); - } - - return; - } - //handle the get request conditioned on the key switch(key.as<mboard_prop_t>()){ case MBOARD_PROP_NAME: - val = std::string("usrp1 mboard - " + (*_mboard_proxy)[std::string("serial")].as<std::string>()); + val = std::string("usrp1 mboard - " + _iface->mb_eeprom["serial"]); return; case MBOARD_PROP_OTHERS: @@ -336,6 +322,10 @@ void usrp1_impl::mboard_get(const wax::obj &key_, wax::obj &val) val = _tx_subdev_spec; return; + case MBOARD_PROP_EEPROM_MAP: + val = _iface->mb_eeprom; + return; + default: UHD_THROW_PROP_GET_ERROR(); } } @@ -351,14 +341,6 @@ void usrp1_impl::mboard_set(const wax::obj &key, const wax::obj &val) std::cout << "USRP1 EEPROM image: " << usrp1_eeprom_image << std::endl; _ctrl_transport->usrp_load_eeprom(val.as<std::string>()); } - - if(key.as<std::string>() == "serial") { - std::string sernum = val.as<std::string>(); - uhd::byte_vector_t buf(sernum.begin(), sernum.end()); - buf.insert(buf.begin(), 248); - _iface->write_i2c(I2C_DEV_EEPROM, buf); - } - return; } @@ -395,6 +377,13 @@ void usrp1_impl::mboard_set(const wax::obj &key, const wax::obj &val) _iface->poke32(FR_TX_MUX, calc_tx_mux(_tx_subdev_spec, _mboard_proxy->get_link())); return; + case MBOARD_PROP_EEPROM_MAP: + // Step1: commit the map, writing only those values set. + // Step2: readback the entire eeprom map into the iface. + val.as<mboard_eeprom_t>().commit(*_iface, mboard_eeprom_t::MAP_B1XX); + _iface->mb_eeprom = mboard_eeprom_t(*_iface, mboard_eeprom_t::MAP_B1XX); + return; + default: UHD_THROW_PROP_SET_ERROR(); } } diff --git a/host/lib/usrp/usrp1/usrp1_iface.cpp b/host/lib/usrp/usrp1/usrp1_iface.cpp index 64ced2905..691c51fe8 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.cpp +++ b/host/lib/usrp/usrp1/usrp1_iface.cpp @@ -25,6 +25,7 @@ #include <iomanip> using namespace uhd; +using namespace uhd::usrp; using namespace uhd::transport; static const bool iface_debug = false; @@ -36,7 +37,8 @@ public: ******************************************************************/ usrp1_iface_impl(usrp_ctrl::sptr ctrl_transport) { - _ctrl_transport = ctrl_transport; + _ctrl_transport = ctrl_transport; + mb_eeprom = mboard_eeprom_t(*this, mboard_eeprom_t::MAP_B1XX); } ~usrp1_iface_impl(void) diff --git a/host/lib/usrp/usrp1/usrp1_iface.hpp b/host/lib/usrp/usrp1/usrp1_iface.hpp index 3f608584a..34a2330b5 100644 --- a/host/lib/usrp/usrp1/usrp1_iface.hpp +++ b/host/lib/usrp/usrp1/usrp1_iface.hpp @@ -18,6 +18,7 @@ #ifndef INCLUDED_USRP1_IFACE_HPP #define INCLUDED_USRP1_IFACE_HPP +#include <uhd/usrp/mboard_eeprom.hpp> #include <uhd/types/serial.hpp> #include <boost/shared_ptr.hpp> #include <boost/utility.hpp> @@ -81,6 +82,8 @@ public: boost::uint16_t index, unsigned char* buff, boost::uint16_t length) = 0; + + uhd::usrp::mboard_eeprom_t mb_eeprom; }; #endif /* INCLUDED_USRP1_IFACE_HPP */ diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index bc478c7fb..6016b0979 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -56,6 +56,10 @@ static device_addrs_t usrp1_find(const device_addr_t &hint) //return an empty list of addresses when type is set to non-usrp1 if (hint.has_key("type") and hint["type"] != "usrp1") return usrp1_addrs; + //Return an empty list of addresses when an address is specified, + //since an address is intended for a different, non-USB, device. + if (hint.has_key("addr")) return usrp1_addrs; + //extract the firmware path for the USRP1 std::string usrp1_fw_image; try{ @@ -89,11 +93,16 @@ static device_addrs_t usrp1_find(const device_addr_t &hint) pid = USRP1_PRODUCT_ID; BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid)) { + usrp1_iface::sptr iface = usrp1_iface::make(usrp_ctrl::make(usb_control::make(handle))); device_addr_t new_addr; new_addr["type"] = "usrp1"; + new_addr["name"] = iface->mb_eeprom["name"]; new_addr["serial"] = handle->get_serial(); - //this is a found usrp1 when a hint serial is not specified or it matches - if (not hint.has_key("serial") or hint["serial"] == new_addr["serial"]){ + //this is a found usrp1 when the hint serial and name match or blank + if ( + (not hint.has_key("name") or hint["name"] == new_addr["name"]) and + (not hint.has_key("serial") or hint["serial"] == new_addr["serial"]) + ){ usrp1_addrs.push_back(new_addr); } } diff --git a/host/lib/usrp/usrp2/clock_ctrl.cpp b/host/lib/usrp/usrp2/clock_ctrl.cpp index 1e1c9b7b8..232f3b32a 100644 --- a/host/lib/usrp/usrp2/clock_ctrl.cpp +++ b/host/lib/usrp/usrp2/clock_ctrl.cpp @@ -20,6 +20,7 @@ #include "usrp2_regs.hpp" //spi slave constants #include <uhd/utils/assert.hpp> #include <boost/cstdint.hpp> +#include <boost/lexical_cast.hpp> #include <iostream> using namespace uhd; @@ -83,8 +84,8 @@ public: } void enable_mimo_clock_out(bool enb){ - //FIXME TODO put this revision read in a common place - boost::uint8_t rev_hi = _iface->read_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV_MSB, 1).at(0); + boost::uint16_t rev = boost::lexical_cast<boost::uint16_t>(_iface->mb_eeprom["rev"]); + boost::uint8_t rev_hi = boost::uint8_t(rev >> 8); //calculate the low and high dividers size_t divider = size_t(this->get_master_clock_rate()/10e6); diff --git a/host/lib/usrp/usrp2/fw_common.h b/host/lib/usrp/usrp2/fw_common.h index e812e1221..4ff31ddfd 100644 --- a/host/lib/usrp/usrp2/fw_common.h +++ b/host/lib/usrp/usrp2/fw_common.h @@ -52,14 +52,6 @@ extern "C" { #define USRP2_I2C_ADDR_TX_DB (USRP2_I2C_DEV_EEPROM | 0x4) #define USRP2_I2C_ADDR_RX_DB (USRP2_I2C_DEV_EEPROM | 0x5) -//////////////////////////////////////////////////////////////////////// -// EEPROM Layout -//////////////////////////////////////////////////////////////////////// -#define USRP2_EE_MBOARD_REV_LSB 0x00 //1 byte -#define USRP2_EE_MBOARD_REV_MSB 0x01 //1 byte -#define USRP2_EE_MBOARD_MAC_ADDR 0x02 //6 bytes -#define USRP2_EE_MBOARD_IP_ADDR 0x0C //uint32, big-endian - typedef enum{ USRP2_CTRL_ID_HUH_WHAT = ' ', //USRP2_CTRL_ID_FOR_SURE, //TODO error condition enums diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index bbe9c273f..83b70bddc 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -236,6 +236,11 @@ size_t usrp2_impl::get_max_recv_samps_per_packet(void) const{ return bpp/_rx_otw_type.get_sample_size(); } +static void handle_overflow(std::vector<usrp2_mboard_impl::sptr> &mboards, size_t chan){ + std::cerr << "O" << std::flush; + mboards.at(chan/mboards.size())->handle_overflow(); +} + size_t usrp2_impl::recv( const std::vector<void *> &buffs, size_t num_samps, rx_metadata_t &metadata, const io_type_t &io_type, @@ -248,6 +253,7 @@ size_t usrp2_impl::recv( io_type, _rx_otw_type, //input and output types to convert _mboards.front()->get_master_clock_freq(), //master clock tick rate uhd::transport::vrt::if_hdr_unpack_be, - boost::bind(&usrp2_impl::io_impl::get_recv_buffs, _io_impl.get(), _1, timeout) + boost::bind(&usrp2_impl::io_impl::get_recv_buffs, _io_impl.get(), _1, timeout), + boost::bind(&handle_overflow, _mboards, _1) ); } diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index a0e6adfad..df98ba275 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -22,11 +22,7 @@ #include <uhd/usrp/mboard_props.hpp> #include <uhd/utils/assert.hpp> #include <uhd/utils/algorithm.hpp> -#include <uhd/types/mac_addr.hpp> -#include <uhd/types/dict.hpp> #include <boost/bind.hpp> -#include <boost/assign/list_of.hpp> -#include <boost/asio/ip/address_v4.hpp> #include <iostream> using namespace uhd; @@ -41,15 +37,9 @@ usrp2_mboard_impl::usrp2_mboard_impl( size_t recv_frame_size ): _index(index), - _recv_frame_size(recv_frame_size) + _recv_frame_size(recv_frame_size), + _iface(usrp2_iface::make(ctrl_transport)) { - //make a new interface for usrp2 stuff - _iface = usrp2_iface::make(ctrl_transport); - - //extract the mboard rev numbers - _rev_lo = _iface->read_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV_LSB, 1).at(0); - _rev_hi = _iface->read_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV_MSB, 1).at(0); - //contruct the interfaces to mboard perifs _clock_ctrl = usrp2_clock_ctrl::make(_iface); _codec_ctrl = usrp2_codec_ctrl::make(_iface); @@ -176,7 +166,15 @@ void usrp2_mboard_impl::set_time_spec(const time_spec_t &time_spec, bool now){ _iface->poke32(U2_REG_TIME64_SECS, boost::uint32_t(time_spec.get_full_secs())); } +void usrp2_mboard_impl::handle_overflow(void){ + _iface->poke32(U2_REG_RX_CTRL_CLEAR_OVERRUN, 1); + if (_continuous_streaming){ //re-issue the stream command if already continuous + this->issue_ddc_stream_cmd(stream_cmd_t::STREAM_MODE_START_CONTINUOUS); + } +} + void usrp2_mboard_impl::issue_ddc_stream_cmd(const stream_cmd_t &stream_cmd){ + _continuous_streaming = stream_cmd.stream_mode == stream_cmd_t::STREAM_MODE_START_CONTINUOUS; _iface->poke32(U2_REG_RX_CTRL_STREAM_CMD, dsp_type1::calc_stream_cmd_word( stream_cmd, _recv_frame_size )); @@ -192,35 +190,14 @@ static const std::string dboard_name = "0"; void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){ named_prop_t key = named_prop_t::extract(key_); - //handle the other props - if (key_.type() == typeid(std::string)){ - if (key.as<std::string>() == "mac-addr"){ - byte_vector_t bytes = _iface->read_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_MAC_ADDR, 6); - val = mac_addr_t::from_bytes(bytes).to_string(); - return; - } - - if (key.as<std::string>() == "ip-addr"){ - boost::asio::ip::address_v4::bytes_type bytes; - std::copy(_iface->read_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_IP_ADDR, 4), bytes); - val = boost::asio::ip::address_v4(bytes).to_string(); - return; - } - } - //handle the get request conditioned on the key switch(key.as<mboard_prop_t>()){ case MBOARD_PROP_NAME: - val = str(boost::format("usrp2 mboard%d - rev %d:%d") % _index % _rev_hi % _rev_lo); + val = str(boost::format("usrp2 mboard%d - rev %s") % _index % _iface->mb_eeprom["rev"]); return; - case MBOARD_PROP_OTHERS:{ - prop_names_t others = boost::assign::list_of - ("mac-addr") - ("ip-addr") - ; - val = others; - } + case MBOARD_PROP_OTHERS: + val = prop_names_t(); return; case MBOARD_PROP_RX_DBOARD: @@ -281,6 +258,10 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){ val = _tx_subdev_spec; return; + case MBOARD_PROP_EEPROM_MAP: + val = _iface->mb_eeprom; + return; + default: UHD_THROW_PROP_GET_ERROR(); } } @@ -289,21 +270,6 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){ * MBoard Set Properties **********************************************************************/ void usrp2_mboard_impl::set(const wax::obj &key, const wax::obj &val){ - //handle the other props - if (key.type() == typeid(std::string)){ - if (key.as<std::string>() == "mac-addr"){ - byte_vector_t bytes = mac_addr_t::from_string(val.as<std::string>()).to_bytes(); - _iface->write_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_MAC_ADDR, bytes); - return; - } - - if (key.as<std::string>() == "ip-addr"){ - byte_vector_t bytes(4); - std::copy(boost::asio::ip::address_v4::from_string(val.as<std::string>()).to_bytes(), bytes); - _iface->write_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_IP_ADDR, bytes); - return; - } - } //handle the get request conditioned on the key switch(key.as<mboard_prop_t>()){ @@ -347,6 +313,13 @@ void usrp2_mboard_impl::set(const wax::obj &key, const wax::obj &val){ )); return; + case MBOARD_PROP_EEPROM_MAP: + // Step1: commit the map, writing only those values set. + // Step2: readback the entire eeprom map into the iface. + val.as<mboard_eeprom_t>().commit(*_iface, mboard_eeprom_t::MAP_NXXX); + _iface->mb_eeprom = mboard_eeprom_t(*_iface, mboard_eeprom_t::MAP_NXXX); + return; + default: UHD_THROW_PROP_SET_ERROR(); } } diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index 2d450bfc6..eb2685efa 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -28,6 +28,7 @@ #include <algorithm> using namespace uhd; +using namespace uhd::usrp; using namespace uhd::transport; /*! @@ -58,6 +59,8 @@ public: "The fpga build is not compatible with the host code build." ) % int(USRP2_FPGA_COMPAT_NUM) % fpga_compat_num)); } + + mb_eeprom = mboard_eeprom_t(*this, mboard_eeprom_t::MAP_NXXX); } ~usrp2_iface_impl(void){ diff --git a/host/lib/usrp/usrp2/usrp2_iface.hpp b/host/lib/usrp/usrp2/usrp2_iface.hpp index 12fd4730a..bf36cbf6e 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.hpp +++ b/host/lib/usrp/usrp2/usrp2_iface.hpp @@ -20,6 +20,7 @@ #include <uhd/transport/udp_simple.hpp> #include <uhd/types/serial.hpp> +#include <uhd/usrp/mboard_eeprom.hpp> #include <boost/shared_ptr.hpp> #include <boost/utility.hpp> #include <boost/cstdint.hpp> @@ -102,6 +103,9 @@ public: size_t num_bits, bool readback ) = 0; + + //motherboard eeprom map structure + uhd::usrp::mboard_eeprom_t mb_eeprom; }; #endif /* INCLUDED_USRP2_IFACE_HPP */ diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index a680708ad..5f549c4fd 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -21,6 +21,7 @@ #include <uhd/usrp/device_props.hpp> #include <uhd/utils/assert.hpp> #include <uhd/utils/static.hpp> +#include <uhd/utils/warning.hpp> #include <uhd/utils/algorithm.hpp> #include <boost/assign/list_of.hpp> #include <boost/format.hpp> @@ -61,7 +62,7 @@ static uhd::device_addrs_t usrp2_find(const device_addr_t &hint){ if (if_addrs.inet == asio::ip::address_v4::loopback().to_string()) continue; //create a new hint with this broadcast address - device_addr_t new_hint; + device_addr_t new_hint = hint; new_hint["addr"] = if_addrs.bcast; //call discover with the new hint and append results @@ -101,19 +102,37 @@ static uhd::device_addrs_t usrp2_find(const device_addr_t &hint){ while(true){ size_t len = udp_transport->recv(asio::buffer(usrp2_ctrl_data_in_mem), DISCOVERY_TIMEOUT_MS); //std::cout << len << "\n"; - if (len > offsetof(usrp2_ctrl_data_t, data)){ - //handle the received data - switch(ntohl(ctrl_data_in->id)){ - case USRP2_CTRL_ID_WAZZUP_DUDE: - //make a boost asio ipv4 with the raw addr in host byte order - boost::asio::ip::address_v4 ip_addr(ntohl(ctrl_data_in->data.ip_addr)); - device_addr_t new_addr; - new_addr["type"] = "usrp2"; - new_addr["addr"] = ip_addr.to_string(); - usrp2_addrs.push_back(new_addr); - //dont break here, it will exit the while loop - //just continue on to the next loop iteration + if (len > offsetof(usrp2_ctrl_data_t, data) and ntohl(ctrl_data_in->id) == USRP2_CTRL_ID_WAZZUP_DUDE){ + //make a boost asio ipv4 with the raw addr in host byte order + boost::asio::ip::address_v4 ip_addr(ntohl(ctrl_data_in->data.ip_addr)); + device_addr_t new_addr; + new_addr["type"] = "usrp2"; + new_addr["addr"] = ip_addr.to_string(); + //Attempt to read the name from the EEPROM and perform filtering. + //This operation can throw due to COMPAT mismatch. That is OK. + //We will allow the device to be found and the COMPAT mismatch + //will be thrown as an exception in the factory function. + try{ + mboard_eeprom_t mb_eeprom = usrp2_iface::make( + udp_simple::make_connected(new_addr["addr"], num2str(USRP2_UDP_CTRL_PORT)) + )->mb_eeprom; + new_addr["name"] = mb_eeprom["name"]; + new_addr["serial"] = mb_eeprom["serial"]; + if ( + (not hint.has_key("name") or hint["name"] == new_addr["name"]) and + (not hint.has_key("serial") or hint["serial"] == new_addr["serial"]) + ){ + usrp2_addrs.push_back(new_addr); + } } + catch(const std::exception &e){ + uhd::warning::post( + std::string("Ignoring discovered device\n") + + e.what() + ); + } + //dont break here, it will exit the while loop + //just continue on to the next loop iteration } if (len == 0) break; //timeout } diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp index 558726a2b..71f52878c 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.hpp +++ b/host/lib/usrp/usrp2/usrp2_impl.hpp @@ -32,7 +32,7 @@ #include <boost/shared_ptr.hpp> #include <boost/function.hpp> #include <uhd/transport/vrt_if_packet.hpp> -#include <uhd/transport/udp_simple.hpp> //mtu +#include <uhd/transport/udp_simple.hpp> #include <uhd/transport/udp_zero_copy.hpp> #include <uhd/usrp/dboard_manager.hpp> #include <uhd/usrp/subdev_spec.hpp> @@ -92,15 +92,12 @@ public: return _clock_ctrl->get_master_clock_rate(); } + void handle_overflow(void); + private: size_t _index; - int _rev_hi, _rev_lo; const size_t _recv_frame_size; - - //properties for this mboard - void get(const wax::obj &, wax::obj &); - void set(const wax::obj &, const wax::obj &); - uhd::usrp::subdev_spec_t _rx_subdev_spec, _tx_subdev_spec; + bool _continuous_streaming; //interfaces usrp2_iface::sptr _iface; @@ -108,6 +105,11 @@ private: usrp2_codec_ctrl::sptr _codec_ctrl; usrp2_serdes_ctrl::sptr _serdes_ctrl; + //properties for this mboard + void get(const wax::obj &, wax::obj &); + void set(const wax::obj &, const wax::obj &); + uhd::usrp::subdev_spec_t _rx_subdev_spec, _tx_subdev_spec; + //rx and tx dboard methods and objects uhd::usrp::dboard_manager::sptr _dboard_manager; uhd::usrp::dboard_iface::sptr _dboard_iface; diff --git a/host/utils/CMakeLists.txt b/host/utils/CMakeLists.txt index a95864ca7..f0fa806c5 100644 --- a/host/utils/CMakeLists.txt +++ b/host/utils/CMakeLists.txt @@ -33,23 +33,19 @@ INSTALL(TARGETS ######################################################################## # Utilities that get installed into the share path ######################################################################## -ADD_EXECUTABLE(usrp2_addr_burner usrp2_addr_burner.cpp) -TARGET_LINK_LIBRARIES(usrp2_addr_burner uhd) - ADD_EXECUTABLE(usrp_burn_db_eeprom usrp_burn_db_eeprom.cpp) TARGET_LINK_LIBRARIES(usrp_burn_db_eeprom uhd) +ADD_EXECUTABLE(usrp_burn_mb_eeprom usrp_burn_mb_eeprom.cpp) +TARGET_LINK_LIBRARIES(usrp_burn_mb_eeprom uhd) + ADD_EXECUTABLE(usrp1_init_eeprom usrp1_init_eeprom.cpp) TARGET_LINK_LIBRARIES(usrp1_init_eeprom uhd) -ADD_EXECUTABLE(usrp1_serial_burner usrp1_serial_burner.cpp) -TARGET_LINK_LIBRARIES(usrp1_serial_burner uhd) - INSTALL(TARGETS - usrp2_addr_burner usrp_burn_db_eeprom + usrp_burn_mb_eeprom usrp1_init_eeprom - usrp1_serial_burner RUNTIME DESTINATION ${PKG_DATA_DIR}/utils ) diff --git a/host/utils/uhd_usrp_probe.cpp b/host/utils/uhd_usrp_probe.cpp index 8947034d7..8cea52fa6 100644 --- a/host/utils/uhd_usrp_probe.cpp +++ b/host/utils/uhd_usrp_probe.cpp @@ -26,6 +26,7 @@ #include <uhd/usrp/dsp_props.hpp> #include <uhd/usrp/subdev_props.hpp> #include <uhd/usrp/dboard_id.hpp> +#include <uhd/usrp/mboard_eeprom.hpp> #include <boost/program_options.hpp> #include <boost/format.hpp> #include <boost/foreach.hpp> @@ -123,10 +124,9 @@ static std::string get_mboard_pp_string(wax::obj mboard){ std::stringstream ss; ss << boost::format("Mboard: %s") % mboard[usrp::MBOARD_PROP_NAME].as<std::string>() << std::endl; //ss << std::endl; - BOOST_FOREACH(const std::string &other_name, mboard[usrp::MBOARD_PROP_OTHERS].as<prop_names_t>()){ - try{ - ss << boost::format("%s: %s") % other_name % mboard[other_name].as<std::string>() << std::endl; - } catch(...){} + usrp::mboard_eeprom_t mb_eeprom = mboard[usrp::MBOARD_PROP_EEPROM_MAP].as<usrp::mboard_eeprom_t>(); + BOOST_FOREACH(const std::string &key, mb_eeprom.keys()){ + if (not mb_eeprom[key].empty()) ss << boost::format("%s: %s") % key % mb_eeprom[key] << std::endl; } BOOST_FOREACH(const std::string &dsp_name, mboard[usrp::MBOARD_PROP_RX_DSP_NAMES].as<prop_names_t>()){ ss << make_border(get_dsp_pp_string("RX", mboard[named_prop_t(usrp::MBOARD_PROP_RX_DSP, dsp_name)])); diff --git a/host/utils/usrp1_serial_burner.cpp b/host/utils/usrp1_serial_burner.cpp deleted file mode 100644 index bf7d3d3bb..000000000 --- a/host/utils/usrp1_serial_burner.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// -// Copyright 2010 Ettus Research LLC -// -// 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 <http://www.gnu.org/licenses/>. -// - -#include <uhd/utils/safe_main.hpp> -#include <uhd/device.hpp> -#include <uhd/usrp/device_props.hpp> -#include <boost/program_options.hpp> -#include <boost/format.hpp> -#include <iostream> - -namespace po = boost::program_options; - -int UHD_SAFE_MAIN(int argc, char *argv[]){ - po::options_description desc("Allowed options"); - desc.add_options() - ("help", "help message") - ("old", po::value<std::string>(), "old USRP serial number (optional)") - ("new", po::value<std::string>(), "new USRP serial number") - ; - - po::variables_map vm; - po::store(po::parse_command_line(argc, argv, desc), vm); - po::notify(vm); - - //print the help message - if (vm.count("help")){ - std::cout << boost::format("USRP serial burner %s") % desc << std::endl; - return ~0; - } - - if(vm.count("new") == 0) { - std::cout << "error: must input --new arg" << std::endl; - return ~0; - } - - //load the options into the address - uhd::device_addr_t device_addr; - device_addr["type"] = "usrp1"; - if(vm.count("old")) device_addr["serial"] = vm["old"].as<std::string>(); - - //find and create a control transport to do the writing. - - uhd::device_addrs_t found_addrs = uhd::device::find(device_addr); - - if (found_addrs.size() == 0){ - std::cerr << "No USRP devices found" << std::endl; - return ~0; - } - - for (size_t i = 0; i < found_addrs.size(); i++){ - uhd::device::sptr dev = uhd::device::make(found_addrs[i]); - wax::obj mb = (*dev)[uhd::usrp::DEVICE_PROP_MBOARD]; - std::cout << "Writing serial number..." << std::endl; - mb[std::string("serial")] = vm["new"].as<std::string>(); - std::cout << "Reading back serial number: " << mb[std::string("serial")].as<std::string>() << std::endl; - } - - - std::cout << "Power-cycle the usrp for the changes to take effect." << std::endl; - return 0; -} diff --git a/host/utils/usrp2_addr_burner.cpp b/host/utils/usrp2_addr_burner.cpp deleted file mode 100644 index f0e3434b7..000000000 --- a/host/utils/usrp2_addr_burner.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// -// Copyright 2010 Ettus Research LLC -// -// 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 <http://www.gnu.org/licenses/>. -// - -#include <uhd/utils/safe_main.hpp> -#include <uhd/device.hpp> -#include <uhd/usrp/device_props.hpp> -#include <boost/program_options.hpp> -#include <boost/format.hpp> -#include <iostream> - -namespace po = boost::program_options; - -int UHD_SAFE_MAIN(int argc, char *argv[]){ - po::options_description desc("Allowed options"); - desc.add_options() - ("help", "help message") - ("addr", po::value<std::string>(), "resolvable network address") - ("new-ip", po::value<std::string>(), "new ip address (optional)") - ("new-mac", po::value<std::string>(), "new mac address (optional)") - ; - - po::variables_map vm; - po::store(po::parse_command_line(argc, argv, desc), vm); - po::notify(vm); - - //print the help message - if (vm.count("help")){ - std::cout << boost::format("USRP2 Address Burner %s") % desc << std::endl; - return ~0; - } - - //load the options into the address - uhd::device_addr_t device_addr; - device_addr["type"] = "usrp2"; - if (vm.count("addr")){ - device_addr["addr"] = vm["addr"].as<std::string>(); - } - else{ - std::cerr << "Error: missing addr option" << std::endl; - return ~0; - } - - //create a usrp2 device - uhd::device::sptr u2_dev = uhd::device::make(device_addr); - //FIXME usees the default mboard for now (until the mimo link is supported) - wax::obj u2_mb = (*u2_dev)[uhd::usrp::DEVICE_PROP_MBOARD]; - std::cout << std::endl; - - //fetch and print current settings - std::cout << "Fetching current settings from usrp2 eeprom:" << std::endl; - std::string curr_ip = u2_mb[std::string("ip-addr")].as<std::string>(); - std::cout << boost::format(" Current IP Address: %s") % curr_ip << std::endl; - std::string curr_mac = u2_mb[std::string("mac-addr")].as<std::string>(); - std::cout << boost::format(" Current MAC Address: %s") % curr_mac << std::endl; - std::cout << " Done" << std::endl << std::endl; - - //try to set the new ip (if provided) - if (vm.count("new-ip")){ - std::cout << "Burning a new ip address into the usrp2 eeprom:" << std::endl; - std::string new_ip = vm["new-ip"].as<std::string>(); - std::cout << boost::format(" New IP Address: %s") % new_ip << std::endl; - u2_mb[std::string("ip-addr")] = new_ip; - std::cout << " Done" << std::endl << std::endl; - } - - //try to set the new mac (if provided) - if (vm.count("new-mac")){ - std::cout << "Burning a new mac address into the usrp2 eeprom:" << std::endl; - std::string new_mac = vm["new-mac"].as<std::string>(); - std::cout << boost::format(" New MAC Address: %s") % new_mac << std::endl; - u2_mb[std::string("mac-addr")] = new_mac; - std::cout << " Done" << std::endl << std::endl; - } - - std::cout << "Power-cycle the usrp2 for the changes to take effect." << std::endl; - return 0; -} diff --git a/host/utils/usrp_burn_db_eeprom.cpp b/host/utils/usrp_burn_db_eeprom.cpp index 64ecf75d6..9afd71a22 100644 --- a/host/utils/usrp_burn_db_eeprom.cpp +++ b/host/utils/usrp_burn_db_eeprom.cpp @@ -58,10 +58,10 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //print the help message if (vm.count("help")){ - std::cout << boost::format("USRP Burn DB EEPROM %s") % desc << std::endl; + std::cout << boost::format("USRP Burn Daughterboard EEPROM %s") % desc << std::endl; std::cout << boost::format( - "Omit the id argument to perform readback,\n" - "Or specify a new id to burn into the eeprom.\n" + "Omit the ID argument to perform readback,\n" + "Or specify a new ID to burn into the EEPROM.\n" ) << std::endl; return ~0; } diff --git a/host/utils/usrp_burn_mb_eeprom.cpp b/host/utils/usrp_burn_mb_eeprom.cpp new file mode 100644 index 000000000..20e1b58b1 --- /dev/null +++ b/host/utils/usrp_burn_mb_eeprom.cpp @@ -0,0 +1,81 @@ +// +// Copyright 2010 Ettus Research LLC +// +// 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 <http://www.gnu.org/licenses/>. +// + +#include <uhd/utils/safe_main.hpp> +#include <uhd/device.hpp> +#include <uhd/usrp/device_props.hpp> +#include <uhd/usrp/mboard_props.hpp> +#include <uhd/usrp/mboard_eeprom.hpp> +#include <boost/program_options.hpp> +#include <boost/format.hpp> +#include <iostream> + +namespace po = boost::program_options; + +int UHD_SAFE_MAIN(int argc, char *argv[]){ + std::string args, key, val; + + po::options_description desc("Allowed options"); + desc.add_options() + ("help", "help message") + ("args", po::value<std::string>(&args)->default_value(""), "device address args [default = \"\"]") + ("key", po::value<std::string>(&key), "the indentifier for a value in EEPROM") + ("val", po::value<std::string>(&val), "the new value to set, omit for readback") + ; + + po::variables_map vm; + po::store(po::parse_command_line(argc, argv, desc), vm); + po::notify(vm); + + //print the help message + if (vm.count("help") or not vm.count("key")){ + std::cout << boost::format("USRP Burn Motherboard EEPROM %s") % desc << std::endl; + std::cout << boost::format( + "Omit the value argument to perform a readback,\n" + "Or specify a new value to burn into the EEPROM.\n" + ) << std::endl; + return ~0; + } + + std::cout << "Creating USRP device from address: " + args << std::endl; + uhd::device::sptr dev = uhd::device::make(args); + //FIXME the default mboard for now (may be others) + wax::obj mboard = (*dev)[uhd::usrp::DEVICE_PROP_MBOARD]; + std::cout << std::endl; + + if (true /*always readback*/){ + std::cout << "Fetching current settings from EEPROM..." << std::endl; + uhd::usrp::mboard_eeprom_t mb_eeprom = \ + mboard[uhd::usrp::MBOARD_PROP_EEPROM_MAP].as<uhd::usrp::mboard_eeprom_t>(); + if (not mb_eeprom.has_key(key)){ + std::cerr << boost::format("Cannot find value for EEPROM[%s]") % key << std::endl; + return ~0; + } + std::cout << boost::format(" EEPROM [\"%s\"] is \"%s\"") % key % mb_eeprom[key] << std::endl; + std::cout << std::endl; + } + if (vm.count("val")){ + uhd::usrp::mboard_eeprom_t mb_eeprom; mb_eeprom[key] = val; + std::cout << boost::format("Setting EEPROM [\"%s\"] to \"%s\"...") % key % val << std::endl; + mboard[uhd::usrp::MBOARD_PROP_EEPROM_MAP] = mb_eeprom; + std::cout << "Power-cycle the USRP device for the changes to take effect." << std::endl; + std::cout << std::endl; + } + + std::cout << "Done" << std::endl; + return 0; +} diff --git a/images/Makefile b/images/Makefile index 57277e787..cfd7ff591 100644 --- a/images/Makefile +++ b/images/Makefile @@ -55,11 +55,11 @@ _usrp1_fw_ihx = $(BUILT_IMAGES_DIR)/usrp1_fw.ihx IMAGES_LIST += $(_usrp1_fw_ihx) $(_usrp1_fw_ihx): - cd $(_usrp1_fw_dir) && ./bootstrap - cd $(_usrp1_fw_dir) && ./configure - make -C $(_usrp1_fw_dir) clean - make -C $(_usrp1_fw_dir) all - cp $(_usrp1_fw_dir)/src/usrp1/std.ihx $@ + cd $(_usrp1_fw_dir) && rm -rf build + cd $(_usrp1_fw_dir) && mkdir build + cd $(_usrp1_fw_dir)/build && cmake ../ + cd $(_usrp1_fw_dir)/build && make + cp $(_usrp1_fw_dir)/build/usrp1/usrp1_fw.ihx $@ endif @@ -119,6 +119,7 @@ $(BUILT_IMAGES_DIR): mkdir $@ images: $(BUILT_IMAGES_DIR) $(IMAGES_LIST) + chmod -x $(BUILT_IMAGES_DIR)/* clean: $(RM) -rf $(BUILT_IMAGES_DIR) |