Switched from usb-stack assisted SOF measurement to pure software solution to keep API compatibility to the original tinyusb

v1.1
Simon Kueppers 2023-01-08 15:32:30 +01:00
rodzic 0baac1e155
commit 417b167c28
3 zmienionych plików z 4 dodań i 9 usunięć

Wyświetl plik

@ -7,7 +7,8 @@
// We have ISOCHRONOUS endpoints defined that share the same endpoint number, but have opposing directions.
// However with STM32 hardware, ISOCHRONOUS endpoints use both RX and TX structures of the same endpoint register in hardware
// We circumvent a clash by defining our own custom endpoint map for the tiny usb stack
// We circumvent a clash by defining our own custom endpoint map for the tiny usb stack.
// This callback is probably not needed with new versions of tinyusb
uint8_t tu_stm32_edpt_number_cb(uint8_t addr)
{
switch (addr) {
@ -38,12 +39,6 @@ uint8_t tu_stm32_edpt_number_cb(uint8_t addr)
}
}
void tu_stm32_sof_cb(void)
{
/* Capture timer value */
USB_SOF_TIMER->EGR = TIM_EGR_CC1G;
}
// FIXME: Do all three need to be handled, or just the LP one?
// USB high-priority interrupt (Channel 74): Triggered only by a correct
// transfer event for isochronous and double-buffer bulk transfer to reach

Wyświetl plik

@ -5,7 +5,7 @@
#include "usb_serial.h"
#define USB_SOF_TIMER TIM2
#define USB_SOF_TIMER_CCR TIM2->CCR1
#define USB_SOF_TIMER_CNT TIM2->CNT
#define USB_SOF_TIMER_HZ 72000000UL
void USB_Init(void);

Wyświetl plik

@ -581,7 +581,7 @@ void tud_audio_feedback_params_cb(uint8_t func_id, uint8_t alt_itf, audio_feedba
TU_ATTR_FAST_FUNC void tud_audio_feedback_interval_isr(uint8_t func_id, uint32_t frame_number, uint8_t interval_shift)
{
static uint32_t prev_cycles = 0;
uint32_t this_cycles = USB_SOF_TIMER_CCR; /* Load from capture register, which is set in tu_stm32_sof_cb */
uint32_t this_cycles = USB_SOF_TIMER_CNT;
uint32_t feedback;
/* Calculate number of master clock cycles between now and last call */