^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * dvb-vb2.h - DVB driver helper framework for streaming I/O
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 2015 Samsung Electronics
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Author: jh1009.sung@samsung.com
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * This program is free software; you can redistribute it and/or modify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * it under the terms of the GNU General Public License as published by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * the Free Software Foundation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #ifndef _DVB_VB2_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define _DVB_VB2_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/poll.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/dvb/dmx.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <media/videobuf2-core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <media/videobuf2-dma-contig.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <media/videobuf2-vmalloc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * enum dvb_buf_type - types of Digital TV memory-mapped buffers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * @DVB_BUF_TYPE_CAPTURE: buffer is filled by the Kernel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * with a received Digital TV stream
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) enum dvb_buf_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) DVB_BUF_TYPE_CAPTURE = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * enum dvb_vb2_states - states to control VB2 state machine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * @DVB_VB2_STATE_NONE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * VB2 engine not initialized yet, init failed or VB2 was released.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * @DVB_VB2_STATE_INIT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * VB2 engine initialized.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * @DVB_VB2_STATE_REQBUFS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) * Buffers were requested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * @DVB_VB2_STATE_STREAMON:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) * VB2 is streaming. Callers should not check it directly. Instead,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * they should use dvb_vb2_is_streaming().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) * Note:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * Callers should not touch at the state machine directly. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) * is handled inside dvb_vb2.c.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) enum dvb_vb2_states {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) DVB_VB2_STATE_NONE = 0x0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) DVB_VB2_STATE_INIT = 0x1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) DVB_VB2_STATE_REQBUFS = 0x2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) DVB_VB2_STATE_STREAMON = 0x4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #define DVB_VB2_NAME_MAX (20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) * struct dvb_buffer - video buffer information for v4l2.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) * @vb: embedded struct &vb2_buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) * @list: list of &struct dvb_buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) struct dvb_buffer {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) struct vb2_buffer vb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * struct dvb_vb2_ctx - control struct for VB2 handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) * @vb_q: pointer to &struct vb2_queue with videobuf2 queue.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) * @mutex: mutex to serialize vb2 operations. Used by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) * vb2 core %wait_prepare and %wait_finish operations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) * @slock: spin lock used to protect buffer filling at dvb_vb2.c.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) * @dvb_q: List of buffers that are not filled yet.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) * @buf: Pointer to the buffer that are currently being filled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) * @offset: index to the next position at the @buf to be filled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) * @remain: How many bytes are left to be filled at @buf.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) * @state: bitmask of buffer states as defined by &enum dvb_vb2_states.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) * @buf_siz: size of each VB2 buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) * @buf_cnt: number of VB2 buffers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) * @nonblocking:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * If different than zero, device is operating on non-blocking
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) * @flags: buffer flags as defined by &enum dmx_buffer_flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) * Filled only at &DMX_DQBUF. &DMX_QBUF should zero this field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * @count: monotonic counter for filled buffers. Helps to identify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) * data stream loses. Filled only at &DMX_DQBUF. &DMX_QBUF should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) * zero this field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * @name: name of the device type. Currently, it can either be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * "dvr" or "demux_filter".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) struct dvb_vb2_ctx {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) struct vb2_queue vb_q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) struct mutex mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) spinlock_t slock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) struct list_head dvb_q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) struct dvb_buffer *buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) int offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) int remain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) int state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) int buf_siz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) int buf_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) int nonblocking;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) enum dmx_buffer_flags flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) u32 count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) char name[DVB_VB2_NAME_MAX + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) #ifndef CONFIG_DVB_MMAP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) static inline int dvb_vb2_init(struct dvb_vb2_ctx *ctx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) const char *name, int non_blocking)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) static inline int dvb_vb2_release(struct dvb_vb2_ctx *ctx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) #define dvb_vb2_is_streaming(ctx) (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) #define dvb_vb2_fill_buffer(ctx, file, wait, flags) (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) static inline __poll_t dvb_vb2_poll(struct dvb_vb2_ctx *ctx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) struct file *file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) poll_table *wait)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * dvb_vb2_init - initializes VB2 handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * @ctx: control struct for VB2 handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * @name: name for the VB2 handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) * @non_blocking:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) * if not zero, it means that the device is at non-blocking mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) int dvb_vb2_init(struct dvb_vb2_ctx *ctx, const char *name, int non_blocking);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) * dvb_vb2_release - Releases the VB2 handler allocated resources and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) * put @ctx at DVB_VB2_STATE_NONE state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) * @ctx: control struct for VB2 handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) int dvb_vb2_release(struct dvb_vb2_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) * dvb_vb2_is_streaming - checks if the VB2 handler is streaming
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) * @ctx: control struct for VB2 handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) * Return: 0 if not streaming, 1 otherwise.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) int dvb_vb2_is_streaming(struct dvb_vb2_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) * dvb_vb2_fill_buffer - fills a VB2 buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) * @ctx: control struct for VB2 handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) * @src: place where the data is stored
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) * @len: number of bytes to be copied from @src
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) * @buffer_flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) * pointer to buffer flags as defined by &enum dmx_buffer_flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) * can be NULL.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) int dvb_vb2_fill_buffer(struct dvb_vb2_ctx *ctx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) const unsigned char *src, int len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) enum dmx_buffer_flags *buffer_flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) * dvb_vb2_poll - Wrapper to vb2_core_streamon() for Digital TV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) * buffer handling.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) * @ctx: control struct for VB2 handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) * @file: &struct file argument passed to the poll
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) * file operation handler.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) * @wait: &poll_table wait argument passed to the poll
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) * file operation handler.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) * Implements poll syscall() logic.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) __poll_t dvb_vb2_poll(struct dvb_vb2_ctx *ctx, struct file *file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) poll_table *wait);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) * dvb_vb2_stream_on() - Wrapper to vb2_core_streamon() for Digital TV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) * buffer handling.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) * @ctx: control struct for VB2 handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) * Starts dvb streaming
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) int dvb_vb2_stream_on(struct dvb_vb2_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) * dvb_vb2_stream_off() - Wrapper to vb2_core_streamoff() for Digital TV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) * buffer handling.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) * @ctx: control struct for VB2 handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) * Stops dvb streaming
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) int dvb_vb2_stream_off(struct dvb_vb2_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) * dvb_vb2_reqbufs() - Wrapper to vb2_core_reqbufs() for Digital TV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) * buffer handling.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) * @ctx: control struct for VB2 handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) * @req: &struct dmx_requestbuffers passed from userspace in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) * order to handle &DMX_REQBUFS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) * Initiate streaming by requesting a number of buffers. Also used to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) * free previously requested buffers, is ``req->count`` is zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) int dvb_vb2_reqbufs(struct dvb_vb2_ctx *ctx, struct dmx_requestbuffers *req);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) * dvb_vb2_querybuf() - Wrapper to vb2_core_querybuf() for Digital TV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) * buffer handling.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) * @ctx: control struct for VB2 handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) * @b: &struct dmx_buffer passed from userspace in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) * order to handle &DMX_QUERYBUF.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) int dvb_vb2_querybuf(struct dvb_vb2_ctx *ctx, struct dmx_buffer *b);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) * dvb_vb2_expbuf() - Wrapper to vb2_core_expbuf() for Digital TV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) * buffer handling.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) * @ctx: control struct for VB2 handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) * @exp: &struct dmx_exportbuffer passed from userspace in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) * order to handle &DMX_EXPBUF.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) * Export a buffer as a file descriptor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) int dvb_vb2_expbuf(struct dvb_vb2_ctx *ctx, struct dmx_exportbuffer *exp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) * dvb_vb2_qbuf() - Wrapper to vb2_core_qbuf() for Digital TV buffer handling.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) * @ctx: control struct for VB2 handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) * @b: &struct dmx_buffer passed from userspace in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) * order to handle &DMX_QBUF.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) * Queue a Digital TV buffer as requested by userspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) int dvb_vb2_qbuf(struct dvb_vb2_ctx *ctx, struct dmx_buffer *b);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) * dvb_vb2_dqbuf() - Wrapper to vb2_core_dqbuf() for Digital TV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) * buffer handling.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) * @ctx: control struct for VB2 handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) * @b: &struct dmx_buffer passed from userspace in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) * order to handle &DMX_DQBUF.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) * Dequeue a Digital TV buffer to the userspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) int dvb_vb2_dqbuf(struct dvb_vb2_ctx *ctx, struct dmx_buffer *b);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) * dvb_vb2_mmap() - Wrapper to vb2_mmap() for Digital TV buffer handling.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) * @ctx: control struct for VB2 handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) * @vma: pointer to &struct vm_area_struct with the vma passed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) * to the mmap file operation handler in the driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) * map Digital TV video buffers into application address space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) int dvb_vb2_mmap(struct dvb_vb2_ctx *ctx, struct vm_area_struct *vma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) #endif /* _DVB_VB2_H */