xrt: Add device driver provided bindings

This commit is contained in:
Jakob Bornecrantz 2020-11-03 19:03:06 +00:00
parent 151a03fb48
commit 7c807a8605
2 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,4 @@
Add `xrt_binding_profile` struct, related pair structs and fields on
`xrt_device` to allow to move the static rebinding of inputs and outputs into
device drivers. This makes it easier to get a overview in the driver itself
which bindings it can bind to.

View file

@ -167,11 +167,56 @@ struct xrt_input
union xrt_input_value value;
};
/*!
* A single named output, that sits on a @ref xrt_device.
*
* @ingroup xrt_iface
*/
struct xrt_output
{
enum xrt_output_name name;
};
/*!
* A binding pair, going @p from a binding point to a @p device input.
*
* @ingroup xrt_iface
*/
struct xrt_binding_input_pair
{
enum xrt_input_name from; //!< From which name.
enum xrt_input_name device; //!< To input on the device.
};
/*!
* A binding pair, going @p from a binding point to a @p device output.
*
* @ingroup xrt_iface
*/
struct xrt_binding_output_pair
{
enum xrt_output_name from; //!< From which name.
enum xrt_output_name device; //!< To output on the device.
};
/*!
* A binding profile, has lists of binding pairs to goes from device in @p name
* to the device it hangs off on.
*
* @ingroup xrt_iface
*/
struct xrt_binding_profile
{
//! Device this binding emulates.
enum xrt_device_name name;
struct xrt_binding_input_pair *inputs;
size_t num_inputs;
struct xrt_binding_output_pair *outputs;
size_t num_outputs;
};
/*!
* @interface xrt_device
*
@ -194,6 +239,11 @@ struct xrt_device
//! Always set, pointing to the tracking system for this device.
struct xrt_tracking_origin *tracking_origin;
//! Number of bindings.
size_t num_binding_profiles;
// Array of alternative binding profiles.
struct xrt_binding_profile *binding_profiles;
//! Number of inputs.
size_t num_inputs;
//! Array of input structs.