mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-02 13:20:20 +00:00
Added improvements with regards to SOF timing jitter
This commit is contained in:
parent
76413a95d4
commit
1d37f5ef9b
@ -627,6 +627,13 @@ void dcd_int_handler(uint8_t rhport) {
|
|||||||
// dcd_ep_ctr_handler(), so less need to loop here. The other interrupts shouldn't
|
// dcd_ep_ctr_handler(), so less need to loop here. The other interrupts shouldn't
|
||||||
// be triggered repeatedly.
|
// be triggered repeatedly.
|
||||||
|
|
||||||
|
/* Put SOF flag at the beginning of ISR in case to get least amount of jitter if it is used for timing purposes */
|
||||||
|
if(int_status & USB_ISTR_SOF) {
|
||||||
|
clear_istr_bits(USB_ISTR_SOF);
|
||||||
|
if (tu_stm32_sof_cb) tu_stm32_sof_cb();
|
||||||
|
dcd_event_sof(0, USB->FNR & USB_FNR_FN, true);
|
||||||
|
}
|
||||||
|
|
||||||
if(int_status & USB_ISTR_RESET) {
|
if(int_status & USB_ISTR_RESET) {
|
||||||
// USBRST is start of reset.
|
// USBRST is start of reset.
|
||||||
clear_istr_bits(USB_ISTR_RESET);
|
clear_istr_bits(USB_ISTR_RESET);
|
||||||
@ -664,11 +671,6 @@ void dcd_int_handler(uint8_t rhport) {
|
|||||||
dcd_event_bus_signal(0, DCD_EVENT_SUSPEND, true);
|
dcd_event_bus_signal(0, DCD_EVENT_SUSPEND, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(int_status & USB_ISTR_SOF) {
|
|
||||||
clear_istr_bits(USB_ISTR_SOF);
|
|
||||||
dcd_event_sof(0, USB->FNR & USB_FNR_FN, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(int_status & USB_ISTR_ESOF) {
|
if(int_status & USB_ISTR_ESOF) {
|
||||||
if(remoteWakeCountdown == 1u)
|
if(remoteWakeCountdown == 1u)
|
||||||
{
|
{
|
||||||
|
@ -130,6 +130,9 @@ static __IO uint16_t * const pma = (__IO uint16_t*)USB_PMAADDR;
|
|||||||
// this callback and defining a custom mapping in your application
|
// this callback and defining a custom mapping in your application
|
||||||
TU_ATTR_WEAK uint8_t tu_stm32_edpt_number_cb(uint8_t addr);
|
TU_ATTR_WEAK uint8_t tu_stm32_edpt_number_cb(uint8_t addr);
|
||||||
|
|
||||||
|
// This callback is called on SOF and can be used to e.g. capture a timer value for timing purposes
|
||||||
|
TU_ATTR_WEAK void tu_stm32_sof_cb(void);
|
||||||
|
|
||||||
// prototypes
|
// prototypes
|
||||||
TU_ATTR_ALWAYS_INLINE static inline __IO uint16_t* pcd_ep_rx_cnt_ptr(USB_TypeDef * USBx, uint32_t bEpNum);
|
TU_ATTR_ALWAYS_INLINE static inline __IO uint16_t* pcd_ep_rx_cnt_ptr(USB_TypeDef * USBx, uint32_t bEpNum);
|
||||||
TU_ATTR_ALWAYS_INLINE static inline __IO uint16_t* pcd_ep_tx_cnt_ptr(USB_TypeDef * USBx, uint32_t bEpNum);
|
TU_ATTR_ALWAYS_INLINE static inline __IO uint16_t* pcd_ep_tx_cnt_ptr(USB_TypeDef * USBx, uint32_t bEpNum);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user