@@ -364,7 +364,7 @@ bool tud_usbtmc_start_bus_read()
364364 case STATE_RCV :
365365 break ;
366366 default :
367- TU_VERIFY ( false) ;
367+ return false;
368368 }
369369 TU_VERIFY (usbd_edpt_xfer (usbtmc_state .rhport , usbtmc_state .ep_bulk_out , usbtmc_state .ep_bulk_out_buf , (uint16_t )usbtmc_state .ep_bulk_out_wMaxPacketSize ));
370370 return true;
@@ -466,61 +466,60 @@ bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
466466 switch (usbtmc_state .state )
467467 {
468468 case STATE_IDLE :
469- TU_VERIFY (xferred_bytes >= sizeof (usbtmc_msg_generic_t ));
470- msg = (usbtmc_msg_generic_t * )(usbtmc_state .ep_bulk_out_buf );
471- uint8_t invInvTag = (uint8_t )~(msg -> header .bTagInverse );
472- TU_VERIFY (msg -> header .bTag == invInvTag );
473- TU_VERIFY (msg -> header .bTag != 0x00 );
474-
475- switch (msg -> header .MsgID ) {
476- case USBTMC_MSGID_DEV_DEP_MSG_OUT :
477- if (!handle_devMsgOutStart (rhport , msg , xferred_bytes ))
478- {
479- usbd_edpt_stall (rhport , usbtmc_state .ep_bulk_out );
480- TU_VERIFY (false);
481- }
482- break ;
469+ {
470+ TU_VERIFY (xferred_bytes >= sizeof (usbtmc_msg_generic_t ));
471+ msg = (usbtmc_msg_generic_t * )(usbtmc_state .ep_bulk_out_buf );
472+ uint8_t invInvTag = (uint8_t )~(msg -> header .bTagInverse );
473+ TU_VERIFY (msg -> header .bTag == invInvTag );
474+ TU_VERIFY (msg -> header .bTag != 0x00 );
475+
476+ switch (msg -> header .MsgID ) {
477+ case USBTMC_MSGID_DEV_DEP_MSG_OUT :
478+ if (!handle_devMsgOutStart (rhport , msg , xferred_bytes ))
479+ {
480+ usbd_edpt_stall (rhport , usbtmc_state .ep_bulk_out );
481+ return false;
482+ }
483+ break ;
483484
484- case USBTMC_MSGID_DEV_DEP_MSG_IN :
485- TU_VERIFY (handle_devMsgIn (msg , xferred_bytes ));
486- break ;
485+ case USBTMC_MSGID_DEV_DEP_MSG_IN :
486+ TU_VERIFY (handle_devMsgIn (msg , xferred_bytes ));
487+ break ;
487488
488489#if (CFG_TUD_USBTMC_ENABLE_488 )
489- case USBTMC_MSGID_USB488_TRIGGER :
490- // Spec says we halt the EP if we didn't declare we support it.
491- TU_VERIFY (usbtmc_state .capabilities -> bmIntfcCapabilities488 .supportsTrigger );
492- TU_VERIFY (tud_usbtmc_msg_trigger_cb (msg ));
490+ case USBTMC_MSGID_USB488_TRIGGER :
491+ // Spec says we halt the EP if we didn't declare we support it.
492+ TU_VERIFY (usbtmc_state .capabilities -> bmIntfcCapabilities488 .supportsTrigger );
493+ TU_VERIFY (tud_usbtmc_msg_trigger_cb (msg ));
493494
494- break ;
495+ break ;
495496#endif
496- case USBTMC_MSGID_VENDOR_SPECIFIC_MSG_OUT :
497- case USBTMC_MSGID_VENDOR_SPECIFIC_IN :
498- default :
499- usbd_edpt_stall (rhport , usbtmc_state .ep_bulk_out );
500- TU_VERIFY (false);
501- return false;
497+ case USBTMC_MSGID_VENDOR_SPECIFIC_MSG_OUT :
498+ case USBTMC_MSGID_VENDOR_SPECIFIC_IN :
499+ default :
500+ usbd_edpt_stall (rhport , usbtmc_state .ep_bulk_out );
501+ return false;
502+ }
503+ return true;
502504 }
503- return true;
504-
505505 case STATE_RCV :
506506 if (!handle_devMsgOut (rhport , usbtmc_state .ep_bulk_out_buf , xferred_bytes , xferred_bytes ))
507507 {
508508 usbd_edpt_stall (rhport , usbtmc_state .ep_bulk_out );
509- TU_VERIFY ( false) ;
509+ return false;
510510 }
511511 return true;
512512
513513 case STATE_ABORTING_BULK_OUT :
514- TU_VERIFY (false);
515- return false; // Should be stalled by now, shouldn't have received a packet.
514+ return false;
516515
517516 case STATE_TX_REQUESTED :
518517 case STATE_TX_INITIATED :
519518 case STATE_ABORTING_BULK_IN :
520519 case STATE_ABORTING_BULK_IN_SHORTED :
521520 case STATE_ABORTING_BULK_IN_ABORTED :
522521 default :
523- TU_VERIFY ( false) ;
522+ return false;
524523 }
525524 }
526525 else if (ep_addr == usbtmc_state .ep_bulk_in )
@@ -569,7 +568,6 @@ bool usbtmcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
569568
570569 default :
571570 TU_ASSERT (false);
572- return false;
573571 }
574572 }
575573 else if (ep_addr == usbtmc_state .ep_int_in ) {
@@ -873,16 +871,13 @@ bool usbtmcd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request
873871 case USB488_bREQUEST_LOCAL_LOCKOUT :
874872 {
875873 TU_VERIFY (request -> bmRequestType == 0xA1 ); // in,class,interface
876- TU_VERIFY (false);
877874 return false;
878875 }
879876#endif
880877
881878 default :
882- TU_VERIFY (false);
883879 return false;
884880 }
885- TU_VERIFY (false);
886881}
887882
888883#endif /* CFG_TUD_TSMC */
0 commit comments