手机版
你好,游客 登录 注册
背景:
阅读新闻

u-boot中的usb命令

[日期:2013-05-08] 来源:Linux社区  作者:voice_shen [字体:大 中 小]

[u-boot: v2013.04]

[Author: Bo Shen voice.shen@gmail.com]

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.2 usb 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.3 usb 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.4 usb 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;

linux
相关资讯       U-boot 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款