Mercurial > mplayer.hg
annotate vidix/dhahelper/test.c @ 33556:520fb0f7544c
Rename GUI directory 'mplayer' and some files in it.
The directory 'mplayer' contains the files for the user interface and
has thus been renamed 'ui'.
Inside this directory the following files have been renamed to better
reflect their contents:
mw.c -> main.c
sw.c -> sub.c
pb.c -> playbar.c
gui_common.* -> render.*
play.* -> actions.*
author | ib |
---|---|
date | Sat, 18 Jun 2011 16:03:31 +0000 |
parents | 0f1b5b68af32 |
children |
rev | line source |
---|---|
27006 | 1 /* |
2 * dhahelper test program | |
3 * | |
4 * Copyright (C) 2002 Alex Beregszsaszi | |
5 * | |
6 * This file is part of MPlayer. | |
7 * | |
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. | |
12 * | |
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. | |
17 * | |
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. | |
21 */ | |
22 | |
26901
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
23 #include <string.h> |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
24 #include <stdio.h> |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
25 #include <sys/ioctl.h> |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
26 #include <unistd.h> |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
27 #include <errno.h> |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
28 #include <fcntl.h> |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
29 #include <sys/mman.h> |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27006
diff
changeset
|
30 |
26901
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
31 #include "dhahelper.h" |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
32 |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
33 int main(int argc, char *argv[]) |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
34 { |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
35 int fd; |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
36 int ret; |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
37 |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
38 fd = open("/dev/dhahelper", O_RDWR); |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
39 |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
40 ioctl(fd, DHAHELPER_GET_VERSION, &ret); |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
41 |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
42 printf("api version: %d\n", ret); |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
43 if (ret != API_VERSION) |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
44 printf("incompatible api!\n"); |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
45 |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
46 { |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
47 dhahelper_memory_t mem; |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
48 |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
49 mem.operation = MEMORY_OP_MAP; |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
50 //mem.start = 0xe0000000; |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
51 mem.start = 0xe4000008; |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
52 mem.offset = 0; |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
53 mem.size = 0x4000; |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
54 mem.ret = 0; |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
55 |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
56 ret = ioctl(fd, DHAHELPER_MEMORY, &mem); |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
57 |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
58 printf("ret: %s\n", strerror(errno)); |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
59 |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
60 mem.ret = (int)mmap(NULL, (size_t)mem.size, PROT_READ, MAP_SHARED, fd, (off_t)0); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27006
diff
changeset
|
61 printf("allocated to %x\n", mem.ret); |
26901
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
62 |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
63 if (argc > 1) |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
64 if (mem.ret != 0) |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
65 { |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
66 int i; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27006
diff
changeset
|
67 |
26901
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
68 for (i = 0; i < 256; i++) |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
69 printf("[%x] ", *(int *)(mem.ret+i)); |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
70 printf("\n"); |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
71 } |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
72 |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
73 munmap((void *)mem.ret, mem.size); |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
74 |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
75 mem.operation = MEMORY_OP_UNMAP; |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
76 mem.start = mem.ret; |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
77 |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
78 ioctl(fd, DHAHELPER_MEMORY, &mem); |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
79 } |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
80 |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
81 return 0; |
af5408de478f
Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff
changeset
|
82 } |