Merge remote-tracking branch 'origin/master' into tx-transfer-sizing

This commit is contained in:
Martin Ling
2022-09-15 15:32:20 +01:00
14 changed files with 591 additions and 81 deletions

View File

@@ -516,8 +516,10 @@ int tx_callback(hackrf_transfer* transfer)
/* Fill the buffer. */
if (file == NULL) {
/* Transmit continuous wave with specific amplitude */
for (i = 0; i < bytes_to_read; i++)
transfer->buffer[i] = -(uint8_t) amplitude;
for (i = 0; i < bytes_to_read; i += 2) {
transfer->buffer[i] = amplitude;
transfer->buffer[i + 1] = 0;
}
bytes_read = bytes_to_read;
} else {
/* Read samples from file. */
@@ -632,7 +634,7 @@ static void usage()
printf("\t[-S buf_size] # Enable receive streaming with buffer size buf_size.\n");
#endif
printf("\t[-B] # Print buffer statistics during transfer\n");
printf("\t[-c amplitude] # CW signal source mode, amplitude 0-128 (DC value to DAC).\n");
printf("\t[-c amplitude] # CW signal source mode, amplitude 0-127 (DC value to DAC).\n");
printf("\t[-R] # Repeat TX mode (default is off) \n");
printf("\t[-b baseband_filter_bw_hz] # Set baseband filter bandwidth in Hz.\n");
printf("\tPossible values: 1.75/2.5/3.5/5/5.5/6/7/8/9/10/12/14/15/20/24/28MHz, default <= 0.75 * sample_rate_hz.\n");
@@ -1022,9 +1024,9 @@ int main(int argc, char** argv)
if (signalsource) {
transceiver_mode = TRANSCEIVER_MODE_SS;
if (amplitude > 128) {
if (amplitude > 127) {
fprintf(stderr,
"argument error: amplitude must be between 0 and 128.\n");
"argument error: amplitude must be between 0 and 127.\n");
usage();
return EXIT_FAILURE;
}
@@ -1359,8 +1361,8 @@ int main(int argc, char** argv)
fprintf(stderr, "Waiting for sync...\n");
} else {
double full_scale_ratio = (double) stream_power_now /
(byte_count_now * 128 * 128);
double dB_full_scale = 10 * log10(full_scale_ratio);
(byte_count_now * 127 * 127);
double dB_full_scale = 10 * log10(full_scale_ratio) + 3.0;
fprintf(stderr,
"%4.1f MiB / %5.3f sec = %4.1f MiB/second, average power %3.1f dBfs",
(byte_count_now / 1e6f),