-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
usb: device_next: new USB Video Class implementation
Introduce a new USB Video Class (UVC) implementation from scratch. The USB Audio Class 2 (UAC2) was taken as inspiration for configuring the descriptors from the devicetree, for now, only the VideoStreaming interfaces that describe the supported formats. It only support a Input Terminal -> Output Terminal chain for now, but it is possible to add more complex topologies in a compatible way in the future. It exposes a native Zephyr Video driver interface, allowing to call the video_enqueue()/video_dequeue() interface that @loicpoulain did introduce in 2019 and maintained since then. The application can query the format currently selected by the host, but will not be alerted when the host configures a new format, as there is no video.h API for it yet. Signed-off-by: Josuah Demangeon <[email protected]>
- Loading branch information
Showing
9 changed files
with
1,856 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright (c) 2024 tinyVision.ai Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
description: | | ||
USB Video Class list of supported Motion JPEG (MJPEG) formats. | ||
include: zephyr,uvc-format.yaml | ||
|
||
compatible: "zephyr,uvc-format-mjpeg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright (c) 2024 tinyVision.ai Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
description: | | ||
USB Video Class list of supported uncompressed frame formats. | ||
compatible: "zephyr,uvc-format-uncompressed" | ||
|
||
include: zephyr,uvc-format.yaml | ||
|
||
properties: | ||
guid: | ||
type: uint8-array | ||
description: | | ||
A GUID identifier that identifies the frame format. A list of GUIDs can | ||
be found in "include/zephyr/dt-bindings/usb/video.h" already encoded. | ||
required: true | ||
|
||
bits-per-pixel: | ||
type: int | ||
description: | | ||
Number of bit for one pixel. This must match the pixel format specified | ||
by the GUID. | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright (c) 2024 tinyVision.ai Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# USB Video Class format common properties. | ||
|
||
properties: | ||
fourcc: | ||
type: string | ||
description: | | ||
The four-character string that uniquely identifies a pixel format. | ||
This must be matching the definition on "include/zephyr/drivers/video.h". | ||
required: true | ||
|
||
child-binding: | ||
description: | | ||
Enumeration of all frame dimensions supported for this format. | ||
properties: | ||
|
||
size: | ||
type: array | ||
description: | | ||
Frame width and size in pixel, from which can be deduced the | ||
frame size since this is an uncompressed format. | ||
required: true | ||
|
||
max-fps: | ||
type: int | ||
description: | | ||
Maximum FPS that can be sustained by theh device for this frame format. | ||
The actual FPS might be lower if the host throttles the transfer, or if | ||
it desires to receive frames less fast. | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright (c) 2024 tinyVision.ai Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
description: USB Video Class instance | ||
|
||
compatible: "zephyr,uvc" | ||
|
||
# Child nodes of "zephyr,uvc" compatibles are supposed to be: | ||
# - Video Control entity named "port", which also matches the | ||
# port/endpoint/remote-endpoint syntax of devicetrees. | ||
# - Video Streaming entity, which list the formats available. | ||
|
||
on-bus: usb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2024 tinyVision.ai Inc. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_USB_VIDEO_H | ||
#define ZEPHYR_INCLUDE_DT_BINDINGS_USB_VIDEO_H | ||
|
||
/* UVC GUIDs as defined on Linux source */ | ||
#define UVC_GUID_MJPEG 4d 4a 50 47 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_YUY2 59 55 59 32 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_YUY2_ISIGHT 59 55 59 32 00 00 10 00 80 00 00 00 00 38 9b 71 | ||
#define UVC_GUID_NV12 4e 56 31 32 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_YV12 59 56 31 32 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_I420 49 34 32 30 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_UYVY 55 59 56 59 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_Y800 59 38 30 30 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_Y8 59 38 20 20 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_Y10 59 31 30 20 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_Y12 59 31 32 20 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_Y16 59 31 36 20 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_BY8 42 59 38 20 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_BA81 42 41 38 31 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_GBRG 47 42 52 47 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_GRBG 47 52 42 47 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_RGGB 52 47 47 42 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_BG16 42 47 31 36 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_GB16 47 42 31 36 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_RG16 52 47 31 36 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_GR16 47 52 31 36 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_RGBP 52 47 42 50 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_BGR3 7d eb 36 e4 4f 52 ce 11 9f 53 00 20 af 0b a7 70 | ||
#define UVC_GUID_BGR4 7e eb 36 e4 4f 52 ce 11 9f 53 00 20 af 0b a7 70 | ||
#define UVC_GUID_M420 4d 34 32 30 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_H264 48 32 36 34 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_H265 48 32 36 35 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_Y8I 59 38 49 20 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_Y12I 59 31 32 49 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_Z16 5a 31 36 20 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_RW10 52 57 31 30 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_INVZ 49 4e 56 5a 90 2d 58 4a 92 0b 77 3f 1f 2c 55 6b | ||
#define UVC_GUID_INZI 49 4e 5a 49 66 1a 42 a2 90 65 d0 18 14 a8 ef 8a | ||
#define UVC_GUID_INVI 49 4e 56 49 db 57 49 5e 8e 3f f4 79 53 2b 94 6f | ||
#define UVC_GUID_CNF4 43 20 20 20 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_D3DFMT_L8 32 00 00 00 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_KSMEDIA_L8_IR 32 00 00 00 02 00 10 00 80 00 00 aa 00 38 9b 71 | ||
#define UVC_GUID_HEVC 48 45 56 43 00 00 10 00 80 00 00 aa 00 38 9b 71 | ||
|
||
#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_USB_VIDEO_H */ |
Oops, something went wrong.