嵌入式系统usb打印服务器,【原创】基于嵌入式系统的USB设备驱动实现

USB在嵌入式系统中的重要性不言而喻,今天就写写如何实现嵌入式系统的USB设备驱动。

【实验平台】

主机:Ubantu10.10

目标板:fsc100

目标内核版本:2.6.35

【实验步骤】

1、实验代码拷贝到ubuntu主机目录下,编译且加载

2、目标板与pc用USB接口线连接,目标板上电后,进到u-boot控制台,并运行dnw

3、启用虚拟机的的USB设备

在ubutn命令终端下可以看到如下信息

#

lsusb -v

Bus

001 Device 002: ID 04e8:1234 Samsung Electronics Co., Ltd

Device

Descriptor:

bLength                18

bDescriptorType         1

bcdUSB               2.00

bDeviceClass          255 Vendor Specific Class

bDeviceSubClass         0

bDeviceProtocol         0

bMaxPacketSize0        64

idVendor           0x04e8 Samsung Electronics Co., Ltd

idProduct          0x1234

bcdDevice            1.00

iManufacturer           1 System MCU

iProduct                2 SEC S3C6400X Test B/D

iSerial                 0

bNumConfigurations      1

Configuration Descriptor:

bLength                 9

bDescriptorType         2

wTotalLength           32

bNumInterfaces          1

bConfigurationValue     1

iConfiguration          0

bmAttributes         0xc0

Self Powered

MaxPower               50mA

Interface Descriptor:

bLength                 9

bDescriptorType         4

bInterfaceNumber        0

bAlternateSetting       0

bNumEndpoints           2

bInterfaceClass       255 Vendor Specific Class

bInterfaceSubClass      0

bInterfaceProtocol      0

iInterface              0

Endpoint Descriptor:

bLength                 7

bDescriptorType         5

bEndpointAddress     0x81

EP 1 IN

bmAttributes            2

Transfer Type            Bulk

Synch Type               None

Usage Type               Data

wMaxPacketSize     0x0200

1x 512 bytes

bInterval               0

Endpoint Descriptor:

bLength                 7

bDescriptorType         5

bEndpointAddress     0x02

EP 2 OUT

bmAttributes            2

Transfer Type            Bulk

Synch Type               None

Usage Type               Data

wMaxPacketSize     0x0200

1x 512 bytes

bInterval               0

4、在pc主机下编译应用程序并运行

# gcc -o test usb_app.c

# ./test zImage

5、在目标板u-boot控制台下运行

U-boot版本为:1.3.4

#

bootm 20008000

U-boot版本为:2010.09

# go

20008000

是不是非常棒,很喜欢的一个应用。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值