File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
src/portable/st/stm32_fsdev Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -627,6 +627,13 @@ void dcd_int_handler(uint8_t rhport) {
627
627
// dcd_ep_ctr_handler(), so less need to loop here. The other interrupts shouldn't
628
628
// be triggered repeatedly.
629
629
630
+ /* Put SOF flag at the beginning of ISR in case to get least amount of jitter if it is used for timing purposes */
631
+ if (int_status & USB_ISTR_SOF ) {
632
+ clear_istr_bits (USB_ISTR_SOF );
633
+ if (tu_stm32_sof_cb ) tu_stm32_sof_cb ();
634
+ dcd_event_sof (0 , USB -> FNR & USB_FNR_FN , true);
635
+ }
636
+
630
637
if (int_status & USB_ISTR_RESET ) {
631
638
// USBRST is start of reset.
632
639
clear_istr_bits (USB_ISTR_RESET );
@@ -664,11 +671,6 @@ void dcd_int_handler(uint8_t rhport) {
664
671
dcd_event_bus_signal (0 , DCD_EVENT_SUSPEND , true);
665
672
}
666
673
667
- if (int_status & USB_ISTR_SOF ) {
668
- clear_istr_bits (USB_ISTR_SOF );
669
- dcd_event_sof (0 , USB -> FNR & USB_FNR_FN , true);
670
- }
671
-
672
674
if (int_status & USB_ISTR_ESOF ) {
673
675
if (remoteWakeCountdown == 1u )
674
676
{
Original file line number Diff line number Diff line change @@ -130,6 +130,9 @@ static __IO uint16_t * const pma = (__IO uint16_t*)USB_PMAADDR;
130
130
// this callback and defining a custom mapping in your application
131
131
TU_ATTR_WEAK uint8_t tu_stm32_edpt_number_cb (uint8_t addr );
132
132
133
+ // This callback is called on SOF and can be used to e.g. capture a timer value for timing purposes
134
+ TU_ATTR_WEAK void tu_stm32_sof_cb (void );
135
+
133
136
// prototypes
134
137
TU_ATTR_ALWAYS_INLINE static inline __IO uint16_t * pcd_ep_rx_cnt_ptr (USB_TypeDef * USBx , uint32_t bEpNum );
135
138
TU_ATTR_ALWAYS_INLINE static inline __IO uint16_t * pcd_ep_tx_cnt_ptr (USB_TypeDef * USBx , uint32_t bEpNum );
You can’t perform that action at this time.
0 commit comments