henryhsu | 58be50c | 2014-10-30 11:49:19 +0800 | [diff] [blame] | 1 | /* 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 Li | dcec433 | 2014-11-13 15:49:21 +0800 | [diff] [blame^] | 9 | #include "libvpu/rk_vepu_interface.h" |
henryhsu | 58be50c | 2014-10-30 11:49:19 +0800 | [diff] [blame] | 10 | |
| 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 | |
| 24 | static void *plugin_init(int fd) |
| 25 | { |
| 26 | return NULL; |
| 27 | } |
| 28 | |
| 29 | static void plugin_close(void *dev_ops_priv) |
| 30 | { |
| 31 | } |
| 32 | |
| 33 | static 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 | |
| 39 | PLUGIN_PUBLIC const struct libv4l_dev_ops libv4l2_plugin = { |
| 40 | .init = &plugin_init, |
| 41 | .close = &plugin_close, |
| 42 | .ioctl = &plugin_ioctl, |
| 43 | }; |