【uboot】uboot环境下usb命令

uboot usb 命令

0.环境及编译

1 env

# env:
openwrt, u-boot-2016 
# usb设备:
FAT , 

2 compile

# compile:

1.命令使用

cmd 0.帮助

# cmd : 
help usb

# src : help部分的说明源码如下:
/*
823 U_BOOT_CMD(
  1     usb,    5,  1,  do_usb,
  2     "USB sub-system",
  3     "start - start (scan) USB controller\n"
  4     "usb reset - reset (rescan) USB controller\n"
  5     "usb stop [f] - stop USB [f]=force stop\n"
  6     "usb tree - show USB device tree\n"
  7     "usb info [dev] - show available USB devices\n"
  8     "usb test [dev] [port] [mode] - set USB 2.0 test mode\n"
  9     "    (specify port 0 to indicate the device's upstream port)\n"
 10     "    Available modes: J, K, S[E0_NAK], P[acket], F[orce_Enable]\n"
 11 #ifdef CONFIG_USB_STORAGE
 12     "usb storage - show details of USB storage devices\n"
 13     "usb dev [dev] - show or set current USB storage device\n"
 14     "usb part [dev] - print partition table of one or all USB storage"
 15     "    devices\n"
 16     "usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n"
 17     "    to memory address `addr'\n"
 18     "usb write addr blk# cnt - write `cnt' blocks starting at block `blk#'\n"
 19     "    from memory address `addr'"
 20 #endif /* CONFIG_USB_STORAGE */
 21 ); 
 */

cmd 1.开始、结束、重置

# cmd :
usb start	//开始检索usb设备,注册低速总线,搜索总线设备等。
usb stop    //停止usb设备,关闭一些clock\bus\clock之类的。
usb reset   //类似start

# log :
/*
IPQ6018# usb start
starting USB...
USB0:   Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus 0 for devices... 1 USB Device(s) found
USB1:   Register 1000140 NbrPorts 1
Starting the controller
USB XHCI 1.10
scanning bus 1 for devices... 2 USB Device(s) found
IPQ6018#  
IPQ6018# 
IPQ6018# usb stop
stopping USB..
IPQ6018#  
IPQ6018# usb reset
resetting USB...
USB0:   Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus 0 for devices... 1 USB Device(s) found
USB1:   Register 1000140 NbrPorts 1
Starting the controller
USB XHCI 1.10
scanning bus 1 for devices... 2 USB Device(s) found
IPQ6018# 
*/

cmd 2.info、tree、storage

# cmd :
usb tree 
usb info 
usb storage
# log :
/*
IPQ6018# usb tree
USB device tree:
  1  Hub (5 Gb/s, 0mA)
     U-Boot XHCI Host Controller 
   
  1  Hub (5 Gb/s, 0mA)
  |  U-Boot XHCI Host Controller 
  |
  +-2  Mass Storage (480 Mb/s, 224mA)
       SanDisk Ultra USB 3.0 4C530000021024102591
     
IPQ6018# usb info 1
config for device 1
2: Mass Storage,  USB Revision 2.10
 - SanDisk Ultra USB 3.0 4C530000021024102591
 - Class: (from Interface) Mass Storage
 - PacketSize: 64  Configurations: 1
 - Vendor: 0x0781  Product 0x5591 Version 1.0
   Configuration: 1
   - Interfaces: 1 Bus Powered 224mA
     Interface: 0
     - Alternate Setting 0, Endpoints: 2
     - Class Mass Storage, Transp. SCSI, Bulk only
     - Endpoint 1 In Bulk MaxPacket 512
     - Endpoint 2 Out Bulk MaxPacket 512

IPQ6018#  
IPQ6018# usb info
1: Hub,  USB Revision 3.0
 - U-Boot XHCI Host Controller 
 - Class: Hub
 - PacketSize: 9  Configurations: 1
 - Vendor: 0x0000  Product 0x0000 Version 1.0
   Configuration: 1
   - Interfaces: 1 Self Powered 0mA
     Interface: 0
     - Alternate Setting 0, Endpoints: 1
     - Class Hub
     - Endpoint 1 In Interrupt MaxPacket 8 Interval 255ms

1: Hub,  USB Revision 3.0
 - U-Boot XHCI Host Controller 
 - Class: Hub
 - PacketSize: 9  Configurations: 1
 - Vendor: 0x0000  Product 0x0000 Version 1.0
   Configuration: 1
   - Interfaces: 1 Self Powered 0mA
     Interface: 0
     - Alternate Setting 0, Endpoints: 1
     - Class Hub
     - Endpoint 1 In Interrupt MaxPacket 8 Interval 255ms

2: Mass Storage,  USB Revision 2.10
 - SanDisk Ultra USB 3.0 4C530000021024102591
 - Class: (from Interface) Mass Storage
 - PacketSize: 64  Configurations: 1
 - Vendor: 0x0781  Product 0x5591 Version 1.0
   Configuration: 1
   - Interfaces: 1 Bus Powered 224mA
     Interface: 0
     - Alternate Setting 0, Endpoints: 2
     - Class Mass Storage, Transp. SCSI, Bulk only
     - Endpoint 1 In Bulk MaxPacket 512
     - Endpoint 2 Out Bulk MaxPacket 512

IPQ6018#  
IPQ6018# usb storage
  Device 0: Vendor: SanDisk Rev: 1.00 Prod: Ultra USB 3.0
            Type: Removable Hard Disk
            Capacity: 14664.0 MB = 14.3 GB (30031872 x 512)
IPQ6018# 
*/

cmd 3.读取usb设备

# cmd :

# log :

cmd 4.数据写入usb设备

# cmd :

# log :

cmd 5.

# cmd :

# log :

cmd 6.

# cmd :

# log :

2.具体应用

1.读取u盘数据

# cmd :

# log :

2.数据写入U盘

# cmd :

# log :

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

过得精彩

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值