├── .github └── ISSUE_TEMPLATE │ └── issue-description.md ├── .gitmodules ├── CONTRIBUTING.md ├── LICENSE ├── LICENSES ├── AGPL-3.0-or-later.txt ├── BSD-3-Clause.txt ├── GPL-2.0-or-later.txt └── ISC.txt ├── README.md ├── doc ├── AnSIC-sensing-correction.png ├── README.md ├── app_notes │ ├── 40mhz.png │ ├── 40mhz.png.license │ ├── README.md │ ├── ad-hoc-two-sdr.md │ ├── ap-client-two-sdr.md │ ├── csi-architecture.jpg │ ├── csi-architecture.jpg.license │ ├── csi-fuzzer-beacon-ant-back-0.jpg │ ├── csi-fuzzer-beacon-ant-back-1-45-0-13.jpg │ ├── csi-fuzzer-implementation.png │ ├── csi-fuzzer-principle.png │ ├── csi-fuzzer-system-before-vs-now.png │ ├── csi-information-format.jpg │ ├── csi-information-format.jpg.license │ ├── csi-screen-shot-radar-matlab.jpg │ ├── csi-screen-shot-radar.jpg │ ├── csi-screen-shot.jpg │ ├── csi-screen-shot.jpg.license │ ├── csi.md │ ├── csi_fuzzer.md │ ├── driver_stat.md │ ├── drv_fpga_dynamic_loading.md │ ├── frequent_trick.md │ ├── guard-interval.png │ ├── guard-interval.png.license │ ├── hls.md │ ├── ieee80211n.md │ ├── inject_80211.md │ ├── iq-architecture.jpg │ ├── iq-architecture.jpg.license │ ├── iq-capture-parameter.jpg │ ├── iq-capture-parameter.jpg.license │ ├── iq-information-format.jpg │ ├── iq-information-format.jpg.license │ ├── iq-screen-shot.jpg │ ├── iq-screen-shot.jpg.license │ ├── iq.md │ ├── iq_2ant-screen-shot.jpg │ ├── iq_2ant-screen-shot.jpg.license │ ├── iq_2ant-setup.png │ ├── iq_2ant-setup.png.license │ ├── iq_2ant.md │ ├── mimo.png │ ├── mimo.png.license │ ├── mpdu-aggr.png │ ├── mpdu-aggr.png.license │ ├── openwifi-csi-fpga-loopback.jpg │ ├── openwifi-iq-loopback.jpg │ ├── openwifi-loopback-principle.jpg │ ├── openwifi-radar.jpg │ ├── packet-iq-self-loopback-test.md │ ├── perf_counter.md │ ├── radar-self-csi.md │ ├── sensing.png │ ├── subcarriers.png │ └── subcarriers.png.license ├── asic │ └── skywater-130-pdk-and-asic-considerations.md ├── bb-clk.jpg ├── cite-openwifi-github-code.md ├── cite-openwifi-vtc-paper.md ├── img_build_instruction │ └── kuiper.md ├── known_issue │ └── notter.md ├── openwifi-detail.jpg ├── openwifi-detail.jpg.license ├── publications.md ├── rf-digital-if-chain-config.jpg ├── rf-digital-if-chain-config.jpg.license ├── rf-digital-if-chain-spectrum.jpg ├── rf-digital-if-chain-spectrum.jpg.license └── videos.md ├── driver ├── Makefile ├── hw_def.h ├── make_all.sh ├── openofdm_rx │ ├── Makefile │ └── openofdm_rx.c ├── openofdm_tx │ ├── Makefile │ └── openofdm_tx.c ├── rx_intf │ ├── Makefile │ └── rx_intf.c ├── sdr.c ├── sdr.h ├── sdrctl_intf.c ├── side_ch │ ├── Makefile │ ├── make_driver.sh │ ├── side_ch.c │ └── side_ch.h ├── sysfs_intf.c ├── tx_intf │ ├── Makefile │ └── tx_intf.c ├── xilinx_dma │ ├── README.md │ ├── make_xilinx_dma.sh │ └── xilinx_dma.c └── xpu │ ├── Makefile │ └── xpu.c ├── kernel_boot ├── 10-network-device.rules ├── 70-persistent-net.rules ├── 72113-files.zip ├── ad9361.patch ├── ad9361_conv.patch ├── axi_hdmi_crtc.patch ├── boards │ ├── adrv9361z7035 │ │ ├── devicetree.dtb │ │ ├── devicetree.dts │ │ └── u-boot.elf │ ├── adrv9361z7035_fmc │ │ ├── devicetree.dts │ │ └── u-boot.elf │ ├── adrv9364z7020 │ │ ├── devicetree.dtb │ │ ├── devicetree.dts │ │ └── u-boot.elf │ ├── antsdr │ │ ├── devicetree.dtb │ │ ├── devicetree.dts │ │ ├── notes.md │ │ └── u-boot.elf │ ├── antsdr_e200 │ │ ├── README.assets │ │ │ └── e200_struct.svg │ │ ├── README.md │ │ ├── devicetree.dtb │ │ ├── devicetree.dts │ │ └── u-boot.elf │ ├── e310v2 │ │ ├── README.assets │ │ │ └── struct.png │ │ ├── README.md │ │ ├── devicetree.dtb │ │ ├── devicetree.dts │ │ └── u-boot.elf │ ├── neptunesdr │ │ ├── devicetree.dtb │ │ ├── devicetree.dts │ │ └── u-boot.elf │ ├── sdrpi │ │ ├── devicetree.dtb │ │ ├── devicetree.dts │ │ ├── notes.md │ │ └── u-boot.elf │ ├── zc702_fmcs2 │ │ ├── devicetree.dtb │ │ ├── devicetree.dts │ │ └── u-boot.elf │ ├── zc706_fmcs2 │ │ ├── devicetree.dtb │ │ ├── devicetree.dts │ │ └── u-boot.elf │ ├── zcu102_fmcs2 │ │ ├── bl31.elf │ │ ├── system.dtb │ │ ├── system.dts │ │ └── u-boot_xilinx_zynqmp_zcu102_revA.elf │ └── zed_fmcs2 │ │ ├── devicetree.dtb │ │ ├── devicetree.dts │ │ └── u-boot.elf ├── build_boot_bin.sh ├── build_zynqmp_boot_bin.sh ├── kernel_config ├── kernel_config_zynqmp └── kernel_patch_readme.md ├── openwifi-arch.jpg ├── openwifi-arch.jpg.license └── user_space ├── arbitrary_iq_gen ├── iq_single_carrier_1000000Hz_512.bin ├── iq_single_carrier_1000000Hz_512.txt └── single_carrier_gen.m ├── boot_bin_gen.sh ├── build_wpa_supplicant_wo11b.sh ├── cd_adi_iio_dir.sh ├── check_calib_inf.sh ├── csi_fuzzer.sh ├── csi_fuzzer_scan.sh ├── cw_disable.sh ├── cw_max_min_cfg.sh ├── dhcpd.conf ├── difs_disable.sh ├── driver_nl80211.patch ├── drv_and_fpga_package_gen.sh ├── eifs_by_last_rx_fail_disable.sh ├── eifs_by_last_tx_fail_disable.sh ├── eifs_disable.sh ├── fast_reg_log ├── fast_reg_log.c └── fast_reg_log_analyzer.m ├── fosdem-11ag.sh ├── fosdem.sh ├── hostapd-openwifi-11ag.conf ├── hostapd-openwifi.conf ├── inject_80211 ├── Makefile ├── analyze_80211.c ├── ieee80211_radiotap.h ├── inject_80211.c ├── inject_80211.h ├── inject_80211.sh ├── radiotap.c ├── radiotap.h ├── unaligned.h └── uthash.h ├── link_perf_test.sh ├── load_fpga_img.sh ├── monitor_ch.sh ├── nav_disable.sh ├── nic_back_to_normal.sh ├── openwifi_ad9361_fir.ftr ├── openwifi_ad9361_fir_tx_0MHz.ftr ├── openwifi_ad9361_fir_tx_0MHz_11n.ftr ├── openwifi_ad9361_fir_tx_0MHz_11n_narrow1.ftr ├── populate_kernel_image_module_reboot.sh ├── post_config.sh ├── prepare_kernel.sh ├── rf_init.sh ├── rf_init_11n.sh ├── rssi_ad9361_show.sh ├── rssi_openwifi_show.sh ├── rx_gain_show.sh ├── rx_stat_show.sh ├── sdcard_boot_update.sh ├── sdr-ad-hoc-join.sh ├── sdr-ad-hoc-up.sh ├── sdrctl_src ├── Makefile ├── cmd.c ├── nl80211.h ├── nl80211_testmode_def.h ├── sdrctl.c ├── sdrctl.h ├── sections.c └── version.sh ├── set_dbg_ch0.sh ├── set_dbg_ch1.sh ├── set_dbg_ch2.sh ├── set_lbt_th.sh ├── set_restrict_freq.sh ├── set_rx_gain_auto.sh ├── set_rx_gain_manual.sh ├── set_rx_monitor_all.sh ├── set_rx_target_sender_mac_addr.sh ├── set_tx_lo.sh ├── set_tx_port.sh ├── setup_once.sh ├── side_ch_ctl_src ├── iq_capture.py ├── iq_capture_2ant.py ├── save_iq_to_txt_for_verilog_sim.m ├── side_ch_ctl.c ├── side_info_display.py ├── test_iq_2ant_file_display.m ├── test_iq_file_display.m └── test_side_info_file_display.m ├── slice_cfg.sh ├── stat_enable.sh ├── system_top.bif ├── transfer_driver_userspace_to_board.sh ├── transfer_kernel_image_module_to_board.sh ├── tx_intf_iq_data_to_sysfs.sh ├── tx_intf_iq_send.sh ├── tx_prio_queue_show.sh ├── tx_stat_show.sh ├── update_sdcard.sh ├── webserver ├── index.html ├── openwifi-detail.jpg ├── openwifi-detail.jpg.license ├── openwifi-logo-small.jpg └── openwifi-logo-small.jpg.license ├── wgd.sh ├── wpa-connect.conf ├── wpa-openwifi.conf └── wpa-testap.conf /.github/ISSUE_TEMPLATE/issue-description.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Issue description 3 | about: Please report issue by this template 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 0. Could you send email to xianjun.jiao@ugent.be to introduce your self? 11 | 12 | 1. Our image is used directly or you build your own image? 13 | 14 | 2. What is your own modification? 15 | 16 | 3. Versions: OS, Vivado, openwifi/openwifi-hw repo branch and commit revision 17 | 18 | 4. Board/hardware type 19 | 20 | 5. WiFi channel number 21 | 22 | 6. Steps to reproduce the issue, and the related error message, screenshot, etc 23 | 24 | 7. Describe your debug efforts by Linux native tools, such as tcpdump and "cat /proc/interrupts" 25 | 26 | 8. Describe your debug efforts by: https://github.com/open-sdr/openwifi/blob/master/doc/README.md#Debug-methods 27 | 28 | 9. Any other thing we need to know for helping you better? 29 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "adi-linux"] 2 | path = adi-linux 3 | url = https://github.com/analogdevicesinc/linux.git 4 | [submodule "adi-linux-64"] 5 | path = adi-linux-64 6 | url = https://github.com/analogdevicesinc/linux.git 7 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | CLA([Individual](https://github.com/open-sdr/openwifi-hw-img/raw/master/doc_repo/openwifi-Individual.pdf), [Entity](https://github.com/open-sdr/openwifi-hw-img/raw/master/doc_repo/openwifi-Entity.pdf)) needs to be signed and sent to Filip.Louagie@UGent.be before you contributing. 8 | 9 | CLA is generated by the [Project Harmony](http://www.harmonyagreements.org/index.html). 10 | -------------------------------------------------------------------------------- /LICENSES/BSD-3-Clause.txt: -------------------------------------------------------------------------------- 1 | Modified BSD license (no advertisement clause): 2 | 3 | Copyright (c) 2002-2017, Jouni Malinen and contributors 4 | All Rights Reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are 8 | met: 9 | 10 | 1. Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 17 | 3. Neither the name(s) of the above-listed copyright holder(s) nor the 18 | names of its contributors may be used to endorse or promote products 19 | derived from this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | -------------------------------------------------------------------------------- /LICENSES/ISC.txt: -------------------------------------------------------------------------------- 1 | Copyright 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 4 | 5 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 6 | -------------------------------------------------------------------------------- /doc/AnSIC-sensing-correction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/AnSIC-sensing-correction.png -------------------------------------------------------------------------------- /doc/app_notes/40mhz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/40mhz.png -------------------------------------------------------------------------------- /doc/app_notes/40mhz.png.license: -------------------------------------------------------------------------------- 1 | # Author: Xianjun jiao 2 | 3 | # SPDX-FileCopyrightText: 2019 UGent 4 | # SPDX-License-Identifier: AGPL-3.0-or-later 5 | -------------------------------------------------------------------------------- /doc/app_notes/README.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | Application notes collect many small topics about using openwifi in different scenarios/modes. 8 | 9 | - [Use openwifi on the w-iLab.t testbed remotely](https://doc.ilabt.imec.be/ilabt/wilab/tutorials/openwifi.html) 10 | - [Communication between two SDR boards under AP and client mode](ap-client-two-sdr.md) 11 | - [Communication between two SDR boards under ad-hoc mode](ad-hoc-two-sdr.md) 12 | - [From CSI (Channel State Information) to CSI (Chip State Information)](csi.md) 13 | - [WiFi CSI radar via self CSI capturing](radar-self-csi.md) 14 | - [Capture IQ sample, AGC gain, RSSI with many types of trigger condition](iq.md) 15 | - [Capture dual antenna TX/RX IQ for multi-purpose (capture collision)](iq_2ant.md) 16 | - [WiFi packet, CSI and IQ sample self loopback test (over-the-air and FPGA internal)](packet-iq-self-loopback-test.md) 17 | - [IEEE 802.11n (Wi-Fi 4)](ieee80211n.md) 18 | - [802.11 packet injection and fuzzing](inject_80211.md) 19 | - [CSI fuzzer](csi_fuzzer.md) 20 | - [Access counter/statistics in FPGA](perf_counter.md) 21 | - [Access counter/statistics in driver](driver_stat.md) 22 | - [Frequent/usual trick on controlling Gain/Att/Frequency/CCA/LBT/CSMA/CW/Sensitivity/etc](frequent_trick.md) 23 | - [Driver and FPGA dynamic reloading](drv_fpga_dynamic_loading.md) 24 | - [owfuzz: a WiFi protocol fuzzing tool using openwifi.](https://github.com/alipay/WiFi-Protocol-Fuzzing-Tool) [[**Vulnerabilities**]](https://github.com/alipay/Owfuzz#discovered-vulnerabilities) 25 | - [Build FPGA with High-Level Synthesis modules](hls.md) 26 | -------------------------------------------------------------------------------- /doc/app_notes/ad-hoc-two-sdr.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | **NOTE** the terminal session mentioned in the following text can also be setup via USB-UART instead of Ethernet. 8 | 9 | **NOTE** adrv9361z7035 has ultra low TX power in 5GHz. Move **CLOSER** when you use that board in 5GHz!!! 10 | 11 | - Power on two SDR boards. Call one board "adhoc1" and the other "adhoc2". On each board, the TX and RX antenna should vertical/orthogonal to each other as much as possible to gain a good TX/RX isolation. 12 | - Connect a computer to the adhoc1 via Ethernet cable. The computer should have static IP 192.168.10.1. Open a terminal on the computer, and then in the terminal: 13 | ``` 14 | ssh root@192.168.10.122 15 | (password: openwifi) 16 | service network-manager stop 17 | cd openwifi 18 | ./wgd.sh 19 | (Wait for the script completed) 20 | ifconfig sdr0 up 21 | ./sdr-ad-hoc-up.sh sdr0 44 192.168.13.1 22 | (Above command setup ad-hoc network at channel 44 with static IP assigned to sdr0 NIC) 23 | iwconfig sdr0 24 | ``` 25 | - You should see output like: 26 | ``` 27 | sdr0 IEEE 802.11 ESSID:"sdr-ad-hoc" 28 | Mode:Ad-Hoc Frequency:5.22 GHz Cell: 92:CA:14:27:1E:B0 29 | Tx-Power=20 dBm 30 | Retry short limit:7 RTS thr:off Fragment thr:off 31 | Encryption key:off 32 | Power Management:off 33 | ``` 34 | If you see "Cell: Not-Associated", please wait and run "iwconfig sdr0" again until a randomly generated Cell ID appears. 35 | 36 | - Connect another computer to the adhoc2 via Ethernet cable. The computer should have static IP 192.168.10.1. Open a terminal on the computer, and then in the terminal: 37 | ``` 38 | ssh root@192.168.10.122 39 | (password: openwifi) 40 | service network-manager stop 41 | cd openwifi 42 | ./wgd.sh 43 | ifconfig sdr0 up 44 | ./sdr-ad-hoc-up.sh sdr0 44 192.168.13.2 45 | iwconfig sdr0 46 | ``` 47 | - You should see output like: 48 | ``` 49 | sdr0 IEEE 802.11 ESSID:"sdr-ad-hoc" 50 | Mode:Ad-Hoc Frequency:5.22 GHz Cell: 92:CA:14:27:1E:B0 51 | Tx-Power=20 dBm 52 | Retry short limit:7 RTS thr:off Fragment thr:off 53 | Encryption key:off 54 | Power Management:off 55 | ``` 56 | The "Cell: 92:CA:14:27:1E:B0" should be the same as adhoc1, because the later joined node should discover the Cell ID of the existing network and join/get it automatically. If not, please adjust the antenna/distance and re-run the commands. 57 | 58 | Now the communication link should be already setup between the two ad-hoc nodes, and you can ping each other. 59 | -------------------------------------------------------------------------------- /doc/app_notes/ap-client-two-sdr.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | **NOTE** the terminal session mentioned in the following text can also be setup via USB-UART instead of Ethernet. 8 | 9 | **NOTE** adrv9361z7035 has ultra low TX power in 5GHz. Move **CLOSER** when you use that board in 5GHz!!! 10 | 11 | - Power on two SDR boards. Call one board "AP board" and the other "client board". On each board, the TX and RX antenna should vertical/orthogonal to each other as much as possible to gain a good TX/RX isolation. 12 | - Connect a computer to the AP board via Ethernet cable. The computer should have static IP 192.168.10.1. Open a terminal on the computer, and then in the terminal: 13 | ``` 14 | ssh root@192.168.10.122 15 | (password: openwifi) 16 | cd openwifi 17 | ./fosdem.sh 18 | (It will create a WiFi AP by hostapd program with config file: hostapd-openwifi.conf) 19 | (Wait for the script completed) 20 | cat /proc/interrupts 21 | (Execute the "cat ..." command for several times) 22 | (You should see the number of "sdr,tx_itrpt1" grows, because it sends the "openwifi" beacon periodically) 23 | ``` 24 | - Connect another computer to the client board via Ethernet cable. The computer should have static IP 192.168.10.1. Open a terminal on the computer, and then in the terminal: 25 | ``` 26 | ssh root@192.168.10.122 27 | (password: openwifi) 28 | service network-manager stop 29 | cd openwifi 30 | ./wgd.sh 31 | (Wait for the script completed) 32 | ifconfig sdr0 up 33 | iwlist sdr0 scan 34 | (The "openwifi" AP should be listed in the scanning results) 35 | wpa_supplicant -i sdr0 -c wpa-openwifi.conf 36 | ("iwconfig sdr0 essid openwifi" could also work. Less info compared to wpa_supplicant) 37 | ``` 38 | If wpa-openwifi.conf is not on board, please create it with [this content](../../user_space/wpa-openwifi.conf). 39 | - Now the client is trying to associate with the AP. You should see like: 40 | ``` 41 | root@analog:~/openwifi# wpa_supplicant -i sdr0 -c wpa-openwifi.conf 42 | Successfully initialized wpa_supplicant 43 | sdr0: CTRL-EVENT-SCAN-STARTED 44 | sdr0: SME: Trying to authenticate with 66:55:44:33:22:8c (SSID='openwifi' freq=5220 MHz) 45 | sdr0: Trying to associate with 66:55:44:33:22:8c (SSID='openwifi' freq=5220 MHz) 46 | sdr0: Associated with 66:55:44:33:22:8c 47 | sdr0: CTRL-EVENT-CONNECTED - Connection to 66:55:44:33:22:8c completed [id=0 id_str=] 48 | ``` 49 | The AP board terminal should print like: 50 | ``` 51 | ... 52 | sdr0: STA 66:55:44:33:22:4c IEEE 802.11: authenticated 53 | sdr0: STA 66:55:44:33:22:4c IEEE 802.11: associated (aid 1) 54 | sdr0: AP-STA-CONNECTED 66:55:44:33:22:4c 55 | sdr0: STA 66:55:44:33:22:4c RADIUS: starting accounting session 613E16DE-00000000 56 | ``` 57 | If not, please adjust antenna/distance and re-run the commands on the client side. 58 | 59 | - After association is done, in another terminal of client (**DO NOT** terminate wpa_supplicant in the original client terminal!): 60 | ``` 61 | dhclient sdr0 62 | (Wait for it completed) 63 | ifconfig sdr0 64 | (Now you should see the IP address like 192.168.13.x allocated by AP) 65 | ping 192.168.13.1 66 | (Ping the AP) 67 | ``` 68 | Now the communication link should be already setup between the AP and the client. 69 | -------------------------------------------------------------------------------- /doc/app_notes/csi-architecture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/csi-architecture.jpg -------------------------------------------------------------------------------- /doc/app_notes/csi-architecture.jpg.license: -------------------------------------------------------------------------------- 1 | # Author: Xianjun jiao 2 | 3 | # SPDX-FileCopyrightText: 2019 UGent 4 | # SPDX-License-Identifier: AGPL-3.0-or-later 5 | -------------------------------------------------------------------------------- /doc/app_notes/csi-fuzzer-beacon-ant-back-0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/csi-fuzzer-beacon-ant-back-0.jpg -------------------------------------------------------------------------------- /doc/app_notes/csi-fuzzer-beacon-ant-back-1-45-0-13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/csi-fuzzer-beacon-ant-back-1-45-0-13.jpg -------------------------------------------------------------------------------- /doc/app_notes/csi-fuzzer-implementation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/csi-fuzzer-implementation.png -------------------------------------------------------------------------------- /doc/app_notes/csi-fuzzer-principle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/csi-fuzzer-principle.png -------------------------------------------------------------------------------- /doc/app_notes/csi-fuzzer-system-before-vs-now.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/csi-fuzzer-system-before-vs-now.png -------------------------------------------------------------------------------- /doc/app_notes/csi-information-format.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/csi-information-format.jpg -------------------------------------------------------------------------------- /doc/app_notes/csi-information-format.jpg.license: -------------------------------------------------------------------------------- 1 | # Author: Xianjun jiao 2 | 3 | # SPDX-FileCopyrightText: 2019 UGent 4 | # SPDX-License-Identifier: AGPL-3.0-or-later 5 | -------------------------------------------------------------------------------- /doc/app_notes/csi-screen-shot-radar-matlab.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/csi-screen-shot-radar-matlab.jpg -------------------------------------------------------------------------------- /doc/app_notes/csi-screen-shot-radar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/csi-screen-shot-radar.jpg -------------------------------------------------------------------------------- /doc/app_notes/csi-screen-shot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/csi-screen-shot.jpg -------------------------------------------------------------------------------- /doc/app_notes/csi-screen-shot.jpg.license: -------------------------------------------------------------------------------- 1 | # Author: Xianjun jiao 2 | 3 | # SPDX-FileCopyrightText: 2019 UGent 4 | # SPDX-License-Identifier: AGPL-3.0-or-later 5 | -------------------------------------------------------------------------------- /doc/app_notes/csi_fuzzer.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | - [ACM WiSec 2021. Openwifi CSI fuzzer for authorized sensing and covert channels](https://dl.acm.org/doi/pdf/10.1145/3448300.3468255) 8 | - [Privacy Protection in WiFi Sensing via CSI Fuzzing](https://ieeexplore.ieee.org/abstract/document/10818006) 9 | 10 | CSI (Channel State Information) of WiFi systems is available in some WiFi chips and can be used for sensing the environment (keystrokes, people, object) passively and secretly. 11 | 12 | ## Concept 13 | 14 | How could a CSI fuzzer stop unauthorized sensing? 15 | 16 | ![](./csi-fuzzer-system-before-vs-now.png) 17 | 18 | CSI fuzzer implementation principle. 19 | 20 | ![](./csi-fuzzer-principle.png) 21 | 22 | ## Demo instructions 23 | 24 | Thanks to the full-duplex capability and CSI extraction feature of openwifi, you can monitor the artificial channel response via [side channel](./csi.md) by Tx-Rx over the air coupling without affecting the normal operation/traffic of openwifi. Before fuzzing the CSI, please follow [WiFi CSI radar via self CSI capturing](radar-self-csi.md) app note to setup normal self CSI monitoring. 25 | 26 | Then, start another ssh session to the openwifi board: 27 | ``` 28 | ssh root@192.168.10.122 29 | (password: openwifi) 30 | 31 | cd openwifi 32 | 33 | ./csi_fuzzer_scan.sh 1 34 | (CSI fuzzer applies possible artificial CSI by scanning all values) 35 | (csi_fuzzer.sh is called. Please read both scripts to understand these commands) 36 | ``` 37 | 38 | Now you should see that CSI keeps changing like in this [video](https://youtu.be/aOPYwT77Qdw). 39 | 40 | # Further explanation on parameters 41 | 42 | CSI fuzzer in openwifi system architecture and related commands. 43 | 44 | ![](./csi-fuzzer-implementation.png) 45 | 46 | # Example fuzzed CSI 47 | 48 | CSI self-monitoring before fuzzing. 49 | 50 | ![](./csi-fuzzer-beacon-ant-back-0.jpg) 51 | 52 | CSI self-monitoring after fuzzing command: `./csi_fuzzer.sh 1 45 0 13` 53 | 54 | ![](./csi-fuzzer-beacon-ant-back-1-45-0-13.jpg) 55 | 56 | `csi_fuzzer_scan.sh` can scan the c1 and c2 in different styles/modes by calling `csi_fuzzer.sh`. 57 | -------------------------------------------------------------------------------- /doc/app_notes/guard-interval.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/guard-interval.png -------------------------------------------------------------------------------- /doc/app_notes/guard-interval.png.license: -------------------------------------------------------------------------------- 1 | # Author: Michael Mehari 2 | 3 | # SPDX-FileCopyrightText: 2019 UGent 4 | # SPDX-License-Identifier: AGPL-3.0-or-later 5 | -------------------------------------------------------------------------------- /doc/app_notes/hls.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | FCCM2023 Poster: [Thijs Havinga, et al. Accelerating FPGA-Based Wi-Fi Transceiver Design and Prototyping by High-Level Synthesis](https://github.com/open-sdr/openwifi-hw-img/raw/master/doc_repo/Thijs-FCCM2023-poster.jpg) 8 | 9 | [Longer/detailed info about the poster](https://arxiv.org/abs/2305.13351) 10 | 11 | In order to speed up or ease FPGA development, it is possible to use High-Level Synthesis (HLS) for creating core baseband processing modules of openwifi. We have already programmed the receiver modules channel estimation and equalization in C++ and converted to Verilog using Vitis HLS. In order to use openwifi with these HLS modules, follow the [build instructions](#build-instructions). 12 | In order to modify these modules within Vitis HLS, follow [the instructions below](#modify-the-code-using-vitis-hls). 13 | 14 | ## Build instructions 15 | 16 | Follow the [Build FPGA](https://github.com/open-sdr/openwifi-hw#build-fpga) instructions till before generating ip_repo. In order to switch to the HLS-version of openofdm_rx, use the following commands: 17 | 18 | ``` 19 | cd ip/openofdm_rx 20 | git checkout dot11zynq_hls 21 | ``` 22 | 23 | Now continue with the instructions. Before generating the bitstream, update the openofdm_rx IP by making sure it is selected under "IP Status" and click "Upgrade Selected". Afterwards, continue with the instructions to generate the bitstream. 24 | 25 | ## Modify the code using Vitis HLS 26 | When in the `openwifi-hw` folder, make sure to run: 27 | ``` 28 | ./get_ip_openofdm_rx.sh 29 | cd ip/openofdm_rx 30 | git checkout dot11zynq_hls 31 | ``` 32 | Then start Vitis HLS and create a new project. Import either all source files (except those ending on '_test.cpp') in the [ch_gain_cal](https://github.com/open-sdr/openofdm/tree/dot11zynq_hls/hls/ch_gain_cal) or [equalizer](https://github.com/open-sdr/openofdm/tree/dot11zynq_hls/hls/equalizer) folder to modify the channel estimation or equalizer module, respectively. Choose either 'equalizer' or 'ch_gain_cal' as top-level module. Next, select `equalizer_test.cpp` or `ch_gain_cal_test.cpp` as testbench file. In 'Part selection', select the right part corresponding to your board. 33 | 34 | After modifying the code and making sure C simulation and cosimulation is running fine, select 'Export RTL', which will generate a ZIP file with a folder `hdl/verilog` containing the generated Verilog files. Replace the current folder `openwifi-hw/ip/openofdm_rx/hls/equalizer/hdl/verilog/` (or `.../ch_gain_cal/hdl/verilog`) with this folder and change the `openofdm_rx.tcl` file to include the newly generated Verilog files. See [here](https://github.com/open-sdr/openofdm/blob/dot11zynq_hls/openofdm_rx.tcl#L268) for an example. If you modified the top-level function arguments, you will need to interface them accordingly in [dot11.v](https://github.com/open-sdr/openofdm/blob/dot11zynq_hls/verilog/dot11.v). 35 | 36 | Now follow the [Build FPGA](https://github.com/open-sdr/openwifi-hw#build-fpga) instructions, starting at the step "Generate ip_repo for the top level FPGA project". It will then use the modified .tcl file to include the correct files for your modified HLS module and build the FPGA using it. 37 | 38 | A similar approach can be followed to create other HLS modules, where you would need to execute these steps in the folder of the IP to be modified and integrate the modules in the corresponding top-level Verilog file. 39 | -------------------------------------------------------------------------------- /doc/app_notes/ieee80211n.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | ## IEEE 802.11n (Wi-Fi 4) 8 | 9 | The 4th generation of Wi-Fi (i.e. 802.11n-2009) is a generation leap over its predecessor Wi-Fi 3 (i.e. 802.11g-2003). It was coined as high throughput (HT) since it improves both the physical layer and the MAC layer. 10 | 11 | ### PHY layer improvements 12 | At the physical layer, 5 major improvements were amended on top of Wi-Fi 3 and this has increased the throughput from 54Mbps to 600Mbps. 13 | 14 | #### More subcarriers 15 | Wi-Fi 3 utilizes 48 OFDM data subcarriers and Wi-Fi 4 increased this number to 52, thereby increasing the throughput to 52/48 * 54Mbps = 58.5Mbps. 16 | 17 | ![](./subcarriers.png) 18 | 19 | #### Forward error correction 20 | The most efficient coding rate used in Wi-Fi 3 was 3/4 but Wi-Fi increased this value to 5/6 by squeezing more bits. This has increased the throughput to (5/6)/(3/4) * 58.5Mbps = 65Mbps. 21 | 22 | #### Guard interval 23 | As a measure to combat inter-symbol interference (ISA), Wi-Fi 3 utilizes 800nsec of guard interval between consecutive OFDM symbols. Wi-Fi 4 shortens this value to 400nsec, and this has increased the throughput to 4usec/3.6usec * 65Mbps = 72.2Mbps. 24 | 25 | ![](./guard-interval.png) 26 | 27 | #### MIMO 28 | Wi-Fi 4 was the first to introduce MIMO and standardized 4x4 spatial streams. This has quadrupled the throughput to 4*72.2Mbps = 288.9Mbps. 29 | 30 | ![](./mimo.png) 31 | 32 | #### 40MHz bandwidth 33 | The last thing Wi-Fi 4 introduced to the physical layer is a 40MHz bandwidth utilizing 108 OFDM data subcarriers. This has increased the throughput to 108/52 * 288.8Mbps = 600 Mbps. 34 | 35 | ![](./40mhz.png) 36 | 37 | ### MAC layer improvements 38 | 39 | On top of the PHY layer improvements, Wi-Fi 4 also introduced frame aggregation at the MAC layer to ease the medium access contention. Two types of frame aggregation are used in Wi-Fi 4; A-MPDU and A-MSDU. While A-MSDU is efficient in medium occupation, a single packet error will make the whole frame unusable and require complete retransmission. However, A-MPDU aggregates multiple MPDUs by adding headers to each packet and a single packet error only requires single packet retransmission. As such, A-MPDU gained traction. 40 | 41 | ![](./mpdu-aggr.png) 42 | 43 | 44 | ## Supported openwifi 802.11n amendments 45 | 46 | - 52 subcarriers 47 | - 5/6 code rates 48 | - 400nsec short guard interval. 49 | 50 | Current theoretical throughput = 72.2Mbps. 51 | 52 | ## To be supported openwifi 802.11n amendments 53 | - Frame aggregation 54 | 55 | ## Not supported openwifi 802.11n amendments 56 | 57 | - MIMO 58 | - 40MHz bandwidth 59 | -------------------------------------------------------------------------------- /doc/app_notes/iq-architecture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/iq-architecture.jpg -------------------------------------------------------------------------------- /doc/app_notes/iq-architecture.jpg.license: -------------------------------------------------------------------------------- 1 | # Author: Xianjun jiao 2 | 3 | # SPDX-FileCopyrightText: 2019 UGent 4 | # SPDX-License-Identifier: AGPL-3.0-or-later 5 | -------------------------------------------------------------------------------- /doc/app_notes/iq-capture-parameter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/iq-capture-parameter.jpg -------------------------------------------------------------------------------- /doc/app_notes/iq-capture-parameter.jpg.license: -------------------------------------------------------------------------------- 1 | # Author: Xianjun jiao 2 | 3 | # SPDX-FileCopyrightText: 2019 UGent 4 | # SPDX-License-Identifier: AGPL-3.0-or-later 5 | -------------------------------------------------------------------------------- /doc/app_notes/iq-information-format.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/iq-information-format.jpg -------------------------------------------------------------------------------- /doc/app_notes/iq-information-format.jpg.license: -------------------------------------------------------------------------------- 1 | # Author: Xianjun jiao 2 | 3 | # SPDX-FileCopyrightText: 2019 UGent 4 | # SPDX-License-Identifier: AGPL-3.0-or-later 5 | -------------------------------------------------------------------------------- /doc/app_notes/iq-screen-shot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/iq-screen-shot.jpg -------------------------------------------------------------------------------- /doc/app_notes/iq-screen-shot.jpg.license: -------------------------------------------------------------------------------- 1 | # Author: Xianjun jiao 2 | 3 | # SPDX-FileCopyrightText: 2019 UGent 4 | # SPDX-License-Identifier: AGPL-3.0-or-later 5 | -------------------------------------------------------------------------------- /doc/app_notes/iq_2ant-screen-shot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/iq_2ant-screen-shot.jpg -------------------------------------------------------------------------------- /doc/app_notes/iq_2ant-screen-shot.jpg.license: -------------------------------------------------------------------------------- 1 | # Author: Xianjun jiao 2 | 3 | # SPDX-FileCopyrightText: 2019 UGent 4 | # SPDX-License-Identifier: AGPL-3.0-or-later 5 | -------------------------------------------------------------------------------- /doc/app_notes/iq_2ant-setup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/iq_2ant-setup.png -------------------------------------------------------------------------------- /doc/app_notes/iq_2ant-setup.png.license: -------------------------------------------------------------------------------- 1 | # Author: Xianjun jiao 2 | 3 | # SPDX-FileCopyrightText: 2019 UGent 4 | # SPDX-License-Identifier: AGPL-3.0-or-later 5 | -------------------------------------------------------------------------------- /doc/app_notes/mimo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/mimo.png -------------------------------------------------------------------------------- /doc/app_notes/mimo.png.license: -------------------------------------------------------------------------------- 1 | # Author: Michael Mehari 2 | 3 | # SPDX-FileCopyrightText: 2019 UGent 4 | # SPDX-License-Identifier: AGPL-3.0-or-later 5 | 6 | -------------------------------------------------------------------------------- /doc/app_notes/mpdu-aggr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/mpdu-aggr.png -------------------------------------------------------------------------------- /doc/app_notes/mpdu-aggr.png.license: -------------------------------------------------------------------------------- 1 | # Author: Michael Mehari 2 | 3 | # SPDX-FileCopyrightText: 2019 UGent 4 | # SPDX-License-Identifier: AGPL-3.0-or-later 5 | 6 | -------------------------------------------------------------------------------- /doc/app_notes/openwifi-csi-fpga-loopback.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/openwifi-csi-fpga-loopback.jpg -------------------------------------------------------------------------------- /doc/app_notes/openwifi-iq-loopback.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/openwifi-iq-loopback.jpg -------------------------------------------------------------------------------- /doc/app_notes/openwifi-loopback-principle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/openwifi-loopback-principle.jpg -------------------------------------------------------------------------------- /doc/app_notes/openwifi-radar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/openwifi-radar.jpg -------------------------------------------------------------------------------- /doc/app_notes/perf_counter.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | Counter/statistics (number of TX packet, RX packet, etc.) in FPGA is offered via side channel register write/read. 9 | 10 | The 1st step is alway loading the side channel kernel module: 11 | ``` 12 | insmod side_ch.ko 13 | ``` 14 | 15 | The register write command is: 16 | ``` 17 | ./side_ch_ctl whXdY 18 | X -- register index 19 | Y -- decimal value to be written 20 | ./side_ch_ctl whXhY 21 | X -- register index 22 | Y -- hex value to be written (useful for MAC address) 23 | ``` 24 | Write register 26~31 with arbitrary value to reset the corresponding counter to 0. 25 | 26 | The register read command is: 27 | ``` 28 | ./side_ch_ctl rhX 29 | X -- register index 30 | ``` 31 | 32 | ## Register definition 33 | 34 | The register 26~31 readback value represents the number of event happened. Each register has two event sources that can be selected via bit in register 19. 35 | 36 | register idx|source selection reg19|event 37 | ------------|----------------------|----------- 38 | 26 |reg19[0] == 0 |short_preamble_detected 39 | 26 |reg19[0] == 1 |phy_tx_start 40 | 27 |reg19[4] == 0 |long_preamble_detected 41 | 27 |reg19[4] == 1 |phy_tx_done 42 | 28 |reg19[8] == 0 |pkt_header_valid_strobe 43 | 28 |reg19[8] == 1 |rssi_above_th 44 | 29 |reg19[12] == 0 |pkt_header_valid_strobe&pkt_header_valid 45 | 29 |reg19[12] == 1 |gain_change 46 | 30 |reg19[16] == 0 |((fcs_in_strobe&addr2_match)&pkt_for_me)&is_data 47 | 30 |reg19[16] == 1 |agc_lock 48 | 31 |reg19[20] == 0 |(((fcs_in_strobe&fcs_ok)&addr2_match)&pkt_for_me)&is_data 49 | 31 |reg19[20] == 1 |tx_pkt_need_ack 50 | 51 | Note: fcs_in_strobe means decoding is done (not necessarily CRC is correct); fcs_ok 1 means CRC correct; fcs_ok 0 means CRC not correct. 52 | 53 | Note: addr2_match means addr2 matches to the register (addr2_target) value; pkt_for_me means addr1 matches self mac addr; is_data means the packet type is data. 54 | 55 | Configuration register: 56 | 57 | register idx|meaning |note 58 | ------------|----------------------|----------- 59 | 7 |addr2 target value |fcs event always needs addr2 match 60 | 9 |threshold for event rssi_above_th|check auto_lbt_th in ad9361_rf_set_channel of sdr.c to estimate a proper value 61 | 62 | Note: addr2 (source/sender's MAC address) target setting uses only 32bit. For address 6c:fd:b9:4c:b1:c1, you set b94cb1c1 63 | 64 | Note: read register 62 of xpu for some addr2 captured by the receiver 65 | -------------------------------------------------------------------------------- /doc/app_notes/radar-self-csi.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | One super power of the openwifi platform is "**Full Duplex**" which means that openwifi baseband can receive its own TX signal. Just like a radar! This brings a unique capability of "**joint radar and communication**" to openwifi. For instance, put two directional antennas to openwifi TX and RX, and the **CSI** (Channel State Information) of the self-TX signal will refect the change of the target object. 8 | ![](./openwifi-radar.jpg) 9 | ![](./sensing.png) 10 | 11 | (See this https://github.com/open-sdr/openwifi/discussions/344 to understand how to map the collected data to the packet via the TSF timestamp) 12 | 13 | ## Quick start 14 | - Power on the SDR board. 15 | - Connect a computer to the SDR board via Ethernet cable. The computer should have static IP 192.168.10.1. Open a terminal on the computer, and then in the terminal: 16 | ``` 17 | ssh root@192.168.10.122 18 | (password: openwifi) 19 | ``` 20 | - On computer, build the latest driver and FPGA package after clone/update openwifi and openwifi-hw-img repository: 21 | ``` 22 | export XILINX_DIR=your_Xilinx_install_directory 23 | (Example: export XILINX_DIR=/opt/Xilinx. The Xilinx directory should include sth like: Downloads, Vitis, etc.) 24 | export OPENWIFI_HW_IMG_DIR=your_openwifi-hw-img_directory 25 | (The directory where you get the open-sdr/openwifi-hw-img repo via git clone) 26 | export BOARD_NAME=your_board_name 27 | (Check the BOARD_NAME definitions in README) 28 | 29 | cd openwifi/user_space 30 | ./drv_and_fpga_package_gen.sh $OPENWIFI_HW_IMG_DIR $XILINX_DIR $BOARD_NAME 31 | scp drv_and_fpga.tar.gz root@192.168.10.122:openwifi/ 32 | scp ./side_ch_ctl_src/side_ch_ctl.c root@192.168.10.122:openwifi/ 33 | scp ./inject_80211/* root@192.168.10.122:openwifi/inject_80211/ 34 | ``` 35 | - On SDR board (/root/openwifi directory): 36 | ``` 37 | cd /root/openwifi/ 38 | ./wgd.sh drv_and_fpga.tar.gz 39 | ./monitor_ch.sh sdr0 1 40 | insmod ./drv_and_fpga/side_ch.ko 41 | gcc -o side_ch_ctl side_ch_ctl.c 42 | ./side_ch_ctl wh1h4001 43 | ./side_ch_ctl wh7h4433225a 44 | (Above two commands ensure receiving CSI only from XX:XX:44:33:22:5a, which will be set by our own packet injector later) 45 | ./sdrctl dev sdr0 set reg xpu 1 1 46 | (Above unmute the baseband self-receiving to receive openwifi own TX signal/packet) 47 | ./side_ch_ctl g0 48 | ``` 49 | - Open another ssh session on SDR board: 50 | ``` 51 | cd /root/openwifi/inject_80211 52 | make 53 | ./inject_80211 -m g -r 4 -t d -e 0 -b 5a -n 99999999 -s 20 -d 1000 sdr0 54 | 55 | (Above command injects the 802.11a/g packet, for 802.11n packet please use: 56 | ./inject_80211 -m n -r 4 -t d -e 8 -b 5a -n 99999999 -s 20 -d 1000 sdr0) 57 | ``` 58 | - Now you should see the increasing numbers in the previous ssh terminal of the SDR board. 59 | - On your computer (NOT ssh session!), run: 60 | ``` 61 | cd openwifi/user_space/side_ch_ctl_src 62 | python3 side_info_display.py 8 waterfall 63 | ``` 64 | The python script needs "matplotlib.pyplot" and "numpy" packages installed. Now you should see figures showing run-time **CSI**, **CSI waterfall**, **Equalizer out** and **frequency offset**. The following photo shows the CSI change in the waterfall plot when I left my seat in front of two directional antennas (Tx/Rx antenna). 65 | ![](./sensing.png) 66 | 67 | While running, all CSI data is also stored into a file **side_info.txt**. A matlab script **test_side_info_file_display.m** is offered to help you do CSI analysis offline. In this case, run **test_side_info_file_display** in Matlab. 68 | ![](./csi-screen-shot-radar-matlab.jpg) 69 | 70 | Please learn the python and Matlab script for CSI data structure per packet according to your requirement. 71 | 72 | Do read the [normal CSI app note](csi.md) to understand the basic implementation architecture. 73 | -------------------------------------------------------------------------------- /doc/app_notes/sensing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/sensing.png -------------------------------------------------------------------------------- /doc/app_notes/subcarriers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/app_notes/subcarriers.png -------------------------------------------------------------------------------- /doc/app_notes/subcarriers.png.license: -------------------------------------------------------------------------------- 1 | # Author: Michael Mehari 2 | 3 | # SPDX-FileCopyrightText: 2019 UGent 4 | # SPDX-License-Identifier: AGPL-3.0-or-later 5 | 6 | -------------------------------------------------------------------------------- /doc/asic/skywater-130-pdk-and-asic-considerations.md: -------------------------------------------------------------------------------- 1 | Hello, 2 | 3 | The skywater PDK and free MPW shuttle are interesting. And indeed we are asked many times to consider sky130 or other ASIC process MPW. 4 | 5 | We do agree that building a real openwifi chip will probably (or not) mean a lot for the community, user and the world. 6 | 7 | But, due to our limited bandwidth, currently we are focusing on making the openwifi IP more stable/mature/as-good-as COTS WiFi chip by using the FPGA verification platform, so we haven’t found time to take a look at a real WiFi chip design yet. 8 | 9 | WiFi chips could be as cheap as 0.5USD, but it doesn't mean the WiFi chip is simple. This is contrary to many people’s minds. I tried to explain the complexity of the WiFi chip in some videos, such as the FOSDEM and Libreplanet videos on this page: https://github.com/open-sdr/openwifi/blob/master/doc/videos.md . The WiFi chip is cheap only because they are sold so many per year. From this perspective, the WiFi chip is really an essential tiny thing of the modern world. 10 | 11 | But we are definitely glad to support/answer-questions if someone else could jump in and do a solid analysis on the ASIC design effort. Some hints: 12 | 13 | 1 . The info and communication hub is our github: https://github.com/open-sdr/openwifi . The FPGA code is in https://github.com/open-sdr/openwifi-hw . 14 | 15 | 2 . The best way to get full picture and further info (resource/power/clock-speed/etc) of the openwifi FPGA design is downloading Xilinx Vivado (version is listed on our github) tool chain, and go through our full FPGA build procedure (README of openwifi-hw: https://github.com/open-sdr/openwifi-hw/blob/master/README.md ), where you will see the full system block diagram: not only the openwifi IP, but also all interfacing/peripheral IP around. Of course many of them are Xilinx/Analog-Devices specific. 16 | 17 | 3 . You don’t need to pay any fee for Xilinx Vivado, if you chose the FPGA boards (the full list of supported FPGA board is in the README of openwifi: https://github.com/open-sdr/openwifi/blob/master/README.md ) that has 7020 FPGA, because Xilinx offer free offer for that small scale FPGA. 18 | 19 | 4 . Try to find out all the vendor/3rd-part (Xilinx/Analog-Devices/etc) IPs, and evaluate/estimate how big the efforts will be if they need to be turned into sky130 or other ASIC design. As far as I remember (not full list), inside openwifi IP, we use these IP cores from Xilinx: 20 | - FFT 21 | - Viterbi decoder 22 | - FIFO 23 | - dual port RAM 24 | - ROM 25 | - FIR filter 26 | - AXI stream DMA 27 | - AXI lite bus 28 | - integer divider 29 | - integer multiplexer 30 | - etc. 31 | 32 | I guess most of them need to be ported if we go for a real chip. 33 | 34 | 5 . Also outside openwifi IP, there are interfacing/peripheral IPs from Xilinx/Analog-Devices, which can be seen if you create and open the openwifi project block diagram in Vivado (follow the openwifi-hw README). Two special things: RF and ARM processor interconnection. 35 | - Currently the RF front-end is AD9361 (off-FPGA), which is not a dedicated WiFi front-end (2.4GH/5GHz only). Instead, AD9361 is a quite expensive front-end that supports 70M~6GHz for SDR (Software Defined Radio) applications. So of course, there will be dedicated AD9361 interfacing IPs from Analog Devices (open source as well: https://github.com/analogdevicesinc/hdl, but the license situation is complicated: https://github.com/analogdevicesinc/hdl/blob/master/LICENSE ) 36 | - Unlike usual WiFi chips that work with processors via USB/PCIe/SDIO/etc bus, openwifi IP interconnects to the ARM processor via AXI bus. This brings us some unique benefits, such as low latency, but it also makes the IP quite platform dependent. 37 | 38 | 6 . Last but not least, considering the efforts (seems big) needed for a real openwifi ASIC, we believe that some bigger/stronger organizations (like foundation/company/person), that have rich experience on IP/licensing analysis and ASIC design, could set up an initiative to work on this openwifi chip activity. Of course, we will be more than happy to join and support it. But to be honest, the openwifi team has very limited ASIC design experiences, and we mainly focus on FPGA for now (due to the bandwidth: personal resource, funding, etc.) 39 | 40 | Further discussions/ideas? Feel free to reach out to us! 41 | 42 | Best regards, 43 | 44 | Xianjun 45 | 46 | -------------------------------------------------------------------------------- /doc/bb-clk.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/bb-clk.jpg -------------------------------------------------------------------------------- /doc/cite-openwifi-github-code.md: -------------------------------------------------------------------------------- 1 | ``` 2 | @electronic{openwifigithub, 3 | author = {Jiao, Xianjun and Liu, Wei and Mehari, Michael and Thijs, Havinga and Muhammad, Aslam}, 4 | title = {open-source IEEE802.11/Wi-Fi baseband chip/FPGA design}, 5 | url = {https://github.com/open-sdr}, 6 | year = {2023}, 7 | } 8 | ``` 9 | -------------------------------------------------------------------------------- /doc/cite-openwifi-vtc-paper.md: -------------------------------------------------------------------------------- 1 | ``` 2 | @inproceedings{jiao2020openwifi, 3 | title={openwifi: a free and open-source IEEE802. 11 SDR implementation on SoC}, 4 | author={Jiao, Xianjun and Liu, Wei and Mehari, Michael and Aslam, Muhammad and Moerman, Ingrid}, 5 | booktitle={2020 IEEE 91st Vehicular Technology Conference (VTC2020-Spring)}, 6 | pages={1--2}, 7 | year={2020}, 8 | organization={IEEE} 9 | } 10 | ``` 11 | -------------------------------------------------------------------------------- /doc/known_issue/notter.md: -------------------------------------------------------------------------------- 1 | # Known issue 2 | 3 | - [Network issue in quick start](#Network-issue-in-quick-start) 4 | - [EXT4 fs error rootfs issue](#EXT4-fs-error-rootfs-issue) 5 | - [antsdr e200 UART console](#antsdr-e200-UART-console) 6 | - [Client can not get IP](#Client-can-not-get-IP) 7 | - [No space left on device](#No-space-left-on-device) 8 | 9 | ## Network issue in quick star 10 | 11 | - OS: Ubuntu 22 LTS 12 | - image: [openwifi img](https://drive.google.com/file/d/1fb8eJGJAntOciCiGFVLfQs7m7ucRtSWD/view?usp=share_link) 13 | 14 | If can't ssh to the board via Ethernet for the 1st time, you might need to delete /etc/network/interfaces.new on SD card (on your computer). 15 | 16 | If still can't ssh the board via Ethernet, you should use UART console (/dev/ttyUSBx, /dev/ttyCH341USBx, etc.) to monitor what happened during booting. 17 | 18 | ## EXT4 fs error rootfs issue 19 | 20 | Sometimes, the 1st booting after flashing SD card might encounter "EXT4-fs error (device mmcblk0p2): ..." error on neptunesdr, changing SD card flashing tool might solve this issue. Some tool candidates: 21 | - gnome-disks 22 | - Startup Disk Creator 23 | - win32diskimager 24 | 25 | ## antsdr e200 UART console 26 | 27 | If can't see the UART console in Linux (/dev/ttyUSB0 or /dev/ttyCH341USB0), according to https://github.com/juliagoda/CH341SER, you might need to do `sudo apt remove brltty` 28 | 29 | ## Client can not get IP 30 | 31 | If the client can not get IP from the openwifi AP, just re-run "service isc-dhcp-server restart" on board and do re-connect from the client. 32 | 33 | ## No space left on device 34 | It might be due to too many dmesg/log/journal, disk becomes full. 35 | ``` 36 | systemd-journald[5694]: Failed to open system journal: No space left on device 37 | ``` 38 | You can try following operations. 39 | ``` 40 | systemd-tmpfiles --clean 41 | sudo systemd-tmpfiles --remove 42 | rm /var/log/* -rf 43 | apt --autoremove purge rsyslog 44 | ``` 45 | Add followings into `/etc/systemd/journald.conf` 46 | ``` 47 | SystemMaxUse=64M 48 | Storage=volatile 49 | RuntimeMaxUse=64M 50 | ForwardToConsole=no 51 | ForwardToWall=no 52 | ``` 53 | -------------------------------------------------------------------------------- /doc/openwifi-detail.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/openwifi-detail.jpg -------------------------------------------------------------------------------- /doc/openwifi-detail.jpg.license: -------------------------------------------------------------------------------- 1 | 2 | # Author: Xianjun jiao 3 | 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | -------------------------------------------------------------------------------- /doc/rf-digital-if-chain-config.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/rf-digital-if-chain-config.jpg -------------------------------------------------------------------------------- /doc/rf-digital-if-chain-config.jpg.license: -------------------------------------------------------------------------------- 1 | 2 | # Author: Xianjun jiao 3 | 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | -------------------------------------------------------------------------------- /doc/rf-digital-if-chain-spectrum.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/doc/rf-digital-if-chain-spectrum.jpg -------------------------------------------------------------------------------- /doc/rf-digital-if-chain-spectrum.jpg.license: -------------------------------------------------------------------------------- 1 | 2 | # Author: Xianjun jiao 3 | 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | -------------------------------------------------------------------------------- /doc/videos.md: -------------------------------------------------------------------------------- 1 | - The 1st public demo video [[Youtube](https://youtu.be/NpjEaszd5u4)], [[link for CHN user](https://www.zhihu.com/zvideo/1280659393378041856)] 2 | - FOSDEM2020 presentation [[Youtube](https://youtu.be/Mq48cGthk7M)], [[link for CHN user](https://www.zhihu.com/zvideo/1280673506397425664)] 3 | - Low latency for gaming and general introduction [[Youtube](https://youtu.be/Notn9X482LI)], [[link for CHN user](https://www.zhihu.com/zvideo/1273823153371385856)] 4 | - CSI (Channel State Information) [[Youtube](https://youtu.be/DanB1ClVamU)], [[link for CHN user](https://www.zhihu.com/zvideo/1297662571618148352)] 5 | - FOSDEM2021 presentation [[Flash back](https://twitter.com/jxjputaoshu/status/1358462741703491584?s=20)], [[link for CHN user](https://www.zhihu.com/zvideo/1340748826311974912)]; [[Presentation](https://video.fosdem.org/2021/D.radio/fsr_openwifi_opensource_wifi_chip.webm)], [[link for CHN user](https://www.zhihu.com/zvideo/1345036055104360448)] 6 | - FSF Libreplanet 2021 presentation [[Official](https://media.libreplanet.org/u/libreplanet/m/openwifi-project-the-dawn-of-the-free-libre-wifi-chip/)], [[LinuxReviews](https://linuxreviews.org/Openwifi_project:_The_dawn_of_the_free/libre_WiFi_chip)], [[link for CHN user](https://www.zhihu.com/zvideo/1373649688906883072)] 7 | - Openwifi industrial real-time high reliable low latency applications (EU Horizon 2020 SHOP4CF project) [[Youtube](https://youtu.be/p7zkkdMvPNc)], [[link for CHN user](https://www.zhihu.com/zvideo/1378413483944538113)] 8 | - WiFi CSI Radar: Joint communication and sensing [[Youtube](https://youtu.be/PUwpJuHZDhg)], [[link for CHN user](https://www.bilibili.com/video/BV1a94y1W7XL/?share_source=copy_web&vd_source=587e4ed61021396d31fd3a09c077969f)] 9 | - CSI fuzzer [[Youtube](https://youtu.be/aOPYwT77Qdw)], [[link for CHN user](https://www.zhihu.com/zvideo/1378409348163506177)], and ACM WiSec interview [[Youtube](https://youtu.be/ZOCV78aTaQg)], [[link for CHN user](https://www.bilibili.com/video/BV1Mo4y1C76t?share_source=copy_web)] 10 | - NGI zero, nlnet online session on future of European open hardware [[Session](https://nlnet.nl/news/2021/20210507-NGI-Zero-workshop-open-hardware.html)], [[Original record](https://archive.org/details/ngiforum-open-hardware-workshop-ngizero)], [[Youtube](https://youtu.be/m9Tw5VuHAfk)], [[link for CHN user](https://www.zhihu.com/zvideo/1379302398096285696)] 11 | - High Precision Time Synchronization on Wi-Fi based Multi-Hop Network [[Youtube](https://youtu.be/m5ryRArbdC8)], [[link for CHN user](https://www.zhihu.com/zvideo/1418222775224492032)] 12 | - FOSDEM2022 presentation [[Presentation](https://video.fosdem.org/2022/D.radio/radio_openwifi.webm)], [[link for CHN user](https://www.bilibili.com/video/BV12b4y1j7YK?share_source=copy_web)] 13 | - [Find the corresponding Wi-Fi packet in wireshark after openwifi CSI/IQ capture](https://github.com/open-sdr/openwifi/discussions/344) [[Youtube](https://youtu.be/iiiINz7XTGA)], [[link for CHN user](https://www.bilibili.com/video/BV13w411Y7GX/?share_source=copy_web&vd_source=587e4ed61021396d31fd3a09c077969f)] 14 | - CCC GPN22 DanielAW, How a Wifi chip works internally [[link](https://media.ccc.de/v/gpn22-380-how-a-wifi-chip-works-internally)] 15 | - FSiC2024, An opensource Wi-Fi chip, What, Why and How? [[link](https://wiki.f-si.org/index.php?title=An_opensource_Wi-Fi_chip,_What,_Why_and_How%3F)] 16 | -------------------------------------------------------------------------------- /driver/Makefile: -------------------------------------------------------------------------------- 1 | # Xianjun jiao. putaoshu@msn.com; xianjun.jiao@imec.be 2 | 3 | obj-m += sdr.o openofdm_rx/openofdm_rx.o openofdm_tx/openofdm_tx.o tx_intf/tx_intf.o rx_intf/rx_intf.o xpu/xpu.o 4 | 5 | all: 6 | make -C $(KDIR) M=$(PWD) modules 7 | # ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 8 | 9 | clean: 10 | rm -f *.ko *.o *.mod.o *.mod.c *.symvers *.order 11 | -------------------------------------------------------------------------------- /driver/make_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Xianjun jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | print_usage () { 8 | echo "You must enter at least 2 arguments: \$XILINX_DIR ARCH_BIT(32 or 64)" 9 | echo "Further arguments (maximum 5) will be converted to #define argument in pre_def.h" 10 | echo " " 11 | } 12 | 13 | print_usage 14 | 15 | if [ "$#" -lt 2 ]; then 16 | exit 1 17 | fi 18 | 19 | OPENWIFI_DIR=$(pwd)/../ 20 | XILINX_DIR=$1 21 | ARCH_OPTION=$2 22 | 23 | echo OPENWIFI_DIR $OPENWIFI_DIR 24 | echo XILINX_DIR $XILINX_DIR 25 | echo ARCH_OPTION $ARCH_OPTION 26 | 27 | if [ -f "$OPENWIFI_DIR/LICENSE" ]; then 28 | echo "\$OPENWIFI_DIR is found!" 29 | else 30 | echo "\$OPENWIFI_DIR is not correct. Please check!" 31 | exit 1 32 | fi 33 | 34 | if [ -d "$XILINX_DIR/Vitis" ]; then 35 | echo "\$XILINX_DIR is found!" 36 | else 37 | echo "\$XILINX_DIR is not correct. Please check!" 38 | exit 1 39 | fi 40 | 41 | if [ "$ARCH_OPTION" != "32" ] && [ "$ARCH_OPTION" != "64" ]; then 42 | echo "\$ARCH_OPTION is not correct. Should be 32 or 64. Please check!" 43 | exit 1 44 | else 45 | echo "\$ARCH_OPTION is valid!" 46 | fi 47 | 48 | echo "#define USE_NEW_RX_INTERRUPT 1" > pre_def.h 49 | if [[ -n $3 ]]; then 50 | DEFINE1=$3 51 | echo DEFINE1 $DEFINE1 52 | echo "#define $DEFINE1" >> pre_def.h 53 | fi 54 | if [[ -n $4 ]]; then 55 | DEFINE2=$4 56 | echo DEFINE2 $DEFINE2 57 | echo "#define $DEFINE2" >> pre_def.h 58 | fi 59 | if [[ -n $5 ]]; then 60 | DEFINE3=$5 61 | echo DEFINE3 $DEFINE3 62 | echo "#define $DEFINE3" >> pre_def.h 63 | fi 64 | if [[ -n $6 ]]; then 65 | DEFINE4=$6 66 | echo DEFINE4 $DEFINE4 67 | echo "#define $DEFINE4" >> pre_def.h 68 | fi 69 | if [[ -n $7 ]]; then 70 | DEFINE5=$7 71 | echo DEFINE5 $DEFINE5 72 | echo "#define $DEFINE5" >> pre_def.h 73 | fi 74 | 75 | source $XILINX_DIR/Vitis/2021.1/settings64.sh 76 | if [ "$ARCH_OPTION" == "64" ]; then 77 | LINUX_KERNEL_SRC_DIR=$OPENWIFI_DIR/adi-linux-64/ 78 | ARCH="arm64" 79 | CROSS_COMPILE="aarch64-linux-gnu-" 80 | else 81 | LINUX_KERNEL_SRC_DIR=$OPENWIFI_DIR/adi-linux/ 82 | ARCH="arm" 83 | CROSS_COMPILE="arm-linux-gnueabihf-" 84 | fi 85 | 86 | # check if user entered the right path to analog device linux 87 | if [ -d "$LINUX_KERNEL_SRC_DIR" ]; then 88 | echo "setup linux kernel path ${LINUX_KERNEL_SRC_DIR}" 89 | else 90 | echo "Error: path to adi linux: ${LINUX_KERNEL_SRC_DIR} not found. Can not continue." 91 | exit 1 92 | fi 93 | 94 | set -x 95 | 96 | home_dir=$(pwd) 97 | 98 | cd $OPENWIFI_DIR/driver/ 99 | if git log -1; then 100 | echo "#define GIT_REV 0x"$(git log -1 --pretty=%h) > git_rev.h 101 | else 102 | echo "#define GIT_REV 0xFFFFFFFF" > git_rev.h 103 | fi 104 | cd $OPENWIFI_DIR/driver/openofdm_tx 105 | make KDIR=$LINUX_KERNEL_SRC_DIR ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE 106 | cd $OPENWIFI_DIR/driver/openofdm_rx 107 | make KDIR=$LINUX_KERNEL_SRC_DIR ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE 108 | cd $OPENWIFI_DIR/driver/tx_intf 109 | make KDIR=$LINUX_KERNEL_SRC_DIR ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE 110 | cd $OPENWIFI_DIR/driver/rx_intf 111 | make KDIR=$LINUX_KERNEL_SRC_DIR ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE 112 | cd $OPENWIFI_DIR/driver/xpu 113 | make KDIR=$LINUX_KERNEL_SRC_DIR ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE 114 | # cd $OPENWIFI_DIR/driver/ad9361 115 | # make KDIR=$LINUX_KERNEL_SRC_DIR ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE 116 | 117 | cd $OPENWIFI_DIR/driver/side_ch 118 | ./make_driver.sh $XILINX_DIR $ARCH_OPTION 119 | 120 | cd $OPENWIFI_DIR/driver/ 121 | make KDIR=$LINUX_KERNEL_SRC_DIR ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE 122 | 123 | cd $home_dir 124 | -------------------------------------------------------------------------------- /driver/openofdm_rx/Makefile: -------------------------------------------------------------------------------- 1 | # by Xianjun jiao. putaoshu@msn.com; xianjun.jiao@imec.be 2 | 3 | obj-m += openofdm_rx.o 4 | 5 | all: 6 | make -C $(KDIR) M=$(PWD) modules 7 | # ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 8 | 9 | clean: 10 | rm -f *.ko *.o *.mod.o *.mod.c *.symvers *.order 11 | -------------------------------------------------------------------------------- /driver/openofdm_tx/Makefile: -------------------------------------------------------------------------------- 1 | # by Xianjun jiao. putaoshu@msn.com; xianjun.jiao@imec.be 2 | 3 | obj-m += openofdm_tx.o 4 | 5 | all: 6 | make -C $(KDIR) M=$(PWD) modules 7 | # ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 8 | 9 | clean: 10 | rm -f *.ko *.o *.mod.o *.mod.c *.symvers *.order 11 | -------------------------------------------------------------------------------- /driver/rx_intf/Makefile: -------------------------------------------------------------------------------- 1 | # by Xianjun jiao. putaoshu@msn.com; xianjun.jiao@imec.be 2 | 3 | obj-m += rx_intf.o 4 | 5 | all: 6 | make -C $(KDIR) M=$(PWD) modules 7 | # ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 8 | 9 | clean: 10 | rm -f *.ko *.o *.mod.o *.mod.c *.symvers *.order 11 | -------------------------------------------------------------------------------- /driver/side_ch/Makefile: -------------------------------------------------------------------------------- 1 | # by Xianjun jiao. putaoshu@msn.com; xianjun.jiao@imec.be 2 | 3 | obj-m += side_ch.o 4 | # obj-m += axidmatest.o 5 | 6 | all: 7 | make -C $(KDIR) M=$(PWD) modules 8 | # ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 9 | 10 | clean: 11 | rm -f *.ko *.o *.mod.o *.mod.c *.symvers *.order 12 | -------------------------------------------------------------------------------- /driver/side_ch/make_driver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Xianjun Jiao, Wei Liu 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | if [ "$#" -ne 2 ]; then 8 | echo "You must enter exactly 2 arguments: \$XILINX_DIR ARCH_BIT(32 or 64)" 9 | exit 1 10 | fi 11 | 12 | OPENWIFI_DIR=$(pwd)/../../ 13 | XILINX_DIR=$1 14 | ARCH_OPTION=$2 15 | 16 | if [ -f "$OPENWIFI_DIR/LICENSE" ]; then 17 | echo "\$OPENWIFI_DIR is found!" 18 | else 19 | echo "\$OPENWIFI_DIR is not correct. Please check!" 20 | exit 1 21 | fi 22 | 23 | if [ -d "$XILINX_DIR/Vitis" ]; then 24 | echo "\$XILINX_DIR is found!" 25 | else 26 | echo "\$XILINX_DIR is not correct. Please check!" 27 | exit 1 28 | fi 29 | 30 | if [ "$ARCH_OPTION" != "32" ] && [ "$ARCH_OPTION" != "64" ]; then 31 | echo "\$ARCH_OPTION is not correct. Should be 32 or 64. Please check!" 32 | exit 1 33 | else 34 | echo "\$ARCH_OPTION is valid!" 35 | fi 36 | 37 | source $XILINX_DIR/Vitis/2021.1/settings64.sh 38 | if [ "$ARCH_OPTION" == "64" ]; then 39 | LINUX_KERNEL_SRC_DIR=$OPENWIFI_DIR/adi-linux-64/ 40 | ARCH="arm64" 41 | CROSS_COMPILE="aarch64-linux-gnu-" 42 | else 43 | LINUX_KERNEL_SRC_DIR=$OPENWIFI_DIR/adi-linux/ 44 | ARCH="arm" 45 | CROSS_COMPILE="arm-linux-gnueabihf-" 46 | fi 47 | 48 | # check if user entered the right path to analog device linux 49 | if [ -d "$LINUX_KERNEL_SRC_DIR" ]; then 50 | echo " setup linux kernel path ${LINUX_KERNEL_SRC_DIR}" 51 | else 52 | echo "Error: path to adi linux: ${LINUX_KERNEL_SRC_DIR} not found. Can not continue." 53 | exit 1 54 | fi 55 | 56 | set -x 57 | 58 | home_dir=$(pwd) 59 | 60 | cd $OPENWIFI_DIR/driver/side_ch 61 | make KDIR=$LINUX_KERNEL_SRC_DIR ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE 62 | 63 | cd $home_dir 64 | -------------------------------------------------------------------------------- /driver/side_ch/side_ch.h: -------------------------------------------------------------------------------- 1 | // Author: Xianjun Jiao 2 | // SPDX-FileCopyrightText: 2019 UGent 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | 5 | // ---------------------------------------side channel------------------------------- 6 | const char *side_ch_compatible_str = "sdr,side_ch"; 7 | 8 | //align with side_ch_control.v and all related user space, remote files 9 | #define CSI_LEN 56 // length of single CSI 10 | #define EQUALIZER_LEN (56-4) // for non HT, four {32767,32767} will be padded to achieve 52 (non HT should have 48) 11 | #define HEADER_LEN 2 //timestamp and frequency offset 12 | 13 | #define MAX_NUM_DMA_SYMBOL 8192 //align with side_ch.v side_ch.h 14 | 15 | #define SIDE_CH_REG_MULTI_RST_ADDR (0*4) 16 | #define SIDE_CH_REG_CONFIG_ADDR (1*4) 17 | #define SIDE_CH_REG_NUM_DMA_SYMBOL_ADDR (2*4) //low 16bit to PS; high 16bit to PL 18 | #define SIDE_CH_REG_IQ_CAPTURE_ADDR (3*4) 19 | #define SIDE_CH_REG_NUM_EQ_ADDR (4*4) 20 | #define SIDE_CH_REG_FC_TARGET_ADDR (5*4) 21 | #define SIDE_CH_REG_ADDR1_TARGET_ADDR (6*4) 22 | #define SIDE_CH_REG_ADDR2_TARGET_ADDR (7*4) 23 | #define SIDE_CH_REG_IQ_TRIGGER_ADDR (8*4) 24 | #define SIDE_CH_REG_RSSI_TH_ADDR (9*4) 25 | #define SIDE_CH_REG_GAIN_TH_ADDR (10*4) 26 | #define SIDE_CH_REG_PRE_TRIGGER_LEN_ADDR (11*4) 27 | #define SIDE_CH_REG_IQ_LEN_ADDR (12*4) 28 | 29 | #define SIDE_CH_REG_M_AXIS_DATA_COUNT_ADDR (20*4) 30 | -------------------------------------------------------------------------------- /driver/tx_intf/Makefile: -------------------------------------------------------------------------------- 1 | # by Xianjun jiao. putaoshu@msn.com; xianjun.jiao@imec.be 2 | 3 | obj-m += tx_intf.o 4 | 5 | all: 6 | make -C $(KDIR) M=$(PWD) modules 7 | # ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 8 | 9 | clean: 10 | rm -f *.ko *.o *.mod.o *.mod.c *.symvers *.order 11 | -------------------------------------------------------------------------------- /driver/xilinx_dma/README.md: -------------------------------------------------------------------------------- 1 | 6 | We don't maintain our own (modified) xilinx dma driver anymore! The original xilinx dma driver in the Linux kernel tree can be used. 7 | 8 | ===============Following are obsolete content================= 9 | 10 | Currently used driver xilinx_dma-orig.c is based on 552d3f11e374ca0d435aa93a571507819eabdda2 of https://github.com/Xilinx/linux-xlnx ) 11 | 12 | instruction to generate our customized xilinx dma driver: 13 | 14 | ./make_xilinx_dma.sh 15 | 16 | instruction to generate our customized xilinx dma test program: 17 | 18 | ./make_xilinx_dma_test.sh 19 | 20 | test dma driver on board: login to zc706, then: 21 | 22 | rm axidmatest.ko 23 | wget ftp://192.168.10.1/driver/xilinx_dma/axidmatest.ko 24 | rm ddc.ko 25 | wget ftp://192.168.10.1/driver/ddc/ddc.ko 26 | rm xilinx_dma.ko 27 | wget ftp://192.168.10.1/driver/xilinx_dma/xilinx_dma.ko 28 | rmmod axidmatest 29 | rmmod ddc 30 | rmmod xilinx_dma 31 | insmod xilinx_dma.ko 32 | insmod ddc.ko 33 | insmod axidmatest.ko 34 | dmesg -c 35 | 36 | dmesg will show test result printed by "insmod axidmatest.ko". Like this: 37 | 38 | root@analog:~# dmesg -c 39 | xilinx_dmatest: dropped channel dma5chan0 40 | xilinx_dmatest: dropped channel dma5chan1 41 | 42 | sdr,ddc dev_remove base_addr 0xf14e0000 43 | sdr,ddc dev_remove ddc_driver_api_inst 0xbf032284 44 | sdr,ddc dev_remove ddc_api 0xbf032284 45 | sdr,ddc dev_remove succeed! 46 | xilinx-vdma 43000000.axivdma: Xilinx AXI VDMA Engine Driver Probed!! 47 | xilinx-vdma 80400000.dma: Xilinx AXI DMA Engine Driver Probed!! 48 | xilinx-vdma 80410000.dma: Xilinx AXI DMA Engine Driver Probed!! 49 | 50 | sdr,ddc dev_probe match! 51 | sdr,ddc dev_probe io start 0x83c20000 end 0x83c2ffff name /fpga-axi@0/rx_intf@83c20000 flags 0x00000200 desc 0x00000000 52 | sdr,ddc dev_probe base_addr 0xf18e0000 53 | sdr,ddc dev_probe ddc_driver_api_inst 0xbf0e1284 54 | sdr,ddc dev_probe ddc_api 0xbf0e1284 55 | sdr,ddc dev_probe reset tsf timer 56 | sdr,ddc dev_probe tsf timer runtime read 1 33007 100015us 57 | sdr,ddc dev_probe succeed! 58 | sdr,ddc hw_init mode 0 59 | sdr,ddc hw_init mode DDC_AXIS_LOOP_BACK 60 | sdr,ddc hw_init err 0 61 | dmatest: Started 1 threads using dma5chan0 dma5chan1 62 | align 3 63 | sdr,ddc hw_init mode 0 64 | sdr,ddc hw_init mode DDC_AXIS_LOOP_BACK 65 | sdr,ddc hw_init err 0 66 | tx_tmo 99 status 0 len 6448 DMA_COMPLETE 0 67 | dma5chan0-dma5c: verifying source buffer... 68 | dma5chan0-dma5c: verifying dest buffer... 69 | dma5chan0-dma5c: #0: No errors with 70 | src_off=0x448 dst_off=0x568 len=0x1930 71 | align 3 72 | sdr,ddc hw_init mode 0 73 | sdr,ddc hw_init mode DDC_AXIS_LOOP_BACK 74 | sdr,ddc hw_init err 0 75 | tx_tmo 100 status 0 len 3248 DMA_COMPLETE 0 76 | dma5chan0-dma5c: verifying source buffer... 77 | dma5chan0-dma5c: verifying dest buffer... 78 | dma5chan0-dma5c: #1: No errors with 79 | src_off=0x458 dst_off=0xf08 len=0xcb0 80 | align 3 81 | sdr,ddc hw_init mode 0 82 | sdr,ddc hw_init mode DDC_AXIS_LOOP_BACK 83 | sdr,ddc hw_init err 0 84 | tx_tmo 100 status 0 len 8112 DMA_COMPLETE 0 85 | dma5chan0-dma5c: verifying source buffer... 86 | dma5chan0-dma5c: verifying dest buffer... 87 | dma5chan0-dma5c: #2: No errors with 88 | src_off=0x10 dst_off=0x20 len=0x1fb0 89 | align 3 90 | sdr,ddc hw_init mode 0 91 | sdr,ddc hw_init mode DDC_AXIS_LOOP_BACK 92 | sdr,ddc hw_init err 0 93 | tx_tmo 100 status 0 len 840 DMA_COMPLETE 0 94 | dma5chan0-dma5c: verifying source buffer... 95 | dma5chan0-dma5c: verifying dest buffer... 96 | dma5chan0-dma5c: #3: No errors with 97 | src_off=0x1890 dst_off=0x1268 len=0x348 98 | align 3 99 | sdr,ddc hw_init mode 0 100 | sdr,ddc hw_init mode DDC_AXIS_LOOP_BACK 101 | sdr,ddc hw_init err 0 102 | tx_tmo 100 status 0 len 7816 DMA_COMPLETE 0 103 | dma5chan0-dma5c: verifying source buffer... 104 | dma5chan0-dma5c: verifying dest buffer... 105 | dma5chan0-dma5c: #4: No errors with 106 | src_off=0x80 dst_off=0x168 len=0x1e88 107 | dma5chan0-dma5c: terminating after 5 tests, 0 failures (status 0) 108 | 109 | -------------------------------------------------------------------------------- /driver/xilinx_dma/make_xilinx_dma.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | if [ "$#" -ne 2 ]; then 8 | echo "You must enter exactly 2 arguments: \$XILINX_DIR \$ARCH(32 or 64)" 9 | exit 1 10 | fi 11 | 12 | WORKDIR=$PWD 13 | OPENWIFI_DIR=$(pwd)/../../ 14 | XILINX_DIR=$1 15 | ARCH_OPTION=$2 16 | 17 | set -x 18 | 19 | if [ -f "$OPENWIFI_DIR/LICENSE" ]; then 20 | echo "\$OPENWIFI_DIR is found!" 21 | else 22 | echo "\$OPENWIFI_DIR is not correct. Please check!" 23 | exit 1 24 | fi 25 | 26 | if [ -d "$XILINX_DIR/SDK" ]; then 27 | echo "\$XILINX_DIR is found!" 28 | else 29 | echo "\$XILINX_DIR is not correct. Please check!" 30 | exit 1 31 | fi 32 | 33 | if [ "$ARCH_OPTION" != "32" ] && [ "$ARCH_OPTION" != "64" ]; then 34 | echo "\$ARCH_OPTION is not correct. Should be 32 or 64. Please check!" 35 | exit 1 36 | else 37 | echo "\$ARCH_OPTION is valid!" 38 | fi 39 | 40 | source $XILINX_DIR/SDK/2018.3/settings64.sh 41 | if [ "$ARCH_OPTION" == "64" ]; then 42 | KDIR=$OPENWIFI_DIR/adi-linux-64/ 43 | export ARCH=arm64 44 | export CROSS_COMPILE=aarch64-linux-gnu- 45 | else 46 | KDIR=$OPENWIFI_DIR/adi-linux/ 47 | export ARCH=arm 48 | export CROSS_COMPILE=arm-linux-gnueabihf- 49 | fi 50 | 51 | SUBMODULE=xilinx_dma 52 | 53 | cp $KDIR/drivers/dma/xilinx/xilinx_dma.c $KDIR/drivers/dma/xilinx/xilinx_dma.c.bak 54 | cp xilinx_dma.c $KDIR/drivers/dma/xilinx -rf 55 | cd $KDIR 56 | make $KDIR/drivers/dma/xilinx/$SUBMODULE.ko 57 | cp $KDIR/drivers/dma/xilinx/$SUBMODULE.ko $WORKDIR -rf 58 | # cp $KDIR/drivers/dma/xilinx/xilinx_dma.c.bak $KDIR/drivers/dma/xilinx/xilinx_dma.c 59 | cd $WORKDIR 60 | ls $SUBMODULE.ko 61 | -------------------------------------------------------------------------------- /driver/xpu/Makefile: -------------------------------------------------------------------------------- 1 | # by Xianjun jiao. putaoshu@msn.com; xianjun.jiao@imec.be 2 | 3 | obj-m += xpu.o 4 | 5 | all: 6 | make -C $(KDIR) M=$(PWD) modules 7 | # ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 8 | 9 | clean: 10 | rm -f *.ko *.o *.mod.o *.mod.c *.symvers *.order 11 | 12 | -------------------------------------------------------------------------------- /kernel_boot/10-network-device.rules: -------------------------------------------------------------------------------- 1 | SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="66:55:44:33:22:*", NAME="sdr0" 2 | -------------------------------------------------------------------------------- /kernel_boot/70-persistent-net.rules: -------------------------------------------------------------------------------- 1 | SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="66:55:44:33:22:*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="sdr0" 2 | -------------------------------------------------------------------------------- /kernel_boot/72113-files.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/72113-files.zip -------------------------------------------------------------------------------- /kernel_boot/ad9361.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drivers/iio/adc/ad9361.c b/drivers/iio/adc/ad9361.c 2 | index b21e2129e27c..b53d7b7ab20d 100644 3 | --- a/drivers/iio/adc/ad9361.c 4 | +++ b/drivers/iio/adc/ad9361.c 5 | @@ -1234,7 +1234,7 @@ static int ad9361_load_mixer_gm_subtable(struct ad9361_rf_phy *phy) 6 | return 0; 7 | } 8 | 9 | -static int ad9361_set_tx_atten(struct ad9361_rf_phy *phy, u32 atten_mdb, 10 | +int ad9361_set_tx_atten(struct ad9361_rf_phy *phy, u32 atten_mdb, 11 | bool tx1, bool tx2, bool immed) 12 | { 13 | u8 buf[2]; 14 | @@ -1266,8 +1266,8 @@ static int ad9361_set_tx_atten(struct ad9361_rf_phy *phy, u32 atten_mdb, 15 | 16 | return ret; 17 | } 18 | - 19 | -static int ad9361_get_tx_atten(struct ad9361_rf_phy *phy, u32 tx_num) 20 | +EXPORT_SYMBOL(ad9361_set_tx_atten); 21 | +int ad9361_get_tx_atten(struct ad9361_rf_phy *phy, u32 tx_num) 22 | { 23 | u8 buf[2]; 24 | int ret = 0; 25 | @@ -1285,7 +1285,7 @@ static int ad9361_get_tx_atten(struct ad9361_rf_phy *phy, u32 tx_num) 26 | 27 | return code; 28 | } 29 | - 30 | +EXPORT_SYMBOL(ad9361_get_tx_atten); 31 | int ad9361_tx_mute(struct ad9361_rf_phy *phy, u32 state) 32 | { 33 | struct ad9361_rf_phy_state *st = phy->state; 34 | @@ -3744,7 +3744,7 @@ static int ad9361_get_auxadc(struct ad9361_rf_phy *phy) 35 | // Setup Control Outs 36 | //************************************************************ 37 | 38 | -static int ad9361_ctrl_outs_setup(struct ad9361_rf_phy *phy, 39 | +int ad9361_ctrl_outs_setup(struct ad9361_rf_phy *phy, 40 | struct ctrl_outs_control *ctrl) 41 | { 42 | struct spi_device *spi = phy->spi; 43 | @@ -3754,6 +3754,7 @@ static int ad9361_ctrl_outs_setup(struct ad9361_rf_phy *phy, 44 | ad9361_spi_write(spi, REG_CTRL_OUTPUT_POINTER, ctrl->index); // Ctrl Out index 45 | return ad9361_spi_write(spi, REG_CTRL_OUTPUT_ENABLE, ctrl->en_mask); // Ctrl Out [7:0] output enable 46 | } 47 | +EXPORT_SYMBOL(ad9361_ctrl_outs_setup); 48 | //************************************************************ 49 | // Setup GPO 50 | //************************************************************ 51 | @@ -5235,7 +5236,7 @@ static int ad9361_setup(struct ad9361_rf_phy *phy) 52 | 53 | } 54 | 55 | -static int ad9361_do_calib_run(struct ad9361_rf_phy *phy, u32 cal, int arg) 56 | +int ad9361_do_calib_run(struct ad9361_rf_phy *phy, u32 cal, int arg) 57 | { 58 | struct ad9361_rf_phy_state *st = phy->state; 59 | int ret; 60 | @@ -5268,7 +5269,7 @@ static int ad9361_do_calib_run(struct ad9361_rf_phy *phy, u32 cal, int arg) 61 | 62 | return ret; 63 | } 64 | - 65 | +EXPORT_SYMBOL(ad9361_do_calib_run); 66 | static int ad9361_update_rf_bandwidth(struct ad9361_rf_phy *phy, 67 | u32 rf_rx_bw, u32 rf_tx_bw) 68 | { 69 | -------------------------------------------------------------------------------- /kernel_boot/ad9361_conv.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drivers/iio/adc/ad9361_conv.c b/drivers/iio/adc/ad9361_conv.c 2 | index 1902e7d07501..ef421dbd5e70 100644 3 | --- a/drivers/iio/adc/ad9361_conv.c 4 | +++ b/drivers/iio/adc/ad9361_conv.c 5 | @@ -449,7 +449,8 @@ static int ad9361_dig_tune_delay(struct ad9361_rf_phy *phy, 6 | unsigned long max_freq, 7 | enum dig_tune_flags flags, bool tx) 8 | { 9 | - static const unsigned int rates[3] = {25000000U, 40000000U, 61440000U}; 10 | + // static const unsigned int rates[3] = {25000000U, 40000000U, 61440000U}; 11 | + static const unsigned int rates[3] = {25000000U, 40000000U, 40000000U}; 12 | struct axiadc_converter *conv = spi_get_drvdata(phy->spi); 13 | unsigned int s0, s1, c0, c1; 14 | unsigned int i, j, r; 15 | -------------------------------------------------------------------------------- /kernel_boot/axi_hdmi_crtc.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drivers/gpu/drm/adi_axi_hdmi/axi_hdmi_crtc.c b/drivers/gpu/drm/adi_axi_hdmi/axi_hdmi_crtc.c 2 | index f24669f623d6..70c5769019fa 100644 3 | --- a/drivers/gpu/drm/adi_axi_hdmi/axi_hdmi_crtc.c 4 | +++ b/drivers/gpu/drm/adi_axi_hdmi/axi_hdmi_crtc.c 5 | @@ -54,7 +54,7 @@ static struct dma_async_tx_descriptor *axi_hdmi_vdma_prep_interleaved_desc( 6 | memset(&vdma_config, 0, sizeof(vdma_config)); 7 | vdma_config.park = 1; 8 | vdma_config.coalesc = 0xff; 9 | - xilinx_vdma_channel_set_config(axi_hdmi_crtc->dma, &vdma_config); 10 | + // xilinx_vdma_channel_set_config(axi_hdmi_crtc->dma, &vdma_config); 11 | } 12 | #endif 13 | 14 | -------------------------------------------------------------------------------- /kernel_boot/boards/adrv9361z7035/devicetree.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/adrv9361z7035/devicetree.dtb -------------------------------------------------------------------------------- /kernel_boot/boards/adrv9361z7035/u-boot.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/adrv9361z7035/u-boot.elf -------------------------------------------------------------------------------- /kernel_boot/boards/adrv9361z7035_fmc/u-boot.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/adrv9361z7035_fmc/u-boot.elf -------------------------------------------------------------------------------- /kernel_boot/boards/adrv9364z7020/devicetree.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/adrv9364z7020/devicetree.dtb -------------------------------------------------------------------------------- /kernel_boot/boards/adrv9364z7020/u-boot.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/adrv9364z7020/u-boot.elf -------------------------------------------------------------------------------- /kernel_boot/boards/antsdr/devicetree.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/antsdr/devicetree.dtb -------------------------------------------------------------------------------- /kernel_boot/boards/antsdr/notes.md: -------------------------------------------------------------------------------- 1 | # antsdr for openwifi-hw 2 | 3 | ## Introduction 4 | [ANTSDR](https://github.com/MicroPhase/antsdr-fw) is a SDR hardware platform based on [xilinx zynq7020](https://www.xilinx.com/products/silicon-devices/soc/zynq-7000.html) and [adi ad936x](https://www.analog.com/en/products/ad9361.html). It could be used as a traditional SDR device such as PlutoSDR or FMCOMMS2/3/4 with Xilinx evaluation board, and it also be used as hardware platform to support openwifi. 5 | 6 | 9 | 12 | 13 | ## Work to be done 14 | The antsdr has RF switch in the front-end, for now, the RF switch is fixed at a higer range, which will isolation the frequency below 3GHz and pass the frequency at 3GHz~6GHz. 15 | For future work, it can add the rf swicth control in the devicetree, and this will change the rf switch with the frequency change. 16 | -------------------------------------------------------------------------------- /kernel_boot/boards/antsdr/u-boot.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/antsdr/u-boot.elf -------------------------------------------------------------------------------- /kernel_boot/boards/antsdr_e200/README.md: -------------------------------------------------------------------------------- 1 | # ANTSDR-E200 2 | 3 | ANTSDR-E200 is similar to MicroPhase ANTSDR-E310 device. 4 | 5 | ANTSDR-E200 has a smaller size and some differences in hardware structure. The ethernet is placed at the PL side. 6 | 7 | ![e200_struct](README.assets/e200_struct.svg) 8 | 9 | Since the performance of the zynq processor is not very strong, the Ethernet cannot run at a very high bandwidth. For some SDR applications, the Ethernet may be required to transmit baseband signals above 20MSPS sample rate. In this case, the bandwidth of the Ethernet will reach 80MB/s. If the Ethernet on the PS side wants to run at this bandwidth, it will take up a lot of CPU resources and the bandwidth is still difficult to meet. For this reason, we moved the network port to the PL side. 10 | 11 | But this has no effect on IIO-based SDR drivers, because we still use ZYNQ's GEM controller. O(∩_∩)O 12 | 13 | When we moved the ethernet to PL, the ANTSDR-E200 could support UHD driver, If anyone is interested in this, you can refer to our project [antsdr_uhd](https://github.com/MicroPhase/antsdr_uhd). 14 | 15 | -------------------------------------------------------------------------------- /kernel_boot/boards/antsdr_e200/devicetree.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/antsdr_e200/devicetree.dtb -------------------------------------------------------------------------------- /kernel_boot/boards/antsdr_e200/u-boot.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/antsdr_e200/u-boot.elf -------------------------------------------------------------------------------- /kernel_boot/boards/e310v2/README.assets/struct.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/e310v2/README.assets/struct.png -------------------------------------------------------------------------------- /kernel_boot/boards/e310v2/README.md: -------------------------------------------------------------------------------- 1 | # ANTSDR-E310V2 2 | 3 | **AntSDR E310V2** is a powerful and versatile software-defined radio (SDR) platform. It is a low-cost, easy-to-use system for developing, testing, and deploying wireless communication solutions such as LTE, GSM, and Wi-Fi. With its wide range of supported frequencies and modulation schemes, it’s possible to easily experiment with various wireless technologies. 4 | 5 | ![struct](README.assets/struct.png) 6 | 7 | Based on the original version, we have optimized the RF performance, added a GPS module, increased an external 10M/PPS input interface, and used a VCXO. The combination of VCXO and external reference input with DAC can generate a more accurate and stable clock. In addition, the Ethernet on the PL makes it possible for E310V2 to be compatible with UHD for higher bandwidth transmission. 8 | 9 | If you are interested in using UHD with E310V2, you can find more information in our [repository](https://github.com/MicroPhase/antsdr_uhd). 10 | 11 | -------------------------------------------------------------------------------- /kernel_boot/boards/e310v2/devicetree.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/e310v2/devicetree.dtb -------------------------------------------------------------------------------- /kernel_boot/boards/e310v2/u-boot.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/e310v2/u-boot.elf -------------------------------------------------------------------------------- /kernel_boot/boards/neptunesdr/devicetree.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/neptunesdr/devicetree.dtb -------------------------------------------------------------------------------- /kernel_boot/boards/neptunesdr/u-boot.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/neptunesdr/u-boot.elf -------------------------------------------------------------------------------- /kernel_boot/boards/sdrpi/devicetree.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/sdrpi/devicetree.dtb -------------------------------------------------------------------------------- /kernel_boot/boards/sdrpi/notes.md: -------------------------------------------------------------------------------- 1 | # sdrpi for openwifi 2 | 3 | ## Introduction 4 | [SDRPi](https://github.com/hexsdr/) is a smart and powerful SDR platform according Raspberry Pi size,which is based on [xilinx zynq7020](https://www.xilinx.com/products/silicon-devices/soc/zynq-7000.html) and [adi ad936x](https://www.analog.com/en/products/ad9361.html). 5 | 6 | 7 | 8 | Hareware feature is : ZYNQ 7Z020CLG400 ,1GB DDR3 memory fo PS, 1G Ethernet RJ45 for PS,1G Ethernet RJ45 for PL, USB OTG(act as USB host or USB SLAVE ), dual USB uarts for PS and PL,on board USB to JTAG debuger,TF card , bootable QSPI FLASH and also external 27 IO pins from PL bank in 3.3v vatage with enable this board connect to other boards or modules. AD9361 RF design is based FMCOMMS3 with RF amplifier additionally.It also has a Ublox m8t GPS module and 40MHZ VCXO. 9 | 10 | 11 | 12 | 13 | It could be used as a traditional SDR device such as PlutoSDR or FMCOMMS2/3/4 with Xilinx evaluation board, and it also be used as hardware platform to support openwifi. 14 | 15 | 16 | -------------------------------------------------------------------------------- /kernel_boot/boards/sdrpi/u-boot.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/sdrpi/u-boot.elf -------------------------------------------------------------------------------- /kernel_boot/boards/zc702_fmcs2/devicetree.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/zc702_fmcs2/devicetree.dtb -------------------------------------------------------------------------------- /kernel_boot/boards/zc702_fmcs2/u-boot.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/zc702_fmcs2/u-boot.elf -------------------------------------------------------------------------------- /kernel_boot/boards/zc706_fmcs2/devicetree.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/zc706_fmcs2/devicetree.dtb -------------------------------------------------------------------------------- /kernel_boot/boards/zc706_fmcs2/u-boot.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/zc706_fmcs2/u-boot.elf -------------------------------------------------------------------------------- /kernel_boot/boards/zcu102_fmcs2/bl31.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/zcu102_fmcs2/bl31.elf -------------------------------------------------------------------------------- /kernel_boot/boards/zcu102_fmcs2/system.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/zcu102_fmcs2/system.dtb -------------------------------------------------------------------------------- /kernel_boot/boards/zcu102_fmcs2/u-boot_xilinx_zynqmp_zcu102_revA.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/zcu102_fmcs2/u-boot_xilinx_zynqmp_zcu102_revA.elf -------------------------------------------------------------------------------- /kernel_boot/boards/zed_fmcs2/devicetree.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/zed_fmcs2/devicetree.dtb -------------------------------------------------------------------------------- /kernel_boot/boards/zed_fmcs2/u-boot.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/kernel_boot/boards/zed_fmcs2/u-boot.elf -------------------------------------------------------------------------------- /kernel_boot/build_boot_bin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | HDF_FILE=$1 5 | UBOOT_FILE=$2 6 | BUILD_DIR=build_boot_bin 7 | OUTPUT_DIR=output_boot_bin 8 | 9 | usage () { 10 | echo "usage: $0 system_top. u-boot.elf [output-archive]" 11 | exit 1 12 | } 13 | 14 | depends () { 15 | echo Xilinx $1 must be installed and in your PATH 16 | echo try: source /opt/Xilinx/Vivado/201x.x/settings64.sh 17 | exit 1 18 | } 19 | 20 | ### Check command line parameters 21 | echo $HDF_FILE | grep -q ".hdf\|.xsa" || usage 22 | echo $UBOOT_FILE | grep -q -e ".elf" -e "uboot" -e "u-boot"|| usage 23 | 24 | if [ ! -f $HDF_FILE ]; then 25 | echo $HDF_FILE: File not found! 26 | usage 27 | fi 28 | 29 | if [ ! -f $UBOOT_FILE ]; then 30 | echo $UBOOT_FILE: File not found! 31 | usage 32 | fi 33 | 34 | ### Check for required Xilinx tools (xcst is equivalent with 'xsdk -batch') 35 | command -v xsct >/dev/null 2>&1 || depends xsct 36 | command -v bootgen >/dev/null 2>&1 || depends bootgen 37 | 38 | rm -Rf $BUILD_DIR $OUTPUT_DIR 39 | mkdir -p $OUTPUT_DIR 40 | mkdir -p $BUILD_DIR 41 | 42 | cp $HDF_FILE $BUILD_DIR/ 43 | cp $UBOOT_FILE $OUTPUT_DIR/u-boot.elf 44 | cp $HDF_FILE $OUTPUT_DIR/ 45 | 46 | ### Create create_fsbl_project.tcl file used by xsct to create the fsbl. 47 | echo "hsi open_hw_design `basename $HDF_FILE`" > $BUILD_DIR/create_fsbl_project.tcl 48 | echo 'set cpu_name [lindex [hsi get_cells -filter {IP_TYPE==PROCESSOR}] 0]' >> $BUILD_DIR/create_fsbl_project.tcl 49 | ### The fsbl creating flow is different starting with 2019.2 Xilinx version 50 | if [[ "$HDF_FILE" =~ ".hdf" ]];then 51 | echo 'sdk setws ./build/sdk' >> $BUILD_DIR/create_fsbl_project.tcl 52 | echo "sdk createhw -name hw_0 -hwspec `basename $HDF_FILE`" >> $BUILD_DIR/create_fsbl_project.tcl 53 | echo 'sdk createapp -name fsbl -hwproject hw_0 -proc $cpu_name -os standalone -lang C -app {Zynq FSBL}' >> $BUILD_DIR/create_fsbl_project.tcl 54 | echo 'configapp -app fsbl build-config release' >> $BUILD_DIR/create_fsbl_project.tcl 55 | echo 'sdk projects -build -type all' >> $BUILD_DIR/create_fsbl_project.tcl 56 | 57 | FSBL_PATH="$BUILD_DIR/build/sdk/fsbl/Release/fsbl.elf" 58 | SYSTEM_TOP_BIT_PATH="$BUILD_DIR/build/sdk/hw_0/system_top.bit" 59 | else 60 | echo 'platform create -name hw0 -hw system_top.xsa -os standalone -out ./build/sdk -proc $cpu_name' >> $BUILD_DIR/create_fsbl_project.tcl 61 | echo 'platform generate' >> $BUILD_DIR/create_fsbl_project.tcl 62 | 63 | FSBL_PATH="$BUILD_DIR/build/sdk/hw0/export/hw0/sw/hw0/boot/fsbl.elf" 64 | SYSTEM_TOP_BIT_PATH="$BUILD_DIR/build/sdk/hw0/hw/system_top.bit" 65 | fi 66 | 67 | ### Create zynq.bif file used by bootgen 68 | echo 'the_ROM_image:' > $OUTPUT_DIR/zynq.bif 69 | echo '{' >> $OUTPUT_DIR/zynq.bif 70 | echo '[bootloader] fsbl.elf' >> $OUTPUT_DIR/zynq.bif 71 | echo 'system_top.bit' >> $OUTPUT_DIR/zynq.bif 72 | echo 'u-boot.elf' >> $OUTPUT_DIR/zynq.bif 73 | echo '}' >> $OUTPUT_DIR/zynq.bif 74 | 75 | ### Build fsbl.elf 76 | ( 77 | cd $BUILD_DIR 78 | xsct create_fsbl_project.tcl 79 | ) 80 | 81 | ### Copy fsbl and system_top.bit into the output folder 82 | cp $FSBL_PATH $OUTPUT_DIR/fsbl.elf 83 | cp $SYSTEM_TOP_BIT_PATH $OUTPUT_DIR/system_top.bit 84 | 85 | ### Build BOOT.BIN 86 | ( 87 | cd $OUTPUT_DIR 88 | bootgen -arch zynq -image zynq.bif -o BOOT.BIN -w 89 | ) 90 | 91 | ### Optionally tar.gz the entire output folder with the name given in argument 3 92 | if [ ${#3} -ne 0 ]; then 93 | tar czvf $3.tar.gz $OUTPUT_DIR 94 | fi 95 | -------------------------------------------------------------------------------- /kernel_boot/kernel_patch_readme.md: -------------------------------------------------------------------------------- 1 | axi_hdmi_crtc.patch to avoid axi hdmi compiling error after enable Xilinx axi dma. 2 | 3 | ad9361.patch to expose some APIs for openwifi driver. 4 | 5 | ad9361_conv.patch to avoid 61.44Msps lvds interface self timing calibration for some low-end/bad hardware (sometimes difficult). 6 | 7 | -------------------------------------------------------------------------------- /openwifi-arch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/openwifi-arch.jpg -------------------------------------------------------------------------------- /openwifi-arch.jpg.license: -------------------------------------------------------------------------------- 1 | 2 | # Author: Xianjun jiao 3 | 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | -------------------------------------------------------------------------------- /user_space/arbitrary_iq_gen/iq_single_carrier_1000000Hz_512.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/user_space/arbitrary_iq_gen/iq_single_carrier_1000000Hz_512.bin -------------------------------------------------------------------------------- /user_space/arbitrary_iq_gen/single_carrier_gen.m: -------------------------------------------------------------------------------- 1 | % Author: Xianjun Jiao (xianjun.jiao@imec.be; putaoshu@msn.com) 2 | % SPDX-FileCopyrightText: 2023 UGent 3 | % SPDX-License-Identifier: AGPL-3.0-or-later 4 | 5 | function single_carrier_gen(carrier_freq, num_iq) 6 | if exist('carrier_freq', 'var')==0 || isempty(carrier_freq) 7 | carrier_freq = 1e6; 8 | end 9 | 10 | if exist('num_iq', 'var')==0 || isempty(num_iq) 11 | num_iq = 512; 12 | end 13 | 14 | sampling_rate = 20e6; 15 | sampling_time = 1/sampling_rate; 16 | t = (0.3+(0:(num_iq-1))).*sampling_time; 17 | s = exp(2.*pi.*carrier_freq.*t.*1i); 18 | 19 | %let's use 14 bits 20 | real_part = round(real(s).*(2^14)); 21 | imag_part = round(imag(s).*(2^14)); 22 | 23 | filename = ['iq_single_carrier_' num2str(carrier_freq) 'Hz_' num2str(num_iq) '.txt']; 24 | fid = fopen(filename,'w'); 25 | if fid == -1 26 | disp('fopen failed'); 27 | return; 28 | end 29 | len = length(s); 30 | for j=1:len 31 | fprintf(fid, '%d,%d\n', real_part(j), imag_part(j)); 32 | end 33 | fclose(fid); 34 | disp(['Saved to ' filename]); 35 | 36 | filename = ['iq_single_carrier_' num2str(carrier_freq) 'Hz_' num2str(num_iq) '.bin']; 37 | fid = fopen(filename,'w'); 38 | if fid == -1 39 | disp('fopen error'); 40 | return; 41 | end 42 | 43 | iq_int16 = [real_part; imag_part]; 44 | iq_int16 = iq_int16(:); 45 | 46 | fwrite(fid, iq_int16, 'int16'); 47 | fclose(fid); 48 | disp(['Saved to ' filename]); 49 | -------------------------------------------------------------------------------- /user_space/boot_bin_gen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | if [ "$#" -ne 3 ]; then 8 | echo "You must enter exactly 3 arguments: \$XILINX_DIR \$BOARD_NAME DIR_TO_system_top.xsa" 9 | exit 1 10 | fi 11 | 12 | XILINX_DIR=$1 13 | BOARD_NAME=$2 14 | XSA_FILE=$3 15 | 16 | OPENWIFI_DIR=$(pwd)/../ 17 | 18 | echo OPENWIFI_DIR $OPENWIFI_DIR 19 | echo XSA_FILE $XSA_FILE 20 | 21 | if [ -f "$OPENWIFI_DIR/LICENSE" ]; then 22 | echo "\$OPENWIFI_DIR is found!" 23 | else 24 | echo "\$OPENWIFI_DIR is not correct. Please check!" 25 | exit 1 26 | fi 27 | 28 | if [ -d "$XILINX_DIR/Vitis" ]; then 29 | echo "\$XILINX_DIR is found!" 30 | else 31 | echo "\$XILINX_DIR is not correct. Please check!" 32 | exit 1 33 | fi 34 | 35 | # if [ "$BOARD_NAME" != "antsdr" ] && [ "$BOARD_NAME" != "zc706_fmcs2" ] && [ "$BOARD_NAME" != "zc702_fmcs2" ] && [ "$BOARD_NAME" != "zed_fmcs2" ] && [ "$BOARD_NAME" != "adrv9361z7035" ] && [ "$BOARD_NAME" != "adrv9364z7020" ]; then 36 | # echo "\$BOARD_NAME is not correct. Please check!" 37 | # exit 1 38 | # else 39 | # echo "\$BOARD_NAME is found!" 40 | # fi 41 | 42 | if [ -f "$XSA_FILE" ]; then 43 | echo "\$XSA_FILE is found!" 44 | else 45 | echo "\$XSA_FILE is not found. Please check!" 46 | exit 1 47 | fi 48 | 49 | home_dir=$(pwd) 50 | 51 | set -ex 52 | 53 | source $XILINX_DIR/Vitis/2021.1/settings64.sh 54 | 55 | cd $OPENWIFI_DIR/kernel_boot 56 | 57 | if [ "$BOARD_NAME" == "zcu102_fmcs2" ] || [ "$BOARD_NAME" == "zcu102_9371" ]; then 58 | ./build_zynqmp_boot_bin.sh $XSA_FILE boards/$BOARD_NAME/u-boot_xilinx_zynqmp_zcu102_revA.elf boards/$BOARD_NAME/bl31.elf 59 | ARCH="zynqmp" 60 | ARCH_BIT=64 61 | elif [ "$BOARD_NAME" == "antsdr" ] || [ "$BOARD_NAME" == "antsdr_e200" ] || [ "$BOARD_NAME" == "e310v2" ] || [ "$BOARD_NAME" == "sdrpi" ] || [ "$BOARD_NAME" == "neptunesdr" ] || [ "$BOARD_NAME" == "zc706_fmcs2" ] || [ "$BOARD_NAME" == "zc702_fmcs2" ] || [ "$BOARD_NAME" == "zed_fmcs2" ] || [ "$BOARD_NAME" == "adrv9361z7035" ] || [ "$BOARD_NAME" == "adrv9364z7020" ]; then 62 | ./build_boot_bin.sh $XSA_FILE boards/$BOARD_NAME/u-boot.elf 63 | ARCH="zynq" 64 | ARCH_BIT=32 65 | else 66 | echo "\$BOARD_NAME is not correct. Please check!" 67 | cd $home_dir 68 | exit 1 69 | fi 70 | 71 | rm -rf build_boot_bin 72 | rm -rf boards/$BOARD_NAME/output_boot_bin 73 | mv output_boot_bin boards/$BOARD_NAME/ 74 | 75 | cd $home_dir 76 | 77 | # generate system_top.bit.bin for FPGA dynamic loading 78 | unzip -o $XSA_FILE 79 | rm -rf ./system_top.bit.bin 80 | bootgen -image system_top.bif -arch $ARCH -process_bitstream bin -w 81 | ls ./system_top.bit.bin -al 82 | -------------------------------------------------------------------------------- /user_space/build_wpa_supplicant_wo11b.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Michael Mehari 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | # if [ "$#" -ne 1 ]; then 8 | # echo "You must enter exactly 1 arguments: \$OPENWIFI_DIR" 9 | # exit 1 10 | # fi 11 | 12 | OPENWIFI_DIR=$(pwd)/../ 13 | 14 | set -x 15 | 16 | cd $OPENWIFI_DIR/user_space 17 | wget http://w1.fi/releases/wpa_supplicant-2.1.tar.gz 18 | tar xzvf wpa_supplicant-2.1.tar.gz 19 | patch -d wpa_supplicant-2.1/src/drivers/ < driver_nl80211.patch 20 | cd wpa_supplicant-2.1/wpa_supplicant/ 21 | cp defconfig .config 22 | sed -i 's/#CONFIG_LIBNL32.*/CONFIG_LIBNL32=y/g' .config 23 | make -j16 24 | # sudo make install 25 | cd ../../ 26 | rm -r wpa_supplicant-2.1/ wpa_supplicant-2.1.tar.gz 27 | -------------------------------------------------------------------------------- /user_space/cd_adi_iio_dir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2022 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | set -x 8 | if test -f "/sys/bus/iio/devices/iio:device0/in_voltage_rf_bandwidth"; then 9 | cd /sys/bus/iio/devices/iio:device0/ 10 | else if test -f "/sys/bus/iio/devices/iio:device1/in_voltage_rf_bandwidth"; then 11 | cd /sys/bus/iio/devices/iio:device1/ 12 | else if test -f "/sys/bus/iio/devices/iio:device2/in_voltage_rf_bandwidth"; then 13 | cd /sys/bus/iio/devices/iio:device2/ 14 | else if test -f "/sys/bus/iio/devices/iio:device3/in_voltage_rf_bandwidth"; then 15 | cd /sys/bus/iio/devices/iio:device3/ 16 | else if test -f "/sys/bus/iio/devices/iio:device4/in_voltage_rf_bandwidth"; then 17 | cd /sys/bus/iio/devices/iio:device4/ 18 | else 19 | echo "Can not find in_voltage_rf_bandwidth!" 20 | echo "Check log to make sure ad9361 driver is loaded!" 21 | exit 1 22 | fi 23 | fi 24 | fi 25 | fi 26 | fi 27 | set +x 28 | -------------------------------------------------------------------------------- /user_space/check_calib_inf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -x 4 | if test -f "/sys/kernel/debug/iio/iio:device0/direct_reg_access"; then 5 | device_path=/sys/kernel/debug/iio/iio:device0/ 6 | else if test -f "/sys/kernel/debug/iio/iio:device1/direct_reg_access"; then 7 | device_path=/sys/kernel/debug/iio/iio:device1/ 8 | else if test -f "/sys/kernel/debug/iio/iio:device2/direct_reg_access"; then 9 | device_path=/sys/kernel/debug/iio/iio:device2/ 10 | else if test -f "/sys/kernel/debug/iio/iio:device3/direct_reg_access"; then 11 | device_path=/sys/kernel/debug/iio/iio:device3/ 12 | else if test -f "/sys/kernel/debug/iio/iio:device4/direct_reg_access"; then 13 | device_path=/sys/kernel/debug/iio/iio:device4/ 14 | else 15 | echo "Check log to make sure ad9361 driver is loaded!" 16 | exit 1 17 | fi 18 | fi 19 | fi 20 | fi 21 | fi 22 | set +x 23 | 24 | (bash -c 'echo $PPID' > /tmp/check_calib_inf.pid 25 | while true; do 26 | echo 0x0A7 > ${device_path}direct_reg_access 27 | status=$( cat ${device_path}direct_reg_access ) 28 | if [ $status == "0xFF" ]; then 29 | echo "WARNING: Tx Quadrature Calibration failed." 30 | fi 31 | sleep 5 32 | done) & 33 | 34 | -------------------------------------------------------------------------------- /user_space/csi_fuzzer.sh: -------------------------------------------------------------------------------- 1 | 2 | #!/bin/bash 3 | 4 | # Author: Xianjun Jiao 5 | # SPDX-FileCopyrightText: 2021 UGent 6 | # SPDX-License-Identifier: AGPL-3.0-or-later 7 | 8 | if [ "$#" -lt 4 ]; then 9 | echo "You must enter 4 arguments: c1_rot90_en c1_raw(-64 to 63) c2_rot90_en c2_raw(-64 to 63)" 10 | exit 1 11 | fi 12 | 13 | c1_rot90_en=$1 14 | c1_raw=$2 15 | c2_rot90_en=$3 16 | c2_raw=$4 17 | 18 | if (($c1_rot90_en != 0)) && (($c1_rot90_en != 1)); then 19 | echo "c1_rot90_en must be 0 or 1!" 20 | exit 1 21 | fi 22 | 23 | if (($c1_raw < -64)) || (($c1_raw > 63)); then 24 | echo "c1_raw must be -64 to 63!" 25 | exit 1 26 | fi 27 | 28 | if (($c2_rot90_en != 0)) && (($c2_rot90_en != 1)); then 29 | echo "c2_rot90_en must be 0 or 1!" 30 | exit 1 31 | fi 32 | 33 | if (($c2_raw < -64)) || (($c2_raw > 63)); then 34 | echo "c2_raw must be -64 to 63!" 35 | exit 1 36 | fi 37 | 38 | if (($c1_raw < 0)); then 39 | unsigned_c1=$(expr 128 + $c1_raw) 40 | # echo $unsigned_c1 41 | else 42 | unsigned_c1=$c1_raw 43 | fi 44 | 45 | if (($c2_raw < 0)); then 46 | unsigned_c2=$(expr 128 + $c2_raw) 47 | # echo $unsigned_c2 48 | else 49 | unsigned_c2=$c2_raw 50 | fi 51 | 52 | # echo $c1_rot90_en 53 | # echo $unsigned_c1 54 | # echo $c2_rot90_en 55 | # echo $unsigned_c2 56 | 57 | unsigned_dec_combined=$(($unsigned_c1 + 512 * $c1_rot90_en + 1024 * $unsigned_c2 + 524288 * $c2_rot90_en)) 58 | # echo $unsigned_dec_combined 59 | 60 | echo "./sdrctl dev sdr0 set reg tx_intf 5 $unsigned_dec_combined" 61 | ./sdrctl dev sdr0 set reg tx_intf 5 $unsigned_dec_combined 62 | -------------------------------------------------------------------------------- /user_space/csi_fuzzer_scan.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2021 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | if [ "$#" -lt 1 ]; then 8 | echo "You must enter 1 arguments: 1, 2, 3 or 4. For scan c1, c2, c2&c1 or c1&c2," 9 | exit 1 10 | fi 11 | 12 | SCAN_OPTION=$1 13 | 14 | if (($SCAN_OPTION == 1)); then 15 | echo "Scan tap1:" 16 | for j in {-64..63}; 17 | do 18 | for i in {-64..63}; 19 | do 20 | ./csi_fuzzer.sh 0 $i 0 0 21 | sleep 0.01 22 | done 23 | for i in {-64..63}; 24 | do 25 | ./csi_fuzzer.sh 1 $i 0 0 26 | sleep 0.01 27 | done 28 | done 29 | exit 1 30 | fi 31 | 32 | if (($SCAN_OPTION == 2)); then 33 | echo "Scan tap2:" 34 | for j in {-64..63}; 35 | do 36 | for i in {-64..63}; 37 | do 38 | ./csi_fuzzer.sh 0 0 0 $i 39 | sleep 0.01 40 | done 41 | for i in {-64..63}; 42 | do 43 | ./csi_fuzzer.sh 0 0 1 $i 44 | sleep 0.01 45 | done 46 | done 47 | exit 1 48 | fi 49 | 50 | if (($SCAN_OPTION == 3)); then 51 | echo "Scan tap1 after tap2:" 52 | for j in {-64..63}; 53 | do 54 | for i in {-64..63}; 55 | do 56 | ./csi_fuzzer.sh 0 $j 0 $i 57 | # sleep 0.1 58 | done 59 | for i in {-64..63}; 60 | do 61 | ./csi_fuzzer.sh 0 $j 1 $i 62 | # sleep 0.1 63 | done 64 | done 65 | for j in {-64..63}; 66 | do 67 | for i in {-64..63}; 68 | do 69 | ./csi_fuzzer.sh 1 $j 0 $i 70 | # sleep 0.1 71 | done 72 | for i in {-64..63}; 73 | do 74 | ./csi_fuzzer.sh 1 $j 1 $i 75 | # sleep 0.1 76 | done 77 | done 78 | exit 1 79 | fi 80 | 81 | if (($SCAN_OPTION == 4)); then 82 | echo "Scan tap2 after tap1:" 83 | for j in {-64..63}; 84 | do 85 | for i in {-64..63}; 86 | do 87 | ./csi_fuzzer.sh 0 $i 0 $j 88 | # sleep 0.1 89 | done 90 | for i in {-64..63}; 91 | do 92 | ./csi_fuzzer.sh 1 $i 0 $j 93 | # sleep 0.1 94 | done 95 | done 96 | for j in {-64..63}; 97 | do 98 | for i in {-64..63}; 99 | do 100 | ./csi_fuzzer.sh 0 $i 1 $j 101 | # sleep 0.1 102 | done 103 | for i in {-64..63}; 104 | do 105 | ./csi_fuzzer.sh 1 $i 1 $j 106 | # sleep 0.1 107 | done 108 | done 109 | exit 1 110 | fi 111 | -------------------------------------------------------------------------------- /user_space/cw_disable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | set -x 12 | #set 13 | if [[ -n $1 ]]; then 14 | echo "3$1" > csma_cfg0 15 | fi 16 | 17 | # show 18 | cat csma_cfg0 19 | set +x 20 | 21 | cd $home_dir 22 | -------------------------------------------------------------------------------- /user_space/cw_max_min_cfg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | set -x 12 | #set 13 | if [[ -n $1 ]]; then 14 | echo "$1" > cw_max_min_cfg 15 | fi 16 | 17 | # show 18 | cat cw_max_min_cfg 19 | set +x 20 | 21 | cd $home_dir -------------------------------------------------------------------------------- /user_space/dhcpd.conf: -------------------------------------------------------------------------------- 1 | # 2 | # Sample configuration file for ISC dhcpd for Debian 3 | # 4 | # Attention: If /etc/ltsp/dhcpd.conf exists, that will be used as 5 | # configuration file instead of this file. 6 | # 7 | # 8 | 9 | # The ddns-updates-style parameter controls whether or not the server will 10 | # attempt to do a DNS update when a lease is confirmed. We default to the 11 | # behavior of the version 2 packages ('none', since DHCP v2 didn't 12 | # have support for DDNS.) 13 | ddns-update-style none; 14 | 15 | # option definitions common to all supported networks... 16 | # option domain-name "orca-project.eu"; 17 | #option domain-name-servers ns1.example.org, ns2.example.org; 18 | 19 | default-lease-time 600; 20 | max-lease-time 7200; 21 | 22 | # If this DHCP server is the official DHCP server for the local 23 | # network, the authoritative directive should be uncommented. 24 | #authoritative; 25 | 26 | # Use this to send dhcp log messages to a different log file (you also 27 | # have to hack syslog.conf to complete the redirection). 28 | log-facility local7; 29 | 30 | # No service will be given on this subnet, but declaring it helps the 31 | # DHCP server to understand the network topology. 32 | 33 | option subnet-mask 255.255.255.0; 34 | option broadcast-address 192.168.13.255; 35 | option routers 192.168.13.1; 36 | option domain-name-servers 8.8.8.8, 4.4.4.4; 37 | option domain-name "mydomain.example"; 38 | 39 | subnet 192.168.13.0 netmask 255.255.255.0 { 40 | # default-lease-time 6000; 41 | # max-lease-time 7200; 42 | option routers 192.168.13.1; 43 | range 192.168.13.2 192.168.13.254; 44 | } 45 | 46 | #subnet 10.152.187.0 netmask 255.255.255.0 { 47 | #} 48 | 49 | # This is a very basic subnet declaration. 50 | 51 | #subnet 10.254.239.0 netmask 255.255.255.224 { 52 | # range 10.254.239.10 10.254.239.20; 53 | # option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org; 54 | #} 55 | 56 | # This declaration allows BOOTP clients to get dynamic addresses, 57 | # which we don't really recommend. 58 | 59 | #subnet 10.254.239.32 netmask 255.255.255.224 { 60 | # range dynamic-bootp 10.254.239.40 10.254.239.60; 61 | # option broadcast-address 10.254.239.31; 62 | # option routers rtr-239-32-1.example.org; 63 | #} 64 | 65 | # A slightly different configuration for an internal subnet. 66 | #subnet 10.5.5.0 netmask 255.255.255.224 { 67 | # range 10.5.5.26 10.5.5.30; 68 | # option domain-name-servers ns1.internal.example.org; 69 | # option domain-name "internal.example.org"; 70 | # option routers 10.5.5.1; 71 | # option broadcast-address 10.5.5.31; 72 | # default-lease-time 600; 73 | # max-lease-time 7200; 74 | #} 75 | 76 | # Hosts which require special configuration options can be listed in 77 | # host statements. If no address is specified, the address will be 78 | # allocated dynamically (if possible), but the host-specific information 79 | # will still come from the host declaration. 80 | 81 | #host passacaglia { 82 | # hardware ethernet 0:0:c0:5d:bd:95; 83 | # filename "vmunix.passacaglia"; 84 | # server-name "toccata.fugue.com"; 85 | #} 86 | 87 | # Fixed IP addresses can also be specified for hosts. These addresses 88 | # should not also be listed as being available for dynamic assignment. 89 | # Hosts for which fixed IP addresses have been specified can boot using 90 | # BOOTP or DHCP. Hosts for which no fixed address is specified can only 91 | # be booted with DHCP, unless there is an address range on the subnet 92 | # to which a BOOTP client is connected which has the dynamic-bootp flag 93 | # set. 94 | #host fantasia { 95 | # hardware ethernet 08:00:07:26:c0:a5; 96 | # fixed-address fantasia.fugue.com; 97 | #} 98 | 99 | # You can declare a class of clients and then do address allocation 100 | # based on that. The example below shows a case where all clients 101 | # in a certain class get addresses on the 10.17.224/24 subnet, and all 102 | # other clients get addresses on the 10.0.29/24 subnet. 103 | 104 | #class "foo" { 105 | # match if substring (option vendor-class-identifier, 0, 4) = "SUNW"; 106 | #} 107 | 108 | #shared-network 224-29 { 109 | # subnet 10.17.224.0 netmask 255.255.255.0 { 110 | # option routers rtr-224.example.org; 111 | # } 112 | # subnet 10.0.29.0 netmask 255.255.255.0 { 113 | # option routers rtr-29.example.org; 114 | # } 115 | # pool { 116 | # allow members of "foo"; 117 | # range 10.17.224.10 10.17.224.250; 118 | # } 119 | # pool { 120 | # deny members of "foo"; 121 | # range 10.0.29.10 10.0.29.230; 122 | # } 123 | #} 124 | -------------------------------------------------------------------------------- /user_space/difs_disable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | set -x 12 | #set 13 | if [[ -n $1 ]]; then 14 | echo "1$1" > csma_cfg0 15 | fi 16 | 17 | # show 18 | cat csma_cfg0 19 | set +x 20 | 21 | cd $home_dir 22 | -------------------------------------------------------------------------------- /user_space/driver_nl80211.patch: -------------------------------------------------------------------------------- 1 | --- wpa_supplicant-2.1/src/drivers/driver_nl80211.c 2014-02-04 12:23:35.000000000 +0100 2 | +++ driver_nl80211.c 2020-01-09 09:11:35.943884000 +0100 3 | @@ -5903,6 +5903,8 @@ 4 | wpa_driver_nl80211_set_mode(bss, nlmode) < 0) 5 | return -1; 6 | 7 | + nl80211_disable_11b_rates(drv, drv->ifindex, 1); 8 | + 9 | retry: 10 | msg = nlmsg_alloc(); 11 | if (!msg) 12 | @@ -8625,6 +8627,7 @@ 13 | } 14 | 15 | nl80211_mark_disconnected(drv); 16 | + nl80211_disable_11b_rates(drv, drv->ifindex, 1); 17 | 18 | msg = nlmsg_alloc(); 19 | if (!msg) 20 | -------------------------------------------------------------------------------- /user_space/drv_and_fpga_package_gen.sh: -------------------------------------------------------------------------------- 1 | 2 | #!/bin/bash 3 | 4 | # Author: Xianjun Jiao 5 | # SPDX-FileCopyrightText: 2022 UGent 6 | # SPDX-License-Identifier: AGPL-3.0-or-later 7 | 8 | if [ "$#" -ne 3 ]; then 9 | echo "You have input $# arguments." 10 | echo "You must enter exactly 3 arguments: \$OPENWIFI_HW_IMG_DIR \$XILINX_DIR \$BOARD_NAME" 11 | exit 1 12 | fi 13 | 14 | OPENWIFI_HW_IMG_DIR=$1 15 | XILINX_DIR=$2 16 | BOARD_NAME=$3 17 | 18 | if [ -d "$XILINX_DIR/Vitis" ]; then 19 | echo "\$XILINX_DIR is found!" 20 | else 21 | echo "\$XILINX_DIR is not correct. Please check!" 22 | exit 1 23 | fi 24 | 25 | if [ "$BOARD_NAME" != "neptunesdr" ] && [ "$BOARD_NAME" != "antsdr" ] && [ "$BOARD_NAME" != "antsdr_e200" ] && [ "$BOARD_NAME" != "e310v2" ] && [ "$BOARD_NAME" != "sdrpi" ] && [ "$BOARD_NAME" != "zc706_fmcs2" ] && [ "$BOARD_NAME" != "zc702_fmcs2" ] && [ "$BOARD_NAME" != "zed_fmcs2" ] && [ "$BOARD_NAME" != "adrv9361z7035" ] && [ "$BOARD_NAME" != "adrv9364z7020" ] && [ "$BOARD_NAME" != "zcu102_fmcs2" ] && [ "$BOARD_NAME" != "zcu102_9371" ]; then 26 | echo "\$BOARD_NAME is not correct. Please check!" 27 | exit 1 28 | else 29 | echo "\$BOARD_NAME is found!" 30 | fi 31 | 32 | if [ -d "$OPENWIFI_HW_IMG_DIR/boards/$BOARD_NAME" ]; then 33 | echo "\$OPENWIFI_HW_IMG_DIR is found!" 34 | else 35 | echo "\$OPENWIFI_HW_IMG_DIR is not correct. Please check!" 36 | exit 1 37 | fi 38 | 39 | # uncompress the system.hdf and system_top.bit for use 40 | mkdir -p hdf_and_bit 41 | rm hdf_and_bit/* -rf 42 | unzip $OPENWIFI_HW_IMG_DIR/boards/$BOARD_NAME/sdk/system_top.xsa -d ./hdf_and_bit 43 | # cp ./hdf_and_bit/$BOARD_NAME/sdk/system_top_hw_platform_0/system.hdf $OPENWIFI_HW_IMG_DIR/boards/$BOARD_NAME/sdk/system_top_hw_platform_0/ -rf 44 | # cp ./hdf_and_bit/system_top.bit $OPENWIFI_HW_IMG_DIR/boards/$BOARD_NAME/sdk/system_top_hw_platform_0/ -rf 45 | 46 | # BIT_FILENAME=$OPENWIFI_HW_IMG_DIR/boards/$BOARD_NAME/sdk/system_top_hw_platform_0/system_top.bit 47 | BIT_FILENAME=./hdf_and_bit/system_top.bit 48 | 49 | if [ -f "$BIT_FILENAME" ]; then 50 | echo "\$BIT_FILENAME is found!" 51 | else 52 | echo "\$BIT_FILENAME does NOT exist. Please check!" 53 | exit 1 54 | fi 55 | 56 | if [ "$BOARD_NAME" == "zcu102_fmcs2" ] || [ "$BOARD_NAME" == "zcu102_9371" ]; then 57 | ARCH="zynqmp" 58 | ARCH_BIT=64 59 | else 60 | ARCH="zynq" 61 | ARCH_BIT=32 62 | fi 63 | 64 | # FINAL_BIT_FILENAME=$BOARD_NAME\_system_top_reload.bit.bin 65 | 66 | source $XILINX_DIR/Vitis/2021.1/settings64.sh 67 | 68 | set -x 69 | 70 | cp $BIT_FILENAME ./ 71 | bootgen -image system_top.bif -arch $ARCH -process_bitstream bin -w 72 | 73 | # cp system_top_reload.bit.bin ./$FINAL_BIT_FILENAME 74 | 75 | cd ../driver 76 | make clean 77 | ./make_all.sh $XILINX_DIR $ARCH_BIT 78 | cd ../user_space 79 | mkdir -p drv_and_fpga 80 | rm -rf drv_and_fpga/* 81 | cp system_top.bit.bin ../driver/side_ch/side_ch.ko ../driver/tx_intf/tx_intf.ko ../driver/rx_intf/rx_intf.ko ../driver/openofdm_tx/openofdm_tx.ko ../driver/openofdm_rx/openofdm_rx.ko ../driver/xpu/xpu.ko ../driver/sdr.ko ./drv_and_fpga -f 82 | cp $OPENWIFI_HW_IMG_DIR/boards/$BOARD_NAME/sdk/git_info.txt ./drv_and_fpga -f 83 | tar -cvf ./drv_and_fpga/driver.tar $(git ls-files ../driver/) 84 | 85 | # dir_save=$(pwd) 86 | 87 | # cd $OPENWIFI_HW_DIR/ip/ 88 | # tar -cvf $dir_save/drv_and_fpga/openwifi-hw-ip-root.tar $(git ls-files ./ | grep -v -E "/|openofdm_rx") 89 | # tar -cvf $dir_save/drv_and_fpga/openwifi-hw-ip-xpu.tar $(git ls-files ./xpu) 90 | # tar -cvf $dir_save/drv_and_fpga/openwifi-hw-ip-tx_intf.tar $(git ls-files ./tx_intf) 91 | # tar -cvf $dir_save/drv_and_fpga/openwifi-hw-ip-rx_intf.tar $(git ls-files ./rx_intf) 92 | # tar -cvf $dir_save/drv_and_fpga/openwifi-hw-ip-openofdm_tx.tar $(git ls-files ./openofdm_tx) 93 | # tar -cvf $dir_save/drv_and_fpga/openwifi-hw-ip-side_ch.tar $(git ls-files ./side_ch) 94 | 95 | # cd ../boards 96 | # tar -cvf $dir_save/drv_and_fpga/openwifi-hw-boards-root.tar $(git ls-files ./ | grep -v "/") 97 | # cd ./$BOARD_NAME 98 | # tar -cvf $dir_save/drv_and_fpga/openwifi-hw-boards-$BOARD_NAME-root.tar $(git ls-files ./ | grep -v "/") 99 | # tar -cvf $dir_save/drv_and_fpga/openwifi-hw-boards-$BOARD_NAME-src.tar $(git ls-files ./src) 100 | # tar -cvf $dir_save/drv_and_fpga/openwifi-hw-boards-$BOARD_NAME-ip_repo.tar ip_repo 101 | 102 | # cd $dir_save 103 | # # tar -cvf drv_and_fpga.tar system_top.bit.bin tx_intf.ko rx_intf.ko openofdm_tx.ko openofdm_rx.ko xpu.ko sdr.ko git_info.txt 104 | 105 | tar -zcvf drv_and_fpga.tar.gz drv_and_fpga 106 | 107 | set +x 108 | -------------------------------------------------------------------------------- /user_space/eifs_by_last_rx_fail_disable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | set -x 12 | #set 13 | if [[ -n $1 ]]; then 14 | echo "4$1" > csma_cfg0 15 | fi 16 | 17 | # show 18 | cat csma_cfg0 19 | set +x 20 | 21 | cd $home_dir 22 | -------------------------------------------------------------------------------- /user_space/eifs_by_last_tx_fail_disable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | set -x 12 | #set 13 | if [[ -n $1 ]]; then 14 | echo "5$1" > csma_cfg0 15 | fi 16 | 17 | # show 18 | cat csma_cfg0 19 | set +x 20 | 21 | cd $home_dir 22 | -------------------------------------------------------------------------------- /user_space/eifs_disable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | set -x 12 | #set 13 | if [[ -n $1 ]]; then 14 | echo "2$1" > csma_cfg0 15 | fi 16 | 17 | # show 18 | cat csma_cfg0 19 | set +x 20 | 21 | cd $home_dir 22 | -------------------------------------------------------------------------------- /user_space/fast_reg_log/fast_reg_log.c: -------------------------------------------------------------------------------- 1 | // Author: Xianjun Jiao (xianjun.jiao@imec.be; putaoshu@msn.com) 2 | // SPDX-FileCopyrightText: 2023 UGent 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | 5 | // Use this example together with fast_reg_log_analyzer.m (notter release) 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | int main() 16 | { 17 | unsigned int bram_size = 0x10000; // 64KB, aligned with openwifi hw .bd and devicetree 18 | off_t bram_pbase = 0x83c40000; // physical base address, aligned with openwifi hw .bd and devicetree (this example: xpu @ 32bit boards) 19 | uint32_t *bram32_vptr; 20 | int fd, i, j; 21 | uint32_t tsf_reg[524288*2]; 22 | FILE *fp; 23 | // Map the BRAM physical address into user space getting a virtual address for it 24 | if ((fd = open("/dev/mem", O_RDONLY | O_SYNC)) != -1) { 25 | bram32_vptr = (uint32_t *)mmap(NULL, bram_size, PROT_READ, MAP_SHARED, fd, bram_pbase); 26 | 27 | fp = fopen ("fast_reg_log.bin", "wb"); 28 | if (fp == NULL) { 29 | printf("fopen fast_reg_log.bin failed! %d\n", (int)fp); 30 | close(fd); 31 | return(0); 32 | } 33 | 34 | for (j=0; j<10; j++) { 35 | for (i=0; i<(524288*2); i=i+2) { 36 | tsf_reg[i+0] = (*(bram32_vptr+57)); // read xpu register 57: rssi trx agc cca status 37 | tsf_reg[i+1] = (*(bram32_vptr+58)); // read xpu register 58: low 32bit of tsf 38 | } 39 | 40 | // for (i=0; i<1024; i++) { 41 | // printf("%d %x\n", tsf[i], reg[i]); 42 | // } 43 | // memcpy(buf, bram64_vptr, bram_size); 44 | 45 | fwrite(tsf_reg, sizeof(uint32_t), 524288*2, fp); 46 | } 47 | 48 | fclose(fp); 49 | // printf("%016llx\n", buf[65532]); 50 | // printf("%016llx\n", buf[65533]); 51 | // printf("%016llx\n", buf[65534]); 52 | // printf("%016llx\n", buf[65535]); 53 | // //for(i=0; i<32; i++) { 54 | // // printf("0x%02x\n", buf[i]); 55 | // //} 56 | 57 | close(fd); 58 | } 59 | return(0); 60 | } 61 | -------------------------------------------------------------------------------- /user_space/fast_reg_log/fast_reg_log_analyzer.m: -------------------------------------------------------------------------------- 1 | % Author: Xianjun Jiao (xianjun.jiao@imec.be; putaoshu@msn.com) 2 | % SPDX-FileCopyrightText: 2023 UGent 3 | % SPDX-License-Identifier: AGPL-3.0-or-later 4 | 5 | function fast_reg_log_analyzer(filename_bin, start_idx, end_idx) 6 | close all; 7 | 8 | % if exist('start_idx', 'var')==0 || isempty(start_idx) 9 | % start_idx = 1; 10 | % end 11 | % 12 | % if exist('end_idx', 'var')==0 || isempty(end_idx) 13 | % end_idx = 65536; 14 | % end 15 | 16 | filename_csv = [filename_bin(1:(end-3)) 'csv']; 17 | disp(['Human readable fast reg log will be in ' filename_csv]); 18 | 19 | fid = fopen(filename_bin); 20 | if fid == -1 21 | disp('fopen failed!'); 22 | return; 23 | end 24 | 25 | a = fread(fid, inf, 'uint32'); 26 | fclose(fid); 27 | % a = bitand(uint32(a), uint32(268435455)); 28 | % plot(a(1:2:end)); hold on; 29 | % plot(a(2:2:end)); 30 | % legend('1', '2'); 31 | 32 | a = uint32(a); 33 | tsf = a(2:2:end); 34 | % plot(tsf); 35 | state = a(1:2:end); 36 | 37 | % find out overflow idx 38 | overflow_idx = find(diff([0; double(tsf)])<0, 1, 'first'); 39 | % overflow_idx 40 | if ~isempty(overflow_idx) 41 | tsf(overflow_idx:end) = tsf(overflow_idx:end) + (2^32); 42 | disp(num2str(overflow_idx)); 43 | end 44 | 45 | rssi_correction = 145; 46 | rssi_half_db = double(bitand(bitshift(state, 0), uint32((2^11)-1))); 47 | agc_lock = 1 - double(bitand(bitshift(state, -11), uint32(1))); 48 | demod_is_ongoing = double(bitand(bitshift(state, -12), uint32(1))); 49 | tx_is_ongoing = double(bitand(bitshift(state, -13), uint32(1))); 50 | ch_idle = 1 - double(bitand(bitshift(state, -14), uint32(1))); 51 | iq_rssi_half_db = double(bitand(bitshift(state, -16), uint32((2^9)-1))); 52 | agc_gain = double(bitand(bitshift(state, -25), uint32((2^7)-1))); 53 | 54 | rssi_dbm = (rssi_half_db./2) - rssi_correction; 55 | 56 | figure; 57 | subplot(2,1,1); 58 | plot(tsf, -rssi_dbm, 'r+-'); hold on; 59 | plot(tsf, iq_rssi_half_db, 'bo-'); 60 | plot(tsf, agc_gain, 'ks-'); 61 | legend('rssi dbm', 'iq rssi half db', 'agc gain'); 62 | subplot(2,1,2); 63 | plot(tsf, agc_lock+0); hold on; 64 | plot(tsf, demod_is_ongoing+2); 65 | plot(tsf, tx_is_ongoing+4); 66 | plot(tsf, ch_idle+6); 67 | 68 | legend('agc lock', 'demod is ongoing', 'tx is ongoing', 'ch idle'); 69 | 70 | a=table(tsf, rssi_half_db, rssi_dbm, iq_rssi_half_db, agc_gain, agc_lock, demod_is_ongoing, tx_is_ongoing, ch_idle); 71 | writetable(a, filename_csv); 72 | -------------------------------------------------------------------------------- /user_space/fosdem-11ag.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | # test_mode=$1 8 | # if [ -z $test_mode ] 9 | # then 10 | # test_mode=0 11 | # fi 12 | # echo test_mode $test_mode 13 | 14 | killall hostapd 15 | killall webfsd 16 | 17 | cd ~/openwifi 18 | # service network-manager stop 19 | # ./wgd.sh $test_mode 20 | ifconfig sdr0 192.168.13.1 21 | rm /var/run/dhcpd.pid 22 | sleep 1 23 | service isc-dhcp-server restart 24 | hostapd hostapd-openwifi-11ag.conf & 25 | sleep 5 26 | cd webserver 27 | webfsd -F -p 80 -f index.html & 28 | route add default gw 192.168.10.1 29 | -------------------------------------------------------------------------------- /user_space/fosdem.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | # test_mode=$1 8 | # if [ -z $test_mode ] 9 | # then 10 | # test_mode=0 11 | # fi 12 | # echo test_mode $test_mode 13 | 14 | killall hostapd 15 | killall webfsd 16 | 17 | cd ~/openwifi 18 | # service network-manager stop 19 | # ./wgd.sh $test_mode 20 | ifconfig sdr0 192.168.13.1 21 | rm /var/run/dhcpd.pid 22 | sleep 1 23 | service isc-dhcp-server restart 24 | hostapd hostapd-openwifi.conf & 25 | sleep 5 26 | cd webserver 27 | webfsd -F -p 80 -f index.html & 28 | route add default gw 192.168.10.1 29 | 30 | -------------------------------------------------------------------------------- /user_space/hostapd-openwifi-11ag.conf: -------------------------------------------------------------------------------- 1 | interface=sdr0 2 | driver=nl80211 3 | country_code=BE 4 | ssid=openwifi 5 | hw_mode=a 6 | channel=36 7 | supported_rates=60 90 120 180 240 360 480 540 8 | basic_rates=60 90 120 180 9 | #ieee80211n=1 10 | #ht_capab=[SHORT-GI-20] 11 | #require_ht=1 12 | #ieee80211d=1 13 | #ieee80211h=1 14 | #wpa=1 15 | #wpa_passphrase=openwifi 16 | #wpa_key_mgmt=WPA-PSK 17 | #wpa_pairwise=TKIP CCMP 18 | #wpa_ptk_rekey=600 19 | 20 | -------------------------------------------------------------------------------- /user_space/hostapd-openwifi.conf: -------------------------------------------------------------------------------- 1 | interface=sdr0 2 | driver=nl80211 3 | country_code=BE 4 | ssid=openwifi 5 | hw_mode=a 6 | channel=36 7 | supported_rates=60 90 120 180 240 360 480 540 8 | basic_rates=60 90 120 180 9 | ieee80211n=1 10 | #ht_capab=[SHORT-GI-20] 11 | require_ht=1 12 | #ieee80211d=1 13 | #ieee80211h=1 14 | #wpa=1 15 | #wpa_passphrase=openwifi 16 | #wpa_key_mgmt=WPA-PSK 17 | #wpa_pairwise=TKIP CCMP 18 | #wpa_ptk_rekey=600 19 | 20 | -------------------------------------------------------------------------------- /user_space/inject_80211/Makefile: -------------------------------------------------------------------------------- 1 | 2 | all: inject_80211 analyze_80211 3 | 4 | inject_80211: inject_80211.c 5 | # gcc -Wall -Werror inject_80211.c -o inject_80211 -lpcap 6 | gcc -Wall inject_80211.c -o inject_80211 -lpcap 7 | 8 | analyze_80211: analyze_80211.c 9 | # gcc -Wall -Werror radiotap.c analyze_80211.c -o analyze_80211 -lpcap 10 | gcc -Wall radiotap.c analyze_80211.c -o analyze_80211 -lpcap 11 | 12 | clean: 13 | rm -f inject_80211 analyze_80211 14 | 15 | -------------------------------------------------------------------------------- /user_space/inject_80211/analyze_80211.c: -------------------------------------------------------------------------------- 1 | 2 | // Author: Michael Mehari 3 | // SPDX-FileCopyrightText: 2020 UGent 4 | // SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | /* 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; version 2. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | */ 20 | 21 | #include "inject_80211.h" 22 | #include "radiotap.h" 23 | #include "uthash.h" 24 | 25 | #define HEADERLEN_80211 24 26 | 27 | struct RECORD_t 28 | { 29 | char id[16]; // hw_mode-rate-sgi_flag-packet_size 30 | uint16_t pkt_cnt; // number of packets received 31 | uint64_t ts_begin; // beginning timestamp 32 | uint64_t ts_end; // ending timestamp 33 | 34 | UT_hash_handle hh; // hash function handler 35 | }; 36 | 37 | /* 802.11n bitrates x 2 */ 38 | static const uint8_t rates_11n[] = {13, 26, 39, 52, 78, 104, 117, 130}; 39 | 40 | int main(int argc, char **argv) 41 | { 42 | struct pcap_pkthdr pcap_hdr; 43 | const u_char *packet; 44 | char hw_mode, id[16]; 45 | int rate, sgi_flag, packet_size; 46 | 47 | int n, hdr_len; 48 | struct ieee80211_radiotap_iterator rti; 49 | 50 | struct RECORD_t *RECORD_ptr, *tmp_ptr, *hash_ptr = NULL; 51 | 52 | if (argc < 2) 53 | { 54 | fprintf(stderr, "Usage: %s \n", argv[0]); 55 | exit(1); 56 | } 57 | 58 | pcap_t *handle; 59 | char errbuf[PCAP_ERRBUF_SIZE]; 60 | handle = pcap_open_offline(argv[1], errbuf); 61 | 62 | if (handle == NULL) 63 | { 64 | fprintf(stderr,"Couldn't open pcap file %s: %s\n", argv[1], errbuf); 65 | return(2); 66 | } 67 | 68 | while ((packet = pcap_next(handle, &pcap_hdr))) 69 | { 70 | hdr_len = (packet[2] + (packet[3] << 8)); 71 | if (pcap_hdr.len < (hdr_len + HEADERLEN_80211)) 72 | continue; 73 | 74 | packet_size = pcap_hdr.len - (hdr_len + HEADERLEN_80211); 75 | if (packet_size < 0) 76 | continue; 77 | 78 | if (ieee80211_radiotap_iterator_init(&rti, (struct ieee80211_radiotap_header *)packet, packet_size, NULL) < 0) 79 | continue; 80 | 81 | while ((n = ieee80211_radiotap_iterator_next(&rti)) == 0) 82 | { 83 | switch (rti.this_arg_index) 84 | { 85 | case IEEE80211_RADIOTAP_RATE: 86 | rate = (rti.this_arg)[0]; 87 | sgi_flag = 0; 88 | hw_mode = 'a'; 89 | break; 90 | 91 | case IEEE80211_RADIOTAP_MCS: 92 | rate = rates_11n[((rti.this_arg)[2])]; 93 | sgi_flag = (rti.this_arg)[1] & 0x40; 94 | hw_mode = 'n'; 95 | break; 96 | } 97 | } 98 | 99 | // create hash table index 100 | sprintf(id, "%c-%d-%d-%d", hw_mode, rate, sgi_flag, packet_size); 101 | 102 | // Hash table implementation for c : https://github.com/troydhanson/uthash 103 | HASH_FIND_STR(hash_ptr, id, RECORD_ptr); 104 | if(RECORD_ptr == NULL) 105 | { 106 | RECORD_ptr = (struct RECORD_t*)malloc(sizeof(struct RECORD_t)); 107 | if(RECORD_ptr == NULL) 108 | { 109 | fprintf(stderr, "Unable to create record!\n"); 110 | return 1; 111 | } 112 | 113 | strcpy(RECORD_ptr->id, id); 114 | RECORD_ptr->pkt_cnt = 1; 115 | RECORD_ptr->ts_begin = 1e6*pcap_hdr.ts.tv_sec + pcap_hdr.ts.tv_usec; 116 | 117 | // Add the new record to the hash table 118 | HASH_ADD_STR(hash_ptr, id, RECORD_ptr); 119 | } 120 | else 121 | { 122 | RECORD_ptr->pkt_cnt++; 123 | RECORD_ptr->ts_end = 1e6*pcap_hdr.ts.tv_sec + pcap_hdr.ts.tv_usec; 124 | } 125 | } 126 | pcap_close(handle); 127 | 128 | 129 | // Iterate through the hash table 130 | printf("HW MODE\tRATE(Mbps)\tSGI\tSIZE(bytes)\tCOUNT\tDELAY(sec)\n"); 131 | printf("=======\t==========\t===\t===========\t=====\t=========\n"); 132 | HASH_ITER(hh, hash_ptr, RECORD_ptr, tmp_ptr) 133 | { 134 | sscanf(RECORD_ptr->id, "%c-%d-%d-%d", &hw_mode, &rate, &sgi_flag, &packet_size); 135 | printf("802.11%c\t%.1f\t\t%s\t%d\t\t%d\t%.5f\n", hw_mode, rate/2.0, (sgi_flag == 0 ? "OFF" : "ON"), packet_size, RECORD_ptr->pkt_cnt, 1e-6*(RECORD_ptr->ts_end - RECORD_ptr->ts_begin)); 136 | } 137 | fflush(stdout); 138 | 139 | return 0; 140 | } 141 | -------------------------------------------------------------------------------- /user_space/inject_80211/inject_80211.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Michael Mehari 3 | * SPDX-FileCopyrightText: 2019 UGent 4 | * SPDX-License-Identifier: AGPL-3.0-or-later 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | typedef unsigned long long int u64; 16 | typedef unsigned int u32; 17 | typedef unsigned short u16; 18 | typedef unsigned char u8; 19 | typedef u32 __le32; 20 | 21 | #if __BYTE_ORDER == __LITTLE_ENDIAN 22 | #define le16_to_cpu(x) (x) 23 | #define le32_to_cpu(x) (x) 24 | #else 25 | #define le16_to_cpu(x) ((((x)&0xff)<<8)|(((x)&0xff00)>>8)) 26 | #define le32_to_cpu(x) \ 27 | ((((x)&0xff)<<24)|(((x)&0xff00)<<8)|(((x)&0xff0000)>>8)|(((x)&0xff000000)>>24)) 28 | #endif 29 | #define unlikely(x) (x) 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /user_space/inject_80211/inject_80211.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Michael Mehari 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | HW_MODE='n' 8 | COUNT=100 9 | DELAY=1000 10 | RATE=( 0 1 2 3 4 5 6 7 ) 11 | SIZE=( $(seq -s' ' 50 100 1450) ) 12 | IF="mon0" 13 | 14 | for (( i = 0 ; i < ${#SIZE[@]} ; i++ )) do 15 | for (( j = 0 ; j < ${#RATE[@]} ; j++ )) do 16 | inject_80211 -m $HW_MODE -n $COUNT -d $DELAY -r ${RATE[$j]} -s ${SIZE[$i]} $IF 17 | sleep 1 18 | done 19 | done 20 | 21 | -------------------------------------------------------------------------------- /user_space/inject_80211/radiotap.h: -------------------------------------------------------------------------------- 1 | #include "ieee80211_radiotap.h" 2 | 3 | // -----ieee80211_radiotap_iterator from cfg80211.h ----- // 4 | /** 5 | * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 6 | * @this_arg_index: index of current arg, valid after each successful call 7 | * to ieee80211_radiotap_iterator_next() 8 | * @this_arg: pointer to current radiotap arg; it is valid after each 9 | * call to ieee80211_radiotap_iterator_next() but also after 10 | * ieee80211_radiotap_iterator_init() where it will point to 11 | * the beginning of the actual data portion 12 | * @this_arg_size: length of the current arg, for convenience 13 | * @current_namespace: pointer to the current namespace definition 14 | * (or internally %NULL if the current namespace is unknown) 15 | * @is_radiotap_ns: indicates whether the current namespace is the default 16 | * radiotap namespace or not 17 | * 18 | * @_rtheader: pointer to the radiotap header we are walking through 19 | * @_max_length: length of radiotap header in cpu byte ordering 20 | * @_arg_index: next argument index 21 | * @_arg: next argument pointer 22 | * @_next_bitmap: internal pointer to next present u32 23 | * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 24 | * @_vns: vendor namespace definitions 25 | * @_next_ns_data: beginning of the next namespace's data 26 | * @_reset_on_ext: internal; reset the arg index to 0 when going to the 27 | * next bitmap word 28 | * 29 | * Describes the radiotap parser state. Fields prefixed with an underscore 30 | * must not be used by users of the parser, only by the parser internally. 31 | */ 32 | 33 | struct ieee80211_radiotap_iterator { 34 | struct ieee80211_radiotap_header *_rtheader; 35 | const struct ieee80211_radiotap_vendor_namespaces *_vns; 36 | const struct ieee80211_radiotap_namespace *current_namespace; 37 | 38 | unsigned char *_arg, *_next_ns_data; 39 | __le32 *_next_bitmap; 40 | 41 | unsigned char *this_arg; 42 | int this_arg_index; 43 | int this_arg_size; 44 | 45 | int is_radiotap_ns; 46 | 47 | int _max_length; 48 | int _arg_index; 49 | uint32_t _bitmap_shifter; 50 | int _reset_on_ext; 51 | }; 52 | 53 | extern int ieee80211_radiotap_iterator_init( 54 | struct ieee80211_radiotap_iterator *iterator, 55 | struct ieee80211_radiotap_header *radiotap_header, 56 | int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns); 57 | 58 | extern int ieee80211_radiotap_iterator_next( 59 | struct ieee80211_radiotap_iterator *iterator); 60 | 61 | -------------------------------------------------------------------------------- /user_space/inject_80211/unaligned.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0-only */ 2 | /* 3 | * Port on Texas Instruments TMS320C6x architecture 4 | * 5 | * Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated 6 | * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) 7 | * Rewritten for 2.6.3x: Mark Salter 8 | */ 9 | #ifndef _ASM_C6X_UNALIGNED_H 10 | #define _ASM_C6X_UNALIGNED_H 11 | 12 | // #include 13 | // #include 14 | 15 | #include "inject_80211.h" 16 | 17 | /* 18 | * The C64x+ can do unaligned word and dword accesses in hardware 19 | * using special load/store instructions. 20 | */ 21 | 22 | static inline u16 get_unaligned_le16(const void *p) 23 | { 24 | const u8 *_p = p; 25 | return _p[0] | _p[1] << 8; 26 | } 27 | 28 | static inline u16 get_unaligned_be16(const void *p) 29 | { 30 | const u8 *_p = p; 31 | return _p[0] << 8 | _p[1]; 32 | } 33 | 34 | static inline void put_unaligned_le16(u16 val, void *p) 35 | { 36 | u8 *_p = p; 37 | _p[0] = val; 38 | _p[1] = val >> 8; 39 | } 40 | 41 | static inline void put_unaligned_be16(u16 val, void *p) 42 | { 43 | u8 *_p = p; 44 | _p[0] = val >> 8; 45 | _p[1] = val; 46 | } 47 | 48 | // static inline u32 get_unaligned32(const void *p) 49 | // { 50 | // u32 val = (u32) p; 51 | // asm (" ldnw .d1t1 *%0,%0\n" 52 | // " nop 4\n" 53 | // : "+a"(val)); 54 | // return val; 55 | // } 56 | 57 | // static inline void put_unaligned32(u32 val, void *p) 58 | // { 59 | // asm volatile (" stnw .d2t1 %0,*%1\n" 60 | // : : "a"(val), "b"(p) : "memory"); 61 | // } 62 | 63 | // static inline u64 get_unaligned64(const void *p) 64 | // { 65 | // u64 val; 66 | // asm volatile (" ldndw .d1t1 *%1,%0\n" 67 | // " nop 4\n" 68 | // : "=a"(val) : "a"(p)); 69 | // return val; 70 | // } 71 | 72 | // static inline void put_unaligned64(u64 val, const void *p) 73 | // { 74 | // asm volatile (" stndw .d2t1 %0,*%1\n" 75 | // : : "a"(val), "b"(p) : "memory"); 76 | // } 77 | 78 | #ifdef CONFIG_CPU_BIG_ENDIAN 79 | 80 | #define get_unaligned_le32(p) __swab32(get_unaligned32(p)) 81 | #define get_unaligned_le64(p) __swab64(get_unaligned64(p)) 82 | #define get_unaligned_be32(p) get_unaligned32(p) 83 | #define get_unaligned_be64(p) get_unaligned64(p) 84 | #define put_unaligned_le32(v, p) put_unaligned32(__swab32(v), (p)) 85 | #define put_unaligned_le64(v, p) put_unaligned64(__swab64(v), (p)) 86 | #define put_unaligned_be32(v, p) put_unaligned32((v), (p)) 87 | #define put_unaligned_be64(v, p) put_unaligned64((v), (p)) 88 | #define get_unaligned __get_unaligned_be 89 | #define put_unaligned __put_unaligned_be 90 | 91 | #else 92 | 93 | #define get_unaligned_le32(p) get_unaligned32(p) 94 | #define get_unaligned_le64(p) get_unaligned64(p) 95 | #define get_unaligned_be32(p) __swab32(get_unaligned32(p)) 96 | #define get_unaligned_be64(p) __swab64(get_unaligned64(p)) 97 | #define put_unaligned_le32(v, p) put_unaligned32((v), (p)) 98 | #define put_unaligned_le64(v, p) put_unaligned64((v), (p)) 99 | #define put_unaligned_be32(v, p) put_unaligned32(__swab32(v), (p)) 100 | #define put_unaligned_be64(v, p) put_unaligned64(__swab64(v), (p)) 101 | #define get_unaligned __get_unaligned_le 102 | #define put_unaligned __put_unaligned_le 103 | 104 | #endif 105 | 106 | #endif /* _ASM_C6X_UNALIGNED_H */ 107 | -------------------------------------------------------------------------------- /user_space/link_perf_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Michael Mehari 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | PL_MIN=100 8 | PL_INC=100 9 | PL_MAX=1500 10 | PAYLOAD=( $(seq -s' ' $PL_MIN $PL_INC $PL_MAX) ) # paload size in bytes 11 | MCS_BPS=( 6 9 12 18 24 36 48 54 ) 12 | MCS_IDX=( 4 5 6 7 8 9 10 11 ) 13 | 14 | INTERVAL=0.001 # Wait interval seconds between sending each packet 15 | PKT_CNT=700 # Stop after sending count ECHO_REQUEST packets 16 | DEADLINE=1 # Specify a timeout, in seconds, before ping exits regardless of how many packets have been sent or received 17 | 18 | SDRCTL_EXEC="./sdrctl_src/sdrctl" 19 | CLIENT_IP="192.168.13.2" 20 | 21 | # Bandwidth = 1.4 MHz 22 | printf "LINK PERFORMANCE TEST\n" 23 | printf "=====================\n" 24 | printf "RATE/PL\t" 25 | for (( j = 0 ; j < ${#PAYLOAD[@]} ; j++ )) do 26 | printf "%*s" 12 "${PAYLOAD[j]}" 27 | done 28 | printf "\n" 29 | 30 | for (( i = 0 ; i < ${#MCS_IDX[@]} ; i++ )) do 31 | 32 | # configure MCS 33 | $SDRCTL_EXEC dev sdr0 set reg drv_tx 0 ${MCS_IDX[$i]} > /dev/null 34 | 35 | printf "%sMbps\t" ${MCS_BPS[$i]} 36 | for (( j = 0 ; j < ${#PAYLOAD[@]} ; j++ )) do 37 | 38 | # Measure link performance 39 | link_per_str=$(ping $CLIENT_IP -i $INTERVAL -c $PKT_CNT -w $DEADLINE -s ${PAYLOAD[$j]} -nq | while read line; do 40 | 41 | # Skip non packet-loss and non rtt responses 42 | [[ ! "$line" =~ "packet loss" ]] && [[ ! "$line" =~ "rtt" ]] && continue 43 | 44 | # Extract packet loss 45 | if [[ "$line" =~ "packet loss" ]]; then 46 | PL=$(echo $line | grep 'packet loss' | cut -d' ' -f6) 47 | if [[ $PL == "100%" ]]; then 48 | printf "%s,INF" $PL 49 | else 50 | printf "%s," $PL 51 | fi 52 | # Extract rtt 53 | else 54 | RTT=$(echo $line | grep rtt | cut -d/ -f5) 55 | printf "%s" $RTT 56 | fi 57 | 58 | done) 59 | printf "%*s" 12 $link_per_str 60 | done 61 | printf "\n" 62 | done 63 | 64 | -------------------------------------------------------------------------------- /user_space/load_fpga_img.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2022 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | # get fpga image file name 8 | if [[ -n $1 ]]; then 9 | fpga_img_filename=$1 10 | else 11 | fpga_img_filename=system_top.bit.bin 12 | fi 13 | 14 | fpga_type=$(cat /proc/device-tree/compatible) 15 | fpga_img_filename_core=${fpga_img_filename##*/} 16 | echo $fpga_type 17 | echo $fpga_img_filename 18 | echo $fpga_img_filename_core 19 | 20 | set -x 21 | 22 | ifconfig sdr0 down 23 | rmmod sdr 24 | # rmmod mac80211 25 | # rmmod cfg80211 26 | # rmmod ad9361_drv 27 | # rmmod xilinx_dma.ko 28 | rmmod openofdm_rx 29 | rmmod openofdm_tx 30 | rmmod rx_intf 31 | rmmod tx_intf 32 | rmmod xpu 33 | 34 | sleep 1 35 | 36 | if [ -f "$fpga_img_filename" ]; then 37 | echo 0 > /sys/class/fpga_manager/fpga0/flags 38 | mkdir -p /lib/firmware 39 | cp $fpga_img_filename /lib/firmware/ -rf 40 | echo $fpga_img_filename_core > /sys/class/fpga_manager/fpga0/firmware 41 | fi 42 | 43 | # insmod ad9361_drv.ko 44 | # sleep 1 45 | 46 | if [ "$fpga_type" != "xlnx,zynq-7000" ]; then 47 | SPI_DEVNAME="spi1.0" 48 | DDS_DEVNAME="99024000.cf-ad9361-dds-core-lpc" 49 | ADC_DEVNAME="99020000.cf-ad9361-lpc" 50 | else 51 | SPI_DEVNAME="spi0.0" 52 | DDS_DEVNAME="79024000.cf-ad9361-dds-core-lpc" 53 | ADC_DEVNAME="79020000.cf-ad9361-lpc" 54 | fi 55 | 56 | while [ ! -d "/sys/bus/spi/drivers/ad9361/$SPI_DEVNAME" ] 57 | do 58 | echo "Waiting for /sys/bus/spi/drivers/ad9361/$SPI_DEVNAME" 59 | sleep 0.2 60 | done 61 | cd /sys/bus/spi/drivers/ad9361/ 62 | echo $SPI_DEVNAME > unbind 63 | echo $SPI_DEVNAME > bind 64 | 65 | #while [ ! -d "/sys/bus/platform/drivers/cf_axi_dds/$DDS_DEVNAME" ] 66 | #do 67 | # echo "Waiting for /sys/bus/platform/drivers/cf_axi_dds/$DDS_DEVNAME" 68 | # sleep 0.2 69 | #done 70 | #cd /sys/bus/platform/drivers/cf_axi_dds/ 71 | #echo $DDS_DEVNAME > unbind 72 | #echo $DDS_DEVNAME > bind 73 | 74 | while [ ! -d "/sys/bus/platform/drivers/cf_axi_adc/$ADC_DEVNAME" ] 75 | do 76 | echo "Waiting for /sys/bus/platform/drivers/cf_axi_adc/$ADC_DEVNAME" 77 | sleep 0.2 78 | done 79 | cd /sys/bus/platform/drivers/cf_axi_adc/ 80 | echo $ADC_DEVNAME > unbind 81 | echo $ADC_DEVNAME > bind 82 | 83 | set +x 84 | -------------------------------------------------------------------------------- /user_space/monitor_ch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | if [ $# -ne 2 ] 8 | then 9 | echo "Please input NIC_name ch_number as input parameter!" 10 | exit 11 | fi 12 | 13 | nic_name=$1 14 | ch_number=$2 15 | echo $nic_name 16 | echo $ch_number 17 | 18 | # sudo service network-manager stop 19 | sudo ip link set $nic_name down 20 | sudo iwconfig $nic_name mode monitor 21 | sudo ip link set $nic_name up 22 | sudo iwconfig $nic_name channel $ch_number 23 | # sudo iwconfig $nic_name modulation 11g 24 | # sudo iwconfig $nic_name rate 6M 25 | ifconfig 26 | iwconfig $nic_name 27 | 28 | -------------------------------------------------------------------------------- /user_space/nav_disable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | set -x 12 | #set 13 | if [[ -n $1 ]]; then 14 | echo "0$1" > csma_cfg0 15 | fi 16 | 17 | # show 18 | cat csma_cfg0 19 | set +x 20 | 21 | cd $home_dir 22 | -------------------------------------------------------------------------------- /user_space/nic_back_to_normal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | if [ $# -ne 1 ] 8 | then 9 | echo "Please input NIC name as input parameter!" 10 | exit 11 | fi 12 | 13 | nic_name=$1 14 | echo $nic_name 15 | 16 | # sudo service network-manager stop 17 | sudo ip link set $nic_name down 18 | sudo iwconfig $nic_name mode managed 19 | #sudo iwconfig $nic_name modulation 11g 20 | sudo ip link set $nic_name up 21 | ifconfig 22 | iwconfig $nic_name 23 | 24 | -------------------------------------------------------------------------------- /user_space/openwifi_ad9361_fir.ftr: -------------------------------------------------------------------------------- 1 | # Data Sample Frequency = 40000000 Hz 2 | TX 3 GAIN 0 INT 1 3 | RX 3 GAIN -6 DEC 1 4 | RTX 1280000000 160000000 80000000 40000000 40000000 40000000 5 | RRX 1280000000 160000000 80000000 40000000 40000000 40000000 6 | BWTX 35301580 7 | BWRX 20172411 8 | -2628,-2628 9 | 2130,2130 10 | 1397,1397 11 | -487,-487 12 | -1098,-1098 13 | 865,865 14 | 2132,2132 15 | -112,-112 16 | -2468,-2468 17 | -169,-169 18 | 3686,3686 19 | 1455,1455 20 | -5304,-5304 21 | -4052,-4052 22 | 11297,11297 23 | 27949,27949 24 | 27949,27949 25 | 11297,11297 26 | -4052,-4052 27 | -5304,-5304 28 | 1455,1455 29 | 3686,3686 30 | -169,-169 31 | -2468,-2468 32 | -112,-112 33 | 2132,2132 34 | 865,865 35 | -1098,-1098 36 | -487,-487 37 | 1397,1397 38 | 2130,2130 39 | -2628,-2628 40 | -------------------------------------------------------------------------------- /user_space/openwifi_ad9361_fir_tx_0MHz.ftr: -------------------------------------------------------------------------------- 1 | # Data Sample Frequency = 40000000 Hz 2 | TX 3 GAIN 0 INT 1 3 | RX 3 GAIN -6 DEC 1 4 | RTX 1280000000 160000000 80000000 40000000 40000000 40000000 5 | RRX 1280000000 160000000 80000000 40000000 40000000 40000000 6 | # BWTX 35301580 7 | BWTX 20172411 8 | BWRX 20172411 9 | -2628,-2628 10 | 2130,2130 11 | 1397,1397 12 | -487,-487 13 | -1098,-1098 14 | 865,865 15 | 2132,2132 16 | -112,-112 17 | -2468,-2468 18 | -169,-169 19 | 3686,3686 20 | 1455,1455 21 | -5304,-5304 22 | -4052,-4052 23 | 11297,11297 24 | 27949,27949 25 | 27949,27949 26 | 11297,11297 27 | -4052,-4052 28 | -5304,-5304 29 | 1455,1455 30 | 3686,3686 31 | -169,-169 32 | -2468,-2468 33 | -112,-112 34 | 2132,2132 35 | 865,865 36 | -1098,-1098 37 | -487,-487 38 | 1397,1397 39 | 2130,2130 40 | -2628,-2628 41 | -------------------------------------------------------------------------------- /user_space/openwifi_ad9361_fir_tx_0MHz_11n.ftr: -------------------------------------------------------------------------------- 1 | # Generated with AD9361 Filter Design Wizard 16.1.3 2 | # MATLAB 9.10.0.1602886 (R2021a), 18-Nov-2021 11:34:55 3 | # Rx setting: 4 | # Data Rate 40, Clock (MHz) ADC 320 DAC 320 1x 5 | # PLL Div 4x, PLL (MHz) 1280 6 | # Units: dB. Apass 0.5, Astop 80, Astop (FIR) 0 7 | # Units: MHz. Fpass 8.75, Fstop 11.25, Fcutoff (Analog) 15.6896, RF Bandwidth 22.4138 8 | # AD936x Decimation Rates. Use Internal FIR. FIR 1X 40, HB1 2X 80, HB2 2X 160, HB3 2X 320 9 | # Tx setting: 10 | # Data Rate 40, Clock (MHz) ADC 320 DAC 320 1x 11 | # PLL Div 4x, PLL (MHz) 1280 12 | # Units: dB. Apass 0.5, Astop 80, Astop (FIR) 0 13 | # Units: MHz. Fpass 8.75, Fstop 11.25, Fcutoff (Analog) 17.6508, RF Bandwidth 22.0636 14 | # AD936x Interpolation Rates. Use Internal FIR. FIR 1X 40, HB1 2X 80, HB2 2X 160, HB3 2X 320 15 | TX 3 GAIN -6 INT 1 16 | RX 3 GAIN -6 DEC 1 17 | RTX 1280000000 320000000 160000000 80000000 40000000 40000000 18 | RRX 1280000000 320000000 160000000 80000000 40000000 40000000 19 | BWTX 25215414 20 | BWRX 25215513 21 | 41,56 22 | 31,70 23 | -187,-148 24 | -496,-500 25 | -395,-434 26 | 183,169 27 | 412,436 28 | -201,-208 29 | -619,-674 30 | 148,137 31 | 886,956 32 | -38,-14 33 | -1232,-1325 34 | -166,-214 35 | 1680,1799 36 | 513,598 37 | -2284,-2437 38 | -1107,-1255 39 | 3197,3389 40 | 2238,2507 41 | -4904,-5127 42 | -5068,-5623 43 | 10562,10560 44 | 28812,29674 45 | 28812,29674 46 | 10562,10560 47 | -5068,-5623 48 | -4904,-5127 49 | 2238,2507 50 | 3197,3389 51 | -1107,-1255 52 | -2284,-2437 53 | 513,598 54 | 1680,1799 55 | -166,-214 56 | -1232,-1325 57 | -38,-14 58 | 886,956 59 | 148,137 60 | -619,-674 61 | -201,-208 62 | 412,436 63 | 183,169 64 | -395,-434 65 | -496,-500 66 | -187,-148 67 | 31,70 68 | 41,56 69 | -------------------------------------------------------------------------------- /user_space/openwifi_ad9361_fir_tx_0MHz_11n_narrow1.ftr: -------------------------------------------------------------------------------- 1 | # Generated with AD9361 Filter Design Wizard 16.1.3 2 | # MATLAB 9.10.0.1602886 (R2021a), 31-Oct-2022 15:56:07 3 | # Rx setting: 4 | # Data Rate 40, Clock (MHz) ADC 320 DAC 320 1x 5 | # PLL Div 4x, PLL (MHz) 1280 6 | # Units: dB. Apass 0.5, Astop 120, Astop (FIR) 0 7 | # Units: MHz. Fpass 8.75, Fstop 12.1, Fcutoff (Analog) 15.6896, RF Bandwidth 22.4138 8 | # AD936x Decimation Rates. Use Internal FIR. FIR 1X 40, HB1 2X 80, HB2 2X 160, HB3 2X 320 9 | # Tx setting: 10 | # Data Rate 40, Clock (MHz) ADC 320 DAC 320 1x 11 | # PLL Div 4x, PLL (MHz) 1280 12 | # Units: dB. Apass 0.5, Astop 80, Astop (FIR) 0 13 | # Units: MHz. Fpass 8.75, Fstop 11.25, Fcutoff (Analog) 17.6508, RF Bandwidth 22.0636 14 | # AD936x Interpolation Rates. Use Internal FIR. FIR 1X 40, HB1 2X 80, HB2 2X 160, HB3 2X 320 15 | TX 3 GAIN -6 INT 1 16 | RX 3 GAIN -6 DEC 1 17 | RTX 1280000000 320000000 160000000 80000000 40000000 40000000 18 | RRX 1280000000 320000000 160000000 80000000 40000000 40000000 19 | BWTX 25215414 20 | BWRX 25215513 21 | 41,-12 22 | 31,-90 23 | -187,-279 24 | -496,-446 25 | -395,-280 26 | 183,212 27 | 412,395 28 | -201,-140 29 | -619,-571 30 | 148,58 31 | 886,827 32 | -38,87 33 | -1232,-1169 34 | -166,-334 35 | 1680,1622 36 | 513,740 37 | -2284,-2242 38 | -1107,-1417 39 | 3197,3181 40 | 2238,2687 41 | -4904,-4913 42 | -5068,-5819 43 | 10562,10346 44 | 28812,29882 45 | 28812,29882 46 | 10562,10346 47 | -5068,-5819 48 | -4904,-4913 49 | 2238,2687 50 | 3197,3181 51 | -1107,-1417 52 | -2284,-2242 53 | 513,740 54 | 1680,1622 55 | -166,-334 56 | -1232,-1169 57 | -38,87 58 | 886,827 59 | 148,58 60 | -619,-571 61 | -201,-140 62 | 412,395 63 | 183,212 64 | -395,-280 65 | -496,-446 66 | -187,-279 67 | 31,-90 68 | 41,-12 69 | -------------------------------------------------------------------------------- /user_space/populate_kernel_image_module_reboot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | set -ex 8 | 9 | MACHINE_TYPE=`uname -m` 10 | 11 | mkdir -p kernel_modules 12 | rm -rf kernel_modules/* 13 | tar -zxvf kernel_modules.tar.gz 14 | 15 | if [ ${MACHINE_TYPE} == 'aarch64' ]; then 16 | IMAGE_FILENAME=Image 17 | DTB_FILENAME="system.dtb" 18 | else 19 | IMAGE_FILENAME=uImage 20 | DTB_FILENAME="devicetree.dtb" 21 | fi 22 | 23 | mv ./kernel_modules/ad9361_drv.ko ./openwifi/ -f || true 24 | mv ./kernel_modules/adi_axi_hdmi.ko ./openwifi/ -f || true 25 | mv ./kernel_modules/axidmatest.ko ./openwifi/ -f || true 26 | mv ./kernel_modules/lcd.ko ./openwifi/ -f || true 27 | mv ./kernel_modules/xilinx_dma.ko ./openwifi/ -f || true 28 | 29 | rm -rf /lib/modules/$(uname -r) 30 | ln -s /root/kernel_modules /lib/modules/$(uname -r) 31 | 32 | depmod 33 | 34 | umount /mnt || /bin/true 35 | mount /dev/mmcblk0p1 /mnt 36 | if test -f "./kernel_modules/$IMAGE_FILENAME"; then 37 | cp ./kernel_modules/$IMAGE_FILENAME /mnt/ 38 | fi 39 | if test -f "./kernel_modules/BOOT.BIN"; then 40 | cp ./kernel_modules/BOOT.BIN /mnt/ 41 | fi 42 | if test -f "./kernel_modules/$DTB_FILENAME"; then 43 | cp ./kernel_modules/$DTB_FILENAME /mnt/ 44 | fi 45 | cd /mnt/ 46 | sync 47 | cd ~ 48 | umount /mnt 49 | 50 | reboot now 51 | -------------------------------------------------------------------------------- /user_space/post_config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | set -ex 8 | 9 | MACHINE_TYPE=`uname -m` 10 | 11 | # setup kernel module directory 12 | if [ -d "/lib/modules/$(uname -r)" ]; then 13 | echo "/lib/modules/$(uname -r) already exists." 14 | else 15 | if [ ${MACHINE_TYPE} == 'aarch64' ]; then 16 | ln -s /lib/modules/adi-linux-64 /lib/modules/$(uname -r) 17 | else 18 | ln -s /lib/modules/adi-linux /lib/modules/$(uname -r) 19 | fi 20 | fi 21 | depmod 22 | modprobe mac80211 23 | 24 | if [ ${MACHINE_TYPE} == 'aarch64' ]; then 25 | cp ~/openwifi/drv64/* ~/openwifi/ -rf 26 | else 27 | cp ~/openwifi/drv32/* ~/openwifi/ -rf 28 | fi 29 | 30 | # add gateway (PC) for internet access 31 | route add default gw 192.168.10.1 || true 32 | 33 | sudo apt update 34 | 35 | chmod +x *.sh 36 | 37 | # build sdrctl 38 | sudo apt-get -y install libnl-3-dev 39 | sudo apt-get -y install libnl-genl-3-dev 40 | cd sdrctl_src 41 | make 42 | cp sdrctl ../ 43 | cd ../side_ch_ctl_src/ 44 | gcc -o side_ch_ctl side_ch_ctl.c 45 | cp side_ch_ctl ../ 46 | cd .. 47 | 48 | # install and setup dhcp server 49 | sudo apt-get -y install isc-dhcp-server 50 | cp dhcpd.conf /etc/dhcp/dhcpd.conf 51 | 52 | # install hostapd and other useful tools 53 | sudo apt-get -y install hostapd 54 | sudo apt-get -y install nano 55 | sudo apt-get -y install tcpdump 56 | sudo apt-get -y install webfs 57 | sudo apt-get -y install iperf 58 | sudo apt-get -y install iperf3 59 | sudo apt-get -y install libpcap-dev 60 | sudo apt-get -y install bridge-utils 61 | 62 | cd ./inject_80211/ 63 | make 64 | 65 | # change the root password to openwifi 66 | cat /etc/passwd 67 | sed -i 's/root:x:0:0:root:\/root:\/bin\/bash/root::0:0:root:\/root:\/bin\/bash/' /etc/passwd 68 | sync 69 | sleep 1 70 | cat /etc/passwd 71 | echo -e "openwifi\nopenwifi" | passwd 72 | sync 73 | sleep 1 74 | cat /etc/passwd 75 | 76 | -------------------------------------------------------------------------------- /user_space/prepare_kernel.sh: -------------------------------------------------------------------------------- 1 | 2 | #!/bin/bash 3 | 4 | # Author: Xianjun Jiao 5 | # SPDX-FileCopyrightText: 2019 UGent 6 | # SPDX-License-Identifier: AGPL-3.0-or-later 7 | 8 | # ATTENTION! You need Vitis, NOT Vitis_HLS, installed 9 | 10 | # if [ "$#" -ne 1 ]; then 11 | # echo "You must enter 1 arguments: ARCH_BIT(32 or 64)" 12 | # exit 1 13 | # fi 14 | 15 | # OPENWIFI_DIR=$(pwd)/../ 16 | # ARCH_OPTION=$1 17 | 18 | if [ "$#" -ne 2 ]; then 19 | echo "You must enter 2 arguments: \$XILINX_DIR ARCH_BIT(32 or 64)" 20 | exit 1 21 | fi 22 | 23 | OPENWIFI_DIR=$(pwd)/../ 24 | XILINX_DIR=$1 25 | ARCH_OPTION=$2 26 | 27 | if [ -f "$OPENWIFI_DIR/LICENSE" ]; then 28 | echo "\$OPENWIFI_DIR is found!" 29 | else 30 | echo "\$OPENWIFI_DIR is not correct. Please check!" 31 | exit 1 32 | fi 33 | 34 | if [ -d "$XILINX_DIR/Vitis" ]; then 35 | echo "\$XILINX_DIR is found!" 36 | else 37 | echo "\$XILINX_DIR is not correct. Please check!" 38 | exit 1 39 | fi 40 | 41 | if [ "$ARCH_OPTION" != "32" ] && [ "$ARCH_OPTION" != "64" ]; then 42 | echo "\$ARCH_OPTION is not correct. Should be 32 or 64. Please check!" 43 | exit 1 44 | else 45 | echo "\$ARCH_OPTION is valid!" 46 | fi 47 | 48 | if [ "$ARCH_OPTION" == "64" ]; then 49 | LINUX_KERNEL_SRC_DIR_NAME=adi-linux-64 50 | LINUX_KERNEL_CONFIG_FILE=$OPENWIFI_DIR/kernel_boot/kernel_config_zynqmp 51 | ARCH_NAME="arm64" 52 | CROSS_COMPILE_NAME="aarch64-linux-gnu-" 53 | IMAGE_TYPE=Image 54 | else 55 | LINUX_KERNEL_SRC_DIR_NAME=adi-linux 56 | LINUX_KERNEL_CONFIG_FILE=$OPENWIFI_DIR/kernel_boot/kernel_config 57 | ARCH_NAME="arm" 58 | CROSS_COMPILE_NAME="arm-linux-gnueabihf-" 59 | IMAGE_TYPE=uImage 60 | fi 61 | 62 | home_dir=$(pwd) 63 | 64 | set -x 65 | 66 | cd $OPENWIFI_DIR/ 67 | git submodule init $LINUX_KERNEL_SRC_DIR_NAME 68 | cd $OPENWIFI_DIR/$LINUX_KERNEL_SRC_DIR_NAME 69 | git reset --hard 70 | cd $OPENWIFI_DIR/ 71 | git submodule update $LINUX_KERNEL_SRC_DIR_NAME 72 | cd $OPENWIFI_DIR/$LINUX_KERNEL_SRC_DIR_NAME 73 | git fetch 74 | git checkout 2021_r1 75 | git pull origin 2021_r1 76 | git reset --hard 2021_r1 77 | 78 | export ARCH=$ARCH_NAME 79 | export CROSS_COMPILE=$CROSS_COMPILE_NAME 80 | source $XILINX_DIR/Vitis/2021.1/settings64.sh 81 | 82 | # if [ "$ARCH_OPTION" == "64" ]; then 83 | cp $LINUX_KERNEL_CONFIG_FILE ./.config 84 | # cp $OPENWIFI_DIR/driver/ad9361/ad9361.c $OPENWIFI_DIR/$LINUX_KERNEL_SRC_DIR_NAME/drivers/iio/adc/ad9361.c -rf 85 | # cp $OPENWIFI_DIR/driver/ad9361/ad9361_conv.c $OPENWIFI_DIR/$LINUX_KERNEL_SRC_DIR_NAME/drivers/iio/adc/ad9361_conv.c -rf 86 | git apply ../kernel_boot/axi_hdmi_crtc.patch 87 | git apply ../kernel_boot/ad9361.patch 88 | git apply ../kernel_boot/ad9361_conv.patch 89 | # else 90 | # make zynq_xcomm_adv7511_defconfig 91 | # fi 92 | 93 | make oldconfig 94 | # make adi_zynqmp_defconfig 95 | make prepare && make modules_prepare 96 | 97 | # if [ "$#" -gt 2 ]; then 98 | make -j12 $IMAGE_TYPE UIMAGE_LOADADDR=0x8000 99 | make modules 100 | # fi 101 | 102 | cd $home_dir 103 | -------------------------------------------------------------------------------- /user_space/rf_init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | home_dir=$(pwd) 8 | 9 | if [ -z "$1" ] 10 | then 11 | tx_offset_tuning_enable=1 12 | else 13 | tx_offset_tuning_enable=0 14 | fi 15 | echo tx_offset_tuning_enable $tx_offset_tuning_enable 16 | 17 | if [ $tx_offset_tuning_enable = "1" ] 18 | then 19 | fir_filename="openwifi_ad9361_fir.ftr" 20 | tx_fir_enable=0 21 | else 22 | fir_filename="openwifi_ad9361_fir_tx_0MHz.ftr" 23 | tx_fir_enable=1 24 | fi 25 | 26 | echo $fir_filename "tx_fir_enable" $tx_fir_enable 27 | 28 | if test -f $fir_filename; then 29 | echo "Found" $fir_filename 30 | else 31 | echo "Can not find" $fir_filename 32 | exit 1 33 | fi 34 | 35 | set -x 36 | if test -f "/sys/bus/iio/devices/iio:device0/in_voltage_rf_bandwidth"; then 37 | cd /sys/bus/iio/devices/iio:device0/ 38 | else if test -f "/sys/bus/iio/devices/iio:device1/in_voltage_rf_bandwidth"; then 39 | cd /sys/bus/iio/devices/iio:device1/ 40 | else if test -f "/sys/bus/iio/devices/iio:device2/in_voltage_rf_bandwidth"; then 41 | cd /sys/bus/iio/devices/iio:device2/ 42 | else if test -f "/sys/bus/iio/devices/iio:device3/in_voltage_rf_bandwidth"; then 43 | cd /sys/bus/iio/devices/iio:device3/ 44 | else if test -f "/sys/bus/iio/devices/iio:device4/in_voltage_rf_bandwidth"; then 45 | cd /sys/bus/iio/devices/iio:device4/ 46 | else 47 | echo "Can not find in_voltage_rf_bandwidth!" 48 | echo "Check log to make sure ad9361 driver is loaded!" 49 | exit 1 50 | fi 51 | fi 52 | fi 53 | fi 54 | fi 55 | set +x 56 | 57 | echo 17500000 > in_voltage_rf_bandwidth 58 | sync 59 | echo 37500000 > out_voltage_rf_bandwidth 60 | sync 61 | echo 40000000 > in_voltage_sampling_frequency 62 | sync 63 | echo 40000000 > out_voltage_sampling_frequency 64 | sync 65 | sleep 1 66 | 67 | echo 1000000000 > out_altvoltage0_RX_LO_frequency 68 | sync 69 | echo 1000000000 > out_altvoltage1_TX_LO_frequency 70 | sync 71 | 72 | cat $home_dir/$fir_filename > filter_fir_config 73 | sync 74 | sleep 0.5 75 | echo 1 > in_voltage_filter_fir_en 76 | echo $tx_fir_enable > out_voltage_filter_fir_en 77 | cat filter_fir_config 78 | cat in_voltage_filter_fir_en 79 | cat out_voltage_filter_fir_en 80 | 81 | echo "rx0 agc fast_attack" 82 | #echo "rx0 agc manual" 83 | cat in_voltage0_gain_control_mode 84 | echo fast_attack > in_voltage0_gain_control_mode 85 | #echo manual > in_voltage0_gain_control_mode 86 | cat in_voltage0_gain_control_mode 87 | sync 88 | 89 | echo "rx1 agc fast_attack" 90 | #echo "rx1 agc manual" 91 | cat in_voltage1_gain_control_mode 92 | echo fast_attack > in_voltage1_gain_control_mode 93 | #echo manual > in_voltage1_gain_control_mode 94 | cat in_voltage1_gain_control_mode 95 | sync 96 | sleep 1 97 | 98 | cat in_voltage_sampling_frequency 99 | cat in_voltage_rf_bandwidth 100 | cat out_voltage_sampling_frequency 101 | cat out_voltage_rf_bandwidth 102 | 103 | echo "rssi" 104 | cat in_voltage0_rssi 105 | cat in_voltage1_rssi 106 | 107 | # # --------not needed maybe-------- # # 108 | echo "rx0 gain to 70" # this set gain is gpio gain - 5dB (test with agc and read back gpio in driver) 109 | cat in_voltage0_hardwaregain 110 | echo 70 > in_voltage0_hardwaregain 111 | cat in_voltage0_hardwaregain 112 | sync 113 | 114 | echo "rx1 gain to 70" 115 | cat in_voltage1_hardwaregain 116 | echo 70 > in_voltage1_hardwaregain 117 | cat in_voltage1_hardwaregain 118 | sync 119 | 120 | echo "tx0 gain -89dB" 121 | cat out_voltage0_hardwaregain 122 | echo -89 > out_voltage0_hardwaregain 123 | cat out_voltage0_hardwaregain 124 | sync 125 | 126 | echo "tx1 gain 0dB" 127 | cat out_voltage1_hardwaregain 128 | echo 0 > out_voltage1_hardwaregain 129 | cat out_voltage1_hardwaregain 130 | sync 131 | # # --------not needed maybe-------- # # 132 | 133 | cd $home_dir 134 | 135 | -------------------------------------------------------------------------------- /user_space/rf_init_11n.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | home_dir=$(pwd) 8 | 9 | #if [ -z "$1" ] 10 | #then 11 | # tx_offset_tuning_enable=1 12 | #else 13 | tx_offset_tuning_enable=0 14 | #fi 15 | echo tx_offset_tuning_enable $tx_offset_tuning_enable 16 | 17 | #if [ $tx_offset_tuning_enable = "1" ] 18 | #then 19 | # fir_filename="openwifi_ad9361_fir.ftr" 20 | # tx_fir_enable=0 21 | #else 22 | # fir_filename="openwifi_ad9361_fir_tx_0MHz.ftr" 23 | # tx_fir_enable=1 24 | #fi 25 | 26 | fir_filename="openwifi_ad9361_fir_tx_0MHz_11n.ftr" 27 | tx_fir_enable=1 28 | 29 | echo $fir_filename "tx_fir_enable" $tx_fir_enable 30 | 31 | if test -f $fir_filename; then 32 | echo "Found" $fir_filename 33 | else 34 | echo "Can not find" $fir_filename 35 | exit 1 36 | fi 37 | 38 | set -x 39 | if test -f "/sys/bus/iio/devices/iio:device0/in_voltage_rf_bandwidth"; then 40 | cd /sys/bus/iio/devices/iio:device0/ 41 | else if test -f "/sys/bus/iio/devices/iio:device1/in_voltage_rf_bandwidth"; then 42 | cd /sys/bus/iio/devices/iio:device1/ 43 | else if test -f "/sys/bus/iio/devices/iio:device2/in_voltage_rf_bandwidth"; then 44 | cd /sys/bus/iio/devices/iio:device2/ 45 | else if test -f "/sys/bus/iio/devices/iio:device3/in_voltage_rf_bandwidth"; then 46 | cd /sys/bus/iio/devices/iio:device3/ 47 | else if test -f "/sys/bus/iio/devices/iio:device4/in_voltage_rf_bandwidth"; then 48 | cd /sys/bus/iio/devices/iio:device4/ 49 | else 50 | echo "Can not find in_voltage_rf_bandwidth!" 51 | echo "Check log to make sure ad9361 driver is loaded!" 52 | exit 1 53 | fi 54 | fi 55 | fi 56 | fi 57 | fi 58 | set +x 59 | 60 | echo 25215513 > in_voltage_rf_bandwidth 61 | echo 25215414 > out_voltage_rf_bandwidth 62 | echo 40000000 > in_voltage_sampling_frequency 63 | echo 40000000 > out_voltage_sampling_frequency 64 | 65 | echo 1000000000 > out_altvoltage0_RX_LO_frequency 66 | echo 1000000000 > out_altvoltage1_TX_LO_frequency 67 | 68 | cat $home_dir/$fir_filename > filter_fir_config 69 | echo 1 > in_voltage_filter_fir_en 70 | echo $tx_fir_enable > out_voltage_filter_fir_en 71 | cat filter_fir_config 72 | cat in_voltage_filter_fir_en 73 | cat out_voltage_filter_fir_en 74 | 75 | echo "rx0 agc fast_attack" 76 | #echo "rx0 agc manual" 77 | cat in_voltage0_gain_control_mode 78 | echo fast_attack > in_voltage0_gain_control_mode 79 | #echo manual > in_voltage0_gain_control_mode 80 | cat in_voltage0_gain_control_mode 81 | 82 | echo "rx1 agc fast_attack" 83 | #echo "rx1 agc manual" 84 | cat in_voltage1_gain_control_mode 85 | echo fast_attack > in_voltage1_gain_control_mode 86 | #echo manual > in_voltage1_gain_control_mode 87 | cat in_voltage1_gain_control_mode 88 | 89 | cat in_voltage_sampling_frequency 90 | cat in_voltage_rf_bandwidth 91 | cat out_voltage_sampling_frequency 92 | cat out_voltage_rf_bandwidth 93 | 94 | echo "rssi" 95 | cat in_voltage0_rssi 96 | cat in_voltage1_rssi 97 | 98 | # # --------not needed maybe-------- # # 99 | echo "rx0 gain to 70" # this set gain is gpio gain - 5dB (test with agc and read back gpio in driver) 100 | cat in_voltage0_hardwaregain 101 | echo 70 > in_voltage0_hardwaregain 102 | cat in_voltage0_hardwaregain 103 | 104 | echo "rx1 gain to 70" 105 | cat in_voltage1_hardwaregain 106 | echo 70 > in_voltage1_hardwaregain 107 | cat in_voltage1_hardwaregain 108 | 109 | echo "tx0 gain -89dB" 110 | cat out_voltage0_hardwaregain 111 | echo -89 > out_voltage0_hardwaregain 112 | cat out_voltage0_hardwaregain 113 | 114 | echo "tx1 gain 0dB" 115 | cat out_voltage1_hardwaregain 116 | echo 0 > out_voltage1_hardwaregain 117 | cat out_voltage1_hardwaregain 118 | # # --------not needed maybe-------- # # 119 | 120 | cd $home_dir 121 | 122 | -------------------------------------------------------------------------------- /user_space/rssi_ad9361_show.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Reads RSSI in dB from RX1, let's call it "r". 4 | # Linear fit offset "o" depends on frequency (2.4GHz or 5GHz and FMCOMMS2/3). 5 | # RSSI(dBm) = -r + o 6 | # 2.4GHz(ch 6) FMCOMMS2: o = 16.74 7 | # 2.4GHz(ch 6) FMCOMMS3: o = 17.44 8 | # 5GHz (ch 44) FMCOMMS2: o = 25.41 9 | # 5GHz (ch 44) FMCOMMS3: o = 24.58 10 | 11 | home_dir=$(pwd) 12 | 13 | #set -x 14 | if test -f "/sys/bus/iio/devices/iio:device0/in_voltage0_rssi"; then 15 | cd /sys/bus/iio/devices/iio:device0/ 16 | else if test -f "/sys/bus/iio/devices/iio:device1/in_voltage0_rssi"; then 17 | cd /sys/bus/iio/devices/iio:device1/ 18 | else if test -f "/sys/bus/iio/devices/iio:device2/in_voltage0_rssi"; then 19 | cd /sys/bus/iio/devices/iio:device2/ 20 | else if test -f "/sys/bus/iio/devices/iio:device3/in_voltage0_rssi"; then 21 | cd /sys/bus/iio/devices/iio:device3/ 22 | else if test -f "/sys/bus/iio/devices/iio:device4/in_voltage0_rssi"; then 23 | cd /sys/bus/iio/devices/iio:device4/ 24 | else 25 | echo "Can not find in_voltage_rf_bandwidth!" 26 | echo "Check log to make sure ad9361 driver is loaded!" 27 | exit 1 28 | fi 29 | fi 30 | fi 31 | fi 32 | fi 33 | #set +x 34 | 35 | if [ $# -lt 1 ]; then 36 | cat in_voltage0_rssi 37 | else 38 | num_read=$1 39 | for ((i=0;i<$num_read;i++)) 40 | do 41 | rssi_str=$(cat in_voltage0_rssi) 42 | echo "${rssi_str//dB}" 43 | done 44 | fi 45 | cd $home_dir 46 | -------------------------------------------------------------------------------- /user_space/rssi_openwifi_show.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rssi_raw=$(./sdrctl dev sdr0 get reg xpu 57) 4 | echo $rssi_raw 5 | 6 | rssi_raw=${rssi_raw: -8} 7 | echo $rssi_raw 8 | 9 | rssi_raw_dec=$(( 16#$rssi_raw )) 10 | echo $rssi_raw_dec 11 | 12 | #rssi_half_db=$(expr (16#$rss_raw) \& 2047) 13 | #rssi_half_db=$(($rssi_raw_dec & 2047)) 14 | #rssi_half_db=$(($rssi_raw_dec & 16#7ff)) 15 | #the low 11 bits are rssi_half_db 16 | rssi_half_db=$((16#$rssi_raw & 16#7ff)) 17 | echo $rssi_half_db 18 | 19 | -------------------------------------------------------------------------------- /user_space/rx_gain_show.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | set -x 12 | cat rx_data_ok_agc_gain_value_realtime 13 | cat rx_data_fail_agc_gain_value_realtime 14 | cat rx_mgmt_ok_agc_gain_value_realtime 15 | cat rx_mgmt_fail_agc_gain_value_realtime 16 | cat rx_ack_ok_agc_gain_value_realtime 17 | set +x 18 | 19 | cd $home_dir 20 | 21 | -------------------------------------------------------------------------------- /user_space/rx_stat_show.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | set -x 12 | # show 13 | cat rx_data_pkt_num_total 14 | cat rx_data_pkt_num_fail 15 | cat rx_mgmt_pkt_num_total 16 | cat rx_mgmt_pkt_num_fail 17 | cat rx_ack_pkt_num_total 18 | cat rx_ack_pkt_num_fail 19 | 20 | cat rx_data_pkt_mcs_realtime 21 | cat rx_data_pkt_fail_mcs_realtime 22 | cat rx_mgmt_pkt_mcs_realtime 23 | cat rx_mgmt_pkt_fail_mcs_realtime 24 | cat rx_ack_pkt_mcs_realtime 25 | 26 | cat rx_data_ok_agc_gain_value_realtime 27 | cat rx_data_fail_agc_gain_value_realtime 28 | cat rx_mgmt_ok_agc_gain_value_realtime 29 | cat rx_mgmt_fail_agc_gain_value_realtime 30 | cat rx_ack_ok_agc_gain_value_realtime 31 | 32 | # clear 33 | if [[ -n $1 ]]; then 34 | echo 0 > rx_data_pkt_num_total 35 | echo 0 > rx_data_pkt_num_fail 36 | echo 0 > rx_mgmt_pkt_num_total 37 | echo 0 > rx_mgmt_pkt_num_fail 38 | echo 0 > rx_ack_pkt_num_total 39 | echo 0 > rx_ack_pkt_num_fail 40 | 41 | echo 0 > rx_data_pkt_mcs_realtime 42 | echo 0 > rx_data_pkt_fail_mcs_realtime 43 | echo 0 > rx_mgmt_pkt_mcs_realtime 44 | echo 0 > rx_mgmt_pkt_fail_mcs_realtime 45 | echo 0 > rx_ack_pkt_mcs_realtime 46 | 47 | echo 0 > rx_data_ok_agc_gain_value_realtime 48 | echo 0 > rx_data_fail_agc_gain_value_realtime 49 | echo 0 > rx_mgmt_ok_agc_gain_value_realtime 50 | echo 0 > rx_mgmt_fail_agc_gain_value_realtime 51 | echo 0 > rx_ack_ok_agc_gain_value_realtime 52 | fi 53 | set +x 54 | 55 | cd $home_dir 56 | 57 | -------------------------------------------------------------------------------- /user_space/sdcard_boot_update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | if [ "$#" -ne 1 ]; then 8 | echo "You must enter the \$BOARD_NAME as argument" 9 | echo "Like: sdrpi antsdr antsdr_e200 e310v2 adrv9364z7020 adrv9361z7035 zc706_fmcs2 zed_fmcs2 zc702_fmcs2 zcu102_fmcs2 zcu102_9371 neptunesdr" 10 | exit 1 11 | fi 12 | BOARD_NAME=$1 13 | 14 | if [ "$BOARD_NAME" != "neptunesdr" ] && [ "$BOARD_NAME" != "antsdr" ] && [ "$BOARD_NAME" != "antsdr_e200" ] && [ "$BOARD_NAME" != "e310v2" ] && [ "$BOARD_NAME" != "sdrpi" ] && [ "$BOARD_NAME" != "zc706_fmcs2" ] && [ "$BOARD_NAME" != "zc702_fmcs2" ] && [ "$BOARD_NAME" != "zed_fmcs2" ] && [ "$BOARD_NAME" != "adrv9361z7035" ] && [ "$BOARD_NAME" != "adrv9364z7020" ] && [ "$BOARD_NAME" != "zcu102_fmcs2" ] && [ "$BOARD_NAME" != "zcu102_9371" ]; then 15 | echo "\$BOARD_NAME is not correct. Please check!" 16 | exit 1 17 | else 18 | echo "\$BOARD_NAME is found!" 19 | fi 20 | 21 | if [ "$BOARD_NAME" == "zcu102_fmcs2" ] || [ "$BOARD_NAME" == "zcu102_9371" ]; then 22 | dtb_filename="system.dtb" 23 | image_filepath="arch/arm64/boot/" 24 | image_filename="Image" 25 | LINUX_KERNEL_SRC_DIR_NAME=adi-linux-64 26 | else 27 | dtb_filename="devicetree.dtb" 28 | image_filepath="arch/arm/boot/" 29 | image_filename="uImage" 30 | LINUX_KERNEL_SRC_DIR_NAME=adi-linux 31 | fi 32 | echo $dtb_filename 33 | echo $image_filepath 34 | echo $image_filename 35 | 36 | set -x 37 | 38 | mv BOOT.BIN BOOT.BIN.bak 39 | sync 40 | wget ftp://192.168.10.1/kernel_boot/boards/$BOARD_NAME/output_boot_bin/BOOT.BIN 41 | if [ -f "./BOOT.BIN" ]; then 42 | echo "BOOT.BIN downloaded!" 43 | else 44 | echo "WARNING! BOOT.BIN not downloaded! Old file used!" 45 | mv BOOT.BIN.bak BOOT.BIN 46 | # exit 1 47 | fi 48 | sync 49 | 50 | mv $image_filename $image_filename.bak 51 | sync 52 | wget ftp://192.168.10.1/$LINUX_KERNEL_SRC_DIR_NAME/$image_filepath/$image_filename 53 | if [ -f "./$image_filename" ]; then 54 | echo "$image_filename downloaded!" 55 | else 56 | echo "WARNING! $image_filename not downloaded! Old file used!" 57 | mv $image_filename.bak $image_filename 58 | # exit 1 59 | fi 60 | sync 61 | 62 | mv $dtb_filename $dtb_filename.bak 63 | sync 64 | wget ftp://192.168.10.1/kernel_boot/boards/$BOARD_NAME/$dtb_filename 65 | if [ -f "./$dtb_filename" ]; then 66 | echo "$dtb_filename downloaded!" 67 | else 68 | echo "WARNING! $dtb_filename not downloaded! Old file used!" 69 | mv $dtb_filename.bak $dtb_filename 70 | # exit 1 71 | fi 72 | sync 73 | 74 | #slepp 0.5 75 | 76 | mount /dev/mmcblk0p1 /mnt 77 | sync 78 | #sleep 0.5 79 | cp BOOT.BIN /mnt/ -f 80 | rm /mnt/Image -f 81 | rm /mnt/uImage -f 82 | cp $image_filename /mnt/ -f 83 | rm /mnt/*.dtb -f 84 | cp $dtb_filename /mnt/ -f 85 | cd /mnt/ 86 | sync 87 | cd ~ 88 | #sleep 0.5 89 | umount /mnt 90 | sync 91 | #sleep 3 92 | sudo reboot now 93 | -------------------------------------------------------------------------------- /user_space/sdr-ad-hoc-join.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | if [ $# -ne 4 ] 8 | then 9 | echo "Please input NIC_name ch_number ip_addr cell as input parameter!" 10 | exit 11 | fi 12 | 13 | nic_name=$1 14 | ch_number=$2 15 | ip_addr=$3 16 | cell=$4 17 | echo $nic_name 18 | echo $ch_number 19 | echo $ip_addr 20 | echo $cell 21 | 22 | # sudo service network-manager stop 23 | sudo ip link set $nic_name down 24 | sudo iwconfig $nic_name mode ad-hoc 25 | sudo iwconfig $nic_name essid 'sdr-ad-hoc' 26 | sudo ip link set $nic_name up 27 | sudo iwconfig $nic_name channel $ch_number 28 | sudo iwconfig $nic_name ap $cell 29 | #sudo iwconfig $nic_name modulation 11g 30 | #sudo iwconfig $nic_name rate 6M 31 | sudo ifconfig $nic_name $ip_addr netmask 255.255.255.0 32 | ifconfig 33 | iwconfig $nic_name 34 | 35 | -------------------------------------------------------------------------------- /user_space/sdr-ad-hoc-up.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | if [ $# -ne 3 ] 8 | then 9 | echo "Please input NIC_name ch_number ip_addr as input parameter!" 10 | exit 11 | fi 12 | 13 | nic_name=$1 14 | ch_number=$2 15 | ip_addr=$3 16 | echo $nic_name 17 | echo $ch_number 18 | echo $ip_addr 19 | 20 | sudo ip link set $nic_name down 21 | sudo iwconfig $nic_name mode ad-hoc 22 | sudo iwconfig $nic_name essid 'sdr-ad-hoc' 23 | sudo ip link set $nic_name up 24 | sudo iwconfig $nic_name channel $ch_number 25 | #sudo iwconfig $nic_name modulation 11g 26 | #sudo iwconfig $nic_name rate 6M 27 | sudo ifconfig $nic_name $ip_addr netmask 255.255.255.0 28 | ifconfig 29 | iwconfig $nic_name 30 | -------------------------------------------------------------------------------- /user_space/sdrctl_src/Makefile: -------------------------------------------------------------------------------- 1 | MAKEFLAGS += --no-print-directory 2 | 3 | PREFIX ?= /usr 4 | SBINDIR ?= $(PREFIX)/sbin 5 | MANDIR ?= $(PREFIX)/share/man 6 | PKG_CONFIG ?= pkg-config 7 | 8 | MKDIR ?= mkdir -p 9 | INSTALL ?= install 10 | CC ?= "gcc" 11 | 12 | CFLAGS ?= -O2 -g 13 | CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration 14 | 15 | # OBJS = iw.o genl.o event.o info.o phy.o \ 16 | interface.o ibss.o station.o survey.o util.o \ 17 | mesh.o mpath.o scan.o reg.o version.o \ 18 | reason.o status.o connect.o link.o offch.o ps.o cqm.o \ 19 | bitrate.o wowlan.o coalesce.o roc.o p2p.o 20 | 21 | OBJS = sdrctl.o cmd.o version.o 22 | 23 | OBJS += sections.o 24 | 25 | # OBJS-$(HWSIM) += hwsim.o 26 | 27 | OBJS += $(OBJS-y) $(OBJS-Y) 28 | 29 | ALL = sdrctl 30 | 31 | ifeq ($(NO_PKG_CONFIG),) 32 | NL3xFOUND := $(shell $(PKG_CONFIG) --atleast-version=3.2 libnl-3.0 && echo Y) 33 | ifneq ($(NL3xFOUND),Y) 34 | NL31FOUND := $(shell $(PKG_CONFIG) --exact-version=3.1 libnl-3.1 && echo Y) 35 | ifneq ($(NL31FOUND),Y) 36 | NL3FOUND := $(shell $(PKG_CONFIG) --atleast-version=3 libnl-3.0 && echo Y) 37 | ifneq ($(NL3FOUND),Y) 38 | NL2FOUND := $(shell $(PKG_CONFIG) --atleast-version=2 libnl-2.0 && echo Y) 39 | ifneq ($(NL2FOUND),Y) 40 | NL1FOUND := $(shell $(PKG_CONFIG) --atleast-version=1 libnl-1 && echo Y) 41 | endif 42 | endif 43 | endif 44 | endif 45 | 46 | ifeq ($(NL1FOUND),Y) 47 | NLLIBNAME = libnl-1 48 | endif 49 | 50 | ifeq ($(NL2FOUND),Y) 51 | CFLAGS += -DCONFIG_LIBNL20 52 | LIBS += -lnl-genl 53 | NLLIBNAME = libnl-2.0 54 | endif 55 | 56 | ifeq ($(NL3xFOUND),Y) 57 | # libnl 3.2 might be found as 3.2 and 3.0 58 | NL3FOUND = N 59 | CFLAGS += -DCONFIG_LIBNL30 60 | LIBS += -lnl-genl-3 61 | NLLIBNAME = libnl-3.0 62 | endif 63 | 64 | ifeq ($(NL3FOUND),Y) 65 | CFLAGS += -DCONFIG_LIBNL30 66 | LIBS += -lnl-genl 67 | NLLIBNAME = libnl-3.0 68 | endif 69 | 70 | # nl-3.1 has a broken libnl-gnl-3.1.pc file 71 | # as show by pkg-config --debug --libs --cflags --exact-version=3.1 libnl-genl-3.1;echo $? 72 | ifeq ($(NL31FOUND),Y) 73 | CFLAGS += -DCONFIG_LIBNL30 74 | LIBS += -lnl-genl 75 | NLLIBNAME = libnl-3.1 76 | endif 77 | 78 | ifeq ($(NLLIBNAME),) 79 | $(error Cannot find development files for any supported version of libnl) 80 | endif 81 | 82 | LIBS += $(shell $(PKG_CONFIG) --libs $(NLLIBNAME)) 83 | CFLAGS += $(shell $(PKG_CONFIG) --cflags $(NLLIBNAME)) 84 | endif # NO_PKG_CONFIG 85 | 86 | ifeq ($(V),1) 87 | Q= 88 | NQ=true 89 | else 90 | Q=@ 91 | NQ=echo 92 | endif 93 | 94 | all: $(ALL) 95 | 96 | VERSION_OBJS := $(filter-out version.o, $(OBJS)) 97 | 98 | version.c: version.sh $(patsubst %.o,%.c,$(VERSION_OBJS)) nl80211.h sdrctl.h Makefile \ 99 | $(wildcard .git/index .git/refs/tags) 100 | @$(NQ) ' GEN ' $@ 101 | $(Q)./version.sh $@ 102 | 103 | %.o: %.c sdrctl.h nl80211.h 104 | @$(NQ) ' CC ' $@ 105 | $(Q)$(CC) $(CFLAGS) -c -o $@ $< 106 | 107 | sdrctl: $(OBJS) 108 | @$(NQ) ' CC ' sdrctl 109 | $(Q)$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o sdrctl 110 | 111 | check: 112 | $(Q)$(MAKE) all CC="REAL_CC=$(CC) CHECK=\"sparse -Wall\" cgcc" 113 | 114 | %.gz: % 115 | @$(NQ) ' GZIP' $< 116 | $(Q)gzip < $< > $@ 117 | 118 | install: sdrctl sdrctl.8.gz 119 | @$(NQ) ' INST sdrctl' 120 | $(Q)$(MKDIR) $(DESTDIR)$(SBINDIR) 121 | $(Q)$(INSTALL) -m 755 sdrctl $(DESTDIR)$(SBINDIR) 122 | @$(NQ) ' INST sdrctl.8' 123 | $(Q)$(MKDIR) $(DESTDIR)$(MANDIR)/man8/ 124 | $(Q)$(INSTALL) -m 644 sdrctl.8.gz $(DESTDIR)$(MANDIR)/man8/ 125 | 126 | clean: 127 | $(Q)rm -f sdrctl *.o *~ *.gz version.c *-stamp 128 | -------------------------------------------------------------------------------- /user_space/sdrctl_src/nl80211_testmode_def.h: -------------------------------------------------------------------------------- 1 | // Author: Xianjun Jiao 2 | // SPDX-FileCopyrightText: 2019 UGent 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | 5 | //---nl80211 cmd testmode definitions 6 | //---should be used in driver sdr.c and user space app 7 | 8 | enum openwifi_testmode_attr { 9 | __OPENWIFI_ATTR_INVALID = 0, 10 | OPENWIFI_ATTR_CMD = 1, 11 | OPENWIFI_ATTR_GAP = 2, 12 | OPENWIFI_ATTR_SLICE_IDX = 3, 13 | OPENWIFI_ATTR_ADDR = 4, 14 | OPENWIFI_ATTR_SLICE_TOTAL = 5, 15 | OPENWIFI_ATTR_SLICE_START = 6, 16 | OPENWIFI_ATTR_SLICE_END = 7, 17 | // OPENWIFI_ATTR_SLICE_TOTAL1 = 8, 18 | // OPENWIFI_ATTR_SLICE_START1 = 9, 19 | // OPENWIFI_ATTR_SLICE_END1 = 10, 20 | OPENWIFI_ATTR_RSSI_TH = 11, 21 | OPENWIFI_ATTR_HIGH_TSF = 12, 22 | OPENWIFI_ATTR_LOW_TSF = 13, 23 | 24 | REG_ATTR_ADDR = 14, 25 | REG_ATTR_VAL = 15, 26 | 27 | /* keep last */ 28 | __OPENWIFI_ATTR_AFTER_LAST, 29 | OPENWIFI_ATTR_MAX = __OPENWIFI_ATTR_AFTER_LAST - 1 30 | }; 31 | 32 | enum openwifi_testmode_cmd { 33 | OPENWIFI_CMD_SET_GAP = 0, 34 | OPENWIFI_CMD_GET_GAP = 1, 35 | 36 | OPENWIFI_CMD_SET_SLICE_IDX = 2, 37 | OPENWIFI_CMD_GET_SLICE_IDX = 3, 38 | 39 | OPENWIFI_CMD_SET_ADDR = 4, 40 | OPENWIFI_CMD_GET_ADDR = 5, 41 | 42 | OPENWIFI_CMD_SET_SLICE_TOTAL = 6, 43 | OPENWIFI_CMD_GET_SLICE_TOTAL = 7, 44 | 45 | OPENWIFI_CMD_SET_SLICE_START = 8, 46 | OPENWIFI_CMD_GET_SLICE_START = 9, 47 | 48 | OPENWIFI_CMD_SET_SLICE_END = 10, 49 | OPENWIFI_CMD_GET_SLICE_END = 11, 50 | 51 | // OPENWIFI_CMD_SET_SLICE_TOTAL1 = 12, 52 | // OPENWIFI_CMD_GET_SLICE_TOTAL1 = 13, 53 | 54 | // OPENWIFI_CMD_SET_SLICE_START1 = 14, 55 | // OPENWIFI_CMD_GET_SLICE_START1 = 15, 56 | 57 | // OPENWIFI_CMD_SET_SLICE_END1 = 16, 58 | // OPENWIFI_CMD_GET_SLICE_END1 = 17, 59 | 60 | OPENWIFI_CMD_SET_RSSI_TH = 18, 61 | OPENWIFI_CMD_GET_RSSI_TH = 19, 62 | 63 | OPENWIFI_CMD_SET_TSF = 20, 64 | 65 | REG_CMD_SET = 21, 66 | REG_CMD_GET = 22, 67 | }; 68 | 69 | static const struct nla_policy openwifi_testmode_policy[OPENWIFI_ATTR_MAX + 1] = { 70 | [OPENWIFI_ATTR_CMD] = { .type = NLA_U32 }, 71 | [OPENWIFI_ATTR_GAP] = { .type = NLA_U32 }, 72 | [OPENWIFI_ATTR_SLICE_IDX] = { .type = NLA_U32 }, 73 | [OPENWIFI_ATTR_ADDR] = { .type = NLA_U32 }, 74 | [OPENWIFI_ATTR_SLICE_TOTAL] = { .type = NLA_U32 }, 75 | [OPENWIFI_ATTR_SLICE_START] = { .type = NLA_U32 }, 76 | [OPENWIFI_ATTR_SLICE_END] = { .type = NLA_U32 }, 77 | // [OPENWIFI_ATTR_SLICE_TOTAL1] = { .type = NLA_U32 }, 78 | // [OPENWIFI_ATTR_SLICE_START1] = { .type = NLA_U32 }, 79 | // [OPENWIFI_ATTR_SLICE_END1] = { .type = NLA_U32 }, 80 | [OPENWIFI_ATTR_RSSI_TH] = { .type = NLA_U32 }, 81 | [OPENWIFI_ATTR_HIGH_TSF] = { .type = NLA_U32 }, 82 | [OPENWIFI_ATTR_LOW_TSF] = { .type = NLA_U32 }, 83 | 84 | [REG_ATTR_ADDR] = { .type = NLA_U32 }, 85 | [REG_ATTR_VAL] = { .type = NLA_U32 }, 86 | }; 87 | -------------------------------------------------------------------------------- /user_space/sdrctl_src/sections.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Xianjun Jiao 3 | * SPDX-FileCopyrightText: 2019 UGent 4 | * SPDX-License-Identifier: AGPL-3.0-or-later 5 | */ 6 | 7 | #include "sdrctl.h" 8 | 9 | SECTION(get); 10 | SECTION(set); 11 | -------------------------------------------------------------------------------- /user_space/sdrctl_src/version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | VERSION="3.17" 8 | OUT="$1" 9 | 10 | if [ -d .git ] && head=`git rev-parse --verify HEAD 2>/dev/null`; then 11 | git update-index --refresh --unmerged > /dev/null 12 | descr=$(git describe) 13 | 14 | # on git builds check that the version number above 15 | # is correct... 16 | [ "${descr%%-*}" = "v$VERSION" ] || exit 2 17 | 18 | v="${descr#v}" 19 | if git diff-index --name-only HEAD | read dummy ; then 20 | v="$v"-dirty 21 | fi 22 | else 23 | v="$VERSION" 24 | fi 25 | 26 | echo '#include "sdrctl.h"' > "$OUT" 27 | echo "const char sdrctl_version[] = \"$v\";" >> "$OUT" 28 | -------------------------------------------------------------------------------- /user_space/set_dbg_ch0.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | # set 12 | if [[ -n $1 ]]; then 13 | echo $1 > dbg_ch0 14 | fi 15 | 16 | # show 17 | cat dbg_ch0 18 | 19 | cd $home_dir 20 | 21 | -------------------------------------------------------------------------------- /user_space/set_dbg_ch1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | # set 12 | if [[ -n $1 ]]; then 13 | echo $1 > dbg_ch1 14 | fi 15 | 16 | # show 17 | cat dbg_ch1 18 | 19 | cd $home_dir 20 | 21 | -------------------------------------------------------------------------------- /user_space/set_dbg_ch2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | # set 12 | if [[ -n $1 ]]; then 13 | echo $1 > dbg_ch2 14 | fi 15 | 16 | # show 17 | cat dbg_ch2 18 | 19 | cd $home_dir 20 | 21 | -------------------------------------------------------------------------------- /user_space/set_lbt_th.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ -n $1 ]]; then 4 | lbt_th=$1 5 | else 6 | lbt_th=987654321 # no input 7 | fi 8 | 9 | set -x 10 | #set 11 | if [ $lbt_th -ne 987654321 ]; then 12 | ./sdrctl dev sdr0 set reg drv_xpu 0 $lbt_th 13 | fi 14 | 15 | # show 16 | # ./sdrctl dev sdr0 get reg xpu 8 17 | ./sdrctl dev sdr0 get reg drv_xpu 0 18 | set +x 19 | -------------------------------------------------------------------------------- /user_space/set_restrict_freq.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | # set 12 | if [[ -n $1 ]]; then 13 | echo $1 > restrict_freq_mhz 14 | fi 15 | 16 | # show 17 | cat restrict_freq_mhz 18 | 19 | cd $home_dir 20 | 21 | -------------------------------------------------------------------------------- /user_space/set_rx_gain_auto.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | home_dir=$(pwd) 8 | 9 | set -x 10 | if test -f "/sys/bus/iio/devices/iio:device0/in_voltage_rf_bandwidth"; then 11 | cd /sys/bus/iio/devices/iio:device0/ 12 | else if test -f "/sys/bus/iio/devices/iio:device1/in_voltage_rf_bandwidth"; then 13 | cd /sys/bus/iio/devices/iio:device1/ 14 | else if test -f "/sys/bus/iio/devices/iio:device2/in_voltage_rf_bandwidth"; then 15 | cd /sys/bus/iio/devices/iio:device2/ 16 | else if test -f "/sys/bus/iio/devices/iio:device3/in_voltage_rf_bandwidth"; then 17 | cd /sys/bus/iio/devices/iio:device3/ 18 | else if test -f "/sys/bus/iio/devices/iio:device4/in_voltage_rf_bandwidth"; then 19 | cd /sys/bus/iio/devices/iio:device4/ 20 | else 21 | echo "Can not find in_voltage_rf_bandwidth!" 22 | echo "Check log to make sure ad9361 driver is loaded!" 23 | exit 1 24 | fi 25 | fi 26 | fi 27 | fi 28 | fi 29 | 30 | echo fast_attack > in_voltage0_gain_control_mode 31 | cat in_voltage0_gain_control_mode 32 | cat in_voltage0_hardwaregain 33 | 34 | cd $home_dir 35 | 36 | set +x 37 | -------------------------------------------------------------------------------- /user_space/set_rx_gain_manual.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | gain_dB=$1 8 | if [ -z $gain_dB ] 9 | then 10 | gain_dB=0 11 | fi 12 | 13 | home_dir=$(pwd) 14 | 15 | set -x 16 | if test -f "/sys/bus/iio/devices/iio:device0/in_voltage_rf_bandwidth"; then 17 | cd /sys/bus/iio/devices/iio:device0/ 18 | else if test -f "/sys/bus/iio/devices/iio:device1/in_voltage_rf_bandwidth"; then 19 | cd /sys/bus/iio/devices/iio:device1/ 20 | else if test -f "/sys/bus/iio/devices/iio:device2/in_voltage_rf_bandwidth"; then 21 | cd /sys/bus/iio/devices/iio:device2/ 22 | else if test -f "/sys/bus/iio/devices/iio:device3/in_voltage_rf_bandwidth"; then 23 | cd /sys/bus/iio/devices/iio:device3/ 24 | else if test -f "/sys/bus/iio/devices/iio:device4/in_voltage_rf_bandwidth"; then 25 | cd /sys/bus/iio/devices/iio:device4/ 26 | else 27 | echo "Can not find in_voltage_rf_bandwidth!" 28 | echo "Check log to make sure ad9361 driver is loaded!" 29 | exit 1 30 | fi 31 | fi 32 | fi 33 | fi 34 | fi 35 | 36 | echo manual > in_voltage0_gain_control_mode 37 | cat in_voltage0_gain_control_mode 38 | 39 | if [ $gain_dB -gt 0 ]; then 40 | echo $gain_dB > in_voltage0_hardwaregain 41 | fi 42 | 43 | cat in_voltage0_hardwaregain 44 | 45 | cd $home_dir 46 | 47 | set +x 48 | -------------------------------------------------------------------------------- /user_space/set_rx_monitor_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | set -x 12 | # set 13 | if [[ -n $1 ]]; then 14 | echo $1 > rx_monitor_all 15 | else 16 | echo 1 > rx_monitor_all 17 | fi 18 | 19 | # show 20 | cat rx_monitor_all 21 | set +x 22 | 23 | cd $home_dir 24 | 25 | -------------------------------------------------------------------------------- /user_space/set_rx_target_sender_mac_addr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | set -x 12 | # set 13 | if [[ -n $1 ]]; then 14 | echo $1 > rx_target_sender_mac_addr 15 | fi 16 | 17 | # show 18 | cat rx_target_sender_mac_addr 19 | set +x 20 | 21 | cd $home_dir 22 | 23 | -------------------------------------------------------------------------------- /user_space/set_tx_lo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -x 4 | if test -f "/sys/kernel/debug/iio/iio:device0/direct_reg_access"; then 5 | cd /sys/kernel/debug/iio/device0/ 6 | else if test -f "/sys/kernel/debug/iio/iio:device1/direct_reg_access"; then 7 | cd /sys/kernel/debug/iio/iio:device1/ 8 | else if test -f "/sys/kernel/debug/iio/iio:device2/direct_reg_access"; then 9 | cd /sys/kernel/debug/iio/iio:device2/ 10 | else if test -f "/sys/kernel/debug/iio/iio:device3/direct_reg_access"; then 11 | cd /sys/kernel/debug/iio/iio:device3/ 12 | else if test -f "/sys/kernel/debug/iio/iio:device4/direct_reg_access"; then 13 | cd /sys/kernel/debug/iio/iio:device4/ 14 | else 15 | echo "Can not find direct_reg_access!" 16 | echo "Check log to make sure ad9361 driver is loaded!" 17 | exit 1 18 | fi 19 | fi 20 | fi 21 | fi 22 | fi 23 | set +x 24 | 25 | if [ "$#" -eq 1 ]; then 26 | if [ $1 == "0" ]; then 27 | echo 0x051 0x10 > direct_reg_access 28 | status=$( cat direct_reg_access ) 29 | if [ $status == "0x10" ]; then 30 | echo "Tx LO turned off" 31 | else 32 | echo "WARNING: turning Tx LO off unsuccessful" 33 | fi 34 | elif [ $1 == "1" ]; then 35 | echo 0x051 0x0 > direct_reg_access 36 | status=$( cat direct_reg_access ) 37 | if [ $status == "0x0" ]; then 38 | echo "Tx LO turned on" 39 | else 40 | echo "WARNING: turning Tx LO on unsuccessful" 41 | fi 42 | fi 43 | elif [ "$#" -eq 0 ]; then 44 | echo "Reading status only. Enter 1 or 0 as argument to set Tx LO on or off." 45 | echo 0x051 > direct_reg_access 46 | status=$( cat direct_reg_access ) 47 | if [ $status == "0x10" ]; then 48 | echo "Tx LO is off" 49 | elif [ $status == "0x0" ]; then 50 | echo "Tx LO is on" 51 | else 52 | echo "WARNING Unrecognized value $status." 53 | fi 54 | else 55 | echo "Too many arguments, specify only one for turning on (1) or off (0) the Tx LO." 56 | fi 57 | -------------------------------------------------------------------------------- /user_space/set_tx_port.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -x 4 | if test -f "/sys/kernel/debug/iio/iio:device0/direct_reg_access"; then 5 | cd /sys/kernel/debug/iio/device0/ 6 | else if test -f "/sys/kernel/debug/iio/iio:device1/direct_reg_access"; then 7 | cd /sys/kernel/debug/iio/iio:device1/ 8 | else if test -f "/sys/kernel/debug/iio/iio:device2/direct_reg_access"; then 9 | cd /sys/kernel/debug/iio/iio:device2/ 10 | else if test -f "/sys/kernel/debug/iio/iio:device3/direct_reg_access"; then 11 | cd /sys/kernel/debug/iio/iio:device3/ 12 | else if test -f "/sys/kernel/debug/iio/iio:device4/direct_reg_access"; then 13 | cd /sys/kernel/debug/iio/iio:device4/ 14 | else 15 | echo "Can not find direct_reg_access!" 16 | echo "Check log to make sure ad9361 driver is loaded!" 17 | exit 1 18 | fi 19 | fi 20 | fi 21 | fi 22 | fi 23 | set +x 24 | 25 | if [ "$#" -eq 1 ]; then 26 | if [ $1 == "0" ]; then 27 | echo 0x004 0x43 > direct_reg_access 28 | status=$( cat direct_reg_access ) 29 | if [ $status == "0x43" ]; then 30 | echo "Tx port B selected." 31 | else 32 | echo "WARNING: switching Tx port B unsuccessful" 33 | fi 34 | elif [ $1 == "1" ]; then 35 | echo 0x004 0x3 > direct_reg_access 36 | status=$( cat direct_reg_access ) 37 | if [ $status == "0x3" ]; then 38 | echo "Tx port A selected." 39 | else 40 | echo "WARNING: switching Tx port A unsuccessful" 41 | fi 42 | fi 43 | elif [ "$#" -eq 0 ]; then 44 | echo "Reading status only. Enter 1 or 0 as argument to select port A or B." 45 | echo 0x004 > direct_reg_access 46 | status=$( cat direct_reg_access ) 47 | if [ $status == "0x43" ]; then 48 | echo "Tx port B is used" 49 | elif [ $status == "0x3" ]; then 50 | echo "Tx port A is used" 51 | else 52 | echo "WARNING Unrecognized value $status." 53 | fi 54 | else 55 | echo "Too many arguments, specify only one for selecting port A (1) or B (0)." 56 | fi 57 | -------------------------------------------------------------------------------- /user_space/setup_once.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2023 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | set -ex 8 | 9 | cd /root/ 10 | 11 | MACHINE_TYPE=`uname -m` 12 | 13 | rm -rf kernel_modules 14 | mkdir -p kernel_modules 15 | 16 | # mkdir -p /lib/modules/$(uname -r) 17 | # rm -rf /lib/modules/$(uname -r) 18 | if [ ${MACHINE_TYPE} == 'aarch64' ]; then 19 | cp /root/kernel_modules64/* /root/kernel_modules/ 20 | cp /root/openwifi64/* /root/openwifi/ 21 | # cp ./kernel_modules64/* /lib/modules/$(uname -r)/ 22 | else 23 | cp /root/kernel_modules32/* /root/kernel_modules/ 24 | cp /root/openwifi32/* /root/openwifi/ 25 | # cp ./kernel_modules32/* /lib/modules/$(uname -r)/ 26 | fi 27 | 28 | # Decide board name 29 | DEVICE_TREE_MODEL_STRING=$(cat /proc/device-tree/model) 30 | if [[ $DEVICE_TREE_MODEL_STRING == *"ADRV9361-Z7035"* ]]; then 31 | BOARD_NAME=adrv9361z7035 32 | elif [[ $DEVICE_TREE_MODEL_STRING == *"ADRV9364-Z7020"* ]]; then 33 | BOARD_NAME=adrv9364z7020 34 | elif [[ $DEVICE_TREE_MODEL_STRING == *"ANTSDR-E310V2"* ]]; then 35 | BOARD_NAME=e310v2 36 | elif [[ $DEVICE_TREE_MODEL_STRING == *"ANTSDR-E310"* ]]; then 37 | BOARD_NAME=antsdr 38 | elif [[ $DEVICE_TREE_MODEL_STRING == *"ANTSDR-E200"* ]]; then 39 | BOARD_NAME=antsdr_e200 40 | elif [[ $DEVICE_TREE_MODEL_STRING == *"neptunesdr"* ]]; then 41 | BOARD_NAME=neptunesdr 42 | elif [[ $DEVICE_TREE_MODEL_STRING == *"sdrpi"* ]]; then 43 | BOARD_NAME=sdrpi 44 | elif [[ $DEVICE_TREE_MODEL_STRING == *"ZC702"* ]]; then 45 | BOARD_NAME=zc702_fmcs2 46 | elif [[ $DEVICE_TREE_MODEL_STRING == *"ZC706"* ]]; then 47 | BOARD_NAME=zc706_fmcs2 48 | elif [[ $DEVICE_TREE_MODEL_STRING == *"ZCU102"* ]]; then 49 | BOARD_NAME=zcu102_fmcs2 50 | elif [[ $DEVICE_TREE_MODEL_STRING == *"ZED"* ]]; then 51 | BOARD_NAME=zed_fmcs2 52 | else 53 | echo $DEVICE_TREE_MODEL_STRING " NOT recognized!" 54 | exit 1 55 | fi 56 | 57 | mv /root/kernel_modules/ad9361_drv.ko /root/openwifi/ -f || true 58 | mv /root/kernel_modules/adi_axi_hdmi.ko /root/openwifi/ -f || true 59 | mv /root/kernel_modules/axidmatest.ko /root/openwifi/ -f || true 60 | mv /root/kernel_modules/lcd.ko /root/openwifi/ -f || true 61 | mv /root/kernel_modules/xilinx_dma.ko /root/openwifi/ -f || true 62 | 63 | rm -rf /lib/modules/$(uname -r) 64 | ln -s /root/kernel_modules /lib/modules/$(uname -r) 65 | sync 66 | depmod 67 | 68 | echo $BOARD_NAME 69 | cp /root/openwifi_BOOT/$BOARD_NAME/system_top.bit.bin /root/openwifi/ -f || true 70 | 71 | cd /root/openwifi/sdrctl_src 72 | make clean 73 | make 74 | cp sdrctl /root/openwifi/ 75 | cd /root/openwifi/side_ch_ctl_src/ 76 | gcc -o side_ch_ctl side_ch_ctl.c 77 | cp side_ch_ctl /root/openwifi/ 78 | cd /root/openwifi/inject_80211/ 79 | make clean 80 | make 81 | cd .. 82 | sync 83 | 84 | # reboot now 85 | -------------------------------------------------------------------------------- /user_space/side_ch_ctl_src/iq_capture.py: -------------------------------------------------------------------------------- 1 | # 2 | # openwifi side info receive and display program 3 | # Xianjun jiao. putaoshu@msn.com; xianjun.jiao@imec.be 4 | # 5 | import os 6 | import sys 7 | import socket 8 | import numpy as np 9 | import matplotlib.pyplot as plt 10 | 11 | def display_iq(iq_capture, agc_gain, rssi_half_db): 12 | 13 | fig_iq_capture = plt.figure(0) 14 | fig_iq_capture.clf() 15 | plt.xlabel("sample") 16 | plt.ylabel("I/Q") 17 | plt.title("I (blue) and Q (red) capture") 18 | plt.plot(iq_capture.real, 'b') 19 | plt.plot(iq_capture.imag, 'r') 20 | plt.ylim(-32767, 32767) 21 | fig_iq_capture.canvas.flush_events() 22 | 23 | agc_gain_lock = np.copy(agc_gain) 24 | agc_gain_lock[agc_gain>127] = 80 # agc lock 25 | agc_gain_lock[agc_gain<=127] = 0 # agc not lock 26 | 27 | agc_gain_value = np.copy(agc_gain) 28 | agc_gain_value[agc_gain>127] = agc_gain[agc_gain>127] - 128 29 | 30 | fig_agc_gain = plt.figure(1) 31 | fig_agc_gain.clf() 32 | plt.xlabel("sample") 33 | plt.ylabel("gain/lock") 34 | plt.title("AGC gain (blue) and lock status (red)") 35 | plt.plot(agc_gain_value, 'b') 36 | plt.plot(agc_gain_lock, 'r') 37 | plt.ylim(0, 82) 38 | fig_agc_gain.canvas.flush_events() 39 | 40 | fig_rssi_half_db = plt.figure(2) 41 | fig_rssi_half_db.clf() 42 | plt.xlabel("sample") 43 | plt.ylabel("dB") 44 | plt.title("RSSI half dB (uncalibrated)") 45 | plt.plot(rssi_half_db) 46 | plt.ylim(100, 270) 47 | fig_rssi_half_db.canvas.flush_events() 48 | 49 | def parse_iq(iq, iq_len): 50 | # print(len(iq), iq_len) 51 | num_dma_symbol_per_trans = 1 + iq_len 52 | num_int16_per_trans = num_dma_symbol_per_trans*4 # 64bit per dma symbol 53 | num_trans = round(len(iq)/num_int16_per_trans) 54 | # print(len(iq), iq.dtype, num_trans) 55 | iq = iq.reshape([num_trans, num_int16_per_trans]) 56 | 57 | timestamp = iq[:,0] + pow(2,16)*iq[:,1] + pow(2,32)*iq[:,2] + pow(2,48)*iq[:,3] 58 | iq_capture = np.int16(iq[:,4::4]) + np.int16(iq[:,5::4])*1j 59 | agc_gain = iq[:,6::4] 60 | rssi_half_db = iq[:,7::4] 61 | # print(num_trans, iq_len, iq_capture.shape, agc_gain.shape, rssi_half_db.shape) 62 | 63 | iq_capture = iq_capture.reshape([num_trans*iq_len,]) 64 | agc_gain = agc_gain.reshape([num_trans*iq_len,]) 65 | rssi_half_db = rssi_half_db.reshape([num_trans*iq_len,]) 66 | 67 | return timestamp, iq_capture, agc_gain, rssi_half_db 68 | 69 | UDP_IP = "192.168.10.1" #Local IP to listen 70 | UDP_PORT = 4000 #Local port to listen 71 | 72 | sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP 73 | sock.bind((UDP_IP, UDP_PORT)) 74 | sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 464) # for low latency. 464 is the minimum udp length in our case (CSI only) 75 | 76 | # align with side_ch_control.v and all related user space, remote files 77 | MAX_NUM_DMA_SYMBOL = 8192 78 | 79 | if len(sys.argv)<2: 80 | print("Assume iq_len = 8187! (Max UDP 65507 bytes; (65507/8)-1 = 8187)") 81 | iq_len = 8187 82 | else: 83 | iq_len = int(sys.argv[1]) 84 | print(iq_len) 85 | # print(type(num_eq)) 86 | 87 | if iq_len>8187: 88 | iq_len = 8187 89 | print('Limit iq_len to 8187! (Max UDP 65507 bytes; (65507/8)-1 = 8187)') 90 | 91 | num_dma_symbol_per_trans = 1 + iq_len 92 | num_byte_per_trans = 8*num_dma_symbol_per_trans 93 | 94 | if os.path.exists("iq.txt"): 95 | os.remove("iq.txt") 96 | iq_fd=open('iq.txt','a') 97 | 98 | plt.ion() 99 | 100 | while True: 101 | try: 102 | data, addr = sock.recvfrom(MAX_NUM_DMA_SYMBOL*8) # buffer size 103 | # print(addr) 104 | test_residual = len(data)%num_byte_per_trans 105 | # print(len(data)/8, num_dma_symbol_per_trans, test_residual) 106 | if (test_residual != 0): 107 | print("Abnormal length") 108 | 109 | iq = np.frombuffer(data, dtype='uint16') 110 | np.savetxt(iq_fd, iq) 111 | 112 | timestamp, iq_capture, agc_gain, rssi_half_db = parse_iq(iq, iq_len) 113 | print(timestamp) 114 | display_iq(iq_capture, agc_gain, rssi_half_db) 115 | 116 | except KeyboardInterrupt: 117 | print('User quit') 118 | break 119 | 120 | print('close()') 121 | iq_fd.close() 122 | sock.close() 123 | -------------------------------------------------------------------------------- /user_space/side_ch_ctl_src/iq_capture_2ant.py: -------------------------------------------------------------------------------- 1 | # 2 | # openwifi side info receive and display program 3 | # Xianjun jiao. putaoshu@msn.com; xianjun.jiao@imec.be 4 | # 5 | import os 6 | import sys 7 | import socket 8 | import numpy as np 9 | import matplotlib.pyplot as plt 10 | 11 | def display_iq(iq0_capture, iq1_capture): 12 | fig_iq_capture = plt.figure(0) 13 | fig_iq_capture.clf() 14 | 15 | ax_iq0 = fig_iq_capture.add_subplot(211) 16 | # ax_iq0.set_xlabel("sample") 17 | ax_iq0.set_ylabel("I/Q") 18 | ax_iq0.set_title("rx0 I/Q") 19 | plt.plot(iq0_capture.real, 'b') 20 | plt.plot(iq0_capture.imag, 'r') 21 | plt.ylim(-32767, 32767) 22 | 23 | ax_iq1 = fig_iq_capture.add_subplot(212) 24 | ax_iq1.set_xlabel("sample") 25 | ax_iq1.set_ylabel("I/Q") 26 | ax_iq1.set_title("rx1 I/Q") 27 | plt.plot(iq1_capture.real, 'b') 28 | plt.plot(iq1_capture.imag, 'r') 29 | plt.ylim(-32767, 32767) 30 | fig_iq_capture.canvas.flush_events() 31 | 32 | def parse_iq(iq, iq_len): 33 | # print(len(iq), iq_len) 34 | num_dma_symbol_per_trans = 1 + iq_len 35 | num_int16_per_trans = num_dma_symbol_per_trans*4 # 64bit per dma symbol 36 | num_trans = round(len(iq)/num_int16_per_trans) 37 | # print(len(iq), iq.dtype, num_trans) 38 | iq = iq.reshape([num_trans, num_int16_per_trans]) 39 | 40 | timestamp = iq[:,0] + pow(2,16)*iq[:,1] + pow(2,32)*iq[:,2] + pow(2,48)*iq[:,3] 41 | iq0_capture = np.int16(iq[:,4::4]) + np.int16(iq[:,5::4])*1j 42 | iq1_capture = np.int16(iq[:,6::4]) + np.int16(iq[:,7::4])*1j 43 | # print(num_trans, iq_len, iq0_capture.shape, iq1_capture.shape) 44 | 45 | iq0_capture = iq0_capture.reshape([num_trans*iq_len,]) 46 | iq1_capture = iq1_capture.reshape([num_trans*iq_len,]) 47 | 48 | return timestamp, iq0_capture, iq1_capture 49 | 50 | UDP_IP = "192.168.10.1" #Local IP to listen 51 | UDP_PORT = 4000 #Local port to listen 52 | 53 | sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP 54 | sock.bind((UDP_IP, UDP_PORT)) 55 | sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 464) # for low latency. 464 is the minimum udp length in our case (CSI only) 56 | 57 | # align with side_ch_control.v and all related user space, remote files 58 | MAX_NUM_DMA_SYMBOL = 8192 59 | 60 | if len(sys.argv)<2: 61 | print("Assume iq_len = 8187! (Max UDP 65507 bytes; (65507/8)-1 = 8187)") 62 | iq_len = 8187 63 | else: 64 | iq_len = int(sys.argv[1]) 65 | print(iq_len) 66 | # print(type(num_eq)) 67 | 68 | if iq_len>8187: 69 | iq_len = 8187 70 | print('Limit iq_len to 8187! (Max UDP 65507 bytes; (65507/8)-1 = 8187)') 71 | 72 | num_dma_symbol_per_trans = 1 + iq_len 73 | num_byte_per_trans = 8*num_dma_symbol_per_trans 74 | 75 | if os.path.exists("iq_2ant.txt"): 76 | os.remove("iq_2ant.txt") 77 | iq_fd=open('iq_2ant.txt','a') 78 | 79 | plt.ion() 80 | 81 | while True: 82 | try: 83 | data, addr = sock.recvfrom(MAX_NUM_DMA_SYMBOL*8) # buffer size 84 | # print(addr) 85 | test_residual = len(data)%num_byte_per_trans 86 | # print(len(data)/8, num_dma_symbol_per_trans, test_residual) 87 | if (test_residual != 0): 88 | print("Abnormal length") 89 | 90 | iq = np.frombuffer(data, dtype='uint16') 91 | np.savetxt(iq_fd, iq) 92 | 93 | timestamp, iq0_capture, iq1_capture = parse_iq(iq, iq_len) 94 | print(timestamp, max(iq0_capture.real), max(iq1_capture.real)) 95 | display_iq(iq0_capture, iq1_capture) 96 | 97 | except KeyboardInterrupt: 98 | print('User quit') 99 | break 100 | 101 | print('close()') 102 | iq_fd.close() 103 | sock.close() 104 | -------------------------------------------------------------------------------- /user_space/side_ch_ctl_src/save_iq_to_txt_for_verilog_sim.m: -------------------------------------------------------------------------------- 1 | % Xianjun Jiao. xianjun.jiao@imec.be; putaoshu@msn.com 2 | 3 | function save_iq_to_txt_for_verilog_sim(mat_filename, varargin) 4 | a = load(mat_filename); 5 | var_names = fieldnames(a); 6 | var_cells = struct2cell(a); 7 | [len_iq, num_frame] = size(var_cells{1}); 8 | 9 | if nargin>=2 10 | idx_set = varargin{1}; 11 | else 12 | idx_set = 1:num_frame; 13 | end 14 | 15 | if nargin >= 3 16 | sp = varargin{2}(1); 17 | ep = varargin{2}(2); 18 | else 19 | sp = 1; 20 | ep = len_iq; 21 | end 22 | 23 | for name_idx = 1 : length(var_names) 24 | filename_txt = [var_names{name_idx} '.txt']; 25 | fid = fopen(filename_txt,'w'); 26 | if fid == -1 27 | disp('fopen failed'); 28 | return; 29 | end 30 | var_tmp = var_cells{name_idx}; 31 | for j=1:length(idx_set) 32 | idx = idx_set(j); 33 | iq = var_tmp(:,idx); 34 | for i=sp:ep 35 | fprintf(fid, '%d %d\n', round(real(iq(i))), round(imag(iq(i)))); 36 | end 37 | end 38 | fclose(fid); 39 | end 40 | -------------------------------------------------------------------------------- /user_space/side_ch_ctl_src/test_iq_2ant_file_display.m: -------------------------------------------------------------------------------- 1 | % Xianjun Jiao. xianjun.jiao@imec.be; putaoshu@msn.com 2 | 3 | % clear all; 4 | % close all; 5 | function timestamp = test_iq_2ant_file_display(iq_len, iq_cap_filename, idx_to_check) 6 | close all; 7 | 8 | if exist('iq_len', 'var')==0 || isempty(iq_len) 9 | iq_len = 8187; % default for big fpga 10 | % iq_len = 4095; % for small fpga 11 | end 12 | 13 | if exist('iq_cap_filename', 'var')==0 || isempty(iq_cap_filename) 14 | iq_cap_filename = 'iq_2ant.txt'; 15 | end 16 | 17 | if exist('idx_to_check', 'var')==0 || isempty(idx_to_check) 18 | idx_to_check = 1; 19 | end 20 | 21 | a = load(iq_cap_filename); 22 | len_a = floor(length(a)/4)*4; 23 | a = a(1:len_a); 24 | 25 | b = reshape(a, [4, length(a)/4])'; 26 | num_data_in_each_iq_capture = 1 + iq_len; 27 | num_iq_capture = floor(size(b,1)/num_data_in_each_iq_capture); 28 | 29 | iq0_capture = zeros(iq_len, num_iq_capture); 30 | iq1_capture = zeros(iq_len, num_iq_capture); 31 | timestamp = zeros(1, num_iq_capture); 32 | 33 | b = uint16(b); 34 | for i=1:num_iq_capture 35 | sp = (i-1)*num_data_in_each_iq_capture + 1; 36 | ep = i*num_data_in_each_iq_capture; 37 | timestamp(i) = double(b(sp,1)) + (2^16)*double(b(sp,2)) + (2^32)*double(b(sp,3)) + (2^48)*double(b(sp,4)); 38 | iq0_capture(:,i) = double(typecast(b((sp+1):ep,1),'int16')) + 1i.*double(typecast(b((sp+1):ep,2),'int16')); 39 | iq1_capture(:,i) = double(typecast(b((sp+1):ep,3),'int16')) + 1i.*double(typecast(b((sp+1):ep,4),'int16')); 40 | end 41 | 42 | mat_filename = [iq_cap_filename(1:end-4) '_' num2str(iq_len) '.mat']; 43 | save(mat_filename, 'iq0_capture', 'iq1_capture'); 44 | 45 | figure; plot(timestamp,'b+-'); title('time stamp (TSF value)'); ylabel('us'); xlabel('packet'); grid on; 46 | 47 | figure; 48 | subplot(2,1,1); 49 | plot(real(iq0_capture(:))); hold on; plot(imag(iq0_capture(:)),'r'); title('rx0 I (blue) Q (red) sample'); xlabel('sample'); ylabel('I/Q'); grid on; 50 | subplot(2,1,2); 51 | plot(real(iq1_capture(:))); hold on; plot(imag(iq1_capture(:)),'r'); title('rx1 I (blue) Q (red) sample'); xlabel('sample'); ylabel('I/Q'); grid on; 52 | 53 | figure; 54 | a = abs(iq0_capture(:)); 55 | b = abs(iq1_capture(:)); 56 | % a(a==0) = max(b); 57 | plot(a); hold on; 58 | plot(b,'r'); title('rx0 and rx1 abs'); xlabel('sample'); ylabel('abs'); grid on; 59 | legend('rx0','rx1'); 60 | 61 | save_iq_complex_to_txt(iq0_capture(:), [mat_filename(1:end-4) '_iq0.txt']); 62 | save_iq_complex_to_txt(iq1_capture(:), [mat_filename(1:end-4) '_iq1.txt']); 63 | 64 | figure; 65 | subplot(2,1,1); 66 | plot(real(iq0_capture(:,idx_to_check))); hold on; plot(imag(iq0_capture(:,idx_to_check)),'r'); title(['Capture idx ' num2str(idx_to_check) ' timestamp ' num2str(timestamp(idx_to_check))]); xlabel('sample'); ylabel('amplitude'); legend('I', 'Q'); grid on; 67 | subplot(2,1,2); 68 | plot(real(iq1_capture(:,idx_to_check))); hold on; plot(imag(iq1_capture(:,idx_to_check)),'r'); title(['Capture idx ' num2str(idx_to_check) ' timestamp ' num2str(timestamp(idx_to_check))]); xlabel('sample'); ylabel('amplitude'); legend('I', 'Q'); grid on; 69 | 70 | function save_iq_complex_to_txt(iq, filename) 71 | fid = fopen(filename,'w'); 72 | if fid == -1 73 | disp('fopen failed'); 74 | return; 75 | end 76 | 77 | for i=1:length(iq) 78 | fprintf(fid, '%d %d\n', round(real(iq(i))), round(imag(iq(i)))); 79 | end 80 | 81 | fclose(fid); 82 | -------------------------------------------------------------------------------- /user_space/side_ch_ctl_src/test_iq_file_display.m: -------------------------------------------------------------------------------- 1 | % Xianjun Jiao. xianjun.jiao@imec.be; putaoshu@msn.com 2 | 3 | % clear all; 4 | % close all; 5 | 6 | function timestamp = test_iq_file_display(iq_len, iq_cap_filename, idx_to_check) 7 | close all; 8 | 9 | if exist('iq_len', 'var')==0 || isempty(iq_len) 10 | iq_len = 8187; 11 | end 12 | 13 | if exist('iq_cap_filename', 'var')==0 || isempty(iq_cap_filename) 14 | iq_cap_filename = 'iq.txt'; 15 | end 16 | 17 | if exist('idx_to_check', 'var')==0 || isempty(idx_to_check) 18 | idx_to_check = 1; 19 | end 20 | 21 | a = load(iq_cap_filename); 22 | len_a = floor(length(a)/4)*4; 23 | a = a(1:len_a); 24 | 25 | b = reshape(a, [4, length(a)/4])'; 26 | num_data_in_each_iq_capture = 1 + iq_len; 27 | num_iq_capture = floor(size(b,1)/num_data_in_each_iq_capture); 28 | 29 | iq_capture = zeros(iq_len, num_iq_capture); 30 | timestamp = zeros(1, num_iq_capture); 31 | agc_gain = zeros(iq_len, num_iq_capture); 32 | rssi_half_db = zeros(iq_len, num_iq_capture); 33 | 34 | b = uint16(b); 35 | for i=1:num_iq_capture 36 | sp = (i-1)*num_data_in_each_iq_capture + 1; 37 | ep = i*num_data_in_each_iq_capture; 38 | timestamp(i) = double(b(sp,1)) + (2^16)*double(b(sp,2)) + (2^32)*double(b(sp,3)) + (2^48)*double(b(sp,4)); 39 | iq_capture(:,i) = double(typecast(b((sp+1):ep,1),'int16')) + 1i.*double(typecast(b((sp+1):ep,2),'int16')); 40 | agc_gain(:,i) = double(b((sp+1):ep,3)); 41 | rssi_half_db(:,i) = double(b((sp+1):ep,4)); 42 | end 43 | save(['iq_' num2str(iq_len) '.mat'], 'iq_capture'); 44 | 45 | agc_gain_lock = zeros(iq_len*num_iq_capture,1); 46 | agc_gain_lock(agc_gain(:)>127) = 1; 47 | 48 | agc_gain_value = agc_gain(:); 49 | agc_gain_value(agc_gain_value>127) = agc_gain_value(agc_gain_value>127) - 128; 50 | 51 | figure; plot(timestamp,'b+-'); title('time stamp (TSF value)'); ylabel('us'); xlabel('packet'); grid on; 52 | figure; plot(rssi_half_db(:)); title('RSSI half dB (uncalibrated)'); xlabel('sample'); ylabel('dB'); grid on; 53 | 54 | figure; 55 | plot(real(iq_capture(:))); hold on; plot(imag(iq_capture(:)),'r'); title('I (blue) Q (red) sample'); xlabel('sample'); ylabel('I/Q'); grid on; 56 | 57 | figure; 58 | subplot(2,1,1); plot(agc_gain_lock); title('AGC lock status from AD9361'); xlabel('sample'); ylabel('status'); grid on; 59 | subplot(2,1,2); plot(agc_gain_value); title('AGC gain from AD9361'); xlabel('sample'); ylabel('gain'); grid on; 60 | 61 | figure; 62 | agc_gain_value = reshape(agc_gain_value, [iq_len, num_iq_capture]); 63 | agc_gain_lock = reshape(agc_gain_lock, [iq_len, num_iq_capture]); 64 | subplot(4,1,1); plot(real(iq_capture(:,idx_to_check))); hold on; plot(imag(iq_capture(:,idx_to_check)),'r'); title(['Capture idx ' num2str(idx_to_check) ' timestamp ' num2str(timestamp(idx_to_check))]); xlabel('sample'); ylabel('amplitude'); legend('I', 'Q'); grid on; 65 | subplot(4,1,2); plot(rssi_half_db(:,idx_to_check)); title('RSSI half dB (uncalibrated)'); xlabel('sample'); ylabel('dB'); grid on; 66 | subplot(4,1,3); plot(agc_gain_lock(:,idx_to_check)); title('AGC lock status from AD9361'); xlabel('sample'); ylabel('status'); grid on; 67 | subplot(4,1,4); plot(agc_gain_value(:,idx_to_check)); title('AGC gain from AD9361'); xlabel('sample'); ylabel('gain'); grid on; 68 | -------------------------------------------------------------------------------- /user_space/side_ch_ctl_src/test_side_info_file_display.m: -------------------------------------------------------------------------------- 1 | % Xianjun Jiao. xianjun.jiao@imec.be; putaoshu@msn.com 2 | 3 | function timestamp = test_side_info_file_display(num_eq, side_info_filename, idx_to_check) 4 | close all; 5 | 6 | if exist('num_eq', 'var')==0 || isempty(num_eq) 7 | num_eq = 8; 8 | end 9 | 10 | if exist('side_info_filename', 'var')==0 || isempty(side_info_filename) 11 | side_info_filename = 'side_info.txt'; 12 | end 13 | 14 | if exist('idx_to_check', 'var')==0 || isempty(idx_to_check) 15 | idx_to_check = 1; 16 | end 17 | 18 | a = load(side_info_filename); 19 | len_a = floor(length(a)/4)*4; 20 | a = a(1:len_a); 21 | 22 | b = reshape(a, [4, length(a)/4])'; 23 | num_data_in_each_side_info = 2+56+num_eq*52; 24 | num_side_info = floor(size(b,1)/num_data_in_each_side_info); 25 | 26 | side_info = zeros(num_data_in_each_side_info, num_side_info); 27 | timestamp = uint64(zeros(1, num_side_info)); 28 | freq_offset = zeros(1, num_side_info); 29 | csi = zeros(56, num_side_info); 30 | equalizer = zeros(num_eq*52, num_side_info); 31 | 32 | b = uint16(b); 33 | for i=1:num_side_info 34 | sp = (i-1)*num_data_in_each_side_info + 1; 35 | ep = i*num_data_in_each_side_info; 36 | timestamp(i) = uint64(b(sp,1)) + (2^16)*uint64(b(sp,2)) + (2^32)*uint64(b(sp,3)) + (2^48)*uint64(b(sp,4)); 37 | freq_offset(i) = (20e6*double(typecast(b(sp+1,1),'int16'))/512)/(2*pi); 38 | side_info(:,i) = double(typecast(b(sp:ep,1),'int16')) + 1i.*double(typecast(b(sp:ep,2),'int16')); 39 | csi(:,i) = side_info(3:58,i); 40 | equalizer(:,i) = side_info(59:end,i); 41 | end 42 | 43 | csi = [csi(29:end,:); csi(1:28,:)]; 44 | equalizer = equalizer(:); 45 | equalizer(equalizer == 32767+1i*32767) = NaN; 46 | 47 | subplot(2,1,1); plot(abs(csi)); title('CSI'); ylabel('abs'); grid on; 48 | subplot(2,1,2); plot(angle(csi)); ylabel('phase'); xlabel('subcarrier'); grid on; 49 | 50 | if ~isempty(equalizer) 51 | scatterplot(equalizer); grid on; 52 | end 53 | 54 | figure; plot(timestamp,'b+-'); title('time stamp (TSF value)'); ylabel('us'); xlabel('packet'); grid on; 55 | figure; plot(freq_offset); title('freq offset (Hz)'); ylabel('Hz'); xlabel('packet'); grid on; 56 | 57 | figure; 58 | subplot(2,1,1); plot(abs(csi(:,idx_to_check))); title('CSI'); ylabel('abs'); grid on; title(['Capture idx ' num2str(idx_to_check) ' timestamp ' num2str(timestamp(idx_to_check))]); 59 | subplot(2,1,2); plot(angle(csi(:,idx_to_check))); ylabel('phase'); xlabel('subcarrier'); grid on; 60 | -------------------------------------------------------------------------------- /user_space/slice_cfg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Xianjun Jiao 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | 7 | if [ $# -ne 5 ] 8 | then 9 | echo "Please input slice_idx mac_addr cycle_period(us) start_time(us) end_time(us) as input parameter!" 10 | exit 11 | fi 12 | 13 | set -x #echo on 14 | 15 | slice_idx=$1 16 | mac_addr=$2 17 | cycle_period=$3 18 | start_time=$4 19 | end_time=$5 20 | 21 | echo $slice_idx 22 | echo $mac_addr 23 | echo $cycle_period 24 | echo $start_time 25 | echo $end_time 26 | 27 | ./sdrctl dev sdr0 set addr$slice_idx $mac_addr 28 | ./sdrctl dev sdr0 set slice_total$slice_idx $cycle_period 29 | ./sdrctl dev sdr0 set slice_start$slice_idx $start_time 30 | ./sdrctl dev sdr0 set slice_end$slice_idx $end_time 31 | -------------------------------------------------------------------------------- /user_space/stat_enable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | # set 12 | if [[ -n $1 ]]; then 13 | echo $1 > stat_enable 14 | else 15 | echo 1 > stat_enable 16 | fi 17 | 18 | # show 19 | cat stat_enable 20 | 21 | cd $home_dir 22 | 23 | -------------------------------------------------------------------------------- /user_space/system_top.bif: -------------------------------------------------------------------------------- 1 | all: 2 | { 3 | system_top.bit /* Bitstream file name */ 4 | } 5 | -------------------------------------------------------------------------------- /user_space/transfer_driver_userspace_to_board.sh: -------------------------------------------------------------------------------- 1 | 2 | #!/bin/bash 3 | 4 | # Author: Xianjun Jiao 5 | # SPDX-FileCopyrightText: 2019 UGent 6 | # SPDX-License-Identifier: AGPL-3.0-or-later 7 | 8 | # Setup Eth connection before this script! 9 | # Host: 192.168.10.1 10 | # Board: 192.168.10.122 11 | # Commands onboard to setup: 12 | # ifconfig eth0 192.168.10.122 netmask 255.255.255.0 13 | # ifconfig eth0 up 14 | # route add default gw 192.168.10.1 15 | 16 | # if [ "$#" -ne 2 ]; then 17 | # echo "You have input $# arguments." 18 | # echo "You must enter \$DIR_TO_ADI_LINUX_KERNEL and ARCH_BIT(32 or 64) as argument" 19 | # exit 1 20 | # fi 21 | 22 | # DIR_TO_ADI_LINUX_KERNEL=$1 23 | # ARCH_OPTION=$2 24 | 25 | # if [ "$ARCH_OPTION" == "64" ]; then 26 | # LINUX_KERNEL_IMAGE=$DIR_TO_ADI_LINUX_KERNEL/arch/arm64/boot/Image 27 | # else 28 | # LINUX_KERNEL_IMAGE=$DIR_TO_ADI_LINUX_KERNEL/arch/arm/boot/uImage 29 | # fi 30 | 31 | mkdir -p openwifi 32 | rm -rf ./openwifi/* 33 | find ../driver/ -name \*.ko -exec cp {} ./openwifi/ \; 34 | 35 | tar -zcvf openwifi.tar.gz openwifi 36 | 37 | scp openwifi.tar.gz root@192.168.10.122: 38 | -------------------------------------------------------------------------------- /user_space/transfer_kernel_image_module_to_board.sh: -------------------------------------------------------------------------------- 1 | 2 | #!/bin/bash 3 | 4 | # Author: Xianjun Jiao 5 | # SPDX-FileCopyrightText: 2019 UGent 6 | # SPDX-License-Identifier: AGPL-3.0-or-later 7 | 8 | # Setup Eth connection before this script! 9 | # Host: 192.168.10.1 10 | # Board: 192.168.10.122 11 | # Commands onboard to setup: 12 | # ifconfig eth0 192.168.10.122 netmask 255.255.255.0 13 | # ifconfig eth0 up 14 | # route add default gw 192.168.10.1 15 | 16 | if [ "$#" -ne 2 ]; then 17 | echo "You have input $# arguments." 18 | echo "You must enter \$DIR_TO_ADI_LINUX_KERNEL and \$BOARD_NAME as argument" 19 | exit 1 20 | fi 21 | 22 | DIR_TO_ADI_LINUX_KERNEL=$1 23 | BOARD_NAME=$2 24 | 25 | if [ "$BOARD_NAME" != "antsdr" ] && [ "$BOARD_NAME" != "antsdr_e200" ] && [ "$BOARD_NAME" != "e310v2" ] && [ "$BOARD_NAME" != "sdrpi" ] && [ "$BOARD_NAME" != "neptunesdr" ] && [ "$BOARD_NAME" != "zc706_fmcs2" ] && [ "$BOARD_NAME" != "zc702_fmcs2" ] && [ "$BOARD_NAME" != "zed_fmcs2" ] && [ "$BOARD_NAME" != "adrv9361z7035" ] && [ "$BOARD_NAME" != "adrv9364z7020" ] && [ "$BOARD_NAME" != "zcu102_fmcs2" ]; then 26 | echo "\$BOARD_NAME is not correct. Please check!" 27 | exit 1 28 | else 29 | echo "\$BOARD_NAME is found!" 30 | fi 31 | 32 | if [ "$BOARD_NAME" == "zcu102_fmcs2" ] || [ "$BOARD_NAME" == "zcu102_9371" ]; then 33 | LINUX_KERNEL_IMAGE=$DIR_TO_ADI_LINUX_KERNEL/arch/arm64/boot/Image 34 | DTB_FILENAME="system.dtb" 35 | else 36 | LINUX_KERNEL_IMAGE=$DIR_TO_ADI_LINUX_KERNEL/arch/arm/boot/uImage 37 | DTB_FILENAME="devicetree.dtb" 38 | fi 39 | 40 | mkdir -p kernel_modules 41 | rm -rf ./kernel_modules/* 42 | find $DIR_TO_ADI_LINUX_KERNEL/ -name \*.ko -exec cp {} ./kernel_modules/ \; 43 | 44 | cp $DIR_TO_ADI_LINUX_KERNEL/Module.symvers ./kernel_modules/ 45 | cp $DIR_TO_ADI_LINUX_KERNEL/modules.builtin ./kernel_modules/ 46 | cp $DIR_TO_ADI_LINUX_KERNEL/modules.builtin.modinfo ./kernel_modules/ 47 | cp $DIR_TO_ADI_LINUX_KERNEL/modules.order ./kernel_modules/ 48 | 49 | if test -f "$LINUX_KERNEL_IMAGE"; then 50 | cp $LINUX_KERNEL_IMAGE ./kernel_modules/ 51 | fi 52 | 53 | if test -f "../kernel_boot/boards/$BOARD_NAME/output_boot_bin/BOOT.BIN"; then 54 | cp ../kernel_boot/boards/$BOARD_NAME/output_boot_bin/BOOT.BIN ./kernel_modules/ 55 | fi 56 | if test -f "../kernel_boot/boards/$BOARD_NAME/$DTB_FILENAME"; then 57 | cp ../kernel_boot/boards/$BOARD_NAME/$DTB_FILENAME ./kernel_modules/ 58 | fi 59 | tar -zcvf kernel_modules.tar.gz kernel_modules 60 | 61 | scp kernel_modules.tar.gz root@192.168.10.122: 62 | 63 | # scp $LINUX_KERNEL_IMAGE root@192.168.10.122: 64 | 65 | scp populate_kernel_image_module_reboot.sh root@192.168.10.122: 66 | -------------------------------------------------------------------------------- /user_space/tx_intf_iq_data_to_sysfs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | set -x 6 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 7 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 8 | else 9 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 10 | fi 11 | 12 | cat ~/openwifi/arbitrary_iq_gen/iq_single_carrier_1000000Hz_512.bin > tx_intf_iq_data 13 | cat tx_intf_iq_data 14 | 15 | cd $home_dir 16 | -------------------------------------------------------------------------------- /user_space/tx_intf_iq_send.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | set -x 6 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 7 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 8 | else 9 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 10 | fi 11 | 12 | echo 1 > tx_intf_iq_ctl 13 | cat tx_intf_iq_ctl 14 | 15 | cd $home_dir 16 | -------------------------------------------------------------------------------- /user_space/tx_prio_queue_show.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | set -x 12 | # show 13 | cat tx_prio_queue 14 | 15 | # clear 16 | if [[ -n $1 ]]; then 17 | echo 0 > tx_prio_queue 18 | fi 19 | set +x 20 | 21 | cd $home_dir 22 | 23 | -------------------------------------------------------------------------------- /user_space/tx_stat_show.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | home_dir=$(pwd) 4 | 5 | if test -d "/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr"; then 6 | cd /sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr 7 | else 8 | cd /sys/devices/soc0/fpga-axi\@0/fpga-axi\@0\:sdr 9 | fi 10 | 11 | set -x 12 | # show 13 | cat tx_data_pkt_need_ack_num_total 14 | cat tx_data_pkt_need_ack_num_total_fail 15 | cat tx_data_pkt_need_ack_num_retx 16 | cat tx_data_pkt_need_ack_num_retx_fail 17 | 18 | cat tx_data_pkt_mcs_realtime 19 | cat tx_data_pkt_fail_mcs_realtime 20 | 21 | cat tx_mgmt_pkt_need_ack_num_total 22 | cat tx_mgmt_pkt_need_ack_num_total_fail 23 | cat tx_mgmt_pkt_need_ack_num_retx 24 | cat tx_mgmt_pkt_need_ack_num_retx_fail 25 | 26 | cat tx_mgmt_pkt_mcs_realtime 27 | cat tx_mgmt_pkt_fail_mcs_realtime 28 | 29 | # clear 30 | if [[ -n $1 ]]; then 31 | echo 0 > tx_data_pkt_need_ack_num_total 32 | echo 0 > tx_data_pkt_need_ack_num_total_fail 33 | echo 0 > tx_data_pkt_need_ack_num_retx 34 | echo 0 > tx_data_pkt_need_ack_num_retx_fail 35 | 36 | echo 0 > tx_data_pkt_mcs_realtime 37 | echo 0 > tx_data_pkt_fail_mcs_realtime 38 | 39 | echo 0 > tx_mgmt_pkt_need_ack_num_total 40 | echo 0 > tx_mgmt_pkt_need_ack_num_total_fail 41 | echo 0 > tx_mgmt_pkt_need_ack_num_retx 42 | echo 0 > tx_mgmt_pkt_need_ack_num_retx_fail 43 | 44 | echo 0 > tx_mgmt_pkt_mcs_realtime 45 | echo 0 > tx_mgmt_pkt_fail_mcs_realtime 46 | fi 47 | set +x 48 | 49 | cd $home_dir 50 | 51 | -------------------------------------------------------------------------------- /user_space/webserver/index.html: -------------------------------------------------------------------------------- 1 |

Welcome to openwifi

2 |

open-source IEEE802.11/Wi-Fi baseband chip/FPGA design

3 |

5 |

6 | -------------------------------------------------------------------------------- /user_space/webserver/openwifi-detail.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/user_space/webserver/openwifi-detail.jpg -------------------------------------------------------------------------------- /user_space/webserver/openwifi-detail.jpg.license: -------------------------------------------------------------------------------- 1 | 2 | # Author: Xianjun jiao 3 | 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | -------------------------------------------------------------------------------- /user_space/webserver/openwifi-logo-small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-sdr/openwifi/55bdb2c49fe3cc4d7b425068d3f7ef1f0b334b42/user_space/webserver/openwifi-logo-small.jpg -------------------------------------------------------------------------------- /user_space/webserver/openwifi-logo-small.jpg.license: -------------------------------------------------------------------------------- 1 | 2 | # Author: Xianjun jiao 3 | 4 | # SPDX-FileCopyrightText: 2019 UGent 5 | # SPDX-License-Identifier: AGPL-3.0-or-later 6 | -------------------------------------------------------------------------------- /user_space/wpa-connect.conf: -------------------------------------------------------------------------------- 1 | network={ 2 | ssid="ssid" 3 | psk="password" 4 | } 5 | -------------------------------------------------------------------------------- /user_space/wpa-openwifi.conf: -------------------------------------------------------------------------------- 1 | network={ 2 | ssid="openwifi" 3 | key_mgmt=NONE 4 | } 5 | -------------------------------------------------------------------------------- /user_space/wpa-testap.conf: -------------------------------------------------------------------------------- 1 | network={ 2 | ssid="testap" 3 | key_mgmt=NONE 4 | } 5 | --------------------------------------------------------------------------------