Skip to content

Commit 96feced

Browse files
authored
Merge pull request hathach#1505 from hathach/revert-sof-rename
revert sof_isr driver rename since it cause issue with existing code
2 parents 806806d + 8451d05 commit 96feced

File tree

3 files changed

+15
-33
lines changed

3 files changed

+15
-33
lines changed

src/device/usbd.c

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static usbd_class_driver_t const _usbd_driver[] =
9898
.open = cdcd_open,
9999
.control_xfer_cb = cdcd_control_xfer_cb,
100100
.xfer_cb = cdcd_xfer_cb,
101-
.sof_isr = NULL
101+
.sof = NULL
102102
},
103103
#endif
104104

@@ -110,7 +110,7 @@ static usbd_class_driver_t const _usbd_driver[] =
110110
.open = mscd_open,
111111
.control_xfer_cb = mscd_control_xfer_cb,
112112
.xfer_cb = mscd_xfer_cb,
113-
.sof_isr = NULL
113+
.sof = NULL
114114
},
115115
#endif
116116

@@ -122,7 +122,7 @@ static usbd_class_driver_t const _usbd_driver[] =
122122
.open = hidd_open,
123123
.control_xfer_cb = hidd_control_xfer_cb,
124124
.xfer_cb = hidd_xfer_cb,
125-
.sof_isr = NULL
125+
.sof = NULL
126126
},
127127
#endif
128128

@@ -134,7 +134,7 @@ static usbd_class_driver_t const _usbd_driver[] =
134134
.open = audiod_open,
135135
.control_xfer_cb = audiod_control_xfer_cb,
136136
.xfer_cb = audiod_xfer_cb,
137-
.sof_isr = audiod_sof_isr
137+
.sof = audiod_sof_isr
138138
},
139139
#endif
140140

@@ -146,7 +146,7 @@ static usbd_class_driver_t const _usbd_driver[] =
146146
.open = videod_open,
147147
.control_xfer_cb = videod_control_xfer_cb,
148148
.xfer_cb = videod_xfer_cb,
149-
.sof_isr = NULL
149+
.sof = NULL
150150
},
151151
#endif
152152

@@ -158,7 +158,7 @@ static usbd_class_driver_t const _usbd_driver[] =
158158
.reset = midid_reset,
159159
.control_xfer_cb = midid_control_xfer_cb,
160160
.xfer_cb = midid_xfer_cb,
161-
.sof_isr = NULL
161+
.sof = NULL
162162
},
163163
#endif
164164

@@ -170,7 +170,7 @@ static usbd_class_driver_t const _usbd_driver[] =
170170
.open = vendord_open,
171171
.control_xfer_cb = tud_vendor_control_xfer_cb,
172172
.xfer_cb = vendord_xfer_cb,
173-
.sof_isr = NULL
173+
.sof = NULL
174174
},
175175
#endif
176176

@@ -182,7 +182,7 @@ static usbd_class_driver_t const _usbd_driver[] =
182182
.open = usbtmcd_open_cb,
183183
.control_xfer_cb = usbtmcd_control_xfer_cb,
184184
.xfer_cb = usbtmcd_xfer_cb,
185-
.sof_isr = NULL
185+
.sof = NULL
186186
},
187187
#endif
188188

@@ -194,7 +194,7 @@ static usbd_class_driver_t const _usbd_driver[] =
194194
.open = dfu_rtd_open,
195195
.control_xfer_cb = dfu_rtd_control_xfer_cb,
196196
.xfer_cb = NULL,
197-
.sof_isr = NULL
197+
.sof = NULL
198198
},
199199
#endif
200200

@@ -206,7 +206,7 @@ static usbd_class_driver_t const _usbd_driver[] =
206206
.open = dfu_moded_open,
207207
.control_xfer_cb = dfu_moded_control_xfer_cb,
208208
.xfer_cb = NULL,
209-
.sof_isr = NULL
209+
.sof = NULL
210210
},
211211
#endif
212212

@@ -218,7 +218,7 @@ static usbd_class_driver_t const _usbd_driver[] =
218218
.open = netd_open,
219219
.control_xfer_cb = netd_control_xfer_cb,
220220
.xfer_cb = netd_xfer_cb,
221-
.sof_isr = NULL,
221+
.sof = NULL,
222222
},
223223
#endif
224224

@@ -230,7 +230,7 @@ static usbd_class_driver_t const _usbd_driver[] =
230230
.open = btd_open,
231231
.control_xfer_cb = btd_control_xfer_cb,
232232
.xfer_cb = btd_xfer_cb,
233-
.sof_isr = NULL
233+
.sof = NULL
234234
},
235235
#endif
236236
};
@@ -264,8 +264,6 @@ static inline usbd_class_driver_t const * get_driver(uint8_t drvid)
264264
// DCD Event
265265
//--------------------------------------------------------------------+
266266

267-
//static tud_sof_isr_t _sof_isr = NULL;
268-
269267
enum { RHPORT_INVALID = 0xFFu };
270268
static uint8_t _usbd_rhport = RHPORT_INVALID;
271269

@@ -373,12 +371,6 @@ bool tud_connect(void)
373371
return true;
374372
}
375373

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-
382374
//--------------------------------------------------------------------+
383375
// USBD Task
384376
//--------------------------------------------------------------------+
@@ -422,7 +414,6 @@ bool tud_init (uint8_t rhport)
422414
}
423415

424416
_usbd_rhport = rhport;
425-
//_sof_isr = NULL;
426417

427418
// Init device controller driver
428419
dcd_init(rhport);
@@ -1110,15 +1101,12 @@ TU_ATTR_FAST_FUNC void dcd_event_handler(dcd_event_t const * event, bool in_isr)
11101101
for (uint8_t i = 0; i < TOTAL_DRIVER_COUNT; i++)
11111102
{
11121103
usbd_class_driver_t const * driver = get_driver(i);
1113-
if (driver->sof_isr)
1104+
if (driver->sof)
11141105
{
1115-
driver->sof_isr(event->rhport, event->sof.frame_count);
1106+
driver->sof(event->rhport, event->sof.frame_count);
11161107
}
11171108
}
11181109

1119-
// SOF user handler in ISR context
1120-
// if (_sof_isr) _sof_isr(event->sof.frame_count);
1121-
11221110
// Some MCUs after running dcd_remote_wakeup() does not have way to detect the end of remote wakeup
11231111
// which last 1-15 ms. DCD can use SOF as a clear indicator that bus is back to operational
11241112
if ( _usbd_dev.suspended )

src/device/usbd.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
extern "C" {
3434
#endif
3535

36-
// typedef void (*tud_sof_isr_t) (uint32_t frame_count);
37-
3836
//--------------------------------------------------------------------+
3937
// Application API
4038
//--------------------------------------------------------------------+
@@ -95,10 +93,6 @@ bool tud_disconnect(void);
9593
// Return false on unsupported MCUs
9694
bool tud_connect(void);
9795

98-
// Set Start-of-frame (1ms interval) IRQ handler
99-
// NULL means disabled, frame_count may not be supported on mcus
100-
// void tud_sof_isr_set(tud_sof_isr_t sof_isr);
101-
10296
// Carry out Data and Status stage of control transfer
10397
// - If len = 0, it is equivalent to sending status only
10498
// - If len > wLength : it will be truncated

src/device/usbd_pvt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ typedef struct
4848
uint16_t (* open ) (uint8_t rhport, tusb_desc_interface_t const * desc_intf, uint16_t max_len);
4949
bool (* control_xfer_cb ) (uint8_t rhport, uint8_t stage, tusb_control_request_t const * request);
5050
bool (* xfer_cb ) (uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes);
51-
void (* sof_isr ) (uint8_t rhport, uint32_t frame_count); // optional
51+
void (* sof ) (uint8_t rhport, uint32_t frame_count); // optional
5252
} usbd_class_driver_t;
5353

5454
// Invoked when initializing device stack to get additional class drivers.

0 commit comments

Comments
 (0)