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.
25 #include <sys/ioctl.h>
31 #include "dhahelper.h"
33 int main(int argc
, char *argv
[])
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;
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
);
68 for (i
= 0; i
< 256; i
++)
69 printf("[%x] ", *(int *)(mem
.ret
+i
));
73 munmap((void *)mem
.ret
, mem
.size
);
75 mem
.operation
= MEMORY_OP_UNMAP
;
78 ioctl(fd
, DHAHELPER_MEMORY
, &mem
);