• 欢迎访问少将博客,学会感恩,乐于付出,珍惜缘份,成就彼此、推荐使用最新版火狐浏览器和Chrome浏览器访问本网站。
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏少将博客吧
  • 欢迎加博主微信:jiang_shaobo

u-boot中的usb命令

点滴 admin 6年前 (2013-12-09) 262次浏览 已收录 0个评论 扫描二维码

1. 使用 (帮助信息)

U-Boot usb
usb – USB sub-system
Usage:
usb start – start (scan) USB controller
usb reset – reset (rescan) USB controller
usb stop [f] – stop USB [f]=force stop
usb tree – show USB device tree
usb info [dev] – show available USB devices
usb storage – show details of USB storage devices
usb dev [dev] – show or set current USB storage device
usb part [dev] – print partition table of one or all USB storage devices
usb read addr blk# cnt – read `cnt’ blocks starting at block `blk#’
to memory address `addr’
usb write addr blk# cnt – write `cnt’ blocks starting at block `blk#’
from memory address `addr’

1.1usb start / usb reset

U-Boot usb start
(Re)start USB…
USB0: scanning bus 0 for devices… 2 USB Device(s) found
scanning usb for storage devices… 1 Storage Device(s) found

1.2usb tree

U-Boot usb tree
USB device tree:
1 Hub (12 Mb/s, 0mA)
| OHCI Root Hub
|
+-2 Mass Storage (12 Mb/s, 200mA)
Kingston DataTraveler G3 001372982955EBC0C5AB0019

1.3usb info(usb info 1 / usb info 2)

U-Boot usb info
1: Hub, USB Revision 1.10
– OHCI Root Hub
– Class: Hub
– PacketSize: 8 Configurations: 1
– Vendor: 0x0000 Product 0x0000 Version 0.0
Configuration: 1
– Interfaces: 1 Self Powered 0mA
Interface: 0
– Alternate Setting 0, Endpoints: 1
– Class Hub
– Endpoint 1 In Interrupt MaxPacket 2 Interval 255ms
2: Mass Storage, USB Revision 2.0
– Kingston DataTraveler G3 001372982955EBC0C5AB0019
– Class: (from Interface) Mass Storage
– PacketSize: 64 Configurations: 1
– Vendor: 0x0930 Product 0x6545 Version 1.0
Configuration: 1
– Interfaces: 1 Bus Powered 200mA
Interface: 0
– Alternate Setting 0, Endpoints: 2
– Class Mass Storage, Transp. SCSI, Bulk only
– Endpoint 1 In Bulk MaxPacket 64
– Endpoint 2 Out Bulk MaxPacket 64
1.4usb dev
U-Boot usb dev
USB device 0: Vendor: Kingston Rev: PMAP Prod: DataTraveler G3
Type: Removable Hard Disk
Capacity: 7441.6 MB = 7.2 GB (15240576 x 512)

2. 源代码分析

common/cmd_usb.c

2.1 usb start / usb reset 命令代码执行

[ strncmp(argv[1], “start”, 5) == 0 ] / [ strncmp(argv[1], “reset”, 5) == 0 ] — usb_stop() — usb_init() — usb_stor_scan(1) (CONFIG_USB_STORAGE) — usb_host_eth_scan(1) (CONFIG_USB_HOST_ETHER) — drv_usb_kbd_init() (CONFIG_USB_KEYBOARD) — return 0;

2.2 usb stop 命令代码执行

[ strncmp(argv[1], “stop”, 4) == 0 ] — (CONFIG_USB_KEYBOARD) [ argc == 2 ] — usb_kbd_deregister() — usb_stop — return 0;

[ strncmp(argv[1], “stop”, 4) == 0 ] — (CONFIG_USB_KEYBOARD) [ argc != 2 ] — console_assign(stdin, “serial”) — usb_kbd_deregister() — usb_stop — return 0;

喜欢 (0)
[🍬谢谢你请我吃糖果🍬🍬~]
分享 (0)
关于作者:
少将,关注Web全栈开发、项目管理,持续不断的学习、努力成为一个更棒的开发,做最好的自己,让世界因你不同。
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址