1: uhs_status_t Usbh_Api_CancelPipe(
struct usb_control_block* ucb)
2: {
3: uhs_status_t retval =
UDI_OK;
4: usb_wrap_msgsubtype msgsubtype = USBWRAP_SUBMSG_NONE;
5:
6:
7:
if( Usbh_susres_get_state() != USBH_SUSRES_STS_IDLE ){
8: uhs_debug_print (DBG_ERR, ("ERROR : Don't Call Current State!!"));
9: CORE_REPORT_ERROR(
USBC_ILLEGAL_ERROR );
10:
return UDI_STAT_INVALID_STATE;
11: }
12:
13:
if ( ucb == NULL ) {
14: CORE_REPORT_ERROR(
USBC_INVALID_PARAMETER );
15:
return UDI_STAT_DATA_ERROR;
16: }
17:
18:
switch ( Usbc_Api_GetPipeEpType( ucb->pipe ) ) {
19:
case USB_TRANS_CONTROL:
20: msgsubtype = USBWRAP_SUBMSG_CTLREQ_CANCEL;
21:
break;
22:
case USB_TRANS_BULK:
23: msgsubtype = USBWRAP_SUBMSG_BLKREQ_CANCEL;
24:
break;
25:
case USB_TRANS_INTERRUPT:
26: msgsubtype = USBWRAP_SUBMSG_INTREQ_CANCEL;
27:
break;
28:
case USB_TRANS_ISOCHRONOUS:
29: msgsubtype = USBWRAP_SUBMSG_ISOREQ_CANCEL;
30:
break;
31:
default:
32: CORE_REPORT_ERROR(
USBC_INVALID_PIPE );
33:
return UDI_STAT_DATA_ERROR;
34: }
35:
36: 37: retval = Usbh_SendRequest(
38: (
void*)ucb,
39: ucb->usbdev->usbdev_DevNum,
40: USBWRAP_MSG_REQUEST_CANCEL,
41: msgsubtype );
42:
43:
if( retval !=
UDI_OK) {
44: 45: 46:
47: }
48:
49:
return retval;
50: }