您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ usb_sndisocpipe函数代码示例

51自学网 2021-06-03 09:21:28
  C++
这篇教程C++ usb_sndisocpipe函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中usb_sndisocpipe函数的典型用法代码示例。如果您正苦于以下问题:C++ usb_sndisocpipe函数的具体用法?C++ usb_sndisocpipe怎么用?C++ usb_sndisocpipe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了usb_sndisocpipe函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: btusb_send_frame

static int btusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb){	struct btusb_data *data = hci_get_drvdata(hdev);	struct usb_ctrlrequest *dr;	struct urb *urb;	unsigned int pipe;	int err;	BT_DBG("%s", hdev->name);	if (!test_bit(HCI_RUNNING, &hdev->flags))		return -EBUSY;	skb->dev = (void *) hdev;	switch (bt_cb(skb)->pkt_type) {	case HCI_COMMAND_PKT:		urb = usb_alloc_urb(0, GFP_ATOMIC);		if (!urb)			return -ENOMEM;		dr = kmalloc(sizeof(*dr), GFP_ATOMIC);		if (!dr) {			usb_free_urb(urb);			return -ENOMEM;		}		dr->bRequestType = data->cmdreq_type;		dr->bRequest     = 0;		dr->wIndex       = 0;		dr->wValue       = 0;		dr->wLength      = __cpu_to_le16(skb->len);		pipe = usb_sndctrlpipe(data->udev, 0x00);		usb_fill_control_urb(urb, data->udev, pipe, (void *) dr,				skb->data, skb->len, btusb_tx_complete, skb);		hdev->stat.cmd_tx++;		break;	case HCI_ACLDATA_PKT:		if (!data->bulk_tx_ep)			return -ENODEV;		urb = usb_alloc_urb(0, GFP_ATOMIC);		if (!urb)			return -ENOMEM;		pipe = usb_sndbulkpipe(data->udev,					data->bulk_tx_ep->bEndpointAddress);		usb_fill_bulk_urb(urb, data->udev, pipe,				skb->data, skb->len, btusb_tx_complete, skb);		hdev->stat.acl_tx++;		break;	case HCI_SCODATA_PKT:		if (!data->isoc_tx_ep || hci_conn_num(hdev, SCO_LINK) < 1)			return -ENODEV;		urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, GFP_ATOMIC);		if (!urb)			return -ENOMEM;		pipe = usb_sndisocpipe(data->udev,					data->isoc_tx_ep->bEndpointAddress);		usb_fill_int_urb(urb, data->udev, pipe,				skb->data, skb->len, btusb_isoc_tx_complete,				skb, data->isoc_tx_ep->bInterval);		urb->transfer_flags  = URB_ISO_ASAP;		__fill_isoc_descriptor(urb, skb->len,				le16_to_cpu(data->isoc_tx_ep->wMaxPacketSize));		hdev->stat.sco_tx++;		goto skip_waking;	default:		return -EILSEQ;	}	err = inc_tx(data);	if (err) {		usb_anchor_urb(urb, &data->deferred);		schedule_work(&data->waker);		err = 0;		goto done;	}skip_waking:	usb_anchor_urb(urb, &data->tx_anchor);	err = usb_submit_urb(urb, GFP_ATOMIC);	if (err < 0) {		if (err != -EPERM && err != -ENODEV)			BT_ERR("%s urb %p submission failed (%d)",//.........这里部分代码省略.........
开发者ID:ArchangelSmarth,项目名称:linux,代码行数:101,


示例2: line6_init_pcm

/*	Create and register the PCM device and mixer entries.	Create URBs for playback and capture.*/int line6_init_pcm(struct usb_line6 *line6,		   struct line6_pcm_properties *properties){	int i, err;	unsigned ep_read = line6->properties->ep_audio_r;	unsigned ep_write = line6->properties->ep_audio_w;	struct snd_pcm *pcm;	struct snd_line6_pcm *line6pcm;	if (!(line6->properties->capabilities & LINE6_CAP_PCM))		return 0;	/* skip PCM initialization and report success */	err = snd_line6_new_pcm(line6, &pcm);	if (err < 0)		return err;	line6pcm = kzalloc(sizeof(*line6pcm), GFP_KERNEL);	if (!line6pcm)		return -ENOMEM;	mutex_init(&line6pcm->state_mutex);	line6pcm->pcm = pcm;	line6pcm->properties = properties;	line6pcm->volume_playback[0] = line6pcm->volume_playback[1] = 255;	line6pcm->volume_monitor = 255;	line6pcm->line6 = line6;	/* Read and write buffers are sized identically, so choose minimum */	line6pcm->max_packet_size = min(			usb_maxpacket(line6->usbdev,				usb_rcvisocpipe(line6->usbdev, ep_read), 0),			usb_maxpacket(line6->usbdev,				usb_sndisocpipe(line6->usbdev, ep_write), 1));	spin_lock_init(&line6pcm->out.lock);	spin_lock_init(&line6pcm->in.lock);	line6pcm->impulse_period = LINE6_IMPULSE_DEFAULT_PERIOD;	line6->line6pcm = line6pcm;	pcm->private_data = line6pcm;	pcm->private_free = line6_cleanup_pcm;	err = line6_create_audio_out_urbs(line6pcm);	if (err < 0)		return err;	err = line6_create_audio_in_urbs(line6pcm);	if (err < 0)		return err;	/* mixer: */	for (i = 0; i < ARRAY_SIZE(line6_controls); i++) {		err = snd_ctl_add(line6->card,				  snd_ctl_new1(&line6_controls[i], line6pcm));		if (err < 0)			return err;	}	return 0;}
开发者ID:020gzh,项目名称:linux,代码行数:65,


示例3: detect_usb_format

static int detect_usb_format(struct ua101 *ua){    const struct uac_format_type_i_discrete_descriptor *fmt_capture;    const struct uac_format_type_i_discrete_descriptor *fmt_playback;    const struct usb_endpoint_descriptor *epd;    unsigned int rate2;    fmt_capture = find_format_descriptor(ua->intf[INTF_CAPTURE]);    fmt_playback = find_format_descriptor(ua->intf[INTF_PLAYBACK]);    if (!fmt_capture || !fmt_playback)        return -ENXIO;    switch (fmt_capture->bSubframeSize) {    case 3:        ua->format_bit = SNDRV_PCM_FMTBIT_S24_3LE;        break;    case 4:        ua->format_bit = SNDRV_PCM_FMTBIT_S32_LE;        break;    default:        dev_err(&ua->dev->dev, "sample width is not 24 or 32 bits/n");        return -ENXIO;    }    if (fmt_capture->bSubframeSize != fmt_playback->bSubframeSize) {        dev_err(&ua->dev->dev,                "playback/capture sample widths do not match/n");        return -ENXIO;    }    if (fmt_capture->bBitResolution != 24 ||            fmt_playback->bBitResolution != 24) {        dev_err(&ua->dev->dev, "sample width is not 24 bits/n");        return -ENXIO;    }    ua->rate = combine_triple(fmt_capture->tSamFreq[0]);    rate2 = combine_triple(fmt_playback->tSamFreq[0]);    if (ua->rate != rate2) {        dev_err(&ua->dev->dev,                "playback/capture rates do not match: %u/%u/n",                rate2, ua->rate);        return -ENXIO;    }    switch (ua->dev->speed) {    case USB_SPEED_FULL:        ua->packets_per_second = 1000;        break;    case USB_SPEED_HIGH:        ua->packets_per_second = 8000;        break;    default:        dev_err(&ua->dev->dev, "unknown device speed/n");        return -ENXIO;    }    ua->capture.channels = fmt_capture->bNrChannels;    ua->playback.channels = fmt_playback->bNrChannels;    ua->capture.frame_bytes =        fmt_capture->bSubframeSize * ua->capture.channels;    ua->playback.frame_bytes =        fmt_playback->bSubframeSize * ua->playback.channels;    epd = &ua->intf[INTF_CAPTURE]->altsetting[1].endpoint[0].desc;    if (!usb_endpoint_is_isoc_in(epd)) {        dev_err(&ua->dev->dev, "invalid capture endpoint/n");        return -ENXIO;    }    ua->capture.usb_pipe = usb_rcvisocpipe(ua->dev, usb_endpoint_num(epd));    ua->capture.max_packet_bytes = le16_to_cpu(epd->wMaxPacketSize);    epd = &ua->intf[INTF_PLAYBACK]->altsetting[1].endpoint[0].desc;    if (!usb_endpoint_is_isoc_out(epd)) {        dev_err(&ua->dev->dev, "invalid playback endpoint/n");        return -ENXIO;    }    ua->playback.usb_pipe = usb_sndisocpipe(ua->dev, usb_endpoint_num(epd));    ua->playback.max_packet_bytes = le16_to_cpu(epd->wMaxPacketSize);    return 0;}
开发者ID:jerem,项目名称:hi35xx-buildroot,代码行数:80,


示例4: usbduxsigma_alloc_usb_buffers

static int usbduxsigma_alloc_usb_buffers(struct comedi_device *dev){	struct usb_device *usb = comedi_to_usb_dev(dev);	struct usbduxsigma_private *devpriv = dev->private;	struct urb *urb;	int i;	devpriv->dux_commands = kzalloc(SIZEOFDUXBUFFER, GFP_KERNEL);	devpriv->in_buf = kzalloc(SIZEINBUF, GFP_KERNEL);	devpriv->insn_buf = kzalloc(SIZEINSNBUF, GFP_KERNEL);	devpriv->ai_urbs = kcalloc(devpriv->n_ai_urbs, sizeof(urb), GFP_KERNEL);	devpriv->ao_urbs = kcalloc(devpriv->n_ao_urbs, sizeof(urb), GFP_KERNEL);	if (!devpriv->dux_commands || !devpriv->in_buf || !devpriv->insn_buf ||	    !devpriv->ai_urbs || !devpriv->ao_urbs)		return -ENOMEM;	for (i = 0; i < devpriv->n_ai_urbs; i++) {		/* one frame: 1ms */		urb = usb_alloc_urb(1, GFP_KERNEL);		if (!urb)			return -ENOMEM;		devpriv->ai_urbs[i] = urb;		urb->dev = usb;		/* will be filled later with a pointer to the comedi-device */		/* and ONLY then the urb should be submitted */		urb->context = NULL;		urb->pipe = usb_rcvisocpipe(usb, 6);		urb->transfer_flags = URB_ISO_ASAP;		urb->transfer_buffer = kzalloc(SIZEINBUF, GFP_KERNEL);		if (!urb->transfer_buffer)			return -ENOMEM;		urb->complete = usbduxsigma_ai_urb_complete;		urb->number_of_packets = 1;		urb->transfer_buffer_length = SIZEINBUF;		urb->iso_frame_desc[0].offset = 0;		urb->iso_frame_desc[0].length = SIZEINBUF;	}	for (i = 0; i < devpriv->n_ao_urbs; i++) {		/* one frame: 1ms */		urb = usb_alloc_urb(1, GFP_KERNEL);		if (!urb)			return -ENOMEM;		devpriv->ao_urbs[i] = urb;		urb->dev = usb;		/* will be filled later with a pointer to the comedi-device */		/* and ONLY then the urb should be submitted */		urb->context = NULL;		urb->pipe = usb_sndisocpipe(usb, 2);		urb->transfer_flags = URB_ISO_ASAP;		urb->transfer_buffer = kzalloc(SIZEOUTBUF, GFP_KERNEL);		if (!urb->transfer_buffer)			return -ENOMEM;		urb->complete = usbduxsigma_ao_urb_complete;		urb->number_of_packets = 1;		urb->transfer_buffer_length = SIZEOUTBUF;		urb->iso_frame_desc[0].offset = 0;		urb->iso_frame_desc[0].length = SIZEOUTBUF;		if (devpriv->high_speed)			urb->interval = 8;	/* uframes */		else			urb->interval = 1;	/* frames */	}	if (devpriv->pwm_buf_sz) {		urb = usb_alloc_urb(0, GFP_KERNEL);		if (!urb)			return -ENOMEM;		devpriv->pwm_urb = urb;		urb->transfer_buffer = kzalloc(devpriv->pwm_buf_sz,					       GFP_KERNEL);		if (!urb->transfer_buffer)			return -ENOMEM;	}	return 0;}
开发者ID:3null,项目名称:linux,代码行数:78,


示例5: btusb_send_frame

static int btusb_send_frame(struct sk_buff *skb){	struct hci_dev *hdev = (struct hci_dev *) skb->dev;	struct btusb_data *data = hdev->driver_data;	struct usb_ctrlrequest *dr;	struct urb *urb;	unsigned int pipe;	int err;	void *hci_usb_tx_buf_t=hci_usb_tx_buf;	char i=0;	BT_DBG("%s", hdev->name);	if (!test_bit(HCI_RUNNING, &hdev->flags))		return -EBUSY;	switch (bt_cb(skb)->pkt_type) {	case HCI_COMMAND_PKT:		urb = usb_alloc_urb(0, GFP_ATOMIC);		if (!urb)			return -ENOMEM;		dr = kmalloc(sizeof(*dr), GFP_ATOMIC);		if (!dr) {			usb_free_urb(urb);			return -ENOMEM;		}		dr->bRequestType = data->cmdreq_type;		dr->bRequest     = 0;		dr->wIndex       = 0;		dr->wValue       = 0;		dr->wLength      = __cpu_to_le16(skb->len);		pipe = usb_sndctrlpipe(data->udev, 0x00);		usb_fill_control_urb(urb, data->udev, pipe, (void *) dr,				skb->data, skb->len, btusb_tx_complete, skb);		hdev->stat.cmd_tx++;		break;	case HCI_ACLDATA_PKT:		if (!data->bulk_tx_ep || hdev->conn_hash.acl_num < 1)			return -ENODEV;		urb = usb_alloc_urb(0, GFP_ATOMIC);		if (!urb)			return -ENOMEM;		pipe = usb_sndbulkpipe(data->udev,					data->bulk_tx_ep->bEndpointAddress);		usb_fill_bulk_urb(urb, data->udev, pipe,				skb->data, skb->len, btusb_tx_complete, skb);		hdev->stat.acl_tx++;		break;	case HCI_SCODATA_PKT:				if (!data->isoc_tx_ep || hdev->conn_hash.sco_num < 1)			return -ENODEV;		urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, GFP_ATOMIC);		if (!urb)			return -ENOMEM;		pipe = usb_sndisocpipe(data->udev,					data->isoc_tx_ep->bEndpointAddress);		urb->dev      = data->udev;		urb->pipe     = pipe;		urb->context  = skb;		urb->complete = btusb_isoc_tx_complete;		urb->interval = data->isoc_tx_ep->bInterval;			urb->transfer_flags  = URB_ISO_ASAP;				for (i=0; i < HCI_MAX_ISOC_FRAMES; i++) {			memcpy((hci_usb_tx_buf_t + HCI_USB_OFFSET*i), &(skb->data[17*i]), 17);		}		urb->transfer_buffer = hci_usb_tx_buf_t;		urb->transfer_buffer_length = SCO_BUF_SIZE;				__fill_isoc_descriptor(urb, SCO_BUF_SIZE,				le16_to_cpu(data->isoc_tx_ep->wMaxPacketSize));		hdev->stat.sco_tx++;		goto skip_waking;	default://.........这里部分代码省略.........
开发者ID:CoreTech-Development,项目名称:buildroot-linux-kernel,代码行数:101,


示例6: btusb_send_frame

static int btusb_send_frame(struct sk_buff *skb){    struct hci_dev *hdev = (struct hci_dev *) skb->dev;    struct btusb_data *data = GET_DRV_DATA(hdev);    struct usb_ctrlrequest *dr;    struct urb *urb;    unsigned int pipe;    int err;    /*	u16* opcode = (u16*)(skb->data);    	uint wlength = skb->len;    	uint icount=0;    	 RTKBT_DBG("==========%s opcode=0x%x,wlength = %d",__FUNCTION__,*opcode,wlength );    		printk("==========wlength=%d /n",wlength);    		for(icount=0;icount <wlength;icount++)    		{    	   		printk("0x%x ",*(opcode+icount) );    		}    		printk("/n==========");    */    BT_DBG("%s", hdev->name);    if (!test_bit(HCI_RUNNING, &hdev->flags))        return -EBUSY;    switch (bt_cb(skb)->pkt_type) {    case HCI_COMMAND_PKT:        urb = usb_alloc_urb(0, GFP_ATOMIC);        if (!urb)            return -ENOMEM;        dr = kmalloc(sizeof(*dr), GFP_ATOMIC);        if (!dr) {            usb_free_urb(urb);            return -ENOMEM;        }        dr->bRequestType = data->cmdreq_type;        dr->bRequest     = 0;        dr->wIndex       = 0;        dr->wValue       = 0;        dr->wLength      = __cpu_to_le16(skb->len);        pipe = usb_sndctrlpipe(data->udev, 0x00);        usb_fill_control_urb(urb, data->udev, pipe, (void *) dr,                             skb->data, skb->len, btusb_tx_complete, skb);        hdev->stat.cmd_tx++;        break;    case HCI_ACLDATA_PKT:        if (!data->bulk_tx_ep)            return -ENODEV;        urb = usb_alloc_urb(0, GFP_ATOMIC);        if (!urb)            return -ENOMEM;        pipe = usb_sndbulkpipe(data->udev,                               data->bulk_tx_ep->bEndpointAddress);        usb_fill_bulk_urb(urb, data->udev, pipe,                          skb->data, skb->len, btusb_tx_complete, skb);        hdev->stat.acl_tx++;        break;    case HCI_SCODATA_PKT:        if (!data->isoc_tx_ep || hdev->conn_hash.sco_num < 1)            return -ENODEV;        urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, GFP_ATOMIC);        if (!urb)            return -ENOMEM;        pipe = usb_sndisocpipe(data->udev,                               data->isoc_tx_ep->bEndpointAddress);        usb_fill_int_urb(urb, data->udev, pipe,                         skb->data, skb->len, btusb_isoc_tx_complete,                         skb, data->isoc_tx_ep->bInterval);        urb->transfer_flags  = URB_ISO_ASAP;        __fill_isoc_descriptor(urb, skb->len,                               le16_to_cpu(data->isoc_tx_ep->wMaxPacketSize));        hdev->stat.sco_tx++;        goto skip_waking;    default:        return -EILSEQ;    }    err = inc_tx(data);    if (err) {        usb_anchor_urb(urb, &data->deferred);//.........这里部分代码省略.........
开发者ID:mattgorski,项目名称:platform_hardware_realtek,代码行数:101,


示例7: btusb_send_frame

static int btusb_send_frame(struct sk_buff *skb){	struct hci_dev *hdev = (struct hci_dev *) skb->dev;	struct btusb_data *data = hdev->driver_data;	struct usb_ctrlrequest *dr;	struct urb *urb;	unsigned int pipe;	int err;	BT_DBG("%s", hdev->name);	if (!test_bit(HCI_RUNNING, &hdev->flags))		return -EBUSY;	switch (bt_cb(skb)->pkt_type) {	case HCI_COMMAND_PKT:		urb = usb_alloc_urb(0, GFP_ATOMIC);		if (!urb)			return -ENOMEM;		dr = kmalloc(sizeof(*dr), GFP_ATOMIC);		if (!dr) {			usb_free_urb(urb);			return -ENOMEM;		}		dr->bRequestType = data->cmdreq_type;		dr->bRequest     = 0;		dr->wIndex       = 0;		dr->wValue       = 0;		dr->wLength      = __cpu_to_le16(skb->len);		pipe = usb_sndctrlpipe(data->udev, 0x00);		usb_fill_control_urb(urb, data->udev, pipe, (void *) dr,				skb->data, skb->len, btusb_tx_complete, skb);		hdev->stat.cmd_tx++;		break;	case HCI_ACLDATA_PKT:		if (!data->bulk_tx_ep || hdev->conn_hash.acl_num < 1)			return -ENODEV;		urb = usb_alloc_urb(0, GFP_ATOMIC);		if (!urb)			return -ENOMEM;		pipe = usb_sndbulkpipe(data->udev,					data->bulk_tx_ep->bEndpointAddress);		usb_fill_bulk_urb(urb, data->udev, pipe,				skb->data, skb->len, btusb_tx_complete, skb);		hdev->stat.acl_tx++;		break;	case HCI_SCODATA_PKT:		if (!data->isoc_tx_ep || hdev->conn_hash.sco_num < 1)			return -ENODEV;		urb = usb_alloc_urb(BTUSB_MAX_ISOC_FRAMES, GFP_ATOMIC);		if (!urb)			return -ENOMEM;		pipe = usb_sndisocpipe(data->udev,					data->isoc_tx_ep->bEndpointAddress);		urb->dev      = data->udev;		urb->pipe     = pipe;		urb->context  = skb;		urb->complete = btusb_tx_complete;		urb->interval = data->isoc_tx_ep->bInterval;		urb->transfer_flags  = URB_ISO_ASAP;		urb->transfer_buffer = skb->data;		urb->transfer_buffer_length = skb->len;		__fill_isoc_descriptor(urb, skb->len,				le16_to_cpu(data->isoc_tx_ep->wMaxPacketSize));		hdev->stat.sco_tx++;		break;	default:		return -EILSEQ;	}	usb_anchor_urb(urb, &data->tx_anchor);	err = usb_submit_urb(urb, GFP_ATOMIC);	if (err < 0) {		BT_ERR("%s urb %p submission failed", hdev->name, urb);		kfree(urb->setup_packet);		usb_unanchor_urb(urb);	}	usb_free_urb(urb);	return err;//.........这里部分代码省略.........
开发者ID:10x-Amin,项目名称:x10_Th_kernel,代码行数:101,


示例8: usb_hif_setup_pipe_resources

A_STATUS usb_hif_setup_pipe_resources(HIF_DEVICE_USB *device){	struct usb_interface *interface = device->interface;	struct usb_host_interface *iface_desc = interface->cur_altsetting;	struct usb_endpoint_descriptor *endpoint;	int i;	int urbcount;	A_STATUS status = A_OK;	HIF_USB_PIPE *pipe;	A_UINT8 pipe_num;	/* walk decriptors and setup pipes */	for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {		endpoint = &iface_desc->endpoint[i].desc;		if (IS_BULK_EP(endpoint->bmAttributes)) {			AR_DEBUG_PRINTF(USB_HIF_DEBUG_ENUM, (					 "%s Bulk Ep:0x%2.2X " "maxpktsz:%d/n",					 IS_DIR_IN(endpoint->bEndpointAddress) ?					 "RX" : "TX",					 endpoint->bEndpointAddress,					 le16_to_cpu					 (endpoint->wMaxPacketSize)));		} else if (IS_INT_EP(endpoint->bmAttributes)) {			AR_DEBUG_PRINTF(USB_HIF_DEBUG_ENUM, (					 "%s Int Ep:0x%2.2X maxpktsz:%d interval:%d/n",					 IS_DIR_IN(endpoint->bEndpointAddress) ?					 "RX" : "TX",					 endpoint->bEndpointAddress,					 le16_to_cpu(endpoint->wMaxPacketSize),					 endpoint->bInterval));		} else if (IS_ISOC_EP(endpoint->bmAttributes)) {			/* TODO for ISO */			AR_DEBUG_PRINTF(USB_HIF_DEBUG_ENUM, (					 "%s ISOC Ep:0x%2.2X maxpktsz:%d interval:%d/n",					 IS_DIR_IN(endpoint->bEndpointAddress) ?					 "RX" : "TX",					 endpoint->bEndpointAddress,					 le16_to_cpu(endpoint->wMaxPacketSize),					 endpoint->bInterval));		}		urbcount = 0;		pipe_num = usb_hif_get_logical_pipe_num(device,							endpoint->							bEndpointAddress,							&urbcount);		if (HIF_USB_PIPE_INVALID == pipe_num)			continue;		pipe = &device->pipes[pipe_num];		if (pipe->device != NULL) {			/* hmmm..pipe was already setup */			continue;		}		pipe->device = device;		pipe->logical_pipe_num = pipe_num;		pipe->ep_address = endpoint->bEndpointAddress;		pipe->max_packet_size = le16_to_cpu(endpoint->wMaxPacketSize);		if (IS_BULK_EP(endpoint->bmAttributes)) {			if (IS_DIR_IN(pipe->ep_address)) {				pipe->usb_pipe_handle =				    usb_rcvbulkpipe(device->udev,						    pipe->ep_address);			} else {				pipe->usb_pipe_handle =				    usb_sndbulkpipe(device->udev,						    pipe->ep_address);			}		} else if (IS_INT_EP(endpoint->bmAttributes)) {			if (IS_DIR_IN(pipe->ep_address)) {				pipe->usb_pipe_handle =				    usb_rcvintpipe(device->udev,						   pipe->ep_address);			} else {				pipe->usb_pipe_handle =				    usb_sndintpipe(device->udev,						   pipe->ep_address);			}		} else if (IS_ISOC_EP(endpoint->bmAttributes)) {			/* TODO for ISO */			if (IS_DIR_IN(pipe->ep_address)) {				pipe->usb_pipe_handle =				    usb_rcvisocpipe(device->udev,						    pipe->ep_address);			} else {				pipe->usb_pipe_handle =				    usb_sndisocpipe(device->udev,						    pipe->ep_address);			}		}		pipe->ep_desc = endpoint;		if (!IS_DIR_IN(pipe->ep_address))			pipe->flags |= HIF_USB_PIPE_FLAG_TX;		status = usb_hif_alloc_pipe_resources(pipe, urbcount);		if (A_FAILED(status))//.........这里部分代码省略.........
开发者ID:macchung,项目名称:ONEPLUS2RAZOR,代码行数:101,



注:本文中的usb_sndisocpipe函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ usb_stor_bulk_transfer_buf函数代码示例
C++ usb_sndintpipe函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。