diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2018-05-26 20:58:19 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2018-06-01 09:47:11 +0300 |
commit | 571e148aaec20c26c308d6611cdb1f34ec81ff1e (patch) | |
tree | 2d829def0ed54aaf55dddd4743c0e9bbb6dec112 /configfs.h | |
parent | 203acba635874681e3e744fbce4151d569afa572 (diff) |
configfs: Refactor ConfigFS parsing code
Move all attribute parsing to a top-level configfs_parse_uvc() function,
and split control and streaming interface attributes to two separate
helper functions. In addition to making the code more structured, it
will also allow supporting multiple streaming interfaces in a single UVC
function in the future.
The uvc_function_config structure is similarly reorganized in a
hierarchical representation of the configuration.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'configfs.h')
-rw-r--r-- | configfs.h | 53 |
1 files changed, 42 insertions, 11 deletions
@@ -11,25 +11,56 @@ #define __CONFIGFS_H__ /* + * struct uvc_function_config_endpoint - Endpoint parameters + * @bInterval: Transfer interval (interrupt and isochronous only) + * @bMaxBurst: Transfer burst size (super-speed only) + * @wMaxPacketSize: Maximum packet size (including the multiplier) + */ +struct uvc_function_config_endpoint { + unsigned int bInterval; + unsigned int bMaxBurst; + unsigned int wMaxPacketSize; +}; + +/* + * struct uvc_function_config_interface - Interface parameters + * @bInterfaceNumber: Interface number + */ +struct uvc_function_config_interface { + unsigned int bInterfaceNumber; +}; + +/* + * struct uvc_function_config_control - Control interface parameters + * @intf: Generic interface parameters + */ +struct uvc_function_config_control { + struct uvc_function_config_interface intf; +}; + +/* + * struct uvc_function_config_streaming - Streaming interface parameters + * @intf: Generic interface parameters + * @ep: Endpoint parameters + */ +struct uvc_function_config_streaming { + struct uvc_function_config_interface intf; + struct uvc_function_config_endpoint ep; +}; + +/* * struct uvc_function_config - UVC function configuration parameters * @video: Full path to the video device node * @udc: UDC name - * @control_interface: Control interface number - * @streaming_interface: Streaming interface number - * @streaming_interval: Isochronous interval for the streaming endpoint - * @streaming_maxburts: Isochronous maximum burst for the streaming endpoint - * @streaming_maxpacket: Isochronous maximum packets for the streaming endpoint + * @control: Control interface configuration + * @streaming: Streaming interface configuration */ struct uvc_function_config { char *video; char *udc; - unsigned int control_interface; - unsigned int streaming_interface; - - unsigned int streaming_interval; - unsigned int streaming_maxburst; - unsigned int streaming_maxpacket; + struct uvc_function_config_control control; + struct uvc_function_config_streaming streaming; }; struct uvc_function_config *configfs_parse_uvc_function(const char *function); |