blob: 80cb62f274b33b123d0d93a85b8deb88d7499177 [file] [log] [blame]
henryhsu58be50c2014-10-30 11:49:19 +08001/* Copyright 2014 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5
6#include <unistd.h>
7#include <sys/syscall.h>
8#include "libv4l-plugin.h"
Wu-Cheng Lidcec4332014-11-13 15:49:21 +08009#include "libvpu/rk_vepu_interface.h"
henryhsu58be50c2014-10-30 11:49:19 +080010
11#define SYS_IOCTL(fd, cmd, arg) \
12 syscall(SYS_ioctl, (int)(fd), (unsigned long)(cmd), (void *)(arg))
13#define SYS_READ(fd, buf, len) \
14 syscall(SYS_read, (int)(fd), (void *)(buf), (size_t)(len));
15#define SYS_WRITE(fd, buf, len) \
16 syscall(SYS_write, (int)(fd), (const void *)(buf), (size_t)(len));
17
18#if HAVE_VISIBILITY
19#define PLUGIN_PUBLIC __attribute__ ((__visibility__("default")))
20#else
21#define PLUGIN_PUBLIC
22#endif
23
24static void *plugin_init(int fd)
25{
26 return NULL;
27}
28
29static void plugin_close(void *dev_ops_priv)
30{
31}
32
33static int plugin_ioctl(void *dev_ops_priv, int fd,
34 unsigned long int cmd, void *arg)
35{
36 return SYS_IOCTL(fd, cmd, arg);
37}
38
39PLUGIN_PUBLIC const struct libv4l_dev_ops libv4l2_plugin = {
40 .init = &plugin_init,
41 .close = &plugin_close,
42 .ioctl = &plugin_ioctl,
43};