device_t
video_attach_mi(
const struct video_hw_if *hw_if
, device_t hw_dev
)
void
video_submit_payload(
device_t vl_dev
, const struct video_payload *payload
)
video_hw_if
structure function pointers called by the video layer, and video layer
functions called by the hardware driver.
The high level video driver attaches to the low level driver
when the latter calls
const char * (*get_devname)(void *);
int (*enum_format)(void *, uint32_t, struct video_format *);
int (*get_format)(void *, struct video_format *);
int (*set_format)(void *, struct video_format *);
int (*try_format)(void *, struct video_format *);
int (*start_transfer)(void *);
int (*stop_transfer)(void *);
int (*control_iter_init)(void *, struct video_control_iter *);
int (*control_iter_next)(void *, struct video_control_iter *);
int (*get_control_desc_group)(void *,
struct video_control_desc_group *);
int (*get_control_group)(void *, struct video_control_group *);
int (*set_control_group)(void *, const struct video_control_group *);
};
video_attach_mi
.
The
video_hw_if
struct is as shown below.
dev
is the device struct for the hardware device.
Return value is the video layer device.
struct video_hw_if {
int (*open)(void *, int); /* open hardware */
void (*close)(void *); /* close hardware */
The upper layer of the video driver allocates buffers for video
samples.
The hardware driver submits data to the video layer with
video_submit_payload
.
vl_dev
is the video layer device returned by
video_attach_mi
.
struct video_payload {
const uint8_t *data;
size_t size;
int frameno;
bool end_of_frame;
};
data
size
frameno
end_of_frame
frameno
.
NULL
if not needed.
int
open(void
*hdl,
int
flags)
void
close(void
*hdl)
const
char
*
get_devname(void
*hdl)
int
enum_format(void
*hdl,
uint32_t
index,
struct
video_format
*format);
int
get_format(void
*hdl,
struct
video_format
*format)
int
set_format(void
*hdl,
struct
video_format
*format)
int
try_format(void
*hdl,
struct
video_format
*format)
int
start_transfer(void
*hdl)
).
int
stop_transfer(void
*hdl)
int
control_iter_init(void
*hdl,
struct
video_control_iter
*)
int
control_iter_next(void
*hdl,
struct
video_control_iter
*)
int
get_control_group(void
*hdl,
struct
video_control_group
*)
int
set_control_group(void
*hdl,
struct
video_control_group
*)