@@ -139,7 +139,7 @@ typedef union TU_ATTR_PACKED
139
139
uint32_t stall : 1 ;
140
140
uint32_t disable : 1 ;
141
141
uint32_t active : 1 ;
142
- };
142
+ } cmd_sts ;
143
143
}ep_cmd_sts_t ;
144
144
145
145
TU_VERIFY_STATIC ( sizeof (ep_cmd_sts_t ) == 4 , "size is not correct" );
@@ -329,7 +329,7 @@ void dcd_edpt_stall(uint8_t rhport, uint8_t ep_addr)
329
329
330
330
// TODO cannot able to STALL Control OUT endpoint !!!!! FIXME try some walk-around
331
331
uint8_t const ep_id = ep_addr2id (ep_addr );
332
- _dcd .ep [ep_id ][0 ].stall = 1 ;
332
+ _dcd .ep [ep_id ][0 ].cmd_sts . stall = 1 ;
333
333
}
334
334
335
335
void dcd_edpt_clear_stall (uint8_t rhport , uint8_t ep_addr )
@@ -338,9 +338,9 @@ void dcd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr)
338
338
339
339
uint8_t const ep_id = ep_addr2id (ep_addr );
340
340
341
- _dcd .ep [ep_id ][0 ].stall = 0 ;
342
- _dcd .ep [ep_id ][0 ].toggle_reset = 1 ;
343
- _dcd .ep [ep_id ][0 ].toggle_mode = 0 ;
341
+ _dcd .ep [ep_id ][0 ].cmd_sts . stall = 0 ;
342
+ _dcd .ep [ep_id ][0 ].cmd_sts . toggle_reset = 1 ;
343
+ _dcd .ep [ep_id ][0 ].cmd_sts . toggle_mode = 0 ;
344
344
}
345
345
346
346
bool dcd_edpt_open (uint8_t rhport , tusb_desc_endpoint_t const * p_endpoint_desc )
@@ -349,10 +349,10 @@ bool dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc)
349
349
uint8_t ep_id = ep_addr2id (p_endpoint_desc -> bEndpointAddress );
350
350
351
351
// Check if endpoint is available
352
- TU_ASSERT ( _dcd .ep [ep_id ][0 ].disable && _dcd .ep [ep_id ][1 ].disable );
352
+ TU_ASSERT ( _dcd .ep [ep_id ][0 ].cmd_sts . disable && _dcd .ep [ep_id ][1 ]. cmd_sts .disable );
353
353
354
354
edpt_reset (rhport , ep_id );
355
- _dcd .ep [ep_id ][0 ].is_iso = (p_endpoint_desc -> bmAttributes .xfer == TUSB_XFER_ISOCHRONOUS );
355
+ _dcd .ep [ep_id ][0 ].cmd_sts . is_iso = (p_endpoint_desc -> bmAttributes .xfer == TUSB_XFER_ISOCHRONOUS );
356
356
357
357
// Enable EP interrupt
358
358
dcd_registers_t * dcd_reg = _dcd_controller [rhport ].regs ;
@@ -365,8 +365,8 @@ void dcd_edpt_close_all (uint8_t rhport)
365
365
{
366
366
for (uint8_t ep_id = 0 ; ep_id < 2 * _dcd_controller [rhport ].ep_pairs ; ++ ep_id )
367
367
{
368
- _dcd .ep [ep_id ][0 ].active = _dcd .ep [ep_id ][0 ].active = 0 ; // TODO proper way is to EPSKIP then wait ep[][].active then write ep[][].disable (see table 778 in LPC55S69 Use Manual)
369
- _dcd .ep [ep_id ][0 ].disable = _dcd .ep [ep_id ][1 ].disable = 1 ;
368
+ _dcd .ep [ep_id ][0 ].cmd_sts . active = _dcd .ep [ep_id ][0 ]. cmd_sts .active = 0 ; // TODO proper way is to EPSKIP then wait ep[][].active then write ep[][].disable (see table 778 in LPC55S69 Use Manual)
369
+ _dcd .ep [ep_id ][0 ].cmd_sts . disable = _dcd .ep [ep_id ][1 ]. cmd_sts .disable = 1 ;
370
370
}
371
371
}
372
372
@@ -375,8 +375,8 @@ void dcd_edpt_close(uint8_t rhport, uint8_t ep_addr)
375
375
(void ) rhport ;
376
376
377
377
uint8_t ep_id = ep_addr2id (ep_addr );
378
- _dcd .ep [ep_id ][0 ].active = _dcd .ep [ep_id ][0 ].active = 0 ; // TODO proper way is to EPSKIP then wait ep[][].active then write ep[][].disable (see table 778 in LPC55S69 Use Manual)
379
- _dcd .ep [ep_id ][0 ].disable = _dcd .ep [ep_id ][1 ].disable = 1 ;
378
+ _dcd .ep [ep_id ][0 ].cmd_sts . active = _dcd .ep [ep_id ][0 ]. cmd_sts .active = 0 ; // TODO proper way is to EPSKIP then wait ep[][].active then write ep[][].disable (see table 778 in LPC55S69 Use Manual)
379
+ _dcd .ep [ep_id ][0 ].cmd_sts . disable = _dcd .ep [ep_id ][1 ]. cmd_sts .disable = 1 ;
380
380
}
381
381
382
382
static void prepare_ep_xfer (uint8_t rhport , uint8_t ep_id , uint16_t buf_offset , uint16_t total_bytes )
@@ -385,7 +385,7 @@ static void prepare_ep_xfer(uint8_t rhport, uint8_t ep_id, uint16_t buf_offset,
385
385
386
386
if (_dcd_controller [rhport ].max_speed == TUSB_SPEED_FULL )
387
387
{
388
- nbytes = tu_min16 (total_bytes , _dcd .ep [ep_id ][0 ].is_iso ? NBYTES_ISO_FS_MAX : NBYTES_CBI_FS_MAX );
388
+ nbytes = tu_min16 (total_bytes , _dcd .ep [ep_id ][0 ].cmd_sts . is_iso ? NBYTES_ISO_FS_MAX : NBYTES_CBI_FS_MAX );
389
389
_dcd .ep [ep_id ][0 ].buffer_fs .offset = buf_offset ;
390
390
_dcd .ep [ep_id ][0 ].buffer_fs .nbytes = nbytes ;
391
391
}else
@@ -397,7 +397,7 @@ static void prepare_ep_xfer(uint8_t rhport, uint8_t ep_id, uint16_t buf_offset,
397
397
398
398
_dcd .dma [ep_id ].nbytes = nbytes ;
399
399
400
- _dcd .ep [ep_id ][0 ].active = 1 ;
400
+ _dcd .ep [ep_id ][0 ].cmd_sts . active = 1 ;
401
401
}
402
402
403
403
bool dcd_edpt_xfer (uint8_t rhport , uint8_t ep_addr , uint8_t * buffer , uint16_t total_bytes )
@@ -431,7 +431,7 @@ static void bus_reset(uint8_t rhport)
431
431
// disable all endpoints as specified by LPC55S69 UM Table 778
432
432
for (uint8_t ep_id = 0 ; ep_id < 2 * MAX_EP_PAIRS ; ep_id ++ )
433
433
{
434
- _dcd .ep [ep_id ][0 ].disable = _dcd .ep [ep_id ][1 ].disable = 1 ;
434
+ _dcd .ep [ep_id ][0 ].cmd_sts . disable = _dcd .ep [ep_id ][1 ]. cmd_sts .disable = 1 ;
435
435
}
436
436
437
437
dcd_registers_t * dcd_reg = _dcd_controller [rhport ].regs ;
@@ -459,7 +459,7 @@ static void process_xfer_isr(uint8_t rhport, uint32_t int_status)
459
459
if ( ep_id == 0 || ep_id == 1 )
460
460
{
461
461
// For control endpoint, we need to manually clear Active bit
462
- ep_cs -> active = 0 ;
462
+ ep_cs -> cmd_sts . active = 0 ;
463
463
}
464
464
465
465
uint16_t buf_offset ;
@@ -556,8 +556,8 @@ void dcd_int_handler(uint8_t rhport)
556
556
if ( tu_bit_test (int_status , 0 ) && (cmd_stat & CMDSTAT_SETUP_RECEIVED_MASK ) )
557
557
{
558
558
// Follow UM flowchart to clear Active & Stall on both Control IN/OUT endpoints
559
- _dcd .ep [0 ][0 ].active = _dcd .ep [1 ][0 ].active = 0 ;
560
- _dcd .ep [0 ][0 ].stall = _dcd .ep [1 ][0 ].stall = 0 ;
559
+ _dcd .ep [0 ][0 ].cmd_sts . active = _dcd .ep [1 ][0 ]. cmd_sts .active = 0 ;
560
+ _dcd .ep [0 ][0 ].cmd_sts . stall = _dcd .ep [1 ][0 ]. cmd_sts .stall = 0 ;
561
561
562
562
dcd_reg -> DEVCMDSTAT |= CMDSTAT_SETUP_RECEIVED_MASK ;
563
563
0 commit comments