Skip to content

Commit 4bfba6b

Browse files
committed
fix rp2 iso transfer: reset state before notify stack. since new audio driver can execute xfer_is()
1 parent 5153312 commit 4bfba6b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

examples/device/uac2_headset/src/main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,9 @@ bool tud_audio_set_itf_close_ep_cb(uint8_t rhport, tusb_control_request_t const
297297
uint8_t const itf = tu_u16_low(tu_le16toh(p_request->wIndex));
298298
uint8_t const alt = tu_u16_low(tu_le16toh(p_request->wValue));
299299

300-
if (ITF_NUM_AUDIO_STREAMING_SPK == itf && alt == 0)
300+
if (ITF_NUM_AUDIO_STREAMING_SPK == itf && alt == 0) {
301301
blink_interval_ms = BLINK_MOUNTED;
302+
}
302303

303304
return true;
304305
}
@@ -309,8 +310,9 @@ bool tud_audio_set_itf_cb(uint8_t rhport, tusb_control_request_t const *p_reques
309310
uint8_t const alt = tu_u16_low(tu_le16toh(p_request->wValue));
310311

311312
TU_LOG2("Set interface %d alt %d\r\n", itf, alt);
312-
if (ITF_NUM_AUDIO_STREAMING_SPK == itf && alt != 0)
313+
if (ITF_NUM_AUDIO_STREAMING_SPK == itf && alt != 0) {
313314
blink_interval_ms = BLINK_STREAMING;
315+
}
314316

315317
// Clear buffer when streaming format is changed
316318
spk_data_size = 0;

src/portable/raspberrypi/rp2040/dcd_rp2040.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,9 @@ static void __tusb_irq_path_func(hw_handle_buff_status)(void) {
190190
bool done = hw_endpoint_xfer_continue(ep);
191191
if (done) {
192192
// Notify
193-
dcd_event_xfer_complete(0, ep->ep_addr, ep->xferred_len, XFER_RESULT_SUCCESS, true);
193+
const uint16_t xferred_len = ep->xferred_len;
194194
hw_endpoint_reset_transfer(ep);
195+
dcd_event_xfer_complete(0, ep->ep_addr, xferred_len, XFER_RESULT_SUCCESS, true);
195196
}
196197
remaining_buffers &= ~bit;
197198
}

0 commit comments

Comments
 (0)