USB urb生命周期

1607阅读 0评论2012-11-23 迷路的泥瓦匠
分类:LINUX

1. 在probe中创建URB
  - struct urb *usb_alloc_urb(int iso_packets, gfp_t mem_flags)
  - void *usb_buffer_alloc(struct usb_device *dev, size_t size, gfp_t mem_flags, dma_addr_t *dma)
  - static inline void usb_fill_int_urb(struct urb *urb,
   struct usb_device *dev,
   unsigned int pipe,
   void *transfer_buffer,
   int buffer_length,
   usb_complete_t complete_fn,
   void *context,
   int interval)
2. 将URB分配给USB设备的指定endpoint
3. 在需要往endpoint写数据时,将URB提交到USB core
  - int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
4. USB core将URB提交到特定的USB host controller
5. USB host controller发送到USB设备
6. 发送完成后,USB host controller通过回调通知到USB设备驱动

上一篇:Ubuntu 12.10设置ramdisk
下一篇:gcc编译参数-fPIC的一些问题