[riot-notifications] [RIOT-OS/RIOT] [WIP] USBUS: Initial work towards an USB stack (#10916)

Koen Zandberg notifications at github.com
Thu Jan 31 23:07:21 CET 2019


### Contribution description

USBUS (Universal Serial Bus Unified Stack) is a generic USB stack specific for RIOT-os. It is a newly written USB stack making use of the usbdev module proposed in #9830. The idea is to have a single message/event based thread handling all the usb work. 

Modularity is achieved by allowing different endpoint modules to register themselves with their specific settings. On startup, each module requiring USB endpoints have to request endpoints from USBUS and add a callback for handling the messages. Examples of modules that could be created are: USB CDC ACM (serial over USB), USB HID (sensors over USB) and USB CDC EEM (ethernet over USB).

### Testing procedure

Run the `examples/usbus_minimal` on a `samr21-xpro` board. Plugging in the second (TARGET USB) in an USB host device (your desktop) should cause it to show up in the usb device listing with something like:
```
% lsusb  -d 046d:5678 -v

Bus 003 Device 018: ID 046d:5678 Logitech, Inc. 
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x046d Logitech, Inc.
  idProduct          0x5678 
  bcdDevice            0.00
  iManufacturer           3 
  iProduct                2 
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength            9
    bNumInterfaces          0
    bConfigurationValue     1
    iConfiguration          1 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
```
(I'm fully aware that I'm stealing one of the Logitech vendor codes, It's on my todo for #9830 to change it to something else).

### Issues/PRs references

depends on #10915 and #9830 

### Todo:
 - [ ] auto_init
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/10916

-- Commit Summary --

  * usb: Add defines for USB peripheral devices
  * usbopt: Add usb control operation enum
  * usbdev: Introduce a common API for USB peripherals
  * fixup! usbdev: Introduce a common API for USB peripherals
  * fixup! usbopt: Add usb control operation enum
  * fixup! usbdev: Introduce a common API for USB peripherals
  * usbdev: add configurables for usb device drivers
  * fixup! usbopt: Add usb control operation enum
  * fixup! fixup! usbdev: Introduce a common API for USB peripherals
  * sam0_common: Add USB peripheral driver
  * samr21-xpro: Enable USB driver when required
  * sam0_common: Add USB peripheral driver
  * usb: Add generic USB structs and functions
  * usbus: Initial work to a unified USB stack

-- File Changes --

    M Makefile.dep (5)
    M boards/samr21-xpro/Makefile.dep (4)
    M cpu/sam0_common/Makefile (4)
    A cpu/sam0_common/include/sam_usb.h (64)
    A cpu/sam0_common/usb/Makefile (3)
    A cpu/sam0_common/usb/usb.c (680)
    A drivers/include/usb/usbdev.h (337)
    M makefiles/pseudomodules.inc.mk (1)
    M sys/Makefile (3)
    A sys/include/usb.h (149)
    A sys/include/usb/message.h (182)
    A sys/include/usb/usbopt.h (115)
    A sys/include/usb/usbus.h (178)
    A sys/include/usb/usbus/hdrs.h (43)
    A sys/usb/usbus/Makefile (4)
    A sys/usb/usbus/hdrs.c (231)
    A sys/usb/usbus/usbus.c (667)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/10916.patch
https://github.com/RIOT-OS/RIOT/pull/10916.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10916
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190131/989bf7cf/attachment.html>


More information about the notifications mailing list