Skip to content

Commit

Permalink
Merge pull request #202 from shuchitak/feature/use_sof_timestamps_for…
Browse files Browse the repository at this point in the history
…_usb_rate

Log SOF timestamps
  • Loading branch information
shuchitak authored Sep 19, 2023
2 parents afe2f14 + 6e32624 commit 881d26f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions modules/sw_services/usb/portable/dcd_xcore.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021-2022 XMOS LIMITED.
// Copyright 2021-2023 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.

#define DEBUG_UNIT TUSB_DCD
Expand Down Expand Up @@ -42,7 +42,7 @@
#define CFG_TUD_XCORE_IO_CORE_MASK (~(1 << 0))
#endif

TU_ATTR_WEAK bool tud_xcore_sof_cb(uint8_t rhport);
TU_ATTR_WEAK bool tud_xcore_sof_cb(uint8_t rhport, uint32_t cur_time);
TU_ATTR_WEAK bool tud_xcore_data_cb(uint32_t cur_time, uint32_t ep_num, uint32_t ep_dir, size_t xfer_len);

#include "rtos_usb.h"
Expand Down Expand Up @@ -210,7 +210,7 @@ static void dcd_xcore_int_handler(rtos_usb_t *ctx,
break;
case rtos_usb_sof_packet:
if (tud_xcore_sof_cb) {
if (tud_xcore_sof_cb(0)) {
if (tud_xcore_sof_cb(0, cur_time)) {
dcd_event_bus_signal(0, DCD_EVENT_SOF, true);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ static void timeout_cb(TimerHandle_t xTimer)
sof_timeout = true;
}

bool tud_xcore_sof_cb(uint8_t rhport)
bool tud_xcore_sof_cb(uint8_t rhport, uint32_t cur_time)
{
(void)cur_time;
if (!received_sof_event) {
received_sof_event = true;
LOCAL_PRINTF("tud_xcore_sof_cb");
Expand Down Expand Up @@ -108,4 +109,4 @@ void register_sof_test(usb_test_ctx_t *test_ctx)
test_ctx->main_test[this_test_num] = sof_test;

test_ctx->test_cnt++;
}
}

0 comments on commit 881d26f

Please sign in to comment.