/*FUNCTION*---------------------------------------------------------------- * * Function Name : usb_dev_list_close_pipe * Returned Value : * Comments : * Cancel pending TR's and close a pipe. * *END*--------------------------------------------------------------------*/ static void usb_dev_list_close_pipe ( _usb_host_handle handle, PIPE_DESCRIPTOR_STRUCT_PTR pipe_ptr ) { /* Body */ USB_STATUS status; USB_HOST_STATE_STRUCT_PTR usb_host_ptr; PIPE_TR_STRUCT_PTR tr_ptr; if (pipe_ptr == NULL) { return; } usb_host_ptr = (USB_HOST_STATE_STRUCT_PTR)handle; USB_lock(); /* Cancel all active TR's in the pipe */ tr_ptr = pipe_ptr->tr_list_ptr; if (tr_ptr) { while (tr_ptr->TR_INDEX != 0) { tr_ptr->CALLBACK = NULL; /* no surprises */ /* Cancel the transfer at low-level */ status = _usb_host_cancel_call_interface (handle, pipe_ptr, tr_ptr); if (status != USB_OK) { } /* Indicate that the TR is idle */ tr_ptr->TR_INDEX = 0; tr_ptr->status = USB_STATUS_IDLE; tr_ptr = tr_ptr->next; } /* EndWhile */ } /* Endif */ /* zero the pipe descriptor, except keep TR list */ tr_ptr = pipe_ptr->tr_list_ptr; _usb_host_close_pipe(handle, (pointer)pipe_ptr); pipe_ptr->tr_list_ptr = tr_ptr; USB_unlock(); } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : usb_dev_list_close_pipe * Returned Value : * Comments : * Cancel pending TR's and close a pipe. * *END*--------------------------------------------------------------------*/ static void usb_dev_list_close_pipe ( _usb_host_handle handle, PIPE_STRUCT_PTR pipe_ptr ) { /* Body */ USB_STATUS status; USB_HOST_STATE_STRUCT_PTR usb_host_ptr; TR_STRUCT_PTR tr_ptr; #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("usb_dev_list_close_pipe"); #endif if (pipe_ptr == NULL) { #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("usb_dev_list_close_pipe NULL pipe"); #endif return; } usb_host_ptr = (USB_HOST_STATE_STRUCT_PTR)handle; USB_lock(); /* Cancel all active TR's in the pipe */ tr_ptr = pipe_ptr->tr_list_ptr; if (tr_ptr != NULL) { do { //tr_ptr->CALLBACK = NULL; if (tr_ptr->TR_INDEX != 0) { tr_ptr->FLAG &= ~TR_CANCEL_ASYNC; /* Cancel the transfer at low-level */ status = _usb_host_cancel_call_interface(handle, pipe_ptr, tr_ptr); if (status != USB_OK) { #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("usb_dev_list_close_pipe failed to cancel transaction"); #endif } } tr_ptr->STATUS = USB_STATUS_IDLE; /* Indicate that the TR is idle */ tr_ptr->TR_INDEX = 0; tr_ptr = tr_ptr->NEXT; } while (tr_ptr != pipe_ptr->tr_list_ptr); //this indicates end of queue } /* EndWhile */ /* zero the pipe descriptor, except keep TR list */ tr_ptr = pipe_ptr->tr_list_ptr; _usb_host_close_pipe(handle, (pointer)pipe_ptr); pipe_ptr->tr_list_ptr = tr_ptr; USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("usb_dev_list_close_pipe SUCCESSFUL"); #endif } /* EndBody */
/*FUNCTION*---------------------------------------------------------------- * * Function Name : usb_dev_list_close_pipe * Returned Value : * Comments : * Cancel pending TR's and close a pipe. * *END*--------------------------------------------------------------------*/ void usb_dev_list_close_pipe ( _usb_host_handle handle, PIPE_DESCRIPTOR_STRUCT_PTR pipe_ptr ) { /* Body */ USB_HOST_STATE_STRUCT_PTR usb_host_ptr; PIPE_TR_STRUCT_PTR tr_ptr; #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("usb_dev_list_close_pipe"); DEBUGMSG(USB_DBG_LEVEL, ("usb_dev_list_close_pipe\n")); #endif if (pipe_ptr == NULL) { #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("usb_dev_list_close_pipe NULL pipe"); #endif return; } usb_host_ptr = (USB_HOST_STATE_STRUCT_PTR)handle; USB_lock(); #ifdef __VUSB32__ _usb_host_cancel_transfer(handle, pipe_ptr, 0); #endif /* Cancel all active TR's in the pipe */ tr_ptr = pipe_ptr->tr_list_ptr; if (tr_ptr) { while (tr_ptr->TR_INDEX != 0) { tr_ptr->CALLBACK = NULL; /* no surprises */ #ifndef __VUSB32__ #ifdef __USB_OS_MQX__ /* Cancel the transfer at low-level */ ((USB_CALLBACK_FUNCTIONS_STRUCT_PTR)usb_host_ptr->CALLBACK_STRUCT_PTR)->\ HOST_CANCEL(handle, pipe_ptr, tr_ptr); #else _usb_hci_vusb20_cancel_transfer(handle, pipe_ptr, tr_ptr); #endif #endif /* Indicate that the TR is idle */ tr_ptr->TR_INDEX = 0; tr_ptr->status = USB_STATUS_IDLE; tr_ptr = tr_ptr->next; } /* EndWhile */ } /* Endif */ /* zero the pipe descriptor, except keep TR list */ tr_ptr = pipe_ptr->tr_list_ptr; _usb_host_close_pipe(handle, (pointer)pipe_ptr); pipe_ptr->tr_list_ptr = tr_ptr; USB_unlock(); #ifdef _HOST_DEBUG_ DEBUG_LOG_TRACE("usb_dev_list_close_pipe SUCCESSFUL"); #endif } /* EndBody */