mirror of
https://github.com/greatscottgadgets/hackrf.git
synced 2026-03-06 15:30:18 +01:00
Keep count of number of shortfalls.
To enable this, we keep a count of the current shortfall length. Each time an SGPIO read/write cannot be completed due to a shortfall, we increase this length. Each time an SGPIO read/write is completed successfully, we reset the shortfall length to zero. When a shortfall occurs and the existing shortfall length is zero, this indicates a new shortfall, and the shortfall count is incremented. This change adds one cycle to the normal RX & TX paths, to zero the shortfall count. To enable this to be done in a single cycle, we keep a zero handy in a high register. The extra accounting adds 10 cycles to the TX and RX shortfall paths, plus an additional 3 cycles to the RX shortfall path since there are now two branches involved: one to the shortfall handler, and another back to the main loop.
This commit is contained in:
@@ -1159,9 +1159,11 @@ int main(int argc, char** argv) {
|
||||
if (result != HACKRF_SUCCESS)
|
||||
fprintf(stderr, "\nhackrf_get_m0_state() failed: %s (%d)\n", hackrf_error_name(result), result);
|
||||
else
|
||||
fprintf(stderr, ", %d bytes %s in buffer\n",
|
||||
fprintf(stderr, ", %d bytes %s in buffer, %u %s\n",
|
||||
tx ? state.m4_count - state.m0_count : state.m0_count - state.m4_count,
|
||||
tx ? "filled" : "free");
|
||||
tx ? "filled" : "free",
|
||||
state.num_shortfalls,
|
||||
tx ? "underruns" : "overruns");
|
||||
} else {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
@@ -1216,9 +1218,12 @@ int main(int argc, char** argv) {
|
||||
fprintf(stderr,
|
||||
"Transfer statistics:\n"
|
||||
"%lu bytes transferred by M0\n"
|
||||
"%lu bytes transferred by M4\n",
|
||||
"%lu bytes transferred by M4\n"
|
||||
"%u %s\n",
|
||||
stats.m0_total,
|
||||
stats.m4_total);
|
||||
stats.m4_total,
|
||||
state.num_shortfalls,
|
||||
(transmit || signalsource) ? "underruns" : "overruns");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user