Study the linux gadget driver
USB gadget driver is important for my project.So I've to understand the basic structure of usb gadget driver. I found some good articles from the internet.
The original article is http://tali.admingilde.org/linux-docbook/gadget/ch01.html
What below is my comprehension.
1. 3 layer concepts
The usb peripheral devices should have 3 layers at least:
____________________
Upper level
____________________
USB Gadget driver
(This is hardware dependent layer.using calls to the Usb controller driver. It duty is listed as following:
1.Handing setup requests
2.Returning configurations and string descriptors
3.(re)setting configurations and interface altsettings,include enable and configuring endpoints
4.Handle life cycle events
5.Managing IN and OUT transfers on all currently enable endpoints)
____________________
USB Controller Driver(the linux/usb_gadget.h declare the functions, and these functions are defined in this layer,where the usb hardware is operated directly)
____________________
USB hardware (some soc has usb controller,such as PXA-25x, S3C244x)