1 2 3 // Always include stdio.h, math.h stdlib.h and errno.h 4 #include <stdio.h> 5 #include <math.h> 6 #include <stdlib.h> 7 #include <errno.h> 8 9 #define STDERR stderr 10 11 #ifndef MEMREF_T 12 #if IA64 == 0 13 #define MEMREF_T int 14 #else 15 #define MEMREF_T long int 16 #endif 17 #endif 18 19 #define INITIAL_SKIP_FLAG_MAX 25 20 21 #define CPU_INTEL 0 22 #define CPU_ARM 1 23 24 25 // Structure for soundcard info. Buffer pointers etc. 26 typedef struct { 27 int no_of_blocks; 28 int valid_frames; 29 int min_valid_frames; 30 int valid_bytes; 31 int empty_frames; 32 int empty_bytes; 33 int tot_frames; 34 int tot_bytes; 35 int framesize; 36 int block_bytes; 37 int block_frames; 38 float interrupt_rate; 39 int newbuf_ptr; 40 int open_flag; 41 }SOUNDCARD_PARM; 42 43 #define CONVERTER_USE 1 44 #define CONVERTER_UP 2 45 #define CONVERTER_LO_BELOW 4 46 47 48 #define RXAD 0 49 #define RXDA 1 50 #define TXDA 2 51 #define TXAD 3 52 #define MAX_IOTEST 3 53 54 55 #define SOUNDCARD_RADIO_UNDEFINED 0 56 #define SOUNDCARD_RADIO_UNDEFINED_REVERSED 1 57 #define SOUNDCARD_RADIO_WSE 2 58 #define SOUNDCARD_RADIO_SI570 3 59 #define SOUNDCARD_RADIO_SOFT66 4 60 #define SOUNDCARD_RADIO_ELEKTOR 5 61 #define SOUNDCARD_RADIO_FCDPROPLUS 6 62 #define SOUNDCARD_RADIO_AFEDRI_USB 7 63 #define MAX_SOUNDCARD_RADIO 8 64 65 #define TRUE 1 66 #define FALSE 0 67 #define YELLOW 14 68 #define LIGHT_GREEN 10 69 #define LIGHT_RED 12 70 71 #define MAX_FFT1_AVG1 9 72 73 #define NO_REDRAW_BLOCKS 16 74 // ******************************************* 75 // Global numerical values 76 #define PI_L 3.1415926535897932 77 #define BIG 300000000000000000000000000000000000000. 78 // Signal power to the power of four may become a very large number. 79 // Define something small to multiply by to prevent overflows. 80 #define P4SCALE 0.000000000000000000001 81 #define P2SCALE 0.00000000001 82 // values for lir_status 83 // Memory errors are larger than LIR_OK. 84 // Other abnormal conditions smaller than LIR_OK. 85 #define LIR_OK 0 86 #define LIR_TUNEERR 1 87 #define LIR_FFT1ERR 2 88 #define LIR_SAVE_UIPARM 4 89 #define LIR_NEW_SETTINGS -1 90 #define LIR_SPURERR -2 91 #define LIR_PARERR -3 92 #define LIR_NEW_POL -4 93 #define LIR_TUNEERR2 -5 94 #define LIR_POWTIM -6 95 #define LIR_PA_FLAG_ERROR -7 96 #define LIR_PA_FORMAT_NOT_SUPPORTED -8 97 #define LIR_PA_OPENSTREAM_FAILED -9 98 #define LIR_PA_START_STREAM_FAILED -10 99 #define LIR_DLL_FAILED -11 100 // ******************************************* 101 // Fixed array dimensions depend on these defines: 102 103 104 105 #define MODE_WCW 0 106 #define MODE_NCW 1 107 #define MODE_HSMS 2 108 #define MODE_SSB 3 109 #define MODE_FM 4 110 #define MODE_AM 5 111 #define MODE_QRSS 6 112 // Note that modes below MODE_TXTEST are allowed to call 113 // users tx routines, but that MODE_TXTEST and higher may 114 // call users_init_mode, but users_hwaredriver is responsible 115 // for checking rx_mode < MODE_TXTEST and not do any tx 116 // activities or screen writes. 117 #define MODE_TXTEST 7 118 #define MODE_RX_ADTEST 8 119 #define MODE_TUNE 9 120 #define MODE_RADAR 10 121 // Note that MAX_RX_MODES can be up to 12. 'L' is reserved 122 // for an new mode that might be desireable to add. 123 #define MAX_RX_MODE 11 124 125 //****************************************************************** 126 // Information about what device drivers to use for soundcards 127 // is stored in ui.use_alsa. The name has became misleading, 128 // but a change would make par_userint incompatible once again... 129 // Use the following masks for testing on ui.use_alsa 130 #define WAVE_FORMAT_EXTENSIBLE_USED 1 131 #define NATIVE_ALSA_USED 1 132 #define PORTAUDIO_RX_IN 2 133 #define PORTAUDIO_RX_OUT 4 134 #define PORTAUDIO_TX_IN 8 135 #define PORTAUDIO_TX_OUT 16 136 #define PORTAUDIO_DLL_VERSION (32+64+128) 137 138 #define TXMODE_OFF 0 139 #define TXMODE_CW 1 140 #define TXMODE_SSB 2 141 142 #define MAX_COLOR_SCALE 23 143 #define MAX_SCRO 50 144 #define LLSQ_MAXPAR 25 145 #define MAX_ADCHAN 4 146 #define MAX_MIX1 8 // No of different signals to process simultaneously 147 #define MAX_AD_CHANNELS 4 148 #define MAX_RX_CHANNELS 2 149 #define DAOUT_MAXTIME 1. 150 #define SPUR_N 3 151 #define SPUR_SIZE (1<<SPUR_N) 152 #define NO_OF_SPUR_SPECTRA 256 153 #define MAX_FFT1_ARRAYS 85 154 #define MAX_FFT3_ARRAYS 30 155 #define MAX_BASEB_ARRAYS 40 156 #define CG_MAXTRACE 24 157 #define MAX_HIRES_ARRAYS 8 158 #define MAX_AFC_ARRAYS 20 159 #define MAX_VOICELAB_ARRAYS 16 160 #define MAX_VOICELAB_ARRAYS 16 161 #define MAX_TXMEM_ARRAYS 30 162 #define MAX_BLANKER_ARRAYS 15 163 #define MAX_RADAR_ARRAYS 15 164 165 #define USR_NORMAL_RX 0 166 #define USR_TXTEST 1 167 #define USR_POWTIM 2 168 #define USR_ADTEST 3 169 #define USR_IQ_BALANCE 4 170 #define USR_CAL_INTERVAL 5 171 #define USR_CAL_FILTERCORR 6 172 #define USR_TUNE 7 173 174 #define UNDEFINED_DEVICE_CODE -1 175 #define DISABLED_DEVICE_CODE -2 176 #define NETWORK_DEVICE_CODE -3 177 #define EXTIO_DEVICE_CODE -4 178 #define SPECIFIC_DEVICE_CODES 9999 179 #define SDR14_DEVICE_CODE (SPECIFIC_DEVICE_CODES+1) 180 #define SDRIQ_DEVICE_CODE (SPECIFIC_DEVICE_CODES+2) 181 #define PERSEUS_DEVICE_CODE (SPECIFIC_DEVICE_CODES+3) 182 #define SDRIP_DEVICE_CODE (SPECIFIC_DEVICE_CODES+4) 183 #define EXCALIBUR_DEVICE_CODE (SPECIFIC_DEVICE_CODES+5) 184 #define RTL2832_DEVICE_CODE (SPECIFIC_DEVICE_CODES+6) 185 #define MIRISDR_DEVICE_CODE (SPECIFIC_DEVICE_CODES+7) 186 #define BLADERF_DEVICE_CODE (SPECIFIC_DEVICE_CODES+8) 187 #define PCIE9842_DEVICE_CODE (SPECIFIC_DEVICE_CODES+9) 188 #define OPENHPSDR_DEVICE_CODE (SPECIFIC_DEVICE_CODES+10) 189 #define NETAFEDRI_DEVICE_CODE (SPECIFIC_DEVICE_CODES+11) 190 191 192 // Positions for runtime error messages in the main spectrum. 193 #define WGERR_DASYNC 0 194 #define WGERR_ADSPEED 1 195 #define WGERR_HWARE 2 196 #define WGERR_MEMORY 2 197 #define WGERR_SCREEN 2 198 #define WGERR_RXIN 3 199 #define WGERR_TIMF1_OVERLOAD 3 200 #define WGERR_TIMF2_OVERLOAD 4 201 #define WGERR_FFT3_OVERLOAD 0 202 #define WGERR_BASEB_OVERLOAD 2 203 #define WGERR_RXOUT 4 204 #define WGERR_TXIN 5 205 #define WGERR_TXOUT 6 206 #define WGERR_NETWR 7 207 #define WGERR_SOUNDCARD 0 208 209 210 #define NET_RXOUT_RAW16 1 211 #define NET_RXOUT_RAW18 2 212 #define NET_RXOUT_RAW24 4 213 #define NET_RXOUT_FFT1 8 214 #define NET_RXOUT_TIMF2 16 215 #define NET_RXOUT_FFT2 32 216 #define NET_RXOUT_BASEB 64 217 #define NET_RXOUT_BASEBRAW 128 218 #define NET_RX_OUTPUT 0x0000ffff 219 #define NET_RX_INPUT 0xffff0000 220 #define NET_RXIN_RAW16 0x00010000 221 #define NET_RXIN_RAW18 0x00020000 222 #define NET_RXIN_RAW24 0x00040000 223 #define NET_RXIN_FFT1 0x00080000 224 #define NET_RXIN_BASEB 0x00100000 225 #define NET_RXIN_BASEBRAW 0x00200000 226 #define NET_RXIN_TIMF2 0x00400000 227 228 #define NETMSG_OWN_FREQ 41651 229 #define NETMSG_SUBSLAVE_FREQ 41652 230 #define NETMSG_CAL_REQUEST 41653 231 #define NETMSG_CALIQ_REQUEST 41654 232 #define NETMSG_FFT1INFO_REQUEST 41655 233 #define NETMSG_MODE_REQUEST 41656 234 #define NETMSG_REMOVE_SUBSLAVE 41567 235 #define NETMSG_BASEBMODE_REQUEST 41658 236 #define NETMSG_BASEBRAWMODE_REQUEST 41659 237 #define NETMSG_SET_MASTER_FREQUENCY 41660 238 #define NETMSG_TIMF2MODE_REQUEST 41661 239 240 #define EXTIO_INVERTED 1 241 #define EXTIO_NON_INVERTED 2 242 #define EXTIO_USE_SOUNDCARD 16 243 244 typedef void (*ROUTINE) (void); 245 #define PERMDEB fprintf(dmp, 246 #define DEB if(dmp != NULL)PERMDEB 247 #define XZ xz 248 // ******************************************* 249 // Audio board and disk file parameter definitions 250 #define DWORD_INPUT 1 251 #define TWO_CHANNELS 2 252 #define IQ_DATA 4 253 #define BYTE_INPUT 8 254 #define NO_DUPLEX 16 255 #define DIGITAL_IQ 32 256 #define FLOAT_INPUT 64 257 #define QWORD_INPUT 128 258 #define MODEPARM_MAX 256 259 // ******************************************* 260 // Processing parameter definitions 261 #define FIRST_FFT_BANDWIDTH 0 262 #define FIRST_FFT_SINPOW 1 263 #define FIRST_FFT_VERNR 2 264 #define FIRST_FFT_NO_OF_THREADS 3 265 #define FFT1_STORAGE_TIME 4 266 #define FIRST_FFT_GAIN 5 267 #define WG_WATERF_BLANKED_PERCENT 6 268 #define FFT1_CORRELATION_SPECTRUM 7 269 #define SECOND_FFT_ENABLE 8 270 271 #define FIRST_BCKFFT_VERNR 9 272 #define SELLIM_MAXLEVEL 10 273 #define FIRST_BCKFFT_ATT_N 11 274 #define SECOND_FFT_NINC 12 275 #define SECOND_FFT_SINPOW 13 276 #define SECOND_FFT_VERNR 14 277 #define SECOND_FFT_ATT_N 15 278 #define FFT2_STORAGE_TIME 16 279 280 #define AFC_ENABLE 17 281 #define AFC_LOCK_RANGE 18 282 #define AFC_MAX_DRIFT 19 283 #define CW_DECODE_ENABLE 20 284 #define MAX_NO_OF_SPURS 21 285 #define SPUR_TIMECONSTANT 22 286 287 #define MIX1_BANDWIDTH_REDUCTION_N 23 288 #define MIX1_NO_OF_CHANNELS 24 289 #define THIRD_FFT_SINPOW 25 290 #define BASEBAND_STORAGE_TIME 26 291 #define OUTPUT_DELAY_MARGIN 27 292 #define DA_OUTPUT_SPEED 28 293 294 #define OUTPUT_MODE 29 295 296 #define AMPLITUDE_EXPAND_EXPONENT 30 297 #define BG_WATERF_BLANKED_PERCENT 31 298 299 #define MAX_GENPARM 32 300 301 // ******************************************************* 302 // Defines for state machine in fft2.c 303 #define FFT2_NOT_ACTIVE 0 304 #define FFT2_B 10 305 #define FFT2_C 11 306 #define FFT2_MMXB 20 307 #define FFT2_MMXC 21 308 #define FFT2_ELIMINATE_SPURS 104 309 #define FFT2_WATERFALL_LINE 1001 310 #define FFT2_TEST_FINISH 9999 311 #define FFT2_COMPLETE -1 312 // ********************************************** 313 #define CALIQ 2 314 #define CALAMP 1 315 316 // ********************************************** 317 #define OS_FLAG_SVGALIB 1 318 #define OS_FLAG_WINDOWS 2 319 #define OS_FLAG_X 4 320 321 #define OSNUM_LINUX 1 322 #define OSNUM_WINDOWS 2 323 #define OSNUM_BSD 3 324 #define OSNUM_DARWIN 4 325 // ******************************************* 326 327 #if(OSNUM == OSNUM_WINDOWS) 328 #define FD unsigned int 329 #else 330 #define FD int 331 #endif 332 333 334 // Structure for transmitter parameters in ssb mode 335 typedef struct { 336 int minfreq; 337 int maxfreq; 338 int slope; 339 int bass; 340 int treble; 341 int mic_gain; 342 int mic_out_gain; 343 int mic_agc_time; 344 int mic_f_threshold; 345 int mic_t_threshold; 346 int rf1_gain; 347 int check; 348 }SSBPROC_PARM; 349 #define MAX_SSBPROC_PARM 12 350 extern char *ssbprocparm_text[MAX_SSBPROC_PARM]; 351 352 // Structure for transmitter parameters in CW modes 353 typedef struct { 354 int rise_time; 355 int enable_hand_key; 356 int enable_tone_key; 357 int enable_ascii; 358 int radar_interval; 359 int radar_pulse; 360 int check; 361 }CWPROC_PARM; 362 #define MAX_CWPROC_PARM 7 363 extern char *cwprocparm_text[MAX_CWPROC_PARM]; 364 365 // ******************************************* 366 // Structure for printing time stamps on waterfall graphs 367 typedef struct { 368 int line; 369 char text[10]; 370 }WATERF_TIMES; 371 372 // ******************************************* 373 // Structure for 5th order Butterworth low pass filter 374 typedef struct { 375 float gain; 376 float c0; 377 float c1; 378 float c2; 379 float c3; 380 float c4; 381 }IIR5_PARMS; 382 383 // ******************************************* 384 // Structure for user interface parameters selected by operator 385 typedef struct { 386 int vga_mode; 387 int shm_mode; 388 int screen_width_factor; 389 int screen_height_factor; 390 int font_scale; 391 int mouse_speed; 392 int max_dma_rate; 393 int process_priority; 394 int use_alsa; 395 int rx_input_mode; 396 int rx_rf_channels; 397 int rx_ad_channels; 398 int rx_ad_speed; 399 int rx_addev_no; 400 int rx_admode; 401 int rx_damode; 402 int rx_dadev_no; 403 int rx_min_da_speed; 404 int rx_max_da_speed; 405 int rx_max_da_channels; 406 int rx_max_da_bytes; 407 int rx_min_da_channels; 408 int rx_min_da_bytes; 409 int soundcard_radio; 410 unsigned int converter_hz; 411 unsigned int converter_mhz; 412 int converter_mode; 413 int network_flag; 414 int tx_ad_speed; 415 int tx_da_speed; 416 int tx_addev_no; 417 int tx_dadev_no; 418 int tx_da_channels; 419 int tx_ad_channels; 420 int tx_da_bytes; 421 int tx_ad_bytes; 422 int tx_enable; 423 int tx_pilot_tone_db; 424 int tx_pilot_tone_prestart; 425 int operator_skil; 426 int max_blocked_cpus; 427 unsigned int timer_resolution; 428 int autostart; 429 int rx_ad_latency; 430 int rx_da_latency; 431 int sample_shift; 432 int min_dma_rate; 433 int use_extio; 434 int extio_type; 435 int check; 436 }USERINT_PARM; 437 #define MAX_UIPARM 50 438 extern char *uiparm_text[MAX_UIPARM]; 439 440 #define DEFAULT_MIN_DMA_RATE 30 441 #define DEFAULT_MAX_DMA_RATE 300 442 #define MIN_DMA_RATE 10 443 #define MAX_DMA_RATE 5000 444 #define DMA_MIN_DIGITS 2 445 #define DMA_MAX_DIGITS 4 446 #define MIN_DMA_RATE_EXP 1 447 #define MAX_DMA_RATE_EXP 100000 448 #define DMA_MIN_DIGITS_EXP 1 449 #define DMA_MAX_DIGITS_EXP 6 450 451 452 #define OPERATOR_SKIL_NEWCOMER 1 453 #define OPERATOR_SKIL_NORMAL 2 454 #define OPERATOR_SKIL_EXPERT 3 455 456 457 // ******************************************* 458 // Screen object parameters for mouse and screen drawing. 459 // Each screen object is defined by it's number, scro[].no 460 // For each type scro[].type the number scro[].no is unique and 461 // defines what to do in the event of a mouse click. 462 463 // Definitions for type = GRAPH 464 #define WIDE_GRAPH 1 465 #define HIRES_GRAPH 2 466 #define TRANSMIT_GRAPH 3 467 #define FREQ_GRAPH 4 468 #define RADAR_GRAPH 5 469 #define MAX_WIDEBAND_GRAPHS 10 470 #define AFC_GRAPH 11 471 #define BASEBAND_GRAPH 12 472 #define POL_GRAPH 13 473 #define COH_GRAPH 14 474 #define EME_GRAPH 15 475 #define METER_GRAPH 16 476 #define ELEKTOR_GRAPH 17 477 #define FCDPROPLUS_GRAPH 18 478 #define GRAPH_RIGHTPRESSED 128 479 #define GRAPH_MASK 0x8000007f 480 481 // Definitions for parameter input routines under mouse control 482 #define FIXED_INT_PARM 3 483 #define TEXT_PARM 4 484 #define FIXED_FLOAT_PARM 5 485 #define FIXED_DOUBLE_PARM 6 486 #define DATA_READY_PARM 128 487 #define MAX_TEXTPAR_CHARS 32 488 #define EG_DX_CHARS 12 489 #define EG_LOC_CHARS 6 490 491 // Definitions for type WIDE_GRAPH 492 #define WG_TOP 0 493 #define WG_BOTTOM 1 494 #define WG_LEFT 2 495 #define WG_RIGHT 3 496 #define WG_BORDER 4 497 #define WG_YSCALE_EXPAND 5 498 #define WG_YSCALE_CONTRACT 6 499 #define WG_YZERO_DECREASE 7 500 #define WG_YZERO_INCREASE 8 501 #define WG_FQMIN_DECREASE 9 502 #define WG_FQMIN_INCREASE 10 503 #define WG_FQMAX_DECREASE 11 504 #define WG_FQMAX_INCREASE 12 505 #define WG_AVG1NUM 13 506 #define WG_FFT1_AVGNUM 14 507 #define WG_WATERF_AVGNUM 15 508 #define WG_WATERF_ZERO 16 509 #define WG_WATERF_GAIN 17 510 #define WG_SPUR_TOGGLE 18 511 #define WG_FREQ_ADJUSTMENT_MODE 19 512 #define WG_LOWEST_FREQ 20 513 #define WG_HIGHEST_FREQ 21 514 #define MAX_WGBUTT 22 515 516 // Definitions for type HIRES_GRAPH 517 #define HG_TOP 0 518 #define HG_BOTTOM 1 519 #define HG_LEFT 2 520 #define HG_RIGHT 3 521 #define HG_BLN_STUPID 4 522 #define HG_BLN_CLEVER 5 523 #define HG_TIMF2_STATUS 6 524 #define HG_TIMF2_WK_INC 7 525 #define HG_TIMF2_WK_DEC 8 526 #define HG_TIMF2_ST_INC 9 527 #define HG_TIMF2_ST_DEC 10 528 #define HG_TIMF2_LINES 11 529 #define HG_TIMF2_HOLD 12 530 #define HG_FFT2_AVGNUM 13 531 #define HG_SPECTRUM_ZERO 14 532 #define HG_SPECTRUM_GAIN 15 533 #define HG_MAP65_GAIN 16 534 #define HG_MAP65_STRONG 17 535 #define MAX_HGBUTT 18 536 537 // Definitions for type BASEBAND_GRAPH 538 #define BG_TOP 0 539 #define BG_BOTTOM 1 540 #define BG_LEFT 2 541 #define BG_RIGHT 3 542 #define BG_YSCALE_EXPAND 4 543 #define BG_YSCALE_CONTRACT 5 544 #define BG_YZERO_DECREASE 6 545 #define BG_YZERO_INCREASE 7 546 #define BG_RESOLUTION_DECREASE 8 547 #define BG_RESOLUTION_INCREASE 9 548 #define BG_OSCILLOSCOPE 10 549 #define BG_OSC_INCREASE 11 550 #define BG_OSC_DECREASE 12 551 #define BG_PIX_PER_PNT_INC 13 552 #define BG_PIX_PER_PNT_DEC 14 553 #define BG_TOGGLE_EXPANDER 15 554 #define BG_TOGGLE_COHERENT 16 555 #define BG_TOGGLE_PHASING 17 556 #define BG_TOGGLE_CHANNELS 18 557 #define BG_TOGGLE_BYTES 19 558 #define BG_TOGGLE_TWOPOL 20 559 #define BG_SEL_COHFAC 21 560 #define BG_SEL_DELPNTS 22 561 #define BG_SEL_FFT3AVGNUM 23 562 #define BG_TOGGLE_AGC 24 563 #define BG_SEL_AGC_ATTACK 25 564 #define BG_SEL_AGC_RELEASE 26 565 #define BG_SEL_AGC_HANG 27 566 #define BG_YBORDER 28 567 #define BG_WATERF_ZERO 29 568 #define BG_WATERF_GAIN 30 569 #define BG_WATERF_AVGNUM 31 570 #define BG_HORIZ_ARROW_MODE 32 571 #define BG_MIXER_MODE 33 572 #define BG_FILTER_SHIFT 34 573 #define BG_NOTCH_NO 35 574 #define BG_NOTCH_POS 36 575 #define BG_NOTCH_WIDTH 37 576 #define BG_TOGGLE_FM_MODE 38 577 #define BG_TOGGLE_FM_SUBTRACT 39 578 #define BG_SEL_FM_AUDIO_BW 40 579 #define BG_TOGGLE_CH2_PHASE 41 580 #define BG_SQUELCH_TIME 42 581 #define BG_SQUELCH_POINT 43 582 #define BG_SQUELCH_LEVEL 44 583 584 #define MAX_BGBUTT 45 585 586 #define MAX_BG_NOTCHES 9 587 588 // Definitions for type AFC_GRAPH 589 #define AG_TOP 0 590 #define AG_BOTTOM 1 591 #define AG_LEFT 2 592 #define AG_RIGHT 3 593 #define AG_FQSCALE_EXPAND 4 594 #define AG_FQSCALE_CONTRACT 5 595 #define AG_MANAUTO 6 596 #define AG_WINTOGGLE 7 597 #define AG_SEL_AVGNUM 8 598 #define AG_SEL_FIT 9 599 #define AG_SEL_DELAY 10 600 #define MAX_AGBUTT 11 601 602 // Definitions for type APOL_GRAPH 603 #define PG_TOP 0 604 #define PG_BOTTOM 1 605 #define PG_LEFT 2 606 #define PG_RIGHT 3 607 #define PG_ANGLE 4 608 #define PG_CIRC 5 609 #define PG_AUTO 6 610 #define PG_AVGNUM 7 611 #define MAX_PGBUTT 8 612 613 // Definitions for type ACOH_GRAPH 614 #define CG_TOP 0 615 #define CG_BOTTOM 1 616 #define CG_LEFT 2 617 #define CG_RIGHT 3 618 #define CG_OSCILLOSCOPE 4 619 #define CG_METER_GRAPH 5 620 #define MAX_CGBUTT 6 621 622 // Definitions for type AEME_GRAPH 623 #define EG_TOP 0 624 #define EG_BOTTOM 1 625 #define EG_LEFT 2 626 #define EG_RIGHT 3 627 #define EG_MINIMISE 4 628 #define EG_LOC 5 629 #define EG_DX 6 630 #define MAX_EGBUTT 7 631 632 // Definitions for type FREQ_GRAPH 633 #define FG_TOP 0 634 #define FG_BOTTOM 1 635 #define FG_LEFT 2 636 #define FG_RIGHT 3 637 #define FG_INCREASE_FQ 4 638 #define FG_DECREASE_FQ 5 639 #define FG_INCREASE_GAIN 6 640 #define FG_DECREASE_GAIN 7 641 #define MAX_FGBUTT 8 642 643 // Definitions for type (S)METER_GRAPH 644 #define MG_TOP 0 645 #define MG_BOTTOM 1 646 #define MG_LEFT 2 647 #define MG_RIGHT 3 648 #define MG_INCREASE_AVGN 4 649 #define MG_DECREASE_AVGN 5 650 #define MG_INCREASE_GAIN 6 651 #define MG_DECREASE_GAIN 7 652 #define MG_INCREASE_YREF 8 653 #define MG_DECREASE_YREF 9 654 #define MG_CHANGE_CAL 10 655 #define MG_CHANGE_TYPE 11 656 #define MG_CHANGE_TRACKS 12 657 #define MG_SCALE_STON_SIGSHIFT 13 658 #define MAX_MGBUTT 14 659 660 // Definitions for type TRANSMIT_GRAPH 661 662 #define TG_TOP 0 663 #define TG_BOTTOM 1 664 #define TG_LEFT 2 665 #define TG_RIGHT 3 666 #define TG_INCREASE_FQ 4 667 #define TG_DECREASE_FQ 5 668 #define TG_CHANGE_SSBPROC_NO 6 669 #define TG_NEW_TX_FREQUENCY 7 670 #define TG_SET_SIGNAL_LEVEL 8 671 #define TG_ONOFF 9 672 #define TG_RADAR_INTERVAL 10 673 #define MAX_TGBUTT 11 674 675 // Definitions for type RADAR_GRAPH 676 677 #define RG_TOP 0 678 #define RG_BOTTOM 1 679 #define RG_LEFT 2 680 #define RG_RIGHT 3 681 #define RG_TIME 4 682 #define RG_ZERO 5 683 #define RG_GAIN 6 684 #define MAX_RGBUTT 7 685 686 687 688 // Structure for the eme database. 689 #define CALLSIGN_CHARS 12 690 typedef struct{ 691 char call[CALLSIGN_CHARS]; 692 float lon; 693 float lat; 694 }DXDATA; 695 696 // Structure for mouse buttons 697 typedef struct { 698 int x1; 699 int x2; 700 int y1; 701 int y2; 702 }BUTTONS; 703 704 // Structure to remember screen positions 705 // for processing parameter change boxes 706 typedef struct{ 707 int no; 708 int type; 709 int x; 710 int y; 711 }SAVPARM; 712 713 // Structure for a screen object on which the mouse can operate. 714 typedef struct { 715 int no; 716 int x1; 717 int x2; 718 int y1; 719 int y2; 720 }SCREEN_OBJECT; 721 722 // Structure for the AFC graph 723 typedef struct { 724 int ytop; 725 int ybottom; 726 int xleft; 727 int xright; 728 int mode_control; 729 int avgnum; 730 int window; 731 int fit_points; 732 int delay; 733 int check; 734 float minston; 735 float search_range; 736 float lock_range; 737 float frange; 738 } AG_PARMS; 739 #define MAX_AG_INTPAR 10 740 extern char *ag_intpar_text[MAX_AG_INTPAR]; 741 #define MAX_AG_FLOATPAR 4 742 extern char *ag_floatpar_text[MAX_AG_FLOATPAR]; 743 744 // Structure for the wide graph. 745 // Waterfall and full dynamic range spectrum 746 typedef struct { 747 int ytop; 748 int ybottom; 749 int xleft; 750 int xright; 751 int yborder; 752 int xpoints_per_pixel; 753 int pixels_per_xpoint; 754 int first_xpoint; 755 int xpoints; 756 int fft_avg1num; 757 int spek_avgnum; 758 int waterfall_avgnum; 759 int spur_inhibit; 760 int check; 761 float yzero; 762 float yrange; 763 float waterfall_db_zero; 764 float waterfall_db_gain; 765 } WG_PARMS; 766 #define MAX_WG_INTPAR 14 767 extern char *wg_intpar_text[MAX_WG_INTPAR]; 768 #define MAX_WG_FLOATPAR 4 769 extern char *wg_floatpar_text[MAX_WG_FLOATPAR]; 770 771 // Structure for the high resolution and blanker control graph. 772 // Waterfall and full dynamic range spectrum 773 typedef struct { 774 int ytop; 775 int ybottom; 776 int xleft; 777 int xright; 778 int stupid_bln_mode; 779 int clever_bln_mode; 780 int timf2_display; 781 int timf2_display_lines; 782 int timf2_display_hold; 783 int spek_avgnum; 784 unsigned int stupid_bln_limit; 785 unsigned int clever_bln_limit; 786 int spek_zero; 787 int spek_gain; 788 int map65_gain_db; 789 int map65_strong; 790 int check; 791 float stupid_bln_factor; 792 float clever_bln_factor; 793 float blanker_ston_fft1; 794 float blanker_ston_fft2; 795 float timf2_display_wk_gain; 796 float timf2_display_st_gain; 797 } HG_PARMS; 798 #define MAX_HG_INTPAR 17 799 extern char *hg_intpar_text[MAX_HG_INTPAR]; 800 #define MAX_HG_FLOATPAR 6 801 extern char *hg_floatpar_text[MAX_HG_FLOATPAR]; 802 803 804 // Structure for the baseband graph 805 typedef struct { 806 int ytop; 807 int ybottom; 808 int xleft; 809 int xright; 810 int yborder; 811 int fft_avgnum; 812 int pixels_per_point; 813 int coh_factor; 814 int delay_points; 815 int agc_flag; 816 int agc_attack; 817 int agc_release; 818 int agc_hang; 819 int waterfall_avgnum; 820 int wheel_stepn; 821 int oscill_on; 822 int horiz_arrow_mode; 823 int mixer_mode; 824 int filter_shift; 825 int fm_mode; 826 int fm_subtract; 827 int fm_audio_bw; 828 int ch2_phase; 829 int squelch_level; 830 int squelch_time; 831 int squelch_point; 832 int check; 833 float filter_flat; 834 float filter_curv; 835 float yzero; 836 float yrange; 837 float db_per_pixel; 838 float yfac_power; 839 float yfac_log; 840 float bandwidth; 841 float first_frequency; 842 float bfo_freq; 843 float output_gain; 844 float waterfall_gain; 845 float waterfall_zero; 846 float oscill_gain; 847 } BG_PARMS; 848 #define MAX_BG_INTPAR 27 849 extern char *bg_intpar_text[MAX_BG_INTPAR]; 850 #define MAX_BG_FLOATPAR 14 851 extern char *bg_floatpar_text[MAX_BG_FLOATPAR]; 852 853 // Structure for the polarization graph 854 typedef struct { 855 int ytop; 856 int ybottom; 857 int xleft; 858 int xright; 859 int adapt; 860 int avg; 861 int check; 862 float angle; 863 float c1; 864 float c2; 865 float c3; 866 } PG_PARMS; 867 #define MAX_PG_INTPAR 7 868 extern char *pg_intpar_text[MAX_PG_INTPAR]; 869 #define MAX_PG_FLOATPAR 4 870 extern char *pg_floatpar_text[MAX_PG_FLOATPAR]; 871 872 // Structure for the coherent processing graph 873 typedef struct { 874 int ytop; 875 int ybottom; 876 int xleft; 877 int xright; 878 int meter_graph_on; 879 int oscill_on; 880 } CG_PARMS; 881 #define MAX_CG_INTPAR 6 882 extern char *cg_intpar_text[MAX_CG_INTPAR]; 883 #define MAX_CG_FLOATPAR 0 884 extern char *cg_floatpar_text[MAX_CG_FLOATPAR+1]; 885 886 887 // Structure for the S-meter graph 888 typedef struct { 889 int ytop; 890 int ybottom; 891 int xleft; 892 int xright; 893 int scale_type; 894 int avgnum; 895 int tracks; 896 int check; 897 float ygain; 898 float yzero; 899 float cal_dbm; 900 float cal_ston; 901 float cal_ston_sigshift; 902 float cal_s_units; 903 } MG_PARMS; 904 #define MAX_MG_INTPAR 8 905 extern char *mg_intpar_text[MAX_MG_INTPAR]; 906 #define MAX_MG_FLOATPAR 6 907 extern char *mg_floatpar_text[MAX_MG_FLOATPAR]; 908 909 910 // Structure for the EME graph. 911 typedef struct { 912 int ytop; 913 int ybottom; 914 int xleft; 915 int xright; 916 int minimise; 917 } EG_PARMS; 918 #define MAX_EG_INTPAR 5 919 extern char *eg_intpar_text[MAX_EG_INTPAR]; 920 #define MAX_EG_FLOATPAR 0 921 extern char *eg_floatpar_text[MAX_EG_FLOATPAR+1]; 922 923 // Structure for the frequency control box. 924 typedef struct { 925 int ytop; 926 int ybottom; 927 int xleft; 928 int xright; 929 int yborder; 930 int passband_direction; 931 int gain; 932 int gain_increment; 933 double passband_increment; 934 double passband_center; 935 } FG_PARMS; 936 #define MAX_FG_INTPAR 8 937 extern char *fg_intpar_text[MAX_FG_INTPAR]; 938 #define MAX_FG_FLOATPAR 2 939 extern char *fg_floatpar_text[MAX_FG_FLOATPAR]; 940 941 // Structure for the Tx control box. 942 typedef struct { 943 int ytop; 944 int ybottom; 945 int xleft; 946 int xright; 947 int spproc_no; 948 int band_direction; 949 double level_db; 950 double freq; 951 double band_increment; 952 double band_center; 953 } TG_PARMS; 954 #define MAX_TG_INTPAR 6 955 extern char *tg_intpar_text[MAX_TG_INTPAR]; 956 #define MAX_TG_FLOATPAR 4 957 extern char *tg_floatpar_text[MAX_TG_FLOATPAR]; 958 959 // Structure for the radar graph. 960 typedef struct { 961 int ytop; 962 int ybottom; 963 int xleft; 964 int xright; 965 float time; 966 float zero; 967 float gain; 968 } RG_PARMS; 969 #define MAX_RG_INTPAR 4 970 extern char *rg_intpar_text[MAX_RG_INTPAR]; 971 #define MAX_RG_FLOATPAR 3 972 extern char *rg_floatpar_text[MAX_RG_FLOATPAR]; 973 974 975 976 // Structure for network parameters 977 typedef struct { 978 int send_group; 979 int rec_group; 980 int port; 981 int send_raw; 982 int send_fft1; 983 int send_fft2; 984 int send_timf2; 985 int send_baseb; 986 int send_basebraw; 987 int receive_raw; 988 int receive_fft1; 989 int receive_baseb; 990 int receive_basebraw; 991 int receive_timf2; 992 int check; 993 } NET_PARMS; 994 #define MAX_NET_INTPAR 15 995 extern char *net_intpar_text[MAX_NET_INTPAR]; 996 997 #define MAX_NETSLAVES 16 998 // Structure for file descriptors used by the network 999 typedef struct { 1000 FD send_rx_raw16; 1001 FD send_rx_raw18; 1002 FD send_rx_raw24; 1003 FD send_rx_fft1; 1004 FD send_rx_fft2; 1005 FD send_rx_timf2; 1006 FD send_rx_baseb; 1007 FD send_rx_basebraw; 1008 FD rec_rx; 1009 FD master; 1010 FD any_slave; 1011 FD slaves[MAX_NETSLAVES]; 1012 } NET_FD; 1013 #define MAX_NET_FD (9+MAX_NETSLAVES) 1014 extern NET_FD netfd; 1015 #define MAX_FREQLIST (2*MAX_NETSLAVES) 1016 1017 // Structure for multicasting receive data on the network. 1018 #define NET_MULTICAST_PAYLOAD 1392 // This number must be a multiple of 48 1019 typedef struct { 1020 1021 double passband_center; // 8 1022 int time; // 4 1023 float userx_freq; // 4 1024 int ptr; // 4 1025 unsigned short int block_no; // 2 1026 signed char userx_no; // 1 1027 signed char passband_direction; // 1 1028 char buf[NET_MULTICAST_PAYLOAD]; 1029 } NET_RX_STRUCT; 1030 extern NET_RX_STRUCT net_rxdata_16; 1031 extern NET_RX_STRUCT net_rxdata_18; 1032 extern NET_RX_STRUCT net_rxdata_24; 1033 extern NET_RX_STRUCT net_rxdata_fft1; 1034 extern NET_RX_STRUCT net_rxdata_timf2; 1035 extern NET_RX_STRUCT net_rxdata_fft2; 1036 extern NET_RX_STRUCT net_rxdata_baseb; 1037 extern NET_RX_STRUCT net_rxdata_basebraw; 1038 1039 // Structure for messages from slaves. 1040 typedef struct { 1041 int type; 1042 int frequency; 1043 } SLAVE_MESSAGE; 1044 extern SLAVE_MESSAGE slave_msg; 1045 1046 1047 1048 1049 // *********************************************** 1050 // Structure used by float fft routines 1051 typedef struct { 1052 float sin; 1053 float cos; 1054 }COSIN_TABLE; 1055 1056 // *********************************************** 1057 // Structure used by d_float fft routines (double) 1058 typedef struct { 1059 double sin; 1060 double cos; 1061 }D_COSIN_TABLE; 1062 1063 // Structure used by MMX fft routines 1064 typedef struct { 1065 short int c1p; 1066 short int s2p; 1067 short int c3p; 1068 short int s4m; 1069 }MMX_COSIN_TABLE; 1070 1071 // Structure for mixer/decimater using backwards FFTs 1072 typedef struct { 1073 float *window; 1074 float *cos2win; 1075 float *sin2win; 1076 unsigned short int *permute; 1077 COSIN_TABLE *table; 1078 unsigned int interleave_points; 1079 unsigned int new_points; 1080 unsigned int crossover_points; 1081 unsigned int size; 1082 unsigned int n; 1083 }MIXER_VARIABLES; 1084 1085 // Define setup info for each fft version. 1086 typedef struct { 1087 unsigned char window; 1088 unsigned char permute; 1089 unsigned char max_n; 1090 unsigned char mmx; 1091 unsigned char simd; 1092 unsigned char real2complex; 1093 unsigned char parall_fft; 1094 char *text; 1095 } FFT_SETUP_INFO; 1096 1097 typedef struct { 1098 void *pointer; 1099 int size; 1100 int scratch_size; 1101 int num; 1102 } MEM_INF; 1103 1104 typedef struct { 1105 float x2; 1106 float y2; 1107 float im_xy; 1108 float re_xy; 1109 }TWOCHAN_POWER; 1110 1111 # define MAX_FFT_VERSIONS 18 1112 # define MAX_FFT1_VERNR 8 1113 # define MAX_FFT1_BCKVERNR 4 1114 # define MAX_FFT2_VERNR 4 1115 1116 // when wse.parport is set to this value, all the I/O to the LPT is routed to the USB2LPT 1.6 1117 # define USB2LPT16_PORT_NUMBER 16 1118