If(CIRC_SPACE(cyp->bulk_in_ring.head, cyp->bulk_in_ring.Based on kernel version 5.7.10. * check if enough space is available in circular buffer */ Printk(KERN_NOTICE "%s Head at %d", DRIVER_NAME, cyp->bulk_in_ring.head) Memcpy(&cyp->bulk_in_ring.buf, urb->transfer_buffer, urb->actual_length) Ĭyp->bulk_in_ring.head = (cyp->bulk_in_ring.head + urb->actual_length) & (RING_BUFFER_SIZE -1) * using spin_lock_irqsave - just because it is always save */ Printk(KERN_ERR "%s Failed bulk read attemting to resubmit, error: %d", DRIVER_NAME, urb->status) If(urb->status = -ENOENT || urb->status = -ECONNRESET || urb->status = -ESHUTDOWN) * device was unlinked do not resubmit urb */ Printk(KERN_DEBUG "%s URB1 read callback triggered %s", DRIVER_NAME, (char*)urb->transfer_buffer) Static void cypress_read_bulk_callback1(struct urb *urb) * save driver data within the interface */ Printk(KERN_INFO "%s Minor %d obtained for Cypress USB Bulk Transfer device", DRIVER_NAME, interface->minor) Usb_deregister_dev(interface, &cypress_class) Printk(KERN_ALERT "%s Failed to register USB device. Minor = usb_register_dev(interface, &cypress_class) * register device and ask for a minor number */ Printk(KERN_ALERT "%s Failed to find suitable bulk out endpoint in interface", DRIVER_NAME) Printk(KERN_INFO "%s Found suitable bulk out endpoint in interface", DRIVER_NAME) If(!usb_find_bulk_out_endpoint(intf_desc, &endpoint))Ĭyp->bulk_out_size = endpoint->wMaxPacketSize Ĭyp->bulk_out_endpointAddr = endpoint->bEndpointAddress * check if bulk out endpoint is available in the probed interface */ Printk(KERN_ALERT "%s Failed to find suitable bulk in endpoint in interface", DRIVER_NAME) Printk(KERN_INFO "%s Found suitable bulk in endpoint in interface", DRIVER_NAME) If(!usb_find_bulk_in_endpoint(intf_desc, &endpoint))Ĭyp->bulk_in_size = endpoint->wMaxPacketSize Ĭyp->bulk_in_endpointAddr = endpoint->bEndpointAddress * check if bulk in endpoint is available in the probed interface */ Printk(KERN_INFO "%s\t\t EP->wMaxPacketSize: 0x%04X (%d)", DRIVER_NAME, i, endpoint->wMaxPacketSize, endpoint->wMaxPacketSize) Printk(KERN_INFO "%s\t\t EP->bDescriptorType: 0x%02X", DRIVER_NAME, i, endpoint->bDescriptorType) Printk(KERN_INFO "%s\t\t EP->bEndpointAddress: 0x%02X", DRIVER_NAME, i, endpoint->bEndpointAddress) Printk(KERN_INFO "%s Interface %d with class %02X and %d endpoints now probed", \ĭRIVER_NAME, intf_desc->desc.bInterfaceNumber, intf_desc->desc.bInterfaceClass, intf_desc->desc.bNumEndpoints) Printk(KERN_INFO "%s Cypress USB BULK Transfer device detected (Vendor:%04X Product:%04X)", DRIVER_NAME, id->idVendor, id->idProduct) * get pointer to interface descriptor */ * get container device from interface pointer */ Printk(KERN_ALERT "%s Failed to allocate memory for the device.", DRIVER_NAME) ![]() Struct usb_endpoint_descriptor *endpoint Ĭyp = kzalloc(sizeof(struct cypress_usb_dev), GFP_KERNEL) Static int cypress_probe(struct usb_interface *interface, const struct usb_device_id *id) * probe function is called on device insertation through the USB core */ ![]() Usb_free_coherent(cyp->device, cyp->bulk_in_size, cyp->buffer_urb_in2, cyp->dma_buffer_urb_in2) Usb_free_coherent(cyp->device, cyp->bulk_in_size, cyp->buffer_urb_in1, cyp->dma_buffer_urb_in1) Usb_kill_anchored_urbs(&cyp->write_urbs) #define DRIVER_NAME "Cypress_USB_Bulk_Transfer_Driver" #include /* wait_queue_head_t, wait_event_interruptible, wake_up_interruptible */ Can someone explain to me what happens here? #include In the syslog I can not find any helpful information. When sending more than 2000Bytes the whole system suddenly crashes. ![]() The magic barrier seems to be round about 2000Bytes. Basically this works, but only for small amounts of data. The USB interface on the Cypress PSoC is configured to send any data it receives via the bulk in endpoint back out via the bulk out endpoint. I am trying to write my own USB driver for my Cypress CY8CKIT-059 PSoC 5LP. ![]() I am using Linux ubuntu 5.4.0-1026-raspi.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |