Mercurial > mplayer.hg
annotate libdha/libdha.c @ 4294:21dbbbbd5479
a few filters (should be removed/merged when arpis videofilter stuff is finished)
-ssf cgb=<float> -> chrominance gaussian blur (nice to improve picture quality)
-ssf lgb=<float> -> luminance gaussian blur (dunno what its good for)
-ssf chs=<int> -> shift chrominance horizontally
-ssf cvs=<int> -> shift chrominance vertically
these will only work if the swscaler is used at all
author | michael |
---|---|
date | Mon, 21 Jan 2002 15:22:28 +0000 |
parents | 4cfb6b9a6da3 |
children | 05ac3586db02 |
rev | line source |
---|---|
3973 | 1 /* |
2 libgha.c - Library for direct hardware access | |
3 Copyrights: | |
4 1996/10/27 - Robin Cutshaw (robin@xfree86.org) | |
5 XFree86 3.3.3 implementation | |
6 1999 - Øyvind Aabling. | |
7 Modified for GATOS/win/gfxdump. | |
8 | |
9 2002 - library implementation by Nick Kurshev | |
4174
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
10 - some changes by Alex Beregszaszi |
3973 | 11 |
12 supported O/S's: SVR4, UnixWare, SCO, Solaris, | |
13 FreeBSD, NetBSD, 386BSD, BSDI BSD/386, | |
14 Linux, Mach/386, ISC | |
15 DOS (WATCOM 9.5 compiler), Win9x (with mapdev.vxd) | |
16 Licence: GPL | |
17 Original location: www.linuxvideo.org/gatos | |
18 */ | |
19 | |
20 #include "libdha.h" | |
21 #include "AsmMacros.h" | |
22 #include <stdio.h> | |
23 #include <stdlib.h> | |
24 #include <string.h> | |
25 #include <fcntl.h> | |
26 #include <sys/stat.h> | |
27 #include <sys/types.h> | |
28 #include <unistd.h> | |
29 | |
4174
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
30 /* instead exit() use libdha_exit, and do the 'mother-application' deinit |
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
31 only in this code */ |
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
32 void libdha_exit(const char *message, int level) |
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
33 { |
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
34 printf("libdha: FATAL: %s\n", message); |
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
35 exit(level); /* FIXME */ |
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
36 } |
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
37 |
4164 | 38 #if defined(_WIN32) |
39 #include "sysdep/libdha_win32.c" | |
40 #elif defined (__EMX__) | |
41 #include "sysdep/libdha_os2.c" | |
42 #else | |
3973 | 43 |
4164 | 44 #if defined(SVR4) || defined(SCO325) |
45 # if !(defined(sun) && defined (i386) && defined (SVR4)) | |
46 # define DEV_MEM "/dev/pmem" | |
47 # elif defined(PowerMAX_OS) | |
48 # define DEV_MEM "/dev/iomem" | |
49 # endif | |
50 # ifdef SCO325 | |
51 # undef DEV_MEM | |
52 # define DEV_MEM "/dev/mem" | |
53 # endif | |
54 # endif /* SVR4 */ | |
3973 | 55 |
4164 | 56 /* Generic version */ |
57 #include <sys/mman.h> | |
3973 | 58 |
4164 | 59 #ifndef DEV_MEM |
60 #define DEV_MEM "/dev/mem" | |
61 #endif | |
3973 | 62 |
63 static int mem=-1; | |
64 void *map_phys_mem(unsigned base, unsigned size) | |
65 { | |
4164 | 66 if ( (mem = open(DEV_MEM,O_RDWR)) == -1) { |
3973 | 67 perror("libdha: open(/dev/mem) failed") ; exit(1) ; |
68 } | |
4164 | 69 return mmap(0,size,PROT_READ|PROT_WRITE,MAP_SHARED,mem,base) ; |
3973 | 70 } |
71 | |
72 void unmap_phys_mem(void *ptr, unsigned size) | |
73 { | |
74 int res=munmap(ptr,size) ; | |
75 if (res == -1) { perror("libdha: munmap() failed") ; exit(1) ; } | |
76 close(mem); | |
77 } | |
78 #endif | |
79 | |
3995 | 80 unsigned char INPORT8(unsigned idx) |
3973 | 81 { |
82 return inb(idx); | |
83 } | |
84 | |
3995 | 85 unsigned short INPORT16(unsigned idx) |
3973 | 86 { |
87 return inw(idx); | |
88 } | |
89 | |
3995 | 90 unsigned INPORT32(unsigned idx) |
3973 | 91 { |
92 return inl(idx); | |
93 } | |
94 | |
3995 | 95 void OUTPORT8(unsigned idx,unsigned char val) |
3973 | 96 { |
97 outb(idx,val); | |
98 } | |
99 | |
3995 | 100 void OUTPORT16(unsigned idx,unsigned short val) |
3973 | 101 { |
102 outw(idx,val); | |
103 } | |
104 | |
3995 | 105 void OUTPORT32(unsigned idx,unsigned val) |
3973 | 106 { |
107 outl(idx,val); | |
108 } | |
4174
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
109 |