本帖最后由 神棍地海棠 于 2023-10-16 13:52 编辑
以下命令在所有RTOS平台(MELIS/FREERTOS)都可以使用 通过menuconfig打开usb模块功能 RTOS通过usb命令集成了测试用例。通过如下命令即可显示支持的功能: <span class="hljs-comment" style="box-sizing: border-box; color: rgb(188, 148, 88); font-style: italic;">//输入如下命令</span>
msh />usb
Usage:
usb hci {-i|-r} [<port>]
usb udc {-i|-r} [<port>]
usb phy_range {-s|-g} {<port>} [<phyrange>]
usb ed_test {<port>} {<type>}
usb debug {<status>}
usb uvc_test
- - - - - - - - - - - - - - - - - - - - -
Meaning:
-i:insmod, -r:rmmod, -s:<span class="hljs-keyword" style="box-sizing: border-box; color: rgb(194, 98, 48);">set</span>, -g:<span class="hljs-keyword" style="box-sizing: border-box; color: rgb(194, 98, 48);">get</span>
port : [<span class="hljs-number" style="box-sizing: border-box; color: rgb(165, 194, 97);">0</span><span class="hljs-number" style="box-sizing: border-box; color: rgb(165, 194, 97);">-0</span>],port number
phyrange : [<span class="hljs-number" style="box-sizing: border-box; color: rgb(165, 194, 97);">0x0</span><span class="hljs-number" style="box-sizing: border-box; color: rgb(165, 194, 97);">-0x1f</span>],phy range
status : [<span class="hljs-number" style="box-sizing: border-box; color: rgb(165, 194, 97);">0</span>-disable,<span class="hljs-number" style="box-sizing: border-box; color: rgb(165, 194, 97);">1</span>-enable],hci debug status
type : [test_j_state/test_k_state/test_se0_nak/test_pack]--hci & otg
[<span class="hljs-meta" style="box-sizing: border-box; color: rgb(155, 133, 157);">test_not_operating/test_force_enable/test_mask</span>]--hci only
==>> More information refer to spec <<==
HCI功能测试命令形式:usb hci {-i|-r} [<port>] <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(205, 168, 105);">usb</span> hci -i <span class="hljs-number" style="box-sizing: border-box; color: rgb(165, 194, 97);">1</span>
<span class="hljs-attribute" style="box-sizing: border-box; color: rgb(205, 168, 105);">usb</span> hci -r <span class="hljs-number" style="box-sizing: border-box; color: rgb(165, 194, 97);">1</span>
UDC功能测试命令形式:usb udc {-i|-r} [<port>] <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(205, 168, 105);">usb</span> udc -i <span class="hljs-number" style="box-sizing: border-box; color: rgb(165, 194, 97);">0</span>
<span class="hljs-attribute" style="box-sizing: border-box; color: rgb(205, 168, 105);">usb</span> udc -r <span class="hljs-number" style="box-sizing: border-box; color: rgb(165, 194, 97);">0</span>
UVC功能测试命令形式:usb uvc_test <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(205, 168, 105);">usb</span> uvc_test
phy range参数调整命令形式:usb phy_range {-s|-g} {<port>} [<phyrange>] usb phy_range -g 0
…
OTG0 phy range
phy_range = 0xa07, details:
bit[12] = 0x0, mode iref-1 vref-0
<span class="hljs-section" style="box-sizing: border-box; color: rgb(255, 198, 109);">bit[11:9] = 0x5, rise time(all usb)</span>
<span class="hljs-section" style="box-sizing: border-box; color: rgb(255, 198, 109);">bit[8:6] = 0x0, rise time(current usb)</span>
<span class="hljs-section" style="box-sizing: border-box; color: rgb(255, 198, 109);">bit[5:4] = 0x0, pre-emphasis</span>
<span class="hljs-section" style="box-sizing: border-box; color: rgb(255, 198, 109);">bit[3:0] = 0x7, resistance</span>
USB0较为特殊,host和device的参数是分开调整的,注意打印,例如上述例子中,“OTG0 phy range”表示目前处于device模式,显示的是device端的phy range。 phy_range就是目前的值,调整参数可以在此基础上进行调整,具体含义参考上面打印中的提示。 usb phy_range -s <span class="hljs-number" style="box-sizing: border-box; color: rgb(165, 194, 97);">0</span> <span class="hljs-number" style="box-sizing: border-box; color: rgb(165, 194, 97);">0xa08</span>
…
OTG0 phy range
phy_range config <span class="hljs-keyword" style="box-sizing: border-box; color: rgb(194, 98, 48);">in</span> vref mode success!
同理,“OTG0 phy range”表示目前处于device模式,设置的是device端的phy range。 ed test测试模式设置命令形式:usb ed_test {<port>} {<type>} <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(205, 168, 105);">usb</span> ed_test <span class="hljs-number" style="box-sizing: border-box; color: rgb(165, 194, 97);">1</span> test_j_state
usb debug功能启停命令形式:usb debug {<status>} <span class="hljs-attribute" style="box-sizing: border-box; color: rgb(205, 168, 105);">usb</span> <span class="hljs-literal" style="box-sizing: border-box;">debug</span> <span class="hljs-number" style="box-sizing: border-box; color: rgb(165, 194, 97);">1</span>
<span class="hljs-attribute" style="box-sizing: border-box; color: rgb(205, 168, 105);">usb</span> <span class="hljs-literal" style="box-sizing: border-box;">debug</span> <span class="hljs-number" style="box-sizing: border-box; color: rgb(165, 194, 97);">0</span>
|