hw/arm: gsj add i2c comments
[qemu/ar7.git] / ui / udmabuf.c
blob23abe1e7eb91b864728ac9fb3f0f9f1cb2ebda84
1 /*
2 * udmabuf helper functions.
4 * This work is licensed under the terms of the GNU GPL, version 2 or later.
5 * See the COPYING file in the top-level directory.
6 */
7 #include "qemu/osdep.h"
8 #include "qapi/error.h"
9 #include "ui/console.h"
11 #ifdef CONFIG_LINUX
13 #include <fcntl.h>
14 #include <sys/ioctl.h>
16 int udmabuf_fd(void)
18 static bool first = true;
19 static int udmabuf;
21 if (!first) {
22 return udmabuf;
24 first = false;
26 udmabuf = open("/dev/udmabuf", O_RDWR);
27 if (udmabuf < 0) {
28 warn_report("open /dev/udmabuf: %s", strerror(errno));
30 return udmabuf;
33 #else
35 int udmabuf_fd(void)
37 return -1;
40 #endif