diff options
author | Guy Mishol | 2014-08-07 08:40:44 -0500 |
---|---|---|
committer | Guy Mishol | 2014-08-07 08:48:13 -0500 |
commit | f39c959f027905bfd52e1807cd90a7503cef777d (patch) | |
tree | f415f7a9bd6d734e3e9903eede038bfb27c80e40 | |
parent | e014b59381f04b329fccd0ec18a5f2da7fa0fd63 (diff) | |
download | 18xx-ti-utils-f39c959f027905bfd52e1807cd90a7503cef777d.tar.gz 18xx-ti-utils-f39c959f027905bfd52e1807cd90a7503cef777d.tar.xz 18xx-ti-utils-f39c959f027905bfd52e1807cd90a7503cef777d.zip |
calibrator: add and update commandsol_r8.a9.16ol_r8.a9.15
version 0.80:
tx power command: support in dBPsat output power
tx start command: support in frames size up to 4065 Bytes
rx statistics command: display RSSI both from SOC and ANT
update Tune channel and tx power input values
add new command - antenna diversity for 5G
Signed-off-by: Guy Mishol <guym@ti.com>
-rw-r--r-- | calibrator.c | 2 | ||||
-rw-r--r-- | wl18xx_plt.c | 90 | ||||
-rw-r--r-- | wl18xx_plt.h | 52 |
3 files changed, 106 insertions, 38 deletions
diff --git a/calibrator.c b/calibrator.c index 25a30d3..b8f66fa 100644 --- a/calibrator.c +++ b/calibrator.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "plt.h" | 25 | #include "plt.h" |
26 | #include "ini.h" | 26 | #include "ini.h" |
27 | 27 | ||
28 | char calibrator_version[] = "0.79"; | 28 | char calibrator_version[] = "0.80"; |
29 | #if !defined CONFIG_LIBNL20 && !defined CONFIG_LIBNL32 | 29 | #if !defined CONFIG_LIBNL20 && !defined CONFIG_LIBNL32 |
30 | /* libnl 2.0 compatibility code */ | 30 | /* libnl 2.0 compatibility code */ |
31 | static inline struct nl_handle *nl_socket_alloc(void) | 31 | static inline struct nl_handle *nl_socket_alloc(void) |
diff --git a/wl18xx_plt.c b/wl18xx_plt.c index 41a8f9e..e0ccb78 100644 --- a/wl18xx_plt.c +++ b/wl18xx_plt.c | |||
@@ -25,6 +25,46 @@ | |||
25 | 25 | ||
26 | SECTION(wl18xx_plt); | 26 | SECTION(wl18xx_plt); |
27 | 27 | ||
28 | static int plt_wl18xx_set_antenna_diversity_5G(struct nl80211_state *state, struct nl_cb *cb, | ||
29 | struct nl_msg *msg, int argc, char **argv) | ||
30 | { | ||
31 | struct nlattr *key; | ||
32 | struct wl18xx_cmd_set_antenna_diversity_5G prms; | ||
33 | |||
34 | if (argc != 1) | ||
35 | return 1; | ||
36 | |||
37 | prms.test.id = WL18XX_TEST_CMD_5GHZ_ANTENNA_DIVERSITY; | ||
38 | prms.mode = (__u8)atoi(argv[0]); | ||
39 | |||
40 | if (prms.mode > 1) | ||
41 | return 1; | ||
42 | |||
43 | key = nla_nest_start(msg, NL80211_ATTR_TESTDATA); | ||
44 | if (!key) { | ||
45 | fprintf(stderr, "fail to nla_nest_start()\n"); | ||
46 | return 1; | ||
47 | } | ||
48 | |||
49 | printf("Calibrator:: Set antenna diversity 5G (mode=%d)\n", | ||
50 | prms.mode); | ||
51 | |||
52 | NLA_PUT_U32(msg, WL1271_TM_ATTR_CMD_ID, WL1271_TM_CMD_TEST); | ||
53 | NLA_PUT(msg, WL1271_TM_ATTR_DATA, sizeof(prms), &prms); | ||
54 | |||
55 | nla_nest_end(msg, key); | ||
56 | |||
57 | return 0; | ||
58 | |||
59 | nla_put_failure: | ||
60 | fprintf(stderr, "%s> building message failed\n", __func__); | ||
61 | return 2; | ||
62 | } | ||
63 | |||
64 | COMMAND(wl18xx_plt, set_antenna_diversity_5G , "<mode>", | ||
65 | NL80211_CMD_TESTMODE, 0, CIB_NETDEV, plt_wl18xx_set_antenna_diversity_5G, | ||
66 | " Set antenna diversity 5G\n"); | ||
67 | |||
28 | 68 | ||
29 | static int plt_wl18xx_tx_tone_stop(struct nl80211_state *state, struct nl_cb *cb, | 69 | static int plt_wl18xx_tx_tone_stop(struct nl80211_state *state, struct nl_cb *cb, |
30 | struct nl_msg *msg, int argc, char **argv) | 70 | struct nl_msg *msg, int argc, char **argv) |
@@ -346,11 +386,11 @@ static int plt_wl18xx_set_tx_power(struct nl80211_state *state, | |||
346 | 386 | ||
347 | prms.test.id = WL18XX_TEST_CMD_TX_POWER; | 387 | prms.test.id = WL18XX_TEST_CMD_TX_POWER; |
348 | 388 | ||
349 | prms.mac_des_pwr = atoi(argv[0]); | 389 | prms.mac_des_pwr = (__s32)atoi(argv[0]); |
350 | prms.mac_lvl_idx = atoi(argv[1]); | 390 | prms.mac_lvl_idx = atoi(argv[1]); |
351 | prms.freq_band = atoi(argv[2]); | 391 | prms.freq_band = atoi(argv[2]); |
352 | prms.freq_prim_chan_num = atoi(argv[3]); | 392 | prms.freq_prim_chan_num = atoi(argv[3]); |
353 | prms.freq_2nd_chan_idx = atoi(argv[4]); | 393 | prms.freq_prim_chan_loc = atoi(argv[4]); |
354 | prms.mac_ant_select = atoi(argv[5]); | 394 | prms.mac_ant_select = atoi(argv[5]); |
355 | prms.mac_non_srv = atoi(argv[6]); | 395 | prms.mac_non_srv = atoi(argv[6]); |
356 | prms.mac_chan_lim_dis = atoi(argv[7]); | 396 | prms.mac_chan_lim_dis = atoi(argv[7]); |
@@ -358,9 +398,19 @@ static int plt_wl18xx_set_tx_power(struct nl80211_state *state, | |||
358 | prms.mac_gain_calc_mode = atoi(argv[9]); | 398 | prms.mac_gain_calc_mode = atoi(argv[9]); |
359 | prms.mac_analog_gain_control_idx = atoi(argv[10]); | 399 | prms.mac_analog_gain_control_idx = atoi(argv[10]); |
360 | prms.mac_post_dpd_gain = atoi(argv[11]); | 400 | prms.mac_post_dpd_gain = atoi(argv[11]); |
361 | if (prms.mac_des_pwr > 20000) { | 401 | |
362 | fprintf(stderr, "TX Output Power is out of range (0-20.000dBm)\n"); | 402 | if ((prms.mac_gain_calc_mode == 0) || (prms.mac_gain_calc_mode == 1)) { |
403 | if ((prms.mac_des_pwr > 20000) || (prms.mac_des_pwr < 0)) { | ||
404 | fprintf(stderr, "Power Mode: TX Output Power is out of range (0-20.000dBm)\n"); | ||
363 | return 1; | 405 | return 1; |
406 | } | ||
407 | } | ||
408 | |||
409 | if (prms.mac_gain_calc_mode == 2) { | ||
410 | if ((prms.mac_des_pwr > -4000) || (prms.mac_des_pwr < -15000)) { | ||
411 | fprintf(stderr, "dBPsat Mode: TX Output Power is out of range (-15.000-(-4.000)dBm)\n"); | ||
412 | return 1; | ||
413 | } | ||
364 | } | 414 | } |
365 | 415 | ||
366 | if (prms.mac_lvl_idx > 3) | 416 | if (prms.mac_lvl_idx > 3) |
@@ -411,9 +461,9 @@ nla_put_failure: | |||
411 | return 2; | 461 | return 2; |
412 | } | 462 | } |
413 | 463 | ||
414 | COMMAND(wl18xx_plt, set_tx_power, "<output_power> <level:0-20.000> <band> " | 464 | COMMAND(wl18xx_plt, set_tx_power, "<output_power> <level> <band> " |
415 | "<primary_channel> <2nd_channel> <antenna> <non_serving_channel> " | 465 | "<channel_number> <primary_channel_location> <antenna> <non_serving_channel> " |
416 | "<channel_limitation> <frontend_limit> <gain_calculation> " | 466 | "<channel_limitation> <frontend_limit> <gain_calculation_mode> " |
417 | "<analog_gain_control_id> <post_dpd_gain>", | 467 | "<analog_gain_control_id> <post_dpd_gain>", |
418 | NL80211_CMD_TESTMODE, 0, CIB_NETDEV, plt_wl18xx_set_tx_power, | 468 | NL80211_CMD_TESTMODE, 0, CIB_NETDEV, plt_wl18xx_set_tx_power, |
419 | "set TX transmissions power for PLT.\n"); | 469 | "set TX transmissions power for PLT.\n"); |
@@ -429,10 +479,10 @@ static int plt_wl18xx_tune_channel(struct nl80211_state *state, struct nl_cb *cb | |||
429 | 479 | ||
430 | prms.test.id = WL18XX_TEST_CMD_CHANNEL_TUNE; | 480 | prms.test.id = WL18XX_TEST_CMD_CHANNEL_TUNE; |
431 | prms.channel = (__u8)atoi(argv[0]); | 481 | prms.channel = (__u8)atoi(argv[0]); |
432 | prms.band = (__u8)atoi(argv[1]); | 482 | prms.band = (__u8)atoi(argv[1]); |
433 | prms.bandwidth = (__u8)atoi(argv[2]); | 483 | prms.bandwidth = (__u8)atoi(argv[2]); |
434 | prms.rfSetIdx = 0; /* Set to Zero to support backward competability only for RTTT */ | 484 | prms.rfSetIdx = 0; /* Set to Zero to support backward competability only for RTTT */ |
435 | 485 | ||
436 | key = nla_nest_start(msg, NL80211_ATTR_TESTDATA); | 486 | key = nla_nest_start(msg, NL80211_ATTR_TESTDATA); |
437 | if (!key) { | 487 | if (!key) { |
438 | fprintf(stderr, "fail to nla_nest_start()\n"); | 488 | fprintf(stderr, "fail to nla_nest_start()\n"); |
@@ -556,7 +606,9 @@ static int plt_wl18xx_display_rx_stats(struct nl_msg *msg, void *arg) | |||
556 | printf("FCS Errors:\t\t%d\n", prms->errors); | 606 | printf("FCS Errors:\t\t%d\n", prms->errors); |
557 | printf("MAC Mismatch:\t\t%d\n", prms->addr_mm); | 607 | printf("MAC Mismatch:\t\t%d\n", prms->addr_mm); |
558 | printf("Good Packets:\t\t%d\n", prms->good); | 608 | printf("Good Packets:\t\t%d\n", prms->good); |
559 | printf("Average RSSI:\t\t%d\n", prms->rssi); | 609 | printf("Average RSSI (SOC):\t%d\n", prms->rssi_soc); |
610 | printf("Average RSSI (ANT):\t%d\n", prms->rssi_ant); | ||
611 | |||
560 | if(prms->total) { | 612 | if(prms->total) { |
561 | float per = ((float)prms->total - (float)prms->good)/(float)prms->total; | 613 | float per = ((float)prms->total - (float)prms->good)/(float)prms->total; |
562 | printf("PER:\t\t\t%f # PER = Total Bad / Total Received\n", per); | 614 | printf("PER:\t\t\t%f # PER = Total Bad / Total Received\n", per); |
@@ -578,8 +630,6 @@ static int plt_wl18xx_get_rx_stats(struct nl80211_state *state, struct nl_cb *cb | |||
578 | 630 | ||
579 | prms.test.id = WL18XX_TEST_CMD_GET_RX_STATISTICS; | 631 | prms.test.id = WL18XX_TEST_CMD_GET_RX_STATISTICS; |
580 | 632 | ||
581 | printf("test.id = 0x%0x\n", prms.test.id); | ||
582 | |||
583 | key = nla_nest_start(msg, NL80211_ATTR_TESTDATA); | 633 | key = nla_nest_start(msg, NL80211_ATTR_TESTDATA); |
584 | if (!key) { | 634 | if (!key) { |
585 | fprintf(stderr, "fail to nla_nest_start()\n"); | 635 | fprintf(stderr, "fail to nla_nest_start()\n"); |
@@ -633,8 +683,8 @@ static int plt_wl18xx_start_tx(struct nl80211_state *state, struct nl_cb *cb, | |||
633 | fprintf(stderr, "Delay is out of range (valid range >=200us)\n"); | 683 | fprintf(stderr, "Delay is out of range (valid range >=200us)\n"); |
634 | return 1; | 684 | return 1; |
635 | } | 685 | } |
636 | if (prms.size > 2000) { | 686 | if (prms.size > 4065) { |
637 | fprintf(stderr, "Packet Size is out of range (valid range <2000B)\n"); | 687 | fprintf(stderr, "Packet Size is out of range (valid range <=4065B)\n"); |
638 | return 1; | 688 | return 1; |
639 | } | 689 | } |
640 | if (prms.rate < 0 || prms.rate > 29) | 690 | if (prms.rate < 0 || prms.rate > 29) |
@@ -690,12 +740,14 @@ COMMAND(wl18xx_plt, start_tx, "<delay> <rate> <size> <mode> <data_type> <gi> " | |||
690 | "\t\t\t22 = MCS10/MCS6 at 40MHz\t23 = MCS11/MCS7 at 40MHz\n" | 740 | "\t\t\t22 = MCS10/MCS6 at 40MHz\t23 = MCS11/MCS7 at 40MHz\n" |
691 | "\t\t\t24 = MCS12/MCS7 at 40MHz SGI\t25 = MCS13\n" | 741 | "\t\t\t24 = MCS12/MCS7 at 40MHz SGI\t25 = MCS13\n" |
692 | "\t\t\t26 = MCS14\t\t\t27 = MCS15\n" | 742 | "\t\t\t26 = MCS14\t\t\t27 = MCS15\n" |
693 | "<size>\t\tpacket size (bytes): 0-2000\n" | 743 | "<size>\t\tpacket size (bytes): 0-4065\n" |
694 | "<mode>\t\tnumber of packets (0 = endless)\n" | 744 | "<mode>\t\tnumber of packets (0 = endless)\n" |
695 | "<data_type>\tTBD\n" | 745 | "<data_type>\tnot supported\n" |
696 | "<gi>\t\tguard interval (0 = normal, 1 = short)\n" | 746 | "<gi>\t\tguard interval (0 = normal, 1 = short)\n" |
697 | "<options1>\tTBD\n" | 747 | "<options1>\tunused\n" |
698 | "<options2>\tTBD\n" | 748 | "<options2>\tsupported options according to bitmap:\n" |
749 | "\t\t\tbit1 - override CCA\n" | ||
750 | "\t\t\tbit2 - fixed/incremental sequence number\n" | ||
699 | "<source MAC>\tsource MAC address (XX:XX:XX:XX:XX:XX)\n" | 751 | "<source MAC>\tsource MAC address (XX:XX:XX:XX:XX:XX)\n" |
700 | "<dest MAC>\tdestination MAC address (XX:XX:XX:XX:XX:XX)\n" | 752 | "<dest MAC>\tdestination MAC address (XX:XX:XX:XX:XX:XX)\n" |
701 | "<channel-width>\tchannel width (0 = 20 MHz, 1 = 40 MHz)"); | 753 | "<channel-width>\tchannel width (0 = 20 MHz, 1 = 40 MHz)"); |
diff --git a/wl18xx_plt.h b/wl18xx_plt.h index 342b5a3..48108cd 100644 --- a/wl18xx_plt.h +++ b/wl18xx_plt.h | |||
@@ -76,6 +76,10 @@ enum wl18xx_test_cmds { | |||
76 | /* 0x33 */ WL18XX_TEST_CMD_PHY_ADDR_WRITE, | 76 | /* 0x33 */ WL18XX_TEST_CMD_PHY_ADDR_WRITE, |
77 | /* 0x34 */ WL18XX_TEST_CMD_START_TX_TONE, | 77 | /* 0x34 */ WL18XX_TEST_CMD_START_TX_TONE, |
78 | /* 0x35 */ WL18XX_TEST_CMD_STOP_TX_TONE, | 78 | /* 0x35 */ WL18XX_TEST_CMD_STOP_TX_TONE, |
79 | /* 0x36 */ WL18XX_TEST_CMD_START_RF_PARAMS_SET, | ||
80 | /* 0x37 */ WL18XX_TEST_CMD_STOP_RF_PARAMS_SET, | ||
81 | /* 0x38 */ WL18XX_TEST_CMD_REG_DOMAIN_UPDATE, | ||
82 | /* 0x39 */ WL18XX_TEST_CMD_5GHZ_ANTENNA_DIVERSITY, | ||
79 | }; | 83 | }; |
80 | 84 | ||
81 | struct wl18xx_cmd_channel_tune { | 85 | struct wl18xx_cmd_channel_tune { |
@@ -116,7 +120,8 @@ struct wl18xx_cmd_rx_stats { | |||
116 | __le32 errors; | 120 | __le32 errors; |
117 | __le32 addr_mm; | 121 | __le32 addr_mm; |
118 | __le32 good; | 122 | __le32 good; |
119 | __le32 rssi; | 123 | __le32 rssi_soc; |
124 | __le32 rssi_ant; | ||
120 | } __attribute__((packed)); | 125 | } __attribute__((packed)); |
121 | 126 | ||
122 | struct wl18xx_cmd_start_tx { | 127 | struct wl18xx_cmd_start_tx { |
@@ -150,11 +155,11 @@ struct wl18xx_cmd_set_tx_power { | |||
150 | 155 | ||
151 | __le32 radio_status; | 156 | __le32 radio_status; |
152 | 157 | ||
153 | __le32 mac_des_pwr; | 158 | __s32 mac_des_pwr; |
154 | __le32 mac_lvl_idx; | 159 | __le32 mac_lvl_idx; |
155 | __le32 freq_band; | 160 | __le32 freq_band; |
156 | __le32 freq_prim_chan_num; | 161 | __le32 freq_prim_chan_num; |
157 | __le32 freq_2nd_chan_idx; | 162 | __le32 freq_prim_chan_loc; |
158 | __le32 mac_ant_select; | 163 | __le32 mac_ant_select; |
159 | __le32 mac_non_srv; | 164 | __le32 mac_non_srv; |
160 | __le32 mac_chan_lim_dis; | 165 | __le32 mac_chan_lim_dis; |
@@ -213,24 +218,35 @@ struct wl18xx_cmd_phy_reg_write { /* TEST_CMD_PHY_REG_WRITE */ | |||
213 | } __attribute__((packed)); | 218 | } __attribute__((packed)); |
214 | 219 | ||
215 | struct wl18xx_cmd_phy_tx_tone_start { /* TEST_CMD_START_TX_TONE */ | 220 | struct wl18xx_cmd_phy_tx_tone_start { /* TEST_CMD_START_TX_TONE */ |
216 | struct wl1271_cmd_header header; | 221 | struct wl1271_cmd_header header; |
217 | struct wl1271_cmd_test_header test; | 222 | struct wl1271_cmd_test_header test; |
218 | 223 | ||
219 | __le32 radio_status; | 224 | __le32 radio_status; |
220 | 225 | ||
221 | __u8 mode; | 226 | __u8 mode; |
222 | __s8 bin_index; | 227 | __s8 bin_index; |
223 | __u8 trigger_iqram_recording; | 228 | __u8 trigger_iqram_recording; |
224 | __u8 sig_gen_cw_en; | 229 | __u8 sig_gen_cw_en; |
225 | __u8 sig_gen_mod_en; | 230 | __u8 sig_gen_mod_en; |
226 | __u8 ant_mode; | 231 | __u8 ant_mode; |
227 | __u8 set_rx_aux_on; | 232 | __u8 set_rx_aux_on; |
228 | __u8 gain_index; | 233 | __u8 gain_index; |
229 | } __attribute__((packed)); | 234 | } __attribute__((packed)); |
230 | 235 | ||
231 | struct wl18xx_cmd_phy_tx_tone_stop { /* TEST_CMD_STOP_TX_TONE */ | 236 | struct wl18xx_cmd_phy_tx_tone_stop { /* TEST_CMD_STOP_TX_TONE */ |
232 | struct wl1271_cmd_header header; | 237 | struct wl1271_cmd_header header; |
233 | struct wl1271_cmd_test_header test; | 238 | struct wl1271_cmd_test_header test; |
239 | } __attribute__((packed)); | ||
240 | |||
241 | struct wl18xx_cmd_set_antenna_diversity_5G { /* WL18XX_TEST_CMD_5GHZ_ANTENNA_DIVERSITY */ | ||
242 | struct wl1271_cmd_header header; | ||
243 | struct wl1271_cmd_test_header test; | ||
244 | |||
245 | __le32 radio_status; | ||
246 | |||
247 | __u8 mode; | ||
248 | __u8 padding[3]; | ||
249 | |||
234 | } __attribute__((packed)); | 250 | } __attribute__((packed)); |
235 | 251 | ||
236 | #endif /* __WL18XX_PLT_H__ */ | 252 | #endif /* __WL18XX_PLT_H__ */ |