drivers/usb/atm/usbatm.h

Source file repositories/reference/linux-study-clean/drivers/usb/atm/usbatm.h

File Facts

System
Linux kernel
Corpus path
drivers/usb/atm/usbatm.h
Extension
.h
Size
5079 bytes
Lines
186
Domain
Driver Families
Bucket
drivers/usb
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct usbatm_driver {
	const char *driver_name;

	/* init device ... can sleep, or cause probe() failure */
	int (*bind) (struct usbatm_data *, struct usb_interface *,
		     const struct usb_device_id *id);

	/* additional device initialization that is too slow to be done in probe() */
	int (*heavy_init) (struct usbatm_data *, struct usb_interface *);

	/* cleanup device ... can sleep, but can't fail */
	void (*unbind) (struct usbatm_data *, struct usb_interface *);

	/* init ATM device ... can sleep, or cause ATM initialization failure */
	int (*atm_start) (struct usbatm_data *, struct atm_dev *);

	/* cleanup ATM device ... can sleep, but can't fail */
	void (*atm_stop) (struct usbatm_data *, struct atm_dev *);

	int bulk_in;	/* bulk rx endpoint */
	int isoc_in;	/* isochronous rx endpoint */
	int bulk_out;	/* bulk tx endpoint */

	unsigned rx_padding;
	unsigned tx_padding;
};

extern int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
		struct usbatm_driver *driver);
extern void usbatm_usb_disconnect(struct usb_interface *intf);


struct usbatm_channel {
	int endpoint;			/* usb pipe */
	unsigned int stride;		/* ATM cell size + padding */
	unsigned int buf_size;		/* urb buffer size */
	unsigned int packet_size;	/* endpoint maxpacket */
	spinlock_t lock;
	struct list_head list;
	struct tasklet_struct tasklet;
	struct timer_list delay;
	struct usbatm_data *usbatm;
};

/* main driver data */

struct usbatm_data {
	/******************
	*  public fields  *
	******************/

	/* mini driver */
	struct usbatm_driver *driver;
	void *driver_data;
	char driver_name[16];
	unsigned int flags; /* set by mini-driver in bind() */

	/* USB device */
	struct usb_device *usb_dev;
	struct usb_interface *usb_intf;
	char description[64];

	/* ATM device */
	struct atm_dev *atm_dev;

	/********************************
	*  private fields - do not use  *
	********************************/

	struct kref refcount;
	struct mutex serialize;
	int disconnected;

	/* heavy init */
	struct task_struct *thread;
	struct completion thread_started;
	struct completion thread_exited;

	/* ATM device */
	struct list_head vcc_list;

	struct usbatm_channel rx_channel;
	struct usbatm_channel tx_channel;

	struct sk_buff_head sndqueue;
	struct sk_buff *current_skb;	/* being emptied */

	struct usbatm_vcc_data *cached_vcc;
	int cached_vci;
	short cached_vpi;

Annotation

Implementation Notes