最終更新:2014-05-12 (月) 12:37:21 (3609d)
drivers/usb/usb-skeleton.c
USB Skeleton driver
include
- linux/kernel.h
- linux/errno.h
- linux/slab.h?
- linux/module.h
- linux/kref.h?
- linux/uaccess.h?
- linux/usb.h
- linux/mutex.h?
参照
- usb_device
- usb_interface
- usb_anchor?
- urb
usb_skel
struct usb_skel { struct usb_device *udev; /* the usb device for this device */ struct usb_interface *interface; /* the interface for this device */ struct semaphore limit_sem; /* limiting the number of writes in progress */ struct usb_anchor submitted; /* in case we need to retract our submissions */ struct urb *bulk_in_urb; /* the urb to read data with */ unsigned char *bulk_in_buffer; /* the buffer to receive data */ size_t bulk_in_size; /* the size of the receive buffer */ size_t bulk_in_filled; /* number of bytes in the buffer */ size_t bulk_in_copied; /* already copied to user space */ __u8 bulk_in_endpointAddr; /* the address of the bulk in endpoint */ __u8 bulk_out_endpointAddr; /* the address of the bulk out endpoint */ int errors; /* the last request tanked */ bool ongoing_read; /* a read is going on */ spinlock_t err_lock; /* lock for errors */ struct kref kref; struct mutex io_mutex; /* synchronize I/O with disconnect */ wait_queue_head_t bulk_in_wait; /* to wait for an ongoing read */ };
usb_driver skel_driver
.name = "skeleton",
usb_driver.probe= skel_probe,
- usb_skel?
- usb_host_interface?
- usb_endpoint_descriptor - エンドポイントディスクリプタ
- init_usb_anchor?
- usb_get_dev - increments the reference count of the usb device structure
- usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
- usb_endpoint_maxp? - get endpoint's max packet size
- usb_alloc_urb - creates a new urb for a USB driver to use
- usb_endpoint_is_bulk_out? - check if the endpoint is bulk OUT
- usb_set_intfdata?
- usb_register_dev (skel_class (fops))
.disconnect = skel_disconnect,
- usb_get_intfdata
- usb_set_intfdata?
- usb_deregister_dev?
- usb_kill_anchored_urbs?
.suspend = skel_suspend,
.resume = skel_resume,
- return 0;
.pre_reset = skel_pre_reset,
.post_reset = skel_post_reset,
.id_table = skel_table,
.supports_autosuspend = 1,
file_operations skel_fops
.owner = THIS_MODULE,
.read = skel_read,
- mutex_lock_interruptible?
- spin_lock_irq?
- spin_unlock_irq?
- wait_event_interruptible
- skel_do_read_io?
- usb_fill_bulk_urb - macro to help initialize a bulk urb
- usb_rcvbulkpipe?
- wake_up_interruptible
- usb_submit_urb
.write = skel_write,
- down_interruptible
- down_trylock?
- usb_alloc_urb - creates a new urb for a USB driver to use
- usb_alloc_coherent? - allocate dma-consistent buffer for URB_NO_xxx_DMA_MAP
- copy_from_user
- usb_fill_bulk_urb - macro to help initialize a bulk urb
- usb_sndbulkpipe?
- usb_free_coherent?
- usb_anchor_urb? - anchors an URB while it is processed
- usb_submit_urb
- usb_free_urb?
.open = skel_open,
- usb_find_interface?
- usb_get_intfdata
- usb_autopm_get_interface?
- kref_get?