bulk interface驱动_25.2.4 USB驱动程序框架

本文介绍了Linux内核中USB驱动程序的基础框架,以driver/usb/usb-skeleton.c文件为例,讲解了USB设备驱动的基本数据结构、初始化、注销过程以及设备初始化和设备注销的详细步骤。内容涵盖usb_skel结构、初始化函数usb_skel_init、注销函数usb_skel_exit,以及设备操作函数等。
摘要由CSDN通过智能技术生成

25.2.4  USB驱动程序框架

Linux内核代码driver/usb/usb-skeleton.c文件是一个标准的USB设备驱动程序。编写一个USB设备的驱动可以参考usb-skeleton.c文件,实际上,可以直接修改该文件驱动新的USB设备。下面以usb-skeleton.c文件为例分析usb-skel设备驱动框架。

1.基本数据结构

usb-skel设备使用自定义结构usb_skel记录设备驱动用到的所有描述符,该结构定义如下:struct usb_skel {

struct usb_device * udev;           /* the usb device for

this device */

// USB设备描述符

struct usb_interface *  interface;      /* the

interface for this device

*/

// USB接口描述符

struct semaphore    limit_sem;      /* limiting

the number of writes in

progress */

// 互斥信号量

unsigned char *     bulk_in_buffer;     /* the

buffer to receive data */

// 数据接收缓冲区

size_t          bulk_in_size;       /* the size

of the receive buffer */

// 数据接收缓冲区大小

__u8            bulk_in_endpointAddr;   /* the

a

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值