demux_ts.c: cleanup
[mplayer/glamo.git] / vidix / dhahelper / test.c
blob59e356efea9c281d7d194b93732a1e58a311398b
1 /*
2 * dhahelper test program
4 * Copyright (C) 2002 Alex Beregszsaszi
6 * This file is part of MPlayer.
8 * MPlayer is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * MPlayer is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include <string.h>
24 #include <stdio.h>
25 #include <sys/ioctl.h>
26 #include <unistd.h>
27 #include <errno.h>
28 #include <fcntl.h>
29 #include <sys/mman.h>
31 #include "dhahelper.h"
33 int main(int argc, char *argv[])
35 int fd;
36 int ret;
38 fd = open("/dev/dhahelper", O_RDWR);
40 ioctl(fd, DHAHELPER_GET_VERSION, &ret);
42 printf("api version: %d\n", ret);
43 if (ret != API_VERSION)
44 printf("incompatible api!\n");
47 dhahelper_memory_t mem;
49 mem.operation = MEMORY_OP_MAP;
50 //mem.start = 0xe0000000;
51 mem.start = 0xe4000008;
52 mem.offset = 0;
53 mem.size = 0x4000;
54 mem.ret = 0;
56 ret = ioctl(fd, DHAHELPER_MEMORY, &mem);
58 printf("ret: %s\n", strerror(errno));
60 mem.ret = (int)mmap(NULL, (size_t)mem.size, PROT_READ, MAP_SHARED, fd, (off_t)0);
61 printf("allocated to %x\n", mem.ret);
63 if (argc > 1)
64 if (mem.ret != 0)
66 int i;
68 for (i = 0; i < 256; i++)
69 printf("[%x] ", *(int *)(mem.ret+i));
70 printf("\n");
73 munmap((void *)mem.ret, mem.size);
75 mem.operation = MEMORY_OP_UNMAP;
76 mem.start = mem.ret;
78 ioctl(fd, DHAHELPER_MEMORY, &mem);
81 return 0;