xref: /openwifi/doc/README.md (revision 2ee67178825ee52f380c2f72b7135d15ddadca60)
1*2ee67178SXianjun Jiao# openwifi domument
2*2ee67178SXianjun Jiao<img src="./openwifi-detail.jpg" width="1100">
3*2ee67178SXianjun Jiao
4*2ee67178SXianjun JiaoAbove figure shows software and hardware/FPGA modules that compose the openwifi design. The module name is equal/similar to the source code file name. Driver modules source code are in openwifi/driver/. FPGA modules source code are in openwifi-hw repository. The user space tool sdrctl source code are in openwifi/user_space/sdrctl_src/.
5*2ee67178SXianjun Jiao
6*2ee67178SXianjun Jiao**sdrctl command**
7*2ee67178SXianjun Jiao
8*2ee67178SXianjun JiaoBesides the Linux native Wi-Fi control programs, such as ifconfig/iw/iwconfig/iwlist/wpa_supplicant/hostapd/etc, openwifi offers a user space tool sdrctl to access openwifi specific functionalities. sdrctl is implemented as nl80211 testmode command and communicates with openwifi driver (function openwifi_testmode_cmd in sdr.c) via Linux nl80211--cfg80211--mac80211 path
9*2ee67178SXianjun Jiao
10*2ee67178SXianjun Jiao* **get and set a parameter**
11*2ee67178SXianjun Jiao```
12*2ee67178SXianjun Jiaosdrctl dev sdr0 get para_name
13*2ee67178SXianjun Jiaosdrctl dev sdr0 set para_name value
14*2ee67178SXianjun Jiao```
15*2ee67178SXianjun Jiaopara_name|meaning|example
16*2ee67178SXianjun Jiao---------|-------|----
17*2ee67178SXianjun Jiaoaddr0|target MAC addres of tx slice 0|32bit. for address 6c:fd:b9:4c:b1:c1, you set b94cb1c1
18*2ee67178SXianjun Jiaoslice_total0|tx slice 0 cycle length in us|for length 50ms, you set 49999
19*2ee67178SXianjun Jiaoslice_start0|tx slice 0 cycle start time in us|for start at 10ms, you set 10000
20*2ee67178SXianjun Jiaoslice_end0|  tx slice 0 cycle end   time in us|for end   at 40ms, you set 39999
21*2ee67178SXianjun Jiaoaddr1|target MAC addres of tx slice 1|32bit. for address 6c:fd:b9:4c:b1:c1, you set b94cb1c1
22*2ee67178SXianjun Jiaoslice_total1|tx slice 1 cycle length in us|for length 50ms, you set 49999
23*2ee67178SXianjun Jiaoslice_start1|tx slice 1 cycle start time in us|for start at 10ms, you set 10000
24*2ee67178SXianjun Jiaoslice_end1|  tx slice 1 cycle end   time in us|for end   at 40ms, you set 39999
25*2ee67178SXianjun Jiao
26*2ee67178SXianjun Jiao* **get and set a register of a module**
27*2ee67178SXianjun Jiao```
28*2ee67178SXianjun Jiaosdrctl dev sdr0 get reg module_name reg_idx
29*2ee67178SXianjun Jiaosdrctl dev sdr0 set reg module_name reg_idx reg_value
30*2ee67178SXianjun Jiao```
31*2ee67178SXianjun Jiaomodule_name drv_rx/drv_tx/drv_xpu refer to driver modules. Related registers are defined in sdr.h (drv_rx_reg_val/drv_tx_reg_val/drv_xpu_reg_val)
32*2ee67178SXianjun Jiao
33*2ee67178SXianjun Jiaomodule_name rf/rx_intf/tx_intf/rx/tx/xpu refer to RF (ad9xxx front-end) and FPGA (rx_intf/tx_intf/openofdm_rx/openofdm_tx/xpu) modules. Related register addresses are defined in hw_def.h.
34*2ee67178SXianjun Jiao
35*2ee67178SXianjun Jiaomodule_name: drv_rx
36*2ee67178SXianjun Jiao
37*2ee67178SXianjun Jiaoreg_idx|meaning|example
38*2ee67178SXianjun Jiao-------|-------|----
39*2ee67178SXianjun Jiao1|rx antenna selection|0:rx1, 1:rx2. After this command, you should down and up sdr0 by ifconfig, but not reload sdr0 driver via ./wgd.sh
40*2ee67178SXianjun Jiao
41*2ee67178SXianjun Jiaomodule_name: drv_tx
42*2ee67178SXianjun Jiao
43*2ee67178SXianjun Jiaoreg_idx|meaning|example
44*2ee67178SXianjun Jiao-------|-------|----
45*2ee67178SXianjun Jiao0|override Linux rate control of tx unicast data packet|4:6M, 5:9M, 6:12M, 7:18M, 8:24M, 9:36M, 10:48M, 11:54M
46*2ee67178SXianjun Jiao1|tx antenna selection|0:tx1, 1:tx2. After this command, you should down and up sdr0 by ifconfig, but not reload sdr0 driver via ./wgd.sh
47*2ee67178SXianjun Jiao
48*2ee67178SXianjun Jiaomodule_name: drv_xpu
49*2ee67178SXianjun Jiao
50*2ee67178SXianjun Jiaoreg_idx|meaning|example
51*2ee67178SXianjun Jiao-------|-------|----
52*2ee67178SXianjun Jiaox|x|x
53*2ee67178SXianjun Jiao
54*2ee67178SXianjun Jiaomodule_name: rf
55*2ee67178SXianjun Jiao
56*2ee67178SXianjun Jiaoreg_idx|meaning|example
57*2ee67178SXianjun Jiao-------|-------|----
58*2ee67178SXianjun Jiaox|x|x
59*2ee67178SXianjun Jiao
60*2ee67178SXianjun Jiaomodule_name: rx_intf
61*2ee67178SXianjun Jiao
62*2ee67178SXianjun Jiaoreg_idx|meaning|example
63*2ee67178SXianjun Jiao-------|-------|----
64*2ee67178SXianjun Jiao2|enable/disable rx interrupt|256(0x100):disable, 0:enable
65*2ee67178SXianjun Jiao
66*2ee67178SXianjun Jiaomodule_name: tx_intf
67*2ee67178SXianjun Jiao
68*2ee67178SXianjun Jiaoreg_idx|meaning|example
69*2ee67178SXianjun Jiao-------|-------|----
70*2ee67178SXianjun Jiao13|tx I/Q digital gain before DUC|current optimal value: 237
71*2ee67178SXianjun Jiao14|enable/disable tx interrupt|196672(0x30040):disable, 64(0x40):enable
72*2ee67178SXianjun Jiao
73*2ee67178SXianjun Jiaomodule_name: rx
74*2ee67178SXianjun Jiao
75*2ee67178SXianjun Jiaoreg_idx|meaning|example
76*2ee67178SXianjun Jiao-------|-------|----
77*2ee67178SXianjun Jiao20|history of PHY rx state|read only. If the last digit readback is always 3, it means the Viterbi decoder stops working
78*2ee67178SXianjun Jiao
79*2ee67178SXianjun Jiaomodule_name: tx
80*2ee67178SXianjun Jiao
81*2ee67178SXianjun Jiaoreg_idx|meaning|example
82*2ee67178SXianjun Jiao-------|-------|----
83*2ee67178SXianjun Jiao1|pilot scrambler initial state|lowest 7 bits are used. 0x7E by default in openofdm_tx.c
84*2ee67178SXianjun Jiao2|data  scrambler initial state|lowest 7 bits are used. 0x7F by default in openofdm_tx.c
85*2ee67178SXianjun Jiao
86*2ee67178SXianjun Jiaomodule_name: xpu
87*2ee67178SXianjun Jiao
88*2ee67178SXianjun Jiaoreg_idx|meaning|example
89*2ee67178SXianjun Jiao-------|-------|----
90*2ee67178SXianjun Jiao2|TSF timer low  32bit write|only write this register won't trigger the TSF timer reload. should use together with register for high 32bit
91*2ee67178SXianjun Jiao3|TSF timer high 32bit write|falling edge of MSB will trigger the TSF timer reload, which means write '1' then '0' to MSB
92*2ee67178SXianjun Jiao4|band and channel number setting|see enum openwifi_band in hw_def.h. it will be set automatically by Linux. normally you shouldn't set it
93*2ee67178SXianjun Jiao11|max number of retransmission in FPGA|normally number of retransmission controled by Linux in real-time. If you write non-zeros value to this register, it will override Linux real-time setting
94*2ee67178SXianjun Jiao19|CSMA enable/disable|3758096384(0xe0000000): disable, 3:enable
95*2ee67178SXianjun Jiao20|tx slice 0 cycle length in us|for length 50ms, you set 49999
96*2ee67178SXianjun Jiao21|tx slice 0 cycle start time in us|for start at 10ms, you set 10000
97*2ee67178SXianjun Jiao22|tx slice 0 cycle end   time in us|for end   at 40ms, you set 39999
98*2ee67178SXianjun Jiao23|tx slice 1 cycle length in us|for length 50ms, you set 49999
99*2ee67178SXianjun Jiao24|tx slice 1 cycle start time in us|for start at 10ms, you set 10000
100*2ee67178SXianjun Jiao25|tx slice 1 cycle end   time in us|for end   at 40ms, you set 39999
101*2ee67178SXianjun Jiao27|FPGA packet filter config|check openwifi_configure_filter in sdr.c. also: https://www.kernel.org/doc/html/v4.9/80211/mac80211.html#frame-filtering
102*2ee67178SXianjun Jiao28|BSSID address low  32bit for BSSID filtering|normally it is set by Linux in real-time automatically
103*2ee67178SXianjun Jiao29|BSSID address high 32bit for BSSID filtering|normally it is set by Linux in real-time automatically
104*2ee67178SXianjun Jiao30|openwifi MAC address low  32bit|
105*2ee67178SXianjun Jiao31|openwifi MAC address high 32bit|check XPU_REG_MAC_ADDR_write in sdr.c to see how we set MAC address to FPGA when NIC start
106*2ee67178SXianjun Jiao58|TSF runtime value low  32bit|read only
107*2ee67178SXianjun Jiao59|TSF runtime value high 32bit|read only
108