From ce7d8a7ab2a13dd8a2ea6412e5e022073be82369 Mon Sep 17 00:00:00 2001 From: Nuand Date: Mon, 18 Feb 2013 17:02:29 -0800 Subject: [PATCH] FSK bridge example This should include everything needed to build the FSK bridge example from scratch. 1) Open existing hdl/quartus/bladerf.qsf project in Quartus a) Generate the Nios core i) Tools -> QSys -> File -> Open -> navigate to ./hdl/fpga/ip/altera/nios_system/nios_system.qsys ii) After opening qsys file, go to Generation tab, click the "Generate" button b) Compile the embedded Nios image i) Tools -> Nios II Software Build Tools for Eclipse I) File -> Import -> General -> Existing Projects into Workspace -> Next -> Browse to checkout root directory -> check both lms_spi_controller and lms_spi_controller_bsp -> Finish II) right click lms_spi_controller_bsp -> NIOS II -> Generate BSP III) right click lms_spi_controller -> Build IV) right click lms_spi_controller -> Make Targets -> Build... -> select mem_init_generate -> Build c) Synthesize FPGA image i) Processing -> Start Compilation 2) Compile driver and user mode applications a) cd linux/kernel ; make ; inmod bladeRF.ko b) cd ../apps; make c) To program the fpga execute ./simple_load c4images/blink.rbf i) Load bladerf.rbf from the quartus output_files directory 3) Use bladeRF's UART as an FSK bridge! NB. The firmware upgrade utility does work, only use it on valid .img files. --- COPYING | 339 +++ README | 25 + common/bladeRF.h | 49 + fx3_firmware/.cproject | 2564 +++++++++++++++++ fx3_firmware/.project | 81 + fx3_firmware/C4loader.cydsn/C4loader.cyfx | 33 + .../projectfiles/gpif2model.xml | 127 + .../projectfiles/gpif2timingsimulation.xml | 16 + .../C4loader.cydsn/projectfiles/gpif2view.xml | 161 ++ fx3_firmware/Debug/makefile | 75 + fx3_firmware/Debug/objects.mk | 7 + fx3_firmware/Debug/sources.mk | 22 + fx3_firmware/Debug/subdir.mk | 47 + fx3_firmware/RFlink.cydsn/RFlink.cyfx | 30 + .../RFlink.cydsn/projectfiles/gpif2model.xml | 203 ++ .../projectfiles/gpif2timingsimulation.xml | 37 + .../RFlink.cydsn/projectfiles/gpif2view.xml | 260 ++ fx3_firmware/bladeRF.c | 1104 +++++++ fx3_firmware/bladeRF.h | 71 + fx3_firmware/cyfxbladeRF.h | 49 + fx3_firmware/cyfxbladeRFusbdscr.c | 417 +++ fx3_firmware/cyfxgpif_C4loader.h | 168 ++ fx3_firmware/cyfxgpif_RFlink.h | 171 ++ fx3_firmware/makefile | 34 + fx3_firmware/spi_flash_lib.c | 223 ++ .../ip/altera/nios_system/nios_system.qsys | 528 ++++ .../software/lms_spi_controller/.cproject | 508 ++++ .../software/lms_spi_controller/.project | 96 + .../software/lms_spi_controller/Makefile | 1086 +++++++ .../lms_spi_controller/hello_world_small.c | 1404 +++++++++ .../software/lms_spi_controller_bsp/.cproject | 481 ++++ .../software/lms_spi_controller_bsp/.project | 85 + .../software/lms_spi_controller_bsp/Makefile | 781 +++++ .../lms_spi_controller_bsp/create-this-bsp | 49 + .../lms_spi_controller_bsp/mem_init.mk | 322 +++ .../software/lms_spi_controller_bsp/public.mk | 390 +++ .../lms_spi_controller_bsp/settings.bsp | 937 ++++++ .../ip/altera/pll/greybox_tmp/cbx_args.txt | 66 + hdl/fpga/ip/altera/pll/pll.cmp | 26 + hdl/fpga/ip/altera/pll/pll.ppf | 13 + hdl/fpga/ip/altera/pll/pll.qip | 5 + hdl/fpga/ip/altera/pll/pll.vhd | 429 +++ .../serial_pll/greybox_tmp/cbx_args.txt | 61 + hdl/fpga/ip/altera/serial_pll/serial_pll.ppf | 11 + hdl/fpga/ip/altera/serial_pll/serial_pll.qip | 4 + hdl/fpga/ip/altera/serial_pll/serial_pll.vhd | 365 +++ hdl/fpga/ip/nuand/nuand.do | 17 + hdl/fpga/ip/nuand/simulation/fx3_model.vhd | 105 + .../ip/nuand/simulation/lms6002d_model.vhd | 57 + hdl/fpga/ip/nuand/synthesis/async_fifo.vhd | 39 + .../nuand/synthesis/constellation_mapper.vhd | 289 ++ hdl/fpga/ip/nuand/synthesis/cordic.vhd | 145 + .../ip/nuand/synthesis/fsk_demodulator.vhd | 81 + hdl/fpga/ip/nuand/synthesis/fsk_modulator.vhd | 83 + hdl/fpga/ip/nuand/synthesis/nco.vhd | 79 + hdl/fpga/ip/nuand/synthesis/sync_fifo.vhd | 86 + hdl/fpga/ip/nuand/synthesis/tb/cordic_tb.vhd | 84 + hdl/fpga/ip/nuand/synthesis/tb/fsk_tb.vhd | 83 + hdl/fpga/ip/nuand/synthesis/tb/nco_tb.vhd | 72 + hdl/fpga/ip/nuand/synthesis/tb/uart_tb.vhd | 123 + hdl/fpga/ip/nuand/synthesis/uart.vhd | 200 ++ hdl/fpga/ip/nuand/synthesis/uart_bridge.vhd | 114 + hdl/fpga/platforms/bladerf/bladerf.do | 15 + .../platforms/bladerf/constraints/bladerf.sdc | 31 + .../platforms/bladerf/constraints/pins.tcl | 259 ++ hdl/fpga/platforms/bladerf/vhdl/bladerf.vhd | 345 +++ .../bladerf/vhdl/bladerf_debug_p.vhd | 11 + hdl/fpga/platforms/bladerf/vhdl/fx3.vhd | 135 + hdl/fpga/platforms/bladerf/vhdl/ramp.vhd | 28 + .../platforms/bladerf/vhdl/spi_reader.vhd | 115 + .../platforms/bladerf/vhdl/tb/bladerf_tb.vhd | 208 ++ .../bladerf/vhdl/tb/spi_reader_tb.vhd | 32 + hdl/quartus/bladerf.qpf | 30 + hdl/quartus/bladerf.qsf | 501 ++++ hdl/quartus/constraints/bladerf.sdc | 11 + hdl/quartus/constraints/pins.tcl | 326 +++ hdl/quartus/signaltap/spi_debugging.stp | 328 +++ linux/apps/Makefile | 11 + linux/apps/c4images/blink.rbf | Bin 0 -> 510858 bytes linux/apps/simple_load.c | 110 + linux/apps/upgrade_firmware.c | 67 + linux/kernel/Makefile | 6 + linux/kernel/bladeRF.c | 598 ++++ linux/kernel/bladeRF.h | 48 + 84 files changed, 18832 insertions(+) create mode 100644 COPYING create mode 100644 README create mode 100644 common/bladeRF.h create mode 100644 fx3_firmware/.cproject create mode 100644 fx3_firmware/.project create mode 100644 fx3_firmware/C4loader.cydsn/C4loader.cyfx create mode 100644 fx3_firmware/C4loader.cydsn/projectfiles/gpif2model.xml create mode 100644 fx3_firmware/C4loader.cydsn/projectfiles/gpif2timingsimulation.xml create mode 100644 fx3_firmware/C4loader.cydsn/projectfiles/gpif2view.xml create mode 100644 fx3_firmware/Debug/makefile create mode 100644 fx3_firmware/Debug/objects.mk create mode 100644 fx3_firmware/Debug/sources.mk create mode 100644 fx3_firmware/Debug/subdir.mk create mode 100644 fx3_firmware/RFlink.cydsn/RFlink.cyfx create mode 100644 fx3_firmware/RFlink.cydsn/projectfiles/gpif2model.xml create mode 100644 fx3_firmware/RFlink.cydsn/projectfiles/gpif2timingsimulation.xml create mode 100644 fx3_firmware/RFlink.cydsn/projectfiles/gpif2view.xml create mode 100644 fx3_firmware/bladeRF.c create mode 100644 fx3_firmware/bladeRF.h create mode 100644 fx3_firmware/cyfxbladeRF.h create mode 100644 fx3_firmware/cyfxbladeRFusbdscr.c create mode 100644 fx3_firmware/cyfxgpif_C4loader.h create mode 100644 fx3_firmware/cyfxgpif_RFlink.h create mode 100644 fx3_firmware/makefile create mode 100644 fx3_firmware/spi_flash_lib.c create mode 100644 hdl/fpga/ip/altera/nios_system/nios_system.qsys create mode 100644 hdl/fpga/ip/altera/nios_system/software/lms_spi_controller/.cproject create mode 100644 hdl/fpga/ip/altera/nios_system/software/lms_spi_controller/.project create mode 100644 hdl/fpga/ip/altera/nios_system/software/lms_spi_controller/Makefile create mode 100644 hdl/fpga/ip/altera/nios_system/software/lms_spi_controller/hello_world_small.c create mode 100644 hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/.cproject create mode 100644 hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/.project create mode 100644 hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/Makefile create mode 100644 hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/create-this-bsp create mode 100644 hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/mem_init.mk create mode 100644 hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/public.mk create mode 100644 hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/settings.bsp create mode 100644 hdl/fpga/ip/altera/pll/greybox_tmp/cbx_args.txt create mode 100644 hdl/fpga/ip/altera/pll/pll.cmp create mode 100644 hdl/fpga/ip/altera/pll/pll.ppf create mode 100644 hdl/fpga/ip/altera/pll/pll.qip create mode 100644 hdl/fpga/ip/altera/pll/pll.vhd create mode 100644 hdl/fpga/ip/altera/serial_pll/greybox_tmp/cbx_args.txt create mode 100644 hdl/fpga/ip/altera/serial_pll/serial_pll.ppf create mode 100644 hdl/fpga/ip/altera/serial_pll/serial_pll.qip create mode 100644 hdl/fpga/ip/altera/serial_pll/serial_pll.vhd create mode 100644 hdl/fpga/ip/nuand/nuand.do create mode 100644 hdl/fpga/ip/nuand/simulation/fx3_model.vhd create mode 100644 hdl/fpga/ip/nuand/simulation/lms6002d_model.vhd create mode 100644 hdl/fpga/ip/nuand/synthesis/async_fifo.vhd create mode 100644 hdl/fpga/ip/nuand/synthesis/constellation_mapper.vhd create mode 100644 hdl/fpga/ip/nuand/synthesis/cordic.vhd create mode 100644 hdl/fpga/ip/nuand/synthesis/fsk_demodulator.vhd create mode 100644 hdl/fpga/ip/nuand/synthesis/fsk_modulator.vhd create mode 100644 hdl/fpga/ip/nuand/synthesis/nco.vhd create mode 100644 hdl/fpga/ip/nuand/synthesis/sync_fifo.vhd create mode 100644 hdl/fpga/ip/nuand/synthesis/tb/cordic_tb.vhd create mode 100644 hdl/fpga/ip/nuand/synthesis/tb/fsk_tb.vhd create mode 100644 hdl/fpga/ip/nuand/synthesis/tb/nco_tb.vhd create mode 100644 hdl/fpga/ip/nuand/synthesis/tb/uart_tb.vhd create mode 100644 hdl/fpga/ip/nuand/synthesis/uart.vhd create mode 100644 hdl/fpga/ip/nuand/synthesis/uart_bridge.vhd create mode 100644 hdl/fpga/platforms/bladerf/bladerf.do create mode 100644 hdl/fpga/platforms/bladerf/constraints/bladerf.sdc create mode 100644 hdl/fpga/platforms/bladerf/constraints/pins.tcl create mode 100644 hdl/fpga/platforms/bladerf/vhdl/bladerf.vhd create mode 100644 hdl/fpga/platforms/bladerf/vhdl/bladerf_debug_p.vhd create mode 100644 hdl/fpga/platforms/bladerf/vhdl/fx3.vhd create mode 100644 hdl/fpga/platforms/bladerf/vhdl/ramp.vhd create mode 100644 hdl/fpga/platforms/bladerf/vhdl/spi_reader.vhd create mode 100644 hdl/fpga/platforms/bladerf/vhdl/tb/bladerf_tb.vhd create mode 100644 hdl/fpga/platforms/bladerf/vhdl/tb/spi_reader_tb.vhd create mode 100644 hdl/quartus/bladerf.qpf create mode 100644 hdl/quartus/bladerf.qsf create mode 100644 hdl/quartus/constraints/bladerf.sdc create mode 100644 hdl/quartus/constraints/pins.tcl create mode 100644 hdl/quartus/signaltap/spi_debugging.stp create mode 100644 linux/apps/Makefile create mode 100644 linux/apps/c4images/blink.rbf create mode 100644 linux/apps/simple_load.c create mode 100644 linux/apps/upgrade_firmware.c create mode 100644 linux/kernel/Makefile create mode 100644 linux/kernel/bladeRF.c create mode 100644 linux/kernel/bladeRF.h diff --git a/COPYING b/COPYING new file mode 100644 index 00000000..d159169d --- /dev/null +++ b/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) 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 +this service 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 make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. 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. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +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 +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the 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 a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE 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. + + 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 +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision 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, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This 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. diff --git a/README b/README new file mode 100644 index 00000000..42ee3f63 --- /dev/null +++ b/README @@ -0,0 +1,25 @@ +This README details how to build the FSK bridge example + +To build and run the FSK bridge rea +1) Open existing hdl/quartus/bladerf.qsf project in Quartus + a) Generate the Nios core + i) Tools -> QSys -> File -> Open -> navigate to ./hdl/fpga/ip/altera/nios_system/nios_system.qsys + ii) After opening qsys file, go to Generation tab, click the "Generate" button + b) Compile the embedded Nios image + i) Tools -> Nios II Software Build Tools for Eclipse + I) File -> Import -> General -> Existing Projects into Workspace -> Next + -> Browse to checkout root directory -> check both lms_spi_controller and lms_spi_controller_bsp + -> Finish + II) right click lms_spi_controller_bsp -> NIOS II -> Generate BSP + III) right click lms_spi_controller -> Build + IV) right click lms_spi_controller -> Make Targets -> Build... -> select mem_init_generate -> Build + c) Synthesize FPGA image + i) Processing -> Start Compilation + +2) Compile driver and user mode applications + a) cd linux/kernel ; make ; inmod bladeRF.ko + b) cd ../apps; make + c) To program the fpga execute ./simple_load c4images/blink.rbf + i) Load bladerf.rbf from the quartus output_files directory + +3) Use bladeRF as an FSK bridge! diff --git a/common/bladeRF.h b/common/bladeRF.h new file mode 100644 index 00000000..f3beacec --- /dev/null +++ b/common/bladeRF.h @@ -0,0 +1,49 @@ + +#define BLADERF_IOCTL_BASE 'N' +#define BLADE_QUERY_VERSION _IOR(BLADERF_IOCTL_BASE, 0, struct bladeRF_version) +#define BLADE_QUERY_FPGA_STATUS _IOR(BLADERF_IOCTL_BASE, 1, unsigned int) +#define BLADE_BEGIN_PROG _IOR(BLADERF_IOCTL_BASE, 2, unsigned int) +#define BLADE_END_PROG _IOR(BLADERF_IOCTL_BASE, 3, unsigned int) +#define BLADE_CHECK_PROG _IOR(BLADERF_IOCTL_BASE, 4, unsigned int) +#define BLADE_RF_RX _IOR(BLADERF_IOCTL_BASE, 5, unsigned int) +#define BLADE_RF_TX _IOR(BLADERF_IOCTL_BASE, 6, unsigned int) + +#define BLADE_UPGRADE_FW _IOR(BLADERF_IOCTL_BASE, 50, unsigned int) + +#define BLADE_USB_CMD_QUERY_VERSION 0 +#define BLADE_USB_CMD_QUERY_FPGA_STATUS 1 +#define BLADE_USB_CMD_BEGIN_PROG 2 +#define BLADE_USB_CMD_END_PROG 3 +#define BLADE_USB_CMD_RF_RX 4 +#define BLADE_USB_CMD_RF_TX 5 +#define BLADE_USB_CMD_FLASH_READ 100 +#define BLADE_USB_CMD_FLASH_WRITE 101 +#define BLADE_USB_CMD_FLASH_ERASE 102 + +#define BLADE_USB_CMD_QUERY_VERSION 0 +#define BLADE_USB_CMD_QUERY_FPGA_STATUS 1 +#define BLADE_USB_CMD_BEGIN_PROG 2 +#define BLADE_USB_CMD_END_PROG 3 +#define BLADE_USB_CMD_RF_RX 4 + +struct bladeRF_version { + unsigned short major; + unsigned short minor; +}; + +struct bladeRF_firmware { + unsigned int len; + unsigned char *ptr; +}; + +#define BLADE_USB_TYPE_OUT 0x40 +#define BLADE_USB_TYPE_IN 0xC0 +#define BLADE_USB_TIMEOUT_MS 1000 + +#define USB_NUAND_VENDOR_ID 0x04b4 +#define USB_NUAND_BLADERF_PRODUCT_ID 0x00f1 +#define NUM_CONCURRENT 8 +#define NUM_DATA_URB (128) +#define DATA_BUF_SZ (1024*4) + + diff --git a/fx3_firmware/.cproject b/fx3_firmware/.cproject new file mode 100644 index 00000000..fce47d9e --- /dev/null +++ b/fx3_firmware/.cproject @@ -0,0 +1,2564 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fx3_firmware/.project b/fx3_firmware/.project new file mode 100644 index 00000000..7f5311e5 --- /dev/null +++ b/fx3_firmware/.project @@ -0,0 +1,81 @@ + + + bladeRF + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + all + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + cs-make + + + org.eclipse.cdt.make.core.buildLocation + ${workspace_loc:/BulkLoopAuto/Debug} + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + all + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/fx3_firmware/C4loader.cydsn/C4loader.cyfx b/fx3_firmware/C4loader.cydsn/C4loader.cyfx new file mode 100644 index 00000000..1d3d98ce --- /dev/null +++ b/fx3_firmware/C4loader.cydsn/C4loader.cyfx @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/fx3_firmware/C4loader.cydsn/projectfiles/gpif2model.xml b/fx3_firmware/C4loader.cydsn/projectfiles/gpif2model.xml new file mode 100644 index 00000000..23b4a3eb --- /dev/null +++ b/fx3_firmware/C4loader.cydsn/projectfiles/gpif2model.xml @@ -0,0 +1,127 @@ + + + + + False + False + False + False + False + Master + Synchronous + Internal + Positive + LittleEndian + Bit16 + 0 + + + + + OUTPUT0 + GPIO_26 + Low + ActiveHigh + Beta + Toggle + + + + + + + + + + + + + START + True + 0 + + + STATE0 + True + 0 + + False + Socket + Thread3 + Enable + DriveNewData + True + + + + INIT + True + 0 + + + STATE2 + True + 0 + + False + Socket + Thread3 + Enable + DrivePreviousSetData + True + + + + STATE5 + True + 0 + + False + Socket + Thread3 + Enable + DrivePreviousSetData + True + + + OUTPUT0 + + + + STATE1 + True + 0 + + False + Socket + Thread3 + Enable + DrivePreviousSetData + True + + + OUTPUT0 + + + + STATE4 + True + 0 + + False + Socket + Thread3 + Enable + DrivePreviousSetData + True + + + + + + + + + + + \ No newline at end of file diff --git a/fx3_firmware/C4loader.cydsn/projectfiles/gpif2timingsimulation.xml b/fx3_firmware/C4loader.cydsn/projectfiles/gpif2timingsimulation.xml new file mode 100644 index 00000000..16b9b209 --- /dev/null +++ b/fx3_firmware/C4loader.cydsn/projectfiles/gpif2timingsimulation.xml @@ -0,0 +1,16 @@ + + + 100 + 512 + 0 + + + + + + + + + + + \ No newline at end of file diff --git a/fx3_firmware/C4loader.cydsn/projectfiles/gpif2view.xml b/fx3_firmware/C4loader.cydsn/projectfiles/gpif2view.xml new file mode 100644 index 00000000..3fd588b3 --- /dev/null +++ b/fx3_firmware/C4loader.cydsn/projectfiles/gpif2view.xml @@ -0,0 +1,161 @@ + + + + + 515 + 214.446666666667 + 83 + 70 + STATE0 + STATE0 + 1 + False + 00000000-0000-0000-0000-000000000000 + + + 225 + 137.41 + 83 + 70 + STATE1 + INIT + 1 + False + 00000000-0000-0000-0000-000000000000 + + + 679 + 96.41 + 83 + 70 + STATE3 + STATE1 + 1 + False + 00000000-0000-0000-0000-000000000000 + + + 885 + 36.41 + 83 + 70 + STATE4 + STATE2 + 1 + False + 00000000-0000-0000-0000-000000000000 + + + 1104 + 100.41 + 83 + 70 + STATE5 + STATE3 + 1 + False + 00000000-0000-0000-0000-000000000000 + + + 1265 + 233.41 + 83 + 70 + STATE6 + STATE4 + 1 + False + 00000000-0000-0000-0000-000000000000 + + + 29 + 18.4466666666667 + 83 + 70 + STARTSTATE0 + START + 1 + False + 00000000-0000-0000-0000-000000000000 + + + + + TRANSITION9 + DMA_RDY_TH3 + STATE6 + STATE0 + Connector + Connector + None + Arrow + 0 + + + TRANSITION8 + LOGIC_ONE + STATE5 + STATE6 + Connector + Connector + None + Arrow + 0 + + + TRANSITION7 + LOGIC_ONE + STATE4 + STATE5 + Connector + Connector + None + Arrow + 0 + + + TRANSITION6 + LOGIC_ONE + STATE3 + STATE4 + Connector + Connector + None + Arrow + 0 + + + TRANSITION5 + LOGIC_ONE + STATE0 + STATE3 + Connector + Connector + None + Arrow + 0 + + + TRANSITION1 + LOGIC_ONE + STARTSTATE0 + STATE1 + Connector + Connector + None + Arrow + 0 + + + TRANSITION0 + DMA_RDY_TH3 + STATE1 + STATE0 + Connector + Connector + None + Arrow + 0 + + + \ No newline at end of file diff --git a/fx3_firmware/Debug/makefile b/fx3_firmware/Debug/makefile new file mode 100644 index 00000000..9d7651d2 --- /dev/null +++ b/fx3_firmware/Debug/makefile @@ -0,0 +1,75 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +-include ../makefile.init + +RM := cs-rm -rf + +# All of the sources participating in the build are defined here +-include sources.mk +-include subdir.mk +-include objects.mk + +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(strip $(C_DEPS)),) +-include $(C_DEPS) +endif +ifneq ($(strip $(ASM_DEPS)),) +-include $(ASM_DEPS) +endif +ifneq ($(strip $(S_UPPER_DEPS)),) +-include $(S_UPPER_DEPS) +endif +endif + +-include ../makefile.defs + +# Add inputs and outputs from these tool invocations to the build variables +SECONDARY_LIST += \ +bladeRF.lst \ + +SECONDARY_SIZE += \ +bladeRF.siz \ + + +# All Target +all: bladeRF.elf secondary-outputs + +# Tool invocations +bladeRF.elf: $(OBJS) $(USER_OBJS) + @echo 'Building target: $@' + @echo 'Invoking: ARM Sourcery Windows GCC C Linker' + arm-none-eabi-gcc $(OBJS) $(USER_OBJS) $(LIBS) -T"C:\Cypress\EZ-USB FX3 SDK\1.2\/firmware/common/fx3.ld" -nostartfiles -Wl,-Map,bladeRF.map -Wl,-d -Wl,--no-wchar-size-warning -Wl,--entry,CyU3PFirmwareEntry "C:\Cypress\EZ-USB FX3 SDK\1.2\\firmware\u3p_firmware\lib\fx3_debug\cyfxapi.a" "C:\Cypress\EZ-USB FX3 SDK\1.2\\firmware\u3p_firmware\lib\fx3_debug\cyu3lpp.a" "C:\Cypress\EZ-USB FX3 SDK\1.2\\firmware\u3p_firmware\lib\fx3_debug\cyu3threadx.a" "C:\Cypress\EZ-USB FX3 SDK\1.2\\arm-none-eabi\lib\libc.a" "C:\Cypress\EZ-USB FX3 SDK\1.2\\lib\gcc\arm-none-eabi\4.5.2\libgcc.a" -mcpu=arm926ej-s -mthumb-interwork -g -gdwarf-2 -o"bladeRF.elf" + @echo 'Finished building target: $@' + @echo ' ' + $(MAKE) --no-print-directory post-build + +bladeRF.lst: bladeRF.elf + @echo 'Invoking: ARM Sourcery Windows GNU Create Listing' + arm-none-eabi-objdump -h -S bladeRF.elf >"bladeRF.lst" + @echo 'Finished building: $@' + @echo ' ' + +bladeRF.siz: bladeRF.elf + @echo 'Invoking: ARM Sourcery Windows GNU Print Size' + arm-none-eabi-size --format=berkeley bladeRF.elf + @echo 'Finished building: $@' + @echo ' ' + +# Other Targets +clean: + -$(RM) $(SECONDARY_SIZE)$(OBJS)$(C_DEPS)$(ASM_DEPS)$(EXECUTABLES)$(SECONDARY_LIST)$(S_UPPER_DEPS) bladeRF.elf + -@echo ' ' + +post-build: + -@echo 'Converting ELF to image (.img) format' + -"C:\Cypress\EZ-USB FX3 SDK\1.2\\util\elf2img\elf2img.exe" -i bladeRF.elf -o bladeRF.img + -@echo ' ' + +secondary-outputs: $(SECONDARY_LIST) $(SECONDARY_SIZE) + +.PHONY: all clean dependents +.SECONDARY: post-build + +-include ../makefile.targets diff --git a/fx3_firmware/Debug/objects.mk b/fx3_firmware/Debug/objects.mk new file mode 100644 index 00000000..dc028f6e --- /dev/null +++ b/fx3_firmware/Debug/objects.mk @@ -0,0 +1,7 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +USER_OBJS := + +LIBS := diff --git a/fx3_firmware/Debug/sources.mk b/fx3_firmware/Debug/sources.mk new file mode 100644 index 00000000..d92627d5 --- /dev/null +++ b/fx3_firmware/Debug/sources.mk @@ -0,0 +1,22 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +ELF_SRCS := +O_SRCS := +C_SRCS := +S_UPPER_SRCS := +OBJ_SRCS := +ASM_SRCS := +SECONDARY_SIZE := +OBJS := +C_DEPS := +ASM_DEPS := +EXECUTABLES := +SECONDARY_LIST := +S_UPPER_DEPS := + +# Every subdirectory with source files must be described here +SUBDIRS := \ +. \ + diff --git a/fx3_firmware/Debug/subdir.mk b/fx3_firmware/Debug/subdir.mk new file mode 100644 index 00000000..62c96ca2 --- /dev/null +++ b/fx3_firmware/Debug/subdir.mk @@ -0,0 +1,47 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../bladeRF.c \ +../cyfxbladeRFusbdscr.c \ +../cyfxtx.c \ +../spi_flash_lib.c + +S_UPPER_SRCS += \ +../cyfx_gcc_startup.S + +OBJS += \ +./bladeRF.o \ +./cyfx_gcc_startup.o \ +./cyfxbladeRFusbdscr.o \ +./cyfxtx.o \ +./spi_flash_lib.o + +C_DEPS += \ +./bladeRF.d \ +./cyfxbladeRFusbdscr.d \ +./cyfxtx.d \ +./spi_flash_lib.d + +S_UPPER_DEPS += \ +./cyfx_gcc_startup.d + + +# Each subdirectory must supply rules for building sources it contributes +%.o: ../%.c + @echo 'Building file: $<' + @echo 'Invoking: ARM Sourcery Windows GCC C Compiler' + arm-none-eabi-gcc -D__CYU3P_TX__=1 -I"C:\Cypress\EZ-USB FX3 SDK\1.2\\firmware\u3p_firmware\inc" -O0 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -mcpu=arm926ej-s -mthumb-interwork -g -gdwarf-2 -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + +%.o: ../%.S + @echo 'Building file: $<' + @echo 'Invoking: ARM Sourcery Windows GCC Assembler' + arm-none-eabi-gcc -x assembler-with-cpp -I"C:\Cypress\EZ-USB FX3 SDK\1.2\\firmware\u3p_firmware\inc" -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -mcpu=arm926ej-s -mthumb-interwork -g -gdwarf-2 -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/fx3_firmware/RFlink.cydsn/RFlink.cyfx b/fx3_firmware/RFlink.cydsn/RFlink.cyfx new file mode 100644 index 00000000..c8c66efc --- /dev/null +++ b/fx3_firmware/RFlink.cydsn/RFlink.cyfx @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/fx3_firmware/RFlink.cydsn/projectfiles/gpif2model.xml b/fx3_firmware/RFlink.cydsn/projectfiles/gpif2model.xml new file mode 100644 index 00000000..6573bcd8 --- /dev/null +++ b/fx3_firmware/RFlink.cydsn/projectfiles/gpif2model.xml @@ -0,0 +1,203 @@ + + + + + False + False + False + False + False + Master + Synchronous + Internal + Positive + LittleEndian + Bit32 + 0 + + + + + RX_0 + GPIO_17 + ActiveHigh + + + RX_1 + GPIO_18 + ActiveHigh + + + TX_2 + GPIO_19 + ActiveHigh + + + TX_3 + GPIO_20 + ActiveHigh + + + DMA_RX + GPIO_21 + Low + ActiveHigh + Alpha + Assert + + + FLAG0 + GPIO_22 + Low + ActiveHigh + Thread_0_DMA_Ready + + + FLAG1 + GPIO_23 + Low + ActiveHigh + Thread_1_DMA_Ready + + + FLAG2 + GPIO_24 + Low + ActiveHigh + Thread_2_DMA_Ready + + + FLAG3 + GPIO_25 + Low + ActiveHigh + Thread_3_DMA_Ready + + + DMA_TX + GPIO_26 + Low + ActiveHigh + Alpha + Assert + + + DMA_DONE + GPIO_27 + Low + ActiveHigh + Alpha + Assert + + + + + + + + + + + + + START + True + 0 + + + INIT + True + 0 + + + IF_RX_0 + True + 0 + + Socket + Thread0 + True + True + + + + IF_RX_1 + True + 0 + + Socket + Thread1 + True + True + + + + IF_TX_2 + True + 0 + + False + Socket + Thread2 + Enable + DriveNewData + True + + + + DONE + True + 0 + + DMA_DONE + + + + WAIT_0 + True + 0 + + + IF_TX_3 + True + 0 + + False + Socket + Thread3 + Enable + DriveNewData + True + + + + IF_TX + True + 0 + + DMA_TX + + + + IF_RX + True + 0 + + DMA_RX + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/fx3_firmware/RFlink.cydsn/projectfiles/gpif2timingsimulation.xml b/fx3_firmware/RFlink.cydsn/projectfiles/gpif2timingsimulation.xml new file mode 100644 index 00000000..e2a397c4 --- /dev/null +++ b/fx3_firmware/RFlink.cydsn/projectfiles/gpif2timingsimulation.xml @@ -0,0 +1,37 @@ + + + 100 + 16 + 12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/fx3_firmware/RFlink.cydsn/projectfiles/gpif2view.xml b/fx3_firmware/RFlink.cydsn/projectfiles/gpif2view.xml new file mode 100644 index 00000000..a4e92df4 --- /dev/null +++ b/fx3_firmware/RFlink.cydsn/projectfiles/gpif2view.xml @@ -0,0 +1,260 @@ + + + + + 224 + 274.446666666667 + 83 + 70 + STATE0 + INIT + 1 + False + 00000000-0000-0000-0000-000000000000 + + + 771 + 129.41 + 83 + 70 + STATE1 + IF_RX_0 + 1 + False + 00000000-0000-0000-0000-000000000000 + + + 770 + 237.41 + 83 + 70 + STATE2 + IF_RX_1 + 1 + False + 00000000-0000-0000-0000-000000000000 + + + 1024 + 262.41 + 83 + 70 + STATE5 + DONE + 1 + False + 00000000-0000-0000-0000-000000000000 + + + 491 + 271.41 + 83 + 70 + STATE6 + WAIT_0 + 1 + False + 00000000-0000-0000-0000-000000000000 + + + 771 + 357.41 + 83 + 70 + STATE10 + IF_TX_2 + 1 + False + 00000000-0000-0000-0000-000000000000 + + + 635 + 166.41 + 83 + 70 + STATE11 + IF_RX + 1 + False + 00000000-0000-0000-0000-000000000000 + + + 772 + 470.41 + 83 + 70 + STATE12 + IF_TX_3 + 1 + False + 00000000-0000-0000-0000-000000000000 + + + 631 + 418.41 + 83 + 70 + STATE13 + IF_TX + 1 + False + 00000000-0000-0000-0000-000000000000 + + + 29 + 18.4466666666667 + 83 + 70 + STARTSTATE0 + START + 1 + False + 00000000-0000-0000-0000-000000000000 + + + + + TRANSITION26 + LOGIC_ONE + STATE5 + STATE6 + Connector + Connector + None + Arrow + 0 + + + TRANSITION25 + !DMA_RDY_TH3 + STATE12 + STATE5 + Connector + Connector + None + Arrow + 0 + + + TRANSITION24 + TX_3 + STATE13 + STATE12 + Connector + Connector + None + Arrow + 0 + + + TRANSITION23 + TX_2 + STATE13 + STATE10 + Connector + Connector + None + Arrow + 0 + + + TRANSITION22 + TX_2|TX_3 + STATE6 + STATE13 + Connector + Connector + None + Arrow + 0 + + + TRANSITION21 + RX_0|RX_1 + STATE6 + STATE11 + Connector + Connector + None + Arrow + 0 + + + TRANSITION20 + RX_1 + STATE11 + STATE2 + Connector + Connector + None + Arrow + 0 + + + TRANSITION19 + RX_0 + STATE11 + STATE1 + Connector + Connector + None + Arrow + 0 + + + TRANSITION17 + !DMA_RDY_TH2 + STATE10 + STATE5 + Connector + Connector + None + Arrow + 0 + + + TRANSITION12 + LOGIC_ONE + STATE0 + STATE6 + Connector + Connector + None + Arrow + 0 + + + TRANSITION2 + !DMA_RDY_TH1 + STATE2 + STATE5 + Connector + Connector + None + Arrow + 0 + + + TRANSITION1 + !DMA_RDY_TH0 + STATE1 + STATE5 + Connector + Connector + None + Arrow + 0 + + + TRANSITION0 + LOGIC_ONE + STARTSTATE0 + STATE0 + Connector + Connector + None + Arrow + 0 + + + \ No newline at end of file diff --git a/fx3_firmware/bladeRF.c b/fx3_firmware/bladeRF.c new file mode 100644 index 00000000..542fba75 --- /dev/null +++ b/fx3_firmware/bladeRF.c @@ -0,0 +1,1104 @@ +/* + * bladeRF FX3 firmware (bladeRF.c) + */ + +#include "cyu3system.h" +#include "cyu3os.h" +#include "cyu3dma.h" +#include "cyu3error.h" +#include "cyu3usb.h" +#include "cyu3uart.h" +#include "bladeRF.h" +#include "cyu3gpif.h" +#include "cyu3pib.h" +#include "cyu3gpio.h" +#include "pib_regs.h" + +/* This file should be included only once as it contains + * structure definitions. Including it in multiple places + * can result in linker error. */ +#include "cyfxgpif_C4loader.h" +#include "cyfxgpif_RFlink.h" + + +uint32_t glAppMode = MODE_NO_CONFIG; + +CyU3PThread bladeRFAppThread; + +CyU3PDmaChannel glChHandlebladeRFUtoP; /* DMA Channel for RF U2P (USB to P-port) transfers */ +CyU3PDmaChannel glChHandlebladeRFPtoU; /* DMA Channel for RF P2U (P-Port to USB) transfers */ + +CyU3PDmaChannel glChHandlebladeRFUtoUART; /* DMA Channel for U2P transfers */ +CyU3PDmaChannel glChHandlebladeRFUARTtoU; /* DMA Channel for U2P transfers */ + +CyU3PDmaMultiChannel glChHandleMultiUtoP; +CyU3PDmaMultiChannel glChHandleMultiPtoU; + +uint32_t glDMARxCount = 0; /* Counter to track the number of buffers received + * from USB during FPGA programming */ + +uint8_t glEp0Buffer[4096] __attribute__ ((aligned (32))); +uint32_t glEp0Idx; + +/* Application Error Handler */ +void CyFxAppErrorHandler(CyU3PReturnStatus_t apiRetStatus) +{ + /* firmware failed with the error code apiRetStatus */ + + /* Loop Indefinitely */ + for (;;) + /* Thread sleep : 100 ms */ + CyU3PThreadSleep(100); +} + +void NuandGPIOReconfigure(CyBool_t fullGpif, CyBool_t warm) +{ + CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS; + CyU3PIoMatrixConfig_t io_cfg; + CyU3PGpioSimpleConfig_t gpioConfig; + CyU3PReturnStatus_t status = CY_U3P_SUCCESS; + int i; + + struct { + int pin; // pin number + int input; // is this an input pin + + int warm; // should this pin be enabled via IOMatrix() call? + // GPIF pins should be marked False, because they have to overriden + } pins[] = { + {GPIO_nSTATUS, CyTrue, CyTrue}, + {GPIO_CONFDONE, CyTrue, CyTrue}, + {GPIO_SYS_RST, CyFalse, CyFalse}, + {GPIO_RX_EN, CyFalse, CyFalse}, + {GPIO_TX_EN, CyFalse, CyFalse}, + {GPIO_nCONFIG, CyFalse, CyTrue} + }; +#define ARR_SIZE(x) (sizeof(x)/sizeof(x[0])) + + io_cfg.useUart = CyTrue; + io_cfg.useI2C = CyFalse; + io_cfg.useI2S = CyFalse; + io_cfg.useSpi = !fullGpif; + io_cfg.isDQ32Bit = fullGpif; + io_cfg.lppMode = CY_U3P_IO_MATRIX_LPP_DEFAULT; + + io_cfg.gpioSimpleEn[0] = 0; + io_cfg.gpioSimpleEn[1] = 0; + if (warm) { + for (i = 0; i < ARR_SIZE(pins); i++) { + if (!pins[i].warm) + continue; + + if (pins[i].pin < 32) { + io_cfg.gpioSimpleEn[0] |= 1 << (pins[i].pin - 1); + } else { + io_cfg.gpioSimpleEn[1] |= 1 << (pins[i].pin - 32); + } + } + } + io_cfg.gpioComplexEn[0] = 0; + io_cfg.gpioComplexEn[1] = 0; + + status = CyU3PDeviceConfigureIOMatrix (&io_cfg); + if (status != CY_U3P_SUCCESS) { + while(1); + } + + for (i = 0; i < ARR_SIZE(pins); i++) { + // the pin has already been activated by the call to IOMatrix() + if (warm && pins[i].warm) + continue; + + apiRetStatus = CyU3PDeviceGpioOverride(pins[i].pin, CyTrue); + if (apiRetStatus != 0) { + CyU3PDebugPrint(4, "CyU3PDeviceGpioOverride failed, error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + gpioConfig.intrMode = CY_U3P_GPIO_NO_INTR; + + if (pins[i].input) { + // input config + gpioConfig.outValue = CyTrue; + gpioConfig.inputEn = CyTrue; + gpioConfig.driveLowEn = CyFalse; + gpioConfig.driveHighEn = CyFalse; + } else { + // output config + gpioConfig.outValue = CyFalse; + gpioConfig.driveLowEn = CyTrue; + gpioConfig.driveHighEn = CyTrue; + gpioConfig.inputEn = CyFalse; + } + + apiRetStatus = CyU3PGpioSetSimpleConfig(pins[i].pin, &gpioConfig); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint(4, "CyU3PGpioSetSimpleConfig failed, error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + } +} + +void UartBridgeStart(void) +{ + uint16_t size = 0; + CyU3PEpConfig_t epCfg; + CyU3PUSBSpeed_t usbSpeed = CyU3PUsbGetSpeed(); + + CyU3PDmaChannelConfig_t dmaCfg; + CyU3PUartConfig_t uartConfig; + CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS; + + + /* Initialize the UART for printing debug messages */ + apiRetStatus = CyU3PUartInit(); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyFxAppErrorHandler(apiRetStatus); + } + + /* Set UART configuration */ + CyU3PMemSet ((uint8_t *)&uartConfig, 0, sizeof (uartConfig)); + uartConfig.baudRate = CY_U3P_UART_BAUDRATE_4M608K; + uartConfig.stopBit = CY_U3P_UART_ONE_STOP_BIT; + uartConfig.parity = CY_U3P_UART_NO_PARITY; + uartConfig.txEnable = CyTrue; + uartConfig.rxEnable = CyTrue; + uartConfig.flowCtrl = CyFalse; + uartConfig.isDma = CyTrue; + + apiRetStatus = CyU3PUartSetConfig (&uartConfig, NULL); + if (apiRetStatus != CY_U3P_SUCCESS) + { + CyFxAppErrorHandler(apiRetStatus); + } + + /* Set UART Tx and Rx transfer Size to infinite */ + apiRetStatus = CyU3PUartTxSetBlockXfer(0xFFFFFFFF); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyFxAppErrorHandler(apiRetStatus); + } + + apiRetStatus = CyU3PUartRxSetBlockXfer(0xFFFFFFFF); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyFxAppErrorHandler(apiRetStatus); + } + + + /* Determine max packet size based on USB speed */ + switch (usbSpeed) + { + case CY_U3P_FULL_SPEED: + size = 64; + break; + + case CY_U3P_HIGH_SPEED: + size = 512; + break; + + case CY_U3P_SUPER_SPEED: + size = 1024; + break; + + default: + CyU3PDebugPrint (4, "Error! Invalid USB speed.\n"); + CyFxAppErrorHandler (CY_U3P_ERROR_FAILURE); + break; + } + + CyU3PMemSet ((uint8_t *)&epCfg, 0, sizeof (epCfg)); + epCfg.enable = CyTrue; + epCfg.epType = CY_U3P_USB_EP_BULK; + epCfg.burstLen = 1; + epCfg.streams = 0; + epCfg.pcktSize = size; + + /* Producer endpoint configuration */ + apiRetStatus = CyU3PSetEpConfig(BLADE_UART_EP_PRODUCER, &epCfg); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "CyU3PSetEpConfig failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler (apiRetStatus); + } + + /* Consumer endpoint configuration */ + apiRetStatus = CyU3PSetEpConfig(BLADE_UART_EP_CONSUMER, &epCfg); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "CyU3PSetEpConfig failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler (apiRetStatus); + } + + CyU3PMemSet((uint8_t *)&dmaCfg, 0, sizeof(dmaCfg)); + dmaCfg.size = size; + dmaCfg.count = 2; + dmaCfg.prodSckId = CY_U3P_UIB_SOCKET_PROD_2; + dmaCfg.consSckId = CY_U3P_LPP_SOCKET_UART_CONS; + dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE; + dmaCfg.notification = 0; + dmaCfg.cb = 0; + dmaCfg.prodHeader = 0; + dmaCfg.prodFooter = 0; + dmaCfg.consHeader = 0; + dmaCfg.prodAvailCount = 0; + + apiRetStatus = CyU3PDmaChannelCreate(&glChHandlebladeRFUtoUART, + CY_U3P_DMA_TYPE_AUTO, &dmaCfg); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "CyU3PDmaChannelCreate failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + dmaCfg.prodSckId = CY_U3P_LPP_SOCKET_UART_PROD; + dmaCfg.consSckId = CY_U3P_UIB_SOCKET_CONS_2; + apiRetStatus = CyU3PDmaChannelCreate(&glChHandlebladeRFUARTtoU, + CY_U3P_DMA_TYPE_AUTO, &dmaCfg); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "CyU3PDmaChannelCreate failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* Flush the endpoint memory */ + CyU3PUsbFlushEp(BLADE_UART_EP_PRODUCER); + CyU3PUsbFlushEp(BLADE_UART_EP_CONSUMER); + + /* Set DMA channel transfer size */ + apiRetStatus = CyU3PDmaChannelSetXfer(&glChHandlebladeRFUtoUART, BLADE_DMA_TX_SIZE); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "CyU3PDmaChannelSetXfer Failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + apiRetStatus = CyU3PDmaChannelSetXfer(&glChHandlebladeRFUARTtoU, BLADE_DMA_TX_SIZE); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "CyU3PDmaChannelSetXfer Failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* Set UART Tx and Rx transfer Size to infinite */ + apiRetStatus = CyU3PUartTxSetBlockXfer(0xFFFFFFFF); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyFxAppErrorHandler(apiRetStatus); + } + + apiRetStatus = CyU3PUartRxSetBlockXfer(0xFFFFFFFF); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyFxAppErrorHandler(apiRetStatus); + } +} + +void CyFxGpioInit(void) +{ + CyU3PGpioClock_t gpioClock; + CyU3PGpioSimpleConfig_t gpioConfig; + CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS; + + /* Init the GPIO module */ + gpioClock.fastClkDiv = 2; + gpioClock.slowClkDiv = 0; + gpioClock.simpleDiv = CY_U3P_GPIO_SIMPLE_DIV_BY_2; + gpioClock.clkSrc = CY_U3P_SYS_CLK; + gpioClock.halfDiv = 0; + + apiRetStatus = CyU3PGpioInit(&gpioClock, NULL); + if (apiRetStatus != 0) + { + /* Error Handling */ + CyU3PDebugPrint (4, "CyU3PGpioInit failed, error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + NuandGPIOReconfigure(CyFalse, CyFalse); +} + +int FpgaBeginProgram(void) +{ + CyBool_t value; + + int tEnd; + CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS; + apiRetStatus = CyU3PGpioSetValue(GPIO_nCONFIG, CyFalse); + tEnd = CyU3PGetTime() + 10; + while (CyU3PGetTime() < tEnd); + apiRetStatus = CyU3PGpioSetValue(GPIO_nCONFIG, CyTrue); + + tEnd = CyU3PGetTime() + 1000; + do { + apiRetStatus = CyU3PGpioGetValue(GPIO_nSTATUS, &value); + if (CyU3PGetTime() > tEnd) + return -1; + } while (!value); + + return 0; +} + +/* DMA callback function to handle the produce events for U to P transfers. */ +void bladeRFConfigUtoPDmaCallback(CyU3PDmaChannel *chHandle, CyU3PDmaCbType_t type, CyU3PDmaCBInput_t *input) +{ + CyU3PReturnStatus_t status = CY_U3P_SUCCESS; + + if (type == CY_U3P_DMA_CB_PROD_EVENT) { + int i; + unsigned char *buf = input->buffer_p.buffer; + unsigned short *us_buf = (unsigned short *)input->buffer_p.buffer; + unsigned short tmpr, tmpw; + + /* Flip the bits in such a way that the FPGA can be programmed + * This mapping can be determined by looking at the schematic */ + for (i = input->buffer_p.count - 1; i >= 0; i--) { + buf[i * 2] = buf[i]; + buf[i * 2 + 1] = 0; + tmpr = us_buf[i]; + + tmpw = 0; +#define US_GPIF_2_FPP(GPIFbit, FPPbit) tmpw |= (tmpr & (1 << FPPbit)) ? (1 << GPIFbit) : 0; + US_GPIF_2_FPP(7, 0); + US_GPIF_2_FPP(15, 1); + US_GPIF_2_FPP(6, 2); + US_GPIF_2_FPP(2, 3); + US_GPIF_2_FPP(1, 4); + US_GPIF_2_FPP(3, 5); + US_GPIF_2_FPP(9, 6); + US_GPIF_2_FPP(11, 7); + us_buf[i] = tmpw; + } + status = CyU3PDmaChannelCommitBuffer (chHandle, input->buffer_p.count * 2, 0); + if (status != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "CyU3PDmaChannelCommitBuffer failed, Error code = %d\n", status); + } + + /* Increment the counter. */ + glDMARxCount++; + } +} + +/* This function starts the RF data transport mechanism. This is the second + * interface of the first and only descriptor. */ +void NuandRFLinkStart(void) +{ + uint16_t size = 0; + CyU3PEpConfig_t epCfg; + CyU3PDmaChannelConfig_t dmaCfg; + CyU3PDmaMultiChannelConfig_t dmaMultiConfig; + CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS; + CyU3PUSBSpeed_t usbSpeed = CyU3PUsbGetSpeed(); + + NuandGPIOReconfigure(CyTrue, CyTrue); + + /* Load the GPIF configuration for loading the RF transceiver */ + apiRetStatus = CyU3PGpifLoad(&Rflink_CyFxGpifConfig); + if (apiRetStatus != CY_U3P_SUCCESS) + { + CyU3PDebugPrint (4, "CyU3PGpifLoad failed, Error Code = %d\n",apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + // strobe the RESET pin to the FPGA + CyU3PGpioSetValue(GPIO_SYS_RST, CyTrue); + CyU3PGpioSetValue(GPIO_SYS_RST, CyFalse); + + /* Start the state machine. */ + apiRetStatus = CyU3PGpifSMStart(RFLINK_START, RFLINK_ALPHA_START); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint(4, "CyU3PGpifSMStart failed, Error Code = %d\n",apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* Determine max packet size based on USB speed */ + switch (usbSpeed) + { + case CY_U3P_FULL_SPEED: + size = 64; + break; + + case CY_U3P_HIGH_SPEED: + size = 512; + break; + + case CY_U3P_SUPER_SPEED: + size = 1024; + break; + + default: + CyU3PDebugPrint (4, "Error! Invalid USB speed.\n"); + CyFxAppErrorHandler (CY_U3P_ERROR_FAILURE); + break; + } + + CyU3PMemSet ((uint8_t *)&epCfg, 0, sizeof (epCfg)); + epCfg.enable = CyTrue; + epCfg.epType = CY_U3P_USB_EP_BULK; + epCfg.burstLen = 1; + epCfg.streams = 0; + epCfg.pcktSize = size; + + /* Producer endpoint configuration */ + apiRetStatus = CyU3PSetEpConfig(BLADE_RF_SAMPLE_EP_PRODUCER, &epCfg); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint(4, "CyU3PSetEpConfig failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler (apiRetStatus); + } + + /* Consumer endpoint configuration */ + apiRetStatus = CyU3PSetEpConfig(BLADE_RF_SAMPLE_EP_CONSUMER, &epCfg); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint(4, "CyU3PSetEpConfig failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler (apiRetStatus); + } + + dmaMultiConfig.size = size; + dmaMultiConfig.count = 50; + dmaMultiConfig.validSckCount = 2; + dmaMultiConfig.prodSckId[0] = BLADE_RF_SAMPLE_EP_PRODUCER_USB_SOCKET; + dmaMultiConfig.consSckId[0] = CY_U3P_PIB_SOCKET_2; + dmaMultiConfig.consSckId[1] = CY_U3P_PIB_SOCKET_3; + dmaMultiConfig.dmaMode = CY_U3P_DMA_MODE_BYTE; + dmaMultiConfig.notification = 0; + dmaMultiConfig.cb = 0; + dmaMultiConfig.prodHeader = 0; + dmaMultiConfig.prodFooter = 0; + dmaMultiConfig.consHeader = 0; + dmaMultiConfig.prodAvailCount = 0; + + apiRetStatus = CyU3PDmaMultiChannelCreate(&glChHandleMultiUtoP, CY_U3P_DMA_TYPE_AUTO_ONE_TO_MANY, &dmaMultiConfig); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint(4, "CyU3PDmaMultiChannelCreate failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + dmaMultiConfig.prodSckId[0] = CY_U3P_PIB_SOCKET_0; + dmaMultiConfig.prodSckId[1] = CY_U3P_PIB_SOCKET_1; + dmaMultiConfig.consSckId[0] = BLADE_RF_SAMPLE_EP_CONSUMER_USB_SOCKET; + dmaMultiConfig.consSckId[1] = 0; + + apiRetStatus = CyU3PDmaMultiChannelCreate(&glChHandleMultiPtoU, CY_U3P_DMA_TYPE_AUTO_MANY_TO_ONE, &dmaMultiConfig); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint(4, "CyU3PDmaMultiChannelCreate failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* Flush the Endpoint memory */ + CyU3PUsbFlushEp(BLADE_RF_SAMPLE_EP_PRODUCER); + CyU3PUsbFlushEp(BLADE_RF_SAMPLE_EP_CONSUMER); + + /* Set DMA channel transfer size. */ + + apiRetStatus = CyU3PDmaMultiChannelSetXfer (&glChHandleMultiUtoP, BLADE_DMA_TX_SIZE, 0); + + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint(4, "CyU3PDmaChannelSetXfer Failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + apiRetStatus = CyU3PDmaMultiChannelSetXfer (&glChHandleMultiPtoU, BLADE_DMA_TX_SIZE, 0); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint(4, "CyU3PDmaChannelSetXfer Failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + glAppMode = MODE_RF_CONFIG; + +} + +/* This function stops the slave FIFO loop application. This shall be called + * whenever a RESET or DISCONNECT event is received from the USB host. The + * endpoints are disabled and the DMA pipe is destroyed by this function. */ +void NuandRFLinkStop (void) +{ + CyU3PEpConfig_t epCfg; + CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS; + + /* Flush endpoint memory buffers */ + CyU3PUsbFlushEp(BLADE_RF_SAMPLE_EP_PRODUCER); + CyU3PUsbFlushEp(BLADE_RF_SAMPLE_EP_CONSUMER); + + /* Destroy the channels */ + CyU3PDmaMultiChannelDestroy(&glChHandleMultiUtoP); + CyU3PDmaMultiChannelDestroy(&glChHandleMultiPtoU); + + /* Disable endpoints. */ + CyU3PMemSet ((uint8_t *)&epCfg, 0, sizeof (epCfg)); + epCfg.enable = CyFalse; + + /* Disable producer endpoint */ + apiRetStatus = CyU3PSetEpConfig(BLADE_RF_SAMPLE_EP_PRODUCER, &epCfg); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint(4, "CyU3PSetEpConfig failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* Disable consumer endpoint */ + apiRetStatus = CyU3PSetEpConfig(BLADE_RF_SAMPLE_EP_CONSUMER, &epCfg); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint(4, "CyU3PSetEpConfig failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* Reset the GPIF */ + CyU3PGpifDisable(CyTrue); + + glAppMode = MODE_NO_CONFIG; +} + +void NuandFpgaConfigStart(void) +{ + uint16_t size = 0; + CyU3PEpConfig_t epCfg; + CyU3PDmaChannelConfig_t dmaCfg; + CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS; + CyU3PUSBSpeed_t usbSpeed = CyU3PUsbGetSpeed(); + + NuandGPIOReconfigure(CyFalse, CyFalse); + + /* Load the GPIF configuration for loading the FPGA */ + apiRetStatus = CyU3PGpifLoad(&C4loader_CyFxGpifConfig); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "CyU3PGpifLoad failed, Error Code = %d\n",apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* Start the state machine. */ + apiRetStatus = CyU3PGpifSMStart(C4LOADER_START, C4LOADER_ALPHA_START); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint(4, "CyU3PGpifSMStart failed, Error Code = %d\n",apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* Determine max packet size based on USB speed */ + switch (usbSpeed) + { + case CY_U3P_FULL_SPEED: + size = 64; + break; + + case CY_U3P_HIGH_SPEED: + size = 512; + break; + + case CY_U3P_SUPER_SPEED: + size = 1024; + break; + + default: + CyU3PDebugPrint(4, "Error! Invalid USB speed.\n"); + CyFxAppErrorHandler(CY_U3P_ERROR_FAILURE); + break; + } + + CyU3PMemSet((uint8_t *)&epCfg, 0, sizeof (epCfg)); + epCfg.enable = CyTrue; + epCfg.epType = CY_U3P_USB_EP_BULK; + epCfg.burstLen = 1; + epCfg.streams = 0; + epCfg.pcktSize = size; + + apiRetStatus = CyU3PSetEpConfig(BLADE_FPGA_EP_PRODUCER, &epCfg); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint(4, "CyU3PSetEpConfig failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler (apiRetStatus); + } + + dmaCfg.size = size * 2; + dmaCfg.count = BLADE_DMA_BUF_COUNT; + dmaCfg.prodSckId = BLADE_FPGA_CONFIG_SOCKET; + dmaCfg.consSckId = CY_U3P_PIB_SOCKET_3; + dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE; + + /* Enable the callback for produce event, this is where the bits will get flipped */ + dmaCfg.notification = CY_U3P_DMA_CB_PROD_EVENT; + + dmaCfg.cb = bladeRFConfigUtoPDmaCallback; + dmaCfg.prodHeader = 0; + dmaCfg.prodFooter = size; + dmaCfg.consHeader = 0; + dmaCfg.prodAvailCount = 0; + + apiRetStatus = CyU3PDmaChannelCreate(&glChHandlebladeRFUtoP, + CY_U3P_DMA_TYPE_MANUAL, &dmaCfg); + + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint(4, "CyU3PDmaChannelCreate failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* Flush the endpoint memory */ + CyU3PUsbFlushEp(BLADE_FPGA_EP_PRODUCER); + + /* Set DMA channel transfer size. */ + apiRetStatus = CyU3PDmaChannelSetXfer(&glChHandlebladeRFUtoP, BLADE_DMA_TX_SIZE); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint(4, "CyU3PDmaChannelSetXfer Failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + glAppMode = MODE_FPGA_CONFIG; +} + +void NuandFpgaConfigStop(void) +{ + CyU3PEpConfig_t epCfg; + CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS; + + /* Flush the endpoint memory */ + CyU3PUsbFlushEp(BLADE_FPGA_EP_PRODUCER); + + /* Destroy the channel */ + CyU3PDmaChannelDestroy(&glChHandlebladeRFUtoP); + + /* Disable endpoints. */ + CyU3PMemSet((uint8_t *)&epCfg, 0, sizeof (epCfg)); + epCfg.enable = CyFalse; + + /* Producer endpoint configuration. */ + apiRetStatus = CyU3PSetEpConfig(BLADE_FPGA_EP_PRODUCER, &epCfg); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "CyU3PSetEpConfig failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler (apiRetStatus); + } + + CyU3PGpifDisable(CyTrue); + + glAppMode = MODE_NO_CONFIG; +} + +/* Callback to handle the USB setup requests. */ +CyBool_t CyFxbladeRFApplnUSBSetupCB(uint32_t setupdat0, uint32_t setupdat1) +{ + uint8_t bRequest, bReqType; + uint8_t bType, bTarget; + uint16_t wValue, wIndex, wLength; + CyBool_t isHandled = CyFalse; + + /* Decode the fields from the setup request. */ + bReqType = (setupdat0 & CY_U3P_USB_REQUEST_TYPE_MASK); + bType = (bReqType & CY_U3P_USB_TYPE_MASK); + bTarget = (bReqType & CY_U3P_USB_TARGET_MASK); + bRequest = ((setupdat0 & CY_U3P_USB_REQUEST_MASK) >> CY_U3P_USB_REQUEST_POS); + wValue = ((setupdat0 & CY_U3P_USB_VALUE_MASK) >> CY_U3P_USB_VALUE_POS); + wIndex = ((setupdat1 & CY_U3P_USB_INDEX_MASK) >> CY_U3P_USB_INDEX_POS); + wLength = ((setupdat1 & CY_U3P_USB_LENGTH_MASK) >> CY_U3P_USB_LENGTH_POS); + + if (bType == CY_U3P_USB_STANDARD_RQT) + { + /* Handle suspend requests */ + if ((bTarget == CY_U3P_USB_TARGET_INTF) && ((bRequest == CY_U3P_USB_SC_SET_FEATURE) + || (bRequest == CY_U3P_USB_SC_CLEAR_FEATURE)) && (wValue == 0)) { + if (glAppMode != MODE_NO_CONFIG) + CyU3PUsbAckSetup(); + else + CyU3PUsbStall(0, CyTrue, CyFalse); + isHandled = CyTrue; + } + + /* Flush enpoint memory and reset channel if CLEAR_FEATURE is received */ + if ((bTarget == CY_U3P_USB_TARGET_ENDPT) && (bRequest == CY_U3P_USB_SC_CLEAR_FEATURE) + && (wValue == CY_U3P_USBX_FS_EP_HALT)) + { + if (glAppMode != MODE_NO_CONFIG) { +#if 0 + if (wIndex == CY_FX_EP_PRODUCER) { + CyU3PDmaChannelReset (&glChHandlebladeRFUtoP); + CyU3PUsbFlushEp(CY_FX_EP_PRODUCER); + CyU3PUsbResetEp(CY_FX_EP_PRODUCER); + CyU3PDmaChannelSetXfer (&glChHandlebladeRFUtoP, BLADE_DMA_TX_SIZE); + } + + if (wIndex == CY_FX_EP_CONSUMER) { + CyU3PDmaChannelReset (&glChHandlebladeRFPtoU); + CyU3PUsbFlushEp(CY_FX_EP_CONSUMER); + CyU3PUsbResetEp(CY_FX_EP_CONSUMER); + CyU3PDmaChannelSetXfer (&glChHandlebladeRFPtoU, BLADE_DMA_RX_SIZE); + } +#endif + + CyU3PUsbStall(wIndex, CyFalse, CyTrue); + isHandled = CyTrue; + } + } + } + + + /* Handle supported bladeRF vendor requests. */ + if (bType == CY_U3P_USB_VENDOR_RQT) + { + unsigned int ret; + CyBool_t fpgaProg; + struct bladeRF_version ver; + CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS; + int retStatus; + char buf[10]; + uint16_t readC; + + isHandled = CyTrue; + + switch (bRequest) + { + case BLADE_USB_CMD_QUERY_VERSION: + ver.major = 0; + ver.minor = 1; + apiRetStatus = CyU3PUsbSendEP0Data(sizeof(ver), &ver); + break; + + case BLADE_USB_CMD_RF_RX: + CyU3PGpioSetValue(GPIO_SYS_RST, CyTrue); + CyU3PGpioSetValue(GPIO_SYS_RST, CyFalse); + + apiRetStatus = CyU3PUsbGetEP0Data(4, buf, &readC); + + CyU3PGpioSetValue(GPIO_RX_EN, (buf[0] || buf[3]) ? CyTrue : CyFalse); + break; + + case BLADE_USB_CMD_RF_TX: + CyU3PGpioSetValue(GPIO_SYS_RST, CyTrue); + CyU3PGpioSetValue(GPIO_SYS_RST, CyFalse); + + apiRetStatus = CyU3PUsbGetEP0Data(4, buf, &readC); + + CyU3PGpioSetValue(GPIO_TX_EN, (buf[0] || buf[3]) ? CyTrue : CyFalse); + break; + + case BLADE_USB_CMD_BEGIN_PROG: + retStatus = FpgaBeginProgram(); + apiRetStatus = CyU3PUsbSendEP0Data (sizeof(retStatus), &retStatus); + break; + break; + + case BLADE_USB_CMD_QUERY_FPGA_STATUS: + apiRetStatus = CyU3PGpioGetValue (GPIO_CONFDONE, &fpgaProg); + if (apiRetStatus == CY_U3P_SUCCESS) { + ret = fpgaProg ? 1 : 0; + } else { + ret = -1; + } + apiRetStatus = CyU3PUsbSendEP0Data (sizeof(ret), &ret); + break; + + case BLADE_USB_CMD_FLASH_READ: + if (CyU3PUsbGetSpeed() == CY_U3P_HIGH_SPEED) { + if (glEp0Idx == 0) { + apiRetStatus = CyFxSpiTransfer (wIndex, 0x100, + glEp0Buffer, CyTrue); + } else { + apiRetStatus = CY_U3P_SUCCESS; + } + apiRetStatus = CyU3PUsbSendEP0Data(wLength, &glEp0Buffer[glEp0Idx]); + + glEp0Idx += 64; + if (glEp0Idx == 256) + glEp0Idx = 0; + } else if (CyU3PUsbGetSpeed() == CY_U3P_SUPER_SPEED) { + apiRetStatus = CyFxSpiTransfer (wIndex, 0x100, + glEp0Buffer, CyTrue); + apiRetStatus = CyU3PUsbSendEP0Data(0x100, &glEp0Buffer); + } + break; + + case BLADE_USB_CMD_FLASH_WRITE: + if (CyU3PUsbGetSpeed() == CY_U3P_HIGH_SPEED) { + apiRetStatus = CyU3PUsbGetEP0Data(64, &glEp0Buffer[glEp0Idx], &readC); + + glEp0Idx += 64; + if (glEp0Idx == 256){ + apiRetStatus = CyFxSpiTransfer (wIndex, 0x100, + glEp0Buffer, CyFalse); + glEp0Idx = 0; + } + } else if (CyU3PUsbGetSpeed() == CY_U3P_SUPER_SPEED) { + apiRetStatus = CyU3PUsbGetEP0Data(0x100, &glEp0Buffer, &readC); + apiRetStatus = CyFxSpiTransfer (wIndex, 0x100, + glEp0Buffer, CyFalse); + } + break; + + case BLADE_USB_CMD_FLASH_ERASE: + apiRetStatus = CyFxSpiEraseSector(CyTrue, wIndex); + ret = (apiRetStatus == CY_U3P_SUCCESS); + CyU3PUsbSendEP0Data(sizeof(ret), &ret); + break; + + break; + default: + isHandled = CyFalse; + + } + } + + return isHandled; +} + +/* This is the callback function to handle the USB events. */ +void CyFxbladeRFApplnUSBEventCB (CyU3PUsbEventType_t evtype, uint16_t evdata) +{ + int interface; + switch (evtype) + { + case CY_U3P_USB_EVENT_SETINTF: + interface = evdata >> 8; + + if (interface == 0) { + NuandRFLinkStop(); + NuandFpgaConfigStart(); + } else if (interface == 1) { + NuandFpgaConfigStop(); + NuandRFLinkStart(); + } else if (interface == 2) { + if (glAppMode == MODE_RF_CONFIG) { + NuandRFLinkStop(); + } + if (glAppMode == MODE_FPGA_CONFIG) { + NuandFpgaConfigStop(); + } + glEp0Idx = 0; + NuandFirmwareStart(); + } + break; + + case CY_U3P_USB_EVENT_SETCONF: + /* Stop the application before re-starting. */ + switch (glAppMode) { + case MODE_RF_CONFIG: + NuandRFLinkStop(); + case MODE_NO_CONFIG: + NuandFpgaConfigStart(); + case MODE_FPGA_CONFIG: + FpgaBeginProgram(); + } + break; + + case CY_U3P_USB_EVENT_RESET: + case CY_U3P_USB_EVENT_DISCONNECT: + /* Stop the loop back function. */ + if (glAppMode == MODE_RF_CONFIG) { + NuandRFLinkStop(); + } else if (glAppMode == MODE_FPGA_CONFIG){ + NuandFpgaConfigStop(); + } + break; + + default: + break; + } +} + +/* Callback function to handle LPM requests from the USB 3.0 host. This function is invoked by the API + whenever a state change from U0 -> U1 or U0 -> U2 happens. If we return CyTrue from this function, the + FX3 device is retained in the low power state. If we return CyFalse, the FX3 device immediately tries + to trigger an exit back to U0. + + This application does not have any state in which we should not allow U1/U2 transitions; and therefore + the function always return CyTrue. + */ +CyBool_t +CyFxApplnLPMRqtCB ( + CyU3PUsbLinkPowerMode link_mode) +{ + return CyTrue; +} + +void bladeRFInit(void) +{ + CyU3PPibClock_t pibClock; + CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS; + + /* Initialize the p-port block. */ + pibClock.clkDiv = 4; + pibClock.clkSrc = CY_U3P_SYS_CLK; + pibClock.isHalfDiv = CyFalse; + /* Enable DLL for async GPIF */ + pibClock.isDllEnable = CyFalse; + apiRetStatus = CyU3PPibInit(CyTrue, &pibClock); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "P-port Initialization failed, Error Code = %d\n",apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* Start the USB functionality. */ + apiRetStatus = CyU3PUsbStart(); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "CyU3PUsbStart failed to Start, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* The fast enumeration is the easiest way to setup a USB connection, + * where all enumeration phase is handled by the library. Only the + * class / vendor requests need to be handled by the application. */ + CyU3PUsbRegisterSetupCallback(CyFxbladeRFApplnUSBSetupCB, CyTrue); + + /* Setup the callback to handle the USB events. */ + CyU3PUsbRegisterEventCallback(CyFxbladeRFApplnUSBEventCB); + + /* Register a callback to handle LPM requests from the USB 3.0 host. */ + CyU3PUsbRegisterLPMRequestCallback(CyFxApplnLPMRqtCB); + + /* Set the USB Enumeration descriptors */ + + /* Super speed device descriptor. */ + apiRetStatus = CyU3PUsbSetDesc(CY_U3P_USB_SET_SS_DEVICE_DESCR, NULL, (uint8_t *)CyFxUSB30DeviceDscr); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "USB set device descriptor failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* High speed device descriptor. */ + apiRetStatus = CyU3PUsbSetDesc(CY_U3P_USB_SET_HS_DEVICE_DESCR, NULL, (uint8_t *)CyFxUSB20DeviceDscr); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "USB set device descriptor failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* BOS descriptor */ + apiRetStatus = CyU3PUsbSetDesc(CY_U3P_USB_SET_SS_BOS_DESCR, NULL, (uint8_t *)CyFxUSBBOSDscr); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "USB set configuration descriptor failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* Device qualifier descriptor */ + apiRetStatus = CyU3PUsbSetDesc(CY_U3P_USB_SET_DEVQUAL_DESCR, NULL, (uint8_t *)CyFxUSBDeviceQualDscr); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "USB set device qualifier descriptor failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* Super speed configuration descriptor */ + apiRetStatus = CyU3PUsbSetDesc(CY_U3P_USB_SET_SS_CONFIG_DESCR, NULL, (uint8_t *)CyFxUSBSSConfigDscr); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "USB set configuration descriptor failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* High speed configuration descriptor */ + apiRetStatus = CyU3PUsbSetDesc(CY_U3P_USB_SET_HS_CONFIG_DESCR, NULL, (uint8_t *)CyFxUSBHSConfigDscr); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "USB Set Other Speed Descriptor failed, Error Code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* Full speed configuration descriptor */ + apiRetStatus = CyU3PUsbSetDesc(CY_U3P_USB_SET_FS_CONFIG_DESCR, NULL, (uint8_t *)CyFxUSBFSConfigDscr); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "USB Set Configuration Descriptor failed, Error Code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* String descriptor 0 */ + apiRetStatus = CyU3PUsbSetDesc(CY_U3P_USB_SET_STRING_DESCR, 0, (uint8_t *)CyFxUSBStringLangIDDscr); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "USB set string descriptor failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* String descriptor 1 */ + apiRetStatus = CyU3PUsbSetDesc(CY_U3P_USB_SET_STRING_DESCR, 1, (uint8_t *)CyFxUSBManufactureDscr); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "USB set string descriptor failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* String descriptor 2 */ + apiRetStatus = CyU3PUsbSetDesc(CY_U3P_USB_SET_STRING_DESCR, 2, (uint8_t *)CyFxUSBProductDscr); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "USB set string descriptor failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + /* Connect the USB Pins with super speed operation enabled. */ + apiRetStatus = CyU3PConnectState(CyTrue, CyTrue); + if (apiRetStatus != CY_U3P_SUCCESS) { + CyU3PDebugPrint (4, "USB Connect failed, Error code = %d\n", apiRetStatus); + CyFxAppErrorHandler(apiRetStatus); + } + + glAppMode = MODE_NO_CONFIG; +} + +/* Entry function for the bladeRFAppThread. */ +void bladeRFAppThread_Entry( uint32_t input) +{ + uint8_t state; + CyFxGpioInit(); + + bladeRFInit(); + + FpgaBeginProgram(); + + for (;;) { + CyU3PThreadSleep (100); + CyU3PGpifGetSMState(&state); + } +} + +/* Application define function which creates the threads. */ +void CyFxApplicationDefine(void) +{ + void *ptr = NULL; + uint32_t retThrdCreate = CY_U3P_SUCCESS; + + /* Allocate the memory for the threads */ + ptr = CyU3PMemAlloc(BLADE_THREAD_STACK); + + /* Create the thread for the application */ + retThrdCreate = CyU3PThreadCreate(&bladeRFAppThread, /* Slave FIFO app thread structure */ + "21:bladeRF_thread", /* Thread ID and thread name */ + bladeRFAppThread_Entry, /* Slave FIFO app thread entry function */ + 0, /* No input parameter to thread */ + ptr, /* Pointer to the allocated thread stack */ + BLADE_THREAD_STACK, /* App Thread stack size */ + BLADE_THREAD_PRIORITY, /* App Thread priority */ + BLADE_THREAD_PRIORITY, /* App Thread pre-emption threshold */ + CYU3P_NO_TIME_SLICE, /* No time slice for the application thread */ + CYU3P_AUTO_START /* Start the thread immediately */ + ); + + if (retThrdCreate != 0) { + /* Application cannot continue */ + /* Loop indefinitely */ + while(1); + } +} + +/* + * Main function + */ +int main(void) +{ + CyU3PIoMatrixConfig_t io_cfg; + CyU3PReturnStatus_t status = CY_U3P_SUCCESS; + + /* Initialize the device */ + status = CyU3PDeviceInit(NULL); + if (status != CY_U3P_SUCCESS) { + goto handle_fatal_error; + } + + /* Initialize the caches. Enable both Instruction and Data Caches. */ + status = CyU3PDeviceCacheControl(CyTrue, CyTrue, CyTrue); + if (status != CY_U3P_SUCCESS) { + goto handle_fatal_error; + } + + io_cfg.useUart = CyTrue; + io_cfg.useI2C = CyFalse; + io_cfg.useI2S = CyFalse; + io_cfg.useSpi = CyFalse; + io_cfg.isDQ32Bit = CyTrue; + io_cfg.lppMode = CY_U3P_IO_MATRIX_LPP_DEFAULT; + + /* No GPIOs are enabled. */ + io_cfg.gpioSimpleEn[0] = 0; + io_cfg.gpioSimpleEn[1] = 0; + io_cfg.gpioComplexEn[0] = 0; + io_cfg.gpioComplexEn[1] = 0; + status = CyU3PDeviceConfigureIOMatrix (&io_cfg); + if (status != CY_U3P_SUCCESS) + { + goto handle_fatal_error; + } + + /* This is a non returnable call for initializing the RTOS kernel */ + CyU3PKernelEntry(); + + /* Dummy return to make the compiler happy */ + return 0; + +handle_fatal_error: + /* Cannot recover from this error. */ + while (1); +} diff --git a/fx3_firmware/bladeRF.h b/fx3_firmware/bladeRF.h new file mode 100644 index 00000000..e14ceec0 --- /dev/null +++ b/fx3_firmware/bladeRF.h @@ -0,0 +1,71 @@ +#ifndef _INCLUDED_BLADE_H_ +#define _INCLUDED_BLADE_H_ + +#include "cyu3externcstart.h" +#include "cyu3types.h" +#include "cyu3usbconst.h" +#include "../common/bladeRF.h" + +#define BLADE_GPIF_16_32BIT_CONF_SELECT (0) + +#define BLADE_DMA_BUF_COUNT (2) +#define BLADE_DMA_TX_SIZE (0) +#define BLADE_DMA_RX_SIZE (0) +#define BLADE_THREAD_STACK (0x0400) +#define BLADE_THREAD_PRIORITY (8) + +// interface #0 +#define BLADE_FPGA_EP_PRODUCER 0x02 +#define BLADE_FPGA_CONFIG_SOCKET CY_U3P_UIB_SOCKET_PROD_2 + +// interface #1 +#define BLADE_RF_SAMPLE_EP_PRODUCER 0x01 +#define BLADE_RF_SAMPLE_EP_PRODUCER_USB_SOCKET CY_U3P_UIB_SOCKET_PROD_1 +#define BLADE_UART_EP_PRODUCER 0x02 +#define BLADE_UART_EP_PRODUCER_USB_SOCKET CY_U3P_UIB_SOCKET_PROD_2 + +#define BLADE_RF_SAMPLE_EP_CONSUMER 0x81 +#define BLADE_RF_SAMPLE_EP_CONSUMER_USB_SOCKET CY_U3P_UIB_SOCKET_CONS_1 +#define BLADE_UART_EP_CONSUMER 0x82 +#define BLADE_UART_EP_CONSUMER_USB_SOCKET CY_U3P_UIB_SOCKET_CONS_2 + +// interface #2 +// doesn't actually use BULK, EP exists for debugging purposes + +/* Extern definitions for the USB Descriptors */ +extern const uint8_t CyFxUSB20DeviceDscr[]; +extern const uint8_t CyFxUSB30DeviceDscr[]; +extern const uint8_t CyFxUSBDeviceQualDscr[]; +extern const uint8_t CyFxUSBFSConfigDscr[]; +extern const uint8_t CyFxUSBHSConfigDscr[]; +extern const uint8_t CyFxUSBBOSDscr[]; +extern const uint8_t CyFxUSBSSConfigDscr[]; +extern const uint8_t CyFxUSBStringLangIDDscr[]; +extern const uint8_t CyFxUSBManufactureDscr[]; +extern const uint8_t CyFxUSBProductDscr[]; + +#include "cyu3externcend.h" + +int FpgaBeginProgram(void); +void NuandFirmwareStart(void); +CyU3PReturnStatus_t CyFxSpiEraseSector(CyBool_t /* isErase */, uint8_t /* sector */); +void NuandGPIOReconfigure(CyBool_t /* fullGpif */, CyBool_t /* warm */); +int FpgaBeginProgram(void); + +extern uint32_t glAppMode; + +#define GPIO_nSTATUS 52 +#define GPIO_nCONFIG 51 +#define GPIO_CONFDONE 50 + +#define GPIO_SYS_RST 24 +#define GPIO_RX_EN 21 +#define GPIO_TX_EN 22 + +#define MODE_NO_CONFIG 0 +#define MODE_FPGA_CONFIG 1 +#define MODE_RF_CONFIG 2 +#define MODE_FW_CONFIG 3 + + +#endif diff --git a/fx3_firmware/cyfxbladeRF.h b/fx3_firmware/cyfxbladeRF.h new file mode 100644 index 00000000..441390b9 --- /dev/null +++ b/fx3_firmware/cyfxbladeRF.h @@ -0,0 +1,49 @@ + +#ifndef _INCLUDED_BLADE_H_ +#define _INCLUDED_BLADE_H_ + +#include "cyu3externcstart.h" +#include "cyu3types.h" +#include "cyu3usbconst.h" + +/* 16/32 bit GPIF Configuration select */ +/* Set BLADE_GPIF_16_32BIT_CONF_SELECT = 0 for 16 bit GPIF data bus. + * Set BLADE_GPIF_16_32BIT_CONF_SELECT = 1 for 32 bit GPIF data bus. + */ +#define BLADE_GPIF_16_32BIT_CONF_SELECT (0) + +#define BLADE_DMA_BUF_COUNT (2) +#define BLADE_DMA_TX_SIZE (0) +#define BLADE_DMA_RX_SIZE (0) +#define BLADE_THREAD_STACK (0x0400) +#define BLADE_THREAD_PRIORITY (8) + +#define CY_FX_EP_PRODUCER 0x01 /* EP 1 OUT */ +#define BLADE_FPGA_EP_PRODUCER 0x02 /* EP 2 OUT */ +#define CY_FX_EP_CONSUMER 0x81 /* EP 1 IN */ + +#define CY_FX_PRODUCER_USB_SOCKET CY_U3P_UIB_SOCKET_PROD_1 /* USB Socket 1 is producer */ +#define BLADE_FPGA_CONFIG_SOCKET CY_U3P_UIB_SOCKET_PROD_2 /* USB Socket 2 is producer */ +#define CY_FX_CONSUMER_USB_SOCKET CY_U3P_UIB_SOCKET_CONS_1 /* USB Socket 1 is consumer */ + +/* Used with FX3 Silicon. */ +#define CY_FX_PRODUCER_PPORT_SOCKET CY_U3P_PIB_SOCKET_0 /* P-port Socket 0 is producer */ +#define CY_FX_CONSUMER_PPORT_SOCKET CY_U3P_PIB_SOCKET_3 /* P-port Socket 3 is consumer */ + +/* Extern definitions for the USB Descriptors */ +extern const uint8_t CyFxUSB20DeviceDscr[]; +extern const uint8_t CyFxUSB30DeviceDscr[]; +extern const uint8_t CyFxUSBDeviceQualDscr[]; +extern const uint8_t CyFxUSBFSConfigDscr[]; +extern const uint8_t CyFxUSBHSConfigDscr[]; +extern const uint8_t CyFxUSBBOSDscr[]; +extern const uint8_t CyFxUSBSSConfigDscr[]; +extern const uint8_t CyFxUSBStringLangIDDscr[]; +extern const uint8_t CyFxUSBManufactureDscr[]; +extern const uint8_t CyFxUSBProductDscr[]; + +#include "cyu3externcend.h" + +#endif /* _INCLUDED_BLADE_H_ */ + +/*[]*/ diff --git a/fx3_firmware/cyfxbladeRFusbdscr.c b/fx3_firmware/cyfxbladeRFusbdscr.c new file mode 100644 index 00000000..af32424c --- /dev/null +++ b/fx3_firmware/cyfxbladeRFusbdscr.c @@ -0,0 +1,417 @@ +#include "cyfxbladeRF.h" + +/* Standard device descriptor for USB 3.0 */ +const uint8_t CyFxUSB30DeviceDscr[] __attribute__ ((aligned (32))) = +{ + 0x12, /* Descriptor size */ + CY_U3P_USB_DEVICE_DESCR, /* Device descriptor type */ + 0x00,0x03, /* USB 3.0 */ + 0x00, /* Device class */ + 0x00, /* Device sub-class */ + 0x00, /* Device protocol */ + 0x09, /* Maxpacket size for EP0 : 2^9 */ + 0xB4,0x04, /* Vendor ID */ + 0xF1,0x00, /* Product ID */ + 0x00,0x00, /* Device release number */ + 0x01, /* Manufacture string index */ + 0x02, /* Product string index */ + 0x00, /* Serial number string index */ + 0x01 /* Number of configurations */ +}; + +/* Standard device descriptor for USB 2.0 */ +const uint8_t CyFxUSB20DeviceDscr[] __attribute__ ((aligned (32))) = +{ + 0x12, /* Descriptor size */ + CY_U3P_USB_DEVICE_DESCR, /* Device descriptor type */ + 0x10,0x02, /* USB 2.10 */ + 0x00, /* Device class */ + 0x00, /* Device sub-class */ + 0x00, /* Device protocol */ + 0x40, /* Maxpacket size for EP0 : 64 bytes */ + 0xB4,0x04, /* Vendor ID */ + 0xF1,0x00, /* Product ID */ + 0x00,0x00, /* Device release number */ + 0x01, /* Manufacture string index */ + 0x02, /* Product string index */ + 0x00, /* Serial number string index */ + 0x01 /* Number of configurations */ +}; + +/* Binary device object store descriptor */ +const uint8_t CyFxUSBBOSDscr[] __attribute__ ((aligned (32))) = +{ + 0x05, /* Descriptor size */ + CY_U3P_BOS_DESCR, /* Device descriptor type */ + 0x16,0x00, /* Length of this descriptor and all sub descriptors */ + 0x02, /* Number of device capability descriptors */ + + /* USB 2.0 extension */ + 0x07, /* Descriptor size */ + CY_U3P_DEVICE_CAPB_DESCR, /* Device capability type descriptor */ + CY_U3P_USB2_EXTN_CAPB_TYPE, /* USB 2.0 extension capability type */ + 0x02,0x00,0x00,0x00, /* Supported device level features: LPM support */ + + /* SuperSpeed device capability */ + 0x0A, /* Descriptor size */ + CY_U3P_DEVICE_CAPB_DESCR, /* Device capability type descriptor */ + CY_U3P_SS_USB_CAPB_TYPE, /* SuperSpeed device capability type */ + 0x00, /* Supported device level features */ + 0x0E,0x00, /* Speeds supported by the device : SS, HS and FS */ + 0x03, /* Functionality support */ + 0x00, /* U1 Device Exit latency */ + 0x00,0x00 /* U2 Device Exit latency */ +}; + +/* Standard device qualifier descriptor */ +const uint8_t CyFxUSBDeviceQualDscr[] __attribute__ ((aligned (32))) = +{ + 0x0A, /* Descriptor size */ + CY_U3P_USB_DEVQUAL_DESCR, /* Device qualifier descriptor type */ + 0x00,0x02, /* USB 2.0 */ + 0x00, /* Device class */ + 0x00, /* Device sub-class */ + 0x00, /* Device protocol */ + 0x40, /* Maxpacket size for EP0 : 64 bytes */ + 0x01, /* Number of configurations */ + 0x00 /* Reserved */ +}; + +/* Standard super speed configuration descriptor */ +const uint8_t CyFxUSBSSConfigDscr[] __attribute__ ((aligned (32))) = +{ + /* Configuration descriptor */ + 0x09, /* Descriptor size */ + CY_U3P_USB_CONFIG_DESCR, /* Configuration descriptor type */ + 0x72,0x00, /* Length of this descriptor and all sub descriptors */ + 0x03, /* Number of interfaces */ + 0x01, /* Configuration number */ + 0x00, /* COnfiguration string index */ + 0x80, /* Config characteristics - Bus powered */ + 0x32, /* Max power consumption of device (in 8mA unit) : 400mA */ + + + /* Interface descriptor #0*/ + 0x09, /* Descriptor size */ + CY_U3P_USB_INTRFC_DESCR, /* Interface Descriptor type */ + 0x00, /* Interface number */ + 0x00, /* Alternate setting number */ + 0x01, /* Number of end points */ + 0xFF, /* Interface class */ + 0x00, /* Interface sub class */ + 0x00, /* Interface protocol code */ + 0x00, /* Interface descriptor string index */ + + /* Endpoint descriptor for producer EP */ + 0x07, /* Descriptor size */ + CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */ + BLADE_FPGA_EP_PRODUCER, /* Endpoint address and description */ + CY_U3P_USB_EP_BULK, /* Bulk endpoint type */ + 0x00,0x04, /* Max packet size = 1024 bytes */ + 0x00, /* Servicing interval for data transfers : 0 for bulk */ + + /* Super speed endpoint companion descriptor for producer EP */ + 0x06, /* Descriptor size */ + CY_U3P_SS_EP_COMPN_DESCR, /* SS endpoint companion descriptor type */ + 0x01, /* Max no. of packets in a burst : 0: burst 1 packet at a time */ + 0x00, /* Max streams for bulk EP = 0 (No streams) */ + 0x00,0x00, /* Service interval for the EP : 0 for bulk */ + + + + /* Interface descriptor #1 */ + 0x09, /* Descriptor size */ + CY_U3P_USB_INTRFC_DESCR, /* Interface Descriptor type */ + 0x01, /* Interface number */ + 0x00, /* Alternate setting number */ + 0x04, /* Number of end points */ + 0xFF, /* Interface class */ + 0x00, /* Interface sub class */ + 0x00, /* Interface protocol code */ + 0x00, /* Interface descriptor string index */ + + /* Endpoint descriptor for consumer EP */ + 0x07, /* Descriptor size */ + CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */ + CY_FX_EP_CONSUMER, /* Endpoint address and description */ + CY_U3P_USB_EP_BULK, /* Bulk endpoint type */ + 0x00,0x04, /* Max packet size = 1024 bytes */ + 0x00, /* Servicing interval for data transfers : 0 for Bulk */ + + /* Super speed endpoint companion descriptor for consumer EP */ + 0x06, /* Descriptor size */ + CY_U3P_SS_EP_COMPN_DESCR, /* SS endpoint companion descriptor type */ + 0x0f, /* Max no. of packets in a burst : 0: burst 1 packet at a time */ + 0x00, /* Max streams for bulk EP = 0 (No streams) */ + 0x00,0x00, /* Service interval for the EP : 0 for bulk */ + + /* Endpoint descriptor for producer EP */ + 0x07, /* Descriptor size */ + CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */ + CY_FX_EP_PRODUCER, /* Endpoint address and description */ + CY_U3P_USB_EP_BULK, /* Bulk endpoint type */ + 0x00,0x04, /* Max packet size = 1024 bytes */ + 0x00, /* Servicing interval for data transfers : 0 for bulk */ + + /* Super speed endpoint companion descriptor for producer EP */ + 0x06, /* Descriptor size */ + CY_U3P_SS_EP_COMPN_DESCR, /* SS endpoint companion descriptor type */ + 0x0f, /* Max no. of packets in a burst : 0: burst 1 packet at a time */ + 0x00, /* Max streams for bulk EP = 0 (No streams) */ + 0x00,0x00, /* Service interval for the EP : 0 for bulk */ + + /* Endpoint descriptor for consumer EP */ + 0x07, /* Descriptor size */ + CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */ + 0x82, /* Endpoint address and description */ + CY_U3P_USB_EP_BULK, /* Bulk endpoint type */ + 0x00,0x04, /* Max packet size = 1024 bytes */ + 0x00, /* Servicing interval for data transfers : 0 for Bulk */ + + /* Super speed endpoint companion descriptor for consumer EP */ + 0x06, /* Descriptor size */ + CY_U3P_SS_EP_COMPN_DESCR, /* SS endpoint companion descriptor type */ + 0x01, /* Max no. of packets in a burst : 0: burst 1 packet at a time */ + 0x00, /* Max streams for bulk EP = 0 (No streams) */ + 0x00,0x00, /* Service interval for the EP : 0 for bulk */ + + /* Endpoint descriptor for producer EP */ + 0x07, /* Descriptor size */ + CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */ + BLADE_FPGA_EP_PRODUCER, /* Endpoint address and description */ + CY_U3P_USB_EP_BULK, /* Bulk endpoint type */ + 0x00,0x04, /* Max packet size = 1024 bytes */ + 0x00, /* Servicing interval for data transfers : 0 for bulk */ + + /* Super speed endpoint companion descriptor for producer EP */ + 0x06, /* Descriptor size */ + CY_U3P_SS_EP_COMPN_DESCR, /* SS endpoint companion descriptor type */ + 0x0f, /* Max no. of packets in a burst : 0: burst 1 packet at a time */ + 0x00, /* Max streams for bulk EP = 0 (No streams) */ + 0x00,0x00, /* Service interval for the EP : 0 for bulk */ + + + /* Interface descriptor #2*/ + 0x09, /* Descriptor size */ + CY_U3P_USB_INTRFC_DESCR, /* Interface Descriptor type */ + 0x02, /* Interface number */ + 0x00, /* Alternate setting number */ + 0x01, /* Number of end points */ + 0xFF, /* Interface class */ + 0x00, /* Interface sub class */ + 0x00, /* Interface protocol code */ + 0x00, /* Interface descriptor string index */ + + /* Endpoint descriptor for producer EP */ + 0x07, /* Descriptor size */ + CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */ + BLADE_FPGA_EP_PRODUCER, /* Endpoint address and description */ + CY_U3P_USB_EP_BULK, /* Bulk endpoint type */ + 0x00,0x04, /* Max packet size = 1024 bytes */ + 0x00, /* Servicing interval for data transfers : 0 for bulk */ + + /* Super speed endpoint companion descriptor for producer EP */ + 0x06, /* Descriptor size */ + CY_U3P_SS_EP_COMPN_DESCR, /* SS endpoint companion descriptor type */ + 0x01, /* Max no. of packets in a burst : 0: burst 1 packet at a time */ + 0x00, /* Max streams for bulk EP = 0 (No streams) */ + 0x00,0x00, /* Service interval for the EP : 0 for bulk */ + + + + +}; + +/* Standard high speed configuration descriptor */ +const uint8_t CyFxUSBHSConfigDscr[] __attribute__ ((aligned (32))) = +{ + /* Configuration descriptor */ + 0x09, /* Descriptor size */ + CY_U3P_USB_CONFIG_DESCR, /* Configuration descriptor type */ + 0x55,0x00, /* Length of this descriptor and all sub descriptors */ + 0x03, /* Number of interfaces */ + 0x01, /* Configuration number */ + 0x00, /* COnfiguration string index */ + 0x80, /* Config characteristics - bus powered */ + 0x32, /* Max power consumption of device (in 2mA unit) : 100mA */ + + /* Interface descriptor #0 */ + 0x09, /* Descriptor size */ + CY_U3P_USB_INTRFC_DESCR, /* Interface Descriptor type */ + 0x00, /* Interface number */ + 0x00, /* Alternate setting number */ + 0x02, /* Number of endpoints */ + 0xFF, /* Interface class */ + 0x00, /* Interface sub class */ + 0x00, /* Interface protocol code */ + 0x00, /* Interface descriptor string index */ + + /* Endpoint descriptor for producer EP */ + 0x07, /* Descriptor size */ + CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */ + CY_FX_EP_PRODUCER, /* Endpoint address and description */ + CY_U3P_USB_EP_BULK, /* Bulk endpoint type */ + 0x00,0x02, /* Max packet size = 512 bytes */ + 0x00, /* Servicing interval for data transfers : 0 for bulk */ + + /* Endpoint descriptor for producer EP */ + 0x07, /* Descriptor size */ + CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */ + BLADE_FPGA_EP_PRODUCER, /* Endpoint address and description */ + CY_U3P_USB_EP_BULK, /* Bulk endpoint type */ + 0x00,0x02, /* Max packet size = 512 bytes */ + 0x00, /* Servicing interval for data transfers : 0 for bulk */ + + /* Interface descriptor #1 */ + 0x09, /* Descriptor size */ + CY_U3P_USB_INTRFC_DESCR, /* Interface Descriptor type */ + 0x01, /* Interface number */ + 0x00, /* Alternate setting number */ + 0x04, /* Number of endpoints */ + 0xFF, /* Interface class */ + 0x00, /* Interface sub class */ + 0x00, /* Interface protocol code */ + 0x00, /* Interface descriptor string index */ + + /* Endpoint descriptor for producer EP */ + 0x07, /* Descriptor size */ + CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */ + 0x01, /* Endpoint address and description */ + CY_U3P_USB_EP_BULK, /* Bulk endpoint type */ + 0x00,0x02, /* Max packet size = 512 bytes */ + 0x00, /* Servicing interval for data transfers : 0 for bulk */ + + /* Endpoint descriptor for producer EP */ + 0x07, /* Descriptor size */ + CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */ + 0x81, /* Endpoint address and description */ + CY_U3P_USB_EP_BULK, /* Bulk endpoint type */ + 0x00,0x02, /* Max packet size = 512 bytes */ + 0x00, /* Servicing interval for data transfers : 0 for bulk */ + + /* Endpoint descriptor for producer EP */ + 0x07, /* Descriptor size */ + CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */ + 0x02, /* Endpoint address and description */ + CY_U3P_USB_EP_BULK, /* Bulk endpoint type */ + 0x00,0x02, /* Max packet size = 512 bytes */ + 0x00, /* Servicing interval for data transfers : 0 for bulk */ + + /* Endpoint descriptor for producer EP */ + 0x07, /* Descriptor size */ + CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */ + 0x82, /* Endpoint address and description */ + CY_U3P_USB_EP_BULK, /* Bulk endpoint type */ + 0x00,0x02, /* Max packet size = 512 bytes */ + 0x00, /* Servicing interval for data transfers : 0 for bulk */ + + /* Interface descriptor #2 */ + 0x09, /* Descriptor size */ + CY_U3P_USB_INTRFC_DESCR, /* Interface Descriptor type */ + 0x02, /* Interface number */ + 0x00, /* Alternate setting number */ + 0x01, /* Number of endpoints */ + 0xFF, /* Interface class */ + 0x00, /* Interface sub class */ + 0x00, /* Interface protocol code */ + 0x00, /* Interface descriptor string index */ + + /* Endpoint descriptor for producer EP */ + 0x07, /* Descriptor size */ + CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */ + 0x01, /* Endpoint address and description */ + CY_U3P_USB_EP_BULK, /* Bulk endpoint type */ + 0x00,0x02, /* Max packet size = 512 bytes */ + 0x00, /* Servicing interval for data transfers : 0 for bulk */ +}; + +/* Standard full speed configuration descriptor */ +const uint8_t CyFxUSBFSConfigDscr[] __attribute__ ((aligned (32))) = +{ + /* Configuration descriptor */ + 0x09, /* Descriptor size */ + CY_U3P_USB_CONFIG_DESCR, /* Configuration descriptor type */ + 0x20,0x00, /* Length of this descriptor and all sub descriptors */ + 0x01, /* Number of interfaces */ + 0x01, /* Configuration number */ + 0x00, /* COnfiguration string index */ + 0x80, /* Config characteristics - bus powered */ + 0x32, /* Max power consumption of device (in 2mA unit) : 100mA */ + + /* Interface descriptor */ + 0x09, /* Descriptor size */ + CY_U3P_USB_INTRFC_DESCR, /* Interface descriptor type */ + 0x00, /* Interface number */ + 0x00, /* Alternate setting number */ + 0x03, /* Number of endpoints */ + 0xFF, /* Interface class */ + 0x00, /* Interface sub class */ + 0x00, /* Interface protocol code */ + 0x00, /* Interface descriptor string index */ + + /* Endpoint descriptor for producer EP */ + 0x07, /* Descriptor size */ + CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */ + CY_FX_EP_PRODUCER, /* Endpoint address and description */ + CY_U3P_USB_EP_BULK, /* Bulk endpoint type */ + 0x40,0x00, /* Max packet size = 64 bytes */ + 0x00, /* Servicing interval for data transfers : 0 for bulk */ + + /* Endpoint descriptor for producer EP */ + 0x07, /* Descriptor size */ + CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */ + BLADE_FPGA_EP_PRODUCER, /* Endpoint address and description */ + CY_U3P_USB_EP_BULK, /* Bulk endpoint type */ + 0x40,0x00, /* Max packet size = 64 bytes */ + 0x00, /* Servicing interval for data transfers : 0 for bulk */ + + /* Endpoint descriptor for consumer EP */ + 0x07, /* Descriptor size */ + CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */ + CY_FX_EP_CONSUMER, /* Endpoint address and description */ + CY_U3P_USB_EP_BULK, /* Bulk endpoint type */ + 0x40,0x00, /* Max packet size = 64 bytes */ + 0x00 /* Servicing interval for data transfers : 0 for bulk */ +}; + +/* Standard language ID string descriptor */ +const uint8_t CyFxUSBStringLangIDDscr[] __attribute__ ((aligned (32))) = +{ + 0x04, /* Descriptor size */ + CY_U3P_USB_STRING_DESCR, /* Device descriptor type */ + 0x09,0x04 /* Language ID supported */ +}; + +/* Standard manufacturer string descriptor */ +const uint8_t CyFxUSBManufactureDscr[] __attribute__ ((aligned (32))) = +{ + 0x0C, /* Descriptor size */ + CY_U3P_USB_STRING_DESCR, /* Device descriptor type */ + 'N',0x00, + 'u',0x00, + 'a',0x00, + 'n',0x00, + 'd',0x00, +}; + +/* Standard product string descriptor */ +const uint8_t CyFxUSBProductDscr[] __attribute__ ((aligned (32))) = +{ + 0x10, /* Descriptor size */ + CY_U3P_USB_STRING_DESCR, /* Device descriptor type */ + 'b',0x00, + 'l',0x00, + 'a',0x00, + 'd',0x00, + 'e',0x00, + 'R',0x00, + 'F',0x00 +}; + +/* Place this buffer as the last buffer so that no other variable / code shares + * the same cache line. Do not add any other variables / arrays in this file. + * This will lead to variables sharing the same cache line. */ +const uint8_t CyFxUsbDscrAlignBuffer[32] __attribute__ ((aligned (32))); + +/* [ ] */ + diff --git a/fx3_firmware/cyfxgpif_C4loader.h b/fx3_firmware/cyfxgpif_C4loader.h new file mode 100644 index 00000000..93141909 --- /dev/null +++ b/fx3_firmware/cyfxgpif_C4loader.h @@ -0,0 +1,168 @@ +/* + * Project Name: c4loader.cyfx + * Time : 01/12/2013 00:49:46 + * Device Type: FX3 + * Project Type: GPIF2 + * + * + * + * + * This is a generated file and should not be modified + * This file need to be included only once in the firmware + * This file is generated by Gpif2 designer tool version - 1.0.837.1 + * + */ + +#ifndef _INCLUDED_CYFXGPIF2CONFIG_ +#define _INCLUDED_CYFXGPIF2CONFIG_ +#include "cyu3types.h" +#include "cyu3gpif.h" + +/* Summary + Number of states in the state machine + */ +#define CY_C4LOADER_NUMBER_OF_STATES 7 + +/* Summary + Mapping of user defined state names to state indices + */ +#define C4LOADER_START 0x0 +#define C4LOADER_STATE0 0x2 +#define C4LOADER_INIT 0x1 +#define C4LOADER_STATE2 0x4 +#define C4LOADER_STATE3 0x5 +#define C4LOADER_STATE1 0x3 +#define C4LOADER_STATE4 0x6 + + +/* Summary + Initial value of early outputs from the state machine. + */ +#define C4LOADER_ALPHA_START 0x0 + + +/* Summary + Transition function values used in the state machine. + */ +uint16_t C4loader_CyFxGpifTransition[] = { + 0x0000, 0xAAAA, 0xFFFF +}; + +/* Summary + Table containing the transition information for various states. + This table has to be stored in the WAVEFORM Registers. + This array consists of non-replicated waveform descriptors and acts as a + waveform table. + */ +CyU3PGpifWaveData C4loader_CyFxGpifWavedata[] = { + {{0x1E739A01,0x0C0000C0,0x80000000},{0x00000000,0x00000000,0x00000000}}, + {{0x2E739C02,0x0C000040,0x80000000},{0x00000000,0x00000000,0x00000000}}, + {{0x2E739C03,0x00400040,0x80000000},{0x00000000,0x00000000,0x00000000}}, + {{0x2E739C04,0x00000040,0x80000000},{0x00000000,0x00000000,0x00000000}}, + {{0x2E739C05,0x00400040,0x80000000},{0x00000000,0x00000000,0x00000000}}, + {{0x1E739A06,0x0C0000C0,0x80000000},{0x00000000,0x00000000,0x00000000}} +}; + +/* Summary + Table that maps state indices to the descriptor table indices. + */ +uint8_t C4loader_CyFxGpifWavedataPosition[] = { + 0,1,2,3,4,5,1 +}; + +/* Summary + GPIF II configuration register values. + */ +uint32_t C4loader_CyFxGpifRegValue[] = { + 0x800083B0, /* CY_U3P_PIB_GPIF_CONFIG */ + 0x00000067, /* CY_U3P_PIB_GPIF_BUS_CONFIG */ + 0x00000000, /* CY_U3P_PIB_GPIF_BUS_CONFIG2 */ + 0x00000052, /* CY_U3P_PIB_GPIF_AD_CONFIG */ + 0x00000000, /* CY_U3P_PIB_GPIF_STATUS */ + 0x00000000, /* CY_U3P_PIB_GPIF_INTR */ + 0x00000000, /* CY_U3P_PIB_GPIF_INTR_MASK */ + 0x00000082, /* CY_U3P_PIB_GPIF_SERIAL_IN_CONFIG */ + 0x00000782, /* CY_U3P_PIB_GPIF_SERIAL_OUT_CONFIG */ + 0x54040000, /* CY_U3P_PIB_GPIF_CTRL_BUS_DIRECTION */ + 0x0000FFFF, /* CY_U3P_PIB_GPIF_CTRL_BUS_DEFAULT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_POLARITY */ + 0x00000200, /* CY_U3P_PIB_GPIF_CTRL_BUS_TOGGLE */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000008, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000006, /* CY_U3P_PIB_GPIF_CTRL_COUNT_CONFIG */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_COUNT_RESET */ + 0x0000FFFF, /* CY_U3P_PIB_GPIF_CTRL_COUNT_LIMIT */ + 0x0000010A, /* CY_U3P_PIB_GPIF_ADDR_COUNT_CONFIG */ + 0x00000000, /* CY_U3P_PIB_GPIF_ADDR_COUNT_RESET */ + 0x0000FFFF, /* CY_U3P_PIB_GPIF_ADDR_COUNT_LIMIT */ + 0x00000000, /* CY_U3P_PIB_GPIF_STATE_COUNT_CONFIG */ + 0x0000FFFF, /* CY_U3P_PIB_GPIF_STATE_COUNT_LIMIT */ + 0x0000010A, /* CY_U3P_PIB_GPIF_DATA_COUNT_CONFIG */ + 0x00000000, /* CY_U3P_PIB_GPIF_DATA_COUNT_RESET */ + 0x0000FFFF, /* CY_U3P_PIB_GPIF_DATA_COUNT_LIMIT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_COMP_VALUE */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_COMP_MASK */ + 0x00000000, /* CY_U3P_PIB_GPIF_DATA_COMP_VALUE */ + 0x00000000, /* CY_U3P_PIB_GPIF_DATA_COMP_MASK */ + 0x00000000, /* CY_U3P_PIB_GPIF_ADDR_COMP_VALUE */ + 0x00000000, /* CY_U3P_PIB_GPIF_ADDR_COMP_MASK */ + 0x00000000, /* CY_U3P_PIB_GPIF_DATA_CTRL */ + 0x00000000, /* CY_U3P_PIB_GPIF_INGRESS_DATA */ + 0x00000000, /* CY_U3P_PIB_GPIF_INGRESS_DATA */ + 0x00000000, /* CY_U3P_PIB_GPIF_INGRESS_DATA */ + 0x00000000, /* CY_U3P_PIB_GPIF_INGRESS_DATA */ + 0x00000000, /* CY_U3P_PIB_GPIF_EGRESS_DATA */ + 0x00000000, /* CY_U3P_PIB_GPIF_EGRESS_DATA */ + 0x00000000, /* CY_U3P_PIB_GPIF_EGRESS_DATA */ + 0x00000000, /* CY_U3P_PIB_GPIF_EGRESS_DATA */ + 0x00000000, /* CY_U3P_PIB_GPIF_INGRESS_ADDRESS */ + 0x00000000, /* CY_U3P_PIB_GPIF_INGRESS_ADDRESS */ + 0x00000000, /* CY_U3P_PIB_GPIF_INGRESS_ADDRESS */ + 0x00000000, /* CY_U3P_PIB_GPIF_INGRESS_ADDRESS */ + 0x00000000, /* CY_U3P_PIB_GPIF_EGRESS_ADDRESS */ + 0x00000000, /* CY_U3P_PIB_GPIF_EGRESS_ADDRESS */ + 0x00000000, /* CY_U3P_PIB_GPIF_EGRESS_ADDRESS */ + 0x00000000, /* CY_U3P_PIB_GPIF_EGRESS_ADDRESS */ + 0x80010400, /* CY_U3P_PIB_GPIF_THREAD_CONFIG */ + 0x80010401, /* CY_U3P_PIB_GPIF_THREAD_CONFIG */ + 0x80010402, /* CY_U3P_PIB_GPIF_THREAD_CONFIG */ + 0x80010403, /* CY_U3P_PIB_GPIF_THREAD_CONFIG */ + 0x00000000, /* CY_U3P_PIB_GPIF_LAMBDA_STAT */ + 0x00000000, /* CY_U3P_PIB_GPIF_ALPHA_STAT */ + 0x00000000, /* CY_U3P_PIB_GPIF_BETA_STAT */ + 0x00000000, /* CY_U3P_PIB_GPIF_WAVEFORM_CTRL_STAT */ + 0x00000000, /* CY_U3P_PIB_GPIF_WAVEFORM_SWITCH */ + 0x00000000, /* CY_U3P_PIB_GPIF_WAVEFORM_SWITCH_TIMEOUT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CRC_CONFIG */ + 0x00000000, /* CY_U3P_PIB_GPIF_CRC_DATA */ + 0xFFFFFFC1 /* CY_U3P_PIB_GPIF_BETA_DEASSERT */ +}; + +/* Summary + This structure holds all the configuration inputs for the GPIF II. + */ +const CyU3PGpifConfig_t C4loader_CyFxGpifConfig = { + (uint16_t)(sizeof(C4loader_CyFxGpifWavedataPosition)/sizeof(uint8_t)), + C4loader_CyFxGpifWavedata, + C4loader_CyFxGpifWavedataPosition, + (uint16_t)(sizeof(C4loader_CyFxGpifTransition)/sizeof(uint16_t)), + C4loader_CyFxGpifTransition, + (uint16_t)(sizeof(C4loader_CyFxGpifRegValue)/sizeof(uint32_t)), + C4loader_CyFxGpifRegValue +}; + +#endif /* _INCLUDED_CYFXGPIF2CONFIG_ */ diff --git a/fx3_firmware/cyfxgpif_RFlink.h b/fx3_firmware/cyfxgpif_RFlink.h new file mode 100644 index 00000000..766de00c --- /dev/null +++ b/fx3_firmware/cyfxgpif_RFlink.h @@ -0,0 +1,171 @@ +/* + * Project Name: RFlink.cyfx + * Time : 01/20/2013 22:51:22 + * Device Type: FX3 + * Project Type: GPIF2 + * + * + * + * + * This is a generated file and should not be modified + * This file need to be included only once in the firmware + * This file is generated by Gpif2 designer tool version - 1.0.837.1 + * + */ + +#ifndef _INCLUDED_CYFXGPIF2CONFIG_RF_ +#define _INCLUDED_CYFXGPIF2CONFIG_RF_ +#include "cyu3types.h" +#include "cyu3gpif.h" + +/* Summary + Number of states in the state machine + */ +#define CY_RFLINK_NUMBER_OF_STATES 10 + +/* Summary + Mapping of user defined state names to state indices + */ +#define RFLINK_START 0x0 +#define RFLINK_INIT 0x1 +#define RFLINK_IF_RX_0 0x3 +#define RFLINK_IF_RX_1 0x5 +#define RFLINK_IF_TX_2 0x6 +#define RFLINK_DONE 0x4 +#define RFLINK_WAIT_0 0x2 +#define RFLINK_IF_TX_3 0x9 +#define RFLINK_IF_TX 0x7 +#define RFLINK_IF_RX 0x8 + + +/* Summary + Initial value of early outputs from the state machine. + */ +#define RFLINK_ALPHA_START 0x80 + + +/* Summary + Transition function values used in the state machine. + */ +uint16_t Rflink_CyFxGpifTransition[] = { + 0x0000, 0xAAAA, 0x5555, 0xCCCC, 0xFFFF, 0xEEEE, 0xFFF0 +}; + +/* Summary + Table containing the transition information for various states. + This table has to be stored in the WAVEFORM Registers. + This array consists of non-replicated waveform descriptors and acts as a + waveform table. + */ +CyU3PGpifWaveData Rflink_CyFxGpifWavedata[] = { + {{0x4E739C01,0x00001000,0x80000000},{0x00000000,0x00000000,0x00000000}}, + {{0x50806202,0x0000000C,0x80000000},{0x00000000,0x00000000,0x00000000}}, + {{0x1E706207,0x0C00C0C6,0x80000000},{0x1E702008,0x00010106,0x80000000}}, + {{0x4E739C04,0x00001000,0x80000000},{0x00000000,0x00000000,0x00000000}}, + {{0x2E739A06,0x08000000,0x80000000},{0x2E739A09,0x0C000000,0x80000000}}, + {{0x2E739A03,0x20000000,0x80000000},{0x2E739A05,0x24000000,0x80000000}} +}; + +/* Summary + Table that maps state indices to the descriptor table indices. + */ +uint8_t Rflink_CyFxGpifWavedataPosition[] = { + 0,1,2,3,1,3,3,4,5,3 +}; + +/* Summary + GPIF II configuration register values. + */ +uint32_t Rflink_CyFxGpifRegValue[] = { + 0x800083B0, /* CY_U3P_PIB_GPIF_CONFIG */ + 0x0000006C, /* CY_U3P_PIB_GPIF_BUS_CONFIG */ + 0x00000000, /* CY_U3P_PIB_GPIF_BUS_CONFIG2 */ + 0x00000052, /* CY_U3P_PIB_GPIF_AD_CONFIG */ + 0x00000000, /* CY_U3P_PIB_GPIF_STATUS */ + 0x00000000, /* CY_U3P_PIB_GPIF_INTR */ + 0x00000000, /* CY_U3P_PIB_GPIF_INTR_MASK */ + 0x00000082, /* CY_U3P_PIB_GPIF_SERIAL_IN_CONFIG */ + 0x00000782, /* CY_U3P_PIB_GPIF_SERIAL_OUT_CONFIG */ + 0x55515500, /* CY_U3P_PIB_GPIF_CTRL_BUS_DIRECTION */ + 0x0000FF70, /* CY_U3P_PIB_GPIF_CTRL_BUS_DEFAULT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_POLARITY */ + 0x00000080, /* CY_U3P_PIB_GPIF_CTRL_BUS_TOGGLE */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000001, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000002, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000003, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000010, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000012, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000013, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000011, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_BUS_SELECT */ + 0x00000006, /* CY_U3P_PIB_GPIF_CTRL_COUNT_CONFIG */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_COUNT_RESET */ + 0x0000FFFF, /* CY_U3P_PIB_GPIF_CTRL_COUNT_LIMIT */ + 0x0000010A, /* CY_U3P_PIB_GPIF_ADDR_COUNT_CONFIG */ + 0x00000000, /* CY_U3P_PIB_GPIF_ADDR_COUNT_RESET */ + 0x0000FFFF, /* CY_U3P_PIB_GPIF_ADDR_COUNT_LIMIT */ + 0x00000000, /* CY_U3P_PIB_GPIF_STATE_COUNT_CONFIG */ + 0x0000FFFF, /* CY_U3P_PIB_GPIF_STATE_COUNT_LIMIT */ + 0x0000010A, /* CY_U3P_PIB_GPIF_DATA_COUNT_CONFIG */ + 0x00000000, /* CY_U3P_PIB_GPIF_DATA_COUNT_RESET */ + 0x0000FFFF, /* CY_U3P_PIB_GPIF_DATA_COUNT_LIMIT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_COMP_VALUE */ + 0x00000000, /* CY_U3P_PIB_GPIF_CTRL_COMP_MASK */ + 0x00000000, /* CY_U3P_PIB_GPIF_DATA_COMP_VALUE */ + 0x00000000, /* CY_U3P_PIB_GPIF_DATA_COMP_MASK */ + 0x00000000, /* CY_U3P_PIB_GPIF_ADDR_COMP_VALUE */ + 0x00000000, /* CY_U3P_PIB_GPIF_ADDR_COMP_MASK */ + 0x00000000, /* CY_U3P_PIB_GPIF_DATA_CTRL */ + 0x00000000, /* CY_U3P_PIB_GPIF_INGRESS_DATA */ + 0x00000000, /* CY_U3P_PIB_GPIF_INGRESS_DATA */ + 0x00000000, /* CY_U3P_PIB_GPIF_INGRESS_DATA */ + 0x00000000, /* CY_U3P_PIB_GPIF_INGRESS_DATA */ + 0x00000000, /* CY_U3P_PIB_GPIF_EGRESS_DATA */ + 0x00000000, /* CY_U3P_PIB_GPIF_EGRESS_DATA */ + 0x00000000, /* CY_U3P_PIB_GPIF_EGRESS_DATA */ + 0x00000000, /* CY_U3P_PIB_GPIF_EGRESS_DATA */ + 0x00000000, /* CY_U3P_PIB_GPIF_INGRESS_ADDRESS */ + 0x00000000, /* CY_U3P_PIB_GPIF_INGRESS_ADDRESS */ + 0x00000000, /* CY_U3P_PIB_GPIF_INGRESS_ADDRESS */ + 0x00000000, /* CY_U3P_PIB_GPIF_INGRESS_ADDRESS */ + 0x00000000, /* CY_U3P_PIB_GPIF_EGRESS_ADDRESS */ + 0x00000000, /* CY_U3P_PIB_GPIF_EGRESS_ADDRESS */ + 0x00000000, /* CY_U3P_PIB_GPIF_EGRESS_ADDRESS */ + 0x00000000, /* CY_U3P_PIB_GPIF_EGRESS_ADDRESS */ + 0x80010400, /* CY_U3P_PIB_GPIF_THREAD_CONFIG */ + 0x80010401, /* CY_U3P_PIB_GPIF_THREAD_CONFIG */ + 0x80010402, /* CY_U3P_PIB_GPIF_THREAD_CONFIG */ + 0x80010403, /* CY_U3P_PIB_GPIF_THREAD_CONFIG */ + 0x00000000, /* CY_U3P_PIB_GPIF_LAMBDA_STAT */ + 0x00000000, /* CY_U3P_PIB_GPIF_ALPHA_STAT */ + 0x00000000, /* CY_U3P_PIB_GPIF_BETA_STAT */ + 0x00800000, /* CY_U3P_PIB_GPIF_WAVEFORM_CTRL_STAT */ + 0x00000000, /* CY_U3P_PIB_GPIF_WAVEFORM_SWITCH */ + 0x00000000, /* CY_U3P_PIB_GPIF_WAVEFORM_SWITCH_TIMEOUT */ + 0x00000000, /* CY_U3P_PIB_GPIF_CRC_CONFIG */ + 0x00000000, /* CY_U3P_PIB_GPIF_CRC_DATA */ + 0xFFFFFFC1 /* CY_U3P_PIB_GPIF_BETA_DEASSERT */ +}; + +/* Summary + This structure holds all the configuration inputs for the GPIF II. + */ +const CyU3PGpifConfig_t Rflink_CyFxGpifConfig = { + (uint16_t)(sizeof(Rflink_CyFxGpifWavedataPosition)/sizeof(uint8_t)), + Rflink_CyFxGpifWavedata, + Rflink_CyFxGpifWavedataPosition, + (uint16_t)(sizeof(Rflink_CyFxGpifTransition)/sizeof(uint16_t)), + Rflink_CyFxGpifTransition, + (uint16_t)(sizeof(Rflink_CyFxGpifRegValue)/sizeof(uint32_t)), + Rflink_CyFxGpifRegValue +}; + +#endif /* _INCLUDED_CYFXGPIF2CONFIG_ */ diff --git a/fx3_firmware/makefile b/fx3_firmware/makefile new file mode 100644 index 00000000..a8dbe6be --- /dev/null +++ b/fx3_firmware/makefile @@ -0,0 +1,34 @@ +FX3FWROOT="C:/Cypress/EZ-USB FX3 SDK/1.2/firmware" +FX3PFWROOT="C:/Cypress/EZ-USB FX3 SDK/1.2/firmware/u3p_firmware" + +all:compile + +include $(FX3FWROOT)/common/fx3_build_config.mak + +MODULE = bladeRF + + +SOURCE += $(MODULE).c + +C_OBJECT=$(SOURCE:%.c=./%.o) +A_OBJECT=$(SOURCE_ASM:%.S=./%.o) + +EXES = $(MODULE).$(EXEEXT) + +$(MODULE).$(EXEEXT): $(A_OBJECT) $(C_OBJECT) + $(LINK) + +$(C_OBJECT) : %.o : %.c + $(COMPILE) + +$(A_OBJECT) : %.o : %.S + $(ASSEMBLE) + +clean: + rm -f ./$(MODULE).$(EXEEXT) + rm -f ./$(MODULE).map + rm -f ./*.o + +compile: $(C_OBJECT) $(A_OBJECT) $(EXES) + +#[]# diff --git a/fx3_firmware/spi_flash_lib.c b/fx3_firmware/spi_flash_lib.c new file mode 100644 index 00000000..3b0dba30 --- /dev/null +++ b/fx3_firmware/spi_flash_lib.c @@ -0,0 +1,223 @@ +/* + * spi_flash_lib.c + * + * Created on: Feb 13, 2013 + * Author: Robert + */ + +#include "cyu3system.h" +#include "cyu3os.h" +#include "cyu3dma.h" +#include "cyu3error.h" +#include "cyu3usb.h" +#include "cyu3uart.h" +#include "bladeRF.h" +#include "cyu3gpif.h" +#include "cyu3pib.h" +#include "cyu3gpio.h" +#include "pib_regs.h" + +#include "cyu3spi.h" +uint16_t glSpiPageSize = 0x100; /* SPI Page size to be used for transfers. */ + +/* SPI initialization for application. */ +CyU3PReturnStatus_t CyFxSpiInit(uint16_t pageLen) +{ + CyU3PSpiConfig_t spiConfig; + CyU3PReturnStatus_t status = CY_U3P_SUCCESS; + + /* Start the SPI module and configure the master. */ + status = CyU3PSpiInit(); + if (status != CY_U3P_SUCCESS) { + return status; + } + + /* Start the SPI master block. Run the SPI clock at 8MHz + * and configure the word length to 8 bits. Also configure + * the slave select using FW. */ + CyU3PMemSet((uint8_t *)&spiConfig, 0, sizeof(spiConfig)); + spiConfig.isLsbFirst = CyFalse; + spiConfig.cpol = CyTrue; + spiConfig.ssnPol = CyFalse; + spiConfig.cpha = CyTrue; + spiConfig.leadTime = CY_U3P_SPI_SSN_LAG_LEAD_HALF_CLK; + spiConfig.lagTime = CY_U3P_SPI_SSN_LAG_LEAD_HALF_CLK; + spiConfig.ssnCtrl = CY_U3P_SPI_SSN_CTRL_FW; + spiConfig.clock = 8000000; + spiConfig.wordLen = 8; + + status = CyU3PSpiSetConfig(&spiConfig, NULL); + + return status; +} + +/* Wait for the status response from the SPI flash. */ +CyU3PReturnStatus_t CyFxSpiWaitForStatus(void) +{ + uint8_t buf[2], rd_buf[2]; + CyU3PReturnStatus_t status = CY_U3P_SUCCESS; + + /* Wait for status response from SPI flash device. */ + do { + buf[0] = 0x06; /* Write enable command. */ + + CyU3PSpiSetSsnLine(CyFalse); + status = CyU3PSpiTransmitWords (buf, 1); + CyU3PSpiSetSsnLine(CyTrue); + if (status != CY_U3P_SUCCESS) { + CyU3PDebugPrint (2, "SPI WR_ENABLE command failed\n\r"); + return status; + } + + buf[0] = 0x05; /* Read status command */ + + CyU3PSpiSetSsnLine(CyFalse); + status = CyU3PSpiTransmitWords(buf, 1); + if (status != CY_U3P_SUCCESS) { + CyU3PDebugPrint(2, "SPI READ_STATUS command failed\n\r"); + CyU3PSpiSetSsnLine(CyTrue); + return status; + } + + status = CyU3PSpiReceiveWords(rd_buf, 2); + CyU3PSpiSetSsnLine(CyTrue); + if(status != CY_U3P_SUCCESS) { + CyU3PDebugPrint(2, "SPI status read failed\n\r"); + return status; + } + + } while ((rd_buf[0] & 1) || (!(rd_buf[0] & 0x2))); + + return CY_U3P_SUCCESS; +} + +/* SPI read / write for programmer application. */ +CyU3PReturnStatus_t CyFxSpiTransfer(uint16_t pageAddress, uint16_t byteCount, uint8_t *buffer, CyBool_t isRead) +{ + uint8_t location[4]; + uint32_t byteAddress = 0; + uint16_t pageCount = (byteCount / glSpiPageSize); + CyU3PReturnStatus_t status = CY_U3P_SUCCESS; + + if (byteCount == 0) { + return CY_U3P_SUCCESS; + } + + if ((byteCount % glSpiPageSize) != 0) { + pageCount ++; + } + + byteAddress = pageAddress * glSpiPageSize; + + while (pageCount != 0) { + location[1] = (byteAddress >> 16) & 0xFF; /* MS byte */ + location[2] = (byteAddress >> 8) & 0xFF; + location[3] = byteAddress & 0xFF; /* LS byte */ + + if (isRead) { + location[0] = 0x03; /* Read command. */ + + status = CyFxSpiWaitForStatus(); + if (status != CY_U3P_SUCCESS) + return status; + + CyU3PSpiSetSsnLine(CyFalse); + status = CyU3PSpiTransmitWords(location, 4); + + if (status != CY_U3P_SUCCESS) { + CyU3PDebugPrint (2, "SPI READ command failed\r\n"); + CyU3PSpiSetSsnLine (CyTrue); + return status; + } + + status = CyU3PSpiReceiveWords(buffer, glSpiPageSize); + if (status != CY_U3P_SUCCESS) { + CyU3PSpiSetSsnLine(CyTrue); + return status; + } + + CyU3PSpiSetSsnLine(CyTrue); + } else { /* Write */ + location[0] = 0x02; /* Write command */ + + status = CyFxSpiWaitForStatus(); + if (status != CY_U3P_SUCCESS) + return status; + + CyU3PSpiSetSsnLine(CyFalse); + status = CyU3PSpiTransmitWords(location, 4); + if (status != CY_U3P_SUCCESS) { + CyU3PDebugPrint(2, "SPI WRITE command failed\r\n"); + CyU3PSpiSetSsnLine(CyTrue); + return status; + } + + status = CyU3PSpiTransmitWords(buffer, glSpiPageSize); + if (status != CY_U3P_SUCCESS) { + CyU3PSpiSetSsnLine(CyTrue); + return status; + } + + CyU3PSpiSetSsnLine(CyTrue); + } + + byteAddress += glSpiPageSize; + buffer += glSpiPageSize; + pageCount--; + + CyU3PThreadSleep(15); + } + + return CY_U3P_SUCCESS; +} + +/* Function to erase SPI flash sectors. */ +CyU3PReturnStatus_t CyFxSpiEraseSector(CyBool_t isErase, uint8_t sector) +{ + uint32_t temp = 0; + uint8_t location[4], rdBuf[2]; + CyU3PReturnStatus_t status = CY_U3P_SUCCESS; + + location[0] = 0x06; /* Write enable. */ + + CyU3PSpiSetSsnLine (CyFalse); + status = CyU3PSpiTransmitWords (location, 1); + CyU3PSpiSetSsnLine (CyTrue); + if (status != CY_U3P_SUCCESS) + return status; + + if (isErase) + { + location[0] = 0xD8; /* Sector erase. */ + temp = sector * 0x10000; + location[1] = (temp >> 16) & 0xFF; + location[2] = (temp >> 8) & 0xFF; + location[3] = temp & 0xFF; + + CyU3PSpiSetSsnLine (CyFalse); + status = CyU3PSpiTransmitWords (location, 4); + CyU3PSpiSetSsnLine (CyTrue); + } + + location[0] = 0x05; /* RDSTATUS */ + do { + CyU3PSpiSetSsnLine (CyFalse); + status = CyU3PSpiTransmitWords (location, 1); + status = CyU3PSpiReceiveWords(rdBuf, 1); + CyU3PSpiSetSsnLine (CyTrue); + } while(rdBuf[0] & 1); + + return status; +} + +void NuandFirmwareStart() { + CyU3PIoMatrixConfig_t io_cfg; + CyU3PReturnStatus_t status = CY_U3P_SUCCESS; + + NuandGPIOReconfigure(CyFalse, CyFalse); + FpgaBeginProgram(); + + status = CyFxSpiInit(0x100); + + glAppMode = MODE_FW_CONFIG; +} diff --git a/hdl/fpga/ip/altera/nios_system/nios_system.qsys b/hdl/fpga/ip/altera/nios_system/nios_system.qsys new file mode 100644 index 00000000..3af52c32 --- /dev/null +++ b/hdl/fpga/ip/altera/nios_system/nios_system.qsys @@ -0,0 +1,528 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + nios2_qsys_0.jtag_debug_module + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + ]]> + + + + + NOT_LISTED 0 INSTALLED 1 IS_DEFAULT_FAMILY 0 ADDRESS_STALL 1 CELL_LEVEL_BACK_ANNOTATION_DISABLED 0 COMPILER_SUPPORT 1 DSP 0 DSP_SHIFTER_BLOCK 0 DUMP_ASM_LAB_BITS_FOR_POWER 1 EMUL 1 ENABLE_ADVANCED_IO_ANALYSIS_GUI_FEATURES 1 EPCS 1 ESB 0 FAKE1 0 FAKE2 0 FAKE3 0 FITTER_USE_FALLING_EDGE_DELAY 0 GENERATE_DC_ON_CURRENT_WARNING_FOR_INTERNAL_CLAMPING_DIODE 0 HARDCOPY 0 HAS_18_BIT_MULTS 0 HAS_ACE_SUPPORT 1 HAS_ADJUSTABLE_OUTPUT_IO_TIMING_MEAS_POINT 0 HAS_ADVANCED_IO_INVERTED_CORNER 0 HAS_ADVANCED_IO_POWER_SUPPORT 1 HAS_ADVANCED_IO_TIMING_SUPPORT 1 HAS_ALM_SUPPORT 0 HAS_ATOM_AND_ROUTING_POWER_MODELED_TOGETHER 0 HAS_AUTO_DERIVE_CLOCK_UNCERTAINTY_SUPPORT 0 HAS_AUTO_FIT_SUPPORT 1 HAS_BALANCED_OPT_TECHNIQUE_SUPPORT 1 HAS_BENEFICIAL_SKEW_SUPPORT 1 HAS_BITLEVEL_DRIVE_STRENGTH_CONTROL 1 HAS_BSDL_FILE_GENERATION 1 HAS_CGA_SUPPORT 1 HAS_CHECK_NETLIST_SUPPORT 0 HAS_CLOCK_REGION_CHECKER_ENABLED 1 HAS_CORE_JUNCTION_TEMP_DERATING 0 HAS_CROSSTALK_SUPPORT 0 HAS_CUSTOM_REGION_SUPPORT 1 HAS_DATA_DRIVEN_ACVQ_HSSI_SUPPORT 0 HAS_DDB_FDI_SUPPORT 0 HAS_DESIGN_ANALYZER_SUPPORT 1 HAS_DETAILED_IO_RAIL_POWER_MODEL 1 HAS_DETAILED_LEIM_STATIC_POWER_MODEL 1 HAS_DETAILED_LE_POWER_MODEL 1 HAS_DETAILED_ROUTING_MUX_STATIC_POWER_MODEL 1 HAS_DETAILED_THERMAL_CIRCUIT_PARAMETER_SUPPORT 1 HAS_DEVICE_MIGRATION_SUPPORT 1 HAS_DIAGONAL_MIGRATION_SUPPORT 0 HAS_EMIF_TOOLKIT_SUPPORT 0 HAS_ERROR_DETECTION_SUPPORT 0 HAS_FAMILY_VARIANT_MIGRATION_SUPPORT 0 HAS_FANOUT_FREE_NODE_SUPPORT 1 HAS_FAST_FIT_SUPPORT 1 HAS_FITTER_EARLY_TIMING_ESTIMATE_SUPPORT 1 HAS_FITTER_ECO_SUPPORT 1 HAS_FIT_NETLIST_OPT_RETIME_SUPPORT 1 HAS_FIT_NETLIST_OPT_SUPPORT 1 HAS_FORMAL_VERIFICATION_SUPPORT 1 HAS_FPGA_XCHANGE_SUPPORT 1 HAS_FSAC_LUTRAM_REGISTER_PACKING_SUPPORT 0 HAS_FULL_DAT_MIN_TIMING_SUPPORT 1 HAS_FULL_INCREMENTAL_DESIGN_SUPPORT 1 HAS_FUNCTIONAL_SIMULATION_SUPPORT 1 HAS_FUNCTIONAL_VERILOG_SIMULATION_SUPPORT 0 HAS_FUNCTIONAL_VHDL_SIMULATION_SUPPORT 0 HAS_GLITCH_FILTERING_SUPPORT 1 HAS_HC_READY_SUPPORT 0 HAS_HIGH_SPEED_LOW_POWER_TILE_SUPPORT 0 HAS_HOLD_TIME_AVOIDANCE_ACROSS_CLOCK_SPINE_SUPPORT 1 HAS_HSPICE_WRITER_SUPPORT 1 HAS_HSSI_POWER_CALCULATOR 0 HAS_IBISO_WRITER_SUPPORT 0 HAS_INCREMENTAL_DAT_SUPPORT 1 HAS_INCREMENTAL_SYNTHESIS_SUPPORT 1 HAS_IO_ASSIGNMENT_ANALYSIS_SUPPORT 1 HAS_IO_DECODER 0 HAS_IO_PLACEMENT_OPTIMIZATION_SUPPORT 1 HAS_IO_SMART_RECOMPILE_SUPPORT 0 HAS_JITTER_SUPPORT 1 HAS_JTAG_SLD_HUB_SUPPORT 1 HAS_LOGIC_LOCK_SUPPORT 1 HAS_MICROPROCESSOR 0 HAS_MIF_SMART_COMPILE_SUPPORT 1 HAS_MINMAX_TIMING_MODELING_SUPPORT 1 HAS_MIN_TIMING_ANALYSIS_SUPPORT 1 HAS_MUX_RESTRUCTURE_SUPPORT 1 HAS_NEW_HC_FLOW_SUPPORT 0 HAS_NEW_SERDES_MAX_RESOURCE_COUNT_REPORTING_SUPPORT 1 HAS_NEW_VPR_SUPPORT 1 HAS_NONSOCKET_TECHNOLOGY_MIGRATION_SUPPORT 0 HAS_NO_JTAG_USERCODE_SUPPORT 0 HAS_OPERATING_SETTINGS_AND_CONDITIONS_REPORTING_SUPPORT 1 HAS_PAD_LOCATION_ASSIGNMENT_SUPPORT 0 HAS_PARTIAL_RECONFIG_SUPPORT 0 HAS_PHYSICAL_NETLIST_OUTPUT 0 HAS_PHYSICAL_ROUTING_SUPPORT 0 HAS_PIN_SPECIFIC_VOLTAGE_SUPPORT 1 HAS_PLDM_REF_SUPPORT 1 HAS_POWER_ESTIMATION_SUPPORT 1 HAS_PRELIMINARY_CLOCK_UNCERTAINTY_NUMBERS 0 HAS_PRE_FITTER_FPP_SUPPORT 0 HAS_PRE_FITTER_LUTRAM_NETLIST_CHECKER_ENABLED 0 HAS_PVA_SUPPORT 1 HAS_RCF_SUPPORT 1 HAS_RCF_SUPPORT_FOR_DEBUGGING 0 HAS_RED_BLACK_SEPARATION_SUPPORT 0 HAS_RE_LEVEL_TIMING_GRAPH_SUPPORT 1 HAS_RISEFALL_DELAY_SUPPORT 1 HAS_SIGNAL_PROBE_SUPPORT 1 HAS_SIGNAL_TAP_SUPPORT 1 HAS_SIMULATOR_SUPPORT 0 HAS_SPLIT_IO_SUPPORT 1 HAS_SPLIT_LC_SUPPORT 1 HAS_SYNTH_FSYN_NETLIST_OPT_SUPPORT 1 HAS_SYNTH_NETLIST_OPT_RETIME_SUPPORT 1 HAS_SYNTH_NETLIST_OPT_SUPPORT 1 HAS_TECHNOLOGY_MIGRATION_SUPPORT 0 HAS_TEMPLATED_REGISTER_PACKING_SUPPORT 1 HAS_TIME_BORROWING_SUPPORT 0 HAS_TIMING_DRIVEN_SYNTHESIS_SUPPORT 1 HAS_TIMING_INFO_SUPPORT 1 HAS_TIMING_OPERATING_CONDITIONS 1 HAS_TIMING_SIMULATION_SUPPORT 1 HAS_TITAN_BASED_MAC_REGISTER_PACKER_SUPPORT 0 HAS_USER_HIGH_SPEED_LOW_POWER_TILE_SUPPORT 0 HAS_USE_FITTER_INFO_SUPPORT 1 HAS_VCCPD_POWER_RAIL 0 HAS_VERTICAL_MIGRATION_SUPPORT 1 HAS_VIEWDRAW_SYMBOL_SUPPORT 0 HAS_VIO_SUPPORT 1 HAS_VIRTUAL_DEVICES 0 HAS_WYSIWYG_DFFEAS_SUPPORT 1 HAS_XIBISO_WRITER_SUPPORT 1 INCREMENTAL_DESIGN_SUPPORTS_COMPATIBLE_CONSTRAINTS 1 IS_CONFIG_ROM 0 IS_HARDCOPY_FAMILY 0 LVDS_IO 1 M10K_MEMORY 0 M144K_MEMORY 0 M20K_MEMORY 0 M4K_MEMORY 0 M512_MEMORY 0 M9K_MEMORY 1 MLAB_MEMORY 0 MRAM_MEMORY 0 NO_RPE_SUPPORT 0 NO_SUPPORT_FOR_LOGICLOCK_CONTENT_BACK_ANNOTATION 1 NO_SUPPORT_FOR_STA_CLOCK_UNCERTAINTY_CHECK 0 NO_TDC_SUPPORT 0 POSTFIT_BAK_DATABASE_EXPORT_ENABLED 1 POSTMAP_BAK_DATABASE_EXPORT_ENABLED 1 PROGRAMMER_SUPPORT 1 QFIT_IN_DEVELOPMENT 0 QMAP_IN_DEVELOPMENT 0 RAM_LOGICAL_NAME_CHECKING_IN_CUT_ENABLED 1 REPORTS_METASTABILITY_MTBF 1 REQUIRES_INSTALLATION_PATCH 0 REQUIRES_LIST_OF_TEMPERATURE_AND_VOLTAGE_OPERATING_CONDITIONS 1 RESERVES_SIGNAL_PROBE_PINS 0 RESOLVE_MAX_FANOUT_EARLY 1 RESOLVE_MAX_FANOUT_LATE 0 RESPECTS_FIXED_SIZED_LOCKED_LOCATION_LOGICLOCK 1 RESTRICTED_USER_SELECTION 0 RISEFALL_SUPPORT_IS_HIDDEN 0 STRICT_TIMING_DB_CHECKS 0 SUPPORTS_ADDITIONAL_OPTIONS_FOR_UNUSED_IO 0 SUPPORTS_CRC 1 SUPPORTS_DIFFERENTIAL_AIOT_BOARD_TRACE_MODEL 1 SUPPORTS_DSP_BALANCING_BACK_ANNOTATION 0 SUPPORTS_GENERATION_OF_EARLY_POWER_ESTIMATOR_FILE 1 SUPPORTS_GLOBAL_SIGNAL_BACK_ANNOTATION 0 SUPPORTS_MAC_CHAIN_OUT_ADDER 0 SUPPORTS_RAM_PACKING_BACK_ANNOTATION 0 SUPPORTS_REG_PACKING_BACK_ANNOTATION 0 SUPPORTS_SIGNALPROBE_REGISTER_PIPELINING 1 SUPPORTS_SINGLE_ENDED_AIOT_BOARD_TRACE_MODEL 1 SUPPORTS_USER_MANUAL_LOGIC_DUPLICATION 1 TMV_RUN_CUSTOMIZABLE_VIEWER 1 TMV_RUN_INTERNAL_DETAILS 1 TMV_RUN_INTERNAL_DETAILS_ON_IO 0 TMV_RUN_INTERNAL_DETAILS_ON_IOBUF 1 TMV_RUN_INTERNAL_DETAILS_ON_LCELL 0 TMV_RUN_INTERNAL_DETAILS_ON_LRAM 0 TRANSCEIVER_3G_BLOCK 0 TRANSCEIVER_6G_BLOCK 0 USES_ACV_FOR_FLED 1 USES_ADB_FOR_BACK_ANNOTATION 1 USES_ALTERA_LNSIM 0 USES_ASIC_ROUTING_POWER_CALCULATOR 0 USES_DATA_DRIVEN_PLL_COMPUTATION_UTIL 1 USES_DEV 1 USES_ICP_FOR_ECO_FITTER 0 USES_LIBERTY_TIMING 0 USES_POWER_SIGNAL_ACTIVITIES 1 USES_THIRD_GENERATION_TIMING_MODELS_TIS 1 USE_ADVANCED_IO_POWER_BY_DEFAULT 1 USE_ADVANCED_IO_TIMING_BY_DEFAULT 1 USE_BASE_FAMILY_DDB_PATH 0 USE_OCT_AUTO_CALIBRATION 1 USE_RELAX_IO_ASSIGNMENT_RULES 0 USE_RISEFALL_ONLY 1 USE_SEPARATE_LIST_FOR_TECH_MIGRATION 0 USE_SINGLE_COMPILER_PASS_PLL_MIF_FILE_WRITER 1 USE_TITAN_IO_BASED_IO_REGISTER_PACKER_UTIL 0 WYSIWYG_BUS_WIDTH_CHECKING_IN_CUT_ENABLED 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + INTERACTIVE_INPUT_OUTPUT + + + + + + + + + $${FILENAME}_onchip_memory2_0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller/.cproject b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller/.cproject new file mode 100644 index 00000000..b8da53d4 --- /dev/null +++ b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller/.cproject @@ -0,0 +1,508 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + make + + mem_init_install + true + false + false + + + make + + mem_init_generate + true + false + false + + + make + + help + true + false + false + + + + diff --git a/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller/.project b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller/.project new file mode 100644 index 00000000..ffdc5a3d --- /dev/null +++ b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller/.project @@ -0,0 +1,96 @@ + + + lms_spi_controller + + + + + + com.altera.sbtgui.project.makefileBuilder + + + + + com.altera.sbtgui.project.makefileBuilder + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + all + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + make + + + org.eclipse.cdt.make.core.buildLocation + ${workspace_loc://lms_spi_controller} + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + all + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.eclipse.cdt.core.ccnature + com.altera.sbtgui.project.SBTGUINature + com.altera.sbtgui.project.SBTGUIAppNature + com.altera.sbtgui.project.SBTGUIManagedNature + + diff --git a/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller/Makefile b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller/Makefile new file mode 100644 index 00000000..916b28f9 --- /dev/null +++ b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller/Makefile @@ -0,0 +1,1086 @@ +#------------------------------------------------------------------------------ +# VARIABLES APPENDED TO BY INCLUDED MAKEFILE FRAGMENTS +#------------------------------------------------------------------------------ + +# List of include directories for -I compiler option (-I added when used). +# Includes the BSP. +ALT_INCLUDE_DIRS := + +# List of library directories for -L linker option (-L added when used). +# Includes the BSP. +ALT_LIBRARY_DIRS := + +# List of library names for -l linker option (-l added when used). +# Includes the BSP. +ALT_LIBRARY_NAMES := + +# List of library names for -msys-lib linker option (-msys-lib added when used). +# These are libraries that might be located in the BSP and depend on the BSP +# library, or vice versa +ALT_BSP_DEP_LIBRARY_NAMES := + +# List of dependencies for the linker. This is usually the full pathname +# of each library (*.a) file. +# Includes the BSP. +ALT_LDDEPS := + +# List of root library directories that support running make to build them. +# Includes the BSP and any ALT libraries. +MAKEABLE_LIBRARY_ROOT_DIRS := + +# Generic flags passed to the compiler for different types of input files. +ALT_CFLAGS := +ALT_CXXFLAGS := +ALT_CPPFLAGS := +ALT_ASFLAGS := +ALT_LDFLAGS := + + +#------------------------------------------------------------------------------ +# The adjust-path macro +# +# If COMSPEC/ComSpec is defined, Make is launched from Windows through +# Cygwin. The adjust-path macro converts absolute windows paths into +# unix style paths (Example: c:/dir -> /c/dir). This will ensture +# paths are readable by GNU Make. +# +# If COMSPEC/ComSpec is not defined, Make is launched from linux, and no +# adjustment is necessary +# +#------------------------------------------------------------------------------ + +ifndef COMSPEC +ifdef ComSpec +COMSPEC = $(ComSpec) +endif # ComSpec +endif # COMSPEC + +ifdef COMSPEC # if Windows OS + +ifeq ($(MAKE_VERSION),3.81) +# +# adjust-path/adjust-path-mixed for Mingw Gnu Make on Windows +# +# Example Usage: +# $(call adjust-path,c:/aaa/bbb) => /c/aaa/bbb +# $(call adjust-path-mixed,/c/aaa/bbb) => c:/aaa/bbb +# $(call adjust-path-mixed,/cygdrive/c/aaa/bbb) => c:/aaa/bbb +# + +# +# adjust-path +# - converts back slash characters into forward slashes +# - if input arg ($1) is an empty string then return the empty string +# - if input arg ($1) does not contain the string ":/", then return input arg +# - using sed, convert mixed path [c:/...] into mingw path [/c/...] +define adjust-path +$(strip \ +$(if $1,\ +$(if $(findstring :/,$(subst \,/,$1)),\ +$(shell echo $(subst \,/,$1) | sed -e 's,^\([a-zA-Z]\):/,/\1/,'),\ +$(subst \,/,$1)))) +endef + +# +# adjust-path-mixed +# - converts back slash characters into forward slashes +# - if input arg ($1) is an empty string then return the empty string +# - if input arg ($1) does not begin with a forward slash '/' char, then +# return input arg +# - using sed, convert mingw path [/c/...] or cygwin path [/c/cygdrive/...] +# into a mixed path [c:/...] +define adjust-path-mixed +$(strip \ +$(if $1,\ +$(if $(findstring $(subst \,/,$1),$(patsubst /%,%,$(subst \,/,$1))),\ +$(subst \,/,$1),\ +$(shell echo $(subst \,/,$1) | sed -e 's,^/cygdrive/\([a-zA-Z]\)/,\1:/,' -e 's,^/\([a-zA-Z]\)/,\1:/,')))) +endef + +else # MAKE_VERSION != 3.81 (MAKE_VERSION == 3.80 or MAKE_VERSION == 3.79) +# +# adjust-path for Cygwin Gnu Make +# $(call adjust-path,c:/aaa/bbb) = /cygdrive/c/aaa/bbb +# $(call adjust-path-mixed,/cygdrive/c/aaa/bbb) = c:/aaa/bbb +# +adjust-path = $(if $1,$(shell cygpath -u "$1"),) +adjust-path-mixed = $(if $1,$(shell cygpath -m "$1"),) +endif + +else # !COMSPEC + +adjust-path = $1 +adjust-path-mixed = $1 + +endif # COMSPEC + + +#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv +# GENERATED SETTINGS START v +#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv + +#START GENERATED +ACTIVE_BUILD_CONFIG := default +BUILD_CONFIGS := default + +# The following TYPE comment allows tools to identify the 'type' of target this +# makefile is associated with. +# TYPE: APP_MAKEFILE + +# This following VERSION comment indicates the version of the tool used to +# generate this makefile. A makefile variable is provided for VERSION as well. +# ACDS_VERSION: 12.1sp1 +ACDS_VERSION := 12.1sp1 + +# This following BUILD_NUMBER comment indicates the build number of the tool +# used to generate this makefile. +# BUILD_NUMBER: 243 + +# Define path to the application ELF. +# It may be used by the makefile fragments so is defined before including them. +# +ELF := lms_spi_controller.elf + +# Paths to C, C++, and assembly source files. +C_SRCS := hello_world_small.c +CXX_SRCS := +ASM_SRCS := + + +# Path to root of object file tree. +OBJ_ROOT_DIR := obj + +# Options to control objdump. +CREATE_OBJDUMP := 1 +OBJDUMP_INCLUDE_SOURCE := 1 +OBJDUMP_FULL_CONTENTS := 0 + +# Options to enable/disable optional files. +CREATE_ELF_DERIVED_FILES := 0 +CREATE_LINKER_MAP := 1 + +# Common arguments for ALT_CFLAGSs +APP_CFLAGS_DEFINED_SYMBOLS := +APP_CFLAGS_UNDEFINED_SYMBOLS := +APP_CFLAGS_OPTIMIZATION := -Os +APP_CFLAGS_DEBUG_LEVEL := -g +APP_CFLAGS_WARNINGS := -Wall +APP_CFLAGS_USER_FLAGS := + +APP_ASFLAGS_USER := +APP_LDFLAGS_USER := + +# Linker options that have default values assigned later if not +# assigned here. +LINKER_SCRIPT := +CRT0 := +SYS_LIB := + +# Define path to the root of the BSP. +BSP_ROOT_DIR := ../lms_spi_controller_bsp/ + +# List of application specific include directories, library directories and library names +APP_INCLUDE_DIRS := +APP_LIBRARY_DIRS := +APP_LIBRARY_NAMES := + +# Pre- and post- processor settings. +BUILD_PRE_PROCESS := +BUILD_POST_PROCESS := + +QUARTUS_PROJECT_DIR := ../../ + + +#END GENERATED + +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# GENERATED SETTINGS END ^ +#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +#------------------------------------------------------------------------------ +# DEFAULT TARGET +#------------------------------------------------------------------------------ + +# Define the variable used to echo output if not already defined. +ifeq ($(ECHO),) +ECHO := echo +endif + +# Put "all" rule before included makefile fragments because they may +# define rules and we don't want one of those to become the default rule. +.PHONY : all + +all: + @$(ECHO) [$(APP_NAME) build complete] + +all : build_pre_process libs app build_post_process + + +#------------------------------------------------------------------------------ +# VARIABLES DEPENDENT ON GENERATED CONTENT +#------------------------------------------------------------------------------ + +# Define object file directory per build configuration +CONFIG_OBJ_DIR := $(OBJ_ROOT_DIR)/$(ACTIVE_BUILD_CONFIG) + +ifeq ($(BSP_ROOT_DIR),) +$(error Edit Makefile and provide a value for BSP_ROOT_DIR) +endif + +ifeq ($(wildcard $(BSP_ROOT_DIR)),) +$(error BSP directory does not exist: $(BSP_ROOT_DIR)) +endif + +# Define absolute path to the root of the BSP. +ABS_BSP_ROOT_DIR := $(call adjust-path-mixed,$(shell cd "$(BSP_ROOT_DIR)"; pwd)) + +# Include makefile fragments. Define variable ALT_LIBRARY_ROOT_DIR before +# including each makefile fragment so that it knows the path to itself. +BSP_INCLUDE_FILE := $(BSP_ROOT_DIR)/public.mk +ALT_LIBRARY_ROOT_DIR := $(BSP_ROOT_DIR) +include $(BSP_INCLUDE_FILE) +# C2H will need this to touch the BSP public.mk and avoid the sopc file +# out-of-date error during a BSP make +ABS_BSP_INCLUDE_FILE := $(ABS_BSP_ROOT_DIR)/public.mk + + +ifneq ($(WARNING.SMALL_STACK_SIZE),) +# This WARNING is here to protect you from unknowingly using a very small stack +# If the warning is set, increase your stack size or enable the BSP small stack +# setting to eliminate the warning +$(warning WARNING: $(WARNING.SMALL_STACK_SIZE)) +endif + + +# If the BSP public.mk indicates that ALT_SIM_OPTIMIZE is set, rename the ELF +# by prefixing it with RUN_ON_HDL_SIMULATOR_ONLY_. +ifneq ($(filter -DALT_SIM_OPTIMIZE,$(ALT_CPPFLAGS)),) +ELF := RUN_ON_HDL_SIMULATOR_ONLY_$(ELF) +endif + +# If the BSP public.mk indicates that ALT_PROVIDE_GMON is set, add option to +# download_elf target +ifneq ($(filter -DALT_PROVIDE_GMON,$(ALT_CPPFLAGS)),) +GMON_OUT_FILENAME := gmon.out +WRITE_GMON_OPTION := --write-gmon $(GMON_OUT_FILENAME) +endif + +# Name of ELF application. +APP_NAME := $(basename $(ELF)) + +# Set to defaults if variables not already defined in settings. +ifeq ($(LINKER_SCRIPT),) +LINKER_SCRIPT := $(BSP_LINKER_SCRIPT) +endif +ifeq ($(CRT0),) +CRT0 := $(BSP_CRT0) +endif +ifeq ($(SYS_LIB),) +SYS_LIB := $(BSP_SYS_LIB) +endif + +OBJDUMP_NAME := $(APP_NAME).objdump +OBJDUMP_FLAGS := --disassemble --syms --all-header +ifeq ($(OBJDUMP_INCLUDE_SOURCE),1) +OBJDUMP_FLAGS += --source +endif +ifeq ($(OBJDUMP_FULL_CONTENTS),1) +OBJDUMP_FLAGS += --full-contents +endif + +# Create list of linker dependencies (*.a files). +APP_LDDEPS := $(ALT_LDDEPS) $(LDDEPS) + +# Take lists and add required prefixes. +APP_INC_DIRS := $(addprefix -I, $(ALT_INCLUDE_DIRS) $(APP_INCLUDE_DIRS) $(INC_DIRS)) +ASM_INC_PREFIX := -Wa,-I +APP_ASM_INC_DIRS := $(addprefix $(ASM_INC_PREFIX), $(ALT_INCLUDE_DIRS) $(APP_INCLUDE_DIRS) $(INC_DIRS)) +APP_LIB_DIRS := $(addprefix -L, $(ALT_LIBRARY_DIRS) $(APP_LIBRARY_DIRS) $(LIB_DIRS)) +APP_LIBS := $(addprefix -l, $(ALT_LIBRARY_NAMES) $(APP_LIBRARY_NAMES) $(LIBS)) + +ifneq ($(AVOID_NIOS2_GCC3_OPTIONS),) + +# +# Avoid Nios II GCC 3.X options. +# + +# Detect if small newlib C library is requested. +# If yes, remove the -msmallc option because it is +# now handled by other means. +ifneq ($(filter -msmallc,$(ALT_LDFLAGS)),) + ALT_LDFLAGS := $(filter-out -msmallc,$(ALT_LDFLAGS)) + ALT_C_LIBRARY := smallc +else + ALT_C_LIBRARY := c +endif + +# Put each BSP dependent library in a group to avoid circular dependencies. +APP_BSP_DEP_LIBS := $(foreach l,$(ALT_BSP_DEP_LIBRARY_NAMES),-Wl,--start-group -l$(ALT_C_LIBRARY) -lgcc -l$(l) -Wl,--end-group) + +else # !AVOID_NIOS2_GCC3_OPTIONS + +# +# Use Nios II GCC 3.X options. +# +APP_BSP_DEP_LIBS := $(addprefix -msys-lib=, $(ALT_BSP_DEP_LIBRARY_NAMES)) + +endif # !AVOID_NIOS2_GCC3_OPTIONS + +# Arguments for the C preprocessor, C/C++ compiler, assembler, and linker. +APP_CFLAGS := $(APP_CFLAGS_DEFINED_SYMBOLS) \ + $(APP_CFLAGS_UNDEFINED_SYMBOLS) \ + $(APP_CFLAGS_OPTIMIZATION) \ + $(APP_CFLAGS_DEBUG_LEVEL) \ + $(APP_CFLAGS_WARNINGS) \ + $(APP_CFLAGS_USER_FLAGS) \ + $(ALT_CFLAGS) \ + $(CFLAGS) + +# Arguments only for the C++ compiler. +APP_CXXFLAGS := $(ALT_CXXFLAGS) $(CXXFLAGS) + +# Arguments only for the C preprocessor. +# Prefix each include directory with -I. +APP_CPPFLAGS := $(APP_INC_DIRS) \ + $(ALT_CPPFLAGS) \ + $(CPPFLAGS) + +# Arguments only for the assembler. +APP_ASFLAGS := $(APP_ASM_INC_DIRS) \ + $(ALT_ASFLAGS) \ + $(APP_ASFLAGS_USER) \ + $(ASFLAGS) + +# Arguments only for the linker. +APP_LDFLAGS := $(APP_LDFLAGS_USER) + +ifneq ($(LINKER_SCRIPT),) +APP_LDFLAGS += -T'$(LINKER_SCRIPT)' +endif + +ifneq ($(AVOID_NIOS2_GCC3_OPTIONS),) + +# Avoid Nios II GCC 3.x options. +ifneq ($(CRT0),) +APP_LDFLAGS += $(CRT0) +endif + +# The equivalent of the -msys-lib option is provided +# by the GROUP() command in the linker script. +# Note this means the SYS_LIB variable is now ignored. + +else # !AVOID_NIOS2_GCC3_OPTIONS + +# Use Nios II GCC 3.x options. +ifneq ($(CRT0),) +APP_LDFLAGS += -msys-crt0='$(CRT0)' +endif +ifneq ($(SYS_LIB),) +APP_LDFLAGS += -msys-lib=$(SYS_LIB) +endif + +endif # !AVOID_NIOS2_GCC3_OPTIONS + +APP_LDFLAGS += \ + $(APP_LIB_DIRS) \ + $(ALT_LDFLAGS) \ + $(LDFLAGS) + +LINKER_MAP_NAME := $(APP_NAME).map +ifeq ($(CREATE_LINKER_MAP), 1) +APP_LDFLAGS += -Wl,-Map=$(LINKER_MAP_NAME) +endif + +# QUARTUS_PROJECT_DIR and SOPC_NAME need to be defined if you want the +# mem_init_install target of the mem_init.mk (located in the associated BSP) +# to know how to copy memory initialization files (e.g. .dat, .hex) into +# directories required for Quartus compilation or RTL simulation. + +# Defining QUARTUS_PROJECT_DIR causes mem_init_install to copy memory +# initialization files into your Quartus project directory. This is required +# to provide the initial memory contents of FPGA memories that can be +# initialized by the programming file (.sof) or Hardcopy ROMs. It is also used +# for VHDL simulation of on-chip memories. + +# Defining SOPC_NAME causes the mem_init_install target to copy memory +# initialization files into your RTL simulation directory. This is required +# to provide the initial memory contents of all memories that can be +# initialized by RTL simulation. This variable should be set to the same name +# as your SOPC Builder system name. For example, if you have a system called +# "foo.sopc", this variable should be set to "foo". + +# If SOPC_NAME is not set and QUARTUS_PROJECT_DIR is set, then derive SOPC_NAME. +ifeq ($(SOPC_NAME),) +ifneq ($(QUARTUS_PROJECT_DIR),) +SOPC_NAME := $(basename $(notdir $(wildcard $(QUARTUS_PROJECT_DIR)/*.sopcinfo))) +endif +endif + +# Defining JDI_FILE is required to specify the JTAG Debug Information File +# path. This file is generated by Quartus, and is needed along with the +# .sopcinfo file to resolve processor instance ID's from names in a multi-CPU +# systems. For multi-CPU systems, the processor instance ID is used to select +# from multiple CPU's during ELF download. + +# Both JDI_FILE and SOPCINFO_FILE are provided by the BSP if they found during +# BSP creation. If JDI_FILE is not set and QUARTUS_PROJECT_DIR is set, then +# derive JDI_FILE. We do not attempt to derive SOPCINFO_FILE since there may be +# multiple .sopcinfo files in a Quartus project. +ifeq ($(JDI_FILE),) +ifneq ($(QUARTUS_PROJECT_DIR),) +JDI_FILE := $(wildcard $(QUARTUS_PROJECT_DIR)/*.jdi) +endif +endif + +# Path to root runtime directory used for hdl simulation +RUNTIME_ROOT_DIR := $(CONFIG_OBJ_DIR)/runtime + + + +#------------------------------------------------------------------------------ +# MAKEFILE INCLUDES DEPENDENT ON GENERATED CONTENT +#------------------------------------------------------------------------------ +# mem_init.mk is a generated makefile fragment. This file defines all targets +# used to generate HDL initialization simulation files and pre-initialized +# onchip memory files. +MEM_INIT_FILE := $(BSP_ROOT_DIR)/mem_init.mk +include $(MEM_INIT_FILE) + +# Create list of object files to be built using the list of source files. +# The source file hierarchy is preserved in the object tree. +# The supported file extensions are: +# +# .c - for C files +# .cxx .cc .cpp - for C++ files +# .S .s - for assembler files +# +# Handle source files specified by --src-dir & --src-rdir differently, to +# save some processing time in calling the adjust-path macro. + +OBJ_LIST_C := $(patsubst %.c,%.o,$(filter %.c,$(C_SRCS))) +OBJ_LIST_CPP := $(patsubst %.cpp,%.o,$(filter %.cpp,$(CXX_SRCS))) +OBJ_LIST_CXX := $(patsubst %.cxx,%.o,$(filter %.cxx,$(CXX_SRCS))) +OBJ_LIST_CC := $(patsubst %.cc,%.o,$(filter %.cc,$(CXX_SRCS))) +OBJ_LIST_S := $(patsubst %.S,%.o,$(filter %.S,$(ASM_SRCS))) +OBJ_LIST_SS := $(patsubst %.s,%.o,$(filter %.s,$(ASM_SRCS))) + +OBJ_LIST := $(sort $(OBJ_LIST_C) $(OBJ_LIST_CPP) $(OBJ_LIST_CXX) \ + $(OBJ_LIST_CC) $(OBJ_LIST_S) $(OBJ_LIST_SS)) + +SDIR_OBJ_LIST_C := $(patsubst %.c,%.o,$(filter %.c,$(SDIR_C_SRCS))) +SDIR_OBJ_LIST_CPP := $(patsubst %.cpp,%.o,$(filter %.cpp,$(SDIR_CXX_SRCS))) +SDIR_OBJ_LIST_CXX := $(patsubst %.cxx,%.o,$(filter %.cxx,$(SDIR_CXX_SRCS))) +SDIR_OBJ_LIST_CC := $(patsubst %.cc,%.o,$(filter %.cc,$(SDIR_CXX_SRCS))) +SDIR_OBJ_LIST_S := $(patsubst %.S,%.o,$(filter %.S,$(SDIR_ASM_SRCS))) +SDIR_OBJ_LIST_SS := $(patsubst %.s,%.o,$(filter %.s,$(SDIR_ASM_SRCS))) + +SDIR_OBJ_LIST := $(sort $(SDIR_OBJ_LIST_C) $(SDIR_OBJ_LIST_CPP) \ + $(SDIR_OBJ_LIST_CXX) $(SDIR_OBJ_LIST_CC) $(SDIR_OBJ_LIST_S) \ + $(SDIR_OBJ_LIST_SS)) + +# Relative-pathed objects that being with "../" are handled differently. +# +# Regular objects are created as +# $(CONFIG_OBJ_DIR)//.o +# where the path structure is maintained under the obj directory. This +# applies for both absolute and relative paths; in the absolute path +# case this means the entire source path will be recreated under the obj +# directory. This is done to allow two source files with the same name +# to be included as part of the project. +# +# Note: On Cygwin, the path recreated under the obj directory will be +# the cygpath -u output path. +# +# Relative-path objects that begin with "../" cause problems under this +# scheme, as $(CONFIG_OBJ_DIR)/..// can potentially put the object +# files anywhere in the system, creating clutter and polluting the source tree. +# As such, their paths are flattened - the object file created will be +# $(CONFIG_OBJ_DIR)/.o. Due to this, two files specified with +# "../" in the beginning cannot have the same name in the project. VPATH +# will be set for these sources to allow make to relocate the source file +# via %.o rules. +# +# The following lines separate the object list into the flatten and regular +# lists, and then handles them as appropriate. + +FLATTEN_OBJ_LIST := $(filter ../%,$(OBJ_LIST)) +FLATTEN_APP_OBJS := $(addprefix $(CONFIG_OBJ_DIR)/,$(notdir $(FLATTEN_OBJ_LIST))) + +REGULAR_OBJ_LIST := $(filter-out $(FLATTEN_OBJ_LIST),$(OBJ_LIST)) +REGULAR_OBJ_LIST_C := $(filter $(OBJ_LIST_C),$(REGULAR_OBJ_LIST)) +REGULAR_OBJ_LIST_CPP := $(filter $(OBJ_LIST_CPP),$(REGULAR_OBJ_LIST)) +REGULAR_OBJ_LIST_CXX := $(filter $(OBJ_LIST_CXX),$(REGULAR_OBJ_LIST)) +REGULAR_OBJ_LIST_CC := $(filter $(OBJ_LIST_CC),$(REGULAR_OBJ_LIST)) +REGULAR_OBJ_LIST_S := $(filter $(OBJ_LIST_S),$(REGULAR_OBJ_LIST)) +REGULAR_OBJ_LIST_SS := $(filter $(OBJ_LIST_SS),$(REGULAR_OBJ_LIST)) + +FLATTEN_SDIR_OBJ_LIST := $(filter ../%,$(SDIR_OBJ_LIST)) +FLATTEN_SDIR_APP_OBJS := $(addprefix $(CONFIG_OBJ_DIR)/,$(notdir $(FLATTEN_SDIR_OBJ_LIST))) + +REGULAR_SDIR_OBJ_LIST := $(filter-out $(FLATTEN_SDIR_OBJ_LIST),$(SDIR_OBJ_LIST)) +REGULAR_SDIR_OBJ_LIST_C := $(filter $(SDIR_OBJ_LIST_C),$(REGULAR_SDIR_OBJ_LIST)) +REGULAR_SDIR_OBJ_LIST_CPP := $(filter $(SDIR_OBJ_LIST_CPP),$(REGULAR_SDIR_OBJ_LIST)) +REGULAR_SDIR_OBJ_LIST_CXX := $(filter $(SDIR_OBJ_LIST_CXX),$(REGULAR_SDIR_OBJ_LIST)) +REGULAR_SDIR_OBJ_LIST_CC := $(filter $(SDIR_OBJ_LIST_CC),$(REGULAR_SDIR_OBJ_LIST)) +REGULAR_SDIR_OBJ_LIST_S := $(filter $(SDIR_OBJ_LIST_S),$(REGULAR_SDIR_OBJ_LIST)) +REGULAR_SDIR_OBJ_LIST_SS := $(filter $(SDIR_OBJ_LIST_SS),$(REGULAR_SDIR_OBJ_LIST)) + +VPATH := $(sort $(dir $(FLATTEN_OBJ_LIST)) $(dir $(FLATTEN_SDIR_OBJ_LIST))) + +APP_OBJS_C := $(addprefix $(CONFIG_OBJ_DIR)/,\ + $(REGULAR_SDIR_OBJ_LIST_C) \ + $(foreach s,$(REGULAR_OBJ_LIST_C),$(call adjust-path,$s))) + +APP_OBJS_CPP := $(addprefix $(CONFIG_OBJ_DIR)/,\ + $(REGULAR_SDIR_OBJ_LIST_CPP) \ + $(foreach s,$(REGULAR_OBJ_LIST_CPP),$(call adjust-path,$s))) + +APP_OBJS_CXX := $(addprefix $(CONFIG_OBJ_DIR)/,\ + $(REGULAR_SDIR_OBJ_LIST_CXX) \ + $(foreach s,$(REGULAR_OBJ_LIST_CXX),$(call adjust-path,$s))) + +APP_OBJS_CC := $(addprefix $(CONFIG_OBJ_DIR)/,\ + $(REGULAR_SDIR_OBJ_LIST_CC) \ + $(foreach s,$(REGULAR_OBJ_LIST_CC),$(call adjust-path,$s))) + +APP_OBJS_S := $(addprefix $(CONFIG_OBJ_DIR)/,\ + $(REGULAR_SDIR_OBJ_LIST_S) \ + $(foreach s,$(REGULAR_OBJ_LIST_S),$(call adjust-path,$s))) + +APP_OBJS_SS := $(addprefix $(CONFIG_OBJ_DIR)/,\ + $(REGULAR_SDIR_OBJ_LIST_SS) \ + $(foreach s,$(REGULAR_OBJ_LIST_SS),$(call adjust-path,$s))) + +APP_OBJS := $(APP_OBJS_C) $(APP_OBJS_CPP) $(APP_OBJS_CXX) $(APP_OBJS_CC) \ + $(APP_OBJS_S) $(APP_OBJS_SS) \ + $(FLATTEN_APP_OBJS) $(FLATTEN_SDIR_APP_OBJS) + +# Add any extra user-provided object files. +APP_OBJS += $(OBJS) + +# Create list of dependancy files for each object file. +APP_DEPS := $(APP_OBJS:.o=.d) + +# Patch the Elf file with system specific information + +# Patch the Elf with the name of the sopc system +ifneq ($(SOPC_NAME),) +ELF_PATCH_FLAG += --sopc_system_name $(SOPC_NAME) +endif + +# Patch the Elf with the absolute path to the Quartus Project Directory +ifneq ($(QUARTUS_PROJECT_DIR),) +ABS_QUARTUS_PROJECT_DIR := $(call adjust-path-mixed,$(shell cd "$(QUARTUS_PROJECT_DIR)"; pwd)) +ELF_PATCH_FLAG += --quartus_project_dir "$(ABS_QUARTUS_PROJECT_DIR)" +endif + +# Patch the Elf and download args with the JDI_FILE if specified +ifneq ($(wildcard $(JDI_FILE)),) +ELF_PATCH_FLAG += --jdi $(JDI_FILE) +DOWNLOAD_JDI_FLAG := --jdi $(JDI_FILE) +endif + +# Patch the Elf with the SOPCINFO_FILE if specified +ifneq ($(wildcard $(SOPCINFO_FILE)),) +ELF_PATCH_FLAG += --sopcinfo $(SOPCINFO_FILE) +endif + +# Use the DOWNLOAD_CABLE variable to specify which JTAG cable to use. +# This is not needed if you only have one cable. +ifneq ($(DOWNLOAD_CABLE),) +DOWNLOAD_CABLE_FLAG := --cable '$(DOWNLOAD_CABLE)' +endif + + +#------------------------------------------------------------------------------ +# BUILD PRE/POST PROCESS +#------------------------------------------------------------------------------ +build_pre_process : + $(BUILD_PRE_PROCESS) + +build_post_process : + $(BUILD_POST_PROCESS) + +.PHONY: build_pre_process build_post_process + + +#------------------------------------------------------------------------------ +# TOOLS +#------------------------------------------------------------------------------ + +# +# Set tool default variables if not already defined. +# If these are defined, they would typically be defined in an +# included makefile fragment. +# +ifeq ($(DEFAULT_CROSS_COMPILE),) +DEFAULT_CROSS_COMPILE := nios2-elf- +endif + +ifeq ($(DEFAULT_STACK_REPORT),) +DEFAULT_STACKREPORT := nios2-stackreport +endif + +ifeq ($(DEFAULT_DOWNLOAD),) +DEFAULT_DOWNLOAD := nios2-download +endif + +ifeq ($(DEFAULT_FLASHPROG),) +DEFAULT_FLASHPROG := nios2-flash-programmer +endif + +ifeq ($(DEFAULT_ELFPATCH),) +DEFAULT_ELFPATCH := nios2-elf-insert +endif + +ifeq ($(DEFAULT_RM),) +DEFAULT_RM := rm -f +endif + +ifeq ($(DEFAULT_CP),) +DEFAULT_CP := cp -f +endif + +ifeq ($(DEFAULT_MKDIR),) +DEFAULT_MKDIR := mkdir -p +endif + +# +# Set tool variables to defaults if not already defined. +# If these are defined, they would typically be defined by a +# setting in the generated portion of this makefile. +# +ifeq ($(CROSS_COMPILE),) +CROSS_COMPILE := $(DEFAULT_CROSS_COMPILE) +endif + +ifeq ($(origin CC),default) +CC := $(CROSS_COMPILE)gcc -xc +endif + +ifeq ($(origin CXX),default) +CXX := $(CROSS_COMPILE)gcc -xc++ +endif + +ifeq ($(origin AS),default) +AS := $(CROSS_COMPILE)gcc +endif + +ifeq ($(origin AR),default) +AR := $(CROSS_COMPILE)ar +endif + +ifeq ($(origin LD),default) +LD := $(CROSS_COMPILE)g++ +endif + +ifeq ($(origin NM),default) +NM := $(CROSS_COMPILE)nm +endif + +ifeq ($(origin RM),default) +RM := $(DEFAULT_RM) +endif + +ifeq ($(origin CP),default) +CP := $(DEFAULT_CP) +endif + +ifeq ($(OBJDUMP),) +OBJDUMP := $(CROSS_COMPILE)objdump +endif + +ifeq ($(OBJCOPY),) +OBJCOPY := $(CROSS_COMPILE)objcopy +endif + +ifeq ($(STACKREPORT),) +ifeq ($(CROSS_COMPILE),nios2-elf-) +STACKREPORT := $(DEFAULT_STACKREPORT) +else +DISABLE_STACKREPORT := 1 +endif +endif + +ifeq ($(DOWNLOAD),) +DOWNLOAD := $(DEFAULT_DOWNLOAD) +endif + +ifeq ($(FLASHPROG),) +FLASHPROG := $(DEFAULT_FLASHPROG) +endif + +ifeq ($(ELFPATCH),) +ELFPATCH := $(DEFAULT_ELFPATCH) +endif + +ifeq ($(MKDIR),) +MKDIR := $(DEFAULT_MKDIR) +endif + +#------------------------------------------------------------------------------ +# PATTERN RULES TO BUILD OBJECTS +#------------------------------------------------------------------------------ + +define compile.c +@$(ECHO) Info: Compiling $< to $@ +@$(MKDIR) $(@D) +$(CC) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CFLAGS) -o $@ $< +$(CC_POST_PROCESS) +endef + +define compile.cpp +@$(ECHO) Info: Compiling $< to $@ +@$(MKDIR) $(@D) +$(CXX) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $< +$(CXX_POST_PROCESS) +endef + +# If assembling with the compiler, ensure "-Wa," is prepended to all APP_ASFLAGS +ifeq ($(AS),$(patsubst %as,%,$(AS))) +COMMA := , +APP_ASFLAGS := $(filter-out $(APP_CFLAGS),$(addprefix -Wa$(COMMA),$(patsubst -Wa$(COMMA)%,%,$(APP_ASFLAGS)))) +endif + +define compile.s +@$(ECHO) Info: Assembling $< to $@ +@$(MKDIR) $(@D) +$(AS) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CFLAGS) $(APP_ASFLAGS) -o $@ $< +$(AS_POST_PROCESS) +endef + +ifeq ($(MAKE_VERSION),3.81) +.SECONDEXPANSION: + +$(APP_OBJS_C): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.c) + $(compile.c) + +$(APP_OBJS_CPP): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.cpp) + $(compile.cpp) + +$(APP_OBJS_CC): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.cc) + $(compile.cpp) + +$(APP_OBJS_CXX): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.cxx) + $(compile.cpp) + +$(APP_OBJS_S): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.S) + $(compile.s) + +$(APP_OBJS_SS): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.s) + $(compile.s) + +endif # MAKE_VERSION != 3.81 + +$(CONFIG_OBJ_DIR)/%.o: %.c + $(compile.c) + +$(CONFIG_OBJ_DIR)/%.o: %.cpp + $(compile.cpp) + +$(CONFIG_OBJ_DIR)/%.o: %.cc + $(compile.cpp) + +$(CONFIG_OBJ_DIR)/%.o: %.cxx + $(compile.cpp) + +$(CONFIG_OBJ_DIR)/%.o: %.S + $(compile.s) + +$(CONFIG_OBJ_DIR)/%.o: %.s + $(compile.s) + + +#------------------------------------------------------------------------------ +# PATTERN RULES TO INTERMEDIATE FILES +#------------------------------------------------------------------------------ + +$(CONFIG_OBJ_DIR)/%.s: %.c + @$(ECHO) Info: Compiling $< to $@ + @$(MKDIR) $(@D) + $(CC) -S $(APP_CPPFLAGS) $(APP_CFLAGS) -o $@ $< + +$(CONFIG_OBJ_DIR)/%.s: %.cpp + @$(ECHO) Info: Compiling $< to $@ + @$(MKDIR) $(@D) + $(CXX) -S $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $< + +$(CONFIG_OBJ_DIR)/%.s: %.cc + @$(ECHO) Info: Compiling $< to $@ + @$(MKDIR) $(@D) + $(CXX) -S $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $< + +$(CONFIG_OBJ_DIR)/%.s: %.cxx + @$(ECHO) Info: Compiling $< to $@ + @$(MKDIR) $(@D) + $(CXX) -S $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $< + +$(CONFIG_OBJ_DIR)/%.i: %.c + @$(ECHO) Info: Compiling $< to $@ + @$(MKDIR) $(@D) + $(CC) -E $(APP_CPPFLAGS) $(APP_CFLAGS) -o $@ $< + +$(CONFIG_OBJ_DIR)/%.i: %.cpp + @$(ECHO) Info: Compiling $< to $@ + @$(MKDIR) $(@D) + $(CXX) -E $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $< + +$(CONFIG_OBJ_DIR)/%.i: %.cc + @$(ECHO) Info: Compiling $< to $@ + @$(MKDIR) $(@D) + $(CXX) -E $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $< + +$(CONFIG_OBJ_DIR)/%.i: %.cxx + @$(ECHO) Info: Compiling $< to $@ + @$(MKDIR) $(@D) + $(CXX) -E $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $< + + +#------------------------------------------------------------------------------ +# TARGET RULES +#------------------------------------------------------------------------------ + +.PHONY : help +help : + @$(ECHO) "Summary of Makefile targets" + @$(ECHO) " Build targets:" + @$(ECHO) " all (default) - Application and all libraries (including BSP)" + @$(ECHO) " bsp - Just the BSP" + @$(ECHO) " libs - All libraries (including BSP)" + @$(ECHO) " flash - All flash files" + @$(ECHO) " mem_init_generate - All memory initialization files" +ifeq ($(QSYS),1) + @$(ECHO) " mem_init_install - This target is deprecated for QSys Systems" + @$(ECHO) " --> Use the mem_init_generate target and then" + @$(ECHO) " add the generated meminit.qip file to your" + @$(ECHO) " Quartus II Project." +else # if QSYS != 1 + @$(ECHO) " mem_init_install - Copy memory initialization files to Quartus II project" +endif # QSYS == 1 + @$(ECHO) + @$(ECHO) " Clean targets:" + @$(ECHO) " clean_all - Application and all libraries (including BSP)" + @$(ECHO) " clean - Just the application" + @$(ECHO) " clean_bsp - Just the BSP" + @$(ECHO) " clean_libs - All libraries (including BSP)" + @$(ECHO) + @$(ECHO) " Run targets:" + @$(ECHO) " download-elf - Download and run your elf executable" + @$(ECHO) " program-flash - Program flash contents to the board" + +# Handy rule to skip making libraries and just make application. +.PHONY : app +app : $(ELF) + +ifeq ($(CREATE_OBJDUMP), 1) +app : $(OBJDUMP_NAME) +endif + +ifeq ($(CREATE_ELF_DERIVED_FILES),1) +app : elf_derived_files +endif + +.PHONY: elf_derived_files +elf_derived_files: default_mem_init + +# Handy rule for making just the BSP. +.PHONY : bsp +bsp : + @$(ECHO) Info: Building $(BSP_ROOT_DIR) + @$(MAKE) --no-print-directory -C $(BSP_ROOT_DIR) + + +# Make sure all makeable libraries (including the BSP) are up-to-date. +LIB_TARGETS := $(patsubst %,%-recurs-make-lib,$(MAKEABLE_LIBRARY_ROOT_DIRS)) + +.PHONY : libs +libs : $(LIB_TARGETS) + +ifneq ($(strip $(LIB_TARGETS)),) +$(LIB_TARGETS): %-recurs-make-lib: + @$(ECHO) Info: Building $* + $(MAKE) --no-print-directory -C $* +endif + +ifneq ($(strip $(APP_LDDEPS)),) +$(APP_LDDEPS): libs + @true +endif + +# Rules to force your project to rebuild or relink +# .force_relink file will cause any application that depends on this project to relink +# .force_rebuild file will cause this project to rebuild object files +# .force_rebuild_all file will cause this project and any project that depends on this project to rebuild object files + +FORCE_RELINK_DEP := .force_relink +FORCE_REBUILD_DEP := .force_rebuild +FORCE_REBUILD_ALL_DEP := .force_rebuild_all +FORCE_REBUILD_DEP_LIST := $(CONFIG_OBJ_DIR)/$(FORCE_RELINK_DEP) $(CONFIG_OBJ_DIR)/$(FORCE_REBUILD_DEP) $(FORCE_REBUILD_ALL_DEP) + +$(FORCE_REBUILD_DEP_LIST): + +$(APP_OBJS): $(wildcard $(CONFIG_OBJ_DIR)/$(FORCE_REBUILD_DEP)) $(wildcard $(addsuffix /$(FORCE_REBUILD_ALL_DEP), . $(ALT_LIBRARY_DIRS))) + +$(ELF): $(wildcard $(addsuffix /$(FORCE_RELINK_DEP), $(CONFIG_OBJ_DIR) $(ALT_LIBRARY_DIRS))) + + +# Clean just the application. +.PHONY : clean +ifeq ($(CREATE_ELF_DERIVED_FILES),1) +clean : clean_elf_derived_files +endif + +clean : + @$(RM) -r $(ELF) $(OBJDUMP_NAME) $(LINKER_MAP_NAME) $(OBJ_ROOT_DIR) $(RUNTIME_ROOT_DIR) $(FORCE_REBUILD_DEP_LIST) + @$(ECHO) [$(APP_NAME) clean complete] + +# Clean just the BSP. +.PHONY : clean_bsp +clean_bsp : + @$(ECHO) Info: Cleaning $(BSP_ROOT_DIR) + @$(MAKE) --no-print-directory -C $(BSP_ROOT_DIR) clean + +# Clean all makeable libraries including the BSP. +LIB_CLEAN_TARGETS := $(patsubst %,%-recurs-make-clean-lib,$(MAKEABLE_LIBRARY_ROOT_DIRS)) + +.PHONY : clean_libs +clean_libs : $(LIB_CLEAN_TARGETS) + +ifneq ($(strip $(LIB_CLEAN_TARGETS)),) +$(LIB_CLEAN_TARGETS): %-recurs-make-clean-lib: + @$(ECHO) Info: Cleaning $* + $(MAKE) --no-print-directory -C $* clean +endif + +.PHONY: clean_elf_derived_files +clean_elf_derived_files: mem_init_clean + +# Clean application and all makeable libraries including the BSP. +.PHONY : clean_all +clean_all : clean mem_init_clean clean_libs + +# Include the dependency files unless the make goal is performing a clean +# of the application. +ifneq ($(firstword $(MAKECMDGOALS)),clean) +ifneq ($(firstword $(MAKECMDGOALS)),clean_all) +-include $(APP_DEPS) +endif +endif + +.PHONY : download-elf +download-elf : $(ELF) + @if [ "$(DOWNLOAD)" = "none" ]; \ + then \ + $(ECHO) Downloading $(ELF) not supported; \ + else \ + $(ECHO) Info: Downloading $(ELF); \ + $(DOWNLOAD) --go --cpu_name=$(CPU_NAME) $(DOWNLOAD_CABLE_FLAG) $(SOPC_SYSID_FLAG) $(DOWNLOAD_JDI_FLAG) $(WRITE_GMON_OPTION) $(ELF); \ + fi + +# Delete the target of a rule if it has changed and its commands exit +# with a nonzero exit status. +.DELETE_ON_ERROR: + +# Rules for flash programming commands +PROGRAM_FLASH_SUFFIX := -program +PROGRAM_FLASH_TARGET := $(addsuffix $(PROGRAM_FLASH_SUFFIX), $(FLASH_FILES)) + +.PHONY : program-flash +program-flash : $(PROGRAM_FLASH_TARGET) + +.PHONY : $(PROGRAM_FLASH_TARGET) +$(PROGRAM_FLASH_TARGET) : flash + @if [ "$(FLASHPROG)" = "none" ]; \ + then \ + $(ECHO) Programming flash not supported; \ + else \ + $(ECHO) Info: Programming $(basename $@).flash; \ + if [ -z "$($(basename $@)_EPCS_FLAGS)" ]; \ + then \ + $(ECHO) $(FLASHPROG) $(SOPC_SYSID_FLAG) --base=$($(basename $@)_START) $(basename $@).flash; \ + $(FLASHPROG) $(DOWNLOAD_CABLE_FLAG) $(SOPC_SYSID_FLAG) --base=$($(basename $@)_START) $(basename $@).flash; \ + else \ + $(ECHO) $(FLASHPROG) $(SOPC_SYSID_FLAG) --epcs --base=$($(basename $@)_START) $(basename $@).flash; \ + $(FLASHPROG) $(DOWNLOAD_CABLE_FLAG) $(SOPC_SYSID_FLAG) --epcs --base=$($(basename $@)_START) $(basename $@).flash; \ + fi \ + fi + + +# Rules for simulating with an HDL Simulator [QSYS only] +ifeq ($(QSYS),1) +IP_MAKE_SIMSCRIPT := ip-make-simscript + +ifeq ($(VSIM),) +VSIM_EXE := $(if $(VSIM_DIR),$(VSIM_DIR)/,)vsim +ifeq ($(ENABLE_VSIM_GUI),1) +VSIM := $(VSIM_EXE) -gui +else +VSIM := $(VSIM_EXE) -c +endif # ENABLE_VSIM_GUI == 1 +endif # VSIM not set + +ifeq ($(SPD),) +ifneq ($(ABS_QUARTUS_PROJECT_DIR),) +ifneq ($(SOPC_NAME),) +SPD := $(ABS_QUARTUS_PROJECT_DIR)/$(SOPC_NAME)_tb.spd +endif # SOPC_NAME set +endif # ABS_QUARTUS_PROJECT_DIR set +endif # SPD == empty string + +ifeq ($(MSIM_SCRIPT),) +SIM_SCRIPT_DIR := $(RUNTIME_ROOT_DIR)/sim +MSIM_SCRIPT := $(SIM_SCRIPT_DIR)/mentor/msim_setup.tcl +endif # MSIM_SCRIPT == empty string + +ifeq ($(MAKE_VERSION),3.81) +ABS_MEM_INIT_DESCRIPTOR_FILE := $(abspath $(MEM_INIT_DESCRIPTOR_FILE)) +else +ABS_MEM_INIT_DESCRIPTOR_FILE := $(call adjust-path-mixed,$(shell pwd))/$(MEM_INIT_DESCRIPTOR_FILE) +endif + +$(MSIM_SCRIPT): $(SPD) $(MEM_INIT_DESCRIPTOR_FILE) +ifeq ($(SPD),) + $(error No SPD file specified. Ensure QUARTUS_PROJECT_DIR variable is set) +endif + @$(MKDIR) $(SIM_SCRIPT_DIR) + $(IP_MAKE_SIMSCRIPT) --spd=$(SPD) --spd=$(MEM_INIT_DESCRIPTOR_FILE) --output-directory=$(SIM_SCRIPT_DIR) + +VSIM_COMMAND = \ + cd $(dir $(MSIM_SCRIPT)) && \ + $(VSIM) -do "do $(notdir $(MSIM_SCRIPT)); ld; $(if $(VSIM_RUN_TIME),run ${VSIM_RUN_TIME};quit;)" + +.PHONY: sim +sim: $(MSIM_SCRIPT) mem_init_generate +ifeq ($(MSIM_SCRIPT),) + $(error MSIM_SCRIPT not set) +endif + $(VSIM_COMMAND) + +endif # QSYS == 1 + + +#------------------------------------------------------------------------------ +# ELF TARGET RULE +#------------------------------------------------------------------------------ +# Rule for constructing the executable elf file. +$(ELF) : $(APP_OBJS) $(LINKER_SCRIPT) $(APP_LDDEPS) + @$(ECHO) Info: Linking $@ + $(LD) $(APP_LDFLAGS) $(APP_CFLAGS) -o $@ $(filter-out $(CRT0),$(APP_OBJS)) $(APP_LIBS) $(APP_BSP_DEP_LIBS) +ifneq ($(DISABLE_ELFPATCH),1) + $(ELFPATCH) $@ $(ELF_PATCH_FLAG) +endif +ifneq ($(DISABLE_STACKREPORT),1) + @bash -c "$(STACKREPORT) $@" +endif + +$(OBJDUMP_NAME) : $(ELF) + @$(ECHO) Info: Creating $@ + $(OBJDUMP) $(OBJDUMP_FLAGS) $< >$@ + +# Rule for printing the name of the elf file +.PHONY: print-elf-name +print-elf-name: + @$(ECHO) $(ELF) + + diff --git a/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller/hello_world_small.c b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller/hello_world_small.c new file mode 100644 index 00000000..75f50c5d --- /dev/null +++ b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller/hello_world_small.c @@ -0,0 +1,1404 @@ +/* + * "Small Hello World" example. + * + * This example prints 'Hello from Nios II' to the STDOUT stream. It runs on + * the Nios II 'standard', 'full_featured', 'fast', and 'low_cost' example + * designs. It requires a STDOUT device in your system's hardware. + * + * The purpose of this example is to demonstrate the smallest possible Hello + * World application, using the Nios II HAL library. The memory footprint + * of this hosted application is ~332 bytes by default using the standard + * reference design. For a more fully featured Hello World application + * example, see the example titled "Hello World". + * + * The memory footprint of this example has been reduced by making the + * following changes to the normal "Hello World" example. + * Check in the Nios II Software Developers Manual for a more complete + * description. + * + * In the SW Application project (small_hello_world): + * + * - In the C/C++ Build page + * + * - Set the Optimization Level to -Os + * + * In System Library project (small_hello_world_syslib): + * - In the C/C++ Build page + * + * - Set the Optimization Level to -Os + * + * - Define the preprocessor option ALT_NO_INSTRUCTION_EMULATION + * This removes software exception handling, which means that you cannot + * run code compiled for Nios II cpu with a hardware multiplier on a core + * without a the multiply unit. Check the Nios II Software Developers + * Manual for more details. + * + * - In the System Library page: + * - Set Periodic system timer and Timestamp timer to none + * This prevents the automatic inclusion of the timer driver. + * + * - Set Max file descriptors to 4 + * This reduces the size of the file handle pool. + * + * - Check Main function does not exit + * - Uncheck Clean exit (flush buffers) + * This removes the unneeded call to exit when main returns, since it + * won't. + * + * - Check Don't use C++ + * This builds without the C++ support code. + * + * - Check Small C library + * This uses a reduced functionality C library, which lacks + * support for buffering, file IO, floating point and getch(), etc. + * Check the Nios II Software Developers Manual for a complete list. + * + * - Check Reduced device drivers + * This uses reduced functionality drivers if they're available. For the + * standard design this means you get polled UART and JTAG UART drivers, + * no support for the LCD driver and you lose the ability to program + * CFI compliant flash devices. + * + * - Check Access device drivers directly + * This bypasses the device file system to access device drivers directly. + * This eliminates the space required for the device file system services. + * It also provides a HAL version of libc services that access the drivers + * directly, further reducing space. Only a limited number of libc + * functions are available in this configuration. + * + * - Use ALT versions of stdio routines: + * + * Function Description + * =============== ===================================== + * alt_printf Only supports %s, %x, and %c ( < 1 Kbyte) + * alt_putstr Smaller overhead than puts with direct drivers + * Note this function doesn't add a newline. + * alt_putchar Smaller overhead than putchar with direct drivers + * alt_getchar Smaller overhead than getchar with direct drivers + * + */ + +#include "sys/alt_stdio.h" +#include "system.h" +#include "altera_avalon_spi.h" +#include "altera_avalon_uart_regs.h" +#include "altera_avalon_jtag_uart_regs.h" +#include "priv/alt_busy_sleep.h" +#include "priv/alt_file.h" +#include +#include +#include +#include +#include + +#include "sys/alt_dev.h" + +#define LMS_READ 0 +#define LMS_WRITE (1<<7) +#define LMS_VERBOSE 1 +#define kHz(x) (x*1000) +#define MHz(x) (x*1000000) +#define GHz(x) (x*1000000000) + +// Frequency selection structure +typedef struct { + uint16_t nint ; + uint32_t nfrac ; + uint8_t freqsel ; + uint32_t reference ; +} lms_freq_t ; + +// Bandwidth selection +typedef enum { + BW_28MHz, + BW_20MHz, + BW_12MHz, + BW_14MHz, + BW_10MHz, + BW_8p75MHz, + BW_7MHz, + BW_6MHz, + BW_5p5MHz, + BW_5MHz, + BW_3p84MHz, + BW_3MHz, + BW_2p75MHz, + BW_2p5MHz, + BW_1p75MHz, + BW_1p5MHz, +} lms_bw_t ; + +// Module selection for those which have both RX and TX constituents +typedef enum +{ + RX, + TX +} lms_module_t ; + +// Loopback options +typedef enum { + LB_BB_LPF, + LB_BB_VGA2, + LB_BB_OP, + LB_RF_LNA1, + LB_RF_LNA2, + LB_RF_LNA3, + LB_NONE +} lms_loopback_mode_t ; + +// LNA options +typedef enum { + LNA_NONE, + LNA_1, + LNA_2, + LNA_3 +} lms_lna_t ; + +// LNA gain options +typedef enum { + LNA_UNKNOWN, + LNA_BYPASS, + LNA_MID, + LNA_MAX +} lms_lna_gain_t ; + +typedef enum { + TXLB_BB, + TXLB_RF +} lms_txlb_t ; + +typedef enum { + PA_AUX, + PA_1, + PA_2, + PA_ALL +} lms_pa_t ; + +// Frequency Range table +typedef struct { + uint32_t low ; + uint32_t high ; + uint8_t value ; +} freq_range_t ; + +const freq_range_t bands[] = { + { .low = 232500000, .high = 285625000, .value = 0x27 }, + { .low = 285625000, .high = 336875000, .value = 0x2f }, + { .low = 336875000, .high = 405000000, .value = 0x37 }, + { .low = 405000000, .high = 465000000, .value = 0x3f }, + { .low = 465000000, .high = 571250000, .value = 0x26 }, + { .low = 571250000, .high = 673750000, .value = 0x2e }, + { .low = 673750000, .high = 810000000, .value = 0x36 }, + { .low = 810000000, .high = 930000000, .value = 0x3e }, + { .low = 930000000, .high = 1142500000, .value = 0x25 }, + { .low = 1142500000, .high = 1347500000, .value = 0x2d }, + { .low = 1347500000, .high = 1620000000, .value = 0x35 }, + { .low = 1620000000, .high = 1860000000, .value = 0x3d }, + { .low = 1860000000u, .high = 2285000000u, .value = 0x24 }, + { .low = 2285000000u, .high = 2695000000u, .value = 0x2c }, + { .low = 2695000000u, .high = 3240000000u, .value = 0x34 }, + { .low = 3240000000u, .high = 3720000000u, .value = 0x3c } +}; + +// Trim DAC write +void dac_write( uint16_t val ) { + alt_printf( "DAC Writing: %x\n", val ) ; + uint8_t data[3] ; + data[0] = 0x28, data[1] = 0, data[2] = 0 ; + alt_avalon_spi_command( SPI_1_BASE, 0, 3, data, 0, 0, 0 ) ; + data[0] = 0x08, data[1] = (val>>8)&0xff, data[2] = val&0xff ; + alt_avalon_spi_command( SPI_1_BASE, 0, 3, data, 0, 0, 0) ; + return ; +} + +// SPI Read +void lms_spi_read( uint8_t address, uint8_t *val ) +{ + uint8_t rv ; + if( address > 0x7f ) + { + alt_printf( "Invalid read address: %x\n", address ) ; + } else { + alt_avalon_spi_command( SPI_0_BASE, 0, 1, &address, 0, 0, ALT_AVALON_SPI_COMMAND_MERGE ) ; + rv = alt_avalon_spi_command( SPI_0_BASE, 0, 0, 0, 1, val, 0 ) ; + if( rv != 1 ) + { + alt_putstr( "SPI data read did not work :(\n") ; + } + } + if( LMS_VERBOSE ) + { + alt_printf( "r-addr: %x data: %x\n", address, *val ) ; + } + return ; +} + +// SPI Write +void lms_spi_write( uint8_t address, uint8_t val ) +{ + if( LMS_VERBOSE ) + { + alt_printf( "w-addr: %x data: %x\n", address, val ) ; + } + /*if( address > 0x7f ) + { + alt_printf( "Invalid write address: %x\n", address ) ; + } else*/ { + uint8_t data[2] = { address |= LMS_WRITE, val } ; + alt_avalon_spi_command( SPI_0_BASE, 0, 2, data, 0, 0, 0 ) ; + } + return ; +} + +// When enabling an LPF, we must select both the module and the filter bandwidth +void lms_lpf_enable( lms_module_t mod, lms_bw_t bw ) +{ + uint8_t reg = (mod == RX) ? 0x54 : 0x34 ; + uint8_t data ; + // Check to see which bandwidth we have selected + lms_spi_read( reg, &data ) ; + if( (lms_bw_t)(data&0x3c>>2) != bw ) + { + data &= ~0x3c ; + data |= (bw<<2) ; + data |= (1<<1) ; + lms_spi_write( reg, data ) ; + } + // Check to see if we are bypassed + lms_spi_read( reg+1, &data ) ; + if( data&(1<<6) ) + { + data &= ~(1<<6) ; + lms_spi_write( reg+1, data ) ; + } + return ; +} + +void lms_lpf_bypass( lms_module_t mod ) +{ + uint8_t reg = (mod == RX) ? 0x55 : 0x35 ; + uint8_t data ; + lms_spi_read( reg, &data ) ; + data |= (1<<6) ; + lms_spi_write( reg, data ) ; + return ; +} + +// Disable the LPF for a specific module +void lms_lpf_disable( lms_module_t mod ) +{ + uint8_t reg = (mod == RX) ? 0x54 : 0x34 ; + lms_spi_write( reg, 0x00 ) ; + return ; +} + +// Get the bandwidth for the selected module +lms_bw_t lms_get_bandwidth( lms_module_t mod ) +{ + uint8_t data ; + uint8_t reg = (mod == RX) ? 0x54 : 0x34 ; + lms_spi_read( reg, &data ) ; + data &= 0x3c ; + data >>= 2 ; + return (lms_bw_t)data ; +} + +// Enable dithering on the module PLL +void lms_dither_enable( lms_module_t mod, uint8_t nbits ) +{ + // Select the base address based on which PLL we are configuring + uint8_t reg = (mod == RX) ? 0x24 : 0x14 ; + uint8_t data ; + + // Read what we currently have in there + lms_spi_read( reg, &data ) ; + + // Enable dithering + data |= (1<<7) ; + + // Clear out the number of bits from before + data &= ~(7<<4) ; + + // Put in the number of bits to dither + data |= ((nbits-1)&7) ; + + // Write it out + lms_spi_write( reg, data ) ; + return ; +} + +// Disable dithering on the module PLL +void lms_dither_disable( lms_module_t mod ) +{ + uint8_t reg = (mod == RX) ? 0x24 : 0x14 ; + uint8_t data ; + lms_spi_read( reg, &data ) ; + data &= ~(1<<7) ; + lms_spi_write( reg, data ) ; + return ; +} + +// Soft reset of the LMS +void lms_soft_reset( ) +{ + lms_spi_write( 0x05, 0x12 ) ; + lms_spi_write( 0x05, 0x32 ) ; + return ; +} + +// Set the gain on the LNA +void lms_lna_set_gain( lms_lna_gain_t gain ) +{ + uint8_t data ; + lms_spi_read( 0x75, &data ) ; + data &= ~(3<<6) ; + data |= ((gain&3)<<6) ; + lms_spi_write( 0x75, data ) ; + return ; +} + +// Select which LNA to enable +void lms_lna_select( lms_lna_t lna ) +{ + uint8_t data ; + lms_spi_read( 0x75, &data ) ; + data &= ~(3<<4) ; + data |= ((lna&3)<<4) ; + lms_spi_write( 0x75, data ) ; + return ; +} + +// Disable RXVGA1 +void lms_rxvga1_disable() +{ + // Set bias current to 0 + lms_spi_write( 0x7b, 0x03 ) ; + return ; +} + +// Enable RXVGA1 +void lms_rxvga1_enable() +{ + // Set bias current to nominal + lms_spi_write( 0x7b, 0x33 ) ; + return ; +} + +// Disable RXVGA2 +void lms_rxvga2_disable() +{ + uint8_t data ; + lms_spi_read( 0x64, &data ) ; + data &= ~(1<<1) ; + lms_spi_write( 0x64, data ) ; + return ; +} + +// Set the gain on RXVGA2 +void lms_rxvga2_set_gain( uint8_t gain ) +{ + // NOTE: Gain is calculated as gain*3dB and shouldn't really + // go above 30dB + if( (gain&0x1f) > 10 ) + { + alt_putstr( "Setting gain above 30dB? You crazy!!\n" ) ; + } + lms_spi_write( 0x65, (0x1f)&gain ) ; + return ; +} + +// Enable RXVGA2 +void lms_rxvga2_enable( uint8_t gain ) +{ + uint8_t data ; + lms_spi_read( 0x64, &data ) ; + data |= (1<<1) ; + lms_spi_write( 0x64, data ) ; + lms_rxvga2_set_gain( gain ) ; + return ; +} + +// Enable PA (PA_ALL is NOT valid for enabling) +void lms_pa_enable( lms_pa_t pa ) +{ + uint8_t data ; + lms_spi_read( 0x44, &data ) ; + if( pa == PA_AUX ) + { + data &= ~(1<<1) ; + } else if( pa == PA_1 ) + { + data &= ~(3<<2) ; + data |= (2<<1) ; + } else if( pa == PA_2 ) + { + data &= ~(3<<2) ; + data |= (4<<1) ; + } + lms_spi_write( 0x44, data ) ; + return ; +} + +// Disable PA +void lms_pa_disable( lms_pa_t pa ) +{ + uint8_t data ; + lms_spi_read( 0x44, &data ) ; + if( pa == PA_ALL ) + { + data |= (1<<1) ; + data &= ~(4<<2) ; + data &= ~(2<<2) ; + } else if( pa == PA_AUX ) + { + data |= (1<<1) ; + } else if( pa == PA_1 ) + { + data &= ~(4<<2) ; + } else { // pa == PA_2 + data &= ~(2<<2) ; + } + lms_spi_write( 0x44, data ) ; + return ; +} + +void lms_peakdetect_enable( ) +{ + uint8_t data ; + lms_spi_read( 0x44, &data ) ; + data &= ~(1<<0) ; + lms_spi_write( 0x44, data ) ; + return ; +} + +void lms_peakdetect_disable( ) +{ + uint8_t data ; + lms_spi_read( 0x44, &data ) ; + data |= (1<<0) ; + lms_spi_write( 0x44, data ) ; + return ; +} + +// Enable TX loopback +void lms_tx_loopback_enable( lms_txlb_t mode ) +{ + uint8_t data ; + switch(mode) + { + case TXLB_BB: + lms_spi_read( 0x46, &data ) ; + data |= (3<<2) ; + lms_spi_write( 0x46, data ) ; + break ; + case TXLB_RF: + // Disable all the PA's first + lms_pa_disable( PA_ALL ) ; + // Connect up the switch + lms_spi_read( 0x0b, &data ) ; + data |= (1<<0) ; + lms_spi_write( 0x0b, data ) ; + // Enable the AUX PA only + lms_pa_enable( PA_AUX ) ; + lms_peakdetect_enable( ); + // Make sure we're muxed over to the AUX mux + lms_spi_read( 0x45, &data ) ; + data &= ~(7<<0) ; + lms_spi_write( 0x45, data ) ; + break ; + } + return ; +} + +// Disable TX loopback +void lms_tx_loopback_disable( lms_txlb_t mode ) +{ + uint8_t data ; + switch(mode) + { + case TXLB_BB: + lms_spi_read( 0x46, &data ) ; + data &= ~(3<<2) ; + lms_spi_write( 0x46, data ) ; + break ; + case TXLB_RF: + // Disable the AUX PA + lms_pa_disable( PA_AUX ) ; + // Disconnect the switch + lms_spi_read( 0x0b, &data ) ; + data &= ~(1<<0) ; + lms_spi_write( 0x0b, data ) ; + break ; + } + return ; +} + +// Loopback enable +void lms_loopback_enable( lms_loopback_mode_t mode ) +{ + uint8_t data ; + switch(mode) + { + case LB_BB_LPF: + // Disable RXVGA1 first + lms_rxvga1_disable() ; + + // Enable BB TX and RX loopback + lms_tx_loopback_enable( TXLB_BB ) ; + lms_spi_write( 0x08, 1<<6 ) ; + break ; + + case LB_BB_VGA2: + // Disable RXLPF first + lms_lpf_disable( RX ) ; + + // Enable TX and RX loopback + lms_tx_loopback_enable( TXLB_BB ) ; + lms_spi_write( 0x08, 1<<5 ) ; + break ; + + case LB_BB_OP: + // Disable RXLPF, RXVGA2, and RXVGA1 + lms_rxvga1_disable() ; + lms_rxvga2_disable() ; + lms_lpf_disable( RX ) ; + + // Enable TX and RX loopback + lms_tx_loopback_enable( TXLB_BB ) ; + lms_spi_write( 0x08, 1<<4 ) ; + break ; + + case LB_RF_LNA1: + // Disable all LNAs + lms_lna_select( LNA_NONE ) ; + + // Enable AUX PA, PD[0], and loopback + lms_tx_loopback_enable( TXLB_RF ) ; +// lms_lna_select( LNA_1 ) ; + lms_spi_read( 0x7d, &data ) ; + data |= 1 ; + lms_spi_write( 0x7d, data ) ; + lms_spi_write( 0x08, 1 ) ; + break ; + + case LB_RF_LNA2: + // Disable all LNAs + lms_lna_select( LNA_NONE ) ; + + // Enable AUX PA, PD[0], and loopback + lms_tx_loopback_enable( TXLB_RF ) ; +// lms_lna_select( LNA_2 ) ; + lms_spi_read( 0x7d, &data ) ; + data |= 1 ; + lms_spi_write( 0x7d, data ) ; + lms_spi_write( 0x08, 2 ) ; + break ; + + case LB_RF_LNA3: + // Disable all LNAs + lms_lna_select( LNA_NONE ) ; + + // Enable AUX PA, PD[0], and loopback + lms_tx_loopback_enable( TXLB_RF ) ; +// lms_lna_select( LNA_3 ) ; + lms_spi_read( 0x7d, &data ) ; + data |= 1 ; + lms_spi_write( 0x7d, data ) ; + lms_spi_write( 0x08, 3 ) ; + break ; + + case LB_NONE: + // Weird + break ; + } + return ; +} + +// Figure out what loopback mode we're in (if any at all!) +lms_loopback_mode_t lms_get_loopback_mode( ) +{ + uint8_t data ; + lms_loopback_mode_t mode = LB_NONE ; + lms_spi_read( 0x08, &data ) ; + if( data == 0 ) + { + mode = LB_NONE ; + } else if( data&(1<<6) ) + { + mode = LB_BB_LPF ; + } else if( data&(1<<5) ) + { + mode = LB_BB_VGA2 ; + } else if( data&(1<<4) ) + { + mode = LB_BB_OP ; + } else if( (data&0xf) == 1 ) + { + mode = LB_RF_LNA1 ; + } else if( (data&0xf) == 2 ) + { + mode = LB_RF_LNA2 ; + } else if( (data&0xf) == 3 ) + { + mode = LB_RF_LNA3 ; + } + return mode ; +} + +// Disable loopback mode - must choose which LNA to hook up and what bandwidth you want +void lms_loopback_disable( lms_lna_t lna, lms_bw_t bw ) +{ + // Read which type of loopback mode we were in + lms_loopback_mode_t mode = lms_get_loopback_mode() ; + + // Disable all RX loopback modes + lms_spi_write( 0x08, 0 ) ; + + switch(mode) + { + case LB_BB_LPF: + // Disable TX baseband loopback + lms_tx_loopback_disable( TXLB_BB ) ; + // Enable RXVGA1 + lms_rxvga1_enable() ; + break ; + case LB_BB_VGA2: + // Disable TX baseband loopback + lms_tx_loopback_disable( TXLB_BB ) ; + // Enable RXLPF + lms_lpf_enable( RX, bw ) ; + break ; + case LB_BB_OP: + // Disable TX baseband loopback + lms_tx_loopback_disable( TXLB_BB ) ; + // Enable RXLPF, RXVGA1 and RXVGA2 + lms_lpf_enable( RX, bw ) ; + lms_rxvga2_enable( 30/3 ) ; + lms_rxvga1_enable() ; + break ; + case LB_RF_LNA1: + case LB_RF_LNA2: + case LB_RF_LNA3: + // Disable TX RF loopback + lms_tx_loopback_disable( TXLB_RF ) ; + // Enable selected LNA + lms_lna_select( lna ) ; + break ; + case LB_NONE: + // Weird + break ; + } + return ; +} + +// Top level power down of the LMS +void lms_power_down( ) +{ + uint8_t data ; + lms_spi_read( 0x05, &data ) ; + data &= ~(1<<4) ; + lms_spi_write( 0x05, data ) ; + return ; +} + +// Enable the PLL of a module +void lms_pll_enable( lms_module_t mod ) +{ + uint8_t reg = (mod == RX) ? 0x24 : 0x14 ; + uint8_t data ; + lms_spi_read( reg, &data ) ; + data |= (1<<3) ; + lms_spi_write( reg, data ) ; + return ; +} + +// Disable the PLL of a module +void lms_pll_disable( lms_module_t mod ) +{ + uint8_t reg = (mod == RX) ? 0x24 : 0x14 ; + uint8_t data ; + lms_spi_read( reg, &data ) ; + data &= ~(1<<3) ; + lms_spi_write( reg, data ) ; + return ; +} + +// Enable the RX subsystem +void lms_rx_enable( ) +{ + uint8_t data ; + lms_spi_read( 0x05, &data ) ; + data |= (1<<2) ; + lms_spi_write( 0x05, data ) ; + return ; +} + +// Disable the RX subsystem +void lms_rx_disable( ) +{ + uint8_t data ; + lms_spi_read( 0x05, &data ) ; + data &= ~(1<<2) ; + lms_spi_write( 0x05, data ) ; + return ; +} + +// Enable the TX subsystem +void lms_tx_enable( ) +{ + uint8_t data ; + lms_spi_read( 0x05, &data ) ; + data |= (1<<3) ; + lms_spi_write( 0x05, data ) ; + return ; +} + +// Disable the TX subsystem +void lms_tx_disable( ) +{ + uint8_t data ; + lms_spi_read( 0x05, &data ) ; + data &= ~(1<<3) ; + lms_spi_write( 0x05, data ) ; + return ; +} + +// Print a frequency structure +void lms_print_frequency( lms_freq_t *f ) +{ + alt_printf( " nint : %x\n", f->nint ) ; + alt_printf( " nfrac : %x\n", f->nfrac ) ; + alt_printf( " freqsel : %x\n", f->freqsel ) ; +} + +// Get the frequency structure +void lms_get_frequency( lms_module_t mod, lms_freq_t *f ) { + uint8_t base = (mod == RX) ? 0x20 : 0x10 ; + uint8_t data ; + lms_spi_read( base+0, &data ) ; + f->nint = ((uint16_t)data) << 1 ; + lms_spi_read( base+1, &data ) ; + f->nint |= (data&0x80)>>7 ; + f->nfrac = ((uint32_t)data&0x7f)<<16 ; + lms_spi_read( base+2, &data ) ; + f->nfrac |= ((uint32_t)data)<<8 ; + lms_spi_read( base+3, &data) ; + f->nfrac |= data ; + lms_spi_read( base+5, &data ) ; + f->freqsel = (data>>2) ; + f->reference = 38400000 ; + return ; +} + +// Set the frequency of a module +void lms_set_frequency( lms_module_t mod, uint32_t freq ) +{ + // Select the base address based on which PLL we are configuring + uint8_t base = (mod == RX) ? 0x20 : 0x10 ; + uint32_t lfreq = freq ; + uint8_t freqsel = bands[0].value ; + uint16_t nint ; + uint32_t nfrac ; + lms_freq_t f ; + uint8_t data ; + uint32_t reference = 38400000 ; + + // Figure out freqsel + if( lfreq < bands[0].low ) + { + // Too low + } else if( lfreq > bands[15].high ) + { + // Too high! + } else + { + uint8_t i = 0 ; + while( i < 16 ) + { + if( (lfreq > bands[i].low) && (lfreq <= bands[i].high) ) + { + freqsel = bands[i].value ; + break ; + } + i++ ; + } + } + + // Calculate nint + nint = 0 ; + reference >>= ((freqsel&7)-3) ; + while( lfreq > reference ) + { + lfreq -= reference ; + nint++ ; + } + + // Turn on the DSMs + lms_spi_read( 0x09, &data ) ; + data |= 0x05 ; + lms_spi_write( 0x09, data ) ; + + // Fractional portion left in freq + nfrac = (lfreq>>2) - (lfreq>>5) - (lfreq>>12) ; + nfrac <<= ((freqsel&7)-3) ; + + f.nint = nint ; + f.nfrac = nfrac ; + f.freqsel = freqsel ; + lms_print_frequency( &f ) ; + + // Program freqsel, selout (rx only), nint and nfrac + if( mod == RX ) + { + lms_spi_write( base+5, freqsel<<2 | (freq < 1500000000 ? 1 : 2 ) ) ; + } else { +// lms_spi_write( base+5, freqsel<<2 ) ; + lms_spi_write( base+5, freqsel<<2 | (freq < 1500000000 ? 1 : 2 ) ) ; + } + data = nint>>1 ;// alt_printf( "%x\n", data ) ; + lms_spi_write( base+0, data ) ; + data = ((nint&1)<<7) | ((nfrac>>16)&0x7f) ;// alt_printf( "%x\n", data ) ; + lms_spi_write( base+1, data ) ; + data = ((nfrac>>8)&0xff) ;// alt_printf( "%x\n", data ) ; + lms_spi_write( base+2, data ) ; + data = (nfrac&0xff) ;// alt_printf( "%x\n", data ) ; + lms_spi_write( base+3, data ) ; + + // Set the PLL Ichp, Iup and Idn currents + lms_spi_read( base+6, &data ) ; + data &= ~(0x1f) ; + data |= 0x0c ; + lms_spi_write( base+6, data ) ; + lms_spi_read( base+7, &data ) ; + data &= ~(0x1f) ; + data |= 3 ; + lms_spi_write( base+7, data ) ; + lms_spi_read( base+8, &data ) ; + data &= ~(0x1f) ; + lms_spi_write( base+8, data ) ; + + // Loop through the VCOCAP to figure out optimal values + lms_spi_read( base+9, &data ) ; + data &= ~(0x3f) ; + { + uint8_t i, vtune, low = 64, high = 0; + for( i = 0 ; i < 64 ; i++ ) + { + data &= ~(0x3f) ; + data |= i ; + lms_spi_write( base+9, data ) ; + lms_spi_read( base+10, &vtune ) ; + if( (vtune&0xc0) == 0xc0 ) + { + alt_putstr( "MESSED UP!!!!!\n" ) ; + } + if( vtune&0x80 ) + { + alt_putstr( "Setting HIGH\n" ) ; + high = i ; + } + if( (vtune&0x40) && low == 64 ) + { + low = i ; + break ; + } + } + alt_printf( "LOW: %x HIGH: %x VCOCAP: %x\n", low, high, (low+high)>>1 ) ; + data &= ~(0x3f) ; + data |= ((low+high)>>1) ; + lms_spi_write( base+9, data ) ; + lms_spi_read( base+10, &vtune ) ; + alt_printf( "VTUNE: %x\n", vtune&0xc0 ) ; + } + + // Turn off the DSMs +// lms_spi_read( 0x09, &data ) ; +// data &= ~(0x05) ; +// lms_spi_write( 0x09, data ) ; + + return ; +} + +void lms_dump_registers(void) +{ + uint8_t data ; + lms_spi_read( 0x02, &data ) ; + lms_spi_read( 0x03, &data ) ; + lms_spi_read( 0x05, &data ) ; + lms_spi_read( 0x06, &data ) ; + lms_spi_read( 0x07, &data ) ; + lms_spi_read( 0x08, &data ) ; + lms_spi_read( 0x09, &data ) ; + lms_spi_read( 0x0A, &data ) ; + lms_spi_read( 0x0B, &data ) ; + lms_spi_read( 0x10, &data ) ; + lms_spi_read( 0x11, &data ) ; + lms_spi_read( 0x12, &data ) ; + lms_spi_read( 0x13, &data ) ; + lms_spi_read( 0x14, &data ) ; + lms_spi_read( 0x15, &data ) ; + lms_spi_read( 0x16, &data ) ; + lms_spi_read( 0x17, &data ) ; + lms_spi_read( 0x18, &data ) ; + lms_spi_read( 0x19, &data ) ; + lms_spi_read( 0x1A, &data ) ; + lms_spi_read( 0x1B, &data ) ; + lms_spi_read( 0x1C, &data ) ; + lms_spi_read( 0x20, &data ) ; + lms_spi_read( 0x21, &data ) ; + lms_spi_read( 0x22, &data ) ; + lms_spi_read( 0x23, &data ) ; + lms_spi_read( 0x24, &data ) ; + lms_spi_read( 0x25, &data ) ; + lms_spi_read( 0x26, &data ) ; + lms_spi_read( 0x27, &data ) ; + lms_spi_read( 0x28, &data ) ; + lms_spi_read( 0x29, &data ) ; + lms_spi_read( 0x2A, &data ) ; + lms_spi_read( 0x2B, &data ) ; + lms_spi_read( 0x2C, &data ) ; + lms_spi_read( 0x32, &data ) ; + lms_spi_read( 0x33, &data ) ; + lms_spi_read( 0x34, &data ) ; + lms_spi_read( 0x35, &data ) ; + lms_spi_read( 0x36, &data ) ; + lms_spi_read( 0x40, &data ) ; + lms_spi_read( 0x41, &data ) ; + lms_spi_read( 0x42, &data ) ; + lms_spi_read( 0x43, &data ) ; + lms_spi_read( 0x44, &data ) ; + lms_spi_read( 0x45, &data ) ; + lms_spi_read( 0x46, &data ) ; + lms_spi_read( 0x47, &data ) ; + lms_spi_read( 0x48, &data ) ; + lms_spi_read( 0x49, &data ) ; + lms_spi_read( 0x4A, &data ) ; + lms_spi_read( 0x4B, &data ) ; + lms_spi_read( 0x4C, &data ) ; + lms_spi_read( 0x4D, &data ) ; + lms_spi_read( 0x52, &data ) ; + lms_spi_read( 0x53, &data ) ; + lms_spi_read( 0x54, &data ) ; + lms_spi_read( 0x55, &data ) ; + lms_spi_read( 0x56, &data ) ; + lms_spi_read( 0x57, &data ) ; + lms_spi_read( 0x58, &data ) ; + lms_spi_read( 0x59, &data ) ; + lms_spi_read( 0x5A, &data ) ; + lms_spi_read( 0x5B, &data ) ; + lms_spi_read( 0x5C, &data ) ; + lms_spi_read( 0x5D, &data ) ; + lms_spi_read( 0x5E, &data ) ; + lms_spi_read( 0x5F, &data ) ; + lms_spi_read( 0x62, &data ) ; + lms_spi_read( 0x63, &data ) ; + lms_spi_read( 0x64, &data ) ; + lms_spi_read( 0x65, &data ) ; + lms_spi_read( 0x66, &data ) ; + lms_spi_read( 0x67, &data ) ; + lms_spi_read( 0x68, &data ) ; + lms_spi_read( 0x70, &data ) ; + lms_spi_read( 0x71, &data ) ; + lms_spi_read( 0x72, &data ) ; + lms_spi_read( 0x73, &data ) ; + lms_spi_read( 0x74, &data ) ; + lms_spi_read( 0x75, &data ) ; + lms_spi_read( 0x76, &data ) ; + lms_spi_read( 0x77, &data ) ; + lms_spi_read( 0x78, &data ) ; + lms_spi_read( 0x79, &data ) ; + lms_spi_read( 0x7A, &data ) ; + lms_spi_read( 0x7B, &data ) ; + lms_spi_read( 0x7C, &data ) ; + lms_spi_read( 0x7D, &data ) ; +} + +void lms_calibrate_dc(void) +{ + // RX path + lms_spi_write( 0x09, 0x8c ) ; // CLK_EN[3] + lms_spi_write( 0x43, 0x08 ) ; // I filter + lms_spi_write( 0x43, 0x28 ) ; // Start Calibration + lms_spi_write( 0x43, 0x08 ) ; // Stop calibration + + lms_spi_write( 0x43, 0x09 ) ; // Q Filter + lms_spi_write( 0x43, 0x29 ) ; + lms_spi_write( 0x43, 0x09 ) ; + + lms_spi_write( 0x09, 0x84 ) ; + + lms_spi_write( 0x09, 0x94 ) ; // CLK_EN[4] + lms_spi_write( 0x66, 0x00 ) ; // Enable comparators + + lms_spi_write( 0x63, 0x08 ) ; // DC reference module + lms_spi_write( 0x63, 0x28 ) ; + lms_spi_write( 0x63, 0x08 ) ; + + lms_spi_write( 0x63, 0x09 ) ; + lms_spi_write( 0x63, 0x29 ) ; + lms_spi_write( 0x63, 0x09 ) ; + + lms_spi_write( 0x63, 0x0a ) ; + lms_spi_write( 0x63, 0x2a ) ; + lms_spi_write( 0x63, 0x0a ) ; + + lms_spi_write( 0x63, 0x0b ) ; + lms_spi_write( 0x63, 0x2b ) ; + lms_spi_write( 0x63, 0x0b ) ; + + lms_spi_write( 0x63, 0x0c ) ; + lms_spi_write( 0x63, 0x2c ) ; + lms_spi_write( 0x63, 0x0c ) ; + + lms_spi_write( 0x66, 0x0a ) ; + lms_spi_write( 0x09, 0x84 ) ; + + // TX path + lms_spi_write( 0x57, 0x04 ) ; + lms_spi_write( 0x09, 0x42 ) ; + + lms_spi_write( 0x33, 0x08 ) ; + lms_spi_write( 0x33, 0x28 ) ; + lms_spi_write( 0x33, 0x08 ) ; + + lms_spi_write( 0x33, 0x09 ) ; + lms_spi_write( 0x33, 0x29 ) ; + lms_spi_write( 0x33, 0x09 ) ; + + lms_spi_write( 0x57, 0x84 ) ; + lms_spi_write( 0x09, 0x81 ) ; + + lms_spi_write( 0x42, 0x77 ) ; + lms_spi_write( 0x43, 0x7f ) ; + + return ; +} + +void lms_lpf_init(void) +{ + lms_spi_write( 0x06, 0x0d ) ; + lms_spi_write( 0x17, 0x43 ) ; + lms_spi_write( 0x27, 0x43 ) ; + lms_spi_write( 0x41, 0x1f ) ; + lms_spi_write( 0x44, 1<<3 ) ; + lms_spi_write( 0x45, 0x1f<<3 ) ; + lms_spi_write( 0x48, 0x1f ) ; + lms_spi_write( 0x49, 0x1f ) ; + return ; +} + +const char msg[] = "bladeRF FSK example!\n" ; + +// Entry point +int main() +{ + alt_u32 rv ; + alt_u8 i, flag; + alt_u8 data ; + lms_bw_t bw ; + alt_putstr("bladeRF LMS6002D SPI Register Readback!\n"); + alt_putstr("---------------------------------------\n"); + +// lms_freq_t f ; + +// lms_lpf_init(); + +// lms_calibrate_dc( ) ; +// +// lms_tx_disable() ; +// lms_rx_disable() ; +// +// lms_soft_reset() ; +// lms_tx_enable() ; +// lms_rx_enable() ; +// lms_pa_disable( PA_ALL ) ; +// +// lms_lpf_init( ) ; +// +// lms_set_frequency( RX, 394000000 ) ; +// lms_set_frequency( TX, 394000000 ) ; +// lms_set_frequency( TX, 1536000000 ) ; +// lms_set_frequency( TX, 1536000000 ) ; +// lms_set_frequency( TX, 1536000000 ) ; +// +// lms_rxvga2_set_gain( 30 ) ; + +// lms_lna_select( LNA_1 ) ; +// lms_pa_enable( PA_1 ) ; +//// +// lms_loopback_enable( LB_RF_LNA1 ) ; +// lms_pa_enable( PA_AUX ) ; +// lms_power_down() ; +// lms_get_frequency( RX, &f ) ; +// lms_print_frequency( &f ) ; +// lms_get_frequency( TX, &f ) ; +// lms_print_frequency( &f ) ; +// +// lms_dump_registers() ; +// lms_spi_write( 0x09, 1<<7 ) ; +// lms_lpf_bypass( RX ) ; +// lms_lpf_bypass( TX ) ; +// +// lms_lpf_enable( RX, BW_28MHz ) ; +// lms_lpf_enable( TX, BW_28MHz ) ; + +//// // Config from thing +// lms_spi_write( 0x82, 0x1F ) ; +// lms_spi_write( 0x83, 0x08 ) ; +// lms_spi_write( 0x85, 0x3E ) ; +// lms_spi_write( 0x86, 0x0D ) ; +// lms_spi_write( 0x87, 0x00 ) ; +// lms_spi_write( 0x88, 0x01 ) ; +// lms_spi_write( 0x89, 0xC5 ) ; +// lms_spi_write( 0x8A, 0x00 ) ; +// lms_spi_write( 0x8B, 0x09 ) ; // 0x09 for loopback +// lms_spi_write( 0x90, 0x34 ) ; +// lms_spi_write( 0x91, 0x15 ) ; +// lms_spi_write( 0x92, 0x55 ) ; +// lms_spi_write( 0x93, 0x55 ) ; +// lms_spi_write( 0x94, 0x88 ) ; +// lms_spi_write( 0x95, 0x99 ) ; +// lms_spi_write( 0x96, 0x8C ) ; +// lms_spi_write( 0x97, 0xE3 ) ; +// lms_spi_write( 0x98, 0x40 ) ; +// lms_spi_write( 0x99, 0x99 ) ; +// lms_spi_write( 0x9A, 0x03 ) ; +// lms_spi_write( 0x9B, 0x76 ) ; +// lms_spi_write( 0x9C, 0x38 ) ; +// lms_spi_write( 0xA0, 0x34 ) ; +// lms_spi_write( 0xA1, 0x15 ) ; +// lms_spi_write( 0xA2, 0x55 ) ; +// lms_spi_write( 0xA3, 0x55 ) ; +// lms_spi_write( 0xA4, 0x88 ) ; +// lms_spi_write( 0xA5, 0x99 ) ; +// lms_spi_write( 0xA6, 0x8C ) ; +// lms_spi_write( 0xA7, 0xE3 ) ; +// lms_spi_write( 0xA8, 0x40 ) ; +// lms_spi_write( 0xA9, 0x9F ) ; +// lms_spi_write( 0xAA, 0x03 ) ; +// lms_spi_write( 0xAB, 0x76 ) ; +// lms_spi_write( 0xAC, 0x38 ) ; +// lms_spi_write( 0xB2, 0x1F ) ; +// lms_spi_write( 0xB3, 0x08 ) ; +// lms_spi_write( 0xB4, 0x02 ) ; +// lms_spi_write( 0xB5, 0x0C ) ; +// lms_spi_write( 0xB6, 0x30 ) ; +// lms_spi_write( 0xC0, 0x02 ) ; +// lms_spi_write( 0xC1, 0x15 ) ; +// lms_spi_write( 0xC2, 0x80 ) ; +// lms_spi_write( 0xC3, 0x80 ) ; +// lms_spi_write( 0xC4, 0x03 ) ; // 0x03 for lb +// lms_spi_write( 0xC5, 0x00 ) ; // 0x00 for lb +// lms_spi_write( 0xC6, 0x00 ) ; +// lms_spi_write( 0xC7, 0x40 ) ; +// lms_spi_write( 0xC8, 0x0C ) ; +// lms_spi_write( 0xC9, 0x0C ) ; +// lms_spi_write( 0xCA, 0x18 ) ; +// lms_spi_write( 0xCB, 0x50 ) ; +// lms_spi_write( 0xCC, 0x07 ) ; +// lms_spi_write( 0xCD, 0x00 ) ; +// lms_spi_write( 0xD2, 0x1F ) ; +// lms_spi_write( 0xD3, 0x08 ) ; +// lms_spi_write( 0xD4, 0x12 ) ; +// lms_spi_write( 0xD5, 0x0C ) ; +// lms_spi_write( 0xD6, 0x30 ) ; +// lms_spi_write( 0xD7, 0x94 ) ; +// lms_spi_write( 0xD8, 0x00 ) ; +// lms_spi_write( 0xD9, 0x09 ) ; +// lms_spi_write( 0xDA, 0x20 ) ; +// lms_spi_write( 0xDB, 0x00 ) ; +// lms_spi_write( 0xDC, 0x00 ) ; +// lms_spi_write( 0xDD, 0x00 ) ; +// lms_spi_write( 0xDE, 0x00 ) ; +// lms_spi_write( 0xDF, 0x1F ) ; +// lms_spi_write( 0xE2, 0x1F ) ; +// lms_spi_write( 0xE3, 0x08 ) ; +// lms_spi_write( 0xE4, 0x32 ) ; +// lms_spi_write( 0xE5, 0x03 ) ; // 0x01 !! +// lms_spi_write( 0xE6, 0x00 ) ; +// lms_spi_write( 0xE7, 0x00 ) ; +// lms_spi_write( 0xE8, 0x01 ) ; +// lms_spi_write( 0xF0, 0x03 ) ; +// lms_spi_write( 0xF1, 0x80 ) ; +// lms_spi_write( 0xF2, 0x80 ) ; +// lms_spi_write( 0xF3, 0x00 ) ; +// lms_spi_write( 0xF4, 0x00 ) ; +// lms_spi_write( 0xF5, 0xD0 ) ; // 0xd0 +// lms_spi_write( 0xF6, 0x78 ) ; +// lms_spi_write( 0xF7, 0x00 ) ; +// lms_spi_write( 0xF8, 0x1C ) ; +// lms_spi_write( 0xF9, 0x37 ) ; +// lms_spi_write( 0xFA, 0x77 ) ; +// lms_spi_write( 0xFB, 0x77 ) ; +// lms_spi_write( 0xFC, 0x18 ) ; +// lms_spi_write( 0xFD, 0x01 ) ; + + // 500MHz out of PA1 + lms_spi_write( 0X82, 0x1F ) ; + lms_spi_write( 0X83, 0x08 ) ; + lms_spi_write( 0X85, 0x3E ) ; + lms_spi_write( 0X86, 0x0D ) ; + lms_spi_write( 0X87, 0x00 ) ; + lms_spi_write( 0X88, 0x00 ) ; + lms_spi_write( 0X89, 0x45 ) ; + lms_spi_write( 0X8A, 0x00 ) ; + lms_spi_write( 0X8B, 0x08 ) ; + lms_spi_write( 0X90, 0x34 ) ; + lms_spi_write( 0X91, 0x15 ) ; + lms_spi_write( 0X92, 0x55 ) ; + lms_spi_write( 0X93, 0x55 ) ; + lms_spi_write( 0X94, 0x88 ) ; + lms_spi_write( 0X95, 0x99 ) ; + lms_spi_write( 0X96, 0x8C ) ; + lms_spi_write( 0X97, 0xE3 ) ; + lms_spi_write( 0X98, 0x40 ) ; + lms_spi_write( 0X99, 0x99 ) ; + lms_spi_write( 0X9A, 0x03 ) ; + lms_spi_write( 0X9B, 0x76 ) ; + lms_spi_write( 0X9C, 0x38 ) ; + lms_spi_write( 0XA0, 0x34 ) ; + lms_spi_write( 0XA1, 0x15 ) ; + lms_spi_write( 0XA2, 0x55 ) ; + lms_spi_write( 0XA3, 0x55 ) ; + lms_spi_write( 0XA4, 0x88 ) ; + lms_spi_write( 0XA5, 0x99 ) ; + lms_spi_write( 0XA6, 0x8C ) ; + lms_spi_write( 0XA7, 0xE3 ) ; + lms_spi_write( 0XA8, 0x40 ) ; + lms_spi_write( 0XA9, 0x9F ) ; + lms_spi_write( 0XAA, 0x03 ) ; + lms_spi_write( 0XAB, 0x76 ) ; + lms_spi_write( 0XAC, 0x38 ) ; + lms_spi_write( 0XB2, 0x1F ) ; + lms_spi_write( 0XB3, 0x08 ) ; + lms_spi_write( 0XB4, 0x02 ) ; + lms_spi_write( 0XB5, 0x0C ) ; // 0x0C for normal LPF + lms_spi_write( 0XB6, 0x30 ) ; + lms_spi_write( 0XC0, 0x02 ) ; + lms_spi_write( 0XC1, 0x1F ) ; + lms_spi_write( 0XC2, 0x80 ) ; + lms_spi_write( 0XC3, 0x80 ) ; + lms_spi_write( 0XC4, 0x0B ) ; + lms_spi_write( 0XC5, 0xC8 ) ; + lms_spi_write( 0XC6, 0x00 ) ; + lms_spi_write( 0XC7, 0x40 ) ; + lms_spi_write( 0XC8, 0x0C ) ; + lms_spi_write( 0XC9, 0x0C ) ; + lms_spi_write( 0XCA, 0x18 ) ; + lms_spi_write( 0XCB, 0x50 ) ; + lms_spi_write( 0XCC, 0x00 ) ; + lms_spi_write( 0XCD, 0x00 ) ; + lms_spi_write( 0XD2, 0x1F ) ; + lms_spi_write( 0XD3, 0x08 ) ; + lms_spi_write( 0XD4, 0x02 ) ; + lms_spi_write( 0XD5, 0x0C ) ; + lms_spi_write( 0XD6, 0x30 ) ; + lms_spi_write( 0XD7, 0x94 ) ; + lms_spi_write( 0XD8, 0x00 ) ; + lms_spi_write( 0XD9, 0x09 ) ; + lms_spi_write( 0XDA, 0x20 ) ; + lms_spi_write( 0XDB, 0x00 ) ; + lms_spi_write( 0XDC, 0x00 ) ; + lms_spi_write( 0XDD, 0x00 ) ; + lms_spi_write( 0XDE, 0x00 ) ; + lms_spi_write( 0XDF, 0x1F ) ; + lms_spi_write( 0XE2, 0x1F ) ; + lms_spi_write( 0XE3, 0x08 ) ; + lms_spi_write( 0XE4, 0x32 ) ; + lms_spi_write( 0XE5, 0x01 ) ; + lms_spi_write( 0XE6, 0x00 ) ; + lms_spi_write( 0XE7, 0x00 ) ; + lms_spi_write( 0XE8, 0x01 ) ; + lms_spi_write( 0XF0, 0x01 ) ; + lms_spi_write( 0XF1, 0x80 ) ; + lms_spi_write( 0XF2, 0x80 ) ; + lms_spi_write( 0XF3, 0x00 ) ; + lms_spi_write( 0XF4, 0x00 ) ; + lms_spi_write( 0XF5, 0x50 ) ; + lms_spi_write( 0XF6, 0x02 ) ; // 0x78 + lms_spi_write( 0XF7, 0x00 ) ; + lms_spi_write( 0XF8, 0x1C ) ; + lms_spi_write( 0XF9, 0x37 ) ; + lms_spi_write( 0XFA, 0x77 ) ; + lms_spi_write( 0XFB, 0x77 ) ; + lms_spi_write( 0XFC, 0x18 ) ; + lms_spi_write( 0XFD, 0x00 ) ; + + +// lms_set_frequency( RX, 284000000 ) ; +// lms_set_frequency( TX, 284000000 ) ; +// +// lms_dump_registers() ; + + + +// lms_set_frequency( RX, 500000000 ) ; +// lms_set_frequency( TX, 500000000 ) ; + + { + uint16_t x = 0 ; + while(1) { + dac_write( x ) ; + alt_busy_sleep( 1000000 ) ; + x += 1024 ; + } + } + dac_write( 0xffff ) ; +// while (1) { +// dac_write( 0 ) ; + // } + + + /* Event loop never exits. */ + { + uint32_t downcount = 1 ; + uint8_t letter = 'a' ; + while(1) + { + // Check if anything is in the JTAG UART + uint32_t reg = IORD_ALTERA_AVALON_JTAG_UART_DATA(JTAG_UART_0_BASE) ; + if( reg & ALTERA_AVALON_JTAG_UART_DATA_RVALID_MSK ) + { + // Get value from JTAG UART + uint8_t letter = (uint8_t)(reg & ALTERA_AVALON_JTAG_UART_DATA_DATA_MSK) ; + + // Write it out to the FSK UART + while( (IORD_ALTERA_AVALON_UART_STATUS(UART_0_BASE) & ALTERA_AVALON_UART_STATUS_TRDY_MSK) == 0 ) { ; } + IOWR_ALTERA_AVALON_UART_TXDATA(UART_0_BASE, letter) ; + } + + // Check if anything is in the FSK UART + if( IORD_ALTERA_AVALON_UART_STATUS(UART_0_BASE) & ALTERA_AVALON_UART_STATUS_RRDY_MSK ) + { + uint8_t val ; + val = IORD_ALTERA_AVALON_UART_RXDATA(UART_0_BASE) ; + + // Write it out the JTAG UART + alt_printf( "%c", val ) ; + } + +// { +// while( (IORD_ALTERA_AVALON_UART_STATUS(UART_0_BASE) & ALTERA_AVALON_UART_STATUS_TRDY_MSK) == 0 ) { +// uint8_t a ; +// a = 1 ; +// }; +// IOWR_ALTERA_AVALON_UART_TXDATA(UART_0_BASE, letter) ; +// alt_printf( "Writing: '%c'\n", letter ) ; +// letter = letter + 1 ; +// if( letter > 'z' ) { +// letter = 'a' ; +// } +// } + } + } + + alt_putstr( "-- End of main loop --\n" ) ; + + // It's a trap!! + //dac_write( 0xffff ) ; + //while (1) { +// dac_write( 0xffff ) ; +// } + + return 0; +} diff --git a/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/.cproject b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/.cproject new file mode 100644 index 00000000..0fb33818 --- /dev/null +++ b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/.cproject @@ -0,0 +1,481 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/.project b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/.project new file mode 100644 index 00000000..b0126c5e --- /dev/null +++ b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/.project @@ -0,0 +1,85 @@ + + + lms_spi_controller_bsp + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + all + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + make + + + org.eclipse.cdt.make.core.buildLocation + ${workspace_loc://lms_spi_controller_bsp} + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + all + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.eclipse.cdt.core.ccnature + com.altera.sbtgui.project.SBTGUINature + com.altera.sbtgui.project.SBTGUIBspNature + + diff --git a/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/Makefile b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/Makefile new file mode 100644 index 00000000..a357e131 --- /dev/null +++ b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/Makefile @@ -0,0 +1,781 @@ +#------------------------------------------------------------------------------ +# BSP MAKEFILE +# +# This makefile was automatically generated by the nios2-bsp-generate-files +# command. Its purpose is to build a custom Board Support Package (BSP) +# targeting a specific Nios II processor in an SOPC Builder-based design. +# +# To create an application or library Makefile which uses this BSP, try the +# nios2-app-generate-makefile or nios2-lib-generate-makefile commands. +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# TOOLS +#------------------------------------------------------------------------------ + +MKDIR := mkdir -p +ECHO := echo +SPACE := $(empty) $(empty) + +#------------------------------------------------------------------------------ +# The adjust-path macro +# +# If COMSPEC is defined, Make is launched from Windows through +# Cygwin. This adjust-path macro will call 'cygpath -u' on all +# paths to ensure they are readable by Make. +# +# If COMSPEC is not defined, Make is launched from *nix, and no adjustment +# is necessary +#------------------------------------------------------------------------------ + +ifndef COMSPEC +ifdef ComSpec +COMSPEC = $(ComSpec) +endif # ComSpec +endif # !COMSPEC + +ifdef COMSPEC + adjust-path = $(subst $(SPACE),\$(SPACE),$(shell cygpath -u "$1")) + adjust-path-mixed = $(subst $(SPACE),\$(SPACE),$(shell cygpath -m "$1")) +else + adjust-path = $(subst $(SPACE),\$(SPACE),$1) + adjust-path-mixed = $(subst $(SPACE),\$(SPACE),$1) +endif + +#------------------------------------------------------------------------------ +# DEFAULT TARGET +# +# The default target, "all", must appear before any other target in the +# Makefile. Note that extra prerequisites are added to the "all" rule later. +#------------------------------------------------------------------------------ +.PHONY: all +all: + @$(ECHO) [BSP build complete] + + +#------------------------------------------------------------------------------ +# PATHS & DIRECTORY NAMES +# +# Explicitly locate absolute path of the BSP root +#------------------------------------------------------------------------------ + +BSP_ROOT_DIR := . + +# Define absolute path to the root of the BSP. +ABS_BSP_ROOT := $(call adjust-path-mixed,$(shell pwd)) + +# Stash all BSP object files here +OBJ_DIR := ./obj + + +#------------------------------------------------------------------------------ +# MANAGED CONTENT +# +# All content between the lines "START MANAGED" and "END MANAGED" below is +# generated based on variables in the BSP settings file when the +# nios2-bsp-generate-files command is invoked. If you wish to persist any +# information pertaining to the build process, it is recomended that you +# utilize the BSP settings mechanism to do so. +# +# Note that most variable assignments in this section have a corresponding BSP +# setting that can be changed by using the nios2-bsp-create-settings or +# nios2-bsp-update-settings command before nios2-bsp-generate-files; if you +# want any variable set to a specific value when this Makefile is re-generated +# (to prevent hand-edits from being over-written), use the BSP settings +# facilities above. +#------------------------------------------------------------------------------ + +#START MANAGED + +# The following TYPE comment allows tools to identify the 'type' of target this +# makefile is associated with. +# TYPE: BSP_PRIVATE_MAKEFILE + +# This following VERSION comment indicates the version of the tool used to +# generate this makefile. A makefile variable is provided for VERSION as well. +# ACDS_VERSION: 12.1sp1 +ACDS_VERSION := 12.1sp1 + +# This following BUILD_NUMBER comment indicates the build number of the tool +# used to generate this makefile. +# BUILD_NUMBER: 243 + +SETTINGS_FILE := settings.bsp +SOPC_FILE := Z:/work/nuandclean/release/hdl/fpga/ip/altera/nios_system/nios_system.sopcinfo + +#------------------------------------------------------------------------------- +# TOOL & COMMAND DEFINITIONS +# +# The base command for each build operation are expressed here. Additional +# switches may be expressed here. They will run for all instances of the +# utility. +#------------------------------------------------------------------------------- + +# Archiver command. Creates library files. +AR = nios2-elf-ar + +# Assembler command. Note that CC is used for .S files. +AS = nios2-elf-gcc + +# Custom flags only passed to the archiver. This content of this variable is +# directly passed to the archiver rather than the more standard "ARFLAGS". The +# reason for this is that GNU Make assumes some default content in ARFLAGS. +# This setting defines the value of BSP_ARFLAGS in Makefile. +BSP_ARFLAGS = -src + +# Custom flags only passed to the assembler. This setting defines the value of +# BSP_ASFLAGS in Makefile. +BSP_ASFLAGS = -Wa,-gdwarf2 + +# C/C++ compiler debug level. '-g' provides the default set of debug symbols +# typically required to debug a typical application. Omitting '-g' removes +# debug symbols from the ELF. This setting defines the value of +# BSP_CFLAGS_DEBUG in Makefile. +BSP_CFLAGS_DEBUG = -g + +# C/C++ compiler optimization level. "-O0" = no optimization,"-O2" = "normal" +# optimization, etc. "-O0" is recommended for code that you want to debug since +# compiler optimization can remove variables and produce non-sequential +# execution of code while debugging. This setting defines the value of +# BSP_CFLAGS_OPTIMIZATION in Makefile. +BSP_CFLAGS_OPTIMIZATION = '-Os' + +# C/C++ compiler warning level. "-Wall" is commonly used.This setting defines +# the value of BSP_CFLAGS_WARNINGS in Makefile. +BSP_CFLAGS_WARNINGS = -Wall + +# C compiler command. +CC = nios2-elf-gcc -xc + +# C++ compiler command. +CXX = nios2-elf-gcc -xc++ + +# Command used to remove files during 'clean' target. +RM = rm -f + + +#------------------------------------------------------------------------------- +# BUILD PRE & POST PROCESS COMMANDS +# +# The following variables are treated as shell commands in the rule +# definitions for each file-type associated with the BSP build, as well as +# commands run at the beginning and end of the entire BSP build operation. +# Pre-process commands are executed before the relevant command (for example, +# a command defined in the "CC_PRE_PROCESS" variable executes before the C +# compiler for building .c files), while post-process commands are executed +# immediately afterwards. +# +# You can view each pre/post-process command in the "Build Rules: All & +# Clean", "Pattern Rules to Build Objects", and "Library Rules" sections of +# this Makefile. +#------------------------------------------------------------------------------- + + +#------------------------------------------------------------------------------- +# BSP SOURCE BUILD SETTINGS (FLAG GENERATION) +# +# Software build settings such as compiler optimization, debug level, warning +# flags, etc., may be defined in the following variables. The variables below +# are concatenated together in the 'Flags' section of this Makefile to form +# final variables of flags passed to the build tools. +# +# These settings are considered private to the BSP and apply to all library & +# driver files in it; they do NOT automatically propagate to, for example, the +# build settings for an application. +# # For additional detail and syntax requirements, please refer to GCC help +# (example: "nios2-elf-gcc --help --verbose"). +# +# Unless indicated otherwise, multiple entries in each variable should be +# space-separated. +#------------------------------------------------------------------------------- + +# Altera HAL alt_sys_init.c generated source file +GENERATED_C_FILES := $(ABS_BSP_ROOT)/alt_sys_init.c +GENERATED_C_LIB_SRCS += alt_sys_init.c + + +#------------------------------------------------------------------------------- +# BSP SOURCE FILE LISTING +# +# All source files that comprise the BSP are listed here, along with path +# information to each file expressed relative to the BSP root. The precise +# list and location of each file is derived from the driver, operating system, +# or software package source file declarations. +# +# Following specification of the source files for each component, driver, etc., +# each source file type (C, assembly, etc.) is concatenated together and used +# to construct a list of objects. Pattern rules to build each object are then +# used to build each file. +#------------------------------------------------------------------------------- + +# altera_avalon_jtag_uart_driver sources root +altera_avalon_jtag_uart_driver_SRCS_ROOT := drivers + +# altera_avalon_jtag_uart_driver sources +altera_avalon_jtag_uart_driver_C_LIB_SRCS := \ + $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_init.c \ + $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_read.c \ + $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_write.c \ + $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_ioctl.c \ + $(altera_avalon_jtag_uart_driver_SRCS_ROOT)/src/altera_avalon_jtag_uart_fd.c + +# altera_avalon_spi_driver sources root +altera_avalon_spi_driver_SRCS_ROOT := drivers + +# altera_avalon_spi_driver sources +altera_avalon_spi_driver_C_LIB_SRCS := \ + $(altera_avalon_spi_driver_SRCS_ROOT)/src/altera_avalon_spi.c + +# altera_avalon_timer_driver sources root +altera_avalon_timer_driver_SRCS_ROOT := drivers + +# altera_avalon_timer_driver sources +altera_avalon_timer_driver_C_LIB_SRCS := \ + $(altera_avalon_timer_driver_SRCS_ROOT)/src/altera_avalon_timer_sc.c \ + $(altera_avalon_timer_driver_SRCS_ROOT)/src/altera_avalon_timer_ts.c \ + $(altera_avalon_timer_driver_SRCS_ROOT)/src/altera_avalon_timer_vars.c + +# altera_avalon_uart_driver sources root +altera_avalon_uart_driver_SRCS_ROOT := drivers + +# altera_avalon_uart_driver sources +altera_avalon_uart_driver_C_LIB_SRCS := \ + $(altera_avalon_uart_driver_SRCS_ROOT)/src/altera_avalon_uart_fd.c \ + $(altera_avalon_uart_driver_SRCS_ROOT)/src/altera_avalon_uart_init.c \ + $(altera_avalon_uart_driver_SRCS_ROOT)/src/altera_avalon_uart_ioctl.c \ + $(altera_avalon_uart_driver_SRCS_ROOT)/src/altera_avalon_uart_read.c \ + $(altera_avalon_uart_driver_SRCS_ROOT)/src/altera_avalon_uart_write.c + +# altera_nios2_qsys_hal_driver sources root +altera_nios2_qsys_hal_driver_SRCS_ROOT := HAL + +# altera_nios2_qsys_hal_driver sources +altera_nios2_qsys_hal_driver_C_LIB_SRCS := \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/altera_nios2_qsys_irq.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_usleep.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_busy_sleep.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_irq_vars.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_icache_flush.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_icache_flush_all.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_dcache_flush.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_dcache_flush_all.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_dcache_flush_no_writeback.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_instruction_exception_entry.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_irq_register.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_iic.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_remap_cached.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_remap_uncached.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_uncached_free.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_uncached_malloc.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_do_ctors.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_do_dtors.c \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_gmon.c + +altera_nios2_qsys_hal_driver_ASM_LIB_SRCS := \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_exception_entry.S \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_exception_trap.S \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_exception_muldiv.S \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_irq_entry.S \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_software_exception.S \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_mcount.S \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/alt_log_macro.S \ + $(altera_nios2_qsys_hal_driver_SRCS_ROOT)/src/crt0.S + +# hal sources root +hal_SRCS_ROOT := HAL + +# hal sources +hal_C_LIB_SRCS := \ + $(hal_SRCS_ROOT)/src/alt_alarm_start.c \ + $(hal_SRCS_ROOT)/src/alt_close.c \ + $(hal_SRCS_ROOT)/src/alt_dev.c \ + $(hal_SRCS_ROOT)/src/alt_dev_llist_insert.c \ + $(hal_SRCS_ROOT)/src/alt_dma_rxchan_open.c \ + $(hal_SRCS_ROOT)/src/alt_dma_txchan_open.c \ + $(hal_SRCS_ROOT)/src/alt_environ.c \ + $(hal_SRCS_ROOT)/src/alt_env_lock.c \ + $(hal_SRCS_ROOT)/src/alt_errno.c \ + $(hal_SRCS_ROOT)/src/alt_execve.c \ + $(hal_SRCS_ROOT)/src/alt_exit.c \ + $(hal_SRCS_ROOT)/src/alt_fcntl.c \ + $(hal_SRCS_ROOT)/src/alt_fd_lock.c \ + $(hal_SRCS_ROOT)/src/alt_fd_unlock.c \ + $(hal_SRCS_ROOT)/src/alt_find_dev.c \ + $(hal_SRCS_ROOT)/src/alt_find_file.c \ + $(hal_SRCS_ROOT)/src/alt_flash_dev.c \ + $(hal_SRCS_ROOT)/src/alt_fork.c \ + $(hal_SRCS_ROOT)/src/alt_fs_reg.c \ + $(hal_SRCS_ROOT)/src/alt_fstat.c \ + $(hal_SRCS_ROOT)/src/alt_get_fd.c \ + $(hal_SRCS_ROOT)/src/alt_getchar.c \ + $(hal_SRCS_ROOT)/src/alt_getpid.c \ + $(hal_SRCS_ROOT)/src/alt_gettod.c \ + $(hal_SRCS_ROOT)/src/alt_iic_isr_register.c \ + $(hal_SRCS_ROOT)/src/alt_instruction_exception_register.c \ + $(hal_SRCS_ROOT)/src/alt_ioctl.c \ + $(hal_SRCS_ROOT)/src/alt_io_redirect.c \ + $(hal_SRCS_ROOT)/src/alt_irq_handler.c \ + $(hal_SRCS_ROOT)/src/alt_isatty.c \ + $(hal_SRCS_ROOT)/src/alt_kill.c \ + $(hal_SRCS_ROOT)/src/alt_link.c \ + $(hal_SRCS_ROOT)/src/alt_load.c \ + $(hal_SRCS_ROOT)/src/alt_log_printf.c \ + $(hal_SRCS_ROOT)/src/alt_lseek.c \ + $(hal_SRCS_ROOT)/src/alt_main.c \ + $(hal_SRCS_ROOT)/src/alt_malloc_lock.c \ + $(hal_SRCS_ROOT)/src/alt_open.c \ + $(hal_SRCS_ROOT)/src/alt_printf.c \ + $(hal_SRCS_ROOT)/src/alt_putchar.c \ + $(hal_SRCS_ROOT)/src/alt_putstr.c \ + $(hal_SRCS_ROOT)/src/alt_read.c \ + $(hal_SRCS_ROOT)/src/alt_release_fd.c \ + $(hal_SRCS_ROOT)/src/alt_rename.c \ + $(hal_SRCS_ROOT)/src/alt_sbrk.c \ + $(hal_SRCS_ROOT)/src/alt_settod.c \ + $(hal_SRCS_ROOT)/src/alt_stat.c \ + $(hal_SRCS_ROOT)/src/alt_tick.c \ + $(hal_SRCS_ROOT)/src/alt_times.c \ + $(hal_SRCS_ROOT)/src/alt_unlink.c \ + $(hal_SRCS_ROOT)/src/alt_wait.c \ + $(hal_SRCS_ROOT)/src/alt_write.c + + +# Assemble all component C source files +COMPONENT_C_LIB_SRCS += \ + $(altera_avalon_jtag_uart_driver_C_LIB_SRCS) \ + $(altera_avalon_spi_driver_C_LIB_SRCS) \ + $(altera_avalon_timer_driver_C_LIB_SRCS) \ + $(altera_avalon_uart_driver_C_LIB_SRCS) \ + $(altera_nios2_qsys_hal_driver_C_LIB_SRCS) \ + $(hal_C_LIB_SRCS) + +# Assemble all component assembly source files +COMPONENT_ASM_LIB_SRCS += \ + $(altera_nios2_qsys_hal_driver_ASM_LIB_SRCS) + +# Assemble all component C++ source files +COMPONENT_CPP_LIB_SRCS += \ + +#END MANAGED + +#------------------------------------------------------------------------------ +# PUBLIC.MK +# +# The generated public.mk file contains BSP information that is shared with +# other external makefiles, such as a Nios II application makefile. System- +# dependent information such as hardware-specific compiler flags and +# simulation file generation are stored here. +# +# In addition, public.mk contains include paths that various software, +# such as a device driver, may need for the C compiler. These paths are +# written to public.mk with respect to the BSP root. In public.mk, each +# path is prefixed with a special variable, $(ALT_LIBRARY_ROOT_DIR). The +# purpose of this variable is to allow an external Makefile to append on +# path information to precisely locate paths expressed in public.mk +# Since this is the BSP Makefile, we set ALT_LIBRARY_ROOT_DIR to point right +# here ("."), at the BSP root. +# +# ALT_LIBRARY_ROOT_DIR must always be set before public.mk is included. +#------------------------------------------------------------------------------ +ALT_LIBRARY_ROOT_DIR := . +include public.mk + + +#------------------------------------------------------------------------------ +# FLAGS +# +# Include paths for BSP files are written into the public.mk file and must +# be added to the existing list of pre-processor flags. In addition, "hooks" +# for standard flags left intentionally empty (CFLAGS, CPPFLAGS, ASFLAGS, +# and CXXFLAGS) are provided for conveniently adding to the relevant flags +# on the command-line or via script that calls make. +#------------------------------------------------------------------------------ +# Assemble final list of compiler flags from generated content +BSP_CFLAGS += \ + $(BSP_CFLAGS_DEFINED_SYMBOLS) \ + $(BSP_CFLAGS_UNDEFINED_SYMBOLS) \ + $(BSP_CFLAGS_OPTIMIZATION) \ + $(BSP_CFLAGS_DEBUG) \ + $(BSP_CFLAGS_WARNINGS) \ + $(BSP_CFLAGS_USER_FLAGS) \ + $(ALT_CFLAGS) \ + $(CFLAGS) + +# Make ready the final list of include directories and other C pre-processor +# flags. Each include path is made ready by prefixing it with "-I". +BSP_CPPFLAGS += \ + $(addprefix -I, $(BSP_INC_DIRS)) \ + $(addprefix -I, $(ALT_INCLUDE_DIRS)) \ + $(ALT_CPPFLAGS) \ + $(CPPFLAGS) + +# Finish off assembler flags with any user-provided flags +BSP_ASFLAGS += $(ASFLAGS) + +# Finish off C++ flags with any user-provided flags +BSP_CXXFLAGS += $(CXXFLAGS) + +# And finally, the ordered list +C_SRCS += $(GENERATED_C_LIB_SRCS) \ + $(COMPONENT_C_LIB_SRCS) + +CXX_SRCS += $(GENERATED_CPP_LIB_SRCS) \ + $(COMPONENT_CPP_LIB_SRCS) + +ASM_SRCS += $(GENERATED_ASM_LIB_SRCS) \ + $(COMPONENT_ASM_LIB_SRCS) + + +#------------------------------------------------------------------------------ +# LIST OF GENERATED FILES +# +# A Nios II BSP relies on the generation of several source files used +# by both the BSP and any applications referencing the BSP. +#------------------------------------------------------------------------------ + + +GENERATED_H_FILES := $(ABS_BSP_ROOT)/system.h + +GENERATED_LINKER_SCRIPT := $(ABS_BSP_ROOT)/linker.x + +GENERATED_FILES += $(GENERATED_H_FILES) \ + $(GENERATED_LINKER_SCRIPT) + + +#------------------------------------------------------------------------------ +# SETUP TO BUILD OBJECTS +# +# List of object files which are to be built. This is constructed from the input +# list of C source files (C_SRCS), C++ source files (CXX_SRCS), and assembler +# source file (ASM_SRCS). The permitted file extensions are: +# +# .c .C - for C files +# .cxx .cc .cpp .CXX .CC .CPP - for C++ files +# .S .s - for assembly files +# +# Extended description: The list of objects is a sorted list (duplicates +# removed) of all possible objects, placed beneath the ./obj directory, +# including any path information stored in the "*_SRCS" variable. The +# "patsubst" commands are used to concatenate together multiple file suffix +# types for common files (i.e. c++ as .cxx, .cc, .cpp). +# +# File extensions are case-insensitive in build rules with the exception of +# assembly sources. Nios II assembly sources with the ".S" extension are first +# run through the C preprocessor. Sources with the ".s" extension are not. +#------------------------------------------------------------------------------ +OBJS = $(sort $(addprefix $(OBJ_DIR)/, \ + $(patsubst %.c, %.o, $(patsubst %.C, %.o, $(C_SRCS))) \ + $(patsubst %.cxx, %.o, $(patsubst %.CXX, %.o, \ + $(patsubst %.cc, %.o, $(patsubst %.CC, %.o, \ + $(patsubst %.cpp, %.o, $(patsubst %.CPP, %.o, \ + $(CXX_SRCS) )))))) \ + $(patsubst %.S, %.o, $(patsubst %.s, %.o, $(ASM_SRCS))) )) + +# List of dependancy files for each object file. +DEPS = $(OBJS:.o=.d) + + +# Rules to force your project to rebuild or relink +# .force_relink file will cause any application that depends on this project to relink +# .force_rebuild file will cause this project to rebuild object files +# .force_rebuild_all file will cause this project and any project that depends on this project to rebuild object files + +FORCE_RELINK_DEP := .force_relink +FORCE_REBUILD_DEP := .force_rebuild +FORCE_REBUILD_ALL_DEP := .force_rebuild_all +FORCE_REBUILD_DEP_LIST := $(FORCE_RELINK_DEP) $(FORCE_REBUILD_DEP) $(FORCE_REBUILD_ALL_DEP) + +$(FORCE_REBUILD_DEP_LIST): + +$(OBJS): $(wildcard $(FORCE_REBUILD_DEP)) $(wildcard $(FORCE_REBUILD_ALL_DEP)) + + +#------------------------------------------------------------------------------ +# BUILD RULES: ALL & CLEAN +#------------------------------------------------------------------------------ +.DELETE_ON_ERROR: + +.PHONY: all +all: build_pre_process +all: Makefile $(GENERATED_FILES) $(BSP_LIB) $(NEWLIB_DIR) +all: build_post_process + + +# clean: remove .o/.a/.d +.PHONY: clean +clean: + @$(RM) -r $(BSP_LIB) $(OBJ_DIR) $(FORCE_REBUILD_DEP_LIST) +ifneq ($(wildcard $(NEWLIB_DIR)),) + @$(RM) -r $(NEWLIB_DIR) +endif + @$(ECHO) [BSP clean complete] + + +#------------------------------------------------------------------------------ +# BUILD PRE/POST PROCESS +#------------------------------------------------------------------------------ +build_pre_process : + $(BUILD_PRE_PROCESS) + +build_post_process : + $(BUILD_POST_PROCESS) + +.PHONY: build_pre_process build_post_process + + + +#------------------------------------------------------------------------------ +# MAKEFILE UP TO DATE? +# +# Is this very Makefile up to date? Someone may have changed the BSP settings +# file or the associated target hardware. +#------------------------------------------------------------------------------ +# Skip this check when clean is the only target +ifneq ($(MAKECMDGOALS),clean) + +ifneq ($(wildcard $(SETTINGS_FILE)),$(SETTINGS_FILE)) +$(warning Warning: BSP Settings File $(SETTINGS_FILE) could not be found.) +endif + +Makefile: $(wildcard $(SETTINGS_FILE)) + @$(ECHO) Makefile not up to date. + @$(ECHO) $(SETTINGS_FILE) has been modified since the BSP Makefile was generated. + @$(ECHO) + @$(ECHO) Generate the BSP to update the Makefile, and then build again. + @$(ECHO) + @$(ECHO) To generate from Eclipse: + @$(ECHO) " 1. Right-click the BSP project." + @$(ECHO) " 2. In the Nios II Menu, click Generate BSP." + @$(ECHO) + @$(ECHO) To generate from the command line: + @$(ECHO) " nios2-bsp-generate-files --settings= --bsp-dir=" + @$(ECHO) + @exit 1 + +ifneq ($(wildcard $(SOPC_FILE)),$(SOPC_FILE)) +$(warning Warning: SOPC File $(SOPC_FILE) could not be found.) +endif + +public.mk: $(wildcard $(SOPC_FILE)) + @$(ECHO) Makefile not up to date. + @$(ECHO) $(SOPC_FILE) has been modified since the BSP was generated. + @$(ECHO) + @$(ECHO) Generate the BSP to update the Makefile, and then build again. + @$(ECHO) + @$(ECHO) To generate from Eclipse: + @$(ECHO) " 1. Right-click the BSP project." + @$(ECHO) " 2. In the Nios II Menu, click Generate BSP." + @$(ECHO) + @$(ECHO) To generate from the command line: + @$(ECHO) " nios2-bsp-generate-files --settings= --bsp-dir=" + @$(ECHO) + @exit 1 + +endif # $(MAKECMDGOALS) != clean + +#------------------------------------------------------------------------------ +# PATTERN RULES TO BUILD OBJECTS +#------------------------------------------------------------------------------ +$(OBJ_DIR)/%.o: %.c + @$(ECHO) Compiling $( $@ + +$(FLASH_FILES): %.flash: $(ELF) + $(post-process-info) + @$(MKDIR) $(@D) + bash -c '$(ELF2FLASH) --input=$< --outfile=$@ --sim_optimize=$(SIM_OPTIMIZE) $(mem_endianness) \ + $(elf2flash_extra_args)' + +# +# Function generate_spd_entry +# Arg1: path to the memory initialization file +# Arg2: Type HEX or DAT +# Arg3: Output spd file to append +gen_spd_entry.BASE_FILE = $(basename $(notdir $1)) +gen_spd_entry.PARAM_NAME = $($(gen_spd_entry.BASE_FILE)_MEM_INIT_FILE_PARAM_NAME) +gen_spd_entry.MEM_PATH = $($(gen_spd_entry.BASE_FILE)_HIERARCHICAL_PATH) +gen_spd_entry.SETTINGS = $(strip \ + path=\"$1\" \ + type=\"$2\" \ + $(if $(gen_spd_entry.PARAM_NAME),initParamName=\"$(gen_spd_entry.PARAM_NAME)\") \ + $(if $(gen_spd_entry.MEM_PATH),memoryPath=\"$(gen_spd_entry.MEM_PATH)\") \ +) +define gen_spd_entry +$(ECHO) "" >> $3 +endef + +$(MEM_INIT_DESCRIPTOR_FILE).DAT_FILESET := $(patsubst $(dir $(MEM_INIT_DESCRIPTOR_FILE))%,%,$(DAT_FILES)) +$(MEM_INIT_DESCRIPTOR_FILE).HEX_FILESET := $(patsubst $(dir $(MEM_INIT_DESCRIPTOR_FILE))%,%,$(HEX_FILES)) + +$(MEM_INIT_DESCRIPTOR_FILE): %.spd: $(MEM_INIT_FILE) + $(post-process-info) + @$(MKDIR) $(@D) + @$(RM) $@ + @$(ECHO) "" > $@ + @$(ECHO) "" >> $@ + @$(foreach dat_file,$($@.DAT_FILESET),$(call gen_spd_entry,$(dat_file),DAT,$@) &&)true + @$(foreach hex_file,$($@.HEX_FILESET),$(call gen_spd_entry,$(hex_file),HEX,$@) &&)true + @$(ECHO) "" >> $@ + +.DELETE_ON_ERROR: $(MEM_INIT_DESCRIPTOR_FILE) + +$(MEM_INIT_QIP_FILE): %.qip: $(MEM_INIT_FILE) + $(post-process-info) + @$(MKDIR) $(@D) + @$(RM) $@ + @$(ECHO) "set_global_assignment -name SEARCH_PATH $$::quartus(qip_path)" > $@ + +.DELETE_ON_ERROR: $(MEM_INIT_QIP_FILE) diff --git a/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/public.mk b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/public.mk new file mode 100644 index 00000000..79960a2b --- /dev/null +++ b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/public.mk @@ -0,0 +1,390 @@ +#------------------------------------------------------------------------------ +# BSP "PUBLIC" MAKEFILE CONTENT +# +# This file is intended to be included in an application or library +# Makefile that is using this BSP. You can create such a Makefile with +# the nios2-app-generate-makefile or nios2-lib-generate-makefile +# commands. +# +# The following variables must be defined before including this file: +# +# ALT_LIBRARY_ROOT_DIR +# Contains the path to the BSP top-level (aka root) directory +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# PATHS +#------------------------------------------------------------------------------ + + + +# Path to the provided linker script. +BSP_LINKER_SCRIPT := $(ALT_LIBRARY_ROOT_DIR)/linker.x + +# Include paths: +# The path to root of all header files that a library wishes to make +# available for an application's use is specified here. Note that this +# may not be *all* folders within a hierarchy. For example, if it is +# desired that the application developer type: +# #include +# #include +# With files laid out like this: +# /inc/sockets.h +# /inc/ip/tcpip.h +# +# Then, only /inc need be added to the list of include +# directories. Alternatively, if you wish to be able to directly include +# all files in a hierarchy, separate paths to each folder in that +# hierarchy must be defined. + +# The following are the "base" set of include paths for a BSP. +# These paths are appended to the list that individual software +# components, drivers, etc., add in the generated portion of this +# file (below). +ALT_INCLUDE_DIRS_TO_APPEND += \ + $(ALT_LIBRARY_ROOT_DIR) \ + $(ALT_LIBRARY_ROOT_DIR)/drivers/inc + +# Additions to linker library search-path: +# Here we provide a path to "our self" for the application to construct a +# "-L " out of. This should contain a list of directories, +# relative to the library root, of all directories with .a files to link +# against. +ALT_LIBRARY_DIRS += $(ALT_LIBRARY_ROOT_DIR) + + +#------------------------------------------------------------------------------ +# COMPILATION FLAGS +#------------------------------------------------------------------------------ +# Default C pre-processor flags for a BSP: +ALT_CPPFLAGS += -DSYSTEM_BUS_WIDTH=32 \ + -pipe + + +#------------------------------------------------------------------------------ +# MANAGED CONTENT +# +# All content between the lines "START MANAGED" and "END MANAGED" below is +# generated based on variables in the BSP settings file when the +# nios2-bsp-generate-files command is invoked. If you wish to persist any +# information pertaining to the build process, it is recomended that you +# utilize the BSP settings mechanism to do so. +#------------------------------------------------------------------------------ +#START MANAGED + +# The following TYPE comment allows tools to identify the 'type' of target this +# makefile is associated with. +# TYPE: BSP_PUBLIC_MAKEFILE + +# This following VERSION comment indicates the version of the tool used to +# generate this makefile. A makefile variable is provided for VERSION as well. +# ACDS_VERSION: 12.1sp1 +ACDS_VERSION := 12.1sp1 + +# This following BUILD_NUMBER comment indicates the build number of the tool +# used to generate this makefile. +# BUILD_NUMBER: 243 + +# Qsys--generated SOPCINFO file. Required for resolving node instance ID's with +# design component names. +SOPCINFO_FILE := Z:/work/nuandclean/release/hdl/fpga/ip/altera/nios_system/nios_system.sopcinfo + +# Big-Endian operation. +# setting BIG_ENDIAN is false +ALT_CFLAGS += -EL + +# Path to the provided C language runtime initialization code. +BSP_CRT0 := $(ALT_LIBRARY_ROOT_DIR)/obj/HAL/src/crt0.o + +# Name of BSP library as provided to linker using the "-msys-lib" flag or +# linker script GROUP command. +# setting BSP_SYS_LIB is hal_bsp +BSP_SYS_LIB := hal_bsp +ELF_PATCH_FLAG += --thread_model hal + +# Type identifier of the BSP library +# setting BSP_TYPE is hal +ALT_CPPFLAGS += -D__hal__ +BSP_TYPE := hal + +# CPU Name +# setting CPU_NAME is nios2_qsys_0 +CPU_NAME = nios2_qsys_0 +ELF_PATCH_FLAG += --cpu_name $(CPU_NAME) + +# Hardware Divider present. +# setting HARDWARE_DIVIDE is false +ALT_CFLAGS += -mno-hw-div + +# Hardware Multiplier present. +# setting HARDWARE_MULTIPLY is false +ALT_CFLAGS += -mno-hw-mul + +# Hardware Mulx present. +# setting HARDWARE_MULX is false +ALT_CFLAGS += -mno-hw-mulx + +# Debug Core present. +# setting HAS_DEBUG_CORE is true +CPU_HAS_DEBUG_CORE = 1 + +# Qsys generated design +# setting QSYS is 1 +QSYS := 1 +ELF_PATCH_FLAG += --qsys true + +# Design Name +# setting SOPC_NAME is nios_system +SOPC_NAME := nios_system + +# SopcBuilder Simulation Enabled +# setting SOPC_SIMULATION_ENABLED is false +ELF_PATCH_FLAG += --simulation_enabled false + +# Small-footprint (polled mode) driver none +# setting altera_avalon_jtag_uart_driver.enable_small_driver is false + +# Enable driver ioctl() support. This feature is not compatible with the +# 'small' driver; ioctl() support will not be compiled if either the UART +# 'enable_small_driver' or HAL 'enable_reduced_device_drivers' settings are +# enabled. none +# setting altera_avalon_uart_driver.enable_ioctl is false + +# Small-footprint (polled mode) driver none +# setting altera_avalon_uart_driver.enable_small_driver is false + +# Build a custom version of newlib with the specified space-separated compiler +# flags. The custom newlib build will be placed in the <bsp root>/newlib +# directory, and will be used only for applications that utilize this BSP. +# setting hal.custom_newlib_flags is none + +# Enable support for a subset of the C++ language. This option increases code +# footprint by adding support for C++ constructors. Certain features, such as +# multiple inheritance and exceptions are not supported. If false, adds +# -DALT_NO_C_PLUS_PLUS to ALT_CPPFLAGS in public.mk, and reduces code +# footprint. none +# setting hal.enable_c_plus_plus is false +ALT_CPPFLAGS += -DALT_NO_C_PLUS_PLUS + +# When your application exits, close file descriptors, call C++ destructors, +# etc. Code footprint can be reduced by disabling clean exit. If disabled, adds +# -DALT_NO_CLEAN_EXIT to ALT_CPPFLAGS and -Wl,--defsym, exit=_exit to +# ALT_LDFLAGS in public.mk. none +# setting hal.enable_clean_exit is false +ALT_CPPFLAGS += -DALT_NO_CLEAN_EXIT +ALT_LDFLAGS += -Wl,--defsym,exit=_exit + +# Add exit() support. This option increases code footprint if your "main()" +# routine does "return" or call "exit()". If false, adds -DALT_NO_EXIT to +# ALT_CPPFLAGS in public.mk, and reduces footprint none +# setting hal.enable_exit is false +ALT_CPPFLAGS += -DALT_NO_EXIT + +# Causes code to be compiled with gprof profiling enabled and the application +# ELF to be linked with the GPROF library. If true, adds -DALT_PROVIDE_GMON to +# ALT_CPPFLAGS and -pg to ALT_CFLAGS in public.mk. none +# setting hal.enable_gprof is false + +# Enables lightweight device driver API. This reduces code and data footprint +# by removing the HAL layer that maps device names (e.g. /dev/uart0) to file +# descriptors. Instead, driver routines are called directly. The open(), +# close(), and lseek() routines will always fail if called. The read(), +# write(), fstat(), ioctl(), and isatty() routines only work for the stdio +# devices. If true, adds -DALT_USE_DIRECT_DRIVERS to ALT_CPPFLAGS in public.mk. +# The Altera Host and read-only ZIP file systems can't be used if +# hal.enable_lightweight_device_driver_api is true. +# setting hal.enable_lightweight_device_driver_api is true +ALT_CPPFLAGS += -DALT_USE_DIRECT_DRIVERS + +# Adds code to emulate multiply and divide instructions in case they are +# executed but aren't present in the CPU. Normally this isn't required because +# the compiler won't use multiply and divide instructions that aren't present +# in the CPU. If false, adds -DALT_NO_INSTRUCTION_EMULATION to ALT_CPPFLAGS in +# public.mk. none +# setting hal.enable_mul_div_emulation is false +ALT_CPPFLAGS += -DALT_NO_INSTRUCTION_EMULATION + +# Certain drivers are compiled with reduced functionality to reduce code +# footprint. Not all drivers observe this setting. The altera_avalon_uart and +# altera_avalon_jtag_uart drivers switch from interrupt-driven to polled +# operation. CAUTION: Several device drivers are disabled entirely. These +# include the altera_avalon_cfi_flash, altera_avalon_epcs_flash_controller, and +# altera_avalon_lcd_16207 drivers. This can result in certain API (HAL flash +# access routines) to fail. You can define a symbol provided by each driver to +# prevent it from being removed. If true, adds -DALT_USE_SMALL_DRIVERS to +# ALT_CPPFLAGS in public.mk. none +# setting hal.enable_reduced_device_drivers is true +ALT_CPPFLAGS += -DALT_USE_SMALL_DRIVERS + +# Turns on HAL runtime stack checking feature. Enabling this setting causes +# additional code to be placed into each subroutine call to generate an +# exception if a stack collision occurs with the heap or statically allocated +# data. If true, adds -DALT_STACK_CHECK and -mstack-check to ALT_CPPFLAGS in +# public.mk. none +# setting hal.enable_runtime_stack_checking is false + +# The BSP is compiled with optimizations to speedup HDL simulation such as +# initializing the cache, clearing the .bss section, and skipping long delay +# loops. If true, adds -DALT_SIM_OPTIMIZE to ALT_CPPFLAGS in public.mk. When +# this setting is true, the BSP shouldn't be used to build applications that +# are expected to run real hardware. +# setting hal.enable_sim_optimize is false + +# Causes the small newlib (C library) to be used. This reduces code and data +# footprint at the expense of reduced functionality. Several newlib features +# are removed such as floating-point support in printf(), stdin input routines, +# and buffered I/O. The small C library is not compatible with Micrium +# MicroC/OS-II. If true, adds -msmallc to ALT_LDFLAGS in public.mk. none +# setting hal.enable_small_c_library is true +ALT_LDFLAGS += -msmallc +ALT_CPPFLAGS += -DSMALL_C_LIB + +# Enable SOPC Builder System ID. If a System ID SOPC Builder component is +# connected to the CPU associated with this BSP, it will be enabled in the +# creation of command-line arguments to download an ELF to the target. +# Otherwise, system ID and timestamp values are left out of public.mk for +# application Makefile "download-elf" target definition. With the system ID +# check disabled, the Nios II EDS tools will not automatically ensure that the +# application .elf file (and BSP it is linked against) corresponds to the +# hardware design on the target. If false, adds --accept-bad-sysid to +# SOPC_SYSID_FLAG in public.mk. none +# setting hal.enable_sopc_sysid_check is true + +# Enable BSP generation to query if SOPC system is big endian. If true ignores +# export of 'ALT_CFLAGS += -EB' to public.mk if big endian system. If true +# ignores export of 'ALT_CFLAGS += -EL' if little endian system. none +# setting hal.make.ignore_system_derived.big_endian is false + +# Enable BSP generation to query if SOPC system has a debug core present. If +# true ignores export of 'CPU_HAS_DEBUG_CORE = 1' to public.mk if a debug core +# is found in the system. If true ignores export of 'CPU_HAS_DEBUG_CORE = 0' if +# no debug core is found in the system. none +# setting hal.make.ignore_system_derived.debug_core_present is false + +# Enable BSP generation to query if SOPC system has FPU present. If true +# ignores export of 'ALT_CFLAGS += -mhard-float' to public.mk if FPU is found +# in the system. If true ignores export of 'ALT_CFLAGS += -mhard-soft' if FPU +# is not found in the system. none +# setting hal.make.ignore_system_derived.fpu_present is false + +# Enable BSP generation to query if SOPC system has hardware divide present. If +# true ignores export of 'ALT_CFLAGS += -mno-hw-div' to public.mk if no +# division is found in system. If true ignores export of 'ALT_CFLAGS += +# -mhw-div' if division is found in the system. none +# setting hal.make.ignore_system_derived.hardware_divide_present is false + +# Enable BSP generation to query if SOPC system floating point custom +# instruction with a divider is present. If true ignores export of 'ALT_CFLAGS +# += -mcustom-fpu-cfg=60-2' and 'ALT_LDFLAGS += -mcustom-fpu-cfg=60-2' to +# public.mk if the custom instruction is found in the system. none +# setting hal.make.ignore_system_derived.hardware_fp_cust_inst_divider_present is false + +# Enable BSP generation to query if SOPC system floating point custom +# instruction without a divider is present. If true ignores export of +# 'ALT_CFLAGS += -mcustom-fpu-cfg=60-1' and 'ALT_LDFLAGS += +# -mcustom-fpu-cfg=60-1' to public.mk if the custom instruction is found in the +# system. none +# setting hal.make.ignore_system_derived.hardware_fp_cust_inst_no_divider_present is false + +# Enable BSP generation to query if SOPC system has multiplier present. If true +# ignores export of 'ALT_CFLAGS += -mno-hw-mul' to public.mk if no multiplier +# is found in the system. If true ignores export of 'ALT_CFLAGS += -mhw-mul' if +# multiplier is found in the system. none +# setting hal.make.ignore_system_derived.hardware_multiplier_present is false + +# Enable BSP generation to query if SOPC system has hardware mulx present. If +# true ignores export of 'ALT_CFLAGS += -mno-hw-mulx' to public.mk if no mulx +# is found in the system. If true ignores export of 'ALT_CFLAGS += -mhw-mulx' +# if mulx is found in the system. none +# setting hal.make.ignore_system_derived.hardware_mulx_present is false + +# Enable BSP generation to query if SOPC system has simulation enabled. If true +# ignores export of 'ELF_PATCH_FLAG += --simulation_enabled' to public.mk. none +# setting hal.make.ignore_system_derived.sopc_simulation_enabled is false + +# Enable BSP generation to query SOPC system for system ID base address. If +# true ignores export of 'SOPC_SYSID_FLAG += --sidp=
' and +# 'ELF_PATCH_FLAG += --sidp=
' to public.mk. none +# setting hal.make.ignore_system_derived.sopc_system_base_address is false + +# Enable BSP generation to query SOPC system for system ID. If true ignores +# export of 'SOPC_SYSID_FLAG += --id=' and 'ELF_PATCH_FLAG += +# --id=' to public.mk. none +# setting hal.make.ignore_system_derived.sopc_system_id is false + +# Enable BSP generation to query SOPC system for system timestamp. If true +# ignores export of 'SOPC_SYSID_FLAG += --timestamp=' and +# 'ELF_PATCH_FLAG += --timestamp=' to public.mk. none +# setting hal.make.ignore_system_derived.sopc_system_timestamp is false + +# Slave descriptor of STDERR character-mode device. This setting is used by the +# ALT_STDERR family of defines in system.h. none +# setting hal.stderr is jtag_uart_0 +ELF_PATCH_FLAG += --stderr_dev jtag_uart_0 + +# Slave descriptor of STDIN character-mode device. This setting is used by the +# ALT_STDIN family of defines in system.h. none +# setting hal.stdin is jtag_uart_0 +ELF_PATCH_FLAG += --stdin_dev jtag_uart_0 + +# Slave descriptor of STDOUT character-mode device. This setting is used by the +# ALT_STDOUT family of defines in system.h. none +# setting hal.stdout is jtag_uart_0 +ELF_PATCH_FLAG += --stdout_dev jtag_uart_0 + + +#------------------------------------------------------------------------------ +# SOFTWARE COMPONENT & DRIVER INCLUDE PATHS +#------------------------------------------------------------------------------ + +ALT_INCLUDE_DIRS += $(ALT_LIBRARY_ROOT_DIR)/HAL/inc + +#------------------------------------------------------------------------------ +# SOFTWARE COMPONENT & DRIVER PRODUCED ALT_CPPFLAGS ADDITIONS +#------------------------------------------------------------------------------ + +ALT_CPPFLAGS += -DALT_SINGLE_THREADED + +#END MANAGED + + +#------------------------------------------------------------------------------ +# LIBRARY INFORMATION +#------------------------------------------------------------------------------ +# Assemble the name of the BSP *.a file using the BSP library name +# (BSP_SYS_LIB) in generated content above. +BSP_LIB := lib$(BSP_SYS_LIB).a + +# Additional libraries to link against: +# An application including this file will prefix each library with "-l". +# For example, to include the Newlib math library "m" is included, which +# becomes "-lm" when linking the application. +ALT_LIBRARY_NAMES += m + +# Additions to linker dependencies: +# An application Makefile will typically add these directly to the list +# of dependencies required to build the executable target(s). The BSP +# library (*.a) file is specified here. +ALT_LDDEPS += $(ALT_LIBRARY_ROOT_DIR)/$(BSP_LIB) + +# Is this library "Makeable"? +# Add to list of root library directories that support running 'make' +# to build them. Because libraries may or may not have a Makefile in their +# root, appending to this variable tells an application to run 'make' in +# the library root to build/update this library. +MAKEABLE_LIBRARY_ROOT_DIRS += $(ALT_LIBRARY_ROOT_DIR) + +# Additional Assembler Flags +# -gdwarf2 flag is required for stepping through assembly code +ALT_ASFLAGS += -gdwarf2 + +#------------------------------------------------------------------------------ +# FINAL INCLUDE PATH LIST +#------------------------------------------------------------------------------ +# Append static include paths to paths specified by OS/driver/sw package +# additions to the BSP thus giving them precedence in case a BSP addition +# is attempting to override BSP sources. +ALT_INCLUDE_DIRS += $(ALT_INCLUDE_DIRS_TO_APPEND) + + + diff --git a/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/settings.bsp b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/settings.bsp new file mode 100644 index 00000000..578edb7b --- /dev/null +++ b/hdl/fpga/ip/altera/nios_system/software/lms_spi_controller_bsp/settings.bsp @@ -0,0 +1,937 @@ + + + hal + default + Feb 18, 2013 3:36:43 AM + 1361187403314 + Z:\work\nuandclean\release\hdl\fpga\ip\altera\nios_system\software\lms_spi_controller_bsp + .\settings.bsp + Z:\work\nuandclean\release\hdl\fpga\ip\altera\nios_system\nios_system.sopcinfo + default + nios2_qsys_0 + 1.9 + + hal.sys_clk_timer + ALT_SYS_CLK + UnquotedString + none + none + system_h_define + Slave descriptor of the system clock timer device. This device provides a periodic interrupt ("tick") and is typically required for RTOS use. This setting defines the value of ALT_SYS_CLK in system.h. + none + false + common + + + hal.timestamp_timer + ALT_TIMESTAMP_CLK + UnquotedString + none + none + system_h_define + Slave descriptor of timestamp timer device. This device is used by Altera HAL timestamp drivers for high-resolution time measurement. This setting defines the value of ALT_TIMESTAMP_CLK in system.h. + none + false + common + + + hal.max_file_descriptors + ALT_MAX_FD + DecimalNumber + 4 + 32 + system_h_define + Determines the number of file descriptors statically allocated. This setting defines the value of ALT_MAX_FD in system.h. + If hal.enable_lightweight_device_driver_api is true, there are no file descriptors so this setting is ignored. If hal.enable_lightweight_device_driver_api is false, this setting must be at least 4 because HAL needs a file descriptor for /dev/null, /dev/stdin, /dev/stdout, and /dev/stderr. + false + + + + hal.enable_instruction_related_exceptions_api + ALT_INCLUDE_INSTRUCTION_RELATED_EXCEPTION_API + BooleanDefineOnly + false + false + system_h_define + Enables API for registering handlers to service instruction-related exceptions. Enabling this setting increases the size of the exception entry code. + These exception types can be generated if various processor options are enabled, such as the MMU, MPU, or other advanced exception types. + false + + + + hal.linker.allow_code_at_reset + ALT_ALLOW_CODE_AT_RESET + Boolean + 1 + 0 + none + Indicates if initialization code is allowed at the reset address. If true, defines the macro ALT_ALLOW_CODE_AT_RESET in linker.h. + If true, defines the macro ALT_ALLOW_CODE_AT_RESET in linker.h. This setting is typically false if an external bootloader (e.g. flash bootloader) is present. + false + + + + hal.linker.enable_alt_load + NONE + Boolean + 1 + 0 + none + Enables the alt_load() facility. The alt_load() facility copies sections from the .text memory into RAM. If true, this setting sets up the VMA/LMA of sections in linker.x to allow them to be loaded into the .text memory. + This setting is typically false if an external bootloader (e.g. flash bootloader) is present. + false + + + + hal.linker.enable_alt_load_copy_rodata + NONE + Boolean + 0 + 0 + none + Causes the alt_load() facility to copy the .rodata section. If true, this setting defines the macro ALT_LOAD_COPY_RODATA in linker.h. + none + false + + + + hal.linker.enable_alt_load_copy_rwdata + NONE + Boolean + 1 + 0 + none + Causes the alt_load() facility to copy the .rwdata section. If true, this setting defines the macro ALT_LOAD_COPY_RWDATA in linker.h. + none + false + + + + hal.linker.enable_alt_load_copy_exceptions + NONE + Boolean + 0 + 0 + none + Causes the alt_load() facility to copy the .exceptions section. If true, this setting defines the macro ALT_LOAD_COPY_EXCEPTIONS in linker.h. + none + false + + + + hal.linker.enable_exception_stack + NONE + Boolean + 0 + 0 + none + Enables use of a separate exception stack. If true, defines the macro ALT_EXCEPTION_STACK in linker.h, adds a memory region called exception_stack to linker.x, and provides the symbols __alt_exception_stack_pointer and __alt_exception_stack_limit in linker.x. + The hal.linker.exception_stack_size and hal.linker.exception_stack_memory_region_name settings must also be valid. This setting must be false for MicroC/OS-II BSPs. The exception stack can be used to improve interrupt and other exception performance if the EIC is *not* used. + false + common + + + hal.linker.exception_stack_size + NONE + DecimalNumber + 1024 + 1024 + none + Size of the exception stack in bytes. + Only used if hal.linker.enable_exception_stack is true. + false + common + + + hal.linker.exception_stack_memory_region_name + NONE + UnquotedString + onchip_memory2_0 + none + none + Name of the existing memory region that will be divided up to create the 'exception_stack' memory region. The selected region name will be adjusted automatically when the BSP is generated to create the 'exception_stack' memory region. + Only used if hal.linker.enable_exception_stack is true. + false + common + + + hal.linker.enable_interrupt_stack + NONE + Boolean + 0 + 0 + none + Enables use of a separate interrupt stack. If true, defines the macro ALT_INTERRUPT_STACK in linker.h, adds a memory region called interrupt_stack to linker.x, and provides the symbols __alt_interrupt_stack_pointer and __alt_interrupt_stack_limit in linker.x. + The hal.linker.interrupt_stack_size and hal.linker.interrupt_stack_memory_region_name settings must also be valid. This setting must be false for MicroC/OS-II BSPs. Only enable if the EIC is used exclusively. The exception stack can be used to improve interrupt and other exception performance if the EIC is *not* used. + false + common + + + hal.linker.interrupt_stack_size + NONE + DecimalNumber + 1024 + 1024 + none + Size of the interrupt stack in bytes. + Only used if hal.linker.enable_interrupt_stack is true. + false + common + + + hal.linker.interrupt_stack_memory_region_name + NONE + UnquotedString + onchip_memory2_0 + none + none + Name of the existing memory region that will be divided up to create the 'interrupt_stack' memory region. The selected region name will be adjusted automatically when the BSP is generated to create the 'interrupt_stack' memory region. + Only used if hal.linker.enable_interrupt_stack is true. + false + common + + + hal.stdin + NONE + UnquotedString + jtag_uart_0 + none + system_h_define + Slave descriptor of STDIN character-mode device. This setting is used by the ALT_STDIN family of defines in system.h. + none + false + common + + + hal.stdout + NONE + UnquotedString + jtag_uart_0 + none + system_h_define + Slave descriptor of STDOUT character-mode device. This setting is used by the ALT_STDOUT family of defines in system.h. + none + false + common + + + hal.stderr + NONE + UnquotedString + jtag_uart_0 + none + system_h_define + Slave descriptor of STDERR character-mode device. This setting is used by the ALT_STDERR family of defines in system.h. + none + false + common + + + hal.log_port + NONE + UnquotedString + none + none + public_mk_define + Slave descriptor of debug logging character-mode device. If defined, it enables extra debug messages in the HAL source. This setting is used by the ALT_LOG_PORT family of defines in system.h. + none + false + none + + + hal.make.build_pre_process + BUILD_PRE_PROCESS + UnquotedString + none + none + makefile_variable + Command executed before BSP built. + none + false + none + + + hal.make.ar_pre_process + AR_PRE_PROCESS + UnquotedString + none + none + makefile_variable + Command executed before archiver execution. + none + false + none + + + hal.make.bsp_cflags_defined_symbols + BSP_CFLAGS_DEFINED_SYMBOLS + UnquotedString + none + none + makefile_variable + Preprocessor macros to define. A macro definition in this setting has the same effect as a "#define" in source code. Adding "-DALT_DEBUG" to this setting has the same effect as "#define ALT_DEBUG" in a souce file. Adding "-DFOO=1" to this setting is equivalent to the macro "#define FOO 1" in a source file. Macros defined with this setting are applied to all .S, .c, and C++ files in the BSP. This setting defines the value of BSP_CFLAGS_DEFINED_SYMBOLS in the BSP Makefile. + none + false + none + + + hal.make.ar_post_process + AR_POST_PROCESS + UnquotedString + none + none + makefile_variable + Command executed after archiver execution. + none + false + none + + + hal.make.as + AS + UnquotedString + nios2-elf-gcc + nios2-elf-gcc + makefile_variable + Assembler command. Note that CC is used for .S files. + none + false + none + + + hal.make.build_post_process + BUILD_POST_PROCESS + UnquotedString + none + none + makefile_variable + Command executed after BSP built. + none + false + none + + + hal.make.bsp_cflags_debug + BSP_CFLAGS_DEBUG + UnquotedString + -g + -g + makefile_variable + C/C++ compiler debug level. '-g' provides the default set of debug symbols typically required to debug a typical application. Omitting '-g' removes debug symbols from the ELF. This setting defines the value of BSP_CFLAGS_DEBUG in Makefile. + none + false + common + + + hal.make.ar + AR + UnquotedString + nios2-elf-ar + nios2-elf-ar + makefile_variable + Archiver command. Creates library files. + none + false + none + + + hal.make.rm + RM + UnquotedString + rm -f + rm -f + makefile_variable + Command used to remove files during 'clean' target. + none + false + none + + + hal.make.cxx_pre_process + CXX_PRE_PROCESS + UnquotedString + none + none + makefile_variable + Command executed before each C++ file is compiled. + none + false + none + + + hal.make.bsp_cflags_warnings + BSP_CFLAGS_WARNINGS + UnquotedString + -Wall + -Wall + makefile_variable + C/C++ compiler warning level. "-Wall" is commonly used.This setting defines the value of BSP_CFLAGS_WARNINGS in Makefile. + none + false + none + + + hal.make.bsp_arflags + BSP_ARFLAGS + UnquotedString + -src + -src + makefile_variable + Custom flags only passed to the archiver. This content of this variable is directly passed to the archiver rather than the more standard "ARFLAGS". The reason for this is that GNU Make assumes some default content in ARFLAGS. This setting defines the value of BSP_ARFLAGS in Makefile. + none + false + none + + + hal.make.bsp_cflags_optimization + BSP_CFLAGS_OPTIMIZATION + UnquotedString + '-Os' + -O0 + makefile_variable + C/C++ compiler optimization level. "-O0" = no optimization,"-O2" = "normal" optimization, etc. "-O0" is recommended for code that you want to debug since compiler optimization can remove variables and produce non-sequential execution of code while debugging. This setting defines the value of BSP_CFLAGS_OPTIMIZATION in Makefile. + none + false + common + + + hal.make.as_post_process + AS_POST_PROCESS + UnquotedString + none + none + makefile_variable + Command executed after each assembly file is compiled. + none + false + none + + + hal.make.cc_pre_process + CC_PRE_PROCESS + UnquotedString + none + none + makefile_variable + Command executed before each .c/.S file is compiled. + none + false + none + + + hal.make.bsp_asflags + BSP_ASFLAGS + UnquotedString + -Wa,-gdwarf2 + -Wa,-gdwarf2 + makefile_variable + Custom flags only passed to the assembler. This setting defines the value of BSP_ASFLAGS in Makefile. + none + false + none + + + hal.make.as_pre_process + AS_PRE_PROCESS + UnquotedString + none + none + makefile_variable + Command executed before each assembly file is compiled. + none + false + none + + + hal.make.bsp_cflags_undefined_symbols + BSP_CFLAGS_UNDEFINED_SYMBOLS + UnquotedString + none + none + makefile_variable + Preprocessor macros to undefine. Undefined macros are similar to defined macros, but replicate the "#undef" directive in source code. To undefine the macro FOO use the syntax "-u FOO" in this setting. This is equivalent to "#undef FOO" in a source file. Note: the syntax differs from macro definition (there is a space, i.e. "-u FOO" versus "-DFOO"). Macros defined with this setting are applied to all .S, .c, and C++ files in the BSP. This setting defines the value of BSP_CFLAGS_UNDEFINED_SYMBOLS in the BSP Makefile. + none + false + none + + + hal.make.cc_post_process + CC_POST_PROCESS + UnquotedString + none + none + makefile_variable + Command executed after each .c/.S file is compiled. + none + false + none + + + hal.make.cxx_post_process + CXX_POST_PROCESS + UnquotedString + none + none + makefile_variable + Command executed before each C++ file is compiled. + none + false + none + + + hal.make.cc + CC + UnquotedString + nios2-elf-gcc -xc + nios2-elf-gcc -xc + makefile_variable + C compiler command. + none + false + none + + + hal.make.bsp_cxx_flags + BSP_CXXFLAGS + UnquotedString + none + none + makefile_variable + Custom flags only passed to the C++ compiler. This setting defines the value of BSP_CXXFLAGS in Makefile. + none + false + none + + + hal.make.bsp_inc_dirs + BSP_INC_DIRS + UnquotedString + none + none + makefile_variable + Space separated list of extra include directories to scan for header files. Directories are relative to the top-level BSP directory. The -I prefix's added by the makefile so don't add it here. This setting defines the value of BSP_INC_DIRS in Makefile. + none + false + none + + + hal.make.cxx + CXX + UnquotedString + nios2-elf-gcc -xc++ + nios2-elf-gcc -xc++ + makefile_variable + C++ compiler command. + none + false + none + + + hal.make.bsp_cflags_user_flags + BSP_CFLAGS_USER_FLAGS + UnquotedString + none + none + makefile_variable + Custom flags passed to the compiler when compiling C, C++, and .S files. This setting defines the value of BSP_CFLAGS_USER_FLAGS in Makefile. + none + false + none + + + hal.make.ignore_system_derived.sopc_system_id + NONE + Boolean + 0 + 0 + public_mk_define + Enable BSP generation to query SOPC system for system ID. If true ignores export of 'SOPC_SYSID_FLAG += --id=<sysid>' and 'ELF_PATCH_FLAG += --id=<sysid>' to public.mk. + none + false + none + + + hal.make.ignore_system_derived.sopc_system_timestamp + NONE + Boolean + 0 + 0 + public_mk_define + Enable BSP generation to query SOPC system for system timestamp. If true ignores export of 'SOPC_SYSID_FLAG += --timestamp=<timestamp>' and 'ELF_PATCH_FLAG += --timestamp=<timestamp>' to public.mk. + none + false + none + + + hal.make.ignore_system_derived.sopc_system_base_address + NONE + Boolean + 0 + 0 + public_mk_define + Enable BSP generation to query SOPC system for system ID base address. If true ignores export of 'SOPC_SYSID_FLAG += --sidp=<address>' and 'ELF_PATCH_FLAG += --sidp=<address>' to public.mk. + none + false + none + + + hal.make.ignore_system_derived.sopc_simulation_enabled + NONE + Boolean + 0 + 0 + public_mk_define + Enable BSP generation to query if SOPC system has simulation enabled. If true ignores export of 'ELF_PATCH_FLAG += --simulation_enabled' to public.mk. + none + false + none + + + hal.make.ignore_system_derived.fpu_present + NONE + Boolean + 0 + 0 + public_mk_define + Enable BSP generation to query if SOPC system has FPU present. If true ignores export of 'ALT_CFLAGS += -mhard-float' to public.mk if FPU is found in the system. If true ignores export of 'ALT_CFLAGS += -mhard-soft' if FPU is not found in the system. + none + false + none + + + hal.make.ignore_system_derived.hardware_multiplier_present + NONE + Boolean + 0 + 0 + public_mk_define + Enable BSP generation to query if SOPC system has multiplier present. If true ignores export of 'ALT_CFLAGS += -mno-hw-mul' to public.mk if no multiplier is found in the system. If true ignores export of 'ALT_CFLAGS += -mhw-mul' if multiplier is found in the system. + none + false + none + + + hal.make.ignore_system_derived.hardware_mulx_present + NONE + Boolean + 0 + 0 + public_mk_define + Enable BSP generation to query if SOPC system has hardware mulx present. If true ignores export of 'ALT_CFLAGS += -mno-hw-mulx' to public.mk if no mulx is found in the system. If true ignores export of 'ALT_CFLAGS += -mhw-mulx' if mulx is found in the system. + none + false + none + + + hal.make.ignore_system_derived.hardware_divide_present + NONE + Boolean + 0 + 0 + public_mk_define + Enable BSP generation to query if SOPC system has hardware divide present. If true ignores export of 'ALT_CFLAGS += -mno-hw-div' to public.mk if no division is found in system. If true ignores export of 'ALT_CFLAGS += -mhw-div' if division is found in the system. + none + false + none + + + hal.make.ignore_system_derived.debug_core_present + NONE + Boolean + 0 + 0 + public_mk_define + Enable BSP generation to query if SOPC system has a debug core present. If true ignores export of 'CPU_HAS_DEBUG_CORE = 1' to public.mk if a debug core is found in the system. If true ignores export of 'CPU_HAS_DEBUG_CORE = 0' if no debug core is found in the system. + none + false + none + + + hal.make.ignore_system_derived.big_endian + NONE + Boolean + 0 + 0 + public_mk_define + Enable BSP generation to query if SOPC system is big endian. If true ignores export of 'ALT_CFLAGS += -EB' to public.mk if big endian system. If true ignores export of 'ALT_CFLAGS += -EL' if little endian system. + none + false + none + + + hal.make.ignore_system_derived.hardware_fp_cust_inst_divider_present + NONE + Boolean + 0 + 0 + public_mk_define + Enable BSP generation to query if SOPC system floating point custom instruction with a divider is present. If true ignores export of 'ALT_CFLAGS += -mcustom-fpu-cfg=60-2' and 'ALT_LDFLAGS += -mcustom-fpu-cfg=60-2' to public.mk if the custom instruction is found in the system. + none + false + none + + + hal.make.ignore_system_derived.hardware_fp_cust_inst_no_divider_present + NONE + Boolean + 0 + 0 + public_mk_define + Enable BSP generation to query if SOPC system floating point custom instruction without a divider is present. If true ignores export of 'ALT_CFLAGS += -mcustom-fpu-cfg=60-1' and 'ALT_LDFLAGS += -mcustom-fpu-cfg=60-1' to public.mk if the custom instruction is found in the system. + none + false + none + + + hal.enable_exit + ALT_NO_EXIT + Boolean + 0 + 1 + public_mk_define + Add exit() support. This option increases code footprint if your "main()" routine does "return" or call "exit()". If false, adds -DALT_NO_EXIT to ALT_CPPFLAGS in public.mk, and reduces footprint + none + false + none + + + hal.enable_small_c_library + NONE + Boolean + 1 + 0 + public_mk_define + Causes the small newlib (C library) to be used. This reduces code and data footprint at the expense of reduced functionality. Several newlib features are removed such as floating-point support in printf(), stdin input routines, and buffered I/O. The small C library is not compatible with Micrium MicroC/OS-II. If true, adds -msmallc to ALT_LDFLAGS in public.mk. + none + false + common + + + hal.enable_clean_exit + ALT_NO_CLEAN_EXIT + Boolean + 0 + 1 + public_mk_define + When your application exits, close file descriptors, call C++ destructors, etc. Code footprint can be reduced by disabling clean exit. If disabled, adds -DALT_NO_CLEAN_EXIT to ALT_CPPFLAGS and -Wl,--defsym, exit=_exit to ALT_LDFLAGS in public.mk. + none + false + none + + + hal.enable_runtime_stack_checking + ALT_STACK_CHECK + Boolean + 0 + 0 + public_mk_define + Turns on HAL runtime stack checking feature. Enabling this setting causes additional code to be placed into each subroutine call to generate an exception if a stack collision occurs with the heap or statically allocated data. If true, adds -DALT_STACK_CHECK and -mstack-check to ALT_CPPFLAGS in public.mk. + none + false + none + + + hal.enable_gprof + ALT_PROVIDE_GMON + Boolean + 0 + 0 + public_mk_define + Causes code to be compiled with gprof profiling enabled and the application ELF to be linked with the GPROF library. If true, adds -DALT_PROVIDE_GMON to ALT_CPPFLAGS and -pg to ALT_CFLAGS in public.mk. + none + false + common + + + hal.enable_c_plus_plus + ALT_NO_C_PLUS_PLUS + Boolean + 0 + 1 + public_mk_define + Enable support for a subset of the C++ language. This option increases code footprint by adding support for C++ constructors. Certain features, such as multiple inheritance and exceptions are not supported. If false, adds -DALT_NO_C_PLUS_PLUS to ALT_CPPFLAGS in public.mk, and reduces code footprint. + none + false + none + + + hal.enable_reduced_device_drivers + ALT_USE_SMALL_DRIVERS + Boolean + 1 + 0 + public_mk_define + Certain drivers are compiled with reduced functionality to reduce code footprint. Not all drivers observe this setting. The altera_avalon_uart and altera_avalon_jtag_uart drivers switch from interrupt-driven to polled operation. CAUTION: Several device drivers are disabled entirely. These include the altera_avalon_cfi_flash, altera_avalon_epcs_flash_controller, and altera_avalon_lcd_16207 drivers. This can result in certain API (HAL flash access routines) to fail. You can define a symbol provided by each driver to prevent it from being removed. If true, adds -DALT_USE_SMALL_DRIVERS to ALT_CPPFLAGS in public.mk. + none + false + common + + + hal.enable_lightweight_device_driver_api + ALT_USE_DIRECT_DRIVERS + Boolean + 1 + 0 + public_mk_define + Enables lightweight device driver API. This reduces code and data footprint by removing the HAL layer that maps device names (e.g. /dev/uart0) to file descriptors. Instead, driver routines are called directly. The open(), close(), and lseek() routines will always fail if called. The read(), write(), fstat(), ioctl(), and isatty() routines only work for the stdio devices. If true, adds -DALT_USE_DIRECT_DRIVERS to ALT_CPPFLAGS in public.mk. + The Altera Host and read-only ZIP file systems can't be used if hal.enable_lightweight_device_driver_api is true. + false + none + + + hal.enable_mul_div_emulation + ALT_NO_INSTRUCTION_EMULATION + Boolean + 0 + 0 + public_mk_define + Adds code to emulate multiply and divide instructions in case they are executed but aren't present in the CPU. Normally this isn't required because the compiler won't use multiply and divide instructions that aren't present in the CPU. If false, adds -DALT_NO_INSTRUCTION_EMULATION to ALT_CPPFLAGS in public.mk. + none + false + none + + + hal.enable_sim_optimize + ALT_SIM_OPTIMIZE + Boolean + 0 + 0 + public_mk_define + The BSP is compiled with optimizations to speedup HDL simulation such as initializing the cache, clearing the .bss section, and skipping long delay loops. If true, adds -DALT_SIM_OPTIMIZE to ALT_CPPFLAGS in public.mk. + When this setting is true, the BSP shouldn't be used to build applications that are expected to run real hardware. + false + common + + + hal.enable_sopc_sysid_check + NONE + Boolean + 1 + 1 + public_mk_define + Enable SOPC Builder System ID. If a System ID SOPC Builder component is connected to the CPU associated with this BSP, it will be enabled in the creation of command-line arguments to download an ELF to the target. Otherwise, system ID and timestamp values are left out of public.mk for application Makefile "download-elf" target definition. With the system ID check disabled, the Nios II EDS tools will not automatically ensure that the application .elf file (and BSP it is linked against) corresponds to the hardware design on the target. If false, adds --accept-bad-sysid to SOPC_SYSID_FLAG in public.mk. + none + false + none + + + hal.custom_newlib_flags + CUSTOM_NEWLIB_FLAGS + UnquotedString + none + none + public_mk_define + Build a custom version of newlib with the specified space-separated compiler flags. + The custom newlib build will be placed in the &lt;bsp root>/newlib directory, and will be used only for applications that utilize this BSP. + false + none + + + hal.log_flags + ALT_LOG_FLAGS + DecimalNumber + 0 + 0 + public_mk_define + The value is assigned to ALT_LOG_FLAGS in the generated public.mk. See hal.log_port setting description. Values can be -1 through 3. + hal.log_port must be set for this to be used. + false + none + + + altera_avalon_jtag_uart_driver.enable_small_driver + ALTERA_AVALON_JTAG_UART_SMALL + BooleanDefineOnly + false + false + public_mk_define + Small-footprint (polled mode) driver + none + false + + + + altera_avalon_uart_driver.enable_small_driver + ALTERA_AVALON_UART_SMALL + BooleanDefineOnly + false + false + public_mk_define + Small-footprint (polled mode) driver + none + false + + + + altera_avalon_uart_driver.enable_ioctl + ALTERA_AVALON_UART_USE_IOCTL + BooleanDefineOnly + false + false + public_mk_define + Enable driver ioctl() support. This feature is not compatible with the 'small' driver; ioctl() support will not be compiled if either the UART 'enable_small_driver' or HAL 'enable_reduced_device_drivers' settings are enabled. + none + false + + + + onchip_memory2_0 + 0x00000000 - 0x00007FFF + 32768 + memory + + + spi_1 + 0x00010000 - 0x0001001F + 32 + + + + spi_0 + 0x00021000 - 0x0002101F + 32 + + + + jtag_uart_0 + 0x00022000 - 0x00022007 + 8 + printable + + + timer_0 + 0x00023000 - 0x0002303F + 64 + timer + + + uart_0 + 0x00024000 - 0x0002401F + 32 + printable + + + .text + onchip_memory2_0 + + + .rodata + onchip_memory2_0 + + + .rwdata + onchip_memory2_0 + + + .bss + onchip_memory2_0 + + + .heap + onchip_memory2_0 + + + .stack + onchip_memory2_0 + + \ No newline at end of file diff --git a/hdl/fpga/ip/altera/pll/greybox_tmp/cbx_args.txt b/hdl/fpga/ip/altera/pll/greybox_tmp/cbx_args.txt new file mode 100644 index 00000000..6ecedd8c --- /dev/null +++ b/hdl/fpga/ip/altera/pll/greybox_tmp/cbx_args.txt @@ -0,0 +1,66 @@ +BANDWIDTH_TYPE=AUTO +CLK0_DIVIDE_BY=1 +CLK0_DUTY_CYCLE=50 +CLK0_MULTIPLY_BY=1 +CLK0_PHASE_SHIFT=0 +CLK1_DIVIDE_BY=1 +CLK1_DUTY_CYCLE=50 +CLK1_MULTIPLY_BY=2 +CLK1_PHASE_SHIFT=0 +COMPENSATE_CLOCK=CLK0 +INCLK0_INPUT_FREQUENCY=26041 +INTENDED_DEVICE_FAMILY="Cyclone IV E" +LPM_TYPE=altpll +OPERATION_MODE=NORMAL +PLL_TYPE=AUTO +PORT_ACTIVECLOCK=PORT_UNUSED +PORT_ARESET=PORT_USED +PORT_CLKBAD0=PORT_UNUSED +PORT_CLKBAD1=PORT_UNUSED +PORT_CLKLOSS=PORT_UNUSED +PORT_CLKSWITCH=PORT_UNUSED +PORT_CONFIGUPDATE=PORT_UNUSED +PORT_FBIN=PORT_UNUSED +PORT_INCLK0=PORT_USED +PORT_INCLK1=PORT_UNUSED +PORT_LOCKED=PORT_USED +PORT_PFDENA=PORT_UNUSED +PORT_PHASECOUNTERSELECT=PORT_UNUSED +PORT_PHASEDONE=PORT_UNUSED +PORT_PHASESTEP=PORT_UNUSED +PORT_PHASEUPDOWN=PORT_UNUSED +PORT_PLLENA=PORT_UNUSED +PORT_SCANACLR=PORT_UNUSED +PORT_SCANCLK=PORT_UNUSED +PORT_SCANCLKENA=PORT_UNUSED +PORT_SCANDATA=PORT_UNUSED +PORT_SCANDATAOUT=PORT_UNUSED +PORT_SCANDONE=PORT_UNUSED +PORT_SCANREAD=PORT_UNUSED +PORT_SCANWRITE=PORT_UNUSED +PORT_clk0=PORT_USED +PORT_clk1=PORT_USED +PORT_clk2=PORT_UNUSED +PORT_clk3=PORT_UNUSED +PORT_clk4=PORT_UNUSED +PORT_clk5=PORT_UNUSED +PORT_clkena0=PORT_UNUSED +PORT_clkena1=PORT_UNUSED +PORT_clkena2=PORT_UNUSED +PORT_clkena3=PORT_UNUSED +PORT_clkena4=PORT_UNUSED +PORT_clkena5=PORT_UNUSED +PORT_extclk0=PORT_UNUSED +PORT_extclk1=PORT_UNUSED +PORT_extclk2=PORT_UNUSED +PORT_extclk3=PORT_UNUSED +SELF_RESET_ON_LOSS_LOCK=OFF +WIDTH_CLOCK=5 +DEVICE_FAMILY="Cyclone IV E" +CBX_AUTO_BLACKBOX=ALL +areset +inclk +inclk +clk +clk +locked diff --git a/hdl/fpga/ip/altera/pll/pll.cmp b/hdl/fpga/ip/altera/pll/pll.cmp new file mode 100644 index 00000000..cf0697f8 --- /dev/null +++ b/hdl/fpga/ip/altera/pll/pll.cmp @@ -0,0 +1,26 @@ +--Copyright (C) 1991-2012 Altera Corporation +--Your use of Altera Corporation's design tools, logic functions +--and other software and tools, and its AMPP partner logic +--functions, and any output files from any of the foregoing +--(including device programming or simulation files), and any +--associated documentation or information are expressly subject +--to the terms and conditions of the Altera Program License +--Subscription Agreement, Altera MegaCore Function License +--Agreement, or other applicable license agreement, including, +--without limitation, that your use is for the sole purpose of +--programming logic devices manufactured by Altera and sold by +--Altera or its authorized distributors. Please refer to the +--applicable agreement for further details. + + +component pll + PORT + ( + areset : IN STD_LOGIC := '0'; + inclk0 : IN STD_LOGIC := '0'; + c0 : OUT STD_LOGIC ; + c1 : OUT STD_LOGIC ; + c2 : OUT STD_LOGIC ; + locked : OUT STD_LOGIC + ); +end component; diff --git a/hdl/fpga/ip/altera/pll/pll.ppf b/hdl/fpga/ip/altera/pll/pll.ppf new file mode 100644 index 00000000..6ffeb9df --- /dev/null +++ b/hdl/fpga/ip/altera/pll/pll.ppf @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/hdl/fpga/ip/altera/pll/pll.qip b/hdl/fpga/ip/altera/pll/pll.qip new file mode 100644 index 00000000..fd03a65a --- /dev/null +++ b/hdl/fpga/ip/altera/pll/pll.qip @@ -0,0 +1,5 @@ +set_global_assignment -name IP_TOOL_NAME "ALTPLL" +set_global_assignment -name IP_TOOL_VERSION "12.1" +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "pll.vhd"] +set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "pll.cmp"] +set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "pll.ppf"] diff --git a/hdl/fpga/ip/altera/pll/pll.vhd b/hdl/fpga/ip/altera/pll/pll.vhd new file mode 100644 index 00000000..7e92684a --- /dev/null +++ b/hdl/fpga/ip/altera/pll/pll.vhd @@ -0,0 +1,429 @@ +-- megafunction wizard: %ALTPLL% +-- GENERATION: STANDARD +-- VERSION: WM1.0 +-- MODULE: altpll + +-- ============================================================ +-- File Name: pll.vhd +-- Megafunction Name(s): +-- altpll +-- +-- Simulation Library Files(s): +-- altera_mf +-- ============================================================ +-- ************************************************************ +-- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! +-- +-- 12.1 Build 177 11/07/2012 SJ Web Edition +-- ************************************************************ + + +--Copyright (C) 1991-2012 Altera Corporation +--Your use of Altera Corporation's design tools, logic functions +--and other software and tools, and its AMPP partner logic +--functions, and any output files from any of the foregoing +--(including device programming or simulation files), and any +--associated documentation or information are expressly subject +--to the terms and conditions of the Altera Program License +--Subscription Agreement, Altera MegaCore Function License +--Agreement, or other applicable license agreement, including, +--without limitation, that your use is for the sole purpose of +--programming logic devices manufactured by Altera and sold by +--Altera or its authorized distributors. Please refer to the +--applicable agreement for further details. + + +LIBRARY ieee; +USE ieee.std_logic_1164.all; + +LIBRARY altera_mf; +USE altera_mf.all; + +ENTITY pll IS + PORT + ( + areset : IN STD_LOGIC := '0'; + inclk0 : IN STD_LOGIC := '0'; + c0 : OUT STD_LOGIC ; + c1 : OUT STD_LOGIC ; + c2 : OUT STD_LOGIC ; + locked : OUT STD_LOGIC + ); +END pll; + + +ARCHITECTURE SYN OF pll IS + + SIGNAL sub_wire0 : STD_LOGIC_VECTOR (4 DOWNTO 0); + SIGNAL sub_wire1 : STD_LOGIC ; + SIGNAL sub_wire2 : STD_LOGIC ; + SIGNAL sub_wire3 : STD_LOGIC ; + SIGNAL sub_wire4 : STD_LOGIC ; + SIGNAL sub_wire5 : STD_LOGIC ; + SIGNAL sub_wire6 : STD_LOGIC_VECTOR (1 DOWNTO 0); + SIGNAL sub_wire7_bv : BIT_VECTOR (0 DOWNTO 0); + SIGNAL sub_wire7 : STD_LOGIC_VECTOR (0 DOWNTO 0); + + + + COMPONENT altpll + GENERIC ( + bandwidth_type : STRING; + clk0_divide_by : NATURAL; + clk0_duty_cycle : NATURAL; + clk0_multiply_by : NATURAL; + clk0_phase_shift : STRING; + clk1_divide_by : NATURAL; + clk1_duty_cycle : NATURAL; + clk1_multiply_by : NATURAL; + clk1_phase_shift : STRING; + clk2_divide_by : NATURAL; + clk2_duty_cycle : NATURAL; + clk2_multiply_by : NATURAL; + clk2_phase_shift : STRING; + compensate_clock : STRING; + inclk0_input_frequency : NATURAL; + intended_device_family : STRING; + lpm_hint : STRING; + lpm_type : STRING; + operation_mode : STRING; + pll_type : STRING; + port_activeclock : STRING; + port_areset : STRING; + port_clkbad0 : STRING; + port_clkbad1 : STRING; + port_clkloss : STRING; + port_clkswitch : STRING; + port_configupdate : STRING; + port_fbin : STRING; + port_inclk0 : STRING; + port_inclk1 : STRING; + port_locked : STRING; + port_pfdena : STRING; + port_phasecounterselect : STRING; + port_phasedone : STRING; + port_phasestep : STRING; + port_phaseupdown : STRING; + port_pllena : STRING; + port_scanaclr : STRING; + port_scanclk : STRING; + port_scanclkena : STRING; + port_scandata : STRING; + port_scandataout : STRING; + port_scandone : STRING; + port_scanread : STRING; + port_scanwrite : STRING; + port_clk0 : STRING; + port_clk1 : STRING; + port_clk2 : STRING; + port_clk3 : STRING; + port_clk4 : STRING; + port_clk5 : STRING; + port_clkena0 : STRING; + port_clkena1 : STRING; + port_clkena2 : STRING; + port_clkena3 : STRING; + port_clkena4 : STRING; + port_clkena5 : STRING; + port_extclk0 : STRING; + port_extclk1 : STRING; + port_extclk2 : STRING; + port_extclk3 : STRING; + self_reset_on_loss_lock : STRING; + width_clock : NATURAL + ); + PORT ( + areset : IN STD_LOGIC ; + clk : OUT STD_LOGIC_VECTOR (4 DOWNTO 0); + inclk : IN STD_LOGIC_VECTOR (1 DOWNTO 0); + locked : OUT STD_LOGIC + ); + END COMPONENT; + +BEGIN + sub_wire7_bv(0 DOWNTO 0) <= "0"; + sub_wire7 <= To_stdlogicvector(sub_wire7_bv); + sub_wire4 <= sub_wire0(2); + sub_wire3 <= sub_wire0(0); + sub_wire1 <= sub_wire0(1); + c1 <= sub_wire1; + locked <= sub_wire2; + c0 <= sub_wire3; + c2 <= sub_wire4; + sub_wire5 <= inclk0; + sub_wire6 <= sub_wire7(0 DOWNTO 0) & sub_wire5; + + altpll_component : altpll + GENERIC MAP ( + bandwidth_type => "AUTO", + clk0_divide_by => 1, + clk0_duty_cycle => 50, + clk0_multiply_by => 2, + clk0_phase_shift => "0", + clk1_divide_by => 1, + clk1_duty_cycle => 50, + clk1_multiply_by => 1, + clk1_phase_shift => "0", + clk2_divide_by => 1, + clk2_duty_cycle => 50, + clk2_multiply_by => 2, + clk2_phase_shift => "3255", + compensate_clock => "CLK0", + inclk0_input_frequency => 26041, + intended_device_family => "Cyclone IV E", + lpm_hint => "CBX_MODULE_PREFIX=pll", + lpm_type => "altpll", + operation_mode => "NORMAL", + pll_type => "AUTO", + port_activeclock => "PORT_UNUSED", + port_areset => "PORT_USED", + port_clkbad0 => "PORT_UNUSED", + port_clkbad1 => "PORT_UNUSED", + port_clkloss => "PORT_UNUSED", + port_clkswitch => "PORT_UNUSED", + port_configupdate => "PORT_UNUSED", + port_fbin => "PORT_UNUSED", + port_inclk0 => "PORT_USED", + port_inclk1 => "PORT_UNUSED", + port_locked => "PORT_USED", + port_pfdena => "PORT_UNUSED", + port_phasecounterselect => "PORT_UNUSED", + port_phasedone => "PORT_UNUSED", + port_phasestep => "PORT_UNUSED", + port_phaseupdown => "PORT_UNUSED", + port_pllena => "PORT_UNUSED", + port_scanaclr => "PORT_UNUSED", + port_scanclk => "PORT_UNUSED", + port_scanclkena => "PORT_UNUSED", + port_scandata => "PORT_UNUSED", + port_scandataout => "PORT_UNUSED", + port_scandone => "PORT_UNUSED", + port_scanread => "PORT_UNUSED", + port_scanwrite => "PORT_UNUSED", + port_clk0 => "PORT_USED", + port_clk1 => "PORT_USED", + port_clk2 => "PORT_USED", + port_clk3 => "PORT_UNUSED", + port_clk4 => "PORT_UNUSED", + port_clk5 => "PORT_UNUSED", + port_clkena0 => "PORT_UNUSED", + port_clkena1 => "PORT_UNUSED", + port_clkena2 => "PORT_UNUSED", + port_clkena3 => "PORT_UNUSED", + port_clkena4 => "PORT_UNUSED", + port_clkena5 => "PORT_UNUSED", + port_extclk0 => "PORT_UNUSED", + port_extclk1 => "PORT_UNUSED", + port_extclk2 => "PORT_UNUSED", + port_extclk3 => "PORT_UNUSED", + self_reset_on_loss_lock => "OFF", + width_clock => 5 + ) + PORT MAP ( + areset => areset, + inclk => sub_wire6, + clk => sub_wire0, + locked => sub_wire2 + ); + + + +END SYN; + +-- ============================================================ +-- CNX file retrieval info +-- ============================================================ +-- Retrieval info: PRIVATE: ACTIVECLK_CHECK STRING "0" +-- Retrieval info: PRIVATE: BANDWIDTH STRING "1.000" +-- Retrieval info: PRIVATE: BANDWIDTH_FEATURE_ENABLED STRING "1" +-- Retrieval info: PRIVATE: BANDWIDTH_FREQ_UNIT STRING "MHz" +-- Retrieval info: PRIVATE: BANDWIDTH_PRESET STRING "Low" +-- Retrieval info: PRIVATE: BANDWIDTH_USE_AUTO STRING "1" +-- Retrieval info: PRIVATE: BANDWIDTH_USE_PRESET STRING "0" +-- Retrieval info: PRIVATE: CLKBAD_SWITCHOVER_CHECK STRING "0" +-- Retrieval info: PRIVATE: CLKLOSS_CHECK STRING "0" +-- Retrieval info: PRIVATE: CLKSWITCH_CHECK STRING "0" +-- Retrieval info: PRIVATE: CNX_NO_COMPENSATE_RADIO STRING "0" +-- Retrieval info: PRIVATE: CREATE_CLKBAD_CHECK STRING "0" +-- Retrieval info: PRIVATE: CREATE_INCLK1_CHECK STRING "0" +-- Retrieval info: PRIVATE: CUR_DEDICATED_CLK STRING "c0" +-- Retrieval info: PRIVATE: CUR_FBIN_CLK STRING "c0" +-- Retrieval info: PRIVATE: DEVICE_SPEED_GRADE STRING "6" +-- Retrieval info: PRIVATE: DIV_FACTOR0 NUMERIC "1" +-- Retrieval info: PRIVATE: DIV_FACTOR1 NUMERIC "1" +-- Retrieval info: PRIVATE: DIV_FACTOR2 NUMERIC "1" +-- Retrieval info: PRIVATE: DUTY_CYCLE0 STRING "50.00000000" +-- Retrieval info: PRIVATE: DUTY_CYCLE1 STRING "50.00000000" +-- Retrieval info: PRIVATE: DUTY_CYCLE2 STRING "50.00000000" +-- Retrieval info: PRIVATE: EFF_OUTPUT_FREQ_VALUE0 STRING "76.800003" +-- Retrieval info: PRIVATE: EFF_OUTPUT_FREQ_VALUE1 STRING "38.400002" +-- Retrieval info: PRIVATE: EFF_OUTPUT_FREQ_VALUE2 STRING "76.800003" +-- Retrieval info: PRIVATE: EXPLICIT_SWITCHOVER_COUNTER STRING "0" +-- Retrieval info: PRIVATE: EXT_FEEDBACK_RADIO STRING "0" +-- Retrieval info: PRIVATE: GLOCKED_COUNTER_EDIT_CHANGED STRING "1" +-- Retrieval info: PRIVATE: GLOCKED_FEATURE_ENABLED STRING "0" +-- Retrieval info: PRIVATE: GLOCKED_MODE_CHECK STRING "0" +-- Retrieval info: PRIVATE: GLOCK_COUNTER_EDIT NUMERIC "1048575" +-- Retrieval info: PRIVATE: HAS_MANUAL_SWITCHOVER STRING "1" +-- Retrieval info: PRIVATE: INCLK0_FREQ_EDIT STRING "38.400" +-- Retrieval info: PRIVATE: INCLK0_FREQ_UNIT_COMBO STRING "MHz" +-- Retrieval info: PRIVATE: INCLK1_FREQ_EDIT STRING "100.000" +-- Retrieval info: PRIVATE: INCLK1_FREQ_EDIT_CHANGED STRING "1" +-- Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_CHANGED STRING "1" +-- Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_COMBO STRING "MHz" +-- Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E" +-- Retrieval info: PRIVATE: INT_FEEDBACK__MODE_RADIO STRING "1" +-- Retrieval info: PRIVATE: LOCKED_OUTPUT_CHECK STRING "1" +-- Retrieval info: PRIVATE: LONG_SCAN_RADIO STRING "1" +-- Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE STRING "Not Available" +-- Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE_DIRTY NUMERIC "0" +-- Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT0 STRING "deg" +-- Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT1 STRING "deg" +-- Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT2 STRING "ps" +-- Retrieval info: PRIVATE: MIG_DEVICE_SPEED_GRADE STRING "Any" +-- Retrieval info: PRIVATE: MIRROR_CLK0 STRING "0" +-- Retrieval info: PRIVATE: MIRROR_CLK1 STRING "0" +-- Retrieval info: PRIVATE: MIRROR_CLK2 STRING "0" +-- Retrieval info: PRIVATE: MULT_FACTOR0 NUMERIC "2" +-- Retrieval info: PRIVATE: MULT_FACTOR1 NUMERIC "1" +-- Retrieval info: PRIVATE: MULT_FACTOR2 NUMERIC "2" +-- Retrieval info: PRIVATE: NORMAL_MODE_RADIO STRING "1" +-- Retrieval info: PRIVATE: OUTPUT_FREQ0 STRING "100.00000000" +-- Retrieval info: PRIVATE: OUTPUT_FREQ1 STRING "100.00000000" +-- Retrieval info: PRIVATE: OUTPUT_FREQ2 STRING "100.00000000" +-- Retrieval info: PRIVATE: OUTPUT_FREQ_MODE0 STRING "0" +-- Retrieval info: PRIVATE: OUTPUT_FREQ_MODE1 STRING "0" +-- Retrieval info: PRIVATE: OUTPUT_FREQ_MODE2 STRING "0" +-- Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT0 STRING "MHz" +-- Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT1 STRING "MHz" +-- Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT2 STRING "MHz" +-- Retrieval info: PRIVATE: PHASE_RECONFIG_FEATURE_ENABLED STRING "1" +-- Retrieval info: PRIVATE: PHASE_RECONFIG_INPUTS_CHECK STRING "0" +-- Retrieval info: PRIVATE: PHASE_SHIFT0 STRING "0.00000000" +-- Retrieval info: PRIVATE: PHASE_SHIFT1 STRING "0.00000000" +-- Retrieval info: PRIVATE: PHASE_SHIFT2 STRING "90.00000000" +-- Retrieval info: PRIVATE: PHASE_SHIFT_STEP_ENABLED_CHECK STRING "0" +-- Retrieval info: PRIVATE: PHASE_SHIFT_UNIT0 STRING "deg" +-- Retrieval info: PRIVATE: PHASE_SHIFT_UNIT1 STRING "deg" +-- Retrieval info: PRIVATE: PHASE_SHIFT_UNIT2 STRING "deg" +-- Retrieval info: PRIVATE: PLL_ADVANCED_PARAM_CHECK STRING "0" +-- Retrieval info: PRIVATE: PLL_ARESET_CHECK STRING "1" +-- Retrieval info: PRIVATE: PLL_AUTOPLL_CHECK NUMERIC "1" +-- Retrieval info: PRIVATE: PLL_ENHPLL_CHECK NUMERIC "0" +-- Retrieval info: PRIVATE: PLL_FASTPLL_CHECK NUMERIC "0" +-- Retrieval info: PRIVATE: PLL_FBMIMIC_CHECK STRING "0" +-- Retrieval info: PRIVATE: PLL_LVDS_PLL_CHECK NUMERIC "0" +-- Retrieval info: PRIVATE: PLL_PFDENA_CHECK STRING "0" +-- Retrieval info: PRIVATE: PLL_TARGET_HARCOPY_CHECK NUMERIC "0" +-- Retrieval info: PRIVATE: PRIMARY_CLK_COMBO STRING "inclk0" +-- Retrieval info: PRIVATE: RECONFIG_FILE STRING "pll.mif" +-- Retrieval info: PRIVATE: SACN_INPUTS_CHECK STRING "0" +-- Retrieval info: PRIVATE: SCAN_FEATURE_ENABLED STRING "1" +-- Retrieval info: PRIVATE: SELF_RESET_LOCK_LOSS STRING "0" +-- Retrieval info: PRIVATE: SHORT_SCAN_RADIO STRING "0" +-- Retrieval info: PRIVATE: SPREAD_FEATURE_ENABLED STRING "0" +-- Retrieval info: PRIVATE: SPREAD_FREQ STRING "50.000" +-- Retrieval info: PRIVATE: SPREAD_FREQ_UNIT STRING "KHz" +-- Retrieval info: PRIVATE: SPREAD_PERCENT STRING "0.500" +-- Retrieval info: PRIVATE: SPREAD_USE STRING "0" +-- Retrieval info: PRIVATE: SRC_SYNCH_COMP_RADIO STRING "0" +-- Retrieval info: PRIVATE: STICKY_CLK0 STRING "1" +-- Retrieval info: PRIVATE: STICKY_CLK1 STRING "1" +-- Retrieval info: PRIVATE: STICKY_CLK2 STRING "1" +-- Retrieval info: PRIVATE: SWITCHOVER_COUNT_EDIT NUMERIC "1" +-- Retrieval info: PRIVATE: SWITCHOVER_FEATURE_ENABLED STRING "1" +-- Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0" +-- Retrieval info: PRIVATE: USE_CLK0 STRING "1" +-- Retrieval info: PRIVATE: USE_CLK1 STRING "1" +-- Retrieval info: PRIVATE: USE_CLK2 STRING "1" +-- Retrieval info: PRIVATE: USE_CLKENA0 STRING "0" +-- Retrieval info: PRIVATE: USE_CLKENA1 STRING "0" +-- Retrieval info: PRIVATE: USE_CLKENA2 STRING "0" +-- Retrieval info: PRIVATE: USE_MIL_SPEED_GRADE NUMERIC "0" +-- Retrieval info: PRIVATE: ZERO_DELAY_RADIO STRING "0" +-- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all +-- Retrieval info: CONSTANT: BANDWIDTH_TYPE STRING "AUTO" +-- Retrieval info: CONSTANT: CLK0_DIVIDE_BY NUMERIC "1" +-- Retrieval info: CONSTANT: CLK0_DUTY_CYCLE NUMERIC "50" +-- Retrieval info: CONSTANT: CLK0_MULTIPLY_BY NUMERIC "2" +-- Retrieval info: CONSTANT: CLK0_PHASE_SHIFT STRING "0" +-- Retrieval info: CONSTANT: CLK1_DIVIDE_BY NUMERIC "1" +-- Retrieval info: CONSTANT: CLK1_DUTY_CYCLE NUMERIC "50" +-- Retrieval info: CONSTANT: CLK1_MULTIPLY_BY NUMERIC "1" +-- Retrieval info: CONSTANT: CLK1_PHASE_SHIFT STRING "0" +-- Retrieval info: CONSTANT: CLK2_DIVIDE_BY NUMERIC "1" +-- Retrieval info: CONSTANT: CLK2_DUTY_CYCLE NUMERIC "50" +-- Retrieval info: CONSTANT: CLK2_MULTIPLY_BY NUMERIC "2" +-- Retrieval info: CONSTANT: CLK2_PHASE_SHIFT STRING "3255" +-- Retrieval info: CONSTANT: COMPENSATE_CLOCK STRING "CLK0" +-- Retrieval info: CONSTANT: INCLK0_INPUT_FREQUENCY NUMERIC "26041" +-- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E" +-- Retrieval info: CONSTANT: LPM_TYPE STRING "altpll" +-- Retrieval info: CONSTANT: OPERATION_MODE STRING "NORMAL" +-- Retrieval info: CONSTANT: PLL_TYPE STRING "AUTO" +-- Retrieval info: CONSTANT: PORT_ACTIVECLOCK STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_ARESET STRING "PORT_USED" +-- Retrieval info: CONSTANT: PORT_CLKBAD0 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_CLKBAD1 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_CLKLOSS STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_CLKSWITCH STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_CONFIGUPDATE STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_FBIN STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_INCLK0 STRING "PORT_USED" +-- Retrieval info: CONSTANT: PORT_INCLK1 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_LOCKED STRING "PORT_USED" +-- Retrieval info: CONSTANT: PORT_PFDENA STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_PHASECOUNTERSELECT STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_PHASEDONE STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_PHASESTEP STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_PHASEUPDOWN STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_PLLENA STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_SCANACLR STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_SCANCLK STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_SCANCLKENA STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_SCANDATA STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_SCANDATAOUT STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_SCANDONE STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_SCANREAD STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_SCANWRITE STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clk0 STRING "PORT_USED" +-- Retrieval info: CONSTANT: PORT_clk1 STRING "PORT_USED" +-- Retrieval info: CONSTANT: PORT_clk2 STRING "PORT_USED" +-- Retrieval info: CONSTANT: PORT_clk3 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clk4 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clk5 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clkena0 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clkena1 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clkena2 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clkena3 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clkena4 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clkena5 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_extclk0 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_extclk1 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_extclk2 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_extclk3 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: SELF_RESET_ON_LOSS_LOCK STRING "OFF" +-- Retrieval info: CONSTANT: WIDTH_CLOCK NUMERIC "5" +-- Retrieval info: USED_PORT: @clk 0 0 5 0 OUTPUT_CLK_EXT VCC "@clk[4..0]" +-- Retrieval info: USED_PORT: @inclk 0 0 2 0 INPUT_CLK_EXT VCC "@inclk[1..0]" +-- Retrieval info: USED_PORT: areset 0 0 0 0 INPUT GND "areset" +-- Retrieval info: USED_PORT: c0 0 0 0 0 OUTPUT_CLK_EXT VCC "c0" +-- Retrieval info: USED_PORT: c1 0 0 0 0 OUTPUT_CLK_EXT VCC "c1" +-- Retrieval info: USED_PORT: c2 0 0 0 0 OUTPUT_CLK_EXT VCC "c2" +-- Retrieval info: USED_PORT: inclk0 0 0 0 0 INPUT_CLK_EXT GND "inclk0" +-- Retrieval info: USED_PORT: locked 0 0 0 0 OUTPUT GND "locked" +-- Retrieval info: CONNECT: @areset 0 0 0 0 areset 0 0 0 0 +-- Retrieval info: CONNECT: @inclk 0 0 1 1 GND 0 0 0 0 +-- Retrieval info: CONNECT: @inclk 0 0 1 0 inclk0 0 0 0 0 +-- Retrieval info: CONNECT: c0 0 0 0 0 @clk 0 0 1 0 +-- Retrieval info: CONNECT: c1 0 0 0 0 @clk 0 0 1 1 +-- Retrieval info: CONNECT: c2 0 0 0 0 @clk 0 0 1 2 +-- Retrieval info: CONNECT: locked 0 0 0 0 @locked 0 0 0 0 +-- Retrieval info: GEN_FILE: TYPE_NORMAL pll.vhd TRUE +-- Retrieval info: GEN_FILE: TYPE_NORMAL pll.ppf TRUE +-- Retrieval info: GEN_FILE: TYPE_NORMAL pll.inc FALSE +-- Retrieval info: GEN_FILE: TYPE_NORMAL pll.cmp TRUE +-- Retrieval info: GEN_FILE: TYPE_NORMAL pll.bsf FALSE +-- Retrieval info: GEN_FILE: TYPE_NORMAL pll_inst.vhd FALSE +-- Retrieval info: LIB_FILE: altera_mf +-- Retrieval info: CBX_MODULE_PREFIX: ON diff --git a/hdl/fpga/ip/altera/serial_pll/greybox_tmp/cbx_args.txt b/hdl/fpga/ip/altera/serial_pll/greybox_tmp/cbx_args.txt new file mode 100644 index 00000000..1724be15 --- /dev/null +++ b/hdl/fpga/ip/altera/serial_pll/greybox_tmp/cbx_args.txt @@ -0,0 +1,61 @@ +BANDWIDTH_TYPE=AUTO +CLK0_DIVIDE_BY=88 +CLK0_DUTY_CYCLE=50 +CLK0_MULTIPLY_BY=105 +CLK0_PHASE_SHIFT=0 +COMPENSATE_CLOCK=CLK0 +INCLK0_INPUT_FREQUENCY=26041 +INTENDED_DEVICE_FAMILY="Cyclone IV E" +LPM_TYPE=altpll +OPERATION_MODE=NORMAL +PLL_TYPE=AUTO +PORT_ACTIVECLOCK=PORT_UNUSED +PORT_ARESET=PORT_USED +PORT_CLKBAD0=PORT_UNUSED +PORT_CLKBAD1=PORT_UNUSED +PORT_CLKLOSS=PORT_UNUSED +PORT_CLKSWITCH=PORT_UNUSED +PORT_CONFIGUPDATE=PORT_UNUSED +PORT_FBIN=PORT_UNUSED +PORT_INCLK0=PORT_USED +PORT_INCLK1=PORT_UNUSED +PORT_LOCKED=PORT_USED +PORT_PFDENA=PORT_UNUSED +PORT_PHASECOUNTERSELECT=PORT_UNUSED +PORT_PHASEDONE=PORT_UNUSED +PORT_PHASESTEP=PORT_UNUSED +PORT_PHASEUPDOWN=PORT_UNUSED +PORT_PLLENA=PORT_UNUSED +PORT_SCANACLR=PORT_UNUSED +PORT_SCANCLK=PORT_UNUSED +PORT_SCANCLKENA=PORT_UNUSED +PORT_SCANDATA=PORT_UNUSED +PORT_SCANDATAOUT=PORT_UNUSED +PORT_SCANDONE=PORT_UNUSED +PORT_SCANREAD=PORT_UNUSED +PORT_SCANWRITE=PORT_UNUSED +PORT_clk0=PORT_USED +PORT_clk1=PORT_UNUSED +PORT_clk2=PORT_UNUSED +PORT_clk3=PORT_UNUSED +PORT_clk4=PORT_UNUSED +PORT_clk5=PORT_UNUSED +PORT_clkena0=PORT_UNUSED +PORT_clkena1=PORT_UNUSED +PORT_clkena2=PORT_UNUSED +PORT_clkena3=PORT_UNUSED +PORT_clkena4=PORT_UNUSED +PORT_clkena5=PORT_UNUSED +PORT_extclk0=PORT_UNUSED +PORT_extclk1=PORT_UNUSED +PORT_extclk2=PORT_UNUSED +PORT_extclk3=PORT_UNUSED +SELF_RESET_ON_LOSS_LOCK=OFF +WIDTH_CLOCK=5 +DEVICE_FAMILY="Cyclone IV E" +CBX_AUTO_BLACKBOX=ALL +areset +inclk +inclk +clk +locked diff --git a/hdl/fpga/ip/altera/serial_pll/serial_pll.ppf b/hdl/fpga/ip/altera/serial_pll/serial_pll.ppf new file mode 100644 index 00000000..5db39e3c --- /dev/null +++ b/hdl/fpga/ip/altera/serial_pll/serial_pll.ppf @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/hdl/fpga/ip/altera/serial_pll/serial_pll.qip b/hdl/fpga/ip/altera/serial_pll/serial_pll.qip new file mode 100644 index 00000000..07b6c46c --- /dev/null +++ b/hdl/fpga/ip/altera/serial_pll/serial_pll.qip @@ -0,0 +1,4 @@ +set_global_assignment -name IP_TOOL_NAME "ALTPLL" +set_global_assignment -name IP_TOOL_VERSION "12.1" +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "serial_pll.vhd"] +set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "serial_pll.ppf"] diff --git a/hdl/fpga/ip/altera/serial_pll/serial_pll.vhd b/hdl/fpga/ip/altera/serial_pll/serial_pll.vhd new file mode 100644 index 00000000..40600858 --- /dev/null +++ b/hdl/fpga/ip/altera/serial_pll/serial_pll.vhd @@ -0,0 +1,365 @@ +-- megafunction wizard: %ALTPLL% +-- GENERATION: STANDARD +-- VERSION: WM1.0 +-- MODULE: altpll + +-- ============================================================ +-- File Name: serial_pll.vhd +-- Megafunction Name(s): +-- altpll +-- +-- Simulation Library Files(s): +-- altera_mf +-- ============================================================ +-- ************************************************************ +-- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! +-- +-- 12.1 Build 177 11/07/2012 SJ Web Edition +-- ************************************************************ + + +--Copyright (C) 1991-2012 Altera Corporation +--Your use of Altera Corporation's design tools, logic functions +--and other software and tools, and its AMPP partner logic +--functions, and any output files from any of the foregoing +--(including device programming or simulation files), and any +--associated documentation or information are expressly subject +--to the terms and conditions of the Altera Program License +--Subscription Agreement, Altera MegaCore Function License +--Agreement, or other applicable license agreement, including, +--without limitation, that your use is for the sole purpose of +--programming logic devices manufactured by Altera and sold by +--Altera or its authorized distributors. Please refer to the +--applicable agreement for further details. + + +LIBRARY ieee; +USE ieee.std_logic_1164.all; + +LIBRARY altera_mf; +USE altera_mf.all; + +ENTITY serial_pll IS + PORT + ( + areset : IN STD_LOGIC := '0'; + inclk0 : IN STD_LOGIC := '0'; + c0 : OUT STD_LOGIC ; + locked : OUT STD_LOGIC + ); +END serial_pll; + + +ARCHITECTURE SYN OF serial_pll IS + + SIGNAL sub_wire0 : STD_LOGIC ; + SIGNAL sub_wire1 : STD_LOGIC_VECTOR (4 DOWNTO 0); + SIGNAL sub_wire2 : STD_LOGIC ; + SIGNAL sub_wire3 : STD_LOGIC ; + SIGNAL sub_wire4 : STD_LOGIC_VECTOR (1 DOWNTO 0); + SIGNAL sub_wire5_bv : BIT_VECTOR (0 DOWNTO 0); + SIGNAL sub_wire5 : STD_LOGIC_VECTOR (0 DOWNTO 0); + + + + COMPONENT altpll + GENERIC ( + bandwidth_type : STRING; + clk0_divide_by : NATURAL; + clk0_duty_cycle : NATURAL; + clk0_multiply_by : NATURAL; + clk0_phase_shift : STRING; + compensate_clock : STRING; + inclk0_input_frequency : NATURAL; + intended_device_family : STRING; + lpm_hint : STRING; + lpm_type : STRING; + operation_mode : STRING; + pll_type : STRING; + port_activeclock : STRING; + port_areset : STRING; + port_clkbad0 : STRING; + port_clkbad1 : STRING; + port_clkloss : STRING; + port_clkswitch : STRING; + port_configupdate : STRING; + port_fbin : STRING; + port_inclk0 : STRING; + port_inclk1 : STRING; + port_locked : STRING; + port_pfdena : STRING; + port_phasecounterselect : STRING; + port_phasedone : STRING; + port_phasestep : STRING; + port_phaseupdown : STRING; + port_pllena : STRING; + port_scanaclr : STRING; + port_scanclk : STRING; + port_scanclkena : STRING; + port_scandata : STRING; + port_scandataout : STRING; + port_scandone : STRING; + port_scanread : STRING; + port_scanwrite : STRING; + port_clk0 : STRING; + port_clk1 : STRING; + port_clk2 : STRING; + port_clk3 : STRING; + port_clk4 : STRING; + port_clk5 : STRING; + port_clkena0 : STRING; + port_clkena1 : STRING; + port_clkena2 : STRING; + port_clkena3 : STRING; + port_clkena4 : STRING; + port_clkena5 : STRING; + port_extclk0 : STRING; + port_extclk1 : STRING; + port_extclk2 : STRING; + port_extclk3 : STRING; + self_reset_on_loss_lock : STRING; + width_clock : NATURAL + ); + PORT ( + areset : IN STD_LOGIC ; + clk : OUT STD_LOGIC_VECTOR (4 DOWNTO 0); + inclk : IN STD_LOGIC_VECTOR (1 DOWNTO 0); + locked : OUT STD_LOGIC + ); + END COMPONENT; + +BEGIN + sub_wire5_bv(0 DOWNTO 0) <= "0"; + sub_wire5 <= To_stdlogicvector(sub_wire5_bv); + locked <= sub_wire0; + sub_wire2 <= sub_wire1(0); + c0 <= sub_wire2; + sub_wire3 <= inclk0; + sub_wire4 <= sub_wire5(0 DOWNTO 0) & sub_wire3; + + altpll_component : altpll + GENERIC MAP ( + bandwidth_type => "AUTO", + clk0_divide_by => 88, + clk0_duty_cycle => 50, + clk0_multiply_by => 105, + clk0_phase_shift => "0", + compensate_clock => "CLK0", + inclk0_input_frequency => 26041, + intended_device_family => "Cyclone IV E", + lpm_hint => "CBX_MODULE_PREFIX=serial_pll", + lpm_type => "altpll", + operation_mode => "NORMAL", + pll_type => "AUTO", + port_activeclock => "PORT_UNUSED", + port_areset => "PORT_USED", + port_clkbad0 => "PORT_UNUSED", + port_clkbad1 => "PORT_UNUSED", + port_clkloss => "PORT_UNUSED", + port_clkswitch => "PORT_UNUSED", + port_configupdate => "PORT_UNUSED", + port_fbin => "PORT_UNUSED", + port_inclk0 => "PORT_USED", + port_inclk1 => "PORT_UNUSED", + port_locked => "PORT_USED", + port_pfdena => "PORT_UNUSED", + port_phasecounterselect => "PORT_UNUSED", + port_phasedone => "PORT_UNUSED", + port_phasestep => "PORT_UNUSED", + port_phaseupdown => "PORT_UNUSED", + port_pllena => "PORT_UNUSED", + port_scanaclr => "PORT_UNUSED", + port_scanclk => "PORT_UNUSED", + port_scanclkena => "PORT_UNUSED", + port_scandata => "PORT_UNUSED", + port_scandataout => "PORT_UNUSED", + port_scandone => "PORT_UNUSED", + port_scanread => "PORT_UNUSED", + port_scanwrite => "PORT_UNUSED", + port_clk0 => "PORT_USED", + port_clk1 => "PORT_UNUSED", + port_clk2 => "PORT_UNUSED", + port_clk3 => "PORT_UNUSED", + port_clk4 => "PORT_UNUSED", + port_clk5 => "PORT_UNUSED", + port_clkena0 => "PORT_UNUSED", + port_clkena1 => "PORT_UNUSED", + port_clkena2 => "PORT_UNUSED", + port_clkena3 => "PORT_UNUSED", + port_clkena4 => "PORT_UNUSED", + port_clkena5 => "PORT_UNUSED", + port_extclk0 => "PORT_UNUSED", + port_extclk1 => "PORT_UNUSED", + port_extclk2 => "PORT_UNUSED", + port_extclk3 => "PORT_UNUSED", + self_reset_on_loss_lock => "OFF", + width_clock => 5 + ) + PORT MAP ( + areset => areset, + inclk => sub_wire4, + locked => sub_wire0, + clk => sub_wire1 + ); + + + +END SYN; + +-- ============================================================ +-- CNX file retrieval info +-- ============================================================ +-- Retrieval info: PRIVATE: ACTIVECLK_CHECK STRING "0" +-- Retrieval info: PRIVATE: BANDWIDTH STRING "1.000" +-- Retrieval info: PRIVATE: BANDWIDTH_FEATURE_ENABLED STRING "1" +-- Retrieval info: PRIVATE: BANDWIDTH_FREQ_UNIT STRING "MHz" +-- Retrieval info: PRIVATE: BANDWIDTH_PRESET STRING "Low" +-- Retrieval info: PRIVATE: BANDWIDTH_USE_AUTO STRING "1" +-- Retrieval info: PRIVATE: BANDWIDTH_USE_PRESET STRING "0" +-- Retrieval info: PRIVATE: CLKBAD_SWITCHOVER_CHECK STRING "0" +-- Retrieval info: PRIVATE: CLKLOSS_CHECK STRING "0" +-- Retrieval info: PRIVATE: CLKSWITCH_CHECK STRING "0" +-- Retrieval info: PRIVATE: CNX_NO_COMPENSATE_RADIO STRING "0" +-- Retrieval info: PRIVATE: CREATE_CLKBAD_CHECK STRING "0" +-- Retrieval info: PRIVATE: CREATE_INCLK1_CHECK STRING "0" +-- Retrieval info: PRIVATE: CUR_DEDICATED_CLK STRING "c0" +-- Retrieval info: PRIVATE: CUR_FBIN_CLK STRING "c0" +-- Retrieval info: PRIVATE: DEVICE_SPEED_GRADE STRING "6" +-- Retrieval info: PRIVATE: DIV_FACTOR0 NUMERIC "88" +-- Retrieval info: PRIVATE: DUTY_CYCLE0 STRING "50.00000000" +-- Retrieval info: PRIVATE: EFF_OUTPUT_FREQ_VALUE0 STRING "45.818180" +-- Retrieval info: PRIVATE: EXPLICIT_SWITCHOVER_COUNTER STRING "0" +-- Retrieval info: PRIVATE: EXT_FEEDBACK_RADIO STRING "0" +-- Retrieval info: PRIVATE: GLOCKED_COUNTER_EDIT_CHANGED STRING "1" +-- Retrieval info: PRIVATE: GLOCKED_FEATURE_ENABLED STRING "0" +-- Retrieval info: PRIVATE: GLOCKED_MODE_CHECK STRING "0" +-- Retrieval info: PRIVATE: GLOCK_COUNTER_EDIT NUMERIC "1048575" +-- Retrieval info: PRIVATE: HAS_MANUAL_SWITCHOVER STRING "1" +-- Retrieval info: PRIVATE: INCLK0_FREQ_EDIT STRING "38.400" +-- Retrieval info: PRIVATE: INCLK0_FREQ_UNIT_COMBO STRING "MHz" +-- Retrieval info: PRIVATE: INCLK1_FREQ_EDIT STRING "100.000" +-- Retrieval info: PRIVATE: INCLK1_FREQ_EDIT_CHANGED STRING "1" +-- Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_CHANGED STRING "1" +-- Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_COMBO STRING "MHz" +-- Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E" +-- Retrieval info: PRIVATE: INT_FEEDBACK__MODE_RADIO STRING "1" +-- Retrieval info: PRIVATE: LOCKED_OUTPUT_CHECK STRING "1" +-- Retrieval info: PRIVATE: LONG_SCAN_RADIO STRING "1" +-- Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE STRING "Not Available" +-- Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE_DIRTY NUMERIC "0" +-- Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT0 STRING "deg" +-- Retrieval info: PRIVATE: MIG_DEVICE_SPEED_GRADE STRING "Any" +-- Retrieval info: PRIVATE: MIRROR_CLK0 STRING "0" +-- Retrieval info: PRIVATE: MULT_FACTOR0 NUMERIC "105" +-- Retrieval info: PRIVATE: NORMAL_MODE_RADIO STRING "1" +-- Retrieval info: PRIVATE: OUTPUT_FREQ0 STRING "100.00000000" +-- Retrieval info: PRIVATE: OUTPUT_FREQ_MODE0 STRING "0" +-- Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT0 STRING "MHz" +-- Retrieval info: PRIVATE: PHASE_RECONFIG_FEATURE_ENABLED STRING "1" +-- Retrieval info: PRIVATE: PHASE_RECONFIG_INPUTS_CHECK STRING "0" +-- Retrieval info: PRIVATE: PHASE_SHIFT0 STRING "0.00000000" +-- Retrieval info: PRIVATE: PHASE_SHIFT_STEP_ENABLED_CHECK STRING "0" +-- Retrieval info: PRIVATE: PHASE_SHIFT_UNIT0 STRING "deg" +-- Retrieval info: PRIVATE: PLL_ADVANCED_PARAM_CHECK STRING "0" +-- Retrieval info: PRIVATE: PLL_ARESET_CHECK STRING "1" +-- Retrieval info: PRIVATE: PLL_AUTOPLL_CHECK NUMERIC "1" +-- Retrieval info: PRIVATE: PLL_ENHPLL_CHECK NUMERIC "0" +-- Retrieval info: PRIVATE: PLL_FASTPLL_CHECK NUMERIC "0" +-- Retrieval info: PRIVATE: PLL_FBMIMIC_CHECK STRING "0" +-- Retrieval info: PRIVATE: PLL_LVDS_PLL_CHECK NUMERIC "0" +-- Retrieval info: PRIVATE: PLL_PFDENA_CHECK STRING "0" +-- Retrieval info: PRIVATE: PLL_TARGET_HARCOPY_CHECK NUMERIC "0" +-- Retrieval info: PRIVATE: PRIMARY_CLK_COMBO STRING "inclk0" +-- Retrieval info: PRIVATE: RECONFIG_FILE STRING "serial_pll.mif" +-- Retrieval info: PRIVATE: SACN_INPUTS_CHECK STRING "0" +-- Retrieval info: PRIVATE: SCAN_FEATURE_ENABLED STRING "1" +-- Retrieval info: PRIVATE: SELF_RESET_LOCK_LOSS STRING "0" +-- Retrieval info: PRIVATE: SHORT_SCAN_RADIO STRING "0" +-- Retrieval info: PRIVATE: SPREAD_FEATURE_ENABLED STRING "0" +-- Retrieval info: PRIVATE: SPREAD_FREQ STRING "50.000" +-- Retrieval info: PRIVATE: SPREAD_FREQ_UNIT STRING "KHz" +-- Retrieval info: PRIVATE: SPREAD_PERCENT STRING "0.500" +-- Retrieval info: PRIVATE: SPREAD_USE STRING "0" +-- Retrieval info: PRIVATE: SRC_SYNCH_COMP_RADIO STRING "0" +-- Retrieval info: PRIVATE: STICKY_CLK0 STRING "1" +-- Retrieval info: PRIVATE: SWITCHOVER_COUNT_EDIT NUMERIC "1" +-- Retrieval info: PRIVATE: SWITCHOVER_FEATURE_ENABLED STRING "1" +-- Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0" +-- Retrieval info: PRIVATE: USE_CLK0 STRING "1" +-- Retrieval info: PRIVATE: USE_CLKENA0 STRING "0" +-- Retrieval info: PRIVATE: USE_MIL_SPEED_GRADE NUMERIC "0" +-- Retrieval info: PRIVATE: ZERO_DELAY_RADIO STRING "0" +-- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all +-- Retrieval info: CONSTANT: BANDWIDTH_TYPE STRING "AUTO" +-- Retrieval info: CONSTANT: CLK0_DIVIDE_BY NUMERIC "88" +-- Retrieval info: CONSTANT: CLK0_DUTY_CYCLE NUMERIC "50" +-- Retrieval info: CONSTANT: CLK0_MULTIPLY_BY NUMERIC "105" +-- Retrieval info: CONSTANT: CLK0_PHASE_SHIFT STRING "0" +-- Retrieval info: CONSTANT: COMPENSATE_CLOCK STRING "CLK0" +-- Retrieval info: CONSTANT: INCLK0_INPUT_FREQUENCY NUMERIC "26041" +-- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E" +-- Retrieval info: CONSTANT: LPM_TYPE STRING "altpll" +-- Retrieval info: CONSTANT: OPERATION_MODE STRING "NORMAL" +-- Retrieval info: CONSTANT: PLL_TYPE STRING "AUTO" +-- Retrieval info: CONSTANT: PORT_ACTIVECLOCK STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_ARESET STRING "PORT_USED" +-- Retrieval info: CONSTANT: PORT_CLKBAD0 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_CLKBAD1 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_CLKLOSS STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_CLKSWITCH STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_CONFIGUPDATE STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_FBIN STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_INCLK0 STRING "PORT_USED" +-- Retrieval info: CONSTANT: PORT_INCLK1 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_LOCKED STRING "PORT_USED" +-- Retrieval info: CONSTANT: PORT_PFDENA STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_PHASECOUNTERSELECT STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_PHASEDONE STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_PHASESTEP STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_PHASEUPDOWN STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_PLLENA STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_SCANACLR STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_SCANCLK STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_SCANCLKENA STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_SCANDATA STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_SCANDATAOUT STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_SCANDONE STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_SCANREAD STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_SCANWRITE STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clk0 STRING "PORT_USED" +-- Retrieval info: CONSTANT: PORT_clk1 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clk2 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clk3 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clk4 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clk5 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clkena0 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clkena1 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clkena2 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clkena3 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clkena4 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_clkena5 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_extclk0 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_extclk1 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_extclk2 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: PORT_extclk3 STRING "PORT_UNUSED" +-- Retrieval info: CONSTANT: SELF_RESET_ON_LOSS_LOCK STRING "OFF" +-- Retrieval info: CONSTANT: WIDTH_CLOCK NUMERIC "5" +-- Retrieval info: USED_PORT: @clk 0 0 5 0 OUTPUT_CLK_EXT VCC "@clk[4..0]" +-- Retrieval info: USED_PORT: @inclk 0 0 2 0 INPUT_CLK_EXT VCC "@inclk[1..0]" +-- Retrieval info: USED_PORT: areset 0 0 0 0 INPUT GND "areset" +-- Retrieval info: USED_PORT: c0 0 0 0 0 OUTPUT_CLK_EXT VCC "c0" +-- Retrieval info: USED_PORT: inclk0 0 0 0 0 INPUT_CLK_EXT GND "inclk0" +-- Retrieval info: USED_PORT: locked 0 0 0 0 OUTPUT GND "locked" +-- Retrieval info: CONNECT: @areset 0 0 0 0 areset 0 0 0 0 +-- Retrieval info: CONNECT: @inclk 0 0 1 1 GND 0 0 0 0 +-- Retrieval info: CONNECT: @inclk 0 0 1 0 inclk0 0 0 0 0 +-- Retrieval info: CONNECT: c0 0 0 0 0 @clk 0 0 1 0 +-- Retrieval info: CONNECT: locked 0 0 0 0 @locked 0 0 0 0 +-- Retrieval info: GEN_FILE: TYPE_NORMAL serial_pll.vhd TRUE +-- Retrieval info: GEN_FILE: TYPE_NORMAL serial_pll.ppf TRUE +-- Retrieval info: GEN_FILE: TYPE_NORMAL serial_pll.inc FALSE +-- Retrieval info: GEN_FILE: TYPE_NORMAL serial_pll.cmp FALSE +-- Retrieval info: GEN_FILE: TYPE_NORMAL serial_pll.bsf FALSE +-- Retrieval info: GEN_FILE: TYPE_NORMAL serial_pll_inst.vhd FALSE +-- Retrieval info: LIB_FILE: altera_mf +-- Retrieval info: CBX_MODULE_PREFIX: ON diff --git a/hdl/fpga/ip/nuand/nuand.do b/hdl/fpga/ip/nuand/nuand.do new file mode 100644 index 00000000..735ea417 --- /dev/null +++ b/hdl/fpga/ip/nuand/nuand.do @@ -0,0 +1,17 @@ +proc compile_nuand { root } { + vlib nuand + + vcom -work nuand -2008 [file join $root ./synthesis/constellation_mapper.vhd] + vcom -work nuand -2008 [file join $root ./synthesis/sync_fifo.vhd] + vcom -work nuand -2008 [file join $root ./synthesis/uart.vhd] + + vcom -work nuand -2008 [file join $root ./synthesis/cordic.vhd] + vcom -work nuand -2008 [file join $root ./synthesis/nco.vhd] + vcom -work nuand -2008 [file join $root ./synthesis/fsk_modulator.vhd] + vcom -work nuand -2008 [file join $root ./synthesis/fsk_demodulator.vhd] + vcom -work nuand -2008 [file join $root ./synthesis/uart.vhd] + + + vcom -work nuand -2008 [file join $root ./simulation/fx3_model.vhd] + vcom -work nuand -2008 [file join $root ./simulation/lms6002d_model.vhd] +} diff --git a/hdl/fpga/ip/nuand/simulation/fx3_model.vhd b/hdl/fpga/ip/nuand/simulation/fx3_model.vhd new file mode 100644 index 00000000..d9fbaf55 --- /dev/null +++ b/hdl/fpga/ip/nuand/simulation/fx3_model.vhd @@ -0,0 +1,105 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + use ieee.math_real.all ; + use ieee.math_complex.all ; + +entity fx3_model is + port ( + fx3_pclk : out std_logic ; + fx3_gpif : inout std_logic_vector(31 downto 0) ; + fx3_ctl : inout std_logic_vector(12 downto 0) ; + fx3_uart_rxd : out std_logic ; + fx3_uart_txd : in std_logic ; + fx3_uart_csx : out std_logic + ) ; +end entity ; -- fx3_model + +architecture digital_loopback of fx3_model is + + constant PCLK_HALF_PERIOD : time := 1 sec * (1.0/100.0e6/2.0) ; + + alias rxd_samples_request is fx3_ctl(0) ; + alias rxd_samples_acknowledge is fx3_ctl(1) ; + alias rxd_samples_we is fx3_ctl(2) ; + alias txd_samples_we is fx3_ctl(3) ; + alias gpif_reset is fx3_ctl(4) ; + + alias unused_ctl is fx3_ctl(12 downto 5) ; + + type gpif_state_t is (IDLE, TX_SAMPLES, RX_SAMPLES) ; + signal gpif_state : gpif_state_t ; + + signal txd_samples : std_logic_vector(31 downto 0) ; + +begin + + rxd_samples_request <= 'Z' ; + rxd_samples_we <= 'Z' ; + + -- Create a 100MHz clock output + fx3_pclk <= not fx3_pclk after PCLK_HALF_PERIOD when fx3_pclk = '0' or fx3_pclk = '1' else + '1' ; + + -- GPIF interface + fx3_gpif <= (others =>'Z') when rxd_samples_acknowledge = '1' else + txd_samples ; + + stimulus : process + constant BLOCK_SIZE : natural := 128 ; + variable count : natural := 0 ; + begin + gpif_reset <= '1' ; + gpif_state <= IDLE ; + rxd_samples_acknowledge <= '0' ; + txd_samples_we <= '0' ; + txd_samples <= (others =>'0') ; + for i in 0 to 10 loop + wait until rising_edge( fx3_pclk ) ; + end loop ; + gpif_reset <= '0' ; + while true loop + wait until rising_edge( fx3_pclk ) ; + case gpif_state is + when IDLE => + if( rxd_samples_request = '0' ) then + gpif_state <= TX_SAMPLES ; + txd_samples_we <= '1' ; + end if ; + when TX_SAMPLES => + txd_samples <= std_logic_vector(unsigned(txd_samples) + 1) ; + if( rxd_samples_request = '1' and count = 0) then + gpif_state <= RX_SAMPLES ; + txd_samples_we <= '0' ; + rxd_samples_acknowledge <= '1' ; + count := BLOCK_SIZE ; + elsif( count > 0 ) then + txd_samples_we <= '1' ; + count := count - 1 ; + end if ; + when RX_SAMPLES => + if( count = 1 ) then + gpif_state <= TX_SAMPLES ; + rxd_samples_acknowledge <= '0' ; + count := BLOCK_SIZE ; + else + count := count - 1 ; + end if ; + end case ; + end loop ; + end process ; + + -- Unused control signals for now + unused_ctl <= (others =>'0') ; + + -- TODO: UART Interface + fx3_uart_rxd <= '0' ; + fx3_uart_csx <= '1' ; + +end architecture ; -- digital_loopback + +architecture inband_scheduler of fx3_model is + +begin + +end architecture ; -- inband_scheduler diff --git a/hdl/fpga/ip/nuand/simulation/lms6002d_model.vhd b/hdl/fpga/ip/nuand/simulation/lms6002d_model.vhd new file mode 100644 index 00000000..2583f400 --- /dev/null +++ b/hdl/fpga/ip/nuand/simulation/lms6002d_model.vhd @@ -0,0 +1,57 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + use ieee.math_real.all ; + use ieee.math_complex.all ; + +entity lms6002d_model is + port ( + -- LMS RX Interface + lms_rx_clock : in std_logic ; + lms_rx_clock_out : out std_logic ; + lms_rx_data : out signed(11 downto 0) ; + lms_rx_enable : in std_logic ; + lms_rx_iq_select : in std_logic ; + + -- LMS TX Interface + lms_tx_clock : in std_logic ; + lms_tx_data : in signed(11 downto 0) ; + lms_tx_enable : in std_logic ; + lms_tx_iq_select : in std_logic ; + + -- LMS SPI Interface + lms_sclk : in std_logic ; + lms_sen : in std_logic ; + lms_sdio : out std_logic ; + lms_sdo : in std_logic ; + + -- LMS Control Interface + lms_pll_out : out std_logic ; + lms_reset : in std_logic + ) ; +end entity ; -- lms6002d_model + +architecture arch of lms6002d_model is + +begin + + lms_pll_out <= '0' ; + + -- Write transmit samples to a file or drop them on the floor + + -- Read receive samples from a file or predetermined tone + lms_rx_clock_out <= lms_rx_clock ; + + drive_rx_data : process( lms_reset, lms_rx_clock ) + begin + if( lms_reset = '1' ) then + lms_rx_data <= (others =>'0') ; + elsif( rising_edge(lms_rx_clock) or falling_edge(lms_rx_clock) ) then + lms_rx_data <= lms_rx_data + 1 ; + end if ; + end process ; + + -- Keep track of the SPI register set + lms_sdio <= '0' ; + +end architecture ; -- arch diff --git a/hdl/fpga/ip/nuand/synthesis/async_fifo.vhd b/hdl/fpga/ip/nuand/synthesis/async_fifo.vhd new file mode 100644 index 00000000..304ccb37 --- /dev/null +++ b/hdl/fpga/ip/nuand/synthesis/async_fifo.vhd @@ -0,0 +1,39 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + +entity async_fifo is + port ( + -- Global clear + clear : in std_logic ; + + -- Write side + w_clock : in std_logic ; + w_enable : in std_logic ; + w_data : in std_logic_vector(7 downto 0) ; + w_empty : out std_logic ; + w_full : out std_logic ; + + -- Read side + r_clock : in std_logic ; + r_enable : in std_logic ; + r_data : out std_logic_vector(7 downto 0) ; + r_empty : out std_logic ; + r_full : out std_logic + ) ; +end entity ; -- async_fifo + +architecture arch of async_fifo is + + -- Clear signals for their respective sides + signal r_clear : std_logic ; + signal w_clear : std_logic ; + + type status_t is record + address : natural range 0 to 1023 ; + count : natural range 0 to 1023 ; + end record ; + +begin + +end architecture ; -- arch \ No newline at end of file diff --git a/hdl/fpga/ip/nuand/synthesis/constellation_mapper.vhd b/hdl/fpga/ip/nuand/synthesis/constellation_mapper.vhd new file mode 100644 index 00000000..c6ba50ef --- /dev/null +++ b/hdl/fpga/ip/nuand/synthesis/constellation_mapper.vhd @@ -0,0 +1,289 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + use ieee.math_real.all ; + use ieee.math_complex.all ; + +package constellation_mapper_p is + + -- All possible modulations + type constellation_mapper_modulation_t is ( + APSK_16, + APSK_32, + MSK, + PSK_2, + PSK_4, + PSK_8, + PSK_8_GRAY, + PSK_16, + QAM_16, + QAM_32, + QAM_64, + QAM_128, + QAM_256, + QAM_512, + QAM_1024, + QAM_2048, + QAM_4096 + ) ; + + -- Array of modulations + type constellation_mapper_modulation_array_t is array(natural range <>) of constellation_mapper_modulation_t ; + + -- Inputs to the mapper + type constellation_mapper_inputs_t is record + bits : std_logic_vector(15 downto 0) ; + modulation : constellation_mapper_modulation_t ; + valid : std_logic ; + end record ; + + -- Outputs of the mapper + type constellation_mapper_outputs_t is record + symbol : complex ; + valid : std_logic ; + end record ; + +end package ; -- constellation_mapper_p + +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + use ieee.math_real.all ; + use ieee.math_complex.all ; + +library work ; + use work.constellation_mapper_p.all ; + +entity constellation_mapper is + generic ( + MODULATIONS : constellation_mapper_modulation_array_t := ( MSK, PSK_2, QAM_16 ) + ) ; + port ( + clock : in std_logic ; + inputs : in constellation_mapper_inputs_t ; + outputs : out constellation_mapper_outputs_t + ) ; +end entity ; -- constellation_mapper + +architecture arch of constellation_mapper is + + type real_array_t is array(natural range <>) of real ; + type complex_array_t is array(natural range <>) of complex ; + + type modulation_info_t is record + index : natural ; + mask : std_logic_vector(15 downto 0) ; + end record ; + + -- NOTE: If QAM_4096 is ever not the end, this needs to change + type modulation_index_t is array(0 to constellation_mapper_modulation_t'pos(QAM_4096)-1) of modulation_info_t ; + + -- Get the number of entries of each of the supported modulations + function size( x : constellation_mapper_modulation_t ) return natural is + variable rv : natural := 0; + begin + case x is + when APSK_16 => rv := 16; + when APSK_32 => rv := 32; + when MSK => rv := 2 ; + when PSK_2 => rv := 2 ; + when PSK_4 => rv := 4 ; + when PSK_8 => rv := 8 ; + when PSK_8_GRAY => rv := 8 ; + when PSK_16 => rv := 16 ; + when QAM_16 => rv := 16 ; + when QAM_32 => rv := 32 ; + when QAM_64 => rv := 64 ; + when QAM_128 => rv := 128 ; + when QAM_256 => rv := 256 ; + when QAM_512 => rv := 512 ; + when QAM_1024 => rv := 1024 ; + when QAM_2048 => rv := 2048 ; + when QAM_4096 => rv := 4096 ; + end case ; + return rv ; + end function ; + + -- 16-APSK Modulation points + function constellation_apsk_16 return complex_array_t is + variable rv : complex_array_t(0 to 15) := (others =>(0.0,0.0)) ; + begin + return rv ; + end function ; + + -- 32-APSK Modulation Points + function constellation_apsk_32 return complex_array_t is + variable rv : complex_array_t(0 to 31) := (others =>(0.0,0.0)) ; + begin + return rv ; + end function ; + + -- MSK Modulation Points + function constellation_msk return complex_array_t is + variable rv : complex_array_t(0 to 1) := (others =>(0.0,0.0)) ; + begin + return rv ; + end function ; + + -- BPSK Modulation Points + function constellation_psk_2 return complex_array_t is + variable rv : complex_array_t(0 to 1) := (others =>(0.0,0.0)) ; + begin + return rv ; + end function ; + + -- QPSK Modulation Points + function constellation_psk_4 return complex_array_t is + variable rv : complex_array_t(0 to 3) := (others =>(0.0,0.0)) ; + begin + return rv ; + end function ; + + -- 8-PSK Modulation Points + function constellation_psk_8 return complex_array_t is + variable rv : complex_array_t(0 to 7) := (others =>(0.0,0.0)) ; + begin + return rv ; + end function ; + + -- 8-PSK Offset Modulation Points + function constellation_psk_8_gray return complex_array_t is + variable rv : complex_array_t(0 to 7) := (others =>(0.0,0.0)) ; + begin + return rv ; + end function ; + + -- 16-PSK Modulation Points + function constellation_psk_16 return complex_array_t is + variable rv : complex_array_t(0 to 15) := (others =>(0.0,0.0)) ; + begin + return rv ; + end function ; + + -- 16-QAM Modulation Points + function constellation_qam_16 return complex_array_t is + variable rv : complex_array_t(0 to 15) := (others =>(0.0,0.0)) ; + begin + return rv ; + end function ; + + -- 32-QAM Modulation Points + function constellation_qam_32 return complex_array_t is + variable rv : complex_array_t(0 to 31) := (others =>(0.0,0.0)) ; + begin + return rv ; + end function ; + + -- 64-QAM Modulation Points + function constellation_qam_64 return complex_array_t is + variable rv : complex_array_t(0 to 63) := (others =>(0.0,0.0)) ; + begin + return rv ; + end function ; + + -- 128-QAM Modulation Points + function constellation_qam_128 return complex_array_t is + variable rv : complex_array_t(0 to 127) := (others =>(0.0,0.0)) ; + begin + return rv ; + end function ; + + -- 256-QAM Modulation Points + function constellation_qam_256 return complex_array_t is + variable rv : complex_array_t(0 to 255) := (others =>(0.0,0.0)) ; + begin + return rv ; + end function ; + + -- 512-QAM Modulation Points + function constellation_qam_512 return complex_array_t is + variable rv : complex_array_t(0 to 511) := (others =>(0.0,0.0)) ; + begin + return rv ; + end function ; + + -- 1024-QAM Modulation Points + function constellation_qam_1024 return complex_array_t is + variable rv : complex_array_t(0 to 1023) := (others =>(0.0,0.0)) ; + begin + return rv ; + end function ; + + -- 2048-QAM Modulation Points + function constellation_qam_2048 return complex_array_t is + variable rv : complex_array_t(0 to 2047) := (others =>(0.0,0.0)) ; + begin + return rv ; + end function ; + + -- 4096-QAM Modulation Points + function constellation_qam_4096 return complex_array_t is + variable rv : complex_array_t(0 to 4096) := (others =>(0.0,0.0)) ; + begin + return rv ; + end function ; + + -- Get each of the constellation arrays + function constellation( x : constellation_mapper_modulation_t ) return complex_array_t is + begin + case x is + when APSK_16 => return constellation_apsk_16 ; + when APSK_32 => return constellation_apsk_32 ; + when MSK => return constellation_msk ; + when PSK_2 => return constellation_psk_2 ; + when PSK_4 => return constellation_psk_4 ; + when PSK_8 => return constellation_psk_8 ; + when PSK_8_GRAY => return constellation_psk_8_gray ; + when PSK_16 => return constellation_psk_16 ; + when QAM_16 => return constellation_qam_16 ; + when QAM_32 => return constellation_qam_32 ; + when QAM_64 => return constellation_qam_64 ; + when QAM_128 => return constellation_qam_128 ; + when QAM_256 => return constellation_qam_256 ; + when QAM_512 => return constellation_qam_512 ; + when QAM_1024 => return constellation_qam_1024 ; + when QAM_2048 => return constellation_qam_2048 ; + when QAM_4096 => return constellation_qam_4096 ; + end case ; + end function ; + + -- Calculate the base indicies for each modulation type + function calculate_indices( x : constellation_mapper_modulation_array_t ) return modulation_index_t is + variable index : natural := 0; + variable rv : modulation_index_t := (others =>(0, x"0000")) ; + begin + for i in x'range loop + rv(constellation_mapper_modulation_t'pos(x(i))).index := index ; + rv(constellation_mapper_modulation_t'pos(x(i))).mask := std_logic_vector(to_unsigned(size(x(i))-1,rv(constellation_mapper_modulation_t'pos(x(i))).mask'length)) ; + index := index + size(x(i)) ; + end loop ; + return rv ; + end function ; + + -- Take in the array and create the modulations recursively + function generate_modulation_table( x : constellation_mapper_modulation_array_t ) return complex_array_t is + begin + return constellation(x(x'low)) & generate_modulation_table(x(x'low+1 to x'high)) ; + end function ; + + -- Constant values generated + constant modulation_index : modulation_index_t := calculate_indices(MODULATIONS) ; + constant modulation_table : complex_array_t := generate_modulation_table(MODULATIONS) ; + + -- Actual signals! + signal base : modulation_info_t ; + signal symbol : complex ; + +begin + + -- Get the inputs and base address + base <= modulation_index(constellation_mapper_modulation_t'pos(inputs.modulation)) ; + + -- Map it to the modulation table + symbol <= modulation_table(base.index + to_integer(unsigned(inputs.bits and base.mask))) ; + + -- Register the outputs + outputs.symbol <= symbol when rising_edge( clock ) and inputs.valid = '1' ; + outputs.valid <= inputs.valid when rising_edge( clock ) ; + +end architecture ; -- arch diff --git a/hdl/fpga/ip/nuand/synthesis/cordic.vhd b/hdl/fpga/ip/nuand/synthesis/cordic.vhd new file mode 100644 index 00000000..fad7c9ca --- /dev/null +++ b/hdl/fpga/ip/nuand/synthesis/cordic.vhd @@ -0,0 +1,145 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + +package cordic_p is + + -- Vectoring mode forces outputs.y to 0 + -- Rotation mode forces outputs.z to 0 + type cordic_mode_t is (CORDIC_ROTATION, CORDIC_VECTORING) ; + + -- TODO: Make this a generic package + type cordic_xyz_t is record + x : signed(15 downto 0) ; + y : signed(15 downto 0) ; + z : signed(15 downto 0) ; + valid : std_logic ; + end record ; + +end package ; -- cordic_p + +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + use ieee.math_real.all ; + +library work ; + use work.cordic_p.all ; + +entity cordic is + port ( + clock : in std_logic ; + reset : in std_logic ; + mode : in cordic_mode_t ; + inputs : in cordic_xyz_t ; + outputs : out cordic_xyz_t + ) ; +end entity ; -- cordic + +architecture arch of cordic is + + -- TODO: Make this generic + constant NUM_STAGES : natural := 12 ; + + -- TODO: Use the VHDL-2008 integer_vector + type integer_array_t is array(natural range <>) of integer ; + + -- Each stage of the CORDIC is atan(2^(-i)) + function calculate_cordic_table return integer_array_t is + variable rv : integer_array_t(0 to NUM_STAGES-1) := (others => 0) ; + begin + for i in 0 to rv'high loop + rv(i) := integer(round((2.0**NUM_STAGES)*arctan(2.0**(-i))/MATH_PI)) ; + end loop ; + return rv ; + end function ; + + -- Constant array + constant K : integer_array_t := calculate_cordic_table ; + + -- The array for CORDIC stages + type xyzs_t is array(0 to NUM_STAGES-1) of cordic_xyz_t ; + + -- ALl the XYZ's for the CORDIC stages + signal xyzs : xyzs_t ; + +begin + + rotate : process(clock, reset) + begin + if( reset = '1' ) then + xyzs <= (others =>(x => (others =>'0'), y => (others =>'0'), z => (others =>'0'), valid => '0')) ; + elsif( rising_edge( clock ) ) then + -- First stage will rotate the vector to be within -pi/2 to pi/2 + xyzs(0).valid <= inputs.valid ; + if( inputs.valid = '1' ) then + case mode is + when CORDIC_ROTATION => + -- Make sure we're only rotating -pi/2 to pi/2 and adjust accordingly + if( inputs.z > 2**(NUM_STAGES-1) ) then + xyzs(0).x <= -inputs.x ; + xyzs(0).y <= -inputs.y ; + xyzs(0).z <= inputs.z - 2**NUM_STAGES ; + elsif( inputs.z < -(2**(NUM_STAGES-1)) ) then + xyzs(0).x <= -inputs.x ; + xyzs(0).y <= -inputs.y ; + xyzs(0).z <= inputs.z + 2**NUM_STAGES ; + else + xyzs(0).x <= inputs.x ; + xyzs(0).y <= inputs.y ; + xyzs(0).z <= inputs.z ; + end if ; + when CORDIC_VECTORING => + -- Make sure we're in the 1st or 4th quadrant only + if( inputs.x < 0 and inputs.y < 0 ) then + xyzs(0).x <= -inputs.x ; + xyzs(0).y <= -inputs.y ; + xyzs(0).z <= inputs.z - 2**(NUM_STAGES) ; + elsif( inputs.x < 0 ) then + xyzs(0).x <= -inputs.x ; + xyzs(0).y <= -inputs.y ; + xyzs(0).z <= inputs.z + 2**(NUM_STAGES) ; + else + xyzs(0).x <= inputs.x ; + xyzs(0).y <= inputs.y ; + xyzs(0).z <= inputs.z ; + end if ; + end case ; + + end if ; + + -- Run through all the other stages + for i in 0 to xyzs'high-1 loop + xyzs(i+1).valid <= xyzs(i).valid ; + if( xyzs(i).valid = '1' ) then + case mode is + when CORDIC_ROTATION => + if( xyzs(i).z < 0 ) then + xyzs(i+1).x <= xyzs(i).x + shift_right(xyzs(i).y, i) ; + xyzs(i+1).y <= xyzs(i).y - shift_right(xyzs(i).x, i) ; + xyzs(i+1).z <= xyzs(i).z + K(i) ; + else + xyzs(i+1).x <= xyzs(i).x - shift_right(xyzs(i).y, i) ; + xyzs(i+1).y <= xyzs(i).y + shift_right(xyzs(i).x, i) ; + xyzs(i+1).z <= xyzs(i).z - K(i) ; + end if ; + when CORDIC_VECTORING => + if( xyzs(i).y < 0 ) then + xyzs(i+1).x <= xyzs(i).x - shift_right(xyzs(i).y, i) ; + xyzs(i+1).y <= xyzs(i).y + shift_right(xyzs(i).x, i) ; + xyzs(i+1).z <= xyzs(i).z - K(i) ; + else + xyzs(i+1).x <= xyzs(i).x + shift_right(xyzs(i).y, i) ; + xyzs(i+1).y <= xyzs(i).y - shift_right(xyzs(i).x, i) ; + xyzs(i+1).z <= xyzs(i).z + K(i) ; + end if ; + end case ; + end if ; + end loop ; + + -- Output stage + outputs <= xyzs(xyzs'high) ; + end if ; + end process ; + +end architecture ; -- arch diff --git a/hdl/fpga/ip/nuand/synthesis/fsk_demodulator.vhd b/hdl/fpga/ip/nuand/synthesis/fsk_demodulator.vhd new file mode 100644 index 00000000..422439c6 --- /dev/null +++ b/hdl/fpga/ip/nuand/synthesis/fsk_demodulator.vhd @@ -0,0 +1,81 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + +library work ; + use work.cordic_p.all ; + +entity fsk_demodulator is + port ( + clock : in std_logic ; + reset : in std_logic ; + + in_real : in signed(15 downto 0) ; + in_imag : in signed(15 downto 0) ; + in_valid : in std_logic ; + + out_ssd : buffer signed(15 downto 0) ; + out_valid : out std_logic + ) ; +end entity ; -- fsk_demodulator + +architecture arch of fsk_demodulator is + + signal cordic_inputs : cordic_xyz_t ; + signal cordic_outputs : cordic_xyz_t ; + + signal prev_z : signed(15 downto 0) ; + signal delta_z : signed(15 downto 0) ; + signal delta_z_valid : std_logic ; + signal unwrapped_z : signed(15 downto 0) ; + signal unwrapped_valid : std_logic ; + +begin + + cordic_inputs <= ( x => in_real, y => in_imag, z => (others =>'0'), valid => in_valid ) ; + + U_cordic : entity work.cordic + port map ( + clock => clock, + reset => reset, + mode => CORDIC_VECTORING, + inputs => cordic_inputs, + outputs => cordic_outputs + ) ; + + find_derivative : process(clock, reset) + begin + if( reset = '1' ) then + prev_z <= (others =>'0') ; + delta_z <= (others =>'0') ; + delta_z_valid <= '0' ; + elsif( rising_edge( clock ) ) then + delta_z_valid <= cordic_outputs.valid ; + if( cordic_outputs.valid = '1' ) then + prev_z <= cordic_outputs.z ; + delta_z <= cordic_outputs.z - prev_z ; + end if ; + end if ; + end process ; + + unwrap : process(clock, reset) + begin + if( reset = '1' ) then + unwrapped_z <= (others =>'0') ; + unwrapped_valid <= '0' ; + elsif( rising_edge( clock ) ) then + unwrapped_valid <= delta_z_valid ; + if( delta_z > 4096 ) then + unwrapped_z <= delta_z - 8192 ; + elsif( delta_z < -4096 ) then + unwrapped_z <= delta_z + 8192 ; + else + unwrapped_z <= delta_z ; + end if ; + end if ; + end process ; + + out_ssd <= out_ssd - shift_right(out_ssd,4) + unwrapped_z when rising_edge(clock) and unwrapped_valid = '1' ; + out_valid <= unwrapped_valid when rising_edge(clock); + +end architecture ; -- arch \ No newline at end of file diff --git a/hdl/fpga/ip/nuand/synthesis/fsk_modulator.vhd b/hdl/fpga/ip/nuand/synthesis/fsk_modulator.vhd new file mode 100644 index 00000000..a4270898 --- /dev/null +++ b/hdl/fpga/ip/nuand/synthesis/fsk_modulator.vhd @@ -0,0 +1,83 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + use ieee.math_real.all ; + +library work ; + use work.nco_p.all ; + +entity fsk_modulator is + port ( + clock : in std_logic ; + reset : in std_logic ; + + symbol : in std_logic ; + symbol_valid : in std_logic ; + + out_real : out signed(15 downto 0) ; + out_imag : out signed(15 downto 0) ; + out_valid : out std_logic + ) ; +end entity ; -- fsk_modulator + +architecture arch of fsk_modulator is + + -- Positive deviation for ZERO and negative deviation for ONE + constant ZERO : signed(15 downto 0) := to_signed(integer(round(4096.0/19.2)),16) ; + constant ONE : signed(15 downto 0) := -ZERO ; + + signal nco_input : nco_input_t ; + signal nco_output : nco_output_t ; + +begin + + register_new_symbol : process(clock, reset) + -- variable dir : std_logic ; + -- variable dphase : signed(15 downto 0) ; + begin + if( reset = '1' ) then + -- dir := '1' ; + -- dphase := (others =>'0') ; + nco_input.dphase <= ZERO ; + nco_input.valid <= '0' ; + elsif( rising_edge( clock ) ) then + nco_input.valid <= '1' ; + -- if( dir = '1' ) then + -- if( dphase < 4094) then + -- dphase := dphase + 1 ; + -- else + -- dphase := dphase - 1 ; + -- dir := '0' ; + -- end if ; + -- else + -- if( dphase > -4094) then + -- dphase := dphase - 1 ; + -- else + -- dphase := dphase + 1 ; + -- dir := '1' ; + -- end if ; + -- end if ; + if( symbol_valid = '1' ) then + -- nco_input.dphase <= dphase ; + if( symbol = '0' ) then + nco_input.dphase <= ZERO ; + else + nco_input.dphase <= ONE ; + end if ; + end if ; + end if ; + end process ; + + U_nco : entity work.nco + port map ( + clock => clock, + reset => reset, + inputs => nco_input, + outputs => nco_output + ) ; + + out_real <= nco_output.re ; + out_imag <= nco_output.im ; + out_valid <= nco_output.valid ; + +end architecture ; -- arch \ No newline at end of file diff --git a/hdl/fpga/ip/nuand/synthesis/nco.vhd b/hdl/fpga/ip/nuand/synthesis/nco.vhd new file mode 100644 index 00000000..0cb4cc33 --- /dev/null +++ b/hdl/fpga/ip/nuand/synthesis/nco.vhd @@ -0,0 +1,79 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + +package nco_p is + + type nco_input_t is record + dphase : signed(15 downto 0) ; + valid : std_logic ; + end record ; + + type nco_output_t is record + re : signed(15 downto 0) ; + im : signed(15 downto 0) ; + valid : std_logic ; + end record ; + +end package ; -- nco_p + +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + +library work ; + use work.cordic_p.all ; + use work.nco_p.all ; + +entity nco is + port ( + clock : in std_logic ; + reset : in std_logic ; + inputs : in nco_input_t ; + outputs : out nco_output_t + ) ; +end entity ; -- nco + +architecture arch of nco is + + signal phase : signed(15 downto 0) ; + + signal cordic_inputs : cordic_xyz_t ; + signal cordic_outputs : cordic_xyz_t ; + +begin + + accumulate_phase : process(clock, reset) + variable temp : signed(15 downto 0) ; + begin + if( reset = '1' ) then + phase <= (others =>'0') ; + elsif( rising_edge( clock ) ) then + if( inputs.valid = '1' ) then + temp := phase + inputs.dphase ; + if( temp > 4096 ) then + temp := temp - 8192 ; + elsif( temp < -4096 ) then + temp := temp + 8192 ; + end if ; + phase <= temp ; + end if ; + end if ; + end process ; + + cordic_inputs <= ( x => to_signed(1234,16), y => (others =>'0'), z => phase, valid => inputs.valid ) ; + + U_cordic : entity work.cordic + port map ( + clock => clock, + reset => reset, + mode => CORDIC_ROTATION, + inputs => cordic_inputs, + outputs => cordic_outputs + ) ; + + outputs.re <= cordic_outputs.x ; + outputs.im <= cordic_outputs.y ; + outputs.valid <= cordic_outputs.valid ; + +end architecture ; -- arch \ No newline at end of file diff --git a/hdl/fpga/ip/nuand/synthesis/sync_fifo.vhd b/hdl/fpga/ip/nuand/synthesis/sync_fifo.vhd new file mode 100644 index 00000000..52e04034 --- /dev/null +++ b/hdl/fpga/ip/nuand/synthesis/sync_fifo.vhd @@ -0,0 +1,86 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + +entity sync_fifo is + generic ( + DEPTH : positive := 32 ; + WIDTH : positive := 16 ; + READ_AHEAD : boolean := true + ) ; + port ( + areset : in std_logic ; + clock : in std_logic ; + + -- FIFO Status information + full : out std_logic ; + empty : out std_logic ; + used_words : out natural range 0 to DEPTH ; + + -- FIFO Input Side + data_in : in std_logic_vector(WIDTH-1 downto 0) ; + write_en : in std_logic ; + + -- FIFO Output Side + data_out : out std_logic_vector(WIDTH-1 downto 0) ; + read_en : in std_logic + ) ; +end entity ; -- sync_fifo + +architecture arch of sync_fifo is + + -- House keeping + signal write_address : natural range 0 to DEPTH-1 ; + signal read_address : natural range 0 to DEPTH-1 ; + signal used : natural range 0 to DEPTH ; + + -- Dual port RAM + type ram_t is array(0 to DEPTH-1) of std_logic_vector(WIDTH-1 downto 0) ; + signal ram : ram_t ; + +begin + + empty <= '1' when used = 0 else '0' ; + full <= '1' when used = DEPTH else '0' ; + used_words <= used ; + + follow_used_words : process( clock, areset ) + begin + if( areset = '1' ) then + used <= 0 ; + write_address <= 0 ; + read_address <= 0 ; + elsif( rising_edge(clock) ) then + if( write_en = '1' ) then + if( read_en = '0' ) then + if( used < DEPTH ) then + write_address <= (write_address + 1) mod DEPTH ; + used <= used + 1 ; + else + report "Trying to write a full FIFO!" severity error ; + end if ; + end if ; + else + if( read_en = '1' ) then + if( used > 0 ) then + read_address <= (read_address + 1) mod DEPTH ; + used <= used - 1 ; + else + report "Trying to read an empty FIFO!" severity error ; + end if ; + end if ; + end if ; + end if ; + end process ; + + access_ram : process( clock ) + begin + if( rising_edge( clock ) ) then + data_out <= ram(read_address) ; + if( write_en = '1' ) then + ram(write_address) <= data_in ; + end if ; + end if ; + end process ; + +end architecture ; -- arch diff --git a/hdl/fpga/ip/nuand/synthesis/tb/cordic_tb.vhd b/hdl/fpga/ip/nuand/synthesis/tb/cordic_tb.vhd new file mode 100644 index 00000000..0d309c40 --- /dev/null +++ b/hdl/fpga/ip/nuand/synthesis/tb/cordic_tb.vhd @@ -0,0 +1,84 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + use ieee.math_real.all ; + +library work ; + use work.cordic_p.all ; + +entity cordic_tb is +end entity ; -- cordic_tb + +architecture arch of cordic_tb is + + signal clock : std_logic := '1' ; + signal reset : std_logic := '1' ; + signal inputs : cordic_xyz_t := ( x => (others =>'0'), y => (others =>'0'), z => (others =>'0'), valid => '0' ); + signal outputs : cordic_xyz_t ; + signal outputs2 : cordic_xyz_t ; + + procedure nop( signal clock : in std_logic ; count : in natural ) is + begin + for i in 1 to count loop + wait until rising_edge( clock ) ; + end loop ; + end procedure ; -- nop + +begin + + -- Generate clock + clock <= not clock after 1 ns ; + + -- Magnitude/phase to cos+isin + U_cordic : entity work.cordic + port map ( + clock => clock, + reset => reset, + mode => CORDIC_ROTATION, + inputs => inputs, + outputs => outputs + ) ; + + -- cos+isin to magnitude/phase + U_cordic2 : entity work.cordic + port map ( + clock => clock, + reset => reset, + mode => CORDIC_VECTORING, + inputs => outputs, + outputs => outputs2 + ) ; + + tb : process + variable ang : integer := 0 ; + variable dang : integer := integer(round(0.01*4096.0)) ; + begin + reset <= '1' ; + nop( clock, 10 ) ; + + reset <= '0' ; + nop( clock, 10 ) ; + + ang := 0 ; + inputs.x <= to_signed( integer(round(4096.0/1.66)), inputs.x'length ) ; + inputs.y <= to_signed( 0, inputs.y'length ) ; + for i in 0 to 10000 loop + inputs.z <= to_signed( ang, inputs.z'length ) ; + inputs.valid <= '1' ; + wait until rising_edge( clock ) ; + inputs.valid <= '0' ; + nop( clock, 20 ) ; + ang := ang + dang ; + if( ang > 4096 ) then + ang := ang - 8192 ; + elsif( ang < -4096 ) then + ang := ang + 8192 ; + end if ; + + end loop ; + + report "-- End of Simulation --" severity failure ; + + end process ; + +end architecture ; -- arch \ No newline at end of file diff --git a/hdl/fpga/ip/nuand/synthesis/tb/fsk_tb.vhd b/hdl/fpga/ip/nuand/synthesis/tb/fsk_tb.vhd new file mode 100644 index 00000000..cc63ae32 --- /dev/null +++ b/hdl/fpga/ip/nuand/synthesis/tb/fsk_tb.vhd @@ -0,0 +1,83 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + use ieee.math_real.all ; + +entity fsk_tb is +end entity ; -- fsk_tb + +architecture arch of fsk_tb is + + signal clock : std_logic := '1' ; + signal reset : std_logic := '1' ; + + signal tx_symbol : std_logic := '0' ; + signal tx_valid : std_logic := '0' ; + + signal tx_sig_real : signed(15 downto 0) ; + signal tx_sig_imag : signed(15 downto 0) ; + signal tx_sig_valid : std_logic ; + + signal rx_symbol : signed(15 downto 0) ; + signal rx_valid : std_logic ; + + procedure nop( signal clock : in std_logic ; count : in natural ) is + begin + for i in 1 to count loop + wait until rising_edge( clock ) ; + end loop ; + end procedure ; + +begin + + clock <= not clock after 1 ns ; + + U_fsk_modulator : entity work.fsk_modulator + port map ( + clock => clock, + reset => reset, + symbol => tx_symbol, + symbol_valid => tx_valid, + out_real => tx_sig_real, + out_imag => tx_sig_imag, + out_valid => tx_sig_valid + ) ; + + U_fsk_demodulator : entity work.fsk_demodulator + port map ( + clock => clock, + reset => reset, + in_real => tx_sig_real, + in_imag => tx_sig_imag, + in_valid => tx_sig_valid, + out_ssd => rx_symbol, + out_valid => rx_valid + ) ; + + tb : process + variable s1, s2 : natural ; + variable random : real ; + begin + reset <= '1' ; + nop( clock, 10 ) ; + + reset <= '0' ; + nop( clock, 10 ) ; + + s1 := 1234 ; + s2 := 2345 ; + for i in 0 to 10000 loop + uniform( s1, s2, random ) ; + if( random >= 0.5 ) then + tx_symbol <= '1' ; + else + tx_symbol <= '0' ; + end if ; + tx_valid <= '1' ; + nop( clock, 50 ) ; + end loop ; + + report "-- End of Simulation --" severity failure ; + end process ; + +end architecture ; -- arch \ No newline at end of file diff --git a/hdl/fpga/ip/nuand/synthesis/tb/nco_tb.vhd b/hdl/fpga/ip/nuand/synthesis/tb/nco_tb.vhd new file mode 100644 index 00000000..c29d4837 --- /dev/null +++ b/hdl/fpga/ip/nuand/synthesis/tb/nco_tb.vhd @@ -0,0 +1,72 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + +library work ; + use work.cordic_p.all ; + use work.nco_p.all ; + +entity nco_tb is +end entity ; -- nco_tb + +architecture arch of nco_tb is + + signal clock : std_logic := '1' ; + signal reset : std_logic := '1' ; + + signal inputs : nco_input_t := ( dphase => (others =>'0'), valid => '0' ); + signal outputs : nco_output_t ; + + procedure nop( signal clock : in std_logic ; count : in natural ) is + begin + for i in 1 to count loop + wait until rising_edge( clock ) ; + end loop ; + end procedure ; + +begin + + clock <= not clock after 1 ns ; + + U_nco : entity work.nco + port map ( + clock => clock, + reset => reset, + inputs => inputs, + outputs => outputs + ) ; + + tb : process + variable up_downx : boolean := true ; + begin + reset <= '1' ; + nop( clock, 10 ) ; + + reset <= '0' ; + nop( clock, 10 ) ; + + for i in 0 to 100000 loop + if( inputs.dphase = 4096 ) then + up_downx := false ; + elsif( inputs.dphase = -4096 ) then + up_downx := true ; + end if ; + + if( up_downx ) then + inputs.dphase <= inputs.dphase + 1 ; + else + inputs.dphase <= inputs.dphase - 1 ; + end if ; + + inputs.valid <= '1' ; + wait until rising_edge( clock ) ; + inputs.valid <= '0' ; + + nop( clock, 10 ) ; + + end loop ; + + report "-- End of Simulation --" severity failure ; + end process ; + +end architecture ; -- arch \ No newline at end of file diff --git a/hdl/fpga/ip/nuand/synthesis/tb/uart_tb.vhd b/hdl/fpga/ip/nuand/synthesis/tb/uart_tb.vhd new file mode 100644 index 00000000..d6d85ebe --- /dev/null +++ b/hdl/fpga/ip/nuand/synthesis/tb/uart_tb.vhd @@ -0,0 +1,123 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + +entity uart_tb is +end entity ; -- uart_tb + +architecture arch of uart_tb is + + signal clock : std_logic := '1' ; + signal reset : std_logic := '1' ; + signal enable : std_logic := '0' ; + + signal rs232_rxd : std_logic ; + signal rs232_txd : std_logic := '1' ; + + signal txd_we : std_logic ; + signal txd_full : std_logic := '0' ; + signal txd_data : std_logic_vector(7 downto 0) ; + + signal rxd_re : std_logic ; + signal rxd_empty : std_logic := '1' ; + signal rxd_data : std_logic_vector(7 downto 0) := (others =>'0') ; + + procedure nop( signal clock : in std_logic ; count : in natural ) is + begin + for i in 1 to count loop + wait until rising_edge(clock) ; + end loop ; + end procedure ; + + procedure uart_send( signal clock : in std_logic ; signal txd : out std_logic ; data : in std_logic_vector(7 downto 0) ; cpb : in natural ) is + begin + wait until rising_edge(clock) ; + -- Send start bit + txd <= '0' ; + nop( clock, cpb ) ; + + -- Send data + for i in 0 to data'high loop + txd <= data(i) ; + nop( clock, cpb ) ; + end loop ; + + -- Send stop bit + txd <= '1' ; + nop( clock, cpb ) ; + end procedure ; + +begin + + clock <= not clock after 1 ns ; + + U_uart : entity work.uart + port map ( + clock => clock, + reset => reset, + enable => enable, + + rs232_rxd => rs232_rxd, + rs232_txd => rs232_txd, + + txd_we => txd_we, + txd_full => txd_full, + txd_data => txd_data, + + rxd_re => rxd_re, + rxd_empty => rxd_empty, + rxd_data => rxd_data + ) ; + + stimulate : process + begin + -- Reset + reset <= '1' ; + nop( clock, 10 ) ; + + -- Done with reset ... + reset <= '0' ; + nop( clock, 10 ) ; + + -- Make sure we don't do anything when we aren't enabled ... + enable <= '0' ; + nop( clock, 10 ) ; + + -- ... and now lets go! + enable <= '1' ; + nop( clock, 100000 ) ; + + -- Ding! + report "-- End of Simulation -- " severity failure ; + + end process ; + + -- Just keep sending data in from the UART + simulate_uart_sending : process + variable val : natural := 0 ; + begin + rs232_txd <= '1' ; + wait until enable = '1' ; + nop( clock, 100 ) ; + while true loop + uart_send( clock, rs232_txd, std_logic_vector(to_unsigned(val,8)), 10 ) ; + val := (val + 1) mod 256 ; + --nop( clock, 5 ) ; + end loop ; + end process ; + + -- Feedback data continuously + simulate_s2u_fifo : process + begin + rxd_empty <= '1' ; + wait until enable = '1' ; + nop( clock, 100 ) ; + rxd_empty <= '0' ; + rxd_data <= (others =>'0') ; + while true loop + wait until rising_edge( clock ) and rxd_re = '1' ; + rxd_data <= std_logic_vector(unsigned(rxd_data)+1) ; + end loop ; + end process ; + +end architecture ; -- arch diff --git a/hdl/fpga/ip/nuand/synthesis/uart.vhd b/hdl/fpga/ip/nuand/synthesis/uart.vhd new file mode 100644 index 00000000..10e013a5 --- /dev/null +++ b/hdl/fpga/ip/nuand/synthesis/uart.vhd @@ -0,0 +1,200 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + +entity uart is + port ( + -- FPGA internal interface to the TX and RX FIFOs + clock : in std_logic ; + reset : in std_logic ; + enable : in std_logic ; + + -- RS232 interface + rs232_rxd : out std_logic ; + rs232_txd : in std_logic ; + + -- UART -> FIFO interface + txd_we : out std_logic ; + txd_full : in std_logic ; + txd_data : out std_logic_vector(7 downto 0) ; + + -- FIFO -> UART interface + rxd_re : out std_logic ; + rxd_empty : in std_logic ; + rxd_data : in std_logic_vector(7 downto 0) + ) ; +end entity ; -- uart + +architecture arch of uart is + + -- TODO: Make this a generic instead of a constant + constant CLOCKS_PER_BIT : natural := 10 ; + + -- Send and receive state machine definitions + type send_fsm_t is (IDLE, SEND_START, SEND_DATA, SEND_STOP ) ; + type receive_fsm_t is (WAIT_FOR_START, CENTER_START, SAMPLE_DATA, WAIT_FOR_STOP) ; + + -- FSM signals + signal send_fsm : send_fsm_t ; + signal receive_fsm : receive_fsm_t ; + + -- Synchronization signals for asynchronous input + signal reg_txd : std_logic ; + signal sync_txd : std_logic ; + +begin + + -- Synchronize asynchronous inputs + reg_txd <= rs232_txd when rising_edge( clock ) ; + sync_txd <= reg_txd when rising_edge( clock ) ; + + -- Receive data from the UART and put it in the FIFO + receive_from_uart : process(all) + variable bits : std_logic_vector(7 downto 0) ; + variable bit_count : natural range 0 to bits'length ; + variable clock_count : natural range 0 to CLOCKS_PER_BIT ; + variable txd_delay : std_logic ; + begin + if( reset = '1' ) then + receive_fsm <= WAIT_FOR_START ; + txd_we <= '0' ; + txd_data <= (others =>'0') ; + bits := (others =>'0') ; + bit_count := 0 ; + clock_count := 0 ; + txd_delay := '0' ; + elsif( rising_edge(clock) ) then + if( enable = '0' ) then + txd_we <= '0' ; + txd_data <= (others =>'0') ; + bits := (others =>'0') ; + bit_count := 0 ; + clock_count := 0 ; + txd_delay := '0' ; + else + txd_we <= '0' ; + case receive_fsm is + -- Wait for the start signal + when WAIT_FOR_START => + if( sync_txd = '0' and txd_delay = '1' ) then + receive_fsm <= CENTER_START ; + clock_count := CLOCKS_PER_BIT/2-1 ; + end if ; + txd_delay := sync_txd ; + + -- Center the start bit + when CENTER_START => + clock_count := clock_count - 1 ; + if( clock_count = 0 ) then + receive_fsm <= SAMPLE_DATA ; + clock_count := CLOCKS_PER_BIT ; + bit_count := bits'length ; + end if ; + + -- Sample the bits + when SAMPLE_DATA => + clock_count := clock_count - 1 ; + if( clock_count = 0 ) then + bits := sync_txd & bits(bits'high downto 1) ; + bit_count := bit_count - 1 ; + clock_count := CLOCKS_PER_BIT ; + if( bit_count = 0 ) then + receive_fsm <= WAIT_FOR_STOP ; + txd_data <= bits ; + txd_we <= '1' ; + end if ; + end if ; + + -- Wait for the stop bit + when WAIT_FOR_STOP => + clock_count := clock_count - 1 ; + if( clock_count = 0 ) then + receive_fsm <= WAIT_FOR_START ; + assert sync_txd = '1' report "STOP bit not found!" severity error ; + end if ; + + when others => + end case ; + end if ; + end if ; + end process ; + + -- Send data to the UART from the FIFO + send_to_uart : process(all) + variable bits : std_logic_vector(7 downto 0) ; + variable bit_count : natural range 0 to bits'length ; + variable clock_count : natural range 0 to CLOCKS_PER_BIT ; + begin + if( reset = '1' ) then + send_fsm <= IDLE ; + rxd_re <= '0' ; + rs232_rxd <= '1' ; + bit_count := 0 ; + clock_count := 0 ; + bits := (others =>'0') ; + elsif( rising_edge(clock) ) then + if( enable = '0' ) then + send_fsm <= IDLE ; + rxd_re <= '0' ; + rs232_rxd <= '1' ; + bit_count := 0 ; + clock_count := 0 ; + bits := (others =>'0') ; + else + rxd_re <= '0' ; + case send_fsm is + -- Wait until we have something to send + when IDLE => + rs232_rxd <= '1' ; + if( rxd_empty = '0' ) then + send_fsm <= SEND_START ; + rxd_re <= '1' ; + bit_count := bits'length ; + clock_count := CLOCKS_PER_BIT ; + end if ; + + -- Send the start bit + when SEND_START => + rs232_rxd <= '0' ; + -- bits := rxd_data ; + clock_count := clock_count - 1 ; + if( clock_count = 0 ) then + send_fsm <= SEND_DATA ; + clock_count := CLOCKS_PER_BIT ; + elsif( clock_count = 9 ) then + bits := rxd_data ; + end if ; + -- Send the data + when SEND_DATA => + rs232_rxd <= bits(0) ; + clock_count := clock_count - 1 ; + if( clock_count = 0 ) then + bits := '0' & bits(bits'high downto 1) ; + bit_count := bit_count - 1 ; + clock_count := CLOCKS_PER_BIT ; + if( bit_count = 0 ) then + send_fsm <= SEND_STOP ; + end if ; + end if ; + + -- Send the stop bit + when SEND_STOP => + rs232_rxd <= '1' ; + clock_count := clock_count - 1 ; + if( clock_count = 0 ) then + send_fsm <= IDLE ; + end if ; + + -- Weird + when others => + send_fsm <= IDLE ; + rs232_rxd <= '1' ; + bit_count := 0 ; + clock_count := 0 ; + bits := (others =>'0') ; + end case ; + end if ; + end if ; + end process ; + +end architecture ; -- arch diff --git a/hdl/fpga/ip/nuand/synthesis/uart_bridge.vhd b/hdl/fpga/ip/nuand/synthesis/uart_bridge.vhd new file mode 100644 index 00000000..2e47e5fe --- /dev/null +++ b/hdl/fpga/ip/nuand/synthesis/uart_bridge.vhd @@ -0,0 +1,114 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + +entity uart_bridge is + port ( + -- UART Interface + uart_clock : in std_logic ; + uart_reset : in std_logic ; + uart_enable : in std_logic ; + uart_rxd : out std_logic ; + uart_txd : out std_logic ; + + -- SPI Interface + spi_clock : in std_logic ; + spi_reset : in std_logic ; + spi_sclk : out std_logic ; + spi_miso : in std_logic ; + spi_mosi : out std_logic ; + spi_csn : out std_logic + ) ; +end entity ; -- uart_bridge + +architecture arch of uart_bridge is + + -- UART to SPI FIFO signals + signal u2s_write : std_logic ; + signal u2s_full : std_logic ; + signal u2s_data : std_logic_vector(7 downto 0) ; + + -- SPI to UART FIFO signals + signal s2u_read : std_logic ; + signal s2u_empty : std_logic ; + signal s2u_data : std_logic_vector(7 downto 0) ; + +begin + + -- UART interface + U_uart : entity work.uart + port map ( + -- Control signals + clock => uart_clock, + reset => uart_reset, + enable => uart_enable, + + -- External UART signals + rs232_rxd => uart_rxd, + rs232_txd => uart_txd, + + -- FIFO signals for UART to FIFO from external interface + txd_we => u2s_write, + txd_full => u2s_full, + txd_wdata => u2s_data, + + -- FIFO signals for FIFO to UART to be transmitted back + rxd_re => s2u_read, + rxd_empty => s2u_empty, + rxd_rdata => s2u_data + ) ; + + -- Dual clock FIFO for UART -> SPI comms + U_u2s_fifo : entity work.async_fifo + port map ( + -- Write side: UART + w_clock => uart_clock, + w_enable => u2s_write, + w_data => u2s_data, + w_empty => open, + w_full => u2s_full, + + -- Read side: SPI + r_clock => spi_clock, + r_enable => spi_read, + r_data => spi_data, + r_empty => spi_empty, + r_full => open + ) ; + + -- Dual clock FIFO for SPI -> UART comms + U_s2u_fifo : entity work.async_fifo + port map ( + -- Write side: SPI + w_clock => spi_clock, + w_enable => spi_readback_wen, + w_data => spi_readback_data, + w_empty => open, + w_full => s2u_full, + + -- Read side: UART + r_clock => uart_clock, + r_enable => s2u_read, + r_data => s2u_data, + r_empty => s2u_empty, + r_full => open + ) ; + + -- LMS SPI interface + U_lms_spi : entity lms_spi + port map ( + -- Control signals + clock => spi_clock, + reset => spi_reset, + + -- SPI data stream + spi_data => spi_data, + spi_read => spi_read, + spi_empty => spi_empty, + + -- SPI readback data stream + readback_data => spi_readback_data, + readback_enable => spi_readback_wen + ) ; + +end architecture ; -- arch diff --git a/hdl/fpga/platforms/bladerf/bladerf.do b/hdl/fpga/platforms/bladerf/bladerf.do new file mode 100644 index 00000000..237c60dd --- /dev/null +++ b/hdl/fpga/platforms/bladerf/bladerf.do @@ -0,0 +1,15 @@ +proc compile_bladerf { root } { + vlib pll + vcom -work pll [file join $root ../../ip/altera/pll/pll.vhd] + + vlib serial_pll + vcom -work serial_pll [file join $root ../../ip/altera/serial_pll/serial_pll.vhd] + + vlib nuand + vcom -work nuand -2008 [file join $root ./vhdl/fx3.vhd] + vcom -work nuand -2008 [file join $root ./vhdl/bladerf_debug_p.vhd] + vcom -work nuand -2008 [file join $root ./vhdl/ramp.vhd] + vcom -work nuand -2008 [file join $root ./vhdl/bladerf.vhd] + + vcom -work nuand -2008 [file join $root ./vhdl/tb/bladerf_tb.vhd] +} diff --git a/hdl/fpga/platforms/bladerf/constraints/bladerf.sdc b/hdl/fpga/platforms/bladerf/constraints/bladerf.sdc new file mode 100644 index 00000000..0ddd4a37 --- /dev/null +++ b/hdl/fpga/platforms/bladerf/constraints/bladerf.sdc @@ -0,0 +1,31 @@ +# Clock inputs +create_clock -period "100.0 MHz" [get_ports fx3_pclk] +create_clock -period "38.4 MHz" [get_ports c4_clock] +create_clock -period "38.4 MHz" [get_ports lms_pll_out] +create_clock -period "19.2 MHz" [get_ports lms_sclk] +create_clock -period "76.8 MHz" [get_ports lms_rx_clock_out] + +# Generate the appropriate PLL clocks +derive_pll_clocks +derive_clock_uncertainty + +# TODO: Constrain the FX3 interface + +# TODO: Constrain the LMS interface +set_input_delay -clock [get_clocks *clk*0*] -reference_pin [get_ports lms_rx_clock_out] -max 10.0 [get_ports lms_rx_data*] +set_input_delay -clock [get_clocks *clk*0*] -reference_pin [get_ports lms_rx_clock_out] -min 1.0 [get_ports lms_rx_data*] -add_delay + + + +#set_input_delay -clock [get_clocks *clk*0*] -reference_pin [get_ports lms_rx_clock] -max 6 [get_ports lms_rx_data*] -add_delay + +set_input_delay -clock [get_clocks lms_sclk] -reference_pin [get_ports lms_sclk] -min 0.2 [get_ports lms_sdo] +set_input_delay -clock [get_clocks lms_sclk] -reference_pin [get_ports lms_sclk] -max 10.0 [get_ports lms_sdo] -add_delay +set_output_delay -clock [get_clocks lms_sclk] -reference_pin [get_ports lms_sclk] -min 0.2 [get_ports {lms_sen lms_sdio}] +set_output_delay -clock [get_clocks lms_sclk] -reference_pin [get_ports lms_sclk] -max 9 [get_ports {lms_sen lms_sdio}] -add_delay + +# Transmit samples +set_output_delay -clock [get_clocks *clk*0*] -reference_pin [get_ports lms_tx_clock] -min 1.0 [get_ports *lms_tx_data*] +set_output_delay -clock [get_clocks *clk*0*] -reference_pin [get_ports lms_tx_clock] -max 10 [get_ports *lms_tx_data*] -add_delay +set_output_delay -clock [get_clocks *clk*0*] -reference_pin [get_ports lms_tx_clock] -min 1.0 [get_ports lms_tx_iq_select] +set_output_delay -clock [get_clocks *clk*0*] -reference_pin [get_ports lms_tx_clock] -max 10 [get_ports lms_tx_iq_select] -add_delay \ No newline at end of file diff --git a/hdl/fpga/platforms/bladerf/constraints/pins.tcl b/hdl/fpga/platforms/bladerf/constraints/pins.tcl new file mode 100644 index 00000000..13a4066e --- /dev/null +++ b/hdl/fpga/platforms/bladerf/constraints/pins.tcl @@ -0,0 +1,259 @@ +# Copyright (C) 1991-2011 Altera Corporation +# Your use of Altera Corporation's design tools, logic functions +# and other software and tools, and its AMPP partner logic +# functions, and any output files from any of the foregoing +# (including device programming or simulation files), and any +# associated documentation or information are expressly subject +# to the terms and conditions of the Altera Program License +# Subscription Agreement, Altera MegaCore Function License +# Agreement, or other applicable license agreement, including, +# without limitation, that your use is for the sole purpose of +# programming logic devices manufactured by Altera and sold by +# Altera or its authorized distributors. Please refer to the +# applicable agreement for further details. + +# Quartus II 32-bit Version 11.1 Build 173 11/01/2011 SJ Web Edition +# File: Z:\projects\nuand\quartus\constraints\pins.tcl +# Generated on: Tue Oct 09 23:04:36 2012 + +package require ::quartus::project + +set VOLTAGE "3.3-V LVCMOS" +#set VOLTAGE "1.8 V" + +set_instance_assignment -name IO_STANDARD $VOLTAGE -to c4_clock +set_instance_assignment -name IO_STANDARD $VOLTAGE -to dac_csx +set_instance_assignment -name IO_STANDARD $VOLTAGE -to dac_sclk +set_instance_assignment -name IO_STANDARD $VOLTAGE -to dac_sdi +set_instance_assignment -name IO_STANDARD $VOLTAGE -to dac_sdo +set_instance_assignment -name IO_STANDARD $VOLTAGE -to refexp_1pps +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_clock +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_gpio[16] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_gpio[15] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_gpio[14] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_gpio[13] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_gpio[12] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_gpio[11] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_gpio[10] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_gpio[9] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_gpio[8] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_gpio[7] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_gpio[6] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_gpio[5] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_gpio[4] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_gpio[3] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_gpio[2] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_gpio[1] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_present +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_spi_clock +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_spi_miso +set_instance_assignment -name IO_STANDARD $VOLTAGE -to exp_spi_mosi +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_pclk +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_ctl[12] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_ctl[11] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_ctl[10] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_ctl[9] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_ctl[8] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_ctl[7] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_ctl[6] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_ctl[5] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_ctl[4] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_ctl[3] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_ctl[2] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_ctl[1] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_ctl[0] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[31] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[30] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[29] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[28] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[27] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[26] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[25] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[24] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[23] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[22] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[21] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[20] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[19] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[18] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[17] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[16] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[15] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[14] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[13] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[12] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[11] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[10] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[9] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[8] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[7] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[6] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[5] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[4] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[3] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[2] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[1] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_gpif[0] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_uart_csx +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_uart_rxd +set_instance_assignment -name IO_STANDARD $VOLTAGE -to fx3_uart_txd +set_instance_assignment -name IO_STANDARD $VOLTAGE -to led[1] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to led[2] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_pll_out +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_reset +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_clock +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_clock_out +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_data[11] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_data[10] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_data[9] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_data[8] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_data[7] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_data[6] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_data[5] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_data[4] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_data[3] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_data[2] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_data[1] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_data[0] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_enable +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_iq_select +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_v[2] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_rx_v[1] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_sclk +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_sdio +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_sdo +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_sen +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_tx_clock +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_tx_data[11] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_tx_data[10] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_tx_data[9] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_tx_data[8] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_tx_data[7] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_tx_data[6] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_tx_data[5] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_tx_data[4] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_tx_data[3] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_tx_data[2] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_tx_data[1] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_tx_data[0] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_tx_enable +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_tx_iq_select +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_tx_v[2] +set_instance_assignment -name IO_STANDARD $VOLTAGE -to lms_tx_v[1] +set_location_assignment PIN_A11 -to c4_clock +set_location_assignment PIN_B10 -to dac_csx +set_location_assignment PIN_B9 -to dac_sclk +set_location_assignment PIN_A10 -to dac_sdi +set_location_assignment PIN_A9 -to dac_sdo +set_location_assignment PIN_G1 -to fx3_pclk +set_location_assignment PIN_M1 -to fx3_ctl[12] +set_location_assignment PIN_J4 -to fx3_ctl[11] +set_location_assignment PIN_J6 -to fx3_ctl[10] +set_location_assignment PIN_K2 -to fx3_ctl[9] +set_location_assignment PIN_N1 -to fx3_ctl[8] +set_location_assignment PIN_G3 -to fx3_ctl[7] +set_location_assignment PIN_F7 -to fx3_ctl[6] +set_location_assignment PIN_B1 -to fx3_ctl[5] +set_location_assignment PIN_C1 -to fx3_ctl[4] +set_location_assignment PIN_H1 -to fx3_ctl[3] +set_location_assignment PIN_H6 -to fx3_ctl[2] +set_location_assignment PIN_F2 -to fx3_ctl[1] +set_location_assignment PIN_F1 -to fx3_ctl[0] +set_location_assignment PIN_Y1 -to fx3_gpif[31] +set_location_assignment PIN_AA1 -to fx3_gpif[30] +set_location_assignment PIN_AB3 -to fx3_gpif[29] +set_location_assignment PIN_P1 -to fx3_gpif[28] +set_location_assignment PIN_W7 -to fx3_gpif[27] +set_location_assignment PIN_R2 -to fx3_gpif[26] +set_location_assignment PIN_W6 -to fx3_gpif[25] +set_location_assignment PIN_W1 -to fx3_gpif[24] +set_location_assignment PIN_R1 -to fx3_gpif[23] +set_location_assignment PIN_V5 -to fx3_gpif[22] +set_location_assignment PIN_T4 -to fx3_gpif[21] +set_location_assignment PIN_M4 -to fx3_gpif[20] +set_location_assignment PIN_T5 -to fx3_gpif[19] +set_location_assignment PIN_P4 -to fx3_gpif[18] +set_location_assignment PIN_M6 -to fx3_gpif[17] +set_location_assignment PIN_N6 -to fx3_gpif[16] +set_location_assignment PIN_D1 -to fx3_gpif[15] +set_location_assignment PIN_C8 -to fx3_gpif[14] +set_location_assignment PIN_C7 -to fx3_gpif[13] +set_location_assignment PIN_C4 -to fx3_gpif[12] +set_location_assignment PIN_C6 -to fx3_gpif[11] +set_location_assignment PIN_B3 -to fx3_gpif[10] +set_location_assignment PIN_F10 -to fx3_gpif[9] +set_location_assignment PIN_B4 -to fx3_gpif[8] +set_location_assignment PIN_K1 -to fx3_gpif[7] +set_location_assignment PIN_A8 -to fx3_gpif[6] +set_location_assignment PIN_A3 -to fx3_gpif[5] +set_location_assignment PIN_F8 -to fx3_gpif[4] +set_location_assignment PIN_A5 -to fx3_gpif[3] +set_location_assignment PIN_B8 -to fx3_gpif[2] +set_location_assignment PIN_B7 -to fx3_gpif[1] +set_location_assignment PIN_B6 -to fx3_gpif[0] +set_location_assignment PIN_AA3 -to fx3_uart_txd +set_location_assignment PIN_AA4 -to fx3_uart_csx +set_location_assignment PIN_AA5 -to fx3_uart_rxd +set_location_assignment PIN_AA7 -to led[1] +set_location_assignment PIN_AB7 -to led[2] +set_location_assignment PIN_T21 -to lms_pll_out +set_location_assignment PIN_K21 -to lms_rx_clock +set_location_assignment PIN_T22 -to lms_rx_clock_out +set_location_assignment PIN_B22 -to lms_rx_data[11] +set_location_assignment PIN_B21 -to lms_rx_data[10] +set_location_assignment PIN_C22 -to lms_rx_data[9] +set_location_assignment PIN_C21 -to lms_rx_data[8] +set_location_assignment PIN_D22 -to lms_rx_data[7] +set_location_assignment PIN_E21 -to lms_rx_data[6] +set_location_assignment PIN_D21 -to lms_rx_data[5] +set_location_assignment PIN_F21 -to lms_rx_data[4] +set_location_assignment PIN_E22 -to lms_rx_data[3] +set_location_assignment PIN_H21 -to lms_rx_data[2] +set_location_assignment PIN_F22 -to lms_rx_data[1] +set_location_assignment PIN_J21 -to lms_rx_data[0] +set_location_assignment PIN_H22 -to lms_rx_iq_select +set_location_assignment PIN_L21 -to lms_tx_clock +set_location_assignment PIN_U21 -to lms_tx_data[11] +set_location_assignment PIN_P22 -to lms_tx_data[10] +set_location_assignment PIN_U22 -to lms_tx_data[9] +set_location_assignment PIN_R21 -to lms_tx_data[8] +set_location_assignment PIN_N22 -to lms_tx_data[7] +set_location_assignment PIN_R22 -to lms_tx_data[6] +set_location_assignment PIN_M22 -to lms_tx_data[5] +set_location_assignment PIN_P21 -to lms_tx_data[4] +set_location_assignment PIN_L22 -to lms_tx_data[3] +set_location_assignment PIN_N21 -to lms_tx_data[2] +set_location_assignment PIN_K22 -to lms_tx_data[1] +set_location_assignment PIN_M21 -to lms_tx_data[0] +set_location_assignment PIN_AA13 -to lms_reset +set_location_assignment PIN_AA14 -to lms_rx_enable +set_location_assignment PIN_AA15 -to lms_sclk +set_location_assignment PIN_AA20 -to lms_tx_v[2] +set_location_assignment PIN_AA21 -to lms_tx_v[1] +set_location_assignment PIN_AB13 -to lms_sdio +set_location_assignment PIN_AB14 -to lms_sdo +set_location_assignment PIN_AB15 -to lms_tx_enable +set_location_assignment PIN_AB16 -to lms_sen +set_location_assignment PIN_AB19 -to lms_rx_v[2] +set_location_assignment PIN_AB20 -to lms_rx_v[1] +set_location_assignment PIN_J22 -to lms_tx_iq_select +set_location_assignment PIN_A13 -to exp_spi_mosi +set_location_assignment PIN_A14 -to exp_gpio[1] +set_location_assignment PIN_A15 -to exp_gpio[2] +set_location_assignment PIN_A16 -to exp_gpio[3] +set_location_assignment PIN_A17 -to exp_gpio[4] +set_location_assignment PIN_A18 -to exp_gpio[5] +set_location_assignment PIN_A19 -to exp_gpio[6] +set_location_assignment PIN_A20 -to exp_gpio[7] +set_location_assignment PIN_C19 -to exp_gpio[8] +set_location_assignment PIN_B13 -to exp_gpio[9] +set_location_assignment PIN_B14 -to exp_gpio[10] +set_location_assignment PIN_B15 -to exp_gpio[11] +set_location_assignment PIN_B16 -to exp_gpio[12] +set_location_assignment PIN_B17 -to exp_gpio[13] +set_location_assignment PIN_B18 -to exp_gpio[14] +set_location_assignment PIN_B19 -to exp_gpio[15] +set_location_assignment PIN_B20 -to exp_gpio[16] +set_location_assignment PIN_C13 -to exp_present +set_location_assignment PIN_D13 -to exp_spi_miso +set_location_assignment PIN_E12 -to exp_spi_clock diff --git a/hdl/fpga/platforms/bladerf/vhdl/bladerf.vhd b/hdl/fpga/platforms/bladerf/vhdl/bladerf.vhd new file mode 100644 index 00000000..d905f725 --- /dev/null +++ b/hdl/fpga/platforms/bladerf/vhdl/bladerf.vhd @@ -0,0 +1,345 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + use ieee.math_real.all ; + use ieee.math_complex.all ; + +library pll ; +library serial_pll ; + +entity bladerf is + port ( + -- Main 38.4MHz system clock + c4_clock : in std_logic ; + + -- VCTCXO DAC + dac_sclk : out std_logic ; + dac_sdi : out std_logic ; + dac_sdo : in std_logic ; + dac_csx : out std_logic ; + + -- LEDs + led : buffer std_logic_vector(2 downto 1) := (others =>'0') ; + + -- LMS RX Interface + lms_rx_clock : buffer std_logic ; + lms_rx_clock_out : in std_logic ; + lms_rx_data : in signed(11 downto 0) ; + lms_rx_enable : out std_logic ; + lms_rx_iq_select : in std_logic := '0' ; + lms_rx_v : out std_logic_vector(2 downto 1) ; + + -- LMS TX Interface + lms_tx_clock : out std_logic ; + lms_tx_data : out signed(11 downto 0) ; + lms_tx_enable : out std_logic ; + lms_tx_iq_select : buffer std_logic := '0' ; + lms_tx_v : out std_logic_vector(2 downto 1) ; + + -- LMS SPI Interface + lms_sclk : buffer std_logic ; + lms_sen : out std_logic ; + lms_sdio : out std_logic ; + lms_sdo : in std_logic ; + + -- LMS Control Interface + lms_pll_out : in std_logic ; + lms_reset : buffer std_logic ; + + -- FX3 Interface + fx3_pclk : in std_logic ; + fx3_gpif : inout std_logic_vector(31 downto 0) ; + fx3_ctl : inout std_logic_vector(12 downto 0) ; + fx3_uart_rxd : out std_logic ; + fx3_uart_txd : in std_logic ; + fx3_uart_csx : in std_logic ; + + -- 1pps reference + refexp_1pps : in std_logic ; + + -- Expansion Interface + exp_clock : out std_logic ; + exp_present : in std_logic ; + exp_spi_clock : out std_logic ; + exp_spi_miso : in std_logic ; + exp_spi_mosi : out std_logic ; + exp_gpio : inout std_logic_vector(16 downto 1) + ) ; +end entity ; -- bladerf + +architecture arch of bladerf is + + component nios_system is + port ( + clk_clk : in std_logic := 'X'; -- clk + reset_reset_n : in std_logic := 'X'; -- reset_n + dac_MISO : in std_logic := 'X'; -- MISO + dac_MOSI : out std_logic; -- MOSI + dac_SCLK : out std_logic; -- SCLK + dac_SS_n : out std_logic; -- SS_n + spi_MISO : in std_logic := 'X'; -- MISO + spi_MOSI : out std_logic; -- MOSI + spi_SCLK : out std_logic; -- SCLK + spi_SS_n : out std_logic; -- SS_n + uart_rxd : in std_logic; + uart_txd : out std_logic + ); + end component nios_system; + + signal ramp_out : signed(11 downto 0) ; + + signal \38.4MHz\ : std_logic ; + signal \76.8MHz\ : std_logic ; + signal \76.8MHz@90\ : std_logic ; + + signal rs232_clock : std_logic ; + signal rs232_locked : std_logic ; + + signal sfifo_din : std_logic_vector(7 downto 0) ; + signal sfifo_dout : std_logic_vector(7 downto 0) ; + signal sfifo_full : std_logic ; + signal sfifo_empty : std_logic ; + signal sfifo_re : std_logic ; + signal sfifo_we : std_logic ; + + attribute noprune : boolean ; + + signal rx_i : signed(11 downto 0) ; + signal rx_q : signed(11 downto 0) ; + + attribute noprune of rx_i : signal is true ; + attribute noprune of rx_q : signal is true ; + + signal fsk_real : signed(15 downto 0) ; + signal fsk_imag : signed(15 downto 0) ; + signal fsk_valid : std_logic ; + + attribute noprune of fsk_real : signal is true ; + attribute noprune of fsk_imag : signal is true ; + + signal nios_uart_txd : std_logic ; + signal nios_uart_rxd : std_logic ; + + attribute noprune of nios_uart_txd : signal is true ; + attribute noprune of nios_uart_rxd : signal is true ; + + signal demod_in_i : signed(15 downto 0) ; + signal demod_in_q : signed(15 downto 0) ; + signal demod_ssd : signed(15 downto 0) ; + signal demod_valid : std_logic ; + + signal qualifier : unsigned(5 downto 0) := (others =>'0') ; + attribute noprune of qualifier : signal is true ; + +begin + + qualifier <= qualifier + 1 when rising_edge(\38.4MHz\) ; + + rx_i <= lms_rx_data when rising_edge(lms_rx_clock_out) and lms_rx_iq_select = '1' ; + rx_q <= lms_rx_data when rising_edge(lms_rx_clock_out) and lms_rx_iq_select = '0' ; + + U_pll : entity pll.pll + port map ( + inclk0 => c4_clock, + c0 => \76.8MHz\, + c1 => \38.4MHz\, + c2 => \76.8MHz@90\, + locked => open + ) ; + + U_serial_pll : entity serial_pll.serial_pll + port map ( + inclk0 => c4_clock, + c0 => rs232_clock, + locked => rs232_locked + ) ; + + -- U_uart_bridge : entity work.uart_bridge + -- port map ( + -- uart_clock + -- uart_reset + -- uart_enable + -- uart_rxd + -- uart_txd + -- ) ; + + -- U_uart : entity work.uart + -- port map ( + -- clock => rs232_clock, + -- reset => not(rs232_locked), + -- enable => not(fx3_uart_csx), + + -- rs232_rxd => fx3_uart_rxd, + -- rs232_txd => fx3_uart_txd, + + -- txd_we => sfifo_we, + -- txd_full => sfifo_full, + -- txd_data => sfifo_din, + + -- rxd_re => sfifo_re, + -- rxd_empty => sfifo_empty, + -- rxd_data => sfifo_dout + -- ) ; + + -- U_sfifo : entity work.sync_fifo + -- generic map ( + -- DEPTH => 32, + -- WIDTH => sfifo_din'length, + -- READ_AHEAD => true + -- ) port map ( + -- areset => not(rs232_locked), + -- clock => rs232_clock, + + -- full => sfifo_full, + -- empty => sfifo_empty, + -- used_words => open, + + -- data_in => sfifo_din, + -- write_en => sfifo_we, + + -- data_out => sfifo_dout, + -- read_en => sfifo_re + -- ) ; + + U_nios_system : nios_system + port map ( + clk_clk => c4_clock, + reset_reset_n => '1', + dac_MISO => dac_sdo, + dac_MOSI => dac_sdi, + dac_SCLK => dac_sclk, + dac_SS_n => dac_csx, + spi_MISO => lms_sdo, + spi_MOSI => lms_sdio, + spi_SCLK => lms_sclk, + spi_SS_n => lms_sen, + uart_rxd => nios_uart_rxd, + uart_txd => nios_uart_txd + ) ; + +-- U_spi_reader : entity work.spi_reader +-- port map ( +-- clock => c4_clock, +-- sclk => lms_sclk, +-- miso => lms_sdo, +-- mosi => lms_sdio, +-- enx => lms_sen, +-- reset_out => lms_reset +-- ) ; + + U_fsk_modulator : entity work.fsk_modulator + port map ( + clock => \38.4MHz\, + reset => '0', + + symbol => nios_uart_txd, + symbol_valid => '1', + + out_real => fsk_real, + out_imag => fsk_imag, + out_valid => fsk_valid + ) ; + + demod_in_i <= resize(rx_i,demod_in_i'length) when rising_edge(lms_rx_clock_out) and lms_rx_iq_select = '1' ; + demod_in_q <= resize(rx_q,demod_in_q'length) when rising_edge(lms_rx_clock_out) and lms_rx_iq_Select = '1' ; + + U_fsk_demodulator : entity work.fsk_demodulator + port map ( + clock => lms_rx_clock_out, + reset => '0', + + in_real => resize(rx_i,16), + in_imag => resize(rx_q,16), + in_valid => lms_rx_iq_select, + + out_ssd => demod_ssd, + out_valid => demod_valid + ) ; + + nios_uart_rxd <= demod_ssd(demod_ssd'high) when demod_valid = '1' ; + + toggle_led1 : process(lms_rx_clock_out) + variable count : natural range 0 to 38_400_00 := 38_400_00 ; + begin + if( rising_edge(lms_rx_clock_out) ) then + count := count - 1 ; + if( count = 0 ) then + count := 38_400_00 ; + led(1) <= not led(1) ; + end if ; + end if ; + end process ; + + toggle_led2 : process(c4_clock) + variable count : natural range 0 to 3_840_000 := 3_840_000 ; + begin + if( rising_edge(c4_clock) ) then + count := count - 1; + if( count = 0 ) then + count := 3_840_000 ; + led(2) <= not led(2) ; + end if ; + end if ; + end process ; + + +-- -- Digital loopback FX3 +-- U_fx3 : entity work.fx3(digital_loopback) +-- port map ( +-- pclk => fx3_pclk, +-- gpif => fx3_gpif, +-- ctl => fx3_ctl, +-- rxd => fx3_uart_rxd, +-- txd => fx3_uart_txd, +-- csx => fx3_uart_csx +-- ) ; + + -- Outputs +-- dac_sclk <= '0' ; +-- dac_sdo <= '0' ; +-- dac_csx <= '0' ; + + lms_reset <= '1' ; + + lms_rx_clock <= \76.8MHz\ ; + lms_rx_enable <= '1' ; + + lms_tx_clock <= \76.8MHz\ ; + lms_tx_enable <= '1' ; + lms_tx_iq_select <= not lms_tx_iq_select when rising_edge(\76.8MHz\) ; + + assign_data : process(\76.8MHz\) + begin + if( rising_edge(\76.8MHz\) ) then + if( lms_tx_iq_select = '1' ) then + lms_tx_data <= resize(shift_right(fsk_real,0),lms_tx_data'length) ; + else + lms_tx_data <= resize(shift_right(fsk_imag,0),lms_tx_data'length) ; + end if ; + end if ; + end process ; + + U_ramp : entity work.ramp + port map ( + clock => c4_clock, + reset => '0', + ramp_out => ramp_out + ) ; + + --lms_sclk <= '0' ; + --lms_sen <= '0' ; + --lms_sdo <= '0' ; + + lms_tx_v <= "10" ; + lms_rx_v <= "10" ; + + fx3_gpif <= (others =>'Z') ; + fx3_ctl <= (others =>'Z') ; + -- fx3_uart_rxd <= fx3_uart_txd ; + + exp_clock <= '0' ; + exp_spi_clock <= '0' ; + exp_spi_mosi <= '0' ; + exp_gpio <= (others =>'Z') ; + +end architecture ; -- arch diff --git a/hdl/fpga/platforms/bladerf/vhdl/bladerf_debug_p.vhd b/hdl/fpga/platforms/bladerf/vhdl/bladerf_debug_p.vhd new file mode 100644 index 00000000..bef1552b --- /dev/null +++ b/hdl/fpga/platforms/bladerf/vhdl/bladerf_debug_p.vhd @@ -0,0 +1,11 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + use ieee.math_real.all ; + use ieee.math_complex.all ; + +package bladerf_debug_p is + + -- Debug signals + +end package ; diff --git a/hdl/fpga/platforms/bladerf/vhdl/fx3.vhd b/hdl/fpga/platforms/bladerf/vhdl/fx3.vhd new file mode 100644 index 00000000..dc3cf6a1 --- /dev/null +++ b/hdl/fpga/platforms/bladerf/vhdl/fx3.vhd @@ -0,0 +1,135 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + +library nuand ; + +entity fx3 is + port ( + -- FX3 GPIF + pclk : in std_logic ; + gpif : inout std_logic_vector(31 downto 0) ; + ctl : inout std_logic_vector(12 downto 0) ; + + -- FX3 UART + rxd : out std_logic ; + txd : in std_logic ; + csx : in std_logic ; + + -- USB RX'd data output side + usb_data_rx : out std_logic_vector(31 downto 0) ; + usb_data_rx_we : out std_logic ; + usb_data_rx_clear : out std_logic ; + + -- USB TX data input + usb_data_tx : in std_logic_vector(31 downto 0) := (others =>'0') ; + usb_data_tx_empty : in std_logic := '1' ; + usb_data_tx_re : out std_logic ; + usb_data_tx_clear : out std_logic ; + + -- UART RX'd data output side + uart_data_rx : out std_logic_vector(7 downto 0) ; + uart_data_rx_we : out std_logic ; + + -- UART TX data input + uart_data_tx : in std_logic_vector(7 downto 0) := (others =>'0') ; + uart_data_tx_re : out std_logic ; + uart_data_tx_empty : in std_logic := '1' + ) ; +end entity ; -- fx3 + +architecture digital_loopback of fx3 is + + alias rxd_samples_request is ctl(0) ; + alias rxd_samples_acknowledge is ctl(1) ; + alias rxd_samples_we is ctl(2) ; + alias txd_samples_we is ctl(3) ; + alias gpif_reset is ctl(4) ; + + alias unused_ctl is ctl(12 downto 5) ; + + constant FIFO_DEPTH : positive := 1024 ; + signal rxd_samples : std_logic_vector(gpif'range) ; + signal fifo_used : natural range 0 to FIFO_DEPTH ; + signal fifo_full : std_logic ; + signal fifo_empty : std_logic ; + signal fifo_read_en : std_logic ; + +begin + + -- USB data goes nowhere + usb_data_rx <= (others =>'0') ; + usb_data_rx_we <= '0' ; + usb_data_rx_clear <= '1' ; + usb_data_tx_re <= '0' ; + usb_data_tx_clear <= '1' ; + + -- UART loopback + rxd <= txd when csx = '0' else '0' ; + uart_data_rx <= (others =>'0') ; + uart_data_rx_we <= '0' ; + uart_data_tx_re <= '0' ; + + -- Set the unused control lines to something + unused_ctl <= (others =>'0') ; + + -- Only drive the GPIF when we've gotten an acknowledgement from the FX3 saying we have the bus + gpif <= rxd_samples when rxd_samples_acknowledge = '1' + else (others =>'Z') ; + + -- Control signals that the FX3 drives + rxd_samples_acknowledge <= 'Z' ; + txd_samples_we <= 'Z' ; + rxd_samples_we <= '0' when gpif_reset = '1' else + rxd_samples_acknowledge when rising_edge(pclk) ; + + fifo_read_en <= '0' ; + + request_generator : process(all) + begin + if( fifo_used = 0 ) then + rxd_samples_request <= '0' ; + elsif( fifo_used > 128 ) then + if( rxd_samples_request = '0' ) then + rxd_samples_request <= '1' ; + else + if( fifo_used = 1 ) then + rxd_samples_request <= '0' ; + else + rxd_samples_request <= '1' ; + end if ; + end if ; + else + if( rxd_samples_request = '1' ) then + if( fifo_used = 0 ) then + rxd_samples_request <= '0' ; + end if ; + end if ; + end if ; + end process ; + + -- Synchronous FIFO for loopback + U_fifo : entity nuand.sync_fifo + generic map ( + DEPTH => FIFO_DEPTH, + WIDTH => gpif'length, + READ_AHEAD => true + ) port map ( + areset => gpif_reset, + clock => pclk, + used_words => fifo_used, + full => fifo_full, + empty => fifo_empty, + data_in => gpif, + write_en => txd_samples_we, + data_out => rxd_samples, + read_en => rxd_samples_acknowledge + ) ; + +end architecture ; -- digital_loopback + +architecture inband_scheduler of fx3 is + +begin + +end architecture ; -- inband_scheduler diff --git a/hdl/fpga/platforms/bladerf/vhdl/ramp.vhd b/hdl/fpga/platforms/bladerf/vhdl/ramp.vhd new file mode 100644 index 00000000..b27d4f97 --- /dev/null +++ b/hdl/fpga/platforms/bladerf/vhdl/ramp.vhd @@ -0,0 +1,28 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + +entity ramp is + port ( + clock : in std_logic ; + reset : in std_logic ; + + ramp_out : buffer signed(11 downto 0) + ) ; +end entity ; + +architecture arch of ramp is + +begin + + count : process(clock, reset) + begin + if( reset = '1' ) then + ramp_out <= (others =>'0') ; + elsif( rising_edge(clock) ) then + ramp_out <= ramp_out + 1 ; + end if ; + end process ; + +end architecture ; + diff --git a/hdl/fpga/platforms/bladerf/vhdl/spi_reader.vhd b/hdl/fpga/platforms/bladerf/vhdl/spi_reader.vhd new file mode 100644 index 00000000..04f1c9c6 --- /dev/null +++ b/hdl/fpga/platforms/bladerf/vhdl/spi_reader.vhd @@ -0,0 +1,115 @@ +library ieee; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + +entity spi_reader is + port ( + clock : in std_logic ; + + sclk : out std_logic ; + miso : in std_logic ; + mosi : out std_logic ; + enx : out std_logic ; + reset_out : out std_logic + ) ; +end entity ; + +architecture arch of spi_reader is + + constant RESET_CYCLES : natural := 1000 ; + constant ENX_WAIT_CYCLES : natural := 10 ; + constant WRITE_BIT_COUNT : natural := 7 ; + constant READ_BIT_COUNT : natural := 8 ; + constant TOTAL_BIT_COUNT : natural := WRITE_BIT_COUNT + READ_BIT_COUNT ; + + type command_t is (COMMAND_READ, COMMAND_WRITE) ; + type fsm_t is (RESET, WAITING, FALLING_SCLK, RISING_SCLK) ; + signal fsm : fsm_t ; + constant command : command_t := COMMAND_READ ; + signal spi_address : unsigned(6 downto 0) := (others =>'0') ; + +begin + + reader : process(all) + variable count : natural range 0 to 1000 := 0 ; + variable address : unsigned(6 downto 0) := (others =>'0') ; + variable wdata : unsigned(7 downto 0) ; + variable rdata : unsigned(7 downto 0) ; + begin + if( rising_edge(clock) ) then + enx <= '0' ; + reset_out <= '1' ; + case fsm is + + when RESET => + reset_out <= '0' ; + spi_address <= (others =>'0') ; + if( count = 0 ) then + fsm <= WAITING ; + count := ENX_WAIT_CYCLES ; + else + count := count - 1 ; + end if ; + + when WAITING => + sclk <= '1' ; + enx <= '1' ; + if( spi_address = 127 ) then + spi_address <= (others =>'0') ; + fsm <= RESET ; + count := RESET_CYCLES ; + end if ; + if( count = 0 ) then + count := TOTAL_BIT_COUNT ; + fsm <= FALLING_SCLK ; + address := spi_address ; + spi_address <= spi_address + 1; + else + count := count - 1 ; + end if ; + + when FALLING_SCLK => + sclk <= '0' ; + fsm <= RISING_SCLK ; + if( command = COMMAND_READ ) then + if( count = TOTAL_BIT_COUNT ) then + mosi <= '0' ; + elsif( count < TOTAL_BIT_COUNT - WRITE_BIT_COUNT ) then + mosi <= '0' ; + else + mosi <= address(address'high) ; + address := shift_left(address,1) ; + end if ; + else + if( count = TOTAL_BIT_COUNT ) then + mosi <= '1' ; + elsif( count < TOTAL_BIT_COUNT - WRITE_BIT_COUNT ) then + mosi <= wdata(wdata'high) ; + wdata := shift_left(wdata,1) ; + else + mosi <= address(address'high) ; + address := shift_left(address,1) ; + end if ; + + end if ; + + when RISING_SCLK => + sclk <= '1' ; + if( command = COMMAND_READ ) then + if( count < TOTAL_BIT_COUNT - WRITE_BIT_COUNT ) then + rdata := rdata(rdata'high-1 downto 0) & miso ; + end if ; + end if ; + if( count = 0 ) then + fsm <= WAITING ; + count := ENX_WAIT_CYCLES ; + else + count := count - 1 ; + fsm <= FALLING_SCLK ; + end if ; + + end case ; + end if ; + end process ; + +end architecture ; diff --git a/hdl/fpga/platforms/bladerf/vhdl/tb/bladerf_tb.vhd b/hdl/fpga/platforms/bladerf/vhdl/tb/bladerf_tb.vhd new file mode 100644 index 00000000..9529691f --- /dev/null +++ b/hdl/fpga/platforms/bladerf/vhdl/tb/bladerf_tb.vhd @@ -0,0 +1,208 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + use ieee.math_real.all ; + use ieee.math_complex.all ; + +library nuand ; + +entity bladerf_tb is +end entity ; -- bladerf_tb + +architecture arch of bladerf_tb is + + constant C4_CLOCK_HALF_PERIOD : time := 1 sec * (1.0/38.4e6/2.0) ; + + type lms_rx_t is record + clock : std_logic ; + clock_out : std_logic ; + data : signed(11 downto 0) ; + enable : std_logic ; + iq_select : std_logic ; + end record ; + + type lms_tx_t is record + clock : std_logic ; + data : signed(11 downto 0) ; + enable : std_logic ; + iq_select : std_logic ; + end record ; + + type lms_spi_t is record + sclk : std_logic ; + sen : std_logic ; + sdio : std_logic ; + sdo : std_logic ; + end record ; + + type fx3_gpif_t is record + pclk : std_logic ; + gpif : std_logic_vector(31 downto 0) ; + ctl : std_logic_vector(12 downto 0) ; + end record ; + + type fx3_uart_t is record + rxd : std_logic ; + txd : std_logic ; + csx : std_logic ; + end record ; + + procedure nop( signal clock : in std_logic ; count : in natural ) is + begin + for i in 1 to count loop + wait until rising_edge(clock) ; + end loop ; + end procedure ; + + procedure uart_send( signal clock : in std_logic ; signal txd : out std_logic ; data : in std_logic_vector(7 downto 0) ; cpb : in natural ) is + begin + wait until rising_edge(clock) ; + -- Send start bit + txd <= '0' ; + nop( clock, cpb ) ; + + -- Send data + for i in 0 to data'high loop + txd <= data(i) ; + nop( clock, cpb ) ; + end loop ; + + -- Send stop bit + txd <= '1' ; + nop( clock, cpb ) ; + end procedure ; + + signal c4_clock : std_logic := '1' ; + signal lms_rx : lms_rx_t ; + signal lms_tx : lms_tx_t ; + signal lms_spi : lms_spi_t ; + signal lms_pll_out : std_logic ; + signal lms_reset : std_logic ; + signal fx3_gpif : fx3_gpif_t ; + signal fx3_uart : fx3_uart_t ; + signal refexp_1pps : std_logic ; + +begin + + -- Main 38.4MHz clock input + c4_clock <= not c4_clock after C4_CLOCK_HALF_PERIOD ; + + -- Top level of the FPGA + U_bladerf : entity nuand.bladerf + port map ( + -- Main system clock + c4_clock => c4_clock, + + -- VCTCXO DAC + dac_sclk => open, + dac_sdi => '0', + dac_sdo => open, + dac_csx => open, + + -- LMS RX Interface + lms_rx_clock => lms_rx.clock, + lms_rx_clock_out => lms_rx.clock_out, + lms_rx_data => lms_rx.data, + lms_rx_enable => lms_rx.enable, + lms_rx_iq_select => lms_rx.iq_select, + + -- LMS TX Interface + lms_tx_clock => lms_tx.clock, + lms_tx_data => lms_tx.data, + lms_tx_enable => lms_tx.enable, + lms_tx_iq_select => lms_tx.iq_select, + + -- LMS SPI Interface + lms_sclk => lms_spi.sclk, + lms_sen => lms_spi.sen, + lms_sdio => lms_spi.sdio, + lms_sdo => lms_spi.sdo, + + -- LMS Control Interface + lms_pll_out => lms_pll_out, + lms_reset => lms_reset, + + -- FX3 Interface + fx3_pclk => fx3_gpif.pclk, + fx3_gpif => fx3_gpif.gpif, + fx3_ctl => fx3_gpif.ctl, + fx3_uart_rxd => fx3_uart.rxd, + fx3_uart_txd => fx3_uart.txd, + fx3_uart_csx => fx3_uart.csx, + + -- 1pps reference + refexp_1pps => refexp_1pps, + + -- Expansion Interface + exp_clock => open, + exp_present => '0', + exp_spi_clock => open, + exp_spi_miso => '0', + exp_spi_mosi => open, + exp_gpio => open + ) ; + + -- LMS6002D Model + U_lms6002d : entity nuand.lms6002d_model + port map ( + -- LMS RX Interface + lms_rx_clock => lms_rx.clock, + lms_rx_clock_out => lms_rx.clock_out, + lms_rx_data => lms_rx.data, + lms_rx_enable => lms_rx.enable, + lms_rx_iq_select => lms_rx.iq_select, + + -- LMS TX Interface + lms_tx_clock => lms_tx.clock, + lms_tx_data => lms_tx.data, + lms_tx_enable => lms_tx.enable, + lms_tx_iq_select => lms_tx.iq_select, + + -- LMS SPI Interface + lms_sclk => lms_spi.sclk, + lms_sen => lms_spi.sen, + lms_sdio => lms_spi.sdio, + lms_sdo => lms_spi.sdo, + + -- LMS Control Interface + lms_pll_out => lms_pll_out, + lms_reset => lms_reset + ) ; + + -- FX3 Model + U_fx3 : entity nuand.fx3_model(digital_loopback) + port map ( + -- GPIF + fx3_pclk => fx3_gpif.pclk, + fx3_gpif => fx3_gpif.gpif, + fx3_ctl => fx3_gpif.ctl, + + -- UART + fx3_uart_rxd => fx3_uart.rxd, + fx3_uart_txd => fx3_uart.txd, + fx3_uart_csx => fx3_uart.csx + ) ; + + -- Create an accurate 1pps signal that is 1 ms wide + create_1pps : process + constant PULSE_PERIOD : time := 1 sec ; + constant PULSE_WIDTH : time := 1 ms ; + begin + if( now = 0 ps ) then + refexp_1pps <= '0' ; + else + refexp_1pps <= '1' ; + end if ; + wait for PULSE_WIDTH ; + refexp_1pps <= '0' ; + wait for PULSE_PERIOD - PULSE_WIDTH ; + end process ; + + -- Stimulus + tb : process + begin + wait for 10 ms ; + report "-- End of simulation --" severity failure ; + end process ; + +end architecture ; -- arch diff --git a/hdl/fpga/platforms/bladerf/vhdl/tb/spi_reader_tb.vhd b/hdl/fpga/platforms/bladerf/vhdl/tb/spi_reader_tb.vhd new file mode 100644 index 00000000..10a34291 --- /dev/null +++ b/hdl/fpga/platforms/bladerf/vhdl/tb/spi_reader_tb.vhd @@ -0,0 +1,32 @@ +library ieee ; + use ieee.std_logic_1164.all ; + use ieee.numeric_std.all ; + +entity spi_reader_tb is +end entity ; + +architecture arch of spi_reader_tb is + + signal clock : std_logic := '1' ; + signal sclk : std_logic ; + signal miso : std_logic := '0' ; + signal mosi : std_logic ; + signal enx : std_logic ; + signal reset_out : std_logic ; + +begin + + clock <= not clock after 1 ns ; + + U_spi_reader : entity work.spi_reader + port map ( + clock => clock, + + sclk => sclk, + miso => miso, + mosi => mosi, + enx => enx, + reset_out => reset_out + ) ; + +end architecture ; diff --git a/hdl/quartus/bladerf.qpf b/hdl/quartus/bladerf.qpf new file mode 100644 index 00000000..a8a5083d --- /dev/null +++ b/hdl/quartus/bladerf.qpf @@ -0,0 +1,30 @@ +# -------------------------------------------------------------------------- # +# +# Copyright (C) 1991-2012 Altera Corporation +# Your use of Altera Corporation's design tools, logic functions +# and other software and tools, and its AMPP partner logic +# functions, and any output files from any of the foregoing +# (including device programming or simulation files), and any +# associated documentation or information are expressly subject +# to the terms and conditions of the Altera Program License +# Subscription Agreement, Altera MegaCore Function License +# Agreement, or other applicable license agreement, including, +# without limitation, that your use is for the sole purpose of +# programming logic devices manufactured by Altera and sold by +# Altera or its authorized distributors. Please refer to the +# applicable agreement for further details. +# +# -------------------------------------------------------------------------- # +# +# Quartus II 64-Bit +# Version 12.1 Build 177 11/07/2012 SJ Web Edition +# Date created = 00:17:06 November 24, 2012 +# +# -------------------------------------------------------------------------- # + +QUARTUS_VERSION = "12.1" +DATE = "00:17:06 November 24, 2012" + +# Revisions + +PROJECT_REVISION = "bladerf" diff --git a/hdl/quartus/bladerf.qsf b/hdl/quartus/bladerf.qsf new file mode 100644 index 00000000..ab9d199b --- /dev/null +++ b/hdl/quartus/bladerf.qsf @@ -0,0 +1,501 @@ +# -------------------------------------------------------------------------- # +# +# Copyright (C) 1991-2012 Altera Corporation +# Your use of Altera Corporation's design tools, logic functions +# and other software and tools, and its AMPP partner logic +# functions, and any output files from any of the foregoing +# (including device programming or simulation files), and any +# associated documentation or information are expressly subject +# to the terms and conditions of the Altera Program License +# Subscription Agreement, Altera MegaCore Function License +# Agreement, or other applicable license agreement, including, +# without limitation, that your use is for the sole purpose of +# programming logic devices manufactured by Altera and sold by +# Altera or its authorized distributors. Please refer to the +# applicable agreement for further details. +# +# -------------------------------------------------------------------------- # +# +# Quartus II 64-Bit +# Version 12.1 Build 177 11/07/2012 SJ Web Edition +# Date created = 00:17:06 November 24, 2012 +# +# -------------------------------------------------------------------------- # +# +# Notes: +# +# 1) The default values for assignments are stored in the file: +# bladerf_assignment_defaults.qdf +# If this file doesn't exist, see file: +# assignment_defaults.qdf +# +# 2) Altera recommends that you do not modify this file. This +# file is updated automatically by the Quartus II software +# and any changes you make may be lost or overwritten. +# +# -------------------------------------------------------------------------- # + + +set_global_assignment -name FAMILY "Cyclone IV E" +set_global_assignment -name DEVICE EP4CE15F23C6 +set_global_assignment -name TOP_LEVEL_ENTITY bladerf +set_global_assignment -name ORIGINAL_QUARTUS_VERSION 12.1 +set_global_assignment -name PROJECT_CREATION_TIME_DATE "00:17:06 NOVEMBER 24, 2012" +set_global_assignment -name LAST_QUARTUS_VERSION "12.1 SP1" +set_global_assignment -name SEARCH_PATH nuand +set_global_assignment -name PROJECT_OUTPUT_DIRECTORY output_files +set_global_assignment -name DEVICE_FILTER_PACKAGE FBGA +set_global_assignment -name DEVICE_FILTER_PIN_COUNT 484 +set_global_assignment -name EDA_SIMULATION_TOOL "ModelSim-Altera (VHDL)" +set_global_assignment -name EDA_OUTPUT_DATA_FORMAT VHDL -section_id eda_simulation +set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top +set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top +set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to c4_clock +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to dac_csx +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to dac_sclk +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to dac_sdi +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to dac_sdo +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to refexp_1pps +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_clock +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_gpio[16] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_gpio[15] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_gpio[14] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_gpio[13] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_gpio[12] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_gpio[11] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_gpio[10] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_gpio[9] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_gpio[8] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_gpio[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_gpio[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_gpio[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_gpio[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_gpio[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_gpio[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_gpio[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_present +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_spi_clock +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_spi_miso +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to exp_spi_mosi +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_ctl[12] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_ctl[11] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_ctl[10] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_ctl[9] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_ctl[8] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_ctl[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_ctl[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_ctl[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_ctl[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_ctl[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_ctl[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_ctl[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_ctl[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[31] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[30] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[29] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[28] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[27] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[26] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[25] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[24] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[23] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[22] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[21] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[20] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[19] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[18] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[17] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[16] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[15] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[14] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[13] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[12] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[11] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[10] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[9] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[8] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_gpif[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_uart_csx +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_uart_rxd +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_uart_txd +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_pll_out +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_reset +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_clock +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_clock_out +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_data[11] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_data[10] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_data[9] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_data[8] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_data[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_data[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_data[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_data[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_data[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_data[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_data[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_data[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_enable +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_iq_select +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_sclk +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_sdio +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_sdo +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_sen +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_tx_clock +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_tx_data[11] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_tx_data[10] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_tx_data[9] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_tx_data[8] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_tx_data[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_tx_data[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_tx_data[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_tx_data[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_tx_data[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_tx_data[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_tx_data[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_tx_data[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_tx_enable +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_tx_iq_select +set_location_assignment PIN_A11 -to c4_clock +set_location_assignment PIN_B10 -to dac_csx +set_location_assignment PIN_B9 -to dac_sclk +set_location_assignment PIN_A10 -to dac_sdi +set_location_assignment PIN_A9 -to dac_sdo +set_location_assignment PIN_M1 -to fx3_ctl[12] +set_location_assignment PIN_J4 -to fx3_ctl[11] +set_location_assignment PIN_J6 -to fx3_ctl[10] +set_location_assignment PIN_K2 -to fx3_ctl[9] +set_location_assignment PIN_N1 -to fx3_ctl[8] +set_location_assignment PIN_G3 -to fx3_ctl[7] +set_location_assignment PIN_F7 -to fx3_ctl[6] +set_location_assignment PIN_B1 -to fx3_ctl[5] +set_location_assignment PIN_C1 -to fx3_ctl[4] +set_location_assignment PIN_H1 -to fx3_ctl[3] +set_location_assignment PIN_H6 -to fx3_ctl[2] +set_location_assignment PIN_F2 -to fx3_ctl[1] +set_location_assignment PIN_F1 -to fx3_ctl[0] +set_location_assignment PIN_AA1 -to fx3_gpif[31] +set_location_assignment PIN_Y1 -to fx3_gpif[30] +set_location_assignment PIN_AB3 -to fx3_gpif[29] +set_location_assignment PIN_P1 -to fx3_gpif[28] +set_location_assignment PIN_W7 -to fx3_gpif[27] +set_location_assignment PIN_R2 -to fx3_gpif[26] +set_location_assignment PIN_W6 -to fx3_gpif[25] +set_location_assignment PIN_W1 -to fx3_gpif[24] +set_location_assignment PIN_R1 -to fx3_gpif[23] +set_location_assignment PIN_V5 -to fx3_gpif[22] +set_location_assignment PIN_T4 -to fx3_gpif[21] +set_location_assignment PIN_M4 -to fx3_gpif[20] +set_location_assignment PIN_T5 -to fx3_gpif[19] +set_location_assignment PIN_P4 -to fx3_gpif[18] +set_location_assignment PIN_M6 -to fx3_gpif[17] +set_location_assignment PIN_N6 -to fx3_gpif[16] +set_location_assignment PIN_D1 -to fx3_gpif[15] +set_location_assignment PIN_C8 -to fx3_gpif[14] +set_location_assignment PIN_C7 -to fx3_gpif[13] +set_location_assignment PIN_C4 -to fx3_gpif[12] +set_location_assignment PIN_C6 -to fx3_gpif[11] +set_location_assignment PIN_B3 -to fx3_gpif[10] +set_location_assignment PIN_F10 -to fx3_gpif[9] +set_location_assignment PIN_B4 -to fx3_gpif[8] +set_location_assignment PIN_K1 -to fx3_gpif[7] +set_location_assignment PIN_A8 -to fx3_gpif[6] +set_location_assignment PIN_A3 -to fx3_gpif[5] +set_location_assignment PIN_F8 -to fx3_gpif[4] +set_location_assignment PIN_A5 -to fx3_gpif[3] +set_location_assignment PIN_B8 -to fx3_gpif[2] +set_location_assignment PIN_B7 -to fx3_gpif[1] +set_location_assignment PIN_B6 -to fx3_gpif[0] +set_location_assignment PIN_AA4 -to fx3_uart_csx +set_location_assignment PIN_AA5 -to fx3_uart_rxd +set_location_assignment PIN_AA3 -to fx3_uart_txd +set_location_assignment PIN_T21 -to lms_pll_out +set_location_assignment PIN_K21 -to lms_rx_clock +set_location_assignment PIN_T22 -to lms_rx_clock_out +set_location_assignment PIN_B22 -to lms_rx_data[11] +set_location_assignment PIN_B21 -to lms_rx_data[10] +set_location_assignment PIN_C22 -to lms_rx_data[9] +set_location_assignment PIN_C21 -to lms_rx_data[8] +set_location_assignment PIN_D22 -to lms_rx_data[7] +set_location_assignment PIN_E21 -to lms_rx_data[6] +set_location_assignment PIN_D21 -to lms_rx_data[5] +set_location_assignment PIN_F21 -to lms_rx_data[4] +set_location_assignment PIN_E22 -to lms_rx_data[3] +set_location_assignment PIN_H21 -to lms_rx_data[2] +set_location_assignment PIN_F22 -to lms_rx_data[1] +set_location_assignment PIN_J21 -to lms_rx_data[0] +set_location_assignment PIN_H22 -to lms_rx_iq_select +set_location_assignment PIN_L21 -to lms_tx_clock +set_location_assignment PIN_U21 -to lms_tx_data[11] +set_location_assignment PIN_P22 -to lms_tx_data[10] +set_location_assignment PIN_U22 -to lms_tx_data[9] +set_location_assignment PIN_R21 -to lms_tx_data[8] +set_location_assignment PIN_N22 -to lms_tx_data[7] +set_location_assignment PIN_R22 -to lms_tx_data[6] +set_location_assignment PIN_M22 -to lms_tx_data[5] +set_location_assignment PIN_P21 -to lms_tx_data[4] +set_location_assignment PIN_L22 -to lms_tx_data[3] +set_location_assignment PIN_N21 -to lms_tx_data[2] +set_location_assignment PIN_K22 -to lms_tx_data[1] +set_location_assignment PIN_M21 -to lms_tx_data[0] +set_global_assignment -name CYCLONEIII_CONFIGURATION_SCHEME "ACTIVE PARALLEL" +set_global_assignment -name USE_CONFIGURATION_DEVICE OFF +set_global_assignment -name GENERATE_TTF_FILE ON +set_global_assignment -name GENERATE_RBF_FILE ON +set_global_assignment -name CRC_ERROR_OPEN_DRAIN OFF +set_global_assignment -name ON_CHIP_BITSTREAM_DECOMPRESSION OFF +set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -rise +set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -fall +set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -rise +set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -fall +set_global_assignment -name RESERVE_DATA0_AFTER_CONFIGURATION "USE AS REGULAR IO" +set_global_assignment -name RESERVE_DATA1_AFTER_CONFIGURATION "USE AS REGULAR IO" +set_global_assignment -name RESERVE_DATA7_THROUGH_DATA2_AFTER_CONFIGURATION "USE AS REGULAR IO" +set_global_assignment -name RESERVE_FLASH_NCE_AFTER_CONFIGURATION "USE AS REGULAR IO" +set_global_assignment -name RESERVE_OTHER_AP_PINS_AFTER_CONFIGURATION "USE AS REGULAR IO" +set_global_assignment -name CYCLONEII_RESERVE_NCEO_AFTER_CONFIGURATION "USE AS REGULAR IO" +set_global_assignment -name RESERVE_DCLK_AFTER_CONFIGURATION "USE AS REGULAR IO" +set_location_assignment PIN_AA13 -to lms_reset +set_location_assignment PIN_AA14 -to lms_rx_enable +set_location_assignment PIN_AA20 -to lms_tx_v[2] +set_location_assignment PIN_AB13 -to lms_sdio +set_location_assignment PIN_AB14 -to lms_sdo +set_location_assignment PIN_AB15 -to lms_tx_enable +set_location_assignment PIN_AB16 -to lms_sen +set_location_assignment PIN_AB19 -to lms_rx_v[2] +set_location_assignment PIN_AB20 -to lms_rx_v[1] +set_location_assignment PIN_J22 -to lms_tx_iq_select +set_location_assignment PIN_A13 -to exp_spi_mosi +set_location_assignment PIN_A14 -to exp_gpio[1] +set_location_assignment PIN_A15 -to exp_gpio[2] +set_location_assignment PIN_A16 -to exp_gpio[3] +set_location_assignment PIN_A17 -to exp_gpio[4] +set_location_assignment PIN_A18 -to exp_gpio[5] +set_location_assignment PIN_A19 -to exp_gpio[6] +set_location_assignment PIN_A20 -to exp_gpio[7] +set_location_assignment PIN_C19 -to exp_gpio[8] +set_location_assignment PIN_B13 -to exp_gpio[9] +set_location_assignment PIN_B14 -to exp_gpio[10] +set_location_assignment PIN_B15 -to exp_gpio[11] +set_location_assignment PIN_B16 -to exp_gpio[12] +set_location_assignment PIN_B17 -to exp_gpio[13] +set_location_assignment PIN_B18 -to exp_gpio[14] +set_location_assignment PIN_B19 -to exp_gpio[15] +set_location_assignment PIN_B20 -to exp_gpio[16] +set_location_assignment PIN_C13 -to exp_present +set_location_assignment PIN_G1 -to fx3_pclk +set_location_assignment PIN_AA15 -to lms_sclk +set_location_assignment PIN_D13 -to exp_spi_miso +set_location_assignment PIN_E12 -to exp_spi_clock +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to fx3_pclk +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to led[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to led[2] +set_location_assignment PIN_AA7 -to led[1] +set_location_assignment PIN_AB7 -to led[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_v[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_rx_v[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_tx_v[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to lms_tx_v[1] +set_location_assignment PIN_AA21 -to lms_tx_v[1] +set_global_assignment -name MIN_CORE_JUNCTION_TEMP 0 +set_global_assignment -name MAX_CORE_JUNCTION_TEMP 85 +set_global_assignment -name ENABLE_SIGNALTAP ON +set_global_assignment -name USE_SIGNALTAP_FILE signaltap/spi_debugging.stp +set_global_assignment -name SLD_NODE_CREATOR_ID 110 -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_ENTITY_NAME sld_signaltap -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_NODE_INFO=805334528" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_POWER_UP_TRIGGER=0" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_ATTRIBUTE_MEM_MODE=OFF" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_STATE_FLOW_USE_GENERATED=0" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_STATE_BITS=11" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_BUFFER_FULL_STOP=1" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_CURRENT_RESOURCE_WIDTH=1" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_TRIGGER_LEVEL=1" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_TRIGGER_IN_ENABLED=0" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_ADVANCED_TRIGGER_ENTITY=basic,1," -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_TRIGGER_LEVEL_PIPELINE=1" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_ENABLE_ADVANCED_TRIGGER=0" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_STORAGE_QUALIFIER_GAP_RECORD=1" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_STORAGE_QUALIFIER_MODE=COMBINATIONAL" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_STORAGE_QUALIFIER_ADVANCED_CONDITION_ENTITY=basic,1," -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_STORAGE_QUALIFIER_PIPELINE=1" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_STORAGE_QUALIFIER_ENABLE_ADVANCED_CONDITION=0" -section_id auto_signaltap_0 +set_global_assignment -name STRATIX_DEVICE_IO_STANDARD "2.5 V" +set_global_assignment -name POWER_PRESET_COOLING_SOLUTION "23 MM HEAT SINK WITH 200 LFPM AIRFLOW" +set_global_assignment -name POWER_BOARD_THERMAL_MODEL "NONE (CONSERVATIVE)" +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_SEGMENT_SIZE=2048" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_SAMPLE_DEPTH=2048" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_clk -to lms_rx_clock_out -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[0] -to dac_csx -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[1] -to dac_sclk -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[2] -to dac_sdi -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[3] -to dac_sdo -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[4] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[0]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[5] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[10]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[6] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[11]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[7] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[12]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[8] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[13]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[9] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[14]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[10] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[15]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[11] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[1]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[12] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[2]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[13] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[3]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[14] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[4]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[15] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[5]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[16] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[6]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[17] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[7]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[18] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[8]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[19] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[9]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[20] -to "nios_system:U_nios_system|uart_txd" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[21] -to qualifier[5] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[22] -to rx_i[0] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[23] -to rx_i[10] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[24] -to rx_i[11] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[25] -to rx_i[1] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[26] -to rx_i[2] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[27] -to rx_i[3] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[28] -to rx_i[4] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[29] -to rx_i[5] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[30] -to rx_i[6] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[31] -to rx_i[7] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[32] -to rx_i[8] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[33] -to rx_i[9] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[34] -to rx_q[0] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[35] -to rx_q[10] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[36] -to rx_q[11] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[37] -to rx_q[1] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[38] -to rx_q[2] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[39] -to rx_q[3] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[40] -to rx_q[4] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[41] -to rx_q[5] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[42] -to rx_q[6] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[43] -to rx_q[7] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[44] -to rx_q[8] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[45] -to rx_q[9] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[0] -to dac_csx -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[1] -to dac_sclk -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[2] -to dac_sdi -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[3] -to dac_sdo -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[4] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[0]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[5] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[10]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[6] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[11]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[7] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[12]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[8] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[13]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[9] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[14]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[10] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[15]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[11] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[1]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[12] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[2]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[13] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[3]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[14] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[4]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[15] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[5]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[16] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[6]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[17] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[7]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[18] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[8]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[19] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[9]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[20] -to "nios_system:U_nios_system|uart_txd" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[21] -to qualifier[5] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[22] -to rx_i[0] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[23] -to rx_i[10] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[24] -to rx_i[11] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[25] -to rx_i[1] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[26] -to rx_i[2] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[27] -to rx_i[3] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[28] -to rx_i[4] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[29] -to rx_i[5] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[30] -to rx_i[6] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[31] -to rx_i[7] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[32] -to rx_i[8] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[33] -to rx_i[9] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[34] -to rx_q[0] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[35] -to rx_q[10] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[36] -to rx_q[11] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[37] -to rx_q[1] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[38] -to rx_q[2] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[39] -to rx_q[3] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[40] -to rx_q[4] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[41] -to rx_q[5] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[42] -to rx_q[6] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[43] -to rx_q[7] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[44] -to rx_q[8] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[45] -to rx_q[9] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[0] -to dac_csx -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[1] -to dac_sclk -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[2] -to dac_sdi -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[3] -to dac_sdo -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[4] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[0]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[5] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[10]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[6] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[11]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[7] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[12]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[8] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[13]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[9] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[14]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[10] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[15]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[11] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[1]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[12] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[2]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[13] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[3]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[14] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[4]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[15] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[5]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[16] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[6]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[17] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[7]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[18] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[8]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[19] -to "fsk_demodulator:U_fsk_demodulator|unwrapped_z[9]" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[20] -to "nios_system:U_nios_system|uart_txd" -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[21] -to qualifier[5] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[22] -to rx_i[0] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[23] -to rx_i[10] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[24] -to rx_i[11] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[25] -to rx_i[1] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[26] -to rx_i[2] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[27] -to rx_i[3] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[28] -to rx_i[4] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[29] -to rx_i[5] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[30] -to rx_i[6] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[31] -to rx_i[7] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[32] -to rx_i[8] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[33] -to rx_i[9] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[34] -to rx_q[0] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[35] -to rx_q[10] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[36] -to rx_q[11] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[37] -to rx_q[1] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[38] -to rx_q[2] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[39] -to rx_q[3] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[40] -to rx_q[4] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[41] -to rx_q[5] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[42] -to rx_q[6] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[43] -to rx_q[7] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[44] -to rx_q[8] -section_id auto_signaltap_0 +set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_storage_qualifier_in[45] -to rx_q[9] -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_DATA_BITS=46" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_TRIGGER_BITS=46" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_STORAGE_QUALIFIER_BITS=46" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_INVERSION_MASK=00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_INVERSION_MASK_LENGTH=302" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_STORAGE_QUALIFIER_INVERSION_MASK_LENGTH=139" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_NODE_CRC_LOWORD=20626" -section_id auto_signaltap_0 +set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_NODE_CRC_HIWORD=47504" -section_id auto_signaltap_0 +set_global_assignment -name VHDL_FILE ../fpga/ip/nuand/synthesis/nco.vhd -hdl_version VHDL_2008 +set_global_assignment -name VHDL_FILE ../fpga/ip/nuand/synthesis/fsk_modulator.vhd -hdl_version VHDL_2008 +set_global_assignment -name VHDL_FILE ../fpga/ip/nuand/synthesis/fsk_demodulator.vhd -hdl_version VHDL_2008 +set_global_assignment -name VHDL_FILE ../fpga/ip/nuand/synthesis/cordic.vhd -hdl_version VHDL_2008 +set_global_assignment -name VHDL_FILE ../fpga/platforms/bladerf/vhdl/ramp.vhd -hdl_version VHDL_2008 +set_global_assignment -name SIGNALTAP_FILE signaltap/spi_debugging.stp +set_global_assignment -name VHDL_FILE ../fpga/platforms/bladerf/vhdl/spi_reader.vhd -hdl_version VHDL_2008 +set_global_assignment -name SDC_FILE ../fpga/platforms/bladerf/constraints/bladerf.sdc +set_global_assignment -name VHDL_FILE ../fpga/platforms/bladerf/vhdl/fx3.vhd -hdl_version VHDL_2008 -library nuand +set_global_assignment -name VHDL_FILE ../fpga/platforms/bladerf/vhdl/bladerf_debug_p.vhd -hdl_version VHDL_2008 -library nuand +set_global_assignment -name VHDL_FILE ../fpga/platforms/bladerf/vhdl/bladerf.vhd -hdl_version VHDL_2008 -library nuand +set_global_assignment -name VHDL_FILE ../fpga/ip/nuand/synthesis/uart.vhd -hdl_version VHDL_2008 -library nuand +set_global_assignment -name VHDL_FILE ../fpga/ip/nuand/synthesis/sync_fifo.vhd -hdl_version VHDL_2008 -library nuand +set_global_assignment -name VHDL_FILE ../fpga/ip/nuand/synthesis/constellation_mapper.vhd -hdl_version VHDL_2008 -library nuand +set_global_assignment -name QIP_FILE ../fpga/ip/altera/nios_system/software/lms_spi_controller/mem_init/meminit.qip +set_global_assignment -name QIP_FILE ../fpga/ip/altera/nios_system/nios_system/synthesis/nios_system.qip +set_global_assignment -name QIP_FILE ../fpga/ip/altera/pll/pll.qip +set_global_assignment -name QIP_FILE ../fpga/ip/altera/serial_pll/serial_pll.qip +set_global_assignment -name QIP_FILE ../fpga/ip/altera/gigemac/gigemac.qip +set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top diff --git a/hdl/quartus/constraints/bladerf.sdc b/hdl/quartus/constraints/bladerf.sdc new file mode 100644 index 00000000..1469f3e1 --- /dev/null +++ b/hdl/quartus/constraints/bladerf.sdc @@ -0,0 +1,11 @@ +# Clock inputs +create_clock -period "100.0 MHz" [get_ports fx3_pclk] +create_clock -period "38.4 MHz" [get_ports c4_clock] + +# Generate the appropriate PLL clocks +derive_pll_clocks +dervice_clock_uncertainty + +# TODO: Constrain the FX3 interface + +# TODO: Constrain the LMS interface diff --git a/hdl/quartus/constraints/pins.tcl b/hdl/quartus/constraints/pins.tcl new file mode 100644 index 00000000..b3425dec --- /dev/null +++ b/hdl/quartus/constraints/pins.tcl @@ -0,0 +1,326 @@ +# Copyright (C) 1991-2011 Altera Corporation +# Your use of Altera Corporation's design tools, logic functions +# and other software and tools, and its AMPP partner logic +# functions, and any output files from any of the foregoing +# (including device programming or simulation files), and any +# associated documentation or information are expressly subject +# to the terms and conditions of the Altera Program License +# Subscription Agreement, Altera MegaCore Function License +# Agreement, or other applicable license agreement, including, +# without limitation, that your use is for the sole purpose of +# programming logic devices manufactured by Altera and sold by +# Altera or its authorized distributors. Please refer to the +# applicable agreement for further details. + +# Quartus II 32-bit Version 11.1 Build 173 11/01/2011 SJ Web Edition +# File: Z:\projects\nuand\quartus\constraints\pins.tcl +# Generated on: Tue Oct 09 23:04:36 2012 + +package require ::quartus::project + +set_instance_assignment -name IO_STANDARD "1.8 V" -to c4_clock +set_instance_assignment -name IO_STANDARD "1.8 V" -to dac_csx +set_instance_assignment -name IO_STANDARD "1.8 V" -to dac_sclk +set_instance_assignment -name IO_STANDARD "1.8 V" -to dac_sdi +set_instance_assignment -name IO_STANDARD "1.8 V" -to dac_sdo +set_instance_assignment -name IO_STANDARD "1.8 V" -to refexp_1pps +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_clock +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_gpio[16] +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_gpio[15] +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_gpio[14] +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_gpio[13] +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_gpio[12] +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_gpio[11] +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_gpio[10] +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_gpio[9] +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_gpio[8] +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_gpio[7] +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_gpio[6] +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_gpio[5] +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_gpio[4] +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_gpio[3] +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_gpio[2] +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_gpio[1] +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_present +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_spi_clock +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_spi_miso +set_instance_assignment -name IO_STANDARD "1.8 V" -to exp_spi_mosi +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_ctl[12] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_ctl[11] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_ctl[10] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_ctl[9] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_ctl[8] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_ctl[7] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_ctl[6] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_ctl[5] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_ctl[4] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_ctl[3] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_ctl[2] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_ctl[1] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_ctl[0] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[31] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[30] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[29] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[28] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[27] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[26] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[25] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[24] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[23] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[22] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[21] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[20] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[19] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[18] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[17] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[16] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[15] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[14] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[13] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[12] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[11] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[10] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[9] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[8] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[7] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[6] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[5] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[4] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[3] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[2] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[1] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_gpif[0] +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_uart_csx +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_uart_rxd +set_instance_assignment -name IO_STANDARD "1.8 V" -to fx3_uart_txd +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_pll_out +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_reset +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_rx_clock +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_rx_clock_out +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_rx_data[11] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_rx_data[10] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_rx_data[9] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_rx_data[8] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_rx_data[7] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_rx_data[6] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_rx_data[5] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_rx_data[4] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_rx_data[3] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_rx_data[2] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_rx_data[1] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_rx_data[0] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_rx_enable +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_rx_iq_select +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_sclk +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_sdio +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_sdo +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_sen +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_tx_clock +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_tx_data[11] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_tx_data[10] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_tx_data[9] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_tx_data[8] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_tx_data[7] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_tx_data[6] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_tx_data[5] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_tx_data[4] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_tx_data[3] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_tx_data[2] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_tx_data[1] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_tx_data[0] +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_tx_enable +set_instance_assignment -name IO_STANDARD "1.8 V" -to lms_tx_iq_select +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to c4_clock +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dac_csx +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dac_sclk +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dac_sdi +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dac_sdo +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_clock +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_gpio[16] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_gpio[15] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_gpio[14] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_gpio[13] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_gpio[12] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_gpio[11] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_gpio[10] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_gpio[9] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_gpio[8] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_gpio[7] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_gpio[6] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_gpio[5] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_gpio[4] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_gpio[3] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_gpio[2] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_gpio[1] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_present +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_spi_clock +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_spi_miso +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to exp_spi_mosi +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_ctl[12] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_ctl[11] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_ctl[10] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_ctl[9] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_ctl[8] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_ctl[7] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_ctl[6] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_ctl[5] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_ctl[4] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_ctl[3] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_ctl[2] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_ctl[1] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_ctl[0] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[31] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[30] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[29] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[28] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[27] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[26] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[25] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[24] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[23] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[22] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[21] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[20] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[19] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[18] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[17] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[16] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[15] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[14] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[13] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[12] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[11] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[10] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[9] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[8] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[7] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[6] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[5] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[4] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[3] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[2] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[1] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_gpif[0] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_uart_csx +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_uart_rxd +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to fx3_uart_txd +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_pll_out +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_reset +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_rx_clock +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_rx_clock_out +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_rx_data[11] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_rx_data[10] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_rx_data[9] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_rx_data[8] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_rx_data[7] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_rx_data[6] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_rx_data[5] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_rx_data[4] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_rx_data[3] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_rx_data[2] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_rx_data[1] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_rx_data[0] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_rx_enable +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_rx_iq_select +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_sclk +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_sdio +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_sdo +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_sen +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_tx_clock +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_tx_data[11] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_tx_data[10] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_tx_data[9] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_tx_data[8] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_tx_data[7] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_tx_data[6] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_tx_data[5] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_tx_data[4] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_tx_data[3] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_tx_data[2] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_tx_data[1] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_tx_data[0] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_tx_enable +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to lms_tx_iq_select +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to refexp_1pps +set_location_assignment PIN_A11 -to c4_clock +set_location_assignment PIN_B10 -to dac_csx +set_location_assignment PIN_B9 -to dac_sclk +set_location_assignment PIN_A10 -to dac_sdi +set_location_assignment PIN_A9 -to dac_sdo +set_location_assignment PIN_M1 -to fx3_ctl[12] +set_location_assignment PIN_J4 -to fx3_ctl[11] +set_location_assignment PIN_J6 -to fx3_ctl[10] +set_location_assignment PIN_K2 -to fx3_ctl[9] +set_location_assignment PIN_N1 -to fx3_ctl[8] +set_location_assignment PIN_G3 -to fx3_ctl[7] +set_location_assignment PIN_F7 -to fx3_ctl[6] +set_location_assignment PIN_B1 -to fx3_ctl[5] +set_location_assignment PIN_C1 -to fx3_ctl[4] +set_location_assignment PIN_H1 -to fx3_ctl[3] +set_location_assignment PIN_H6 -to fx3_ctl[2] +set_location_assignment PIN_F2 -to fx3_ctl[1] +set_location_assignment PIN_F1 -to fx3_ctl[0] +set_location_assignment PIN_Y1 -to fx3_gpif[31] +set_location_assignment PIN_AA1 -to fx3_gpif[30] +set_location_assignment PIN_AB3 -to fx3_gpif[29] +set_location_assignment PIN_P1 -to fx3_gpif[28] +set_location_assignment PIN_W7 -to fx3_gpif[27] +set_location_assignment PIN_R2 -to fx3_gpif[26] +set_location_assignment PIN_W6 -to fx3_gpif[25] +set_location_assignment PIN_W1 -to fx3_gpif[24] +set_location_assignment PIN_R1 -to fx3_gpif[23] +set_location_assignment PIN_V5 -to fx3_gpif[22] +set_location_assignment PIN_T4 -to fx3_gpif[21] +set_location_assignment PIN_M4 -to fx3_gpif[20] +set_location_assignment PIN_T5 -to fx3_gpif[19] +set_location_assignment PIN_P4 -to fx3_gpif[18] +set_location_assignment PIN_M6 -to fx3_gpif[17] +set_location_assignment PIN_N6 -to fx3_gpif[16] +set_location_assignment PIN_D1 -to fx3_gpif[15] +set_location_assignment PIN_C8 -to fx3_gpif[14] +set_location_assignment PIN_C7 -to fx3_gpif[13] +set_location_assignment PIN_C4 -to fx3_gpif[12] +set_location_assignment PIN_C6 -to fx3_gpif[11] +set_location_assignment PIN_B3 -to fx3_gpif[10] +set_location_assignment PIN_F10 -to fx3_gpif[9] +set_location_assignment PIN_B4 -to fx3_gpif[8] +set_location_assignment PIN_K1 -to fx3_gpif[7] +set_location_assignment PIN_A8 -to fx3_gpif[6] +set_location_assignment PIN_A3 -to fx3_gpif[5] +set_location_assignment PIN_F8 -to fx3_gpif[4] +set_location_assignment PIN_A5 -to fx3_gpif[3] +set_location_assignment PIN_B8 -to fx3_gpif[2] +set_location_assignment PIN_B7 -to fx3_gpif[1] +set_location_assignment PIN_B6 -to fx3_gpif[0] +set_location_assignment PIN_AA3 -to fx3_uart_csx +set_location_assignment PIN_AA4 -to fx3_uart_rxd +set_location_assignment PIN_AA5 -to fx3_uart_txd +set_location_assignment PIN_T21 -to lms_pll_out +set_location_assignment PIN_K21 -to lms_rx_clock +set_location_assignment PIN_T16 -to lms_rx_clock_out +set_location_assignment PIN_B22 -to lms_rx_data[11] +set_location_assignment PIN_B21 -to lms_rx_data[10] +set_location_assignment PIN_C22 -to lms_rx_data[9] +set_location_assignment PIN_C21 -to lms_rx_data[8] +set_location_assignment PIN_D22 -to lms_rx_data[7] +set_location_assignment PIN_E21 -to lms_rx_data[6] +set_location_assignment PIN_D21 -to lms_rx_data[5] +set_location_assignment PIN_F21 -to lms_rx_data[4] +set_location_assignment PIN_E22 -to lms_rx_data[3] +set_location_assignment PIN_H21 -to lms_rx_data[2] +set_location_assignment PIN_F22 -to lms_rx_data[1] +set_location_assignment PIN_J21 -to lms_rx_data[0] +set_location_assignment PIN_H22 -to lms_rx_iq_select +set_location_assignment PIN_L21 -to lms_tx_clock +set_location_assignment PIN_U21 -to lms_tx_data[11] +set_location_assignment PIN_P22 -to lms_tx_data[10] +set_location_assignment PIN_U22 -to lms_tx_data[9] +set_location_assignment PIN_R21 -to lms_tx_data[8] +set_location_assignment PIN_N22 -to lms_tx_data[7] +set_location_assignment PIN_R22 -to lms_tx_data[6] +set_location_assignment PIN_M22 -to lms_tx_data[5] +set_location_assignment PIN_P21 -to lms_tx_data[4] +set_location_assignment PIN_L22 -to lms_tx_data[3] +set_location_assignment PIN_N21 -to lms_tx_data[2] +set_location_assignment PIN_K22 -to lms_tx_data[1] +set_location_assignment PIN_M21 -to lms_tx_data[0] diff --git a/hdl/quartus/signaltap/spi_debugging.stp b/hdl/quartus/signaltap/spi_debugging.stp new file mode 100644 index 00000000..f8502bb4 --- /dev/null +++ b/hdl/quartus/signaltap/spi_debugging.stp @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 'dac_csx' == low && 'fsk_demodulator:U_fsk_demodulator|unwrapped_z[10]' == low + + + + + + + 0000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000 + + + + + + + + + + + + + + + + + + + 11110000000100101000111001111000001001001000001111000000010010100011100111100000100100100000111100000000000000001100000001000010010010000011110000000000000000110000000100001000001000001111011111111101011111100111100000100000100000111101111111110101111110011110000010011010000011110000000000000000110000111000001001101000001111000000000000000011000011100000100000100000111100000001001010001100000001000010000010000011110000000100101000110000000100001001001000001111000000010001010011100111100000100100100000111100000001000101001110011110000010010010000011110111111011110101111000111000001001001000001111011111101111010111100011100000100111000000111100000001000101001100010001000010011100000011110000000100010100110001000100000000101000001111000000000000000011000111100000000010100000111100000000000000001100011110000010000010000011110111111111010111110000000100001000001000001111011111111101011111000000010000000010100000111100000000101111001100010001000000001010000011110000000010111100110001000100000001001000001111011111111110101111000011100000000100100000111101111111111010111100001110000010010010000011110000000000000000111001111000001001001000001111000000000000000011100111100000000010100000111100000000000000001100000001000000001010000011110000000000000000110000000100001000001000001111011111111101011111000100010000100000100000111101111111110101111100010001000010000010000011110000000011010000111001111000001000001000001111000000001101000011100111100000100001100000111100000001100100001100000001000010000110000011110000000110010000110000000100001001110000001111000000010000000011000100010000100111000000111100000001000000001100010001000000001010000011110111111110000111110000000100000000101000001111011111111000011111000000010000100100100000111100000001011110001100000001000010010010000011110000000101111000110000000100001000001000001111000000000000000011100111100000100000100000111100000000000000001110011110000000001010000011110111111011010111110001000100000000101000001111011111101101011111000100010000100000100000111101111111001101111100000001000010000010000011110111111100110111110000000100001000001000001111000000001000101010000000010000100000100000111100000000100010101000000001000010000010000011110111111101110101100001000100001000001000001111011111110111010110000100010000100100100000111100000000111110001010001110000010010010000011110000000011111000101000111000001001001000001111000000011001000010000000010000100100100000111100000001100100001000000001000010011100000011110111111111010111100001000100001001110000001111011111111101011110000100010000100000100000111100000000101010001010011110000010000010000011110000000010101000101001111000001001001000001111011111111110101110000100010000100100100000111101111111111010111000010001000010011100000011110000000111001000101001111000001001110000001111000000011100100010100111100000100111000000111100000000000000001010011110000010011100000011110000000000000000101001111000000000101000001111000000000000000010100100010000000010100000111100000000000000001010010001000010010010000011110000000010101000101000111000001001001000001111000000001010100010100011100000100100100000111101111110111010111000000001000010010010000011110111111011101011100000000100001001001000001111000000010000000010100011100000100100100000111100000001000000001010001110000010010010000011110000000000010100100001000100001001001000001111000000000001010010000100010000100100100000111101111111111010111000000001000010010010000011110111111111101011100000000100001000001000001111000000010000000010000000010000100000100000111100000001000000001000000001000000001010000011110000000100010100100001000100000000101000001111000000010001010010000100010000100000100000111101111110001101111000010001000010000010000011110111111000110111100001000100001001110000001111000000000010100010000100010000100111000000111100000000001010001000010001000000001010000011110111111111111111101001111000000000101000001111011111111111111110100111100000100100100000111100000001000000001000000001000010010010000011110000000100000000100000000100000001001000001111011111101101011110100111100000000100100000111101111110110101111010011110000000001010000011110000000000000000100000000100000000101000001111000000000000000010000000010000100111000000111100000000101010001000000001000010011100000011110000000010101000100000000100001001001000001111011111111110101110000000010000100100100000111101111111111010111000000001000010011100000011110111111111111111101001111000001001110000001111011111111111111110100111100000000010100000111100000000111110001000000001000000001010000011110000000011111000100000000100001001001000001111000000011001000010000000010000100100100000111100000001100100001000000001000010000010000011110000000000000000101000111000001000001000001111000000000000000010100011100000100100100000111100000001000000001000010001000010010010000011110000000100000000100001000100001000001000001111011111101110101110100011100000100000100000111101111110111010111010001110000010011010000011110000000100010100100001000100001001101000001111000000010001010010000100010000100111000000111101111111111010111110011110000010011100000011110111111111101011111001111000001001110000001111000000001001010011100111100000100111000000111100000000100101001110011110000000001010000011110111111111111111110001000100000000101000001111011111111111111111000100010000100111000000111101111111110101111110001110000010011100000011110111111111010111111000111000000000101000001111000000001010100011100011100000000010100000111100000000101010001110001110000010010010000011110111111111101011110000000100001001001000001111011111111110101111000000010000100000100000111100000000100010101100010001000010000010000011110000000010001010110001000100000000101000001111011111110111010111100111100000000010100000111101111111011101011110011110000010000010000011110000000100000000111001111000001000001000001111000000010000000011100111100000100000100000111100000001000101001110011110000010000010000011110000000100010100111001111000000000101000001111011111101110101111000100010000000010100000111101111110111010111100010001000010000010000011110000000010010100110001000100001000001000001111000000001001010011000100010000000100100000111100000000000000001110011110000000010010000011110000000000000000111001111000001000001000001111011111101101011111000100010000100000100000111101111110110101111100010001000010010010000011110000000011010000110000111000001001001000001111000000001101000011000011100000100111000000111100000001100100001100000001000010011100000011110000000110010000110000000100000000101000001111000000000000000011000100010000000010100000111100000000000000001100010001000000001100000011110000000100000000111001111000000000110000001111000000010000000011100111100000000010100000111101111111111010111110011110000000001010000011110111111111101011111001111000001001001000001111000000000101000011000000010000100100100000111100000000010100001100000001000000001010000011110000000001111000111001111000000000101000001111000000000111100011100111100000100100100000111101111111110101111100000001000010010010000011110111111111010111110000000100001000001000001111000000000000000011100111100000100000100000111100000000000000001110011110000000001010000011110000000010101000111001111000000000101000001111000000001010100011100111100000100000100000111101111110111101011100010001000010000010000011110111111011110101110001000100001001110000001111000000001000101011000101100000100111000000111100000000100010101100010110000010000010000011110111111111111111110001000100001000001000001111011111111111111111000100010000100000100000111100000001000000001110001110000010000010000011110000000100000000111000111000001000001000001111011111111111111111000100010000100000100000111101111111111111111100010001000010010010000011110111111111010111110001000100001001001000001111011111111101011111000100010000100000100000111100000000101010001110011110000010000010000011110000000010101000111001111000000000101000001111011111111111111111000000010000000010100000111101111111111111111100000001000010011100000011110111111111101011101000111000001001110000001111011111111110101110100011100000000010100000111100000000100101001010010001000000001010000011110000000010010100101001000100001000001000001111011111111110101110000000010000100000100000111101111111111010111000000001000010000010000011110000000000010100100001111000001000001000001111000000000001010010000111100000100000100000111101111111110101111000010001000010000010000011110111111111010111100001000100001000001000001111011111110011011110100111100000100000100000111101111111001101111010011110000010000010000011110000000100010100101001111000001000001000001111000000010001010010100111100000100100100000111101111110111010111000010001000010010010000011110111111011101011100001000100001000001000001111000000001001010010000000010000100000100000111100000000100101001000000001000010011100000011110111111111101011100000000100001001110000001111011111111110101110000000010000000100100000111100000001110010001000010001000000010010000011110000000111001000100001000100001001001000001111000000010010100010000000010000100100100000111100000001001010001000000001000010000010000011110111111000011011100000000100001000001000001111011111100001101110000000010000000010100000111100000000000101001000000001000000001010000011110000000000010100100000000100001000001000001111000000000000000010000000010000100000100000111100000000000000001000000001000000001010000011110111111000011011100000000100000000101000001111011111100001101110000000010000100000100000111101111111111111111000000001000010000010000011110111111111111111100000000100001000001000001111000000010001010010000100010000100000100000111100000001000101001000010001000000001010000011110111111111010111101001111000000000101000001111011111111101011110100111100000100111000000111100000000000000001000010001000010011100000011110000000000000000100001000100000000101000001111000000001010100010100111100000000010100000111100000000101010001010011110000010000010000011110111111011010111100000000100001000001000001111011111101101011110000000010000100000100000111100000000101010001010011110000010000010000011110000000010101000101001111000001001001000001111011111101101011110000000010000100100100000111101111110110101111000000001000010011100000011110000000000000000100000000100001001110000001111000000000000000010000000010000100000100000111100000000110100001000000001000010000010000011110000000011010000100000000100001001001000001111011111111000011110100011100000100100100000111101111111100001111010001110000010011100000011110000000101111000101001000100001001110000001111000000010111100010100100010000000010100000111100000001100100001000001110000000001010000011110000000110010000100000111000000000101000001111011111111101011110100100010000000010100000111101111111110101111010010001000010011100000011110000000100101000100000111000001001110000001111000000010010100010000011100000100000100000111101111111111010111000000001000010000010000011110111111111101011100000000100001001001000001111000000000010100011100100010000100100100000111100000000001010001110010001000010000010000011110000000100101000110001111000001000001000001111000000010010100011000111100000000010100000111101111111110101111100000001000000001010000011110111111111010111110000000100001000001000001111000000010101000011100111100000100000100000111100000001010100001110011110000010011100000011110000000001111000111001111000001001110000001111000000000111100011100111100000000010100000111101111110000011011100010001000000001010000011110111111000001101110001000100000001101000001111000000000011110011000000010000000110100000111100000000001111001100000001000010000010000011110000000000000000111001111000001000001000001111000000000000000011100111100000100000100000011101111110000110111110011110000010000010000001110111111000011011111001111000001000001000000111000000010001010011000000010000100000100000011100000001000101001100000001000010000010000001110111111011010111110001000100001000001000000111011111101101011111000100010000000010100000011101111111001101111110001110000000001010000001110111111100110111111000111000001001001000000111000000010001010011000100010000100100100000011100000001000101001100010001000010010010000001110000000110010000111001000100001001001000000111000000011001000011100100010000100100100000011101111111100001111100011110000010010010000001110111111110000111110001111000001001001000000111000000010010100011000000010000100100100000011100000001001010001100000001000010000010000001110000000000000000110000000100001000001000000111000000000000000011000000010000000100100000011101111111110101111110011110000000010010000001110111111111010111111001111000001001110000000111000000001101000011000100010000100111000000011100000000110100001100010001000010000010000001110000000001010000111001111000001000001000000111000000000101000011100111100000100100100000011101111110110101111100000001000010010010000001110111111011010111110000000100001000001000000111000000001000000011000000010000100000100000011100000000100000001100000001000010011100000001110000000000101000110000000100001001110000000111000000000010100011000000010000100100100000011101111110110101111100000001000010010010000001110111111011010111110000000100001000001000000111000000010010100011000000010000100000100000011100000001001010001100000001000010000010000001110111111000011011110001111000001000001000000111011111100001101111000111100000000010100000011100000000000000001100011110000000001010000001110000000000000000110001111000000000101000000111000000000001010011000000010000000010100000011100000000000101001100000001000010000010000001110111111111010111111001111000001000001000000111011111111101011111100111100000000100100000011101111110001101111100011110000000010010000001110111111000110111110001111000000000101000000111000000010001010011000000010000000010100000011100000001000101001100000001000010010010000001110111111111010111110001000100001001001000000111011111111101011111000100010000100100100000011100000000000000001000000001000010010010000001110000000000000000100000000100000000101000000111000000001010100010000000010000000010100000011100000000101010001000000001000010000010000001110000000000000000100000000100001000001000000111000000000000000010000000010000100100100000011101111110110101111000001110000010010010000001110111111011010111100000111000001000001000000111000000010010100010000100010000100000100000011100000001001010001000010001000010000010000001110000000100000000100001000100001000001000000111000000010000000010000100010000000100100000011101111111111111111010001110000000010010000001110111111111111111101000111000001000001000000111011111111101011110000100010000100000100000011101111111110101111000010001000000001010000001110000000010101000100000000100000000101000000111000000001010100010000000010000100000100000011101111110110101111000000001000010000010000001110111111011010111100000000100001000001000000111000000010010100010100111100000100000100000011100000001001010001010011110000000010010000001110000000000000000101001111000000001001000000111000000000000000010100111100000100000100000011101111110000110111000010001000010000010000001110111111000011011100001000100001001001000000111000000000101000010000101100000100100100000011100000000010100001000010110000010000010000001110000000001111000101001111000001000001000000111000000000111100010100111100000100100100000011101111111011011111000011110000010010010000001110111111101101111100001111000001001001000000111011111101010111110100111100000100100100000011101111110101011111010011110000010000010000001110000000000000000101001000100001000001000000111000000000000000010100100010000000010100000011100000001001010001010011110000000001010000001110000000100101000101001111000001000001000000111000000000000000010100111100000100000100000011100000000000000001010011110000010000010000001110111111111010111100001000100001000001000000111011111111101011110000100010000000010100000011100000000101010001000010001000000001010000001110000000010101000100001000100001001001000000111011111111111111110000100010000100100100000011101111111111111111000010001000000001010000001110000000100000000101001111000000000101000000111000000010000000010100111100000000010100000011101111111111111111000010001000000001010000001110111111111111111100001000100001001110000000111011111100110111110100111100000100111000000011101111110011011111010011110000010000010000001110000000001010000100000000100001000001000000111000000000101000010000000010000100000100000011100000000000000001000000001000010000010000001110000000000000000100000000100000000101000000111011111110110111110000000010000000010100000011101111111011011111000000001000010011100000001110111111010101111100000000100001001110000000111011111101010111110000000010000100000100000011100000000110100001000000001000010000010000001110000000011010000100000000100001000001000000111000000000101000010100111100000100000100000011100000000010100001010011110000000001010000001110111111011101011110000100100000000101000000111011111101110101111000010010000100100100000011100000001000101001110001110000010010010000001110000000100010100111000111000001000001000000111011111111101011111000100010000100000100000011101111111110101111100010001000010010010000001110000000010101000110001000100001001001000000111000000001010100011000100010000100110100000011101111110111010111100000001000010011010000001110111111011101011110000000100001001110000000111000000000010100011000011100000100111000000011100000000001010001100001110000010010010000001110000000000000000110001111000001001001000000111000000000000000011000111100000100100100000011100000000101010001100000001000010010010000001110000000010101000110000000100001001001000000111011111111000011111000100010000100100100000011101111111100001111100010001000000001010000001110000000001111000111001111000000000101000000111000000000111100011100111100000100000100000011101111111110101111100010001000010000010000001110111111111010111110001000100001000001000000111000000001111100011000000010000100000100000011100000000111110001100000001000000011010000001110111111010110011110000000100000001101000000111011111101011001111000000010000100100100000011100000000100101001100000001000010010010000001110000000010010100110000000100001001001000000111000000000000000011000111100000100100100000011100000000000000001100011110000000001010000001110111111111111111110000000100000000101000000111011111111111111111000000010000000010100000011101111111011011111100010001000000001010000001110111111101101111110001000100000000101000000111000000011001000011100100010000000010100000011100000001100100001110010001000010011100000001110111111000011011110001011000001001110000000111011111100001101111000101100000000010100000011100000000001111001100010001000000001010000001110000000000111100110001000100000000101000000111011111100011011111000000010000000010100000011101111110001101111100000001000010000010000001110000000000000000110000000100001000001000000111000000000000000011000000010000000010100000011100000001000000001100010001000000001010000001110000000100000000110001000100001000001000000111000000000000000011100011100000100000100000011100000000000000001110001110000010000010000001110111111001101111110001000100001000001000000111011111100110111111000100010000000110100000011101111111101100111100000001000000011010000001110111111110110011110000000100001001110000000111000000010010011011100111100000100111000000011100000001001001101110011110000000001010000001110111111001110011110000000100000000101000000111011111100111001111000000010000000111000000011101111110101011111110011110000000011100000001110111111010101111111001111000000000101000000111000000001010100011000000010000000010100000011100000000101010001100000001000010011100000001110111111111101011111001111000001001110000000111011111111110101111100111100000100000100000011100000000000101001100010001000010000010000001110000000000010100110001000100000000101000000111000000000101000010100011100000000010100000011100000000010100001010001110000000001100000001110111111110110011100001000100000000110000000111011111111011001110000100010000100100100000011100000000100101001000000001000010010010000001110000000010010100100000000100001001001000000111011111101110101110000000010000100100100000011101111110111010111000000001000010000010000001110000000010010100101001111000001000001000000111000000001001010010100111100000000100100000011101111110111010111010011110000000010010000001110111111011101011101001111000001001001000000111000000010001010010100011100000100100100000011100000001000101001010001110000010000010000001110111111101101111101001111000001000001000000111011111110110111110100111100000100000100000011101111111101100111010010001000010000010000001110111111110110011101001000100000000101000000111000000011110010010000011100000000010100000011100000001111001001000001110000010000010000001110000000100101000100000000100001000001000000111000000010010100010000000010000100100100000011101111111110101111000000001000010010010000001110111111111010111100000000100001000001000000111000000010010100010100111100000100000100000011100000001001010001010011110000000001010000001110000000000000000101001000100000000101000000111000000000000000010100100010000000111000000011100000000000000001000000001000000011100000001110000000000000000100000000100001001001000000111000000000000000010100111100000100100100000011100000000000000001010011110000000001010000001110111111001101111100000000100000000101000000111011111100110111110000000010000100000100000011100000000010100001000000001000010000010000001110000000001010000100000000100000000101000000111000000000000000010100011100000000010100000011100000000000000001010001110000010011100000001110111111111010111100000000100001001110000000111011111111101011110000000010000100000100000011100000000101010001000001110000010000010000001110000000010101000100000111000000001110000000111011111110001110110000100010000000111000000011101111111000111011000010001000010011010000001110000000011100010100000000100001001101000000111000000001110001010000000010000100000100000011100000001000000001010011110000010000010000001110000000100000000101001111000001001001000000111011111101101011110000000010000100100100000011101111110110101111000000001000010010010000001110000000010101000101000111000001001001000000111000000001010100010100011100000100000100000011101111110110101111000010001000010000010000001110111111011010111100001000100000000101000000111000000000000000010100111100000000010100000011100000000000000001010011110000010011100000001110111111100110111100000000100001001110000000111011111110011011110000000010000100000100000011100000001010011001000000001000010000010000001110000000101001100100000000100001001001000000111011111101000011110000000010000100100100000011101111110100001111000000001000010000010000001110000000100101000100001000100001000001000000111000000010010100010000100010000000010100000011100000000000000001100010001000000001010000001110000000000000000110001000100001000001000000111000000000000000011000000010000100000100000011100000000000000001100000001000000011010000001110111111101101111110000000100000001101000000111011111110110111111000000010000000010100000011101111111100001111110011110000000001010000001110111111110000111111001111000001001001000000111000000011100100011000100010000100100100000011100000001110010001100010001000000001010000001110000000100101000111001111000000000101000000111000000010010100011100111100000100111000000011101111111110101111100000001000010011100000001110111111111010111110000000100000000101000000111000000001101000011000000010000000010100000011100000000110100001100000001000000001010000001100111111110000111110001000100000000101000000110011111111000011111000100010000000010100000011000000000001111001100000001000000001010000001100000000000111100110000000100000000101000000110011111110011011111000100010000000010100000011001111111001101111100010001000010011100000001100111111111111111110000000100001001110000000110011111111111111111000000010000000110100000001001111111011011111100000001000000011010000000100111111101101111110000000100001001001000000010011111111000011111000100010000100100100000001001111111100001111100010001000000001010000001100000000100010100111000111000000000101000000110000000010001010011100011100000100000100000011000000000000000001100000001000010000010000001100000000000000000110000000100001001110000000010011111100110111111000000010000100111000000001001111110011011111100000001000010011100000000100000000001010000110000000100001001110000000010000000000101000011000000010000000010100000011001111110111010111110010001000000001010000001100111111011101011111001000100001001001000000110000000010011110011100111100000100100100000011000000001001111001110011110000010000010000000110111111000110111110000000100001000001000000011011111100011011111000000010000000010100000001101111111011011111100010001000000001010000000110111111101101111110001000100000000101000000111000000011001000011100111100000000010100000011100000001100100001110011110000000001010000001110111111111101011110000000100000000101000000111011111111110101111000000010000100100100000001000000000000000001100010001000010010010000000100000000000000000110001000100000001001000000010000000001001010011100100010000000100100000001000000000100101001110010001000010010010000001100111111000110111111001111000001001001000000110011111100011011111100111100000100100100000011000000001110010001100000001000010010010000001100000000111001000110000000100001000001000000011000000010000000011000000010000100000100000001100000001000000001100000001000000001010000000110111111001101111110000000100000000101000000011011111100110111111000000010000100100100000011100000000010100001110011110000010010010000001110000000001010000111001111000001000001000000111011111111111111111000100010000100000100000011101111111111111111100010001000010010010000000100111111001000111100001000100001001001000000010011111100100011110000100010000100000100000001000000001010100001000010001000010000010000000100000000101010000100001000100001000001000000110000000011100100010000000010000100000100000011000000001110010001000000001000010010010000001100111111111010111101001111000001001001000000110011111111101011110100111100000100000100000001000000000101010001000000001000010000010000000100000000010101000100000000100000001101000000010011111111111111110100011100000000110100000001001111111111111111010001110000010010010000001100000000000000000101001111000001001001000000110000000000000000010100111100000000010100000011001111111110101111010010001000000001010000001100111111111010111101001000100001001001000000010011111110011011110100011100000100100100000001001111111001101111010001110000000010010000000100000000000000000100001000100000001001000000010000000000000000010000100010000000010100000011000000000000101001000010001000000001010000001100000000000010100100001000100001001001000000110000000000000000010100111100000100100100000011000000000000000001010011110000010011100000001110000000000101000100000000100001001110000000111000000000010100010000000010000100100100000011101111111001101111000000001000010010010000001110111111100110111100000000100001000001000000111000000000000000010000000010000100000100000011100000000000000001000000001000000001010000001110111111000110111100000000100000000101000000111011111100011011110000000010000100000100000011100000001110010001010001110000010000010000001110000000111001000101000111000001001001000000111011111110110111110100100010000100100100000011101111111011011111010010001000010000010000001110111111010101111101001111000001000001000000111011111101010111110100111100000100000100000011101111111001101111000000001000010000010000001110111111100110111100000000100000001110000000111000000000001010010100011100000000111000000011100000000000101001010001110000000001010000001110111111111010111101001111000000000101000000111011111111101011110100111100000000010100000011100000000101010001000010001000000001010000001110000000010101000100001000100001001110000000111011111101101011110100011100000100111000000011101111110110101111010001110000010011100000001110000000010101000100000000100001001110000000111000000001010100010000000010000100000100000011101111111111010111010001110000010000010000001110111111111101011101000111000001000001000000111000000000001010010000000010000100000100000011100000000000101001000000001000010010010000001110111111111101011100000000100001001001000000111011111111110101110000000010000100100100000011100000000100101001010011110000010010010000001110000000010010100101001111000001001110000000111000000000000000010000000010000100111000000011100000000000000001000000001000010000010000001110111111011101011100000000100001000001000000111011111101110101110000000010000000010100000011100000000001010001000010110000000001010000001110000000000101000100001011000001000001000000111000000000000000011000000010000100000100000011100000000000000001100000001000010000010000001110000000100101000110000000100001000001000000111000000010010100011000000010000100111000000011100000000000000001100000001000010011100000001110000000000000000110000000100001001001000000111000000000000000011100111100000100100100000011100000000000000001110011110000010000010000001110111111000011011111001111000001000001000000111011111100001101111100111100000100111000000011100000001110010001100010001000010011100000001110000000111001000110001000100000000101000000111000000001010100011100111100000000010100000011100000000101010001110011110000010011100000001110000000000000000111001000100001001110000000111000000000000000011100100010000100000100000011101111110110101111110011110000010000010000001110111111011010111111001111000001000001000000111011111100011011111100111100000100000100000011101111110001101111110011110000000010010000001110000000100010100110000000100000001001000000111000000010001010011000000010000000010100000011100000000000000001100000001000000001010000001110000000000000000110000000100001000001000000111011111100001101111000000010000100000100000011101111110000110111100000001000010011100000001110000000101111000111001111000001001110000000111000000010111100011100111100000100100100000011101111111100001111100000001000010010010000001110111111110000111110000000100001001110000000111000000000000000011100011100000100111000000011100000000000000001110001110000000001010000001110000000000010100110001000100000000101000000111000000000001010011000100010000000010100000011100000000000000001100010001000000001010000001110000000000000000110001000100001001001000000111000000010000000011000000010000100100100000011100000001000000001100000001000010000010000001110111111011010111110001000100001000001000000111011111101101011111000100010000100111000000011101111110001101111110011110000010011100000001110111111000110111111001111000000000101000000111000000010001010011000100010000000010100000011100000001000101001100010001000010010010000001110111111111101011111001111000001001001000000111011111111110101111100111100000100111000000011100000000100101001100010001000010011100000001110000000010010100110001000100000001101000000111011111100110111111000000010000000110100000011101111110011011111100000001000010000010000001110111111010101111110000000100001000001000000111011111101010111111000000010000100100100000011100000000000000001110011110000010010010000001110000000000000000111001111000001000001000000111011111100011011111100011100000100000100000011101111110001101111110001110000010010010000001110000000010010100110000000100001001001000000111000000001001010011000000010000100000100000011101111110110101111110001110000010000010000001110111111011010111111000111000000000101000000111011111110011011111100011100000000010100000011101111111001101111110001110000000001010000001110000000001001100111001000100000000101000000111000000000100110011100100010000000010100000011101111111100001111010001110000000001010000001110111111110000111101000111000001000001000000111000000010010100010000100010000100000100000011100000001001010001000010001000010011010000001110000000000000000100001000100001001101000000111000000000000000010000100010000100000100000011100000001000000001010001110000010000010000001110000000100000000101000111000001001001000000111011111101101011110000100010000100100100000011101111110110101111000010001000010010010000001110000000010101000100000000100001001001000000111000000001010100010000000010000100000100000011100000000000000001000010001000010000010000001110000000000000000100001000100000000101000000111011111111010111110000000010000000010100000011101111111101011111000000001000010011100000001110000000001010000100000000100001001110000000111000000000101000010000000010000000100100000011100000001010100001000000001000000010010000001110000000101010000100000000100000000101000000111011111111011001110000100010000000010100000011101111111101100111000010001000010000010000001110000000100010100100001000100001000001000000111000000010001010010000100010000100100100000011101111110110101111010011110000010010010000001110111111011010111101001111000001001001000000111000000000000000010000100010000100100100000011100000000000000001000010001000010011100000001110000000011010000100000000100001001110000000111000000001101000010000000010000000111000000011101111110100001111000001110000000011100000001110111111010000111100000111000000000101000000111000000010001010010000100010000000010100000011100000001000101001000010001000000001010000001110000000100000000101001111000000000101000000111000000010000000010100111100000100100100000011101111111111010111000010001000010010010000001110111111111101011100001000100001000001000000111000000011100100010100111100000100000100000011100000001110010001010011110000010000010000001110000000100101000100001000100001000001000000111000000010010100010000100010000000111000000011101111111111010111000010001000000011100000001110111111111101011100001000100001001001000000111000000000000000010100011100000100100100000011100000000000000001010001110000010010010000001110000000100111100100001000100001001001000000111000000010011110010000100010000100000100000011101111111010001111010011110000010000010000001110111111101000111101001111000001001110000000111000000011001000010000000010000100111000000011100000001100100001000000001000000001010000001110111111000011011100001000100000000101000000111011111100001101110000100010000100111000000011100000000000101001000000001000010011100000001110000000000010100100000000100001001001000000111011111100010001110000100010000100100100000011101111110001000111000010001000010010010000001110000000111100100100001000100001001001000000111000000011110010010000100010000000010100000011100000000101010001010001110000000001010000001110000000010101000101000111000001001110000000111011111111110101110100111100000100111000000011101111111111010111010011110000000001010000001110000000000000000110000000100000000101000000111000000000000000011000000010000100100100000011100000001000101001100010001000010010010000001110000000100010100110001000100001001001000000111011111101110101111100011100000100100100000011101111110111010111110001110000010010010000001110000000100010100111000111000001001001000000111000000010001010011100011100000100111000000011101111111110101111100010001000010011100000001110111111111010111110001000100000000101000000111000000001101000011100111100000000010100000011100000000110100001110011110000000001010000001110111111010101111111001111000000000101000000111011111101010111111100111100000100000100000011100000000101010001110011110000010000010000001110000000010101000111001111000000000101000000111011111111111111111100111100000000010100000011101111111111111111110011110000010010010000001110111111111010111110000000100001001001000000111011111111101011111000000010000100100100000011100000000101010001100000001000010010010000001110000000010101000110000000100001000001000000111011111101101011111000100010000100000100000011101111110110101111100010001000000010010000001110000000011010000110000000100000001001000000111000000001101000011000000010000100111000000011100000000010100001110001110000010011100000001110000000001010000111000111000001000001000000111011111111111111111100111100000100000100000011101111111111111111110011110000000001010000001110000000100000000110000000100000000101000000111000000010000000011000000010000000110100000011101111111111111111110010001000000011010000001110111111111111111111001000100000001001000000111000000000000000011100011100000000100100000011100000000000000001110001110000010000010000001110111111111010111111000111000001000001000000111011111111101011111100011100000100000100000011101111111011011111100010001000010000010000001110111111101101111110001000100001000001000000111011111111010111111100011100000100000100000011101111111101011111110001110000000001010000001110000000100010100111001000100000000101000000111000000010001010011100100010000100111000000011100000001000000001110001110000010011100000001110000000100000000111000111000001000001000000111000000011100100011000000010000100000100000011100000001110010001100000001000000001010000001110111111001110011110001000100000000101000000111011111100111001111000100010000100111000000011100000000011110001100000001000010011100000001110000000001111000110000000100001001001000000111000000000000000011000100010000100100100000011100000000000000001100010001000010010010000001110111111000011011111001111000001001001000000111011111100001101111100111100000100000100000011100000001000101001100010001000010000010000001110000000100010100110001000100000000101000000111011111111100001111100111100000000010100000011101111111110000111110011110000010010010000001110000000000111100110000000100001001001000000111000000000011110011000000010000000110100000011100000001000000001100000001000000011010000001110000000100000000110000000100001001110000000111011111101110101110000111100000100111000000011101111110111010111000011110000000010010000001110000000100010100101001111000000001001000000111000000010001010010100111100000100111000000011101111111110101111010011110000010011100000001110111111111010111101001111000001000001000000111000000010010100010000000010000100000100000011100000001001010001000000001000010011100000001110111111101101111101001111000001001110000000111011111110110111110100111100000100000100000011100000001100100001000010001000010000010000001110000000110010000100001000100001001001000000111000000000010100010000111100000100100100000011100000000001010001000011110000000001010000001110111111111000011101000111000000000101000000111011111111100001110100011100000100000100000011100000001000101001010010001000010000010000001110000000100010100101001000100001000001000000111011111100001101110100111100000100000100000011101111110000110111010011110000000011010000001110000000000010100100001011000000001101000000111000000000001010010000101100000100000100000011101111111111010111000001001000010000010000001110111111111101011100000100100000001001000000111000000010001010010100111100000000100100000011100000001000101001010011110000010010010000001110111111111010111100000000100001001001000000111011111111101011110000000010000000011000000011100000000101010001000000001000000001100000001110000000010101000100000000100000000101000000111011111111111111110100111100000000010100000011101111111111111111010011110000010000010000001110111111000011011101001000100001000001000000111011111100001101110100100010000100100100000011100000001010011001010001110000010010010000001110000000101001100101000111000000001101000000111011111100110111110100111100000000110100000011101111110011011111010011110000010011100000001110111111110000111100001000100001001110000000111011111111000011110000100010000100100100000011100000000011110001010001110000010010010000001110000000001111000101000111000001000001000000111011111111111010110100100010000100000100000011101111111111101011010010001000010000010000001110000000010001010100000000100001000001000000111000000001000101010000000010000100100100000011101111111111111111000000001000010010010000001110111111111111111100000000100001001001000000111011111110011011110100111100000100100100000011101111111001101111010011110000010000010000001110000000000111100101001111000001000001000000111000000000011110010100111100000100000100000011101111111111101011000000001000010000010000001110111111111110101100000000100001000001000000111000000011100100010100011100000100000100000011100000001110010001010001110000010000010000001110000000100101000101000111000001000001000000111000000010010100010100011100000100111000000011101111110000110111000010001000010011100000001110111111000011011100001000100001001001000000111000000000001010010100011100000100100100000011100000000000101001010001110000010011100000001110000000000000000100001000100001001110000000111000000000000000010000100010000100000100000011100000000000000001100010001000010000010000001110000000000000000110001000100000000101000000111000000000000000011000111100000000010100000011100000000000000001100011110000010010010000001110111111111010111110000000100001001001000000111011111111101011111000000010000100000100000011100000001001010001100010001000010000010000001110000000100101000110001000100000001101000000111011111111101011111000000010000000110100000011101111111110101111100000001000010010010000001110000000000000000110000000100001001001000000111000000000000000011000000010000000100100000011100000000000000001100001110000000010010000001110000000000000000110000111000001001001000000111011111110011011111000000010000100100100000011101111111001101111100000001000010000010000001110000000101111000110001000100001000001000000111000000010111100011000100010000000010100000011100000000010100001100000001000000001010000001110000000001010000110000000100001000001000000111011111101101011111100011100000100000100000011101111110110101111110001110000000001010000001110000000101111000110001000100000000101000000111000000010111100011000100010000100111000000011101111110011011111100010001000010011100000001110111111001101111110001000100000000101000000111000000000000000011100011100000000010100000011100000000000000001110001110000010000010000001110000000100000000110001000100001000001000000111000000010000000011000100010000100000100000011101111110110101111100000001000010000010000001110111111011010111110000000100001001110000000111000000001101000011100011100000100111000000011100000000110100001110001110000000001010000001110111111010101111110001000100000000101000000111011111101010111111000100010000100100100000011100000000101010001100000001000010010010000001110000000010101000110000000100001000001000000111011111101110101111000000010000100000100000011101111110111010111100000001000010010010000001110000000011111000110001000100001001001000000111000000001111100011000100010000100100100000011100000001100100001110001110000010010010000001110000000110010000111000111000000001001000000111011111100001101111000000010000000100100000011101111110000110111100000001000010000010000001110111111111111111110001000100001000001000000111011111111111111111000100010000000010100000011100000000100101001110011110000000001010000001110000000010010100111001111000001001001000000111011111101101011111000100010000100100100000011101111110110101111100010001000010010010000001110000000000000000110000000100001001001000000111000000000000000011000000010000100100100000011100000001001010001110011110000010010010000001110000000100101000111001111000001001001000000111011111111101011111100100010000100100100000011101111111110101111110010001000010000010000001110000000100101000110000111000001000001000000111000000010010100011000011100000000010100000011101111111110101111100010001000000001010000001110111111111010111110001000100000001001000000111000000001101000011000000010000000100100000011100000000110100001100000001000000001010000001110000000110010000100000000100000000101000000111000000011001000010000000010000100000100000011101111111110101111000010001000010000010000001110111111111010111100001000100000000101000000111000000010010100010000100010000000010100000011100000001001010001000010001000010011100000001110000000000000000100000000100001001110000000111000000000000000010000000010000000010100000011101111110000110111000010001000000001010000001110111111000011011100001000100001000001000000111000000000011110010000100010000100000100000011100000000001111001000010001000010011100000001110111111001110011100001000100001001110000000111011111100111001110000100010000000010100000011100000001011110001000000001000000001010000001110000000101111000100000000100001001110000000111011111101101011110000111100000100111000000011101111110110101111000011110000010010010000001110000000011010000100000000100001001001000000111000000001101000010000000010000100100100000011101111110100001111000000001000010010010000001110111111010000111100000000100000000101000000111000000001001010010100111100000000010100000011100000000100101001010011110000010000010000001110111111111101011100000000100001000001000000111011111111110101110000000010000100000100000011101111111111111111000001110000010000010000001110111111111111111100000111000001000001000000111000000001111100010100100010000100000100000011100000000111110001010010001000010000010000001110111111010000111100001000100001000001000000111011111101000011110000100010000000100100000011100000000100101001010011110000000010010000001110000000010010100101001111000000001110000000111011111111111111110000000010000000111000000011101111111111111111000000001000010000010000001110000000100000000101001111000001000001000000111000000010000000010100111100000100100100000011101111111111111111000000001000010010010000001110111111111111111100000000100001000001000000111011111111101011110000100010000100000100000011101111111110101111000010001000000001010000001110000000100101000100001111000000000101000000111000000010010100010000111100000100111000000011101111110000110111000010001000010011100000001110111111000011011100001000100000000101000000111000000000101000010100011100000000010100000011100000000010100001010001110000010011100000001110111111110101111100001111000001001110000000111011111111010111110000111100000000010100000011100000000001010001000010001000000001010000001110000000000101000100001000100001001001000000111000000010010100010100111100000100100100000011100000001001010001010011110000010000010000001110111111111010111100001000100001000001000000111011111111101011110000100010000100000100000011100000000110100001000010001000010000010000001110000000011010000100001000100000000101000000111011111111000011110100111100000000010100000011101111111100001111010011110000000001010000001110000000101111000100000000100000000101000000111000000010111100010000000010000100111000000011101111110101011111000001110000010011100000001110111111010101111100000111000000000101000000111000000001010100011000000010000000010100000011100000000101010001100000001000010000010000001110111111011010111110000000100001000001000000111011111101101011111000000010000100111000000011100000001001010001100010001000010011100000001110000000100101000110001000100001001001000000111011111100001101111000100010000100100100000011101111110000110111100010001000010011100000001110000000101111000111001111000001001110000000111000000010111100011100111100000100100100000011100000000010100001100000001000010010010000001110000000001010000110000000100000000101000000111011111101110101111000000010000000010100000011101111110111010111100000001000000001010000001110000000100111100111001111000000000101000000111000000010011110011100111100000000110100000011101111111111010111100010001000000011010000001110111111111101011110001000100001000001000000111011111100011011111100111100000100000100000011101111110001101111110011110000000001010000001110000000000101000111001111000000000101000000111000000000010100011100111100000100000100000011101111110001101111100010001000010000010000001110111111000110111110001000100000001001000000111000000010001010011000000010000000100100000011100000001000101001100000001000010010010000001110000000100000000111001111000001001001000000111000000010000000011100111100000100000100000011100000000000000001100000001000010000010000001110000000000000000110000000100001000001000000111000000000101000011000100010000100000100000011100000000010100001100010001000010011100000001110111111110110011110001000100001001110000000111011111111011001111000100010000100100100000011100000001000101001110011110000010010010000001110000000100010100111001111000001000001000000111011111111111111111100011100000100000100000011101111111111111111110001110000010011100000001110111111001000111111001000100001001110000000111011111100100011111100100010000100111000000011100000000011110001110011110000010011100000001110000000001111000111001111000000000101000000111000000000000000011100100010000000010100000011100000000000000001110010001000010000010000001110111111111010111110001000100001000001000000111011111111101011111000100010000100100100000011101111110001101111100000001000010010010000001110111111000110111110000000100000000101000000111000000000010100011000100010000000010100000011100000000001010001100010001000010000010000001110000000100101000110000000100001000001000000111000000010010100011000000010000100100100000011101111111110101111110011110000010010010000001110111111111010111111001111000000001101000000111011111110001101111100100010000000110100000011101111111000110111110010001000010010010000001110000000100111100110000000100001001001000000111000000010011110011000000010000000010100000011101111111111010111110011110000000001010000001110111111111101011111001111000000000101000000111000000011100100011000000010000000010100000011100000001110010001100000001000010000010000001110000000010101000111001111000001000001000000111000000001010100011100111100000100000100000011101111111111010111000010001000010000010000001110111111111101011100001000100001001001000000111000000000001010010000000010000100100100000011100000000000101001000000001000010010010000001110000000101010000100001000100001001001000000111000000010101000010000100010000100100100000011101111110010001111000010001000010010010000001110111111001000111100001000100001001001000000111000000000010100010000011100000100100100000011100000000001010001000001110000010000010000001110000000000000000101000111000001000001000000111000000000000000010100011100000100000100000011101111110110101111000000001000010000010000001110111111011010111100000000100001000001000000110000000010010100010100111100000100000100000011000000001001010001010011110000010011100000001100111111111010111101000111000001001110000000110011111111101011110100011100000100100100000011000000001001010001000010001000010010010000001100000000100101000100001000100000000101000000110011111111101011110000011100000000010100000011001111111110101111000001110000010000010000000100000000000000000100001000100001000001000000010000000000000000010000100010000000010100000001000000001001010001000010001000000001010000000100000000100101000100001000100001000001000000110000000000000000010000000010000100000100000011000000000000000001000000001000000011010000001100111111111010111100001000100000001101000000110011111111101011110000100010000100000100000001001111111001101111000000001000010000010000000100111111100110111100000000100000000101000000010000000010001010010100111100000000010100000001000000001000101001010011110000010010010000001100111111001101111100001000100001001001000000110011111100110111110000100010000100111000000011000000001100100001010011110000010011100000001100000000110010000101001111000001001001000000010011111110110111110000000010000100100100000001001111111011011111000000001000010010010000000100111111110000111101000111000001001001000000010011111111000011110100011100000100111000000011000000000001111001010011110000010011100000001100000000000111100101001111000001001110000000110011111100010001110000101100000100111000000011001111110001000111000010110000010000010000000100000000100010100100001000100001000001000000010000000010001010010000100010000100100100000001001111111111111111000000001000010010010000000100111111111111111100000000100001001001000000110011111111110101110100011100000100100100000011001111111111010111010001110000000011100000001100000000100010100101001000100000001110000000110000000010001010010100100010000100100100000001000000000000000001000011110000010010010000000100000000000000000100001111000001000001000000010011111111101011110000100010000100000100000001001111111110101111000010001000010000010000001100111111100110111100000000100001000001000000110011111110011011110000000010000000110100000011000000001000101001010001110000000011010000001100000000100010100101000111000001001110000000010011111101101011110000100010000100111000000001001111110110101111000010001000010011100000000100000000100101000110000000100001001110000000010000000010010100011000000010000000010100000011001111110000110111110011110000000001010000001100111111000011011111001111000000001001000000110000000010010100011000100010000000100100000011000000001001010001100010001000010011100000000100000000111001000111000111000001001110000000010000000011100100011100011100000100000100000001001111110000110111100010001000010000010000000100111111000011011110001000100001001110000000110000000000011110011100111100000100111000000011000000000001111001110011110000000001010000001100111111111101011110000000100000000101000000110011111111110101111000000010000000010100000001001111110001101111110011110000000001010000000100111111000110111111001111000001001110000000010000000001001010011000101100000100111000000001000000000100101001100010110000000001010000001100111111111111111110000000100000000101000000110011111111111111111000000010000100111000000011001111111111010111100000001000010011100000001100111111111101011110000000100001000001000000111000000010001010011000000010000100000100000011100000001000101001100000001000010010010000001110111111111101011110001000100001001001000000111011111111110101111000100010000100000100000011100000000100101001110011110000010000010000001110000000010010100111001111000000000101000000111000000000000000011100111100000000010100000011100000000000000001110011110000010011100000001110111111111101011111000111000001001110000000111011111111110101111100011100000000010100000011100000001000010101110011110000000001010000001110000000100001010111001111000000001110000000111011111101111010111100111100000000111000000011101111110111101011110011110000000001010000001110000000000101000111001111000000000101000000111000000000010100011100111100000100000100000011100000001001010001100010001000010000010000001110000000100101000110001000100001000001000000111011111100001101111100011100000100000100000011101111110000110111110001110000010011010000001110000000100010100110001000100001001101000000111000000010001010011000100010000100000100000011101111111111010111110011110000010000010000001110111111111101011111001111000001000001000000111000000010001010011100100010000100000100000011100000001000101001110010001000000001010000001110111111011101011111001111000000000101000000111011111101110101111100111100000100100100000011100000000100101001100010001000010010010000001110000000010010100110001000100001000001000000111011111111111111111000000010000100000100000011101111111111111111100000001000000011010000001110111111000011011110000000100000001101000000111011111100001101111000000010000000100100000011100000000100010101110001110000000010010000001110000000010001010111000111000000000101000000111011111101111010111000000010000000010100000011101111110111101011100000001000010011100000001110000000000010100111001111000001001110000000111000000000001010011100111100000000010100000011101111110011011111110011110000000001010000001110111111001101111111001111000001001110000000111000000000101000010000000010000100111000000011100000000010100001000000001000010000010000001110111111000011011100000000100001000001000000111011111100001101110000000010000100111000000011100000000001111001010011110000010011100000001110000000000111100101001111000001001001000000111011111100011011110100111100000100100100000011101111110001101111010011110000000001010000001110000000100000000101001111000000000101000000111000000010000000010100111100000100100100000011101111110111010111000000001000010010010000001110111111011101011100000000100001000001000000111000000001001010010000000010000100000100000011100000000100101001000000001000000001010000001110111111111101011101001111000000000101000000111011111111110101110100111100000100100100000011100000001110010001000000001000010010010000001110000000111001000100000000100001000001000000111011111100011011110000011100000100000100000011101111110001101111000001110000010010010000001110000000100010100101001111000001001001000000111000000010001010010100111100000100111000000011100000001000000001010011110000010011100000001110000000100000000101001111000001001001000000111011111111111111110000100010000100100100000011101111111111111111000010001000010011010000001110111111111010111100000000100001001101000000111011111111101011110000000010000100000100000011100000000101010001010001110000010000010000001110000000010101000101000111000001001110000000111011111111111111110000000010000100111000000011101111111111111111000000001000000001010000001110111111111010111100000000100000000101000000111011111111101011110000000010000100100100000011100000000101010001000001110000010010010000001110000000010101000100000111000000000101000000111011111111110101110000000010000000010100000011101111111111010111000000001000000001100000001110000000000010100100000000100000000110000000111000000000001010010000000010000000010100000011100000001010100001000000001000000001010000001110000000101010000100000000100001000001000000111011111101000011110100111100000100000100000011101111110100001111010011110000010011100000001110000000000000000100000000100001001110000000111000000000000000010000000010000100000100000011100000000101010001010001110000010000010000001110000000010101000101000111000001000001000000111011111111111111110000100010000100000100000011101111111111111111000010001000010010010000001110000000000101000100001000100001001001000000111000000000010100010000100010000100000100000011101111111110110011000010001000010000010000001110111111111011001100001000100000000101000000111000000001000101010000000010000000010100000011100000000100010101000000001000010010010000001110111111011010111100001011000001001001000000111011111101101011110000101100000100000100000011101111111001101111000000001000010000010000001110111111100110111100000000100001000001000000111000000011100100010100011100000100000100000011100000001110010001010001110000010011100000001110000000100101000100000111000001001110000000111000000010010100010000011100000000010100000011101111111110101111110010001000000001010000001110111111111010111111001000100001001110000000111011111110011011111100011100000100111000000011101111111001101111110001110000010010010000001110000000101111000110001000100001001001000000111000000010111100011000100010000100100100000011100000001100100001100010001000010010010000001110000000110010000110001000100001001110000000111000000010000000011100111100000100111000000011100000001000000001110011110000010010010000001110111111011010111111001000100001001001000000111011111101101011111100100010000100111000000011100000000000000001110001110000010011100000001110000000000000000111000111000001001001000000111000000010001010011000111100000100100100000011100000001000101001100011110000000001010000001110111111000001101111001000100000000101000000111011111100000110111100100010000100111000000011100000001001111001100000001000010011100000001110000000100111100110000000100001000001000000111011111101101011111000100010000100000100000011101111110110101111100010001000000001010000001110111111000110111110000000100000000101000000111011111100011011111000000010000100111000000011100000001000101001110011110000010011100000001110000000100010100111001111000000001001000000111011111100010001111000000010000000100100000011101111110001000111100000001000010011010000001110000000100111100110000000100001001101000000111000000010011110011000000010000100111000000011100000000000000001110001110000010011100000001110000000000000000111000111000001000001000000111011111111100001111000100010000100000100000011101111111110000111100010001000000001010000001110000000111100100111001111000000000101000000111000000011110010011100111100000100111000000011100000000110100001110011110000010011100000001110000000011010000111001111000001001110000000111011111101000011111000100010000100111000000011101111110100001111100010001000010000010000001110000000100010100111000111000001000001000000111000000010001010011100011100000100111000000011100000000001010001110011110000010011100000001110000000000101000111001111000001001001000000111011111111100001111100111100000100100100000011101111111110000111110011110000010000010000001110000000100010100111001111000001000001000000111000000010001010011100111100000100100100000011101111111011011111110011110000010010010000001110111111101101111111001111000001000001000000111011111111000011111100111100000100000100000011101111111100001111110011110000010000010000001110000000000000000110000000100001000001000000111000000000000000011000000010000000100100000011100000000000000001110001110000000010010000001110000000000000000111000111000001001110000000111000000011100100011000000010000100111000000011100000001110010001100000001000010000010000001110000000100101000111001000100001000001000000111000000010010100011100100010000100000100000011100000000000000001100011110000010000010000001110000000000000000110001111000000000101000000111000000000000000011000000010000000010100000011100000000000000001100000001000010000010000001110000000000000000101000111000001000001000000111000000000000000010100011100000100111000000011100000000000000001000010001000010011100000001110000000000000000100001000100000000101000000111000000000000000010100111100000000010100000011100000000000000001010011110000010000010000001110111111111010111100001111000001000001000000111011111111101011110000111100000100000100000011100000000000000001010011110000010000010000001110000000000000000101001111000001001110000000111011111110011011110000100010000100111000000011101111111001101111000010001000010000010000001110000000100010100100000000100001000001000000111000000010001010010000000010000100100100000011101111110110101111000000001000010010010000001110111111011010111100000000100001000001000000111000000000000000010000100010000100000100000011100000000000000001000010001000000001010000001110000000011010000100001000100000000101000000111000000001101000010000100010000100111000000011100000001100100001010011110000010011100000001110000000110010000101001111000001000001000000111000000000000000010100011100000100000100000011100000000000000001010001110000010010010000001110111111000011011100001000100001001001000000111011111100001101110000100010000100111000000011100000000000000001000010001000010011100000001110000000000000000100001000100001001001000000111000000000001010010000011100000100100100000011100000000000101001000001110000010000010000001110111111111010111101000111000001000001000000111011111111101011110100011100000000110100000011100000000110100001000000001000000011010000001110000000011010000100000000100001000001000000111011111101000011110000000010000100000100000011101111110100001111000000001000010011100000001110000000100010100100000111000001001110000000111000000010001010010000011100000100111000000011100000001000000001000000001000010011100000001110000000100000000100000000100000000101000000111011111101110101110000000010000000010100000011101111110111010111000000001000010000010000001110000000000101000101001111000001000001000000111000000000010100010100111100000000010100000011100000001001010001010011110000000001010000001110000000100101000101001111000001000001000000111000000010001010010100011100000100000100000011100000001000101001010001110000000011010000001110111111011000011101001111000000001101000000111011111101100001110100111100000000010100000011101111110001101111000000001000000001010000001110111111000110111100000000100001001001000000111000000000010100010100111100000100100100000011100000000001010001010011110000000010010000001110000000010101000100001000100000001001000000111000000001010100010000100010000100100100000011101111110110101111000010110000010010010000001110111111011010111100001011000001001001000000111000000001010100010100111100000100100100000011100000000101010001010011110000010000010000001110111111111111111101001111000001000001000000111011111111111111110100111100000100100100000011100000001000101001000010001000010010010000001110000000100010100100001000100001000001000000111011111100001101111000000010000100000100000011101111110000110111100000001000010011100000001110111111111111111111000111000001001110000000111011111111111111111100011100000100100100000011100000000000000001110011110000010010010000001110000000000000000111001111000001000001000000111011111111101011111000000010000100000100000011101111111110101111100000001000010000010000001110000000110010100110000000100001000001000000111000000011001010011000000010000100100100000011101111110110101111100010001000010010010000001110111111011010111110001000100001000001000000111000000000000000011100011100000100000100000011100000000000000001110001110000010010010000001110111111000011011110000000100001001001000000111011111100001101111000000010000000010100000011101111111111111111100000001000000001010000001110111111111111111110000000100001001001000000111000000001001010011100111100000100100100000011100000000100101001110011110000010011010000001110111111111111111110001000100001001101000000111011111111111111111000100010000100111000000011101111111110101111100000001000010011100000001110111111111010111110000000100000000101000000111000000010010100011100111100000000010100000011100000001001010001110011110000000001010000001110111111000011011110000000100000000101000000111011111100001101111000000010000100000100000011100000001000101001110011110000010000010000001110000000100010100111001111000000000101000000111000000000000000011100111100000000010100000011100000000000000001110011110000010011100000001110111111111111111110000000100001001110000000111011111111111111111000000010000100100100000011100000001000101001110011110000010010010000001110000000100010100111001111000000000101000000111011111101111010111100111100000000010100000011101111110111101011110011110000010011100000001110000000010010100110000000100001001110000000111000000001001010011000000010000000110100000011100000000000000001110011110000000011010000001110000000000000000111001111000001000001000000111011111101101011111000000010000100000100000011101111110110101111100000001000010010010000001110000000010101000110001111000001001001000000111000000001010100011000111100000000010100000011101111111111010111110011110000000001010000001110111111111101011111001111000001000001000000111000000000001010011100011100000100000100000011100000000000101001110001110000010010010000001110000000100000000111001111000001001001000000111000000010000000011100111100000000010100000011101111111111010111110011110000000001010000001110111111111101011111001111000000000101000000111000000000011110011000000010000000010100000011100000000001111001100000001000000001010000001110111111000110111111001000100000000101000000111011111100011011111100100010000100000100000011100000000000000001110011110000010000010000001110000000000000000111001111000000000101000000111000000010000000011100011100000000010100000011100000001000000001110001110000010000010000001110111111111111111111001111000001000001000000111011111111111111111100111100000100000100000011100000001000000001010011110000010000010000001110000000100000000101001111000001001001000000111000000000000000010000111100000100100100000011100000000000000001000011110000010010010000001110000000000000000100000000100001001001000000111000000000000000010000000010000100100100000011100000000000000001000010001000010010010000001110000000000000000100001000100000000101000000111011111111110101110100111100000000010100000011101111111111010111010011110000010000010000001110000000100010100100000111000001000001000000111000000010001010010000011100000100111000000011101111111111111111000010001000010011100000001110111111111111111100001000100000000101000000111000000000000000010000000010000000010100000011100000000000000001000000001000010010010000001110000000000000000101000111000001001001000000111000000000000000010100011100000100000100000011100000001000000001010001110000010000010000001110000000100000000101000111000000000101000000111011111111111111110000000010000000010100000011101111111111111111000000001000010011100000001110111111101101111101001111000001001110000000111011111110110111110100111100000000110100000011100000001100100001000010001000000011010000001110000000110010000100001000100000000101000000111011111111101011110000011100000000010100000011101111111110101111000001110000010011100000001110000000011010000100000000100001001110000000111000000001101000010000000010000000010100000011100000001100100001000010001000000001010000001110000000110010000100001000100001001001000000111000000000000000010100011100000100100100000011100000000000000001010001110000010010010000001110000000100000000101001000100001001001000000111000000010000000010100100010000100111000000011101111110111010111010011110000010011100000001110111111011101011101001111000001001001000000111000000001100110010000000010000100100100000011100000000110011001000000001000000001010000001110111111000110111100001111000000000101000000111011111100011011110000111100000100000100000011101111110101011111000000001000010000010000001110111111010101111100000000100000001101000000111000000001010100010100111100000000110100000011100000000101010001010011110000000001010000001110111111011010111100000000100000000101000000111011111101101011110000000010000000010100000011100000000101010001000010001000000001010000001110000000010101000100001000100001000001000000111011111111100001110100011100000100000100000011101111111110000111010001110000010011100000001110000000000111100100000000100001001110000000111000000000011110010000000010000100000100000011100000001000000001000000001000010000010000001110000000100000000100000000100001000001000000111011111111111111110100111100000100000100000011101111111111111111010011110000000001010000001110000000000101000101001000100000000101000000111000000000010100010100100010000100111000000011101111111001101111010011110000010011100000001110111111100110111101001111000001001001000000111000000000000000010000011100000100100100000011100000000000000001000001110000010000010000001110111111111101011110001000100001000001000000111011111111110101111000100010000000010100000011100000001110010001110011110000000001010000001110000000111001000111001111000000000101000000111000000000000000011100100010000000010100000011100000000000000001110010001000010011100000001110000000000000000111000111000001001110000000111000000000000000011100011100000100100100000011100000000101010001100011110000010010010000001110000000010101000110001111000001000001000000111011111111100001111000000010000100000100000011101111111110000111100000001000010010010000001110000000000111100110000000100001001001000000111000000000011110011000000010000000010100000011100000000000000001110001110000000001010000001110000000000000000111000111000001000001000000111011111110110111111100111100000100000100000011101111111011011111110011110000010000010000001110000000001010000110000000100001000001000000111000000000101000011000000010000000010100000011101111111110000111110011110000000001010000001110111111111000011111001111000001000001000000111000000010011110011000100010000100000100000011100000001001111001100010001000000001010000001110111111111111111111000111000000000101000000111011111111111111111100011100000000100100000011100000000000000001100010001000000010010000001110000000000000000110001000100000000101000000111000000010000000011100011100000000010100000011100000001000000001110001110000010000010000001110111111111111111110000000100001000001000000111011111111111111111000000010000100100100000011100000000000000001100000001000010010010000001110000000000000000110000000100001001001000000111000000010000000011000100010000100100100000011100000001000000001100010001000000001010000001110111111111111111110000000100000000101000000111011111111111111111000000010000100000100000011101111111011011111100010001000010000010000001110111111101101111110001000100001000001000000111000000011001000011100111100000100000100000011100000001100100001110011110000000001010000001110111111101101111110001000100000000101000000111011111110110111111000100010000100111000000011100000001100100001100010001000010011100000001110000000110010000110001000100001000001000000111000000000000000011000100010000100000100000011100000000000000001100010001000000001010000001110000000000000000111001000100000000101000000111000000000000000011100100010000100100100000011101111111011011111100001110000010010010000001110111111101101111110000111000000000101000000111011111101010111111000000010000000010100000011101111110101011111100000001000010010010000001110111111100110111110000000100001001001000000111011111110011011111000000010000000010100000011100000001000101001100000001000000001010000001110000000100010100110000000100001000001000000111011111101110101111000100010000100000100000011101111110111010111100010001000010010010000001110000000100000000111000111000001001001000000111000000010000000011100011100000100111000000011100000001011110001100010001000010011100000001110000000101111000110001000100001001110000000111011111100110111110100011100000100111000000011101111110011011111010001110000000001010000001110000000111100100100001000100000000101000000111000000011110010010000100010000100000100000011101111110001101111000010001000010000010000001110111111000110111100001000100000000101000000111000000010000000010000101100000000010100000011100000001000000001000010110000010000010000001110111111011010111100001000100001000001000000111011111101101011110000100010000000010100000011100000000000000001000001110000000001010000001110000000000000000100000111000001000001000000111000000000000000010000100010000100000100000011100000000000000001000010001000010000010000001110111111000110111101000111000001000001000000111011111100011011110100011100000000010100000011100000000100101001000000001000000001010000001110000000010010100100000000100001001110000000111011111111110101110100111100000100111000000011101111111111010111010011110000000001010000001110000000101111000101000111000000000101000000111000000010111100010100011100000000010100000011100000000010100001000010001000000001010000001110000000001010000100001000100001000001000000111011111100110111110100111100000100000100000011101111110011011111010011110000000001010000001110000000110010000100001111000000000101000000111000000011001000010000111100000100000100000011101111110000110111000010001000010000010000001110111111000011011100001000100000000101000000111000000010001010010000000010000000010100000011100000001000101001000000001000010000010000001110111111011101011100000000100001000001000000111011111101110101110000000010000100111000000011100000000100101001010011110000010011100000001110000000010010100101001111000001000001000000111000000000000000010100111100000100000100000011100000000000000001010011110000000010010000001110111111111101011100001000100000001001000000111011111111110101110000100010000100000100000011100000001000101001000000001000010000010000001110000000100010100100000000100001000001000000111011111111111111110100111100000100000100000011101111111111111111010011110000000011010000001110111111101101111100001000100000001101000000111011111110110111110000100010000100111000000011101111110101011111010011110000010011100000001110111111010101111101001111000000000101000000111011111100011011110000000010000000010100000011101111110001101111000000001000000001010000001110000000100010100100001000100000000101000000111000000010001010010000100010000100000100000011100000000000000001010001110000010000010000001110000000000000000101000111000001000001000000111011111100001101110000100010000100000100000011101111110000110111000010001000010010010000001110000000111001000100000000100001001001000000111000000011100100010000000010000100000100000011100000000111110001000010001000010000010000001110000000011111000100001000100001001001000000111011111101011001110100111100000100100100000011101111110101100111010011110000000010010000001110000000010010100100000000100000001001000000111000000001001010010000000010000100000100000011100000000000000001100000001000010000010000001110000000000000000110000000100001001001000000111011111111110101111100111100000100100100000011101111111111010111110011110000010000010000001110000000000010100110001000100001000001000000111000000000001010011000100010000100000100000011101111111110101111100000001000010000010000001110111111111010111110000000100001001110000000111000000000000000011100011100000100111000000011100000000000000001110001110000010010010000001110000000000000000110000000100001001001000000111000000000000000011000000010000100111000000011000000001001010001100001110000010011100000001100000000100101000110000111000001000001000000110011111111101011111000100010000100000100000011001111111110101111100010001000000001010000001100000000100101000111001111000000000101000000110000000010010100011100111100000000010100000011000000000000000001110011110000000001010000001100000000000000000111001111000001001001000000010011111100001101111000100010000100100100000001001111110000110111100010001000000001010000000100111111111111111111000111000000000101000000010011111111111111111100011100000100111000000011000000000100101001100000001000010011100000001100000000010010100110000000100000000101000000110011111101110101111000000010000000010100000011001111110111010111100000001000010010010000000100000000100010100110000000100001001001000000010000000010001010011000000010000000010100000001001111111011011111100010001000000001010000000100111111101101111110001000100001000001000000110000000000101000011000000010000100000100000011000000000010100001100000001000010011100000001100111111111111111111001000100001001110000000110011111111111111111100100010000100100100000001001111111011011111100000001000010010010000000100111111101101111110000000100001000001000000010011111101010111111100111100000100000100000001001111110101011111110011110000010010010000001100000000010101000110001111000001001001000000110000000001010100011000111100000100000100000011001111111111111111110001110000010000010000001100111111111111111111000111000001000001000000010000000010000000011000100010000100000100000001000000001000000001100010001000010000010000000100111111111101011111001111000001000001000000010011111111110101111100111100000100110100000011001111111111111111100011110000010011010000001100111111111111111110001111000001001001000000110000000001010100011100100010000100100100000011000000000101010001110010001000000011010000000100111111011111111111000111000000001101000000010011111101111111111100011100000100100100000001000000001001010001100000001000010010010000000100000000100101000110000000100001000001000000110000000000000000011000000010000100000100000011000000000000000001100000001000000001010000001100000000000000000110000000100000000101000000110000000000000000011000000010000100100100000001001111110000110111110010001000010010010000000100111111000011011111001000100001001110000000010000000010000101011000011100000100111000000001000000001000010101100001110000000001010000001100111111000011011101001111000000000101000000110011111100001101110100111100000100100100000011001111111111111111000000001000010010010000001100111111111111111100000000100000000101000000010000000010000000010000011100000000010100000001000000001000000001000001110000010011100000000100111111011010111100001000100001001110000000010011111101101011110000100010000100000100000011000000000101010001000000001000010000010000001100000000010101000100000000100001001001000000110011111111111111110000000010000100100100000011001111111111111111000000001000010010010000000100111111000100011100001000100001001001000000010011111100010001110000100010000100000100000001000000000000010101000011110000010000010000000100000000000001010100001111000000000101000000110011111100011011110000100010000000010100000011001111110001101111000010001000010000010000001100000000100000000100000000100001000001000000110000000010000000010000000010000100000100000011101111110110101111010011110000010000010000001110111111011010111101001111000001000001000000111011111110011011110000100010000100000100000011101111111001101111000010001000010011100000001110000000000010100100000111000001001110000000111000000000001010010000011100000100000100000011100000000000000001010010001000010000010000001110000000000000000101001000100001001110000000111011111100001101110000000010000100111000000011101111110000110111000000001000010010010000001110000000100010100101001111000001001001000000111000000010001010010100111100000000010100000011101111111111010111000000001000000001010000001110111111111101011100000000100001001110000000111000000011100100010100111100000100111000000011100000001110010001010011110000010000010000001110000000100101000100000000100001000001000000111000000010010100010000000010000000110100000011101111111111010111000010001000000011010000001110111111111101011100001000100001000001000000111000000010001010010100011100000100000100000011100000001000101001010001110000010011010000001110111111000100011100001000100001001101000000111011111100010001110000100010000000010100000011100000000001111001000000001000000001010000001110000000000111100100000000100001001001000000111000000010000000010000000010000100100100000011100000001000000001000000001000000001010000001110111111011101011100000000100000000101000000111011111101110101110000000010000100100100000011100000001000101001000000001000010010010000001110000000100010100100000000100000000101000000111000000000010100010000111100000000010100000011100000000001010001000011110000010010010000001110111111000100011100001000100001001001000000111011111100010001110000100010000100111000000011100000000100010101010011110000010011100000001110000000010001010101001111000001001001000000111011111111011001110000111100000100100100000011101111111101100111000011110000010011100000001110000000110010000100000000100001001110000000111000000011001000010000000010000000010100000011100000001000000001000000001000000001010000001110000000100000000100000000100000000101000000111011111111111111111100111100000000010100000011101111111111111111110011110000010011100000001110000000100000000111001111000001001110000000111000000010000000011100111100000000010100000011100000000000000001110011110000000001010000001110000000000000000111001111000001001001000000111011111101110101111000000010000100100100000011101111110111010111100000001000010010010000001110000000100010100111001111000001001001000000111000000010001010011100111100000100000100000011101111110000110111100010001000010000010000001110111111000011011110001000100000000101000000111000000010001010011100011100000000010100000011100000001000101001110001110000010000010000001110000000000000000110000000100001000001000000111000000000000000011000000010000100100100000011101111111111010111100000001000010010010000001110111111111101011110000000100001001001000000111000000010001010011000000010000100100100000011100000001000101001100000001000010011100000001110111111111111111110000000100001001110000000111011111111111111111000000010000100000100000011100000000000000001110011110000010000010000001110000000000000000111001111000001001110000000111000000000000000011000010010000100111000000011100000000000000001100001001000010010010000001110111111101101111110000000100001001001000000111011111110110111111000000010000100100100000011100000001100100001100000001000010010010000001110000000110010000110000000100001001110000000111000000000000000011100111100000100111000000011100000000000000001110011110000010010010000001110000000000000000111001111000001001001000000111000000000000000011100111100000100000100000011101111111111010111100000001000010000010000001110111111111101011110000000100001000001000000111000000000010100011000000010000100000100000011100000000001010001100000001000000001010000001110111111100110111110001111000000000101000000111011111110011011111000111100000100000100000011100000000010100001100010001000010000010000001110000000001010000110001000100000000101000000111000000000111100011000100010000000010100000011100000000011110001100010001000000011100000001110111111111101011110000000100000001110000000111011111111110101111000000010000100000100000011100000001000101001100010001000010000010000001110000000100010100110001000100000000101000000111000000000000000011000000010000000010100000011100000000000000001100000001000010010010000001110111111111010111110000000100001001001000000111011111111101011111000000010000100000100000011100000000101010001110011110000010000010000001110000000010101000111001111000001000001000000111011111111111111111000000010000100000100000011101111111111111111100000001000010011100000001110111111101101111110000000100001001110000000111011111110110111111000000010000000010100000011101111111101100111110001110000000001010000001110111111110110011111000111000001000001000000111000000011110010011000111100000100000100000011100000001111001001100011110000010000010000001110000000011010000110000000100001000001000000111000000001101000011000000010000000010100000011100000001100100001010011110000000001010000001110000000110010000101001111000001001110000000111011111111101011110000100010000100111000000011101111111110101111000010001000000001010000001110000000100101000101001111000000000101000000111000000010010100010100111100000100000100000011101111111111010111010011110000010000010000001110111111111101011101001111000001000001000000111000000001001010010000000010000100000100000011100000000100101001000000001000010000010000001110111111111111111101000111000001000001000000111011111111111111110100011100000000010100000011100000000000000001000010001000000001010000001110000000000000000100001000100001000001000000111000000010000000010000000010000100000100000011100000001000000001000000001000010000010000001110111111111101011101001111000001000001000000111011111111110101110100111100000000010100000011100000001011110001010011110000000001010000001110000000101111000101001111000001000001000000111000000011001000010000000010000100000100000011100000001100100001000000001000010010010000001110000000000000000100001000100001001001000000111000000000000000010000100010000100100100000011101111111110101111000010001000010010010000001110111111111010111100001000100001001001000000111000000001010100010000100010000100100100000011100000000101010001000010001000010000010000001110111111111101011100001000100001000001000000111011111111110101110000100010000000010100000011100000001110010001010011110000000001010000001110000000111001000101001111000001001110000000111000000001010100010000000010000100111000000011100000000101010001000000001000010010010000001110111111111111111100001111000001001001000000111011111111111111110000111100000100100100000011100000000000000001010001110000010010010000001110000000000000000101000111000000001001000000111011111111101011110100100010000000100100000011101111111110101111010010001000010010010000001110000000000000000101001111000001001001000000111000000000000000010100111100000100000100000011101111111001101111000000001000010000010000001110111111100110111100000000100000000101000000111000000010111100010000000010000000010100000011100000001011110001000000001000000001010000001110111111110000111101001111000000000101000000111011111111000011110100111100000100000100000011100000000000101001010010001000010000010000001110000000000010100101001000100000000101000000111000000010000000010000000010000000010100000011100000001000000001000000001000000001100000001110111111111111111101001111000000000110000000111011111111111111110100111100000100100100000011101111111001101111010001110000010010010000001110111111100110111101000111000001000001000000111000000011100100010000000010000100000100000011100000001110010001000000001000010010010000001110000000100000000100000000100001001001000000111000000010000000010000000010000000010100000011100000000000000001000000001000000001010000001110000000000000000100000000100001001110000000111011111111111111110100011100000100111000000011101111111111111111010001110000010010010000001110111111001101111111001111000001001001000000111011111100110111111100111100000100111000000011101111111100111011100000001000010011100000001110111111110011101110000000100001000001000000111000000010000101011000100010000100000100000011100000001000010101100010001000000001010000001110000000000000000111001111000000000101000000111000000000000000011100111100000100000100000011100000000000000001100001110000010000010000001110000000000000000110000111000001000001000000111000000010000000011000100010000100000100000011100000001000000001100010001000000010010000001110111111011101011110001011000000001001000000111011111101110101111000101100000000110100000011100000000100101001110011110000000011010000001110000000010010100111001111000001001110000000111011111111110101111000000010000100111000000011101111111111010111100000001000000001010000001110000000111001000111000111000000000101000000111000000011100100011100011100000100000100000011100000000110100001100010001000010000010000001110000000011010000110001000100000000101000000111000000011001000011000000010000000010100000011100000001100100001100000001000010011100000001110000000000000000111001111000001001110000000111000000000000000011100111100000100000100000011101111110010001111100000001000010000010000001110111111001000111110000000100001001001000000111000000010101101011000111100000100100100000011100000001010110101100011110000010000010000001110111111111011001110000000100001000001000000111011111111101100111000000010000000010100000011100000001000101001100010001000000001010000001110000000100010100110001000100001001001000000111011111111111111111100111100000100100100000011101111111111111111110011110000010000010000001110111111101101111111001111000001000001000000111011111110110111111100111100000000010100000011101111110100001111100010001000000001010000001110111111010000111110001000100001000001000000111000000010001010011000000010000100000100000011100000001000101001100000001000010010010000001110000000000000000111001111000001001001000000111000000000000000011100111100000000010100000011100000000000000001100010001000000001010000001110000000000000000110001000100001000001000000111000000010000000011000100010000100000100000011100000001000000001100010001000010010010000001110111111011010111110001000100001001001000000111011111101101011111000100010000100000100000011100000001001010001110011110000010000010000001110000000100101000111001111000000000101000000111000000010000000011000100010000000010100000011100000001000000001100010001000010000010000001110111111111101011111001111000001000001000000111011111111110101111100111100000100100100000011100000000000101001110001110000010010010000001110000000000010100111000111000001001110000000111000000010000000011000000010000100111000000011100000001000000001100000001000010000010000001110111111111101011111001111000001000001000000111011111111110101111100111100000100100100000011100000001110010001100010001000010010010000001110000000111001000110001000100001001110000000111011111110011011110000100010000100111000000011101111111001101111000010001000000001010000001110000000100010100101001111000000000101000000111000000010001010010100111100000000010100000011101111111111010111000000001000000001010000001110111111111101011100000000100001001110000000111000000000001010010000000010000100111000000011100000000000101001000000001000010000010000001110111111111010111100001000100001000001000000111011111111101011110000100010000100000100000011100000000000000001000000001000010000010000001110000000000000000100000000100001000001000000111000000010010100010000000010000100000100000011100000001001010001000000001000010000010000001110111111111101011100001000100001000001000000111011111111110101110000100010000000110100000011100000000111110001000011110000000011010000001110000000011111000100001111000000000101000000111000000000101000010000000010000000010100000011100000000010100001000000001000010000010000001110111111011101011101001111000001000001000000111011111101110101110100111100000100000100000011100000000001010001010011110000010000010000001110000000000101000101001111000001001001000000111011111110011011110000100010000100100100000011101111111001101111000010001000010010010000001110000000111001000100000111000001001001000000111000000011100100010000011100000100100100000011100000000000000001000000001000010010010000001110000000000000000100000000100000000101000000111000000010111100010000000010000000010100000011100000001011110001000000001000010000010000001110111111101101111101001111000001000001000000111011111110110111110100111100000100000100000011101111110110101111000010001000010000010000001110111111011010111100001000100000000101000000111000000010010100010000101100000000010100000011100000001001010001000010110000010010010000001110000000000000000100001000100001001001000000111000000000000000010000100010000100100100000011101111111110101111010011110000010010010000001110111111111010111101001111000001001001000000111000000001010100010000100010000100100100000011100000000101010001000010001000000001010000001110000000000000000100001000100000000101000000111000000000000000010000100010000000010100000011101111110110101111000000001000000001010000001110111111011010111100000000100001001110000000111000000010010100010000100010000100111000000011100000001001010001000010001000000001010000001110111111101101111101001111000000000101000000111011111110110111110100111100000100100100000011100000001011110001010011110000010010010000001110000000101111000101001111000001000001000000111011111110110101110000100010000100000100000011101111111011010111000010001000000001010000001110000000100101000101001111000000000101000000111000000010010100010100111100000100100100000011101111111011011111000000001000010010010000001110111111101101111100000000100001001001000000111000000000000000010100111100000100100100000011100000000000000001010011110000010010010000001110111111010000111100000000100001001001000000111011111101000011110000000010000000100100000011100000000111110001100010001000000010010000001110000000011111000110001000100001000001000000111000000011001000011000000010000100000100000011100000001100100001100000001000010011100000001110000000000000000111001000100001001110000000111000000000000000011100100010000100000100000011101111111011011111100000001000010000010000001110111111101101111110000000100001001001000000111000000011001000011100100010000100100100000011100000001100100001110010001000010010010000001110000000000000000111001000100001001001000000111000000000000000011100100010000100000100000011100000000000000001110011110000010000010000001110000000000000000111001111000000000101000000111000000000000000011000100010000000010100000011100000000000000001100010001000010000010000001110111111000011011111001111000001000001000000111011111100001101111100111100000100100100000 + 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111T111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 + + + + + + + + + + + + + + + + + + + diff --git a/linux/apps/Makefile b/linux/apps/Makefile new file mode 100644 index 00000000..ab32d8e2 --- /dev/null +++ b/linux/apps/Makefile @@ -0,0 +1,11 @@ + +all: simple_load upgrade_firmware + +clean: + rm -rf simple_load upgrade_firmware + +simple_load : simple_load.c + gcc -o $@ $< + +upgrade_firmware: upgrade_firmware.c + gcc -o $@ $< diff --git a/linux/apps/c4images/blink.rbf b/linux/apps/c4images/blink.rbf new file mode 100644 index 0000000000000000000000000000000000000000..06e0d8cb9708112b4331bab1691664653aa39db9 GIT binary patch literal 510858 zcmexQ0Azg!gU`P||Ni~+APi!IFo=zev565Y57G<5AoU;`hCzH72DuT0VSJbx z78Vv3m>3fi6BCRLqmku7Vjz7W8id){*w|q5AR2~2=D;va45S`}VR}IFAij{0kPwIl ziGygEIEammLFORyLGA!ykeG{$iwjI%MMXsg#0Ftl{DIVf_#g~ogD{82GJl4(+6@32!q^!oX$XMU>If=jE0FL(~OLajQIE< zJ7Dr4wIH{E!U^OKke^_3Aa{V|g@uKML1_%c78Dc|1ko@xAR5F6VGtXHL2M8Pv5~Qo zl9CcK9~*noqD70;)z#Huav(Q>u(7eRF(~XnZc0v0PKL?DXk0?#!cGJV zK=L5>fZPDWAU=!+v1#ots53-Bc7fahO0OUc;v>5QOo>K z43dM{0b+wN$Q>a2L25uWNFF2(3oj5GghBEkcY!c68^#BvEl@my_)bnvP9QZP4B~?@ z$P5q$iGgU47>EtSAiF^r#0Qlf=<*prD{2kRA{llt)2z0L&dA8e|4Y4x}E0L2MA_;Nai@nF+!magf;{HVA|G zAT=Nw#0O!JdKe#MCd^$RaSaU(4G#|w50E?vgY=4tiHXU`$jE@$adB~RAUz8wvp!fmt4?qD-9wY|CFfkBqW@cu#Y}vA9 zAUO~XG6SR)#0Rm_-2xJaVUQdMgZLmChCzH7Mi)cp!_=YYouZDp_!NLp12gL~pgVcd&P#A#NFs!Aer3G^j%zZF95Dha2 z#D-y*7(N;n|1dRja&mH@Gz;QixpL)-v$L}^$nPB;9UUMV8GCzsduL~7XT#EdMn*;k zC=bBYaC38WM@L6TgVHmoTmjXgAoGy@1`-Ehm>7r+!aYy`^2?bsXU>4~CWwsN9LOCY`$6sk zr9F@vKxG>!A00VzQ{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H=^Y%qpnZK+*)cV*^zHbPWf{4^Y=Zlz;>{ zz{WBl2|(Qf76Ann%%TZMBO72%0t^qVKt^E0Aa^3fnZV9O@WCulFfuSeYyb;D2s8nZ z-yjlT5+m(n2%y>w(gd*x#DZdo5@d@oMW9MSk&IxXvCbEw35+Z*o}zCg1jMNKM?x&) p^5bai;|iIPAU+!V +#include +#include +#include +#include +#include +#include +#include +#include + + +struct bladeRF_version { + unsigned short major; + unsigned short minor; +}; + +#define BLADERF_IOCTL_BASE 'N' +#define BLADE_QUERY_VERSION _IOR(BLADERF_IOCTL_BASE, 0, struct bladeRF_version) +#define BLADE_QUERY_FPGA_STATUS _IOR(BLADERF_IOCTL_BASE, 1, unsigned int) +#define BLADE_BEGIN_PROG _IOR(BLADERF_IOCTL_BASE, 2, unsigned int) +#define BLADE_END_PROG _IOR(BLADERF_IOCTL_BASE, 3, unsigned int) +#define BLADE_RF_RX _IOR(BLADERF_IOCTL_BASE, 4, unsigned int) + + + + +int time_past(struct timeval ref, struct timeval now) { + if (now.tv_sec > ref.tv_sec) + return 1; + + if (now.tv_sec == ref.tv_sec && now.tv_usec > ref.tv_usec) + return 1; + + return 0; +} + +#define STACK_BUFFER_SZ 1024 + +int prog_fpga(int fd, char *file) { + int ret; + int fpga_fd, nread, toread; + int programmed; + size_t bytes; + struct stat stat; + char buf[STACK_BUFFER_SZ]; + struct timeval end_time, curr_time; + int endTime; + + + fpga_fd = open(file, 0); + if (fpga_fd == -1) + return 1; + ioctl(fd, BLADE_BEGIN_PROG, &ret); + fstat(fpga_fd, &stat); + +#define min(x,y) ((x 1) { + ret = prog_fpga(fd, argv[1]); + printf("FPGA programming: %s\n", ret ? "error" : "success"); + } + + return 0; +} diff --git a/linux/apps/upgrade_firmware.c b/linux/apps/upgrade_firmware.c new file mode 100644 index 00000000..6f15eee5 --- /dev/null +++ b/linux/apps/upgrade_firmware.c @@ -0,0 +1,67 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "../../common/bladeRF.h" + +int main(int argc, char *argv[]) { + struct bladeRF_version ver; + int fd; + int ret = 0; + int val; + + fd = open("/dev/bladerf1", O_RDWR|O_CREAT|O_TRUNC, 0666); + if (fd == -1) { + printf("Can't open bladeRF\n"); + return 1; + } + + if (argc > 1) { + int fw_fd; + int nread, nidx; + struct stat fw_stat; + struct bladeRF_firmware fw_param; + + fw_fd = open(argv[1], O_RDWR); + if (fw_fd == -1) { + printf("Can't open `%s'\n", argv[1]); + return 1; + } + + if (fstat(fw_fd, &fw_stat) == -1) { + printf("Can't fstat firmware file\n"); + return 1; + } + + fw_param.len = fw_stat.st_size; + fw_param.ptr = malloc(fw_param.len); + if (!fw_param.ptr) { + printf("Can't allocate buffer\n"); + return 1; + } + + nread = fw_stat.st_size; + nidx = 0; + do { + ret = read(fw_fd, &fw_param.ptr[nidx], nread); + if (ret == -1) { + printf("Couldn't read file\n"); + return 1; + } + nread -= ret; + } while(nread); + + ret = ioctl(fd, BLADE_UPGRADE_FW, &fw_param); + printf("Upgrading fw, ptr=%p, len=%d\n", fw_param.ptr, fw_param.len); + printf("BLADE_UPGRADE_FW = %d\n", ret); + free(fw_param.ptr); + close(fw_fd); + } + + return ret; +} diff --git a/linux/kernel/Makefile b/linux/kernel/Makefile new file mode 100644 index 00000000..c4a3374b --- /dev/null +++ b/linux/kernel/Makefile @@ -0,0 +1,6 @@ +obj-m = bladeRF.o +KVERSION = $(shell uname -r) +all: + make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules +clean: + make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean diff --git a/linux/kernel/bladeRF.c b/linux/kernel/bladeRF.c new file mode 100644 index 00000000..26088f08 --- /dev/null +++ b/linux/kernel/bladeRF.c @@ -0,0 +1,598 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "../../common/bladeRF.h" + +struct data_buffer { + struct urb *urb; + void *addr; + dma_addr_t dma; +}; + +typedef struct { + struct usb_device *udev; + struct usb_interface *interface; + + int intnum; + + int rx_en; + spinlock_t data_in_lock; + unsigned int data_in_consumer_idx; + unsigned int data_in_producer_idx; + atomic_t data_in_cnt; + struct data_buffer data_in_bufs[NUM_DATA_URB]; + struct usb_anchor data_in_anchor; + wait_queue_head_t data_in_wait; + +} bladerf_device_t; + +static struct usb_driver bladerf_driver; + +// USB PID-VID table +static struct usb_device_id bladerf_table[] = { + { USB_DEVICE(USB_NUAND_VENDOR_ID, USB_NUAND_BLADERF_PRODUCT_ID) }, + { } /* Terminate entry */ +}; +MODULE_DEVICE_TABLE(usb, bladerf_table); + +static int __submit_rx_urb(bladerf_device_t *dev, unsigned int flags) { + struct urb *urb; + + urb = dev->data_in_bufs[dev->data_in_producer_idx].urb; + + dev->data_in_producer_idx++; + dev->data_in_producer_idx &= (NUM_DATA_URB - 1); + + atomic_inc(&dev->data_in_cnt); + return usb_submit_urb(urb, flags ? flags : GFP_KERNEL ); +} + +static void __bladeRF_read_cb(struct urb *urb) { + bladerf_device_t *dev; + unsigned char *buf; + + buf = (unsigned char *)urb->transfer_buffer; + dev = (bladerf_device_t *)urb->context; + + if (dev->rx_en) + __submit_rx_urb(dev, GFP_ATOMIC); + wake_up_interruptible(&dev->data_in_wait); +} + +static int bladerf_start(bladerf_device_t *dev) { + int i; + void *buf; + struct urb *urb; + + dev->rx_en = 0; + atomic_set(&dev->data_in_cnt, 0); + dev->data_in_consumer_idx = 0; + dev->data_in_producer_idx = 0; + + for (i = 0; i < NUM_DATA_URB; i++) { + buf = usb_alloc_coherent(dev->udev, DATA_BUF_SZ, + GFP_KERNEL, &dev->data_in_bufs[i].dma); + if (!buf) { + dev_err(&dev->interface->dev, "Could not allocate data IN buffer\n"); + return -1; + } + + dev->data_in_bufs[i].addr = buf; + + urb = usb_alloc_urb(0, GFP_KERNEL); + if (!buf) { + dev_err(&dev->interface->dev, "Could not allocate data IN URB\n"); + return -1; + } + + dev->data_in_bufs[i].urb = urb; + + usb_fill_bulk_urb(urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), + dev->data_in_bufs[i].addr, DATA_BUF_SZ, __bladeRF_read_cb, dev); + + urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; + urb->transfer_dma = dev->data_in_bufs[i].dma; + } + + return 0; +} + +static void bladerf_stop(bladerf_device_t *dev) { + int i; + for (i = 0; i < NUM_DATA_URB; i++) { + usb_free_coherent(dev->udev, DATA_BUF_SZ, dev->data_in_bufs[i].addr, dev->data_in_bufs[i].dma); + usb_free_urb(dev->data_in_bufs[i].urb); + } +} + +int __bladerf_snd_cmd(bladerf_device_t *dev, int cmd, void *ptr, __u16 len); +static int enable_rx(bladerf_device_t *dev) { + int ret; + int i; + unsigned int val; + val = 1; + + if (dev->intnum != 1) + return -1; + + ret = __bladerf_snd_cmd(dev, BLADE_USB_CMD_RF_RX, &val, sizeof(val)); + if (ret < 0) + goto err_out; + + ret = 0; + dev->rx_en = 1; + + for (i = 0; i < NUM_CONCURRENT; i++) { + if ((ret = __submit_rx_urb(dev, 0)) < 0) { + dev_err(&dev->interface->dev, "Error submitting initial RX URBs (%d/%d), error=%d\n", i, NUM_CONCURRENT, ret); + break; + } + } + +err_out: + return ret; +} + +static ssize_t bladerf_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) +{ + ssize_t ret = 0; + bladerf_device_t *dev; + int read; + + dev = (bladerf_device_t *)file->private_data; + if (dev->intnum != 1) { + return -1; + } + + if (!dev->rx_en) { + if (enable_rx(dev)) { + return -EINVAL; + } + } + read = 0; + + while (!read) { + if (atomic_read(&dev->data_in_cnt)) { + unsigned int idx; + + spin_lock(&dev->data_in_lock); + atomic_dec(&dev->data_in_cnt); + idx = dev->data_in_consumer_idx++; + dev->data_in_consumer_idx &= (DATA_BUF_SZ - 1); + spin_unlock(&dev->data_in_lock); + + ret = copy_to_user(buf, dev->data_in_bufs[idx].addr, DATA_BUF_SZ); + + if (!ret) + ret = DATA_BUF_SZ; + + break; + + } else { + ret = wait_event_interruptible(dev->data_in_wait, atomic_read(&dev->data_in_cnt)); + if (ret < 0) + break; + + } + } + + return ret; +} + +static ssize_t bladerf_write(struct file *file, const char *user_buf, size_t count, loff_t *ppos) +{ + bladerf_device_t *dev; + char *buf = NULL; + struct urb *urb = NULL; + int nwrote, ret; + + dev = (bladerf_device_t *)file->private_data; + + buf = kmalloc(count, GFP_KERNEL); + if (copy_from_user(buf, user_buf, count)) { + kfree(buf); + return -EFAULT; + } + + ret = usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 2), buf, count, &nwrote, 2000); + kfree(buf); + + if (ret) + return ret; + + return nwrote; +} + + +int __bladerf_rcv_cmd(bladerf_device_t *dev, int cmd, void *ptr, __u16 len) { + int tries = 3; + int retval; + + do { + retval = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), + cmd, BLADE_USB_TYPE_IN, 0, 0, + ptr, len, BLADE_USB_TIMEOUT_MS); + if (retval < 0) { + dev_err(&dev->interface->dev, "Error in %s calling usb_control_msg()" + " with error %d, %d tries left\n", __func__, retval, tries); + } + } while ((retval < 0) && --tries); + + return retval; +} + +int __bladerf_rcv_one_word(bladerf_device_t *dev, int cmd, void __user *arg) { + unsigned int buf; + int retval = -EINVAL; + + if (!arg) { + retval = -EFAULT; + goto err_out; + } + + retval = __bladerf_rcv_cmd(dev, cmd, &buf, sizeof(buf)); + + if (retval >= 0) { + buf = le32_to_cpu(buf); + retval = copy_to_user(arg, &buf, sizeof(buf)); + } + + if (retval >= 0) { + retval = 0; + } + +err_out: + return retval; +} + +int __bladerf_snd_cmd(bladerf_device_t *dev, int cmd, void *ptr, __u16 len) { + int tries = 3; + int retval; + + do { + printk("usb_control_msg(ptr=%p) len=%d\n", ptr, len); + retval = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), + cmd, BLADE_USB_TYPE_OUT, 0, 0, + ptr, len, BLADE_USB_TIMEOUT_MS); + printk("done usb_control_msg() = %d\n", retval); + if (retval < 0) { + dev_err(&dev->interface->dev, "Error in %s calling usb_control_msg()" + " with error %d, %d tries left\n", __func__, retval, tries); + } + } while ((retval < 0) && --tries); + + return retval; +} + +int __bladerf_snd_one_word(bladerf_device_t *dev, int cmd, void __user *arg) { + unsigned int buf; + int retval = -EINVAL; + + if (!arg) { + retval = -EFAULT; + goto err_out; + } + + if ((retval = copy_from_user(&buf, arg, sizeof(buf)))) + goto err_out; + buf = cpu_to_le32(buf); + + retval = __bladerf_snd_cmd(dev, cmd, &buf, sizeof(buf)); + +err_out: + return retval; +} + +long bladerf_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + bladerf_device_t *dev; + void __user *data; + struct bladeRF_version ver; + int ret; + int retval = -EINVAL; + int sz, nread, nwrite; + int sectors_to_wipe, sector_idx; + int pages_to_write, page_idx; + int pages_to_read; + int check_idx, check_error; + + unsigned char buf[1024]; + struct bladeRF_firmware brf_fw; + unsigned char *fw_buf; + + dev = file->private_data; + data = (void __user *)arg; + + + switch (cmd) { + case BLADE_QUERY_VERSION: + retval = __bladerf_rcv_cmd(dev, BLADE_USB_CMD_QUERY_VERSION, &ver, sizeof(ver)); + if (retval >= 0) { + ver.major = le16_to_cpu(ver.major); + ver.minor = le16_to_cpu(ver.minor); + retval = copy_to_user(data, &ver, sizeof(struct bladeRF_version)); + } + break; + + case BLADE_QUERY_FPGA_STATUS: + retval = __bladerf_rcv_one_word(dev, BLADE_USB_CMD_QUERY_FPGA_STATUS, data); + break; + + case BLADE_BEGIN_PROG: + if (dev->intnum != 0) { + ret = usb_set_interface(dev->udev, 0,0); + dev->intnum = 0; + } + + retval = __bladerf_rcv_one_word(dev, BLADE_USB_CMD_BEGIN_PROG, data); + break; + + case BLADE_END_PROG: + // TODO: send another 2 DCLK cycles to ensure compliance with C4's boot procedure + retval = __bladerf_rcv_one_word(dev, BLADE_USB_CMD_QUERY_FPGA_STATUS, data); + + if (!retval) { + ret = usb_set_interface(dev->udev, 1,0); + dev->intnum = 1; + } + break; + + case BLADE_UPGRADE_FW: + + if (dev->intnum != 2) { + retval = usb_set_interface(dev->udev, 2,0); + + if (retval) + break; + + dev->intnum = 2; + } + + if (copy_from_user(&brf_fw, data, sizeof(struct bladeRF_firmware))) { + return -EFAULT; + } + + brf_fw.len = ((brf_fw.len + 255) / 256) * 256; + + fw_buf = kzalloc(brf_fw.len, GFP_KERNEL); + if (!fw_buf) + goto leave_fw; + + if (copy_from_user(fw_buf, brf_fw.ptr, brf_fw.len)) { + retval = -EFAULT; + goto leave_fw; + } + + retval = -ENODEV; + + sectors_to_wipe = (brf_fw.len + 0xffff) / 0x10000; + printk("Going to wipe %d sectors\n", sectors_to_wipe); + for (sector_idx = 0; sector_idx < sectors_to_wipe; sector_idx++) { + printk("Erasing sector %d... ", sector_idx); + retval = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), + BLADE_USB_CMD_FLASH_ERASE, BLADE_USB_TYPE_IN, 0x0000, sector_idx, + &ret, 4, BLADE_USB_TIMEOUT_MS * 100); + printk("- erased\n"); + + if (retval != 4) { + goto leave_fw; + } + ret = le32_to_cpu(ret); + if (ret != 1) { + printk("Unable to erase previous sector, quitting\n"); + goto leave_fw; + } + } + + if (dev->udev->speed == USB_SPEED_HIGH) { + sz = 64; + } else if (dev->udev->speed == USB_SPEED_SUPER) { + sz = 256; + } + + pages_to_write = (brf_fw.len + 255) / 0x100; + for (page_idx = pages_to_write - 1; page_idx >= 0; page_idx--) { + nwrite = 0; + do { + retval = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), + BLADE_USB_CMD_FLASH_WRITE, BLADE_USB_TYPE_OUT, 0x0000, page_idx, + &fw_buf[page_idx * 256 + nwrite], sz, BLADE_USB_TIMEOUT_MS); + nwrite += sz; + } while (nwrite != 256); + } + + pages_to_read = (brf_fw.len + 255) / 0x100; + + check_error = 0; + for (page_idx = 0; page_idx < pages_to_read; page_idx++) { + nread = 0; + do { + retval = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), + BLADE_USB_CMD_FLASH_READ, BLADE_USB_TYPE_IN, 0x0000, page_idx, + &buf[nread], sz, BLADE_USB_TIMEOUT_MS); + nread += sz; + } while (nread != 256); + + for (check_idx = 0; check_idx < 256; check_idx++) { + if (buf[check_idx] != fw_buf[page_idx * 256 + check_idx]) { + printk("ERROR: bladeRF firmware verification detected a mismatch at byte offset 0x%.8x\n", page_idx * 256 + check_idx); + printk("ERROR: expected byte 0x%.2X, got 0x%.2X\n", fw_buf[page_idx * 256 + check_idx], buf[check_idx]); + check_error = 1; + goto leave_fw; + } + } + } + retval = 0; + printk("SUCCESSFULLY VERIFIED\n"); + +leave_fw: + kfree(fw_buf); + break; + + case BLADE_CHECK_PROG: + retval = 0; + printk("ok %d\n", dev->intnum); + if (dev->intnum == 0) { + retval = __bladerf_rcv_cmd(dev, BLADE_USB_CMD_QUERY_FPGA_STATUS, &ret, sizeof(ret)); + printk("retval =%d ret=%d\n", retval, ret); + if (retval >= 0 && ret) { + retval = 0; + ret = usb_set_interface(dev->udev, 1,0); + dev->intnum = 1; + retval = copy_to_user((void __user *)arg, &ret, sizeof(ret)); + printk("ok changed intf\n"); + } + } + break; + + case BLADE_RF_RX: + if (dev->intnum != 1) { + dev_err(&dev->interface->dev, "Cannot enable RX from config mode\n"); + retval = -1; + break; + } + + printk("RF_RX!\n"); + retval = __bladerf_snd_one_word(dev, BLADE_USB_CMD_RF_RX, data); + break; + + case BLADE_RF_TX: + if (dev->intnum != 1) { + dev_err(&dev->interface->dev, "Cannot enable TX from config mode\n"); + retval = -1; + break; + } + + printk("RF_TX!\n"); + retval = __bladerf_snd_one_word(dev, BLADE_USB_CMD_RF_TX, data); + break; + } + + return retval; +} + +static int bladerf_open(struct inode *inode, struct file *file) +{ + bladerf_device_t *dev; + struct usb_interface *interface; + int subminor; + + subminor = iminor(inode); + + interface = usb_find_interface(&bladerf_driver, subminor); + if (interface == NULL) { + pr_err("%s - error, cannot find device for minor %d\n", __func__, subminor); + return -ENODEV; + } + + dev = usb_get_intfdata(interface); + if (dev == NULL) { + return -ENODEV; + } + + file->private_data = dev; + + return 0; +} + +static int bladerf_release(struct inode *inode, struct file *file) +{ + return 0; +} + +static struct file_operations bladerf_fops = { + .owner = THIS_MODULE, + .read = bladerf_read, + .write = bladerf_write, + .unlocked_ioctl = bladerf_ioctl, + .open = bladerf_open, + .release = bladerf_release, +}; + + +#define USB_NUAND_BLADERF_MINOR_BASE 193 + +static struct usb_class_driver bladerf_class = { + .name = "bladerf%d", + .fops = &bladerf_fops, + .minor_base = USB_NUAND_BLADERF_MINOR_BASE, +}; + +static int bladerf_probe(struct usb_interface *interface, + const struct usb_device_id *id) +{ + bladerf_device_t *dev; + int retval; + + dev = kzalloc(sizeof(bladerf_device_t), GFP_KERNEL); + if (dev == NULL) { + dev_err(&interface->dev, "Out of memory\n"); + goto error_oom; + } + + + spin_lock_init(&dev->data_in_lock); + dev->udev = usb_get_dev(interface_to_usbdev(interface)); + dev->interface = interface; + dev->intnum = 0; + + init_usb_anchor(&dev->data_in_anchor); + init_waitqueue_head(&dev->data_in_wait); + + bladerf_start(dev); + + usb_set_intfdata(interface, dev); + + retval = usb_register_dev(interface, &bladerf_class); + if (retval) { + dev_err(&interface->dev, "Unable to get a minor device number for bladeRF device\n"); + usb_set_intfdata(interface, NULL); + return retval; + } + + dev_info(&interface->dev, "Nuand bladeRF device is now attached\n"); + return 0; + +error_oom: + return -ENOMEM; +} + +static void bladerf_disconnect(struct usb_interface *interface) +{ + bladerf_device_t *dev; + + dev = usb_get_intfdata(interface); + + bladerf_stop(dev); + + usb_deregister_dev(interface, &bladerf_class); + + usb_set_intfdata(interface, NULL); + + usb_put_dev(dev->udev); + + dev_info(&interface->dev, "Nuand bladeRF device has been disconnected\n"); + + kfree(dev); +} + +static struct usb_driver bladerf_driver = { + .name = "nuand_bladerf", + .probe = bladerf_probe, + .disconnect = bladerf_disconnect, + .id_table = bladerf_table, +}; + +module_usb_driver(bladerf_driver); + +MODULE_AUTHOR("Robert Ghilduta "); +MODULE_DESCRIPTION("bladeRF USB driver"); +MODULE_VERSION("v0.1"); +MODULE_LICENSE("GPL"); diff --git a/linux/kernel/bladeRF.h b/linux/kernel/bladeRF.h new file mode 100644 index 00000000..c297ddd6 --- /dev/null +++ b/linux/kernel/bladeRF.h @@ -0,0 +1,48 @@ + +#define BLADERF_IOCTL_BASE 'N' +#define BLADE_QUERY_VERSION _IOR(BLADERF_IOCTL_BASE, 0, struct bladeRF_version) +#define BLADE_QUERY_FPGA_STATUS _IOR(BLADERF_IOCTL_BASE, 1, unsigned int) +#define BLADE_BEGIN_PROG _IOR(BLADERF_IOCTL_BASE, 2, unsigned int) +#define BLADE_END_PROG _IOR(BLADERF_IOCTL_BASE, 3, unsigned int) +#define BLADE_CHECK_PROG _IOR(BLADERF_IOCTL_BASE, 4, unsigned int) +#define BLADE_RF_RX _IOR(BLADERF_IOCTL_BASE, 5, unsigned int) +#define BLADE_RF_TX _IOR(BLADERF_IOCTL_BASE, 6, unsigned int) + +#define BLADE_UPGRADE_FW _IOR(BLADERF_IOCTL_BASE, 50, unsigned int) + +#define BLADE_USB_CMD_QUERY_VERSION 0 +#define BLADE_USB_CMD_QUERY_FPGA_STATUS 1 +#define BLADE_USB_CMD_BEGIN_PROG 2 +#define BLADE_USB_CMD_END_PROG 3 +#define BLADE_USB_CMD_RF_RX 4 +#define BLADE_USB_CMD_RF_TX 5 +#define BLADE_USB_CMD_FLASH_READ 100 +#define BLADE_USB_CMD_FLASH_WRITE 101 +#define BLADE_USB_CMD_FLASH_ERASE 102 + +#define BLADE_USB_CMD_QUERY_VERSION 0 +#define BLADE_USB_CMD_QUERY_FPGA_STATUS 1 +#define BLADE_USB_CMD_BEGIN_PROG 2 +#define BLADE_USB_CMD_END_PROG 3 +#define BLADE_USB_CMD_RF_RX 4 + +struct bladeRF_version { + unsigned short major; + unsigned short minor; +}; + +struct bladeRF_firmware { + unsigned int len; + unsigned char *ptr; +}; + +#define BLADE_USB_TYPE_OUT 0x40 +#define BLADE_USB_TYPE_IN 0xC0 +#define BLADE_USB_TIMEOUT_MS 1000 + +#define USB_NUAND_VENDOR_ID 0x04b4 +#define USB_NUAND_BLADERF_PRODUCT_ID 0x00f1 +#define NUM_CONCURRENT 8 +#define NUM_DATA_URB (128) +#define DATA_BUF_SZ (1024*4) +