@@ -98,7 +98,7 @@ static usbd_class_driver_t const _usbd_driver[] =
98
98
.open = cdcd_open ,
99
99
.control_xfer_cb = cdcd_control_xfer_cb ,
100
100
.xfer_cb = cdcd_xfer_cb ,
101
- .sof = NULL
101
+ .sof_isr = NULL
102
102
},
103
103
#endif
104
104
@@ -110,7 +110,7 @@ static usbd_class_driver_t const _usbd_driver[] =
110
110
.open = mscd_open ,
111
111
.control_xfer_cb = mscd_control_xfer_cb ,
112
112
.xfer_cb = mscd_xfer_cb ,
113
- .sof = NULL
113
+ .sof_isr = NULL
114
114
},
115
115
#endif
116
116
@@ -122,7 +122,7 @@ static usbd_class_driver_t const _usbd_driver[] =
122
122
.open = hidd_open ,
123
123
.control_xfer_cb = hidd_control_xfer_cb ,
124
124
.xfer_cb = hidd_xfer_cb ,
125
- .sof = NULL
125
+ .sof_isr = NULL
126
126
},
127
127
#endif
128
128
@@ -134,7 +134,7 @@ static usbd_class_driver_t const _usbd_driver[] =
134
134
.open = audiod_open ,
135
135
.control_xfer_cb = audiod_control_xfer_cb ,
136
136
.xfer_cb = audiod_xfer_cb ,
137
- .sof = audiod_sof
137
+ .sof_isr = audiod_sof
138
138
},
139
139
#endif
140
140
@@ -146,7 +146,7 @@ static usbd_class_driver_t const _usbd_driver[] =
146
146
.open = videod_open ,
147
147
.control_xfer_cb = videod_control_xfer_cb ,
148
148
.xfer_cb = videod_xfer_cb ,
149
- .sof = NULL
149
+ .sof_isr = NULL
150
150
},
151
151
#endif
152
152
@@ -158,7 +158,7 @@ static usbd_class_driver_t const _usbd_driver[] =
158
158
.reset = midid_reset ,
159
159
.control_xfer_cb = midid_control_xfer_cb ,
160
160
.xfer_cb = midid_xfer_cb ,
161
- .sof = NULL
161
+ .sof_isr = NULL
162
162
},
163
163
#endif
164
164
@@ -170,7 +170,7 @@ static usbd_class_driver_t const _usbd_driver[] =
170
170
.open = vendord_open ,
171
171
.control_xfer_cb = tud_vendor_control_xfer_cb ,
172
172
.xfer_cb = vendord_xfer_cb ,
173
- .sof = NULL
173
+ .sof_isr = NULL
174
174
},
175
175
#endif
176
176
@@ -182,7 +182,7 @@ static usbd_class_driver_t const _usbd_driver[] =
182
182
.open = usbtmcd_open_cb ,
183
183
.control_xfer_cb = usbtmcd_control_xfer_cb ,
184
184
.xfer_cb = usbtmcd_xfer_cb ,
185
- .sof = NULL
185
+ .sof_isr = NULL
186
186
},
187
187
#endif
188
188
@@ -194,7 +194,7 @@ static usbd_class_driver_t const _usbd_driver[] =
194
194
.open = dfu_rtd_open ,
195
195
.control_xfer_cb = dfu_rtd_control_xfer_cb ,
196
196
.xfer_cb = NULL ,
197
- .sof = NULL
197
+ .sof_isr = NULL
198
198
},
199
199
#endif
200
200
@@ -206,7 +206,7 @@ static usbd_class_driver_t const _usbd_driver[] =
206
206
.open = dfu_moded_open ,
207
207
.control_xfer_cb = dfu_moded_control_xfer_cb ,
208
208
.xfer_cb = NULL ,
209
- .sof = NULL
209
+ .sof_isr = NULL
210
210
},
211
211
#endif
212
212
@@ -218,7 +218,7 @@ static usbd_class_driver_t const _usbd_driver[] =
218
218
.open = netd_open ,
219
219
.control_xfer_cb = netd_control_xfer_cb ,
220
220
.xfer_cb = netd_xfer_cb ,
221
- .sof = NULL ,
221
+ .sof_isr = NULL ,
222
222
},
223
223
#endif
224
224
@@ -230,7 +230,7 @@ static usbd_class_driver_t const _usbd_driver[] =
230
230
.open = btd_open ,
231
231
.control_xfer_cb = btd_control_xfer_cb ,
232
232
.xfer_cb = btd_xfer_cb ,
233
- .sof = NULL
233
+ .sof_isr = NULL
234
234
},
235
235
#endif
236
236
};
@@ -264,7 +264,7 @@ static inline usbd_class_driver_t const * get_driver(uint8_t drvid)
264
264
// DCD Event
265
265
//--------------------------------------------------------------------+
266
266
267
- static tud_sof_isr_t _sof_isr = NULL ;
267
+ // static tud_sof_isr_t _sof_isr = NULL;
268
268
269
269
enum { RHPORT_INVALID = 0xFFu };
270
270
static uint8_t _usbd_rhport = RHPORT_INVALID ;
@@ -373,11 +373,11 @@ bool tud_connect(void)
373
373
return true;
374
374
}
375
375
376
- void tud_sof_isr_set (tud_sof_isr_t sof_isr )
377
- {
378
- _sof_isr = sof_isr ;
379
- dcd_sof_enable (_usbd_rhport , _sof_isr != NULL );
380
- }
376
+ // void tud_sof_isr_set(tud_sof_isr_t sof_isr)
377
+ // {
378
+ // _sof_isr = sof_isr;
379
+ // dcd_sof_enable(_usbd_rhport, _sof_isr != NULL);
380
+ // }
381
381
382
382
//--------------------------------------------------------------------+
383
383
// USBD Task
@@ -422,7 +422,7 @@ bool tud_init (uint8_t rhport)
422
422
}
423
423
424
424
_usbd_rhport = rhport ;
425
- _sof_isr = NULL ;
425
+ // _sof_isr = NULL;
426
426
427
427
// Init device controller driver
428
428
dcd_init (rhport );
@@ -585,21 +585,12 @@ void tud_task (void)
585
585
}
586
586
break ;
587
587
588
- case DCD_EVENT_SOF :
589
- TU_LOG2 ("\r\n" );
590
- // TODO: Should this really be done here in the queue? How to distinguish the calls here from those SOF events which should be handled directly in the ISR routine? If we do it like this, the SOF routines get called two time right now, once in the ISR context and once again here
591
- // for ( uint8_t i = 0; i < TOTAL_DRIVER_COUNT; i++ )
592
- // {
593
- // usbd_class_driver_t const * driver = get_driver(i);
594
- // if ( driver->sof ) driver->sof(event.rhport, event.sof.frame_count);
595
- // }
596
- break ;
597
-
598
588
case USBD_EVENT_FUNC_CALL :
599
589
TU_LOG2 ("\r\n" );
600
590
if ( event .func_call .func ) event .func_call .func (event .func_call .param );
601
591
break ;
602
592
593
+ case DCD_EVENT_SOF :
603
594
default :
604
595
TU_BREAKPOINT ();
605
596
break ;
@@ -1114,15 +1105,14 @@ void dcd_event_handler(dcd_event_t const * event, bool in_isr)
1114
1105
for (uint8_t i = 0 ; i < TOTAL_DRIVER_COUNT ; i ++ )
1115
1106
{
1116
1107
usbd_class_driver_t const * driver = get_driver (i );
1117
- if (driver -> sof )
1108
+ if (driver -> sof_isr )
1118
1109
{
1119
- driver -> sof (event -> rhport , event -> sof .frame_count );
1120
- // TU_LOG2("%s sof\r\n", driver->name); // too demanding
1110
+ driver -> sof_isr (event -> rhport , event -> sof .frame_count );
1121
1111
}
1122
1112
}
1123
1113
1124
1114
// SOF user handler in ISR context
1125
- if (_sof_isr ) _sof_isr (event -> sof .frame_count );
1115
+ // if (_sof_isr) _sof_isr(event->sof.frame_count);
1126
1116
1127
1117
// Some MCUs after running dcd_remote_wakeup() does not have way to detect the end of remote wakeup
1128
1118
// which last 1-15 ms. DCD can use SOF as a clear indicator that bus is back to operational
@@ -1133,6 +1123,8 @@ void dcd_event_handler(dcd_event_t const * event, bool in_isr)
1133
1123
dcd_event_t const event_resume = { .rhport = event -> rhport , .event_id = DCD_EVENT_RESUME };
1134
1124
osal_queue_send (_usbd_q , & event_resume , in_isr );
1135
1125
}
1126
+
1127
+ // skip osal queue for SOF in usbd task
1136
1128
break ;
1137
1129
1138
1130
default :
@@ -1411,7 +1403,8 @@ void usbd_edpt_close(uint8_t rhport, uint8_t ep_addr)
1411
1403
1412
1404
void usbd_sof_enable (uint8_t rhport , bool en )
1413
1405
{
1414
- // TODO: Check needed if all drivers including the user sof_cb does not need an active SOF ISR any more. Only if all drivers switched off SOF calls the SOF interrupt may be disabled
1406
+ // TODO: Check needed if all drivers including the user sof_cb does not need an active SOF ISR any more.
1407
+ // Only if all drivers switched off SOF calls the SOF interrupt may be disabled
1415
1408
dcd_sof_enable (rhport , en );
1416
1409
}
1417
1410
0 commit comments