47
47
// MACRO CONSTANT TYPEDEF PROTYPES
48
48
//--------------------------------------------------------------------+
49
49
50
- typedef enum
51
- {
50
+ typedef enum {
52
51
DCD_EVENT_INVALID = 0 ,
53
52
DCD_EVENT_BUS_RESET ,
54
53
DCD_EVENT_UNPLUGGED ,
@@ -65,13 +64,11 @@ typedef enum
65
64
DCD_EVENT_COUNT
66
65
} dcd_eventid_t ;
67
66
68
- typedef struct TU_ATTR_ALIGNED (4 )
69
- {
67
+ typedef struct TU_ATTR_ALIGNED (4 ) {
70
68
uint8_t rhport ;
71
69
uint8_t event_id ;
72
70
73
- union
74
- {
71
+ union {
75
72
// BUS RESET
76
73
struct {
77
74
tusb_speed_t speed ;
@@ -123,7 +120,7 @@ void dcd_dcache_clean_invalidate(void const* addr, uint32_t data_size) TU_ATTR_W
123
120
//--------------------------------------------------------------------+
124
121
125
122
// Initialize controller to device mode
126
- void dcd_init (uint8_t rhport );
123
+ void dcd_init (uint8_t rhport );
127
124
128
125
// Interrupt Handler
129
126
void dcd_int_handler (uint8_t rhport );
@@ -184,11 +181,11 @@ void dcd_edpt_stall (uint8_t rhport, uint8_t ep_addr);
184
181
void dcd_edpt_clear_stall (uint8_t rhport , uint8_t ep_addr );
185
182
186
183
// Allocate packet buffer used by ISO endpoints
187
- // Some MCU need manual packet buffer allocation, we allocation largest size to avoid clustering
184
+ // Some MCU need manual packet buffer allocation, we allocate the largest size to avoid clustering
188
185
TU_ATTR_WEAK bool dcd_edpt_iso_alloc (uint8_t rhport , uint8_t ep_addr , uint16_t largest_packet_size );
189
186
190
187
// Configure and enable an ISO endpoint according to descriptor
191
- TU_ATTR_WEAK bool dcd_edpt_iso_activate (uint8_t rhport , tusb_desc_endpoint_t const * p_endpoint_desc );
188
+ TU_ATTR_WEAK bool dcd_edpt_iso_activate (uint8_t rhport , tusb_desc_endpoint_t const * p_endpoint_desc );
192
189
193
190
//--------------------------------------------------------------------+
194
191
// Event API (implemented by stack)
@@ -198,32 +195,28 @@ TU_ATTR_WEAK bool dcd_edpt_iso_activate(uint8_t rhport, tusb_desc_endpoint_t co
198
195
extern void dcd_event_handler (dcd_event_t const * event , bool in_isr );
199
196
200
197
// helper to send bus signal event
201
- TU_ATTR_ALWAYS_INLINE static inline void dcd_event_bus_signal (uint8_t rhport , dcd_eventid_t eid , bool in_isr )
202
- {
198
+ TU_ATTR_ALWAYS_INLINE static inline void dcd_event_bus_signal (uint8_t rhport , dcd_eventid_t eid , bool in_isr ) {
203
199
dcd_event_t event = { .rhport = rhport , .event_id = eid };
204
200
dcd_event_handler (& event , in_isr );
205
201
}
206
202
207
203
// helper to send bus reset event
208
- TU_ATTR_ALWAYS_INLINE static inline void dcd_event_bus_reset (uint8_t rhport , tusb_speed_t speed , bool in_isr )
209
- {
204
+ TU_ATTR_ALWAYS_INLINE static inline void dcd_event_bus_reset (uint8_t rhport , tusb_speed_t speed , bool in_isr ) {
210
205
dcd_event_t event = { .rhport = rhport , .event_id = DCD_EVENT_BUS_RESET };
211
206
event .bus_reset .speed = speed ;
212
207
dcd_event_handler (& event , in_isr );
213
208
}
214
209
215
210
// helper to send setup received
216
- TU_ATTR_ALWAYS_INLINE static inline void dcd_event_setup_received (uint8_t rhport , uint8_t const * setup , bool in_isr )
217
- {
211
+ TU_ATTR_ALWAYS_INLINE static inline void dcd_event_setup_received (uint8_t rhport , uint8_t const * setup , bool in_isr ) {
218
212
dcd_event_t event = { .rhport = rhport , .event_id = DCD_EVENT_SETUP_RECEIVED };
219
213
memcpy (& event .setup_received , setup , sizeof (tusb_control_request_t ));
220
214
221
215
dcd_event_handler (& event , in_isr );
222
216
}
223
217
224
218
// helper to send transfer complete event
225
- TU_ATTR_ALWAYS_INLINE static inline void dcd_event_xfer_complete (uint8_t rhport , uint8_t ep_addr , uint32_t xferred_bytes , uint8_t result , bool in_isr )
226
- {
219
+ TU_ATTR_ALWAYS_INLINE static inline void dcd_event_xfer_complete (uint8_t rhport , uint8_t ep_addr , uint32_t xferred_bytes , uint8_t result , bool in_isr ) {
227
220
dcd_event_t event = { .rhport = rhport , .event_id = DCD_EVENT_XFER_COMPLETE };
228
221
229
222
event .xfer_complete .ep_addr = ep_addr ;
@@ -233,8 +226,7 @@ TU_ATTR_ALWAYS_INLINE static inline void dcd_event_xfer_complete (uint8_t rhport
233
226
dcd_event_handler (& event , in_isr );
234
227
}
235
228
236
- static inline void dcd_event_sof (uint8_t rhport , uint32_t frame_count , bool in_isr )
237
- {
229
+ TU_ATTR_ALWAYS_INLINE static inline void dcd_event_sof (uint8_t rhport , uint32_t frame_count , bool in_isr ) {
238
230
dcd_event_t event = { .rhport = rhport , .event_id = DCD_EVENT_SOF };
239
231
event .sof .frame_count = frame_count ;
240
232
dcd_event_handler (& event , in_isr );
0 commit comments