Merge pull request #1167 from martinling/tx-sync-output

Don't start baseband streaming until TX buffer is first filled.
This commit is contained in:
Michael Ossmann
2022-09-21 15:05:51 -04:00
committed by GitHub

View File

@ -431,6 +431,7 @@ void rx_mode(uint32_t seq)
void tx_mode(uint32_t seq) void tx_mode(uint32_t seq)
{ {
unsigned int usb_count = 0; unsigned int usb_count = 0;
bool started = false;
transceiver_startup(TRANSCEIVER_MODE_TX); transceiver_startup(TRANSCEIVER_MODE_TX);
@ -443,13 +444,12 @@ void tx_mode(uint32_t seq)
NULL); NULL);
usb_count += USB_TRANSFER_SIZE; usb_count += USB_TRANSFER_SIZE;
// Enable streaming. The M0 is in TX_START mode, and will automatically
// send zeroes until the host fills buffer 0. Once that buffer is filled,
// the bulk transfer completion handler will increase the M4 count, and
// the M0 will switch to TX_RUN mode and transmit the first data.
baseband_streaming_enable(&sgpio_config);
while (transceiver_request.seq == seq) { while (transceiver_request.seq == seq) {
if (!started && (m0_state.m4_count == USB_BULK_BUFFER_SIZE)) {
// Buffer is now full, start streaming.
baseband_streaming_enable(&sgpio_config);
started = true;
}
if ((usb_count - m0_state.m0_count) <= USB_TRANSFER_SIZE) { if ((usb_count - m0_state.m0_count) <= USB_TRANSFER_SIZE) {
usb_transfer_schedule_block( usb_transfer_schedule_block(
&usb_endpoint_bulk_out, &usb_endpoint_bulk_out,