4747// MACRO CONSTANT TYPEDEF PROTYPES
4848//--------------------------------------------------------------------+
4949
50- typedef enum
51- {
50+ typedef enum {
5251 DCD_EVENT_INVALID = 0 ,
5352 DCD_EVENT_BUS_RESET ,
5453 DCD_EVENT_UNPLUGGED ,
@@ -65,13 +64,11 @@ typedef enum
6564 DCD_EVENT_COUNT
6665} dcd_eventid_t ;
6766
68- typedef struct TU_ATTR_ALIGNED (4 )
69- {
67+ typedef struct TU_ATTR_ALIGNED (4 ) {
7068 uint8_t rhport ;
7169 uint8_t event_id ;
7270
73- union
74- {
71+ union {
7572 // BUS RESET
7673 struct {
7774 tusb_speed_t speed ;
@@ -123,7 +120,7 @@ void dcd_dcache_clean_invalidate(void const* addr, uint32_t data_size) TU_ATTR_W
123120//--------------------------------------------------------------------+
124121
125122// Initialize controller to device mode
126- void dcd_init (uint8_t rhport );
123+ void dcd_init (uint8_t rhport );
127124
128125// Interrupt Handler
129126void dcd_int_handler (uint8_t rhport );
@@ -184,11 +181,11 @@ void dcd_edpt_stall (uint8_t rhport, uint8_t ep_addr);
184181void dcd_edpt_clear_stall (uint8_t rhport , uint8_t ep_addr );
185182
186183// 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
188185TU_ATTR_WEAK bool dcd_edpt_iso_alloc (uint8_t rhport , uint8_t ep_addr , uint16_t largest_packet_size );
189186
190187// 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 );
192189
193190//--------------------------------------------------------------------+
194191// 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
198195extern void dcd_event_handler (dcd_event_t const * event , bool in_isr );
199196
200197// 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 ) {
203199 dcd_event_t event = { .rhport = rhport , .event_id = eid };
204200 dcd_event_handler (& event , in_isr );
205201}
206202
207203// 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 ) {
210205 dcd_event_t event = { .rhport = rhport , .event_id = DCD_EVENT_BUS_RESET };
211206 event .bus_reset .speed = speed ;
212207 dcd_event_handler (& event , in_isr );
213208}
214209
215210// 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 ) {
218212 dcd_event_t event = { .rhport = rhport , .event_id = DCD_EVENT_SETUP_RECEIVED };
219213 memcpy (& event .setup_received , setup , sizeof (tusb_control_request_t ));
220214
221215 dcd_event_handler (& event , in_isr );
222216}
223217
224218// 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 ) {
227220 dcd_event_t event = { .rhport = rhport , .event_id = DCD_EVENT_XFER_COMPLETE };
228221
229222 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
233226 dcd_event_handler (& event , in_isr );
234227}
235228
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 ) {
238230 dcd_event_t event = { .rhport = rhport , .event_id = DCD_EVENT_SOF };
239231 event .sof .frame_count = frame_count ;
240232 dcd_event_handler (& event , in_isr );
0 commit comments