static int st5481_setup_b_out(struct st5481_bcs *bcs) { struct usb_device *dev = bcs->adapter->usb_dev; struct usb_interface *intf; struct usb_host_interface *altsetting = NULL; struct usb_host_endpoint *endpoint; struct st5481_b_out *b_out = &bcs->b_out; DBG(4,""); intf = usb_ifnum_to_if(dev, 0); if (intf) altsetting = usb_altnum_to_altsetting(intf, 3); if (!altsetting) return -ENXIO; // Allocate URBs and buffers for the B channel out endpoint = &altsetting->endpoint[EP_B1_OUT - 1 + bcs->channel * 2]; DBG(4,"endpoint address=%02x,packet size=%d", endpoint->desc.bEndpointAddress, le16_to_cpu(endpoint->desc.wMaxPacketSize)); // Allocate memory for 8000bytes/sec + extra bytes if underrun return st5481_setup_isocpipes(b_out->urb, dev, usb_sndisocpipe(dev, endpoint->desc.bEndpointAddress), NUM_ISO_PACKETS_B, SIZE_ISO_PACKETS_B_OUT, NUM_ISO_PACKETS_B * SIZE_ISO_PACKETS_B_OUT + B_FLOW_ADJUST, usb_b_out_complete, bcs); }
int st5481_setup_in(struct st5481_in *in) { struct usb_device *dev = in->adapter->usb_dev; int retval; DBG(4, ""); in->rcvbuf = kmalloc(in->bufsize, GFP_KERNEL); retval = -ENOMEM; if (!in->rcvbuf) goto err; retval = st5481_setup_isocpipes(in->urb, dev, usb_rcvisocpipe(dev, in->ep), in->num_packets, in->packet_size, in->num_packets * in->packet_size, usb_in_complete, in); if (retval) goto err_free; return 0; err_free: kfree(in->rcvbuf); err: return retval; }
static int st5481_setup_d_out(struct st5481_adapter *adapter) { struct usb_device *dev = adapter->usb_dev; struct usb_interface *intf; struct usb_host_interface *altsetting = NULL; struct usb_host_endpoint *endpoint; struct st5481_d_out *d_out = &adapter->d_out; DBG(2,""); intf = usb_ifnum_to_if(dev, 0); if (intf) altsetting = usb_altnum_to_altsetting(intf, 3); if (!altsetting) return -ENXIO; // Allocate URBs and buffers for the D channel out endpoint = &altsetting->endpoint[EP_D_OUT-1]; DBG(2,"endpoint address=%02x,packet size=%d", endpoint->desc.bEndpointAddress, le16_to_cpu(endpoint->desc.wMaxPacketSize)); return st5481_setup_isocpipes(d_out->urb, dev, usb_sndisocpipe(dev, endpoint->desc.bEndpointAddress), NUM_ISO_PACKETS_D, SIZE_ISO_PACKETS_D_OUT, NUM_ISO_PACKETS_D * SIZE_ISO_PACKETS_D_OUT, usb_d_out_complete, adapter); }
static int __devinit st5481_setup_d_out(struct st5481_adapter *adapter) { struct usb_device *dev = adapter->usb_dev; struct usb_interface_descriptor *altsetting; struct usb_endpoint_descriptor *endpoint; struct st5481_d_out *d_out = &adapter->d_out; DBG(2,""); altsetting = &(dev->config->interface[0].altsetting[3]); // Allocate URBs and buffers for the D channel out endpoint = &altsetting->endpoint[EP_D_OUT-1]; DBG(2,"endpoint address=%02x,packet size=%d", endpoint->bEndpointAddress,endpoint->wMaxPacketSize); return st5481_setup_isocpipes(d_out->urb, dev, usb_sndisocpipe(dev, endpoint->bEndpointAddress), NUM_ISO_PACKETS_D, SIZE_ISO_PACKETS_D_OUT, NUM_ISO_PACKETS_D * SIZE_ISO_PACKETS_D_OUT, usb_d_out_complete, adapter); }
static int __devinit st5481_setup_b_out(struct st5481_bcs *bcs) { struct usb_device *dev = bcs->adapter->usb_dev; struct usb_interface_descriptor *altsetting; struct usb_endpoint_descriptor *endpoint; struct st5481_b_out *b_out = &bcs->b_out; DBG(4,""); altsetting = &(dev->config->interface[0].altsetting[3]); // Allocate URBs and buffers for the B channel out endpoint = &altsetting->endpoint[EP_B1_OUT - 1 + bcs->channel * 2]; DBG(4,"endpoint address=%02x,packet size=%d", endpoint->bEndpointAddress,endpoint->wMaxPacketSize); // Allocate memory for 8000bytes/sec + extra bytes if underrun return st5481_setup_isocpipes(b_out->urb, dev, usb_sndisocpipe(dev, endpoint->bEndpointAddress), NUM_ISO_PACKETS_B, SIZE_ISO_PACKETS_B_OUT, NUM_ISO_PACKETS_B * SIZE_ISO_PACKETS_B_OUT + B_FLOW_ADJUST, usb_b_out_complete, bcs); }