/* * pipe operations */ static int uftdi_open_pipes(uftdi_state_t *uf) { int ifc, alt; usb_pipe_policy_t policy; usb_ep_data_t *in_data, *out_data; /* get ep data */ ifc = uf->uf_dev_data->dev_curr_if; alt = 0; in_data = usb_lookup_ep_data(uf->uf_dip, uf->uf_dev_data, ifc, alt, 0, USB_EP_ATTR_BULK, USB_EP_DIR_IN); out_data = usb_lookup_ep_data(uf->uf_dip, uf->uf_dev_data, ifc, alt, 0, USB_EP_ATTR_BULK, USB_EP_DIR_OUT); if (in_data == NULL || out_data == NULL) { USB_DPRINTF_L2(DPRINT_ATTACH, uf->uf_lh, "uftdi_open_pipes: can't get ep data"); return (USB_FAILURE); } /* open pipes */ policy.pp_max_async_reqs = 2; if (usb_pipe_open(uf->uf_dip, &in_data->ep_descr, &policy, USB_FLAGS_SLEEP, &uf->uf_bulkin_ph) != USB_SUCCESS) return (USB_FAILURE); if (usb_pipe_open(uf->uf_dip, &out_data->ep_descr, &policy, USB_FLAGS_SLEEP, &uf->uf_bulkout_ph) != USB_SUCCESS) { usb_pipe_close(uf->uf_dip, uf->uf_bulkin_ph, USB_FLAGS_SLEEP, NULL, NULL); return (USB_FAILURE); } mutex_enter(&uf->uf_lock); uf->uf_bulkin_state = UFTDI_PIPE_IDLE; uf->uf_bulkout_state = UFTDI_PIPE_IDLE; mutex_exit(&uf->uf_lock); return (USB_SUCCESS); }
int usba10_usb_pipe_open( dev_info_t *dip, usb_ep_descr_t *ep, usb_pipe_policy_t *pipe_policy, usb_flags_t flags, usb_pipe_handle_t *pipe_handle) { return (usb_pipe_open(dip, ep, pipe_policy, flags, pipe_handle)); }