• Home
  • Annotate
  • current directory
Name Date Size #Lines LOC

..21-Aug-2025-

README.md A D21-Aug-20251.8 KiB4937

driver.cpp A D21-Aug-202514.9 KiB436358

rules.mk A D21-Aug-20251.2 KiB5937

test.cpp A D21-Aug-20258.6 KiB281194

README.md

1# USB Peripheral Test
2
3## Overview
4
5This directory contains a test for USB peripheral role functionality in Zircon.
6It consists of two parts - a Zircon USB function driver and a Linux host test program.
7The host test (called usb-peripheral-test) tests control requests in both the IN and OUT
8direction with various payload sizes, receiving data on an interrupt endpoint and finally
9bulk transfers.
10
11## How to Run
12
13First of all, this test only works with devices that implement USB peripheral role functionality.
14The [hikey960 board](../../../../docs/targets/hikey960.md) is one of those devices, so here we
15assume you are using a hikey960 board. To run the test, follow these steps:
16
171. Connect the Hikey USB-C port to your Linux desktop
18
192. In the Hikey's shell, switch to USB peripheral mode and enable the test driver:
20```
21usbctl mode peripheral
22usbctl peripheral reset
23usbctl peripheral init-test
24```
25
263. Run the host test:
27
28```
29./build-arm64/host_tests/usb-peripheral-test
30```
31
32If the test succeeds, you should see something like:
33```
34CASE usb_peripheral_tests                               [STARTED]
35    control_interrupt_test_8                            [RUNNING] [PASSED] (36 ms)
36    control_interrupt_test_64                           [RUNNING] [PASSED] (31 ms)
37    control_interrupt_test_100                          [RUNNING] [PASSED] (31 ms)
38    control_interrupt_test_256                          [RUNNING] [PASSED] (31 ms)
39    control_interrupt_test_1000                         [RUNNING] [PASSED] (31 ms)
40    bulk_test                                           [RUNNING] [PASSED] (19 ms)
41CASE usb_peripheral_tests                               [PASSED]
42```
43
44## TODO
45
46Future versions of this test may include:
47* isochronous transfers
48* setting and clearing stall conditions
49