@@ -1,3 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
+vidtv_demod-objs := vidtv_common.o
+vidtv_bridge-objs := vidtv_common.o
+
obj-$(CONFIG_DVB_VIDTV) += vidtv_tuner.o vidtv_demod.o vidtv_bridge.o
new file mode 100644
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * The Virtual DVB test driver serves as a reference DVB driver and helps
+ * validate the existing APIs in the media subsystem. It can also aid
+ * developers working on userspace applications.
+ *
+ * Written by Daniel W. S. Almeida <dwlsalmeida@gmail.com>
+ */
+
+#include <linux/types.h>
+#include <linux/string.h>
+#include <linux/printk.h>
+
+u32 vidtv_memcpy(void *to,
+ const void *from,
+ size_t len,
+ u32 offset,
+ u32 buf_sz)
+{
+ if (buf_sz && offset + len > buf_sz) {
+ pr_err("%s: overflow detected, skipping. Try increasing the buffer size",
+ __func__);
+ return 0;
+ }
+
+ memcpy(to, from, len);
+ return len;
+}
+
+u32 vidtv_memset(void *to,
+ int c,
+ size_t len,
+ u32 offset,
+ u32 buf_sz)
+{
+ if (buf_sz && offset + len > buf_sz) {
+ pr_err("%s: overflow detected, skipping. Try increasing the buffer size",
+ __func__);
+ return 0;
+ }
+
+ memset(to, c, len);
+ return len;
+}
new file mode 100644
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * The Virtual DVB test driver serves as a reference DVB driver and helps
+ * validate the existing APIs in the media subsystem. It can also aid
+ * developers working on userspace applications.
+ *
+ * Written by Daniel W. S. Almeida <dwlsalmeida@gmail.com>
+ */
+
+#ifndef VIDTV_COMMON_H
+#define VIDTV_COMMON_H
+
+#include <linux/types.h>
+#include <media/dvb_frontend.h>
+
+u32 vidtv_memcpy(void *to,
+ const void *from,
+ size_t len,
+ u32 offset,
+ u32 buf_sz);
+
+u32 vidtv_memset(void *to,
+ int c,
+ size_t len,
+ u32 offset,
+ u32 buf_sz);
+
+#endif // VIDTV_COMMON_H