| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
#include "command.h" |
| 44 |
#include "console.h" |
| 45 |
#include "../ad9361_api.h" |
| 46 |
#include "dac_core.h" |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
command cmd_list[] = { |
| 52 |
{"help?", "Displays all available commands.", "", get_help}, |
| 53 |
{"register?", "Gets the specified register value.", "", get_register}, |
| 54 |
{"tx_lo_freq?", "Gets current TX LO frequency [MHz].", "", get_tx_lo_freq}, |
| 55 |
{"tx_lo_freq=", "Sets the TX LO frequency [MHz].", "", set_tx_lo_freq}, |
| 56 |
{"tx_samp_freq?", "Gets current TX sampling frequency [Hz].", "", get_tx_samp_freq}, |
| 57 |
{"tx_samp_freq=", "Sets the TX sampling frequency [Hz].", "", set_tx_samp_freq}, |
| 58 |
{"tx_rf_bandwidth?", "Gets current TX RF bandwidth [Hz].", "", get_tx_rf_bandwidth}, |
| 59 |
{"tx_rf_bandwidth=", "Sets the TX RF bandwidth [Hz].", "", set_tx_rf_bandwidth}, |
| 60 |
{"tx1_attenuation?", "Gets current TX1 attenuation [mdB].", "", get_tx1_attenuation}, |
| 61 |
{"tx1_attenuation=", "Sets the TX1 attenuation [mdB].", "", set_tx1_attenuation}, |
| 62 |
{"tx2_attenuation?", "Gets current TX2 attenuation [mdB].", "", get_tx2_attenuation}, |
| 63 |
{"tx2_attenuation=", "Sets the TX2 attenuation [mdB].", "", set_tx2_attenuation}, |
| 64 |
{"tx_fir_en?", "Gets current TX FIR state.", "", get_tx_fir_en}, |
| 65 |
{"tx_fir_en=", "Sets the TX FIR state.", "", set_tx_fir_en}, |
| 66 |
{"rx_lo_freq?", "Gets current RX LO frequency [MHz].", "", get_rx_lo_freq}, |
| 67 |
{"rx_lo_freq=", "Sets the RX LO frequency [MHz].", "", set_rx_lo_freq}, |
| 68 |
{"rx_samp_freq?", "Gets current RX sampling frequency [Hz].", "", get_rx_samp_freq}, |
| 69 |
{"rx_samp_freq=", "Sets the RX sampling frequency [Hz].", "", set_rx_samp_freq}, |
| 70 |
{"rx_rf_bandwidth?", "Gets current RX RF bandwidth [Hz].", "", get_rx_rf_bandwidth}, |
| 71 |
{"rx_rf_bandwidth=", "Sets the RX RF bandwidth [Hz].", "", set_rx_rf_bandwidth}, |
| 72 |
{"rx1_gc_mode?", "Gets current RX1 GC mode.", "", get_rx1_gc_mode}, |
| 73 |
{"rx1_gc_mode=", "Sets the RX1 GC mode.", "", set_rx1_gc_mode}, |
| 74 |
{"rx2_gc_mode?", "Gets current RX2 GC mode.", "", get_rx2_gc_mode}, |
| 75 |
{"rx2_gc_mode=", "Sets the RX2 GC mode.", "", set_rx2_gc_mode}, |
| 76 |
{"rx1_rf_gain?", "Gets current RX1 RF gain.", "", get_rx1_rf_gain}, |
| 77 |
{"rx1_rf_gain=", "Sets the RX1 RF gain.", "", set_rx1_rf_gain}, |
| 78 |
{"rx2_rf_gain?", "Gets current RX2 RF gain.", "", get_rx2_rf_gain}, |
| 79 |
{"rx2_rf_gain=", "Sets the RX2 RF gain.", "", set_rx2_rf_gain}, |
| 80 |
{"rx_fir_en?", "Gets current RX FIR state.", "", get_rx_fir_en}, |
| 81 |
{"rx_fir_en=", "Sets the RX FIR state.", "", set_rx_fir_en}, |
| 82 |
{"dds_tx1_tone1_freq?", "Gets current DDS TX1 Tone 1 frequency [Hz].", "", get_dds_tx1_tone1_freq}, |
| 83 |
{"dds_tx1_tone1_freq=", "Sets the DDS TX1 Tone 1 frequency [Hz].", "", set_dds_tx1_tone1_freq}, |
| 84 |
{"dds_tx1_tone2_freq?", "Gets current DDS TX1 Tone 2 frequency [Hz].", "", get_dds_tx1_tone2_freq}, |
| 85 |
{"dds_tx1_tone2_freq=", "Sets the DDS TX1 Tone 2 frequency [Hz].", "", set_dds_tx1_tone2_freq}, |
| 86 |
{"dds_tx1_tone1_phase?", "Gets current DDS TX1 Tone 1 phase [degrees].", "", get_dds_tx1_tone1_phase}, |
| 87 |
{"dds_tx1_tone1_phase=", "Sets the DDS TX1 Tone 1 phase [degrees].", "", set_dds_tx1_tone1_phase}, |
| 88 |
{"dds_tx1_tone2_phase?", "Gets current DDS TX1 Tone 2 phase [degrees].", "", get_dds_tx1_tone2_phase}, |
| 89 |
{"dds_tx1_tone2_phase=", "Sets the DDS TX1 Tone 2 phase [degrees].", "", set_dds_tx1_tone2_phase}, |
| 90 |
{"dds_tx1_tone1_scale?", "Gets current DDS TX1 Tone 1 scale.", "", get_dds_tx1_tone1_scale}, |
| 91 |
{"dds_tx1_tone1_scale=", "Sets the DDS TX1 Tone 1 scale.", "", set_dds_tx1_tone1_scale}, |
| 92 |
{"dds_tx1_tone2_scale?", "Gets current DDS TX1 Tone 2 scale.", "", get_dds_tx1_tone2_scale}, |
| 93 |
{"dds_tx1_tone2_scale=", "Sets the DDS TX1 Tone 2 scale.", "", set_dds_tx1_tone2_scale}, |
| 94 |
{"dds_tx2_tone1_freq?", "Gets current DDS TX2 Tone 1 frequency [Hz].", "", get_dds_tx2_tone1_freq}, |
| 95 |
{"dds_tx2_tone1_freq=", "Sets the DDS TX2 Tone 1 frequency [Hz].", "", set_dds_tx2_tone1_freq}, |
| 96 |
{"dds_tx2_tone2_freq?", "Gets current DDS TX2 Tone 2 frequency [Hz].", "", get_dds_tx2_tone2_freq}, |
| 97 |
{"dds_tx2_tone2_freq=", "Sets the DDS TX2 Tone 2 frequency [Hz].", "", set_dds_tx2_tone2_freq}, |
| 98 |
{"dds_tx2_tone1_phase?", "Gets current DDS TX2 Tone 1 phase [degrees].", "", get_dds_tx2_tone1_phase}, |
| 99 |
{"dds_tx2_tone1_phase=", "Sets the DDS TX2 Tone 1 phase [degrees].", "", set_dds_tx2_tone1_phase}, |
| 100 |
{"dds_tx2_tone2_phase?", "Gets current DDS TX2 Tone 2 phase [degrees].", "", get_dds_tx2_tone2_phase}, |
| 101 |
{"dds_tx2_tone2_phase=", "Sets the DDS TX2 Tone 2 phase [degrees].", "", set_dds_tx2_tone2_phase}, |
| 102 |
{"dds_tx2_tone1_scale?", "Gets current DDS TX2 Tone 1 scale.", "", get_dds_tx2_tone1_scale}, |
| 103 |
{"dds_tx2_tone1_scale=", "Sets the DDS TX2 Tone 1 scale.", "", set_dds_tx2_tone1_scale}, |
| 104 |
{"dds_tx2_tone2_scale?", "Gets current DDS TX2 Tone 2 scale.", "", dds_tx2_tone2_scale}, |
| 105 |
{"dds_tx2_tone2_scale=", "Sets the DDS TX2 Tone 2 scale.", "", set_dds_tx2_tone2_scale}, |
| 106 |
}; |
| 107 |
const char cmd_no = (sizeof(cmd_list) / sizeof(command)); |
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
extern struct dds_state dds_st; |
| 113 |
extern struct ad9361_rf_phy *ad9361_phy; |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
void show_invalid_param_message(unsigned char cmd_no) |
| 121 |
{ |
| 122 |
console_print("Invalid parameter!\n"); |
| 123 |
console_print("%s - %s\n", (char*)cmd_list[cmd_no].name, (char*)cmd_list[cmd_no].description); |
| 124 |
console_print("Example: %s\n", (char*)cmd_list[cmd_no].example); |
| 125 |
} |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
void get_help(double* param, char param_no) |
| 133 |
{ |
| 134 |
unsigned char display_cmd; |
| 135 |
|
| 136 |
console_print("Available commands:\n"); |
| 137 |
for(display_cmd = 0; display_cmd < cmd_no; display_cmd++) |
| 138 |
{ |
| 139 |
console_print("%s - %s\n", (char*)cmd_list[display_cmd].name, |
| 140 |
(char*)cmd_list[display_cmd].description); |
| 141 |
} |
| 142 |
} |
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
void get_register(double* param, char param_no) |
| 150 |
{ |
| 151 |
uint16_t reg_addr; |
| 152 |
uint8_t reg_val; |
| 153 |
struct spi_device spi; |
| 154 |
|
| 155 |
if(param_no >= 1) |
| 156 |
{ |
| 157 |
spi.id_no = 0; |
| 158 |
reg_addr = param[0]; |
| 159 |
reg_val = ad9361_spi_read(&spi, reg_addr); |
| 160 |
console_print("register[0x%x]=0x%x\n", reg_addr, reg_val); |
| 161 |
} |
| 162 |
else |
| 163 |
show_invalid_param_message(1); |
| 164 |
} |
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
void get_tx_lo_freq(double* param, char param_no) |
| 172 |
{ |
| 173 |
uint64_t lo_freq_hz; |
| 174 |
|
| 175 |
ad9361_get_tx_lo_freq(ad9361_phy, &lo_freq_hz); |
| 176 |
lo_freq_hz /= 1000000; |
| 177 |
console_print("tx_lo_freq=%d\n", (uint32_t)lo_freq_hz); |
| 178 |
} |
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
void set_tx_lo_freq(double* param, char param_no) |
| 186 |
{ |
| 187 |
uint64_t lo_freq_hz; |
| 188 |
|
| 189 |
if(param_no >= 1) |
| 190 |
{ |
| 191 |
lo_freq_hz = param[0]; |
| 192 |
lo_freq_hz *= 1000000; |
| 193 |
ad9361_set_tx_lo_freq(ad9361_phy, lo_freq_hz); |
| 194 |
lo_freq_hz /= 1000000; |
| 195 |
console_print("tx_lo_freq=%d\n", (uint32_t)lo_freq_hz); |
| 196 |
} |
| 197 |
} |
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
void get_tx_samp_freq(double* param, char param_no) |
| 205 |
{ |
| 206 |
uint32_t sampling_freq_hz; |
| 207 |
|
| 208 |
ad9361_get_tx_sampling_freq(ad9361_phy, &sampling_freq_hz); |
| 209 |
console_print("tx_samp_freq=%d\n", sampling_freq_hz); |
| 210 |
} |
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
void set_tx_samp_freq(double* param, char param_no) |
| 218 |
{ |
| 219 |
uint32_t sampling_freq_hz; |
| 220 |
|
| 221 |
if(param_no >= 1) |
| 222 |
{ |
| 223 |
sampling_freq_hz = (uint32_t)param[0]; |
| 224 |
ad9361_set_tx_sampling_freq(ad9361_phy, sampling_freq_hz); |
| 225 |
ad9361_get_tx_sampling_freq(ad9361_phy, &sampling_freq_hz); |
| 226 |
dds_update(ad9361_phy); |
| 227 |
console_print("tx_samp_freq=%d\n", sampling_freq_hz); |
| 228 |
} |
| 229 |
else |
| 230 |
show_invalid_param_message(1); |
| 231 |
} |
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
void get_tx_rf_bandwidth(double* param, char param_no) |
| 239 |
{ |
| 240 |
uint32_t bandwidth_hz; |
| 241 |
|
| 242 |
ad9361_get_tx_rf_bandwidth(ad9361_phy, &bandwidth_hz); |
| 243 |
console_print("tx_rf_bandwidth=%d\n", bandwidth_hz); |
| 244 |
} |
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
void set_tx_rf_bandwidth(double* param, char param_no) |
| 252 |
{ |
| 253 |
uint32_t bandwidth_hz; |
| 254 |
|
| 255 |
if(param_no >= 1) |
| 256 |
{ |
| 257 |
bandwidth_hz = param[0]; |
| 258 |
ad9361_set_tx_rf_bandwidth(ad9361_phy, bandwidth_hz); |
| 259 |
} |
| 260 |
else |
| 261 |
show_invalid_param_message(1); |
| 262 |
} |
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
void get_tx1_attenuation(double* param, char param_no) |
| 270 |
{ |
| 271 |
uint32_t attenuation_mdb; |
| 272 |
|
| 273 |
ad9361_get_tx_attenuation(ad9361_phy, 0, &attenuation_mdb); |
| 274 |
console_print("tx1_attenuation=%d\n", attenuation_mdb); |
| 275 |
} |
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
void set_tx1_attenuation(double* param, char param_no) |
| 283 |
{ |
| 284 |
uint32_t attenuation_mdb; |
| 285 |
|
| 286 |
if(param_no >= 1) |
| 287 |
{ |
| 288 |
attenuation_mdb = param[0]; |
| 289 |
ad9361_set_tx_attenuation(ad9361_phy, 0, attenuation_mdb); |
| 290 |
console_print("tx1_attenuation=%d\n", attenuation_mdb); |
| 291 |
} |
| 292 |
else |
| 293 |
show_invalid_param_message(1); |
| 294 |
} |
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
void get_tx2_attenuation(double* param, char param_no) |
| 302 |
{ |
| 303 |
uint32_t attenuation_mdb; |
| 304 |
|
| 305 |
ad9361_get_tx_attenuation(ad9361_phy, 1, &attenuation_mdb); |
| 306 |
console_print("tx2_attenuation=%d\n", attenuation_mdb); |
| 307 |
} |
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
void set_tx2_attenuation(double* param, char param_no) |
| 315 |
{ |
| 316 |
uint32_t attenuation_mdb; |
| 317 |
|
| 318 |
if(param_no >= 1) |
| 319 |
{ |
| 320 |
attenuation_mdb = param[0]; |
| 321 |
ad9361_set_tx_attenuation(ad9361_phy, 1, attenuation_mdb); |
| 322 |
console_print("tx2_attenuation=%d\n", attenuation_mdb); |
| 323 |
} |
| 324 |
else |
| 325 |
show_invalid_param_message(1); |
| 326 |
} |
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
void get_tx_fir_en(double* param, char param_no) |
| 334 |
{ |
| 335 |
uint8_t en_dis; |
| 336 |
|
| 337 |
ad9361_get_tx_fir_en_dis(ad9361_phy, &en_dis); |
| 338 |
console_print("tx_fir_en=%d\n", en_dis); |
| 339 |
} |
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
void set_tx_fir_en(double* param, char param_no) |
| 347 |
{ |
| 348 |
uint8_t en_dis; |
| 349 |
|
| 350 |
if(param_no >= 1) |
| 351 |
{ |
| 352 |
en_dis = param[0]; |
| 353 |
ad9361_set_tx_fir_en_dis(ad9361_phy, en_dis); |
| 354 |
console_print("tx_fir_en=%d\n", en_dis); |
| 355 |
} |
| 356 |
else |
| 357 |
show_invalid_param_message(1); |
| 358 |
} |
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
void get_rx_lo_freq(double* param, char param_no) |
| 366 |
{ |
| 367 |
uint64_t lo_freq_hz; |
| 368 |
|
| 369 |
ad9361_get_rx_lo_freq(ad9361_phy, &lo_freq_hz); |
| 370 |
lo_freq_hz /= 1000000; |
| 371 |
console_print("rx_lo_freq=%d\n", (uint32_t)lo_freq_hz); |
| 372 |
} |
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
void set_rx_lo_freq(double* param, char param_no) |
| 380 |
{ |
| 381 |
uint64_t lo_freq_hz; |
| 382 |
|
| 383 |
if(param_no >= 1) |
| 384 |
{ |
| 385 |
lo_freq_hz = param[0]; |
| 386 |
lo_freq_hz *= 1000000; |
| 387 |
ad9361_set_rx_lo_freq(ad9361_phy, lo_freq_hz); |
| 388 |
lo_freq_hz /= 1000000; |
| 389 |
console_print("rx_lo_freq=%d\n", (uint32_t)lo_freq_hz); |
| 390 |
} |
| 391 |
} |
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
void get_rx_samp_freq(double* param, char param_no) |
| 399 |
{ |
| 400 |
uint32_t sampling_freq_hz; |
| 401 |
|
| 402 |
ad9361_get_rx_sampling_freq(ad9361_phy, &sampling_freq_hz); |
| 403 |
console_print("rx_samp_freq=%d\n", sampling_freq_hz); |
| 404 |
} |
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
void set_rx_samp_freq(double* param, char param_no) |
| 412 |
{ |
| 413 |
uint32_t sampling_freq_hz; |
| 414 |
|
| 415 |
if(param_no >= 1) |
| 416 |
{ |
| 417 |
sampling_freq_hz = (uint32_t)param[0]; |
| 418 |
ad9361_set_rx_sampling_freq(ad9361_phy, sampling_freq_hz); |
| 419 |
ad9361_get_rx_sampling_freq(ad9361_phy, &sampling_freq_hz); |
| 420 |
dds_update(ad9361_phy); |
| 421 |
console_print("rx_samp_freq=%d\n", sampling_freq_hz); |
| 422 |
} |
| 423 |
else |
| 424 |
show_invalid_param_message(1); |
| 425 |
} |
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
|
| 430 |
|
| 431 |
|
| 432 |
void get_rx_rf_bandwidth(double* param, char param_no) |
| 433 |
{ |
| 434 |
uint32_t bandwidth_hz; |
| 435 |
|
| 436 |
ad9361_get_rx_rf_bandwidth(ad9361_phy, &bandwidth_hz); |
| 437 |
console_print("rx_rf_bandwidth=%d\n", bandwidth_hz); |
| 438 |
} |
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
void set_rx_rf_bandwidth(double* param, char param_no) |
| 446 |
{ |
| 447 |
uint32_t bandwidth_hz; |
| 448 |
|
| 449 |
if(param_no >= 1) |
| 450 |
{ |
| 451 |
bandwidth_hz = param[0]; |
| 452 |
ad9361_set_rx_rf_bandwidth(ad9361_phy, bandwidth_hz); |
| 453 |
console_print("rx_rf_bandwidth=%d\n", bandwidth_hz); |
| 454 |
} |
| 455 |
else |
| 456 |
show_invalid_param_message(1); |
| 457 |
} |
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
void get_rx1_gc_mode(double* param, char param_no) |
| 465 |
{ |
| 466 |
uint8_t gc_mode; |
| 467 |
|
| 468 |
ad9361_get_rx_gain_control_mode(ad9361_phy, 0, &gc_mode); |
| 469 |
console_print("rx1_gc_mode=%d\n", gc_mode); |
| 470 |
} |
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
void set_rx1_gc_mode(double* param, char param_no) |
| 478 |
{ |
| 479 |
uint8_t gc_mode; |
| 480 |
|
| 481 |
if(param_no >= 1) |
| 482 |
{ |
| 483 |
gc_mode = param[0]; |
| 484 |
ad9361_set_rx_gain_control_mode(ad9361_phy, 0, gc_mode); |
| 485 |
console_print("rx1_gc_mode=%d\n", gc_mode); |
| 486 |
} |
| 487 |
else |
| 488 |
show_invalid_param_message(1); |
| 489 |
} |
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
void get_rx2_gc_mode(double* param, char param_no) |
| 497 |
{ |
| 498 |
uint8_t gc_mode; |
| 499 |
|
| 500 |
ad9361_get_rx_gain_control_mode(ad9361_phy, 1, &gc_mode); |
| 501 |
console_print("rx2_gc_mode=%d\n", gc_mode); |
| 502 |
} |
| 503 |
|
| 504 |
|
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
void set_rx2_gc_mode(double* param, char param_no) |
| 510 |
{ |
| 511 |
uint8_t gc_mode; |
| 512 |
|
| 513 |
if(param_no >= 1) |
| 514 |
{ |
| 515 |
gc_mode = param[0]; |
| 516 |
ad9361_set_rx_gain_control_mode(ad9361_phy, 1, gc_mode); |
| 517 |
console_print("rx2_gc_mode=%d\n", gc_mode); |
| 518 |
} |
| 519 |
else |
| 520 |
show_invalid_param_message(1); |
| 521 |
} |
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
void get_rx1_rf_gain(double* param, char param_no) |
| 529 |
{ |
| 530 |
int32_t gain_db; |
| 531 |
|
| 532 |
ad9361_get_rx_rf_gain (ad9361_phy, 0, &gain_db); |
| 533 |
console_print("rx1_rf_gain=%d\n", gain_db); |
| 534 |
} |
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
void set_rx1_rf_gain(double* param, char param_no) |
| 542 |
{ |
| 543 |
int32_t gain_db; |
| 544 |
|
| 545 |
if(param_no >= 1) |
| 546 |
{ |
| 547 |
gain_db = param[0]; |
| 548 |
ad9361_set_rx_rf_gain (ad9361_phy, 0, gain_db); |
| 549 |
console_print("rx1_rf_gain=%d\n", gain_db); |
| 550 |
} |
| 551 |
else |
| 552 |
show_invalid_param_message(1); |
| 553 |
} |
| 554 |
|
| 555 |
|
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
void get_rx2_rf_gain(double* param, char param_no) |
| 561 |
{ |
| 562 |
int32_t gain_db; |
| 563 |
|
| 564 |
ad9361_get_rx_rf_gain (ad9361_phy, 1, &gain_db); |
| 565 |
console_print("rx2_rf_gain=%d\n", gain_db); |
| 566 |
} |
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
void set_rx2_rf_gain(double* param, char param_no) |
| 574 |
{ |
| 575 |
int32_t gain_db; |
| 576 |
|
| 577 |
if(param_no >= 1) |
| 578 |
{ |
| 579 |
gain_db = param[0]; |
| 580 |
ad9361_set_rx_rf_gain (ad9361_phy, 1, gain_db); |
| 581 |
console_print("rx2_rf_gain=%d\n", gain_db); |
| 582 |
} |
| 583 |
else |
| 584 |
show_invalid_param_message(1); |
| 585 |
} |
| 586 |
|
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
void get_rx_fir_en(double* param, char param_no) |
| 593 |
{ |
| 594 |
uint8_t en_dis; |
| 595 |
|
| 596 |
ad9361_get_rx_fir_en_dis(ad9361_phy, &en_dis); |
| 597 |
console_print("rx_fir_en=%d\n", en_dis); |
| 598 |
} |
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
|
| 605 |
void set_rx_fir_en(double* param, char param_no) |
| 606 |
{ |
| 607 |
uint8_t en_dis; |
| 608 |
|
| 609 |
if(param_no >= 1) |
| 610 |
{ |
| 611 |
en_dis = param[0]; |
| 612 |
ad9361_set_rx_fir_en_dis(ad9361_phy, en_dis); |
| 613 |
console_print("rx_fir_en=%d\n", en_dis); |
| 614 |
} |
| 615 |
else |
| 616 |
show_invalid_param_message(1); |
| 617 |
} |
| 618 |
|
| 619 |
|
| 620 |
|
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
void get_dds_tx1_tone1_freq(double* param, char param_no) |
| 625 |
{ |
| 626 |
uint32_t freq = dds_st.cached_freq[DDS_CHAN_TX1_I_F1]; |
| 627 |
|
| 628 |
console_print("dds_tx1_tone1_freq=%d\n", freq); |
| 629 |
} |
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
void set_dds_tx1_tone1_freq(double* param, char param_no) |
| 637 |
{ |
| 638 |
uint32_t freq = (uint32_t)param[0]; |
| 639 |
|
| 640 |
if(param_no >= 1) |
| 641 |
{ |
| 642 |
dds_set_frequency(ad9361_phy, DDS_CHAN_TX1_I_F1, freq); |
| 643 |
dds_set_frequency(ad9361_phy, DDS_CHAN_TX1_Q_F1, freq); |
| 644 |
console_print("dds_tx1_tone1_freq=%d\n", freq); |
| 645 |
} |
| 646 |
else |
| 647 |
show_invalid_param_message(1); |
| 648 |
} |
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
|
| 653 |
|
| 654 |
|
| 655 |
void get_dds_tx1_tone2_freq(double* param, char param_no) |
| 656 |
{ |
| 657 |
uint32_t freq = dds_st.cached_freq[DDS_CHAN_TX1_I_F2]; |
| 658 |
|
| 659 |
console_print("dds_tx1_tone2_freq=%d\n", freq); |
| 660 |
} |
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
void set_dds_tx1_tone2_freq(double* param, char param_no) |
| 668 |
{ |
| 669 |
uint32_t freq = (uint32_t)param[0]; |
| 670 |
|
| 671 |
if(param_no >= 1) |
| 672 |
{ |
| 673 |
dds_set_frequency(ad9361_phy, DDS_CHAN_TX1_I_F2, freq); |
| 674 |
dds_set_frequency(ad9361_phy, DDS_CHAN_TX1_Q_F2, freq); |
| 675 |
console_print("dds_tx1_tone2_freq=%d\n", freq); |
| 676 |
} |
| 677 |
else |
| 678 |
show_invalid_param_message(1); |
| 679 |
} |
| 680 |
|
| 681 |
|
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
|
| 686 |
void get_dds_tx1_tone1_phase(double* param, char param_no) |
| 687 |
{ |
| 688 |
uint32_t phase = dds_st.cached_phase[DDS_CHAN_TX1_I_F1]; |
| 689 |
|
| 690 |
phase /= 1000; |
| 691 |
console_print("dds_tx1_tone1_phase=%d\n", phase); |
| 692 |
} |
| 693 |
|
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
|
| 698 |
|
| 699 |
void set_dds_tx1_tone1_phase(double* param, char param_no) |
| 700 |
{ |
| 701 |
int32_t phase = (uint32_t)param[0]; |
| 702 |
|
| 703 |
if(param_no >= 1) |
| 704 |
{ |
| 705 |
dds_set_phase(ad9361_phy, DDS_CHAN_TX1_I_F1, (uint32_t)(phase * 1000)); |
| 706 |
if ((phase - 90) < 0) |
| 707 |
phase += 360; |
| 708 |
dds_set_phase(ad9361_phy, DDS_CHAN_TX1_Q_F1, (uint32_t)((phase - 90) * 1000)); |
| 709 |
phase = dds_st.cached_phase[DDS_CHAN_TX1_I_F1] / 1000; |
| 710 |
console_print("dds_tx1_tone1_phase=%d\n", phase); |
| 711 |
} |
| 712 |
else |
| 713 |
show_invalid_param_message(1); |
| 714 |
} |
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
|
| 721 |
void get_dds_tx1_tone2_phase(double* param, char param_no) |
| 722 |
{ |
| 723 |
uint32_t phase = dds_st.cached_phase[DDS_CHAN_TX1_I_F2]; |
| 724 |
|
| 725 |
phase /= 1000; |
| 726 |
console_print("dds_tx1_tone2_phase=%d\n", phase); |
| 727 |
} |
| 728 |
|
| 729 |
|
| 730 |
|
| 731 |
|
| 732 |
|
| 733 |
|
| 734 |
void set_dds_tx1_tone2_phase(double* param, char param_no) |
| 735 |
{ |
| 736 |
int32_t phase = (uint32_t)param[0]; |
| 737 |
|
| 738 |
if(param_no >= 1) |
| 739 |
{ |
| 740 |
dds_set_phase(ad9361_phy, DDS_CHAN_TX1_I_F2, (uint32_t)(phase * 1000)); |
| 741 |
if ((phase - 90) < 0) |
| 742 |
phase += 360; |
| 743 |
dds_set_phase(ad9361_phy, DDS_CHAN_TX1_Q_F2, (uint32_t)((phase - 90) * 1000)); |
| 744 |
phase = dds_st.cached_phase[DDS_CHAN_TX1_I_F2] / 1000; |
| 745 |
console_print("dds_tx1_tone2_phase=%d\n", phase); |
| 746 |
} |
| 747 |
else |
| 748 |
show_invalid_param_message(1); |
| 749 |
} |
| 750 |
|
| 751 |
|
| 752 |
|
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
void get_dds_tx1_tone1_scale(double* param, char param_no) |
| 757 |
{ |
| 758 |
int32_t scale = dds_st.cached_scale[DDS_CHAN_TX1_I_F1]; |
| 759 |
|
| 760 |
console_print("dds_tx1_tone1_scale=%d\n", scale); |
| 761 |
} |
| 762 |
|
| 763 |
|
| 764 |
|
| 765 |
|
| 766 |
|
| 767 |
|
| 768 |
void set_dds_tx1_tone1_scale(double* param, char param_no) |
| 769 |
{ |
| 770 |
int32_t scale = (int32_t)param[0]; |
| 771 |
|
| 772 |
if(param_no >= 1) |
| 773 |
{ |
| 774 |
dds_set_scale(ad9361_phy, DDS_CHAN_TX1_I_F1, scale); |
| 775 |
dds_set_scale(ad9361_phy, DDS_CHAN_TX1_Q_F1, scale); |
| 776 |
scale = dds_st.cached_scale[DDS_CHAN_TX1_I_F1]; |
| 777 |
console_print("dds_tx1_tone1_scale=%d\n", scale); |
| 778 |
} |
| 779 |
else |
| 780 |
show_invalid_param_message(1); |
| 781 |
} |
| 782 |
|
| 783 |
|
| 784 |
|
| 785 |
|
| 786 |
|
| 787 |
|
| 788 |
void get_dds_tx1_tone2_scale(double* param, char param_no) |
| 789 |
{ |
| 790 |
int32_t scale = dds_st.cached_scale[DDS_CHAN_TX1_I_F2]; |
| 791 |
|
| 792 |
console_print("dds_tx1_tone2_scale=%d\n", scale); |
| 793 |
} |
| 794 |
|
| 795 |
|
| 796 |
|
| 797 |
|
| 798 |
|
| 799 |
|
| 800 |
void set_dds_tx1_tone2_scale(double* param, char param_no) |
| 801 |
{ |
| 802 |
int32_t scale = (int32_t)param[0]; |
| 803 |
|
| 804 |
if(param_no >= 1) |
| 805 |
{ |
| 806 |
dds_set_scale(ad9361_phy, DDS_CHAN_TX1_I_F2, scale); |
| 807 |
dds_set_scale(ad9361_phy, DDS_CHAN_TX1_Q_F2, scale); |
| 808 |
scale = dds_st.cached_scale[DDS_CHAN_TX1_I_F2]; |
| 809 |
console_print("dds_tx1_tone2_scale=%d\n", scale); |
| 810 |
} |
| 811 |
else |
| 812 |
show_invalid_param_message(1); |
| 813 |
} |
| 814 |
|
| 815 |
|
| 816 |
|
| 817 |
|
| 818 |
|
| 819 |
|
| 820 |
void get_dds_tx2_tone1_freq(double* param, char param_no) |
| 821 |
{ |
| 822 |
uint32_t freq = dds_st.cached_freq[DDS_CHAN_TX2_I_F1]; |
| 823 |
|
| 824 |
console_print("dds_tx2_tone1_freq=%d\n", freq); |
| 825 |
} |
| 826 |
|
| 827 |
|
| 828 |
|
| 829 |
|
| 830 |
|
| 831 |
|
| 832 |
void set_dds_tx2_tone1_freq(double* param, char param_no) |
| 833 |
{ |
| 834 |
uint32_t freq = (uint32_t)param[0]; |
| 835 |
|
| 836 |
if(param_no >= 1) |
| 837 |
{ |
| 838 |
dds_set_frequency(ad9361_phy, DDS_CHAN_TX2_I_F1, freq); |
| 839 |
dds_set_frequency(ad9361_phy, DDS_CHAN_TX2_Q_F1, freq); |
| 840 |
console_print("dds_tx2_tone1_freq=%d\n", freq); |
| 841 |
} |
| 842 |
else |
| 843 |
show_invalid_param_message(1); |
| 844 |
} |
| 845 |
|
| 846 |
|
| 847 |
|
| 848 |
|
| 849 |
|
| 850 |
|
| 851 |
void get_dds_tx2_tone2_freq(double* param, char param_no) |
| 852 |
{ |
| 853 |
uint32_t freq = dds_st.cached_freq[DDS_CHAN_TX2_I_F2]; |
| 854 |
|
| 855 |
console_print("dds_tx2_tone2_freq=%d\n", freq); |
| 856 |
} |
| 857 |
|
| 858 |
|
| 859 |
|
| 860 |
|
| 861 |
|
| 862 |
|
| 863 |
void set_dds_tx2_tone2_freq(double* param, char param_no) |
| 864 |
{ |
| 865 |
uint32_t freq = (uint32_t)param[0]; |
| 866 |
|
| 867 |
if(param_no >= 1) |
| 868 |
{ |
| 869 |
dds_set_frequency(ad9361_phy, DDS_CHAN_TX2_I_F2, freq); |
| 870 |
dds_set_frequency(ad9361_phy, DDS_CHAN_TX2_Q_F2, freq); |
| 871 |
console_print("dds_tx2_tone2_freq=%d\n", freq); |
| 872 |
} |
| 873 |
else |
| 874 |
show_invalid_param_message(1); |
| 875 |
} |
| 876 |
|
| 877 |
|
| 878 |
|
| 879 |
|
| 880 |
|
| 881 |
|
| 882 |
void get_dds_tx2_tone1_phase(double* param, char param_no) |
| 883 |
{ |
| 884 |
uint32_t phase = dds_st.cached_phase[DDS_CHAN_TX2_I_F1]; |
| 885 |
|
| 886 |
phase /= 1000; |
| 887 |
console_print("dds_tx2_tone1_phase=%d\n", phase); |
| 888 |
} |
| 889 |
|
| 890 |
|
| 891 |
|
| 892 |
|
| 893 |
|
| 894 |
|
| 895 |
void set_dds_tx2_tone1_phase(double* param, char param_no) |
| 896 |
{ |
| 897 |
int32_t phase = (uint32_t)param[0]; |
| 898 |
|
| 899 |
if(param_no >= 1) |
| 900 |
{ |
| 901 |
dds_set_phase(ad9361_phy, DDS_CHAN_TX2_I_F1, (uint32_t)(phase * 1000)); |
| 902 |
if ((phase - 90) < 0) |
| 903 |
phase += 360; |
| 904 |
dds_set_phase(ad9361_phy, DDS_CHAN_TX2_Q_F1, (uint32_t)((phase - 90) * 1000)); |
| 905 |
phase = dds_st.cached_phase[DDS_CHAN_TX2_I_F1] / 1000; |
| 906 |
console_print("dds_tx2_tone1_phase=%d\n", phase); |
| 907 |
} |
| 908 |
else |
| 909 |
show_invalid_param_message(1); |
| 910 |
} |
| 911 |
|
| 912 |
|
| 913 |
|
| 914 |
|
| 915 |
|
| 916 |
|
| 917 |
void get_dds_tx2_tone2_phase(double* param, char param_no) |
| 918 |
{ |
| 919 |
uint32_t phase = dds_st.cached_phase[DDS_CHAN_TX2_I_F2]; |
| 920 |
|
| 921 |
phase /= 1000; |
| 922 |
console_print("dds_tx2_f2_phase=%d\n", phase); |
| 923 |
} |
| 924 |
|
| 925 |
|
| 926 |
|
| 927 |
|
| 928 |
|
| 929 |
|
| 930 |
void set_dds_tx2_tone2_phase(double* param, char param_no) |
| 931 |
{ |
| 932 |
int32_t phase = (uint32_t)param[0]; |
| 933 |
|
| 934 |
if(param_no >= 1) |
| 935 |
{ |
| 936 |
dds_set_phase(ad9361_phy, DDS_CHAN_TX2_I_F2, (uint32_t)(phase * 1000)); |
| 937 |
if ((phase - 90) < 0) |
| 938 |
phase += 360; |
| 939 |
dds_set_phase(ad9361_phy, DDS_CHAN_TX2_Q_F2, (uint32_t)((phase - 90) * 1000)); |
| 940 |
phase = dds_st.cached_phase[DDS_CHAN_TX2_I_F2] / 1000; |
| 941 |
console_print("dds_tx2_tone2_phase=%d\n", phase); |
| 942 |
} |
| 943 |
else |
| 944 |
show_invalid_param_message(1); |
| 945 |
} |
| 946 |
|
| 947 |
|
| 948 |
|
| 949 |
|
| 950 |
|
| 951 |
|
| 952 |
void get_dds_tx2_tone1_scale(double* param, char param_no) |
| 953 |
{ |
| 954 |
int32_t scale = dds_st.cached_scale[DDS_CHAN_TX2_I_F1]; |
| 955 |
|
| 956 |
console_print("dds_tx2_tone1_scale=%d\n", scale); |
| 957 |
} |
| 958 |
|
| 959 |
|
| 960 |
|
| 961 |
|
| 962 |
|
| 963 |
|
| 964 |
void set_dds_tx2_tone1_scale(double* param, char param_no) |
| 965 |
{ |
| 966 |
int32_t scale = (int32_t)param[0]; |
| 967 |
|
| 968 |
if(param_no >= 1) |
| 969 |
{ |
| 970 |
dds_set_scale(ad9361_phy, DDS_CHAN_TX2_I_F1, scale); |
| 971 |
dds_set_scale(ad9361_phy, DDS_CHAN_TX2_Q_F1, scale); |
| 972 |
scale = dds_st.cached_scale[DDS_CHAN_TX2_I_F1]; |
| 973 |
console_print("dds_tx2_tone1_scale=%d\n", scale); |
| 974 |
} |
| 975 |
else |
| 976 |
show_invalid_param_message(1); |
| 977 |
} |
| 978 |
|
| 979 |
|
| 980 |
|
| 981 |
|
| 982 |
|
| 983 |
|
| 984 |
void dds_tx2_tone2_scale(double* param, char param_no) |
| 985 |
{ |
| 986 |
int32_t scale = dds_st.cached_scale[DDS_CHAN_TX2_I_F2]; |
| 987 |
|
| 988 |
console_print("dds_tx2_tone2_scale=%d\n", scale); |
| 989 |
} |
| 990 |
|
| 991 |
|
| 992 |
|
| 993 |
|
| 994 |
|
| 995 |
|
| 996 |
void set_dds_tx2_tone2_scale(double* param, char param_no) |
| 997 |
{ |
| 998 |
int32_t scale = (int32_t)param[0]; |
| 999 |
|
| 1000 |
if(param_no >= 1) |
| 1001 |
{ |
| 1002 |
dds_set_scale(ad9361_phy, DDS_CHAN_TX2_I_F2, scale); |
| 1003 |
dds_set_scale(ad9361_phy, DDS_CHAN_TX2_Q_F2, scale); |
| 1004 |
scale = dds_st.cached_scale[DDS_CHAN_TX2_I_F2]; |
| 1005 |
console_print("dds_tx2_tone2_scale=%d\n", scale); |
| 1006 |
} |
| 1007 |
else |
| 1008 |
show_invalid_param_message(1); |
| 1009 |
} |