[prev in list] [next in list] [prev in thread] [next in thread]
List: xine-cvslog
Subject: [xine-cvs] HG: xine-lib-1.2-plugin-loader: [33/35] Merge from 1.2
From: Darren Salt <linux () youmustbejoking ! demon ! co ! uk>
Date: 2007-06-21 22:31:50
Message-ID: 3e9d711a77870cbbca8d.1182464857:33 () hg ! debian ! org
[Download RAW message or body]
# [node df73844e8a47005bef76ffe6cd9323d8e6a1c218 part 33]
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/libxineadec/nosefart/osd.h
--- a/src/libxineadec/nosefart/osd.h Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
-** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com)
-**
-**
-** This program is free software; you can redistribute it and/or
-** modify it under the terms of version 2 of the GNU Library General
-** Public License as published by the Free Software Foundation.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-** Library General Public License for more details. To obtain a
-** copy of the GNU Library General Public License, write to the Free
-** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**
-** Any permitted reproduction of these routines, in whole or in part,
-** must bear this legend.
-**
-**
-** osd.h
-**
-** O/S dependent routine defintions (must be customized)
-** $Id: osd.h,v 1.2 2003/07/12 12:31:14 mroi Exp $
-*/
-
-#ifndef _OSD_H_
-#define _OSD_H_
-
-#if defined(__GNUC__) || defined(__ICC)
-#define PATH_SEP '/'
-#ifdef __DJGPP__
-#include <dpmi.h>
-#include "dos_ints.h"
-#endif
-#elif defined(WIN32)
-#define PATH_SEP '\\'
-#else /* crapintosh? */
-#define PATH_SEP ':'
-#endif
-
-extern void osd_loginit(void);
-extern void osd_logshutdown(void);
-extern void osd_logprint(const char *string);
-
-extern int osd_startsound(void (*playfunc)(void *buffer, int size));
-extern int osd_getsoundbps(void);
-extern int osd_getsamplerate(void);
-
-
-#ifndef NSF_PLAYER
-#include "rgb.h"
-#include "bitmap.h"
-
-extern bitmap_t *osd_getvidbuf(void);
-typedef void (*blitproc_t)(bitmap_t *bmp, int x_pos, int y_pos, int width, int \
height);
-extern blitproc_t osd_blit;
-extern void osd_copytoscreen(void);
-
-extern void osd_showusage(char *filename);
-extern void osd_fullname(char *fullname, const char *shortname);
-extern char *osd_newextension(char *string, char *ext);
-
-extern void osd_setpalette(rgb_t *pal);
-extern void osd_restorepalette(void);
-
-extern void osd_getinput(void);
-extern int osd_gethostinput(void);
-extern void osd_getmouse(int *x, int *y, int *button);
-
-extern int osd_init(void);
-extern void osd_shutdown(void);
-#endif /* !NSF_PLAYER */
-
-#endif /* _OSD_H_ */
-
-/*
-** $Log: osd.h,v $
-** Revision 1.2 2003/07/12 12:31:14 mroi
-** - adding support for the Intel compiler icc
-** - general multipass compilation make targets
-**
-** Revision 1.1 2003/01/08 07:04:35 tmmm
-** initial import of Nosefart sources
-**
-** Revision 1.7 2000/07/04 04:45:33 matt
-** moved INLINE define into types.h
-**
-** Revision 1.6 2000/06/29 16:06:18 neil
-** Wrapped DOS-specific headers in an ifdef
-**
-** Revision 1.5 2000/06/09 15:12:25 matt
-** initial revision
-**
-*/
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/libxineadec/nosefart/types.h
--- a/src/libxineadec/nosefart/types.h Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-/*
-** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com)
-**
-**
-** This program is free software; you can redistribute it and/or
-** modify it under the terms of version 2 of the GNU Library General
-** Public License as published by the Free Software Foundation.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-** Library General Public License for more details. To obtain a
-** copy of the GNU Library General Public License, write to the Free
-** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**
-** Any permitted reproduction of these routines, in whole or in part,
-** must bear this legend.
-**
-**
-** types.h
-**
-** Data type definitions
-** $Id: types.h,v 1.4 2004/08/27 19:33:37 valtri Exp $
-*/
-
-#ifndef _NOSEFART_TYPES_H_
-#define _NOSEFART_TYPES_H_
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-/* Define this if running on little-endian (x86) systems */
-#ifdef WORDS_BIGENDIAN
-#undef HOST_LITTLE_ENDIAN
-#else
-#define HOST_LITTLE_ENDIAN
-#endif
-
-#ifdef __GNUC__
-#define INLINE static inline
-#elif defined(WIN32)
-#define INLINE static __inline
-#else /* crapintosh? */
-#define INLINE static
-#endif
-
-/* These should be changed depending on the platform */
-typedef char int8;
-typedef short int16;
-typedef int int32;
-
-typedef unsigned char uint8;
-typedef unsigned short uint16;
-typedef unsigned int uint32;
-
-typedef uint8 boolean;
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
-#ifdef NOFRENDO_DEBUG
-#include <stdlib.h>
-#include "memguard.h"
-#include "log.h"
-#define ASSERT(expr) if (FALSE == (expr))\
- {\
- log_printf("ASSERT: line %d of %s\n", __LINE__, \
__FILE__);\
- log_shutdown();\
- exit(1);\
- }
-#define ASSERT_MSG(msg) {\
- log_printf("ASSERT: %s\n", msg);\
- log_shutdown();\
- exit(1);\
- }
-#else /* Not debugging */
-#include "memguard.h"
-#define ASSERT(expr)
-#define ASSERT_MSG(msg)
-#endif
-
-#endif /* _NOSEFART_TYPES_H_ */
-
-/*
-** $Log: types.h,v $
-** Revision 1.4 2004/08/27 19:33:37 valtri
-** MINGW32 port. Engine library and most of plugins compiles now.
-**
-** List of some changes:
-** - replaced some _MSC_VER by more common WIN32
-** - define INTLDIR, remove -static flag for included intl
-** - shared more common CFLAGS with DEBUG_CFLAGS
-** - use WIN32_CFLAGS for all building
-** - separate some flags into THREAD_CFLAGS_CONFIG,
-** THREAD_CFLAGS_CONFIG and ZLIB_LIB_CONFIG for public xine-config,
-** automatically use internal libs if necessary
-** - don't warn about missing X for mingw and cygwin
-** - libw32dll disabled for WIN32 (making native loader would be
-** interesting, or porting wine code to Windows? :->)
-** - DVB and RTP disabled for WIN32, not ported yet
-** - fix build and fix a warning in cdda
-** - fix build for nosefart and libfaad
-** - implement configure option --disable-freetype
-** - sync libxine.pc and xine-config.in
-** - add -liberty to goom under WIN32
-** - move original build files from included phread and zlib into archives
-** and replace them by autotools
-**
-** Revision 1.3 2003/01/11 15:53:53 tmmm
-** make the Nosefart engine aware of the config's WORDS_BIGENDIAN #define
-**
-** Revision 1.2 2003/01/09 19:50:04 jkeil
-** NSF audio files were crashing on SPARC.
-**
-** - Define the correct HOST_ENDIAN for SPARC
-** - remove unaligned memory accesses
-**
-** Revision 1.1 2003/01/08 07:04:36 tmmm
-** initial import of Nosefart sources
-**
-** Revision 1.7 2000/07/04 04:46:44 matt
-** moved INLINE define from osd.h
-**
-** Revision 1.6 2000/06/09 15:12:25 matt
-** initial revision
-**
-*/
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/libxineadec/nosefart/version.h
--- a/src/libxineadec/nosefart/version.h Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
-** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com)
-**
-**
-** This program is free software; you can redistribute it and/or
-** modify it under the terms of version 2 of the GNU Library General
-** Public License as published by the Free Software Foundation.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-** Library General Public License for more details. To obtain a
-** copy of the GNU Library General Public License, write to the Free
-** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**
-** Any permitted reproduction of these routines, in whole or in part,
-** must bear this legend.
-**
-**
-** version.h
-**
-** Program name / version definitions
-** $Id: version.h,v 1.2 2003/12/05 15:55:01 f1rmb Exp $
-*/
-
-#ifndef _VERSION_H_
-#define _VERSION_H_
-
-#ifdef NSF_PLAYER
-#define APP_STRING "Nosefart"
-#else
-#define APP_STRING "Nofrendo"
-#endif /* NSF_PLAYER */
-
-#define APP_VERSION "1.92"
-
-#endif /* _VERSION_H_ */
-
-/*
-** $Log: version.h,v $
-** Revision 1.2 2003/12/05 15:55:01 f1rmb
-** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's \
relevant too. Small other little fix (can't remember). Change few internal function \
prototype because it xine_t pointer need to be used if some xine's internal sections. \
NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, \
without invasive changes. To be continued...
-**
-** Revision 1.1 2003/01/08 07:04:36 tmmm
-** initial import of Nosefart sources
-**
-** Revision 1.7 2000/07/04 04:46:55 matt
-** updated version number
-**
-** Revision 1.6 2000/06/20 00:03:39 matt
-** updated for 1.91
-**
-** Revision 1.5 2000/06/09 17:01:56 matt
-** changed version to 1.90
-**
-** Revision 1.4 2000/06/09 15:12:25 matt
-** initial revision
-**
-*/
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/libxineadec/nosefart/vrc7_snd.c
--- a/src/libxineadec/nosefart/vrc7_snd.c Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,347 +0,0 @@
-/*
-** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com)
-**
-**
-** This program is free software; you can redistribute it and/or
-** modify it under the terms of version 2 of the GNU Library General
-** Public License as published by the Free Software Foundation.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-** Library General Public License for more details. To obtain a
-** copy of the GNU Library General Public License, write to the Free
-** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**
-** Any permitted reproduction of these routines, in whole or in part,
-** must bear this legend.
-**
-**
-** vrc7_snd.c
-**
-** VRCVII sound hardware emulation
-** Thanks to Charles MacDonald (cgfm2@hooked.net) for donating code.
-** $Id: vrc7_snd.c,v 1.2 2003/12/05 15:55:01 f1rmb Exp $
-*/
-
-#include <stdio.h>
-#include "types.h"
-#include "vrc7_snd.h"
-#include "fmopl.h"
-
-
-static int buflen;
-static int16 *buffer;
-
-#define OPL_WRITE(opl, r, d) \
-{ \
- OPLWrite((opl)->ym3812, 0, (r)); \
- OPLWrite((opl)->ym3812, 1, (d)); \
-}
-
-static vrc7_t vrc7;
-
-/* Fixed instrument settings, from MAME's YM2413 emulation */
-/* This might need some tweaking... */
-unsigned char table[16][11] =
-{
- /* 20 23 40 43 60 63 80 83 E0 E3 C0 */
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-
- /* MAME */
- { 0x01, 0x22, 0x23, 0x07, 0xF0, 0xF0, 0x07, 0x18, 0x00, 0x00, 0x00 }, /* Violin \
*/
- { 0x23, 0x01, 0x68, 0x05, 0xF2, 0x74, 0x6C, 0x89, 0x00, 0x00, 0x00 }, /* Acoustic \
Guitar(steel) */
- { 0x13, 0x11, 0x25, 0x00, 0xD2, 0xB2, 0xF4, 0xF4, 0x00, 0x00, 0x00 }, /* Acoustic \
Grand */
- { 0x22, 0x21, 0x1B, 0x05, 0xC0, 0xA1, 0x18, 0x08, 0x00, 0x00, 0x00 }, /* Flute */
- { 0x22, 0x21, 0x2C, 0x03, 0xD2, 0xA1, 0x18, 0x57, 0x00, 0x00, 0x00 }, /* Clarinet \
*/
- { 0x01, 0x22, 0xBA, 0x01, 0xF1, 0xF1, 0x1E, 0x04, 0x00, 0x00, 0x00 }, /* Oboe */
- { 0x21, 0x21, 0x28, 0x06, 0xF1, 0xF1, 0x6B, 0x3E, 0x00, 0x00, 0x00 }, /* Trumpet \
*/
- { 0x27, 0x21, 0x60, 0x00, 0xF0, 0xF0, 0x0D, 0x0F, 0x00, 0x00, 0x00 }, /* Church \
Organ */
- { 0x20, 0x21, 0x2B, 0x06, 0x85, 0xF1, 0x6D, 0x89, 0x00, 0x00, 0x00 }, /* French \
Horn */
- { 0x01, 0x21, 0xBF, 0x02, 0x53, 0x62, 0x5F, 0xAE, 0x01, 0x00, 0x00 }, /* Synth \
Voice */
- { 0x23, 0x21, 0x70, 0x07, 0xD4, 0xA3, 0x4E, 0x64, 0x01, 0x00, 0x00 }, /* \
Harpsichord */
- { 0x2B, 0x21, 0xA4, 0x07, 0xF6, 0x93, 0x5C, 0x4D, 0x00, 0x00, 0x00 }, /* \
Vibraphone */
- { 0x21, 0x23, 0xAD, 0x07, 0x77, 0xF1, 0x18, 0x37, 0x00, 0x00, 0x00 }, /* Synth \
Bass 1 */
- { 0x21, 0x21, 0x2A, 0x03, 0xF3, 0xE2, 0x29, 0x46, 0x00, 0x00, 0x00 }, /* Acoustic \
Bass */
- { 0x21, 0x23, 0x37, 0x03, 0xF3, 0xE2, 0x29, 0x46, 0x00, 0x00, 0x00 }, /* Electric \
Guitar(clean) */
-
-
-#if 0
- /* Horton, try 1 */
- { 0x05, 0x03, 0x10, 0x06, 0x74, 0xA1, 0x13, 0xF4, 0x00, 0x00, 0x00 },
- { 0x05, 0x01, 0x16, 0x00, 0xF9, 0xA2, 0x15, 0xF5, 0x00, 0x00, 0x00 },
- { 0x01, 0x41, 0x11, 0x00, 0xA0, 0xA0, 0x83, 0x95, 0x00, 0x00, 0x00 },
- { 0x01, 0x41, 0x17, 0x00, 0x60, 0xF0, 0x83, 0x95, 0x00, 0x00, 0x00 },
- { 0x24, 0x41, 0x1F, 0x00, 0x50, 0xB0, 0x94, 0x94, 0x00, 0x00, 0x00 },
- { 0x05, 0x01, 0x0B, 0x04, 0x65, 0xA0, 0x54, 0x95, 0x00, 0x00, 0x00 },
- { 0x11, 0x41, 0x0E, 0x04, 0x70, 0xC7, 0x13, 0x10, 0x00, 0x00, 0x00 },
- { 0x02, 0x44, 0x16, 0x06, 0xE0, 0xE0, 0x31, 0x35, 0x00, 0x00, 0x00 },
- { 0x48, 0x22, 0x22, 0x07, 0x50, 0xA1, 0xA5, 0xF4, 0x00, 0x00, 0x00 },
- { 0x05, 0xA1, 0x18, 0x00, 0xA2, 0xA2, 0xF5, 0xF5, 0x00, 0x00, 0x00 },
- { 0x07, 0x81, 0x2B, 0x05, 0xA5, 0xA5, 0x03, 0x03, 0x00, 0x00, 0x00 },
- { 0x01, 0x41, 0x08, 0x08, 0xA0, 0xA0, 0x83, 0x95, 0x00, 0x00, 0x00 },
- { 0x21, 0x61, 0x12, 0x00, 0x93, 0x92, 0x74, 0x75, 0x00, 0x00, 0x00 },
- { 0x21, 0x62, 0x21, 0x00, 0x84, 0x85, 0x34, 0x15, 0x00, 0x00, 0x00 },
- { 0x21, 0x62, 0x0E, 0x00, 0xA1, 0xA0, 0x34, 0x15, 0x00, 0x00, 0x00 },
-#endif
-
-#if 0
- /* Horton try 2 */
- { 0x31, 0x22, 0x23, 0x07, 0xF0, 0xF0, 0xE8, 0xF7, 0x00, 0x00, 0x00 },
- { 0x03, 0x31, 0x68, 0x05, 0xF2, 0x74, 0x79, 0x9C, 0x00, 0x00, 0x00 },
- { 0x01, 0x51, 0x72, 0x04, 0xF1, 0xD3, 0x9D, 0x8B, 0x00, 0x00, 0x00 },
- { 0x22, 0x61, 0x1B, 0x05, 0xC0, 0xA1, 0xF8, 0xE8, 0x00, 0x00, 0x00 },
- { 0x22, 0x61, 0x2C, 0x03, 0xD2, 0xA1, 0xA7, 0xE8, 0x00, 0x00, 0x00 },
- { 0x31, 0x22, 0xFA, 0x01, 0xF1, 0xF1, 0xF4, 0xEE, 0x00, 0x00, 0x00 },
- { 0x21, 0x61, 0x28, 0x06, 0xF1, 0xF1, 0xCE, 0x9B, 0x00, 0x00, 0x00 },
- { 0x27, 0x61, 0x60, 0x00, 0xF0, 0xF0, 0xFF, 0xFD, 0x00, 0x00, 0x00 },
- { 0x60, 0x21, 0x2B, 0x06, 0x85, 0xF1, 0x79, 0x9D, 0x00, 0x00, 0x00 },
- { 0x31, 0xA1, 0xFF, 0x0A, 0x53, 0x62, 0x5E, 0xAF, 0x00, 0x00, 0x00 },
- { 0x03, 0xA1, 0x70, 0x0F, 0xD4, 0xA3, 0x94, 0xBE, 0x00, 0x00, 0x00 },
- { 0x2B, 0x61, 0xE4, 0x07, 0xF6, 0x93, 0xBD, 0xAC, 0x00, 0x00, 0x00 },
- { 0x21, 0x63, 0xED, 0x07, 0x77, 0xF1, 0xC7, 0xE8, 0x00, 0x00, 0x00 },
- { 0x21, 0x61, 0x2A, 0x03, 0xF3, 0xE2, 0xB6, 0xD9, 0x00, 0x00, 0x00 },
- { 0x21, 0x63, 0x37, 0x03, 0xF3, 0xE2, 0xB6, 0xD9, 0x00, 0x00, 0x00 },
-#endif
-};
-
-static void vrc7_reset(void)
-{
- int n;
-
- /* Point to current VRC7 context */
- vrc7_t *opll = &vrc7;
-
- /* Clear all YM3812 registers */
- for (n = 0; n < 0x100; n++)
- OPL_WRITE(opll, n, 0x00);
-
- /* Turn off rhythm mode and key-on bits */
- OPL_WRITE(opll, 0xBD, 0xC0);
-
- /* Enable waveform select */
- OPL_WRITE(opll, 0x01, 0x20);
-}
[... 95 lines omitted ...]
- /* If the user instrument registers were accessed, then
- go through each channel and update the ones that were
- currently using the user instrument. We can skip the
- last three channels in rhythm mode since they can
- only use percussion sounds anyways. */
- if (opll->latch <= 0x05)
- {
- uint8 x;
-
- for (x = 0; x < 6; x++)
- if (opll->channel[x].instrument == 0x00)
- load_instrument(x, 0x00, opll->channel[x].volume);
- }
- break;
-
- case 0x10: /* Channel Frequency (LSB) */
- case 0x20: /* Channel Frequency (MSB) + key-on and sustain control */
- {
- uint8 block;
- uint16 frequency;
- uint8 ch = (opll->latch & 0x0F);
-
- /* Ensure proper channel range */
- if (ch > 0x05)
- break;
-
- /* Get VRC7 channel frequency */
- frequency = ((opll->reg[0x10 + ch] & 0xFF) | ((opll->reg[0x20 + ch] & \
0x01) << 8));
-
- /* Scale 9 bit frequency to 10 bits */
- frequency = (frequency << 1) & 0x1FFF;
-
- /* Get VRC7 block */
- block = (opll->reg[0x20 + ch] >> 1) & 7;
-
- /* Add in block */
- frequency |= (block << 10);
-
- /* Add key-on flag */
- if (opll->reg[0x20 + ch] & 0x10)
- frequency |= 0x2000;
-
- /* Save current frequency/block/key-on setting */
- opll->channel[ch].frequency = (frequency & 0x3FFF);
-
- /* Write changes to YM3812 */
- OPL_WRITE(opll, 0xA0 + ch, (opll->channel[ch].frequency >> 0) & 0xFF);
- OPL_WRITE(opll, 0xB0 + ch, (opll->channel[ch].frequency >> 8) & 0xFF);
- }
- break;
-
- case 0x30: /* Channel Volume Level and Instrument Select */
-
- /* Ensure proper channel range */
- if (opll->latch > 0x35)
- break;
-
- {
- uint8 ch = (opll->latch & 0x0F);
- uint8 inst = (data >> 4) & 0x0F;
- uint8 vol = (data & 0x0F) << 2;
- load_instrument(ch, inst, vol);
- }
-
- break;
- }
- }
- else /* Register latch */
- {
- opll->latch = (data & 0x3F);
- }
-}
-
-static int32 vrc7_process(void)
-{
- static int sample = 0;
-
- /* update a large chunk at once */
- if (sample >= buflen)
- {
- sample -= buflen;
- YM3812UpdateOne(vrc7.ym3812, buffer, buflen);
- }
-
- return (int32) ((int16 *) buffer)[sample++];
-}
-
-static apu_memwrite vrc7_memwrite[] =
-{
- { 0x9010, 0x9010, vrc7_write },
- { 0x9030, 0x9030, vrc7_write },
- { -1, -1, NULL }
-};
-
-apuext_t vrc7_ext =
-{
- vrc7_init,
- vrc7_shutdown,
- vrc7_reset,
- vrc7_process,
- NULL, /* no reads */
- vrc7_memwrite
-};
-
-/*
-** $Log: vrc7_snd.c,v $
-** Revision 1.2 2003/12/05 15:55:01 f1rmb
-** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's \
relevant too. Small other little fix (can't remember). Change few internal function \
prototype because it xine_t pointer need to be used if some xine's internal sections. \
NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, \
without invasive changes. To be continued...
-**
-** Revision 1.1 2003/01/08 07:04:36 tmmm
-** initial import of Nosefart sources
-**
-** Revision 1.5 2000/07/04 04:51:02 matt
-** made data types stricter
-**
-** Revision 1.4 2000/07/03 02:18:53 matt
-** much better external module exporting
-**
-** Revision 1.3 2000/06/20 20:45:09 matt
-** minor cleanups
-**
-** Revision 1.2 2000/06/20 04:06:16 matt
-** migrated external sound definition to apu module
-**
-** Revision 1.1 2000/06/20 00:06:47 matt
-** initial revision
-**
-*/
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/libxineadec/nosefart/vrc7_snd.h
--- a/src/libxineadec/nosefart/vrc7_snd.h Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com)
-**
-**
-** This program is free software; you can redistribute it and/or
-** modify it under the terms of version 2 of the GNU Library General
-** Public License as published by the Free Software Foundation.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-** Library General Public License for more details. To obtain a
-** copy of the GNU Library General Public License, write to the Free
-** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**
-** Any permitted reproduction of these routines, in whole or in part,
-** must bear this legend.
-**
-**
-** vrc7_snd.h
-**
-** VRCVII (Konami MMC) sound hardware emulation header
-** Thanks to Charles MacDonald (cgfm2@hooked.net) for donating code.
-**
-** $Id: vrc7_snd.h,v 1.1 2003/01/08 07:04:36 tmmm Exp $
-*/
-
-#ifndef _VRC7_SND_H_
-#define _VRC7_SND_H_
-
-#include "fmopl.h"
-
-/* VRC7 context */
-typedef struct vrc7_s
-{
- uint8 reg[0x40]; /* 64 registers */
- uint8 latch; /* Register latch */
- uint8 user[0x10]; /* User instrument settings */
- struct
- {
- uint16 frequency; /* Channel frequency */
- uint8 volume; /* Channel volume */
- uint8 instrument; /* Channel instrument */
- } channel[9];
-
- FM_OPL *ym3812;
-} vrc7_t;
-
-
-#include "nes_apu.h"
-
-extern apuext_t vrc7_ext;
-
-#endif /* !_VRC7_SND_H_ */
-
-/*
-** $Log: vrc7_snd.h,v $
-** Revision 1.1 2003/01/08 07:04:36 tmmm
-** initial import of Nosefart sources
-**
-** Revision 1.3 2000/07/04 04:51:02 matt
-** made data types stricter
-**
-** Revision 1.2 2000/06/20 04:06:16 matt
-** migrated external sound definition to apu module
-**
-** Revision 1.1 2000/06/20 00:06:47 matt
-** initial revision
-**
-*/
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/libxineadec/nosefart/vrcvisnd.c
--- a/src/libxineadec/nosefart/vrcvisnd.c Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,210 +0,0 @@
-/*
-** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com)
-**
-**
-** This program is free software; you can redistribute it and/or
-** modify it under the terms of version 2 of the GNU Library General
-** Public License as published by the Free Software Foundation.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-** Library General Public License for more details. To obtain a
-** copy of the GNU Library General Public License, write to the Free
-** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**
-** Any permitted reproduction of these routines, in whole or in part,
-** must bear this legend.
-**
-**
-** vrcvisnd.c
-**
-** VRCVI sound hardware emulation
-** $Id: vrcvisnd.c,v 1.2 2003/12/05 15:55:01 f1rmb Exp $
-*/
-
-#include "types.h"
-#include "vrcvisnd.h"
-#include "nes_apu.h"
-
-
-static vrcvisnd_t vrcvi;
-static int32 vrcvi_incsize;
-
-/* VRCVI rectangle wave generation */
-static int32 vrcvi_rectangle(vrcvirectangle_t *chan)
-{
- /* reg0: 0-3=volume, 4-6=duty cycle
- ** reg1: 8 bits of freq
- ** reg2: 0-3=high freq, 7=enable
- */
-
- chan->phaseacc -= vrcvi_incsize; /* # of clocks per wave cycle */
- while (chan->phaseacc < 0)
- {
- chan->phaseacc += chan->freq;
- chan->adder = (chan->adder + 1) & 0x0F;
- }
-
- /* return if not enabled */
- if (FALSE == chan->enabled)
- return 0;
-
- if (chan->adder < chan->duty_flip)
- return -(chan->volume);
- else
- return chan->volume;
-}
-
-/* VRCVI sawtooth wave generation */
-static int32 vrcvi_sawtooth(vrcvisawtooth_t *chan)
-{
- /* reg0: 0-5=phase accumulator bits
- ** reg1: 8 bits of freq
- ** reg2: 0-3=high freq, 7=enable
- */
-
- chan->phaseacc -= vrcvi_incsize; /* # of clocks per wav cycle */
- while (chan->phaseacc < 0)
- {
- chan->phaseacc += chan->freq;
- chan->output_acc += chan->volume;
-
- if (7 == ++chan->adder)
- {
- chan->adder = 0;
- chan->output_acc = 0;
- }
- }
-
- /* return if not enabled */
- if (FALSE == chan->enabled)
- return 0;
- else
- return (chan->output_acc >> 3) << 9;
-}
-
-/* mix vrcvi sound channels together */
-static int32 vrcvi_process(void)
-{
- int32 output;
-
- output = vrcvi_rectangle(&vrcvi.rectangle[0]);
- output += vrcvi_rectangle(&vrcvi.rectangle[1]);
- output += vrcvi_sawtooth(&vrcvi.saw);
-
- return output;
-}
-
-/* write to registers */
-static void vrcvi_write(uint32 address, uint8 value)
-{
- int chan;
-
- switch (address & 0xB003)
- {
- case 0x9000:
- case 0xA000:
- chan = (address >> 12) - 9;
- vrcvi.rectangle[chan].reg[0] = value;
- vrcvi.rectangle[chan].volume = (value & 0x0F) << 8;
- vrcvi.rectangle[chan].duty_flip = (value >> 4) + 1;
- break;
- case 0x9001:
- case 0xA001:
- chan = (address >> 12) - 9;
- vrcvi.rectangle[chan].reg[1] = value;
- vrcvi.rectangle[chan].freq = APU_TO_FIXED(((vrcvi.rectangle[chan].reg[2] & \
0x0F) << 8) + value + 1);
- break;
- case 0x9002:
- case 0xA002:
- chan = (address >> 12) - 9;
- vrcvi.rectangle[chan].reg[2] = value;
- vrcvi.rectangle[chan].freq = APU_TO_FIXED(((value & 0x0F) << 8) + \
vrcvi.rectangle[chan].reg[1] + 1);
- vrcvi.rectangle[chan].enabled = (value & 0x80) ? TRUE : FALSE;
- break;
- case 0xB000:
- vrcvi.saw.reg[0] = value;
- vrcvi.saw.volume = value & 0x3F;
- break;
- case 0xB001:
- vrcvi.saw.reg[1] = value;
- vrcvi.saw.freq = APU_TO_FIXED((((vrcvi.saw.reg[2] & 0x0F) << 8) + value + 1) \
<< 1);
- break;
- case 0xB002:
- vrcvi.saw.reg[2] = value;
- vrcvi.saw.freq = APU_TO_FIXED((((value & 0x0F) << 8) + vrcvi.saw.reg[1] + 1) \
<< 1);
- vrcvi.saw.enabled = (value & 0x80) ? TRUE : FALSE;
- break;
- default:
- break;
- }
-}
-
-/* reset state of vrcvi sound channels */
-static void vrcvi_reset(void)
-{
- int i;
-
- /* preload regs */
- for (i = 0; i < 3; i++)
- {
- vrcvi_write(0x9000 + i, 0);
- vrcvi_write(0xA000 + i, 0);
- vrcvi_write(0xB000 + i, 0);
- }
-
- /* get the phase period from the apu */
- vrcvi_incsize = apu_getcyclerate();
-}
-
-static void vrcvi_dummy(void)
-{
-}
-
-static apu_memwrite vrcvi_memwrite[] =
-{
-// { 0x4040, 0x4092, ext_write }, /* FDS sound regs */
- { 0x9000, 0x9002, vrcvi_write }, /* vrc6 */
- { 0xA000, 0xA002, vrcvi_write },
- { 0xB000, 0xB002, vrcvi_write },
- { -1, -1, NULL }
-};
-
-apuext_t vrcvi_ext =
-{
- vrcvi_dummy, /* no init */
- vrcvi_dummy, /* no shutdown */
- vrcvi_reset,
- vrcvi_process,
- NULL, /* no reads */
- vrcvi_memwrite
-};
-
-/*
-** $Log: vrcvisnd.c,v $
-** Revision 1.2 2003/12/05 15:55:01 f1rmb
-** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's \
relevant too. Small other little fix (can't remember). Change few internal function \
prototype because it xine_t pointer need to be used if some xine's internal sections. \
NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, \
without invasive changes. To be continued...
-**
-** Revision 1.1 2003/01/08 07:04:36 tmmm
-** initial import of Nosefart sources
-**
-** Revision 1.9 2000/07/04 04:51:41 matt
-** cleanups
-**
-** Revision 1.8 2000/07/03 02:18:53 matt
-** much better external module exporting
-**
-** Revision 1.7 2000/06/20 04:06:16 matt
-** migrated external sound definition to apu module
-**
-** Revision 1.6 2000/06/20 00:08:58 matt
-** changed to driver based API
-**
-** Revision 1.5 2000/06/09 16:49:02 matt
-** removed all floating point from sound generation
-**
-** Revision 1.4 2000/06/09 15:12:28 matt
-** initial revision
-**
-*/
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/libxineadec/nosefart/vrcvisnd.h
--- a/src/libxineadec/nosefart/vrcvisnd.h Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
-** Nofrendo (c) 1998-2000 Matthew Conte (matt@conte.com)
-**
-**
-** This program is free software; you can redistribute it and/or
-** modify it under the terms of version 2 of the GNU Library General
-** Public License as published by the Free Software Foundation.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-** Library General Public License for more details. To obtain a
-** copy of the GNU Library General Public License, write to the Free
-** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**
-** Any permitted reproduction of these routines, in whole or in part,
-** must bear this legend.
-**
-**
-** vrcvisnd.h
-**
-** VRCVI (Konami MMC) sound hardware emulation header
-** $Id: vrcvisnd.h,v 1.2 2003/12/05 15:55:01 f1rmb Exp $
-*/
-
-#ifndef _VRCVISND_H_
-#define _VRCVISND_H_
-
-typedef struct vrcvirectangle_s
-{
- uint8 reg[3];
- int32 phaseacc;
- uint8 adder;
-
- int32 freq;
- int32 volume;
- uint8 duty_flip;
- boolean enabled;
-} vrcvirectangle_t;
-
-typedef struct vrcvisawtooth_s
-{
- uint8 reg[3];
- int32 phaseacc;
- uint8 adder;
- uint8 output_acc;
-
- int32 freq;
- uint8 volume;
- boolean enabled;
-} vrcvisawtooth_t;
-
-typedef struct vrcvisnd_s
-{
- vrcvirectangle_t rectangle[2];
- vrcvisawtooth_t saw;
-} vrcvisnd_t;
-
-#include "nes_apu.h"
-
-extern apuext_t vrcvi_ext;
-
-#endif /* _VRCVISND_H_ */
-
-/*
-** $Log: vrcvisnd.h,v $
-** Revision 1.2 2003/12/05 15:55:01 f1rmb
-** cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's \
relevant too. Small other little fix (can't remember). Change few internal function \
prototype because it xine_t pointer need to be used if some xine's internal sections. \
NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, \
without invasive changes. To be continued...
-**
-** Revision 1.1 2003/01/08 07:04:36 tmmm
-** initial import of Nosefart sources
-**
-** Revision 1.7 2000/06/20 04:06:16 matt
-** migrated external sound definition to apu module
-**
-** Revision 1.6 2000/06/20 00:08:58 matt
-** changed to driver based API
-**
-** Revision 1.5 2000/06/09 16:49:02 matt
-** removed all floating point from sound generation
-**
-** Revision 1.4 2000/06/09 15:12:28 matt
-** initial revision
-**
-*/
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 src/libxineadec/nsf.c
--- a/src/libxineadec/nsf.c Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,295 +0,0 @@
-/*
- * Copyright (C) 2000-2001 the xine project
- *
- * This file is part of xine, a free video player.
- *
- * xine is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * xine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * NSF Audio "Decoder" using the Nosefart NSF engine by Matt Conte
- * http://www.baisoku.org/
- *
- * $Id: nsf.c,v 1.13 2006/09/25 23:56:31 dgp85 Exp $
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include "xine_internal.h"
-#include "audio_out.h"
-#include "buffer.h"
-#include "xineutils.h"
-#include "bswap.h"
-
-/* Nosefart includes */
-#include "nosefart/types.h"
-#include "nosefart/nsf.h"
-
-typedef struct {
- audio_decoder_class_t decoder_class;
-} nsf_class_t;
-
-typedef struct nsf_decoder_s {
- audio_decoder_t audio_decoder;
-
- xine_stream_t *stream;
-
- int sample_rate; /* audio sample rate */
- int bits_per_sample; /* bits/sample, usually 8 or 16 */
- int channels; /* 1 or 2, usually */
-
- int output_open; /* flag to indicate audio is ready */
-
- int nsf_size;
- unsigned char *nsf_file;
- int nsf_index;
- int song_number;
-
- /* nsf-specific variables */
- int64_t last_pts;
- unsigned int iteration;
-
- nsf_t *nsf;
-} nsf_decoder_t;
-
-/**************************************************************************
- * xine audio plugin functions
- *************************************************************************/
-
-static void nsf_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
-
- nsf_decoder_t *this = (nsf_decoder_t *) this_gen;
- audio_buffer_t *audio_buffer;
-
- if (buf->decoder_flags & BUF_FLAG_HEADER) {
-
- /* When the engine sends a BUF_FLAG_HEADER flag, it is time to initialize
- * the decoder. The buffer element type has 4 decoder_info fields,
- * 0..3. Field 1 is the sample rate. Field 2 is the bits/sample. Field
- * 3 is the number of channels. */
- this->sample_rate = buf->decoder_info[1];
- this->bits_per_sample = buf->decoder_info[2];
- this->channels = buf->decoder_info[3];
-
- /* take this opportunity to initialize stream/meta information */
- _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC,
- "NES Music (Nosefart)");
-
- this->song_number = buf->content[4];
- /* allocate a buffer for the file */
- this->nsf_size = BE_32(&buf->content[0]);
- this->nsf_file = xine_xmalloc(this->nsf_size);
- this->nsf_index = 0;
-
- /* peform any other required initialization */
- this->last_pts = -1;
- this->iteration = 0;
-
- return;
- }
-
- /* accumulate chunks from the NSF file until whole file is received */
- if (this->nsf_index < this->nsf_size) {
- xine_fast_memcpy(&this->nsf_file[this->nsf_index], buf->content,
- buf->size);
- this->nsf_index += buf->size;
-
- if (this->nsf_index == this->nsf_size) {
- /* file has been received, proceed to initialize engine */
- nsf_init();
- this->nsf = nsf_load(NULL, this->nsf_file, this->nsf_size);
- if (!this->nsf) {
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "nsf: could not \
initialize NSF\n");
- /* make the decoder return on every subsequent buffer */
- this->nsf_index = 0;
- return;
- }
- this->nsf->current_song = this->song_number;
- nsf_playtrack(this->nsf, this->nsf->current_song, this->sample_rate,
- this->bits_per_sample, this->channels);
- }
[... 43 lines omitted ...]
-}
-
-/* This function resets the state of the audio decoder. This usually
- * entails resetting the data accumulation buffer. */
-static void nsf_reset (audio_decoder_t *this_gen) {
-
- nsf_decoder_t *this = (nsf_decoder_t *) this_gen;
-
- this->last_pts = -1;
-}
-
-/* This function resets the last pts value of the audio decoder. */
-static void nsf_discontinuity (audio_decoder_t *this_gen) {
-
- nsf_decoder_t *this = (nsf_decoder_t *) this_gen;
-
- this->last_pts = -1;
-}
-
-/* This function closes the audio output and frees the private audio decoder
- * structure. */
-static void nsf_dispose (audio_decoder_t *this_gen) {
-
- nsf_decoder_t *this = (nsf_decoder_t *) this_gen;
-
- /* close the audio output */
- if (this->output_open)
- this->stream->audio_out->close (this->stream->audio_out, this->stream);
- this->output_open = 0;
-
- /* free anything that was allocated during operation */
- nsf_free(&this->nsf);
- free(this->nsf_file);
- free(this);
-}
-
-/* This function allocates, initializes, and returns a private audio
- * decoder structure. */
-static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stream_t \
*stream) {
-
- nsf_decoder_t *this ;
-
- this = (nsf_decoder_t *) xine_xmalloc (sizeof (nsf_decoder_t));
-
- /* connect the member functions */
- this->audio_decoder.decode_data = nsf_decode_data;
- this->audio_decoder.reset = nsf_reset;
- this->audio_decoder.discontinuity = nsf_discontinuity;
- this->audio_decoder.dispose = nsf_dispose;
-
- /* connect the stream */
- this->stream = stream;
-
- /* audio output is not open at the start */
- this->output_open = 0;
-
- /* initialize the basic audio parameters */
- this->channels = 0;
- this->sample_rate = 0;
- this->bits_per_sample = 0;
-
- /* return the newly-initialized audio decoder */
- return &this->audio_decoder;
-}
-
-/* This function returns a brief string that describes (usually with the
- * decoder's most basic name) the audio decoder plugin. */
-static char *get_identifier (audio_decoder_class_t *this) {
- return "NSF";
-}
-
-/* This function returns a slightly longer string describing the audio
- * decoder plugin. */
-static char *get_description (audio_decoder_class_t *this) {
- return "NES Music audio decoder plugin";
-}
-
-/* This function frees the audio decoder class and any other memory that was
- * allocated. */
-static void dispose_class (audio_decoder_class_t *this_gen) {
-
- nsf_class_t *this = (nsf_class_t *)this_gen;
-
- free (this);
-}
-
-/* This function allocates a private audio decoder class and initializes
- * the class's member functions. */
-static void *init_plugin (xine_t *xine, void *data) {
-
- nsf_class_t *this ;
-
- this = (nsf_class_t *) xine_xmalloc (sizeof (nsf_class_t));
-
- this->decoder_class.open_plugin = open_plugin;
- this->decoder_class.get_identifier = get_identifier;
- this->decoder_class.get_description = get_description;
- this->decoder_class.dispose = dispose_class;
-
- return this;
-}
-
-/* This is a list of all of the internal xine audio buffer types that
- * this decoder is able to handle. Check src/xine-engine/buffer.h for a
- * list of valid buffer types (and add a new one if the one you need does
- * not exist). Terminate the list with a 0. */
-static uint32_t audio_types[] = {
- BUF_AUDIO_NSF,
- 0
-};
-
-/* This data structure combines the list of supported xine buffer types and
- * the priority that the plugin should be given with respect to other
- * plugins that handle the same buffer type. A plugin with priority (n+1)
- * will be used instead of a plugin with priority (n). */
-static const decoder_info_t dec_info_audio = {
- audio_types, /* supported types */
- 5 /* priority */
-};
-
-/* The plugin catalog entry. This is the only information that this plugin
- * will export to the public. */
-const plugin_info_t xine_plugin_info[] EXPORTED = {
- /* { type, API version, "name", version, special_info, init_function }, */
- { PLUGIN_AUDIO_DECODER, 15, "nsf", XINE_VERSION_CODE, &dec_info_audio, \
&init_plugin },
- { PLUGIN_NONE, 0, "", 0, NULL, NULL }
-};
-
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/libxineadec/xine_speex_decoder.c
--- a/src/libxineadec/xine_speex_decoder.c Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,436 +0,0 @@
-/*
- * Copyright (C) 2000-2003 the xine project
- *
- * This file is part of xine, a free video player.
- *
- * xine is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * xine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: xine_decoder.c,v 1.22 2007/01/19 01:48:05 dgp85 Exp $
- *
- * (ogg/)speex audio decoder plugin (libspeex wrapper) for xine
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#define LOG_MODULE "speex_decoder"
-#define LOG_VERBOSE
-/*
-#define LOG
-*/
-#define LOG_BUFFERS 0
-
-#include "xine_internal.h"
-#include "audio_out.h"
-#include "buffer.h"
-
-#include <ogg/ogg.h>
-
-#include <speex/speex.h>
-#include <speex/speex_header.h>
-#include <speex/speex_callbacks.h>
-#include <speex/speex_stereo.h>
-
-#define MAX_FRAME_SIZE 2000
-
-typedef struct {
- audio_decoder_class_t decoder_class;
-} speex_class_t;
-
-typedef struct speex_decoder_s {
- audio_decoder_t audio_decoder;
-
- int64_t pts;
-
- int output_sampling_rate;
- int output_open;
- int output_mode;
-
- /* speex stuff */
- void *st;
- int frame_size;
- int rate;
- int nframes;
- int channels;
- SpeexBits bits;
- SpeexStereoState stereo;
- int expect_metadata;
-
- float output[MAX_FRAME_SIZE];
-
- int header_count;
-
- xine_stream_t *stream;
-
-} speex_decoder_t;
-
-
-static void speex_reset (audio_decoder_t *this_gen) {
-
- speex_decoder_t *this = (speex_decoder_t *) this_gen;
-
- speex_bits_init (&this->bits);
-}
-
-static void speex_discontinuity (audio_decoder_t *this_gen) {
-
- speex_decoder_t *this = (speex_decoder_t *) this_gen;
-
- this->pts=0;
-}
-
-/* Known speex comment keys from ogg123 sources*/
-static struct {
- char *key; /* includes the '=' for programming convenience */
- int xine_metainfo_index;
-} speex_comment_keys[] = {
- {"ARTIST=", XINE_META_INFO_ARTIST},
- {"ALBUM=", XINE_META_INFO_ALBUM},
- {"TITLE=", XINE_META_INFO_TITLE},
- {"GENRE=", XINE_META_INFO_GENRE},
- {"DESCRIPTION=", XINE_META_INFO_COMMENT},
- {"DATE=", XINE_META_INFO_YEAR},
- {NULL, 0}
-};
-
-#define readint(buf, base) (((buf[base+3]<<24)&0xff000000)| \
- ((buf[base+2]<<16)&0xff0000)| \
- ((buf[base+1]<<8)&0xff00)| \
- (buf[base]&0xff))
-
-static
-void read_metadata (speex_decoder_t *this, char * comments, int length)
-{
- char * c = comments;
- int len, i, nb_fields;
- char * end;
-
- _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "speex");
[... 184 lines omitted ...]
- if (speex_bits_remaining(&this->bits)<0) {
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "libspeex: Decoding overflow, \
corrupted stream?\n");
- break;
- }
-
- if (this->channels == 2) {
- speex_decode_stereo (this->output, this->frame_size, &this->stereo);
- }
-
- speex_decoder_ctl (this->st, SPEEX_GET_BITRATE, &bitrate);
- if (bitrate <= 1) bitrate = 16000; /* assume 16 kbit */
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, bitrate);
-
- /*PCM saturation (just in case)*/
- for (i=0; i < this->frame_size * this->channels; i++)
- {
- if (this->output[i]>32000.0)
- this->output[i]=32000.0;
- else if (this->output[i]<-32000.0)
- this->output[i]=-32000.0;
- }
-
- /*Convert to short and play */
- for (i=0; i< this->frame_size * this->channels; i++) {
- *ptr++ = (ogg_int16_t)this->output[i];
- }
-
- audio_buffer->vpts = this->pts;
- this->pts=0;
- audio_buffer->num_frames = this->frame_size;
-
- this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, \
this->stream);
-
- buf->pts=0;
-
- }
- }
- else {
- llprintf (LOG_BUFFERS, "output not open\n");
- }
-}
-
-static void speex_dispose (audio_decoder_t *this_gen) {
-
- speex_decoder_t *this = (speex_decoder_t *) this_gen;
-
- if (this->st) {
- speex_decoder_destroy (this->st);
- }
- speex_bits_destroy (&this->bits);
-
- if (this->output_open)
- this->stream->audio_out->close (this->stream->audio_out, this->stream);
-
- free (this_gen);
-}
-
-static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen,
- xine_stream_t *stream) {
-
- speex_decoder_t *this ;
- static SpeexStereoState init_stereo = SPEEX_STEREO_STATE_INIT;
-
- this = (speex_decoder_t *) xine_xmalloc (sizeof (speex_decoder_t));
-
- this->audio_decoder.decode_data = speex_decode_data;
- this->audio_decoder.reset = speex_reset;
- this->audio_decoder.discontinuity = speex_discontinuity;
- this->audio_decoder.dispose = speex_dispose;
- this->stream = stream;
-
- this->output_open = 0;
- this->header_count = 1;
- this->expect_metadata = 0;
-
- this->st = NULL;
-
- this->channels = 1;
-
- memcpy (&this->stereo, &init_stereo, sizeof (SpeexStereoState));
-
- return (audio_decoder_t *) this;
-}
-
-/*
- * speex plugin class
- */
-
-static char *get_identifier (audio_decoder_class_t *this) {
- return "speex";
-}
-
-static char *get_description (audio_decoder_class_t *this) {
- return "Speex audio decoder plugin";
-}
-
-static void dispose_class (audio_decoder_class_t *this) {
- free (this);
-}
-
-static void *init_plugin (xine_t *xine, void *data) {
-
- speex_class_t *this;
-
- this = (speex_class_t *) xine_xmalloc (sizeof (speex_class_t));
-
- this->decoder_class.open_plugin = open_plugin;
- this->decoder_class.get_identifier = get_identifier;
- this->decoder_class.get_description = get_description;
- this->decoder_class.dispose = dispose_class;
-
- return this;
-}
-
-static uint32_t audio_types[] = {
- BUF_AUDIO_SPEEX, 0
- };
-
-static const decoder_info_t dec_info_audio = {
- audio_types, /* supported types */
- 5 /* priority */
-};
-
-const plugin_info_t xine_plugin_info[] EXPORTED = {
- /* type, API, "name", version, special_info, init_function */
- { PLUGIN_AUDIO_DECODER, 15, "speex", XINE_VERSION_CODE, &dec_info_audio, \
init_plugin },
- { PLUGIN_NONE, 0, "", 0, NULL, NULL }
-};
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/libxineadec/xine_vorbis_decoder.c
--- a/src/libxineadec/xine_vorbis_decoder.c Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,354 +0,0 @@
-/*
- * Copyright (C) 2000-2003 the xine project
- *
- * This file is part of xine, a free video player.
- *
- * xine is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * xine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: xine_decoder.c,v 1.48 2006/12/04 13:59:38 dgp85 Exp $
- *
- * (ogg/)vorbis audio decoder plugin (libvorbis wrapper) for xine
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#define LOG_MODULE "vorbis_decoder"
-#define LOG_VERBOSE
-/*
-#define LOG
-*/
-
-#include "xine_internal.h"
-#include "audio_out.h"
-#include "buffer.h"
-
-#include <ogg/ogg.h>
-#include <vorbis/codec.h>
-
-#define MAX_NUM_SAMPLES 4096
-
-typedef struct {
- audio_decoder_class_t decoder_class;
-} vorbis_class_t;
-
-typedef struct vorbis_decoder_s {
- audio_decoder_t audio_decoder;
-
- int64_t pts;
-
- int output_sampling_rate;
- int output_open;
- int output_mode;
-
- ogg_packet op; /* we must use this struct to sent data to libvorbis */
-
- /* vorbis stuff */
- vorbis_info vi; /* stores static vorbis bitstream settings */
- vorbis_comment vc;
- vorbis_dsp_state vd; /* central working state for packet->PCM decoder */
- vorbis_block vb; /* local working state for packet->PCM decoder */
-
- int16_t convbuffer[MAX_NUM_SAMPLES];
- int convsize;
-
- int header_count;
-
- xine_stream_t *stream;
-
-} vorbis_decoder_t;
-
-
-static void vorbis_reset (audio_decoder_t *this_gen) {
-
- vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen;
-
- if( !this->header_count )
- vorbis_block_init(&this->vd,&this->vb);
-}
-
-static void vorbis_discontinuity (audio_decoder_t *this_gen) {
-
- vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen;
-
- this->pts=0;
-}
-
-/* Known vorbis comment keys from ogg123 sources*/
-static struct {
- char *key; /* includes the '=' for programming convenience */
- int xine_metainfo_index;
-} vorbis_comment_keys[] = {
- {"ARTIST=", XINE_META_INFO_ARTIST},
- {"ALBUM=", XINE_META_INFO_ALBUM},
- {"TITLE=", XINE_META_INFO_TITLE},
- {"GENRE=", XINE_META_INFO_GENRE},
- {"DESCRIPTION=", XINE_META_INFO_COMMENT},
- {"COMMENT=", XINE_META_INFO_COMMENT},
- {"DATE=", XINE_META_INFO_YEAR},
- {"TRACKNUMBER=", XINE_META_INFO_TRACK_NUMBER},
- {NULL, 0}
-};
-
-static void get_metadata (vorbis_decoder_t *this) {
-
- char **ptr=this->vc.user_comments;
- while(*ptr){
-
- char *comment = *ptr;
- int i;
-
- lprintf("%s\n", comment);
-
- for (i = 0; vorbis_comment_keys[i].key != NULL; i++) {
-
- if ( !strncasecmp (vorbis_comment_keys[i].key, comment,
- strlen(vorbis_comment_keys[i].key)) ) {
-
- lprintf ("known metadata %d %d\n",
[... 102 lines omitted ...]
- /* convert floats to 16 bit signed ints (host order) and
- interleave */
- for(i=0;i<this->vi.channels;i++){
- ogg_int16_t *ptr=audio_buffer->mem+i;
- float *mono=pcm[i];
- for(j=0;j<bout;j++){
- int val=mono[j]*32767.f;
- /* might as well guard against clipping */
- if(val>32767){
- val=32767;
- clipflag=1;
- }
- if(val<-32768){
- val=-32768;
- clipflag=1;
- }
- *ptr=val;
- ptr+=this->vi.channels;
- }
- }
-
- audio_buffer->vpts = this->pts;
- this->pts=0;
- audio_buffer->num_frames = bout;
-
- this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, \
this->stream);
-
- buf->pts=0;
-
- /* tell libvorbis how many samples we actually consumed */
- vorbis_synthesis_read(&this->vd,bout);
- }
- }
- lprintf("output not open\n");
-}
-
-static void vorbis_dispose (audio_decoder_t *this_gen) {
-
- vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen;
-
- if( !this->header_count ) {
- lprintf("deinitializing decoder\n");
-
- vorbis_block_clear(&this->vb);
- vorbis_dsp_clear(&this->vd);
- }
-
- vorbis_comment_clear(&this->vc);
-
- vorbis_info_clear(&this->vi); /* must be called last */
-
- if (this->output_open)
- this->stream->audio_out->close (this->stream->audio_out, this->stream);
-
- lprintf("libvorbis instance destroyed\n");
-
- free (this_gen);
-}
-
-static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen,
- xine_stream_t *stream) {
-
- vorbis_decoder_t *this ;
-
- this = (vorbis_decoder_t *) xine_xmalloc (sizeof (vorbis_decoder_t));
-
- this->audio_decoder.decode_data = vorbis_decode_data;
- this->audio_decoder.reset = vorbis_reset;
- this->audio_decoder.discontinuity = vorbis_discontinuity;
- this->audio_decoder.dispose = vorbis_dispose;
- this->stream = stream;
-
- this->output_open = 0;
- this->header_count = 3;
- this->convsize = 0;
-
- vorbis_info_init(&this->vi);
- vorbis_comment_init(&this->vc);
-
- lprintf("libvorbis decoder instance created\n");
-
- return (audio_decoder_t *) this;
-}
-
-/*
- * vorbis plugin class
- */
-
-static char *get_identifier (audio_decoder_class_t *this) {
- return "vorbis";
-}
-
-static char *get_description (audio_decoder_class_t *this) {
- return "vorbis audio decoder plugin";
-}
-
-static void dispose_class (audio_decoder_class_t *this) {
- free (this);
-}
-
-static void *init_plugin (xine_t *xine, void *data) {
-
- vorbis_class_t *this;
-
- this = (vorbis_class_t *) xine_xmalloc (sizeof (vorbis_class_t));
-
- this->decoder_class.open_plugin = open_plugin;
- this->decoder_class.get_identifier = get_identifier;
- this->decoder_class.get_description = get_description;
- this->decoder_class.dispose = dispose_class;
-
- return this;
-}
-
-static uint32_t audio_types[] = {
- BUF_AUDIO_VORBIS, 0
- };
-
-static const decoder_info_t dec_info_audio = {
- audio_types, /* supported types */
- 5 /* priority */
-};
-
-const plugin_info_t xine_plugin_info[] EXPORTED = {
- /* type, API, "name", version, special_info, init_function */
- { PLUGIN_AUDIO_DECODER, 15, "vorbis", XINE_VERSION_CODE, &dec_info_audio, \
init_plugin },
- { PLUGIN_NONE, 0, "", 0, NULL, NULL }
-};
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/libxinevdec/xine_theora_decoder.c
--- a/src/libxinevdec/xine_theora_decoder.c Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,402 +0,0 @@
-/*
- * Copyright (C) 2001-2003 the xine project
- *
- * This file is part of xine, a free video player.
- *
- * xine is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * xine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: xine_decoder.c,v 1.26 2006/07/10 22:08:30 dgp85 Exp $
- *
- * xine decoder plugin using libtheora
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <inttypes.h>
-#include <string.h>
-#include <pthread.h>
-#include <math.h>
-#include <assert.h>
-#include <theora/theora.h>
-
-#define LOG_MODULE "theora_decoder"
-#define LOG_VERBOSE
-/*
-#define LOG
-*/
-
-#include "xine_internal.h"
-#include "video_out.h"
-#include "buffer.h"
-#include "metronom.h"
-#include "xineutils.h"
-
-typedef struct theora_class_s {
- video_decoder_class_t decoder_class;
-} theora_class_t;
-
-typedef struct theora_decoder_s {
- video_decoder_t theora_decoder;
- theora_class_t *class;
- theora_info t_info;
- theora_comment t_comment;
- theora_state t_state;
- ogg_packet op;
- yuv_buffer yuv;
- xine_stream_t* stream;
- int reject;
- int op_max_size;
- char* packet;
- int done;
- int width, height;
- double ratio;
- int offset_x, offset_y;
- int frame_duration;
- int skipframes;
- int hp_read;
- int initialized;
-} theora_decoder_t;
-
-static void readin_op (theora_decoder_t *this, char* src, int size) {
- if ( this->done+size > this->op_max_size) {
- while (this->op_max_size < this->done+size)
- this->op_max_size=this->op_max_size*2;
- this->packet=realloc(this->packet, this->op_max_size);
- this->op.packet=this->packet;
- }
- xine_fast_memcpy ( this->packet+this->done, src, size);
- this->done=this->done+size;
-}
-
-static void yuv2frame(yuv_buffer *yuv, vo_frame_t *frame, int offset_x, int \
offset_y) {
- int i;
- int crop_offset;
-
- /* fixme - direct rendering (exchaning pointers) may be possible.
- * frame->base[0] = yuv->y could work if one could change the
- * pitches[0,1,2] values, and rely on the drawing routine using
- * the new pitches. With cropping and offsets, it's a bit trickier,
- * but it would still be possible.
- * Attempts at doing this have yielded nothing but SIGSEVs so far.
- */
-
- /* Copy yuv data onto the frame. Cropping and offset as specified
- * by the frame_width, frame_height, offset_x and offset_y fields
- * in the theora header is carried out.
- */
-
- crop_offset=offset_x+yuv->y_stride*offset_y;
- for(i=0;i<frame->height;i++)
- xine_fast_memcpy(frame->base[0]+frame->pitches[0]*i,
- yuv->y+crop_offset+yuv->y_stride*i,
- frame->width);
-
- crop_offset=(offset_x/2)+(yuv->uv_stride)*(offset_y/2);
- for(i=0;i<frame->height/2;i++){
- xine_fast_memcpy(frame->base[1]+frame->pitches[1]*i,
- yuv->u+crop_offset+yuv->uv_stride*i,
- frame->width/2);
- xine_fast_memcpy(frame->base[2]+frame->pitches[2]*i,
- yuv->v+crop_offset+yuv->uv_stride*i,
- frame->width/2);
-
- }
-}
-
-static int collect_data (theora_decoder_t *this, buf_element_t *buf ) {
- /* Assembles an ogg_packet which was sent with send_ogg_packet over xinebuffers */
[... 150 lines omitted ...]
-
-static void theora_reset (video_decoder_t *this_gen) {
- /*
- * reset decoder after engine flush (prepare for new
- * video data not related to recently decoded data)
- */
- theora_decoder_t *this = (theora_decoder_t *) this_gen;
- this->skipframes=0;
-}
-
-static void theora_discontinuity (video_decoder_t *this_gen) {
- /*
- * inform decoder that a time reference discontinuity has happened.
- * that is, it must forget any currently held pts value
- */
- theora_decoder_t *this = (theora_decoder_t *) this_gen;
- this->skipframes=0;
-}
-
-static void theora_dispose (video_decoder_t *this_gen) {
- /*
- * close down, free all resources
- */
-
- theora_decoder_t *this = (theora_decoder_t *) this_gen;
-
- lprintf ("dispose \n");
-
- theora_clear (&this->t_state);
- theora_comment_clear (&this->t_comment);
- theora_info_clear (&this->t_info);
- this->stream->video_out->close(this->stream->video_out, this->stream);
- free (this->packet);
- free (this);
-}
-
-static video_decoder_t *theora_open_plugin (video_decoder_class_t *class_gen, \
xine_stream_t *stream) {
-
- /*
- * open a new instance of this plugin class
- */
-
- theora_decoder_t *this ;
-
- this = (theora_decoder_t *) xine_xmalloc (sizeof (theora_decoder_t));
-
- this->theora_decoder.decode_data = theora_decode_data;
- this->theora_decoder.flush = theora_flush;
- this->theora_decoder.reset = theora_reset;
- this->theora_decoder.discontinuity = theora_discontinuity;
- this->theora_decoder.dispose = theora_dispose;
-
- this->stream = stream;
- this->class = (theora_class_t *) class_gen;
-
- this->op_max_size = 4096;
- this->packet = malloc(this->op_max_size);
-
- this->done = 0;
-
- this->stream = stream;
-
- this->initialized = 0;
-
- theora_comment_init (&this->t_comment);
- theora_info_init (&this->t_info);
- stream->video_out->open (stream->video_out, stream);
-
- return &this->theora_decoder;
-
-}
-
-/*
- * theora plugin class
- */
-
-static char *theora_get_identifier (video_decoder_class_t *this) {
- /*
- * return short, human readable identifier for this plugin class
- */
- return "theora video";
-}
-
-static char *theora_get_description (video_decoder_class_t *this) {
- /*
- * return human readable (verbose = 1 line) description for
- * this plugin class
- */
- return "theora video decoder plugin";
-}
-
-static void theora_dispose_class (video_decoder_class_t *this) {
- /*
- * free all class-related resources
- */
- free (this);
-}
-
-static void *init_plugin (xine_t *xine, void *data) {
- /*initialize our plugin*/
- theora_class_t *this;
-
- this = (theora_class_t *) xine_xmalloc (sizeof (theora_class_t));
-
- this->decoder_class.open_plugin = theora_open_plugin;
- this->decoder_class.get_identifier = theora_get_identifier;
- this->decoder_class.get_description = theora_get_description;
- this->decoder_class.dispose = theora_dispose_class;
-
- return this;
-}
-
-/*
- * exported plugin catalog entry
- */
-
-static uint32_t supported_types[] = { BUF_VIDEO_THEORA, 0 };
-
-static const decoder_info_t dec_info_video = {
- supported_types, /* supported types */
- 5 /* priority */
-};
-
-const plugin_info_t xine_plugin_info[] EXPORTED = {
- /* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_DECODER, 18, "theora", XINE_VERSION_CODE, &dec_info_video, \
init_plugin },
- { PLUGIN_NONE, 0, "", 0, NULL, NULL }
-};
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 src/video_out/deinterlace.c
--- a/src/video_out/deinterlace.c Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,847 +0,0 @@
- /*
- * Copyright (C) 2001 the xine project
- *
- * This file is part of xine, a free video player.
- *
- * xine is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * xine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * Deinterlace routines by Miguel Freitas
- * based of DScaler project sources (deinterlace.sourceforge.net)
- *
- * Currently only available for Xv driver and MMX extensions
- *
- * small todo list:
- * - implement non-MMX versions for all methods
- * - support MMX2 instructions
- * - move some generic code from xv driver to this file
- * - make it also work for yuy2 frames
- *
- */
-
-#include <stdio.h>
-#include <string.h>
-#include "xine_internal.h"
-#include "deinterlace.h"
-#include "xineutils.h"
-
-
-/*
- DeinterlaceFieldBob algorithm
- Based on Virtual Dub plugin by Gunnar Thalin
- MMX asm version from dscaler project (deinterlace.sourceforge.net)
- Linux version for Xine player by Miguel Freitas
-*/
-static void deinterlace_bob_yuv_mmx( uint8_t *pdst, uint8_t *psrc[],
- int width, int height )
-{
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
- int Line;
- uint64_t *YVal1;
- uint64_t *YVal2;
- uint64_t *YVal3;
- uint64_t *Dest;
- uint8_t* pEvenLines = psrc[0];
- uint8_t* pOddLines = psrc[0]+width;
- int LineLength = width;
- int SourcePitch = width * 2;
- int IsOdd = 1;
- long EdgeDetect = 625;
- long JaggieThreshold = 73;
-
- int n;
-
- uint64_t qwEdgeDetect;
- uint64_t qwThreshold;
-
- static mmx_t YMask = {ub:{0xff,0,0xff,0,0xff,0,0xff,0}};
- static mmx_t Mask = {ub:{0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe}};
-
- qwEdgeDetect = EdgeDetect;
- qwEdgeDetect += (qwEdgeDetect << 48) + (qwEdgeDetect << 32) + (qwEdgeDetect << \
16);
- qwThreshold = JaggieThreshold;
- qwThreshold += (qwThreshold << 48) + (qwThreshold << 32) + (qwThreshold << 16);
-
-
- // copy first even line no matter what, and the first odd line if we're
- // processing an odd field.
- xine_fast_memcpy(pdst, pEvenLines, LineLength);
- if (IsOdd)
- xine_fast_memcpy(pdst + LineLength, pOddLines, LineLength);
-
- height = height / 2;
- for (Line = 0; Line < height - 1; ++Line)
- {
- if (IsOdd)
- {
- YVal1 = (uint64_t *)(pOddLines + Line * SourcePitch);
- YVal2 = (uint64_t *)(pEvenLines + (Line + 1) * SourcePitch);
- YVal3 = (uint64_t *)(pOddLines + (Line + 1) * SourcePitch);
- Dest = (uint64_t *)(pdst + (Line * 2 + 2) * LineLength);
- }
- else
- {
- YVal1 = (uint64_t *)(pEvenLines + Line * SourcePitch);
- YVal2 = (uint64_t *)(pOddLines + Line * SourcePitch);
- YVal3 = (uint64_t *)(pEvenLines + (Line + 1) * SourcePitch);
- Dest = (uint64_t *)(pdst + (Line * 2 + 1) * LineLength);
- }
-
- // For ease of reading, the comments below assume that we're operating on an odd
- // field (i.e., that bIsOdd is true). The exact same processing is done when we
- // operate on an even field, but the roles of the odd and even fields are \
reversed.
- // It's just too cumbersome to explain the algorithm in terms of "the next odd
- // line if we're doing an odd field, or the next even line if we're doing an
- // even field" etc. So wherever you see "odd" or "even" below, keep in mind \
that
- // half the time this function is called, those words' meanings will invert.
-
- // Copy the odd line to the overlay verbatim.
- xine_fast_memcpy((char *)Dest + LineLength, YVal3, LineLength);
-
- n = LineLength >> 3;
- while( n-- )
- {
- movq_m2r (*YVal1++, mm0);
- movq_m2r (*YVal2++, mm1);
- movq_m2r (*YVal3++, mm2);
-
- // get intensities in mm3 - 4
- movq_r2r ( mm0, mm3 );
- pand_m2r ( YMask, mm3 );
- movq_r2r ( mm1, mm4 );
- pand_m2r ( YMask, mm4 );
- movq_r2r ( mm2, mm5 );
[... 595 lines omitted ...]
- screen aren't deinterlaced.
-
-*/
-static void deinterlace_linearblend_yuv( uint8_t *pdst, uint8_t *psrc[],
- int width, int height )
-{
- register int x, y;
- register uint8_t *l0, *l1, *l2, *l3;
-
- l0 = pdst; /* target line */
- l1 = psrc[0]; /* 1st source line */
- l2 = l1 + width; /* 2nd source line = line that follows l1 */
- l3 = l2 + width; /* 3rd source line = line that follows l2 */
-
- /* Copy the first line */
- xine_fast_memcpy(l0, l1, width);
- l0 += width;
-
- for (y = 1; y < height-1; ++y) {
- /* computes avg of: l1 + 2*l2 + l3 */
-
- for (x = 0; x < width; ++x) {
- l0[x] = (l1[x] + (l2[x]<<1) + l3[x]) >> 2;
- }
-
- /* updates the line pointers */
- l1 = l2; l2 = l3; l3 += width;
- l0 += width;
- }
-
- /* Copy the last line */
- xine_fast_memcpy(l0, l1, width);
-}
-
-static int check_for_mmx(void)
-{
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
-static int config_flags = -1;
-
- if ( config_flags == -1 )
- config_flags = xine_mm_accel();
- if (config_flags & MM_ACCEL_X86_MMX)
- return 1;
- return 0;
-#else
- return 0;
-#endif
-}
-
-/* generic YUV deinterlacer
- pdst -> pointer to destination bitmap
- psrc -> array of pointers to source bitmaps ([0] = most recent)
- width,height -> dimension for bitmaps
- method -> DEINTERLACE_xxx
-*/
-
-void deinterlace_yuv( uint8_t *pdst, uint8_t *psrc[],
- int width, int height, int method )
-{
- switch( method ) {
- case DEINTERLACE_NONE:
- xine_fast_memcpy(pdst,psrc[0],width*height);
- break;
- case DEINTERLACE_BOB:
- if( check_for_mmx() )
- deinterlace_bob_yuv_mmx(pdst,psrc,width,height);
- else /* FIXME: provide an alternative? */
- xine_fast_memcpy(pdst,psrc[0],width*height);
- break;
- case DEINTERLACE_WEAVE:
- if( check_for_mmx() )
- {
- if( !deinterlace_weave_yuv_mmx(pdst,psrc,width,height) )
- xine_fast_memcpy(pdst,psrc[0],width*height);
- }
- else /* FIXME: provide an alternative? */
- xine_fast_memcpy(pdst,psrc[0],width*height);
- break;
- case DEINTERLACE_GREEDY:
- if( check_for_mmx() )
- {
- if( !deinterlace_greedy_yuv_mmx(pdst,psrc,width,height) )
- xine_fast_memcpy(pdst,psrc[0],width*height);
- }
- else /* FIXME: provide an alternative? */
- xine_fast_memcpy(pdst,psrc[0],width*height);
- break;
- case DEINTERLACE_ONEFIELD:
- if( check_for_mmx() )
- deinterlace_onefield_yuv_mmx(pdst,psrc,width,height);
- else /* FIXME: provide an alternative? */
- xine_fast_memcpy(pdst,psrc[0],width*height);
- break;
- case DEINTERLACE_ONEFIELDXV:
- lprintf("ONEFIELDXV must be handled by the video driver.\n");
- break;
- case DEINTERLACE_LINEARBLEND:
- if( check_for_mmx() )
- deinterlace_linearblend_yuv_mmx(pdst,psrc,width,height);
- else
- deinterlace_linearblend_yuv(pdst,psrc,width,height);
- break;
- default:
- lprintf("unknow method %d.\n",method);
- break;
- }
-}
-
-int deinterlace_yuv_supported ( int method )
-{
- switch( method ) {
- case DEINTERLACE_NONE:
- return 1;
- case DEINTERLACE_BOB:
- case DEINTERLACE_WEAVE:
- case DEINTERLACE_GREEDY:
- case DEINTERLACE_ONEFIELD:
- return check_for_mmx();
- case DEINTERLACE_ONEFIELDXV:
- lprintf ("ONEFIELDXV must be handled by the video driver.\n");
- return 0;
- case DEINTERLACE_LINEARBLEND:
- return 1;
- }
-
- return 0;
-}
-
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 src/video_out/deinterlace.h
--- a/src/video_out/deinterlace.h Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
- /*
- * Copyright (C) 2001 the xine project
- *
- * This file is part of xine, a free video player.
- *
- * xine is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * xine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * Deinterlace routines by Miguel Freitas
- * based of DScaler project sources (deinterlace.sourceforge.net)
- *
- * Currently only available for Xv driver and MMX extensions
- *
- */
-
-#ifndef __DEINTERLACE_H__
-#define __DEINTERLACE_H__
-
-#include "video_out.h"
-
-int deinterlace_yuv_supported ( int method );
-void deinterlace_yuv( uint8_t *pdst, uint8_t *psrc[],
- int width, int height, int method );
-
-#define DEINTERLACE_NONE 0
-#define DEINTERLACE_BOB 1
-#define DEINTERLACE_WEAVE 2
-#define DEINTERLACE_GREEDY 3
-#define DEINTERLACE_ONEFIELD 4
-#define DEINTERLACE_ONEFIELDXV 5
-#define DEINTERLACE_LINEARBLEND 6
-
-static const char *deinterlace_methods[] = {
- "none",
- "bob",
- "weave",
- "greedy",
- "onefield",
- "onefield_xv",
- "linearblend",
- NULL
-};
-
-#endif
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/.hgignore
--- a/src/video_out/libdha/.hgignore Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-.libs
-.deps
-*.lo
-*.la
-pci_dev_ids.c
-pci_ids.h
-pci_names.c
-pci_names.h
-pci_vendors.h
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/AsmMacros.h
--- a/src/video_out/libdha/AsmMacros.h Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/* $XConsortium: AsmMacros.h /main/13 1996/10/25 11:33:12 kaleb $ */
-/*
- * (c) Copyright 1993,1994 by David Wexelblat <dwex@xfree86.org>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * DAVID WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of David Wexelblat shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from David Wexelblat.
- *
- */
-/*
- * Copyright 1997
- * Digital Equipment Corporation. All rights reserved.
- * This software is furnished under license and may be used and copied only in
- * accordance with the following terms and conditions. Subject to these
- * conditions, you may download, copy, install, use, modify and distribute
- * this software in source and/or binary form. No title or ownership is
- * transferred hereby.
- *
- * 1) Any source code used, modified or distributed must reproduce and retain
- * this copyright notice and list of conditions as they appear in the source
- * file.
- *
- * 2) No right is granted to use any trade name, trademark, or logo of Digital
- * Equipment Corporation. Neither the "Digital Equipment Corporation" name
- * nor any trademark or logo of Digital Equipment Corporation may be used
- * to endorse or promote products derived from this software without the
- * prior written permission of Digital Equipment Corporation.
- *
- * 3) This software is provided "AS-IS" and any express or implied warranties,
- * including but not limited to, any implied warranties of merchantability,
- * fitness for a particular purpose, or non-infringement are disclaimed. In
- * no event shall DIGITAL be liable for any damages whatsoever, and in
- * particular, DIGITAL shall not be liable for special, indirect,
- * consequential, or incidental damages or damages for
- * lost profits, loss of revenue or loss of use, whether such damages arise
- * in contract,
- * negligence, tort, under statute, in equity, at law or otherwise, even if
- * advised of the possibility of such damage.
- *
- */
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 \
2001/11/16 21:13:34 tsi Exp $ */
-
-/*
- * Modified for readability by Nick Kurshev
-*/
-
-#if defined(__GNUC__) || defined(__ICC)
-#if defined(__alpha__)
-#include "sysdep/AsmMacros_alpha.h"
-#elif defined(__ia64__)
-#include "sysdep/AsmMacros_ia64.h"
-#elif defined(__sparc__)
-#include "sysdep/AsmMacros_sparc.h"
-#elif defined( __arm32__ )
-#include "sysdep/AsmMacros_arm32.h"
-#elif defined(__powerpc__)
-#include "sysdep/AsmMacros_powerpc.h"
-#elif defined (__i386__)
-#include "sysdep/AsmMacros_x86.h"
-#else
-#include "sysdep/AsmMacros_generic.h"
-#endif
-
-#else /* __GNUC__ */
-
-#if defined(_MINIX) && defined(_ACK)
-
-/* inb, outb, inw and outw are defined in the library */
-/* ... but I've no idea if the same is true for inl & outl */
-
-extern u8_t inb(U16_t);
-extern void outb(U16_t, U8_t);
-extern u16_t inw(U16_t);
-extern void outw(U16_t, U16_t);
-extern u32_t inl(U16_t);
-extern void outl(U16_t, U32_t);
-
-#else /* not _MINIX and _ACK */
-
-# if defined(__STDC__) && (__STDC__ == 1)
-# ifndef NCR
-# define asm __asm
-# endif
-# endif
-# ifdef SVR4
-# include <sys/types.h>
-# ifndef __USLC__
-# define __USLC__
-# endif
-# endif
-#ifndef SCO325
-# include <sys/inline.h>
-#else
-# include "../common/scoasm.h"
-#endif
-#define intr_disable() asm("cli")
-#define intr_enable() asm("sti")
-
-#endif /* _MINIX and _ACK */
-#endif /* __GNUC__ */
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/Makefile.am
--- a/src/video_out/libdha/Makefile.am Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-include $(top_srcdir)/misc/Makefile.common
-
-EXTRA_DIST = README pci_db2c.awk
-
-SUBDIRS = bin kernelhelper oth sysdep
-
-AM_CFLAGS = @STATIC@
-
-if HAVE_VIDIX
-dha_lib = libdha.la
-endif
-
-awk_generated = pci_dev_ids.c pci_ids.h pci_names.c pci_names.h pci_vendors.h
-CLEANFILES = $(awk_generated)
-
-noinst_LTLIBRARIES = $(dha_lib)
-
-libdha_la_SOURCES = libdha.c mtrr.c pci.c mmi.c ports.c irq.c cpu_flush.c
-nodist_libdha_la_SOURCES = pci_names.c
-
-EXTRA_PROGRAMS = test
-
-test_SOURCES = test.c
-test_LDADD = $(top_builddir)/src/video_out/libdha/libdha.la
-
-noinst_HEADERS = AsmMacros.h libdha.h pci_ids.h pci_names.h pci_vendors.h
-
-## for OpenBSD LIBS += -li386
-
-## We have to create some files, on the fly, this is why this rule is needed.
-pci_db2c.awk:
-oth/pci.db:
-
-$(awk_generated): pci_db2c.awk oth/pci.db
- LC_ALL=C $(AWK) -f $(top_srcdir)/src/video_out/libdha/pci_db2c.awk \
- $(top_srcdir)/src/video_out/libdha/oth/pci.db
-
-pci_names.lo: $(awk_generated)
- source='$*.c' object='$@' libtool=yes \
- depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' \
- $(CCDEPMODE) $(depcomp) \
- $(LTCOMPILE) -c -o $@ `test -f $*.c || echo '$(srcdir)/'`$*.c
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 src/video_out/libdha/README
--- a/src/video_out/libdha/README Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-libdha - Library of Direct Hardware Access.
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-This library was designed for direct hardware access under different
-OS and architectures. It's not linux specific only (like harddrake
-and other).
-
-This library is based on gfxdump utility from GATOS project.
-Full list of supported OS'es see in libdha.h
-
-Note: This library requires ROOT privileges or SUID'ed executable
-file (same as XServer).
-(Or use newly developed libdha kernel helper. Look at kernelhelper/dhahelper.c)
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/bin/Makefile.am
--- a/src/video_out/libdha/bin/Makefile.am Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-include $(top_srcdir)/misc/Makefile.common
-
-EXTRA_DIST = README mapdev.copyright mapdev.vxd
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/bin/README
--- a/src/video_out/libdha/bin/README Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-mapdev.vxd
-~~~~~~~~~~
-mapdev.vxd - provides direct hardware access under Win9x.
-install: Just copy it into %WINDOWS%\system folder and reboot.
-note: This driver won't work under NT-based systems
-(like WinNT, Win2000 and even WinME and WinXP due importing NT things).
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/bin/mapdev.copyright
--- a/src/video_out/libdha/bin/mapdev.copyright Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-From khazzah@melita.com Mon Jun 23 21:48:19 1997
-Return-Path: <khazzah@melita.com>
-Received: from melita.melita.com by max4.rrze.uni-erlangen.de; Mon, 23 Jun 1997 \
21:48:16 +0200
-Received: from mailgate.melita.com ([192.68.22.8]) by melita.melita.com \
(8.6.12/8.6.9) with SMTP id QAA29292 for <Stefan.Dirsch@stud.uni-erlangen.de>; Mon, \
23 Jun 1997 16:17:55 -0400
-Received: by mailgate.melita.com with Microsoft Mail
- id <33AEFD34@mailgate.melita.com>; Mon, 23 Jun 97 15:48:20 PDT
-From: Karen Hazzah <khazzah@melita.com>
-To: "'Stefan.Dirsch@stud.uni-erlangen.de'" <Stefan.Dirsch@stud.uni-erlangen.de>
-Subject: Your post to vxd newsgroup
-Date: Sun, 22 Jun 97 20:51:00 PDT
-Message-ID: <33AEFD34@mailgate.melita.com>
-Encoding: 22 TEXT
-X-Mailer: Microsoft Mail V3.0
-
-
-I posted an answer to your question in the newsgroup. I also have
-additional information for you.
-
-I can email you the binary for VxD which does exactly what you need:
-given a physical address, returns a pointer that can be used by a
-Win32 application. I'll also give you source for a Win32 app which
-uses the VxD to read an area of physical memory.
-
-I don't offer this solution to everyone, since in most cases the
-proper solution is for them to write a VxD which interacts with their
-hardware, rather than simply getting a pointer to the hardware and
-interacting with it from an application.
-
-However, in your case, you're just using a VxD as a tool to get your
-Linux driver working...you shouldn't have to write a VxD for this :-)
-
-Let me know if you're interested.
-===============================================================================
-Hello Karen
-
-A long time ago, you sent me your VXD for reading an area of physical
-memory under Win32, so I could make register dumps of the graphic
-chip. Did I ever mention, that it works perfectly for me?
-
-Why I contact you is, that I really would like to offer this solution
-to all XFree86 members, so that it will be much easier in the future
-for XFree86 to develop drivers for graphic boards.
-
-Can I count with your agreement? Would you like to add a special
-copyright to your software?
-
-Stefan
-===============================================================================
-From KHazzah@melita.com Wed Mar 4 00:00:28 1998
-Return-Path: <KHazzah@melita.com>
-Received: from melita.melita.com (melita.com [192.68.22.2])
- by Galois.suse.de (8.8.8/8.8.8) with SMTP id AAA03709
- for <sndirsch@suse.de>; Wed, 4 Mar 1998 00:00:26 +0100
-Received: from norcross.melita.com (norcross.melita.com [192.68.22.10]) by \
melita.melita.com (8.6.12/8.6.9) with ESMTP id TAA31217 for <sndirsch@suse.de>; Tue, \
3 Mar 1998 19:48:10 -0500
-Received: by zippy.melita.com with Internet Mail Service (5.5.1960.3)
- id <F5X7MBSS>; Tue, 3 Mar 1998 18:00:26 -0500
-Message-ID: <D8EE8292EB83D111A15E00805FA67447166532@zippy.melita.com>
-From: "Hazzah, Karen" <KHazzah@melita.com>
-To: Stefan Dirsch <sndirsch@suse.de>
-Subject: RE: VXD binary for Win32 for reading an area of physical memory
-Date: Tue, 3 Mar 1998 18:00:25 -0500
-MIME-Version: 1.0
-X-Mailer: Internet Mail Service (5.5.1960.3)
-Content-Type: text/plain
-Status: ROr
-
-OK, you have my permission to make it publicly available, as is.
-
-If you make it available on the web (ftp, etc.), please give me the
-URL so I can refer others to it.
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 src/video_out/libdha/bin/mapdev.vxd Binary \
file src/video_out/libdha/bin/mapdev.vxd has changed
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/cpu_flush.c
--- a/src/video_out/libdha/cpu_flush.c Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-/* CPU flush support */
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include "libdha.h"
-#include "kernelhelper/dhahelper.h"
-
-void cpu_flush(void *va,unsigned long length)
-{
- int retval;
- int libdha_fd=-1;
- if( libdha_fd == -1) libdha_fd = open("/dev/dhahelper",O_RDWR);
- if (libdha_fd > 0)
- {
- dhahelper_cpu_flush_t _l2;
- _l2.va = va;
- _l2.length = length;
- retval = ioctl(libdha_fd, DHAHELPER_CPU_FLUSH, &_l2);
- close(libdha_fd);
- }
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 src/video_out/libdha/irq.c
--- a/src/video_out/libdha/irq.c Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/* HW IRQ support */
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/mman.h> /* mlock */
-#include <pthread.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include "libdha.h"
-#include "kernelhelper/dhahelper.h"
-
-
-static int libdha_fd=-1;
-static int hwirq_locks=0;
-
-int hwirq_install(int bus, int dev, int func,
- int ar, u_long ao, uint32_t ad)
-{
- int retval;
- if( libdha_fd == -1) libdha_fd = open("/dev/dhahelper",O_RDWR);
- hwirq_locks++;
- if (libdha_fd > 0)
- {
- dhahelper_irq_t _irq;
- _irq.bus = bus;
- _irq.dev = dev;
- _irq.func = func;
- _irq.ack_region = ar;
- _irq.ack_offset = ao;
- _irq.ack_data = ad;
- retval = ioctl(libdha_fd, DHAHELPER_INSTALL_IRQ, &_irq);
- return retval;
- }
- return errno;
-}
-
-int hwirq_wait(unsigned irqnum)
-{
- int retval;
- if (libdha_fd > 0)
- {
- dhahelper_irq_t _irq;
- _irq.num = irqnum;
- retval = ioctl(libdha_fd, DHAHELPER_ACK_IRQ, &_irq);
- return retval;
- }
- return EINVAL;
-}
-
-int hwirq_uninstall(int bus, int dev, int func)
-{
- if (libdha_fd > 0)
- {
- dhahelper_irq_t _irq;
- _irq.bus = bus;
- _irq.dev = dev;
- _irq.func = func;
- ioctl(libdha_fd, DHAHELPER_FREE_IRQ, &_irq);
- }
- if(!hwirq_locks) { close(libdha_fd); libdha_fd=-1; }
- return 0;
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/kernelhelper/Makefile.am
--- a/src/video_out/libdha/kernelhelper/Makefile.am Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-include $(top_srcdir)/misc/Makefile.common
-
-EXTRA_DIST = README dhahelper.c
-
-KCFLAGS = -O2 -Wall -D__KERNEL__ -DMODULE -include `echo @LINUX_INCLUDE@ | sed -e \
's/\-I//g'`/linux/modversions.h
-
-KVERSION = $(shell $(SHELL) -c 'uname -r')
-moddir = /lib/modules/$(KVERSION)/misc
-
-KCOMPILE = $(CC) $(CFLAGS) $(KCFLAGS) $(INCLUDES) $(LINUX_INCLUDE)
-
-if HAVE_LINUX
-if BUILD_DHA_KMOD
-KERNEL_MODULE = dhahelper.o
-endif
-endif
-
-noinst_HEADERS = dhahelper.h
-
-EXTRA_PROGRAMS = test
-test_SOURCES = test.c
-
-dhahelper.o:
- $(KCOMPILE) -c `test -f $*.c || echo '$(srcdir)/'`$*.c
-
-nodes:
- $(MKNOD) -m 666 /dev/dhahelper c 252 0
-
-all: $(KERNEL_MODULE)
-
-install-exec-local: $(KERNEL_MODULE)
-@BUILD_DHA_KMOD_TRUE@ @$(NORMAL_INSTALL)
-@BUILD_DHA_KMOD_TRUE@ $(mkinstalldirs) $(DESTDIR)$(moddir)
-@BUILD_DHA_KMOD_TRUE@ @list='$(KERNEL_MODULE)'; \
-@BUILD_DHA_KMOD_TRUE@ for p in $$list; do \
-@BUILD_DHA_KMOD_TRUE@ if test -f $$p; then \
-@BUILD_DHA_KMOD_TRUE@ echo "$(INSTALL) -o root -g root -m 644 $$p \
$(DESTDIR)$(moddir)/$$p"; \
-@BUILD_DHA_KMOD_TRUE@ $(INSTALL) -o root -g root -m 644 $$p \
$(DESTDIR)$(moddir)/$$p; \
-@BUILD_DHA_KMOD_TRUE@ else :; fi; \
-@BUILD_DHA_KMOD_TRUE@ done; \
-@BUILD_DHA_KMOD_TRUE@ $(DEPMOD) -a
-@BUILD_DHA_KMOD_TRUE@ if test ! -c /dev/dhahelper; then \
-@BUILD_DHA_KMOD_TRUE@ $(MAKE) nodes; \
-@BUILD_DHA_KMOD_TRUE@ fi
-
-
-uninstall-local:
-@BUILD_DHA_KMOD_TRUE@ @$(NORMAL_UNINSTALL)
-@BUILD_DHA_KMOD_TRUE@ @list='$(KERNEL_MODULE)'; \
-@BUILD_DHA_KMOD_TRUE@ for p in $$list; do \
-@BUILD_DHA_KMOD_TRUE@ echo "rm -f $(DESTDIR)$(moddir)/`echo $$p|sed \
's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
-@BUILD_DHA_KMOD_TRUE@ rm -f $(DESTDIR)$(moddir)/`echo $$p|sed \
's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
-@BUILD_DHA_KMOD_TRUE@ done
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/kernelhelper/README
--- a/src/video_out/libdha/kernelhelper/README Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-dhahelper is small driver to provide some kernel function into userspace.
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The main reason you need to use dhahelper is for busmastering.
-(Btw, lacking of possibility to implement conversion of
-virtual addresses into physical in userspace caused
-implementing of so-called DRM drivers for Linux from
-XFree86 side).
-Second goal (still is unfinished) - provide possibility
-to control port and physical memory access through
-groups and access rights of this driver. (Unix way).
-
-Installation:
-~~~~~~~~~~~~~
-just type in this directory:
-make all install
-
-The device node /dev/dhahelper will be created. The initial
-permissions of this node are restrictive. See below for information
-on how to make it available to non-root users.
-
-Porting:
-~~~~~~~~
-This driver was developed only for Linux.
-So if someone will port that on other unices
-then any patches are gladly accepted.
-
-WARNING:
-~~~~~~~~
-
-This driver violates some kernel security rules. To keep this driver
-from anonymous access I suggest you create a new group (e.g. dha) for
-/dev/dhahelper and set the permissions to 660 (or ug+rw,o-rw). Then
-do one of the following:
-
-- add trusted users to group dha.
-- make trusted applications SGID to dha.
-
-Good luck!
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/kernelhelper/dhahelper.c
--- a/src/video_out/libdha/kernelhelper/dhahelper.c Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1239 +0,0 @@
-/*
- Direct Hardware Access kernel helper
-
- (C) 2002 Alex Beregszaszi <alex@naxine.org>
- (C) 2002-2003 Nick Kurshev <nickols_k@mail.ru>
- (C) 2002-2004 Måns Rullgård <mru@users.sourceforge.net>
-
- Accessing hardware from userspace as USER (no root needed!)
-
- Tested on 2.2.x (2.2.19), 2.4.x (2.4.3,2.4.17) and 2.6.1.
-
- License: GPL
-
- WARNING! THIS MODULE VIOLATES SEVERAL SECURITY LINES! DON'T USE IT
- ON PRODUCTION SYSTEMS, ONLY AT HOME, ON A "SINGLE-USER" SYSTEM.
- NO WARRANTY!
-
- IF YOU WANT TO USE IT ON PRODUCTION SYSTEMS THEN PLEASE READ 'README'
- FILE TO KNOW HOW TO PREVENT ANONYMOUS ACCESS TO THIS MODULE.
-
- Tech:
- Communication between userspace and kernelspace goes over character
- device using ioctl.
-
- Usage:
- mknod -m 600 /dev/dhahelper c 252 0
-
- Also you can change the major number, setting the "dhahelper_major"
- module parameter, the default is 252, specified in dhahelper.h.
-
- Note: do not use other than minor==0, the module forbids it.
-
- TODO:
- * select (request?) a "valid" major number (from Linux project? ;)
- * make security
- * is pci handling needed? (libdha does this with lowlevel port funcs)
- * is mttr handling needed?
- * test on older kernels (2.0.x (?))
-*/
-
-#ifndef MODULE
-#define MODULE
-#endif
-
-#ifndef __KERNEL__
-#define __KERNEL__
-#endif
-
-#include <linux/config.h>
-
-#ifdef CONFIG_MODVERSION
-#define MODVERSION
-#include <linux/modversions.h>
-#endif
-
-#include <linux/version.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/pagemap.h>
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/interrupt.h>
-#include <linux/vmalloc.h>
-#include <linux/string.h>
-#include <linux/errno.h>
-#include <asm/io.h>
-#include <asm/pgtable.h>
-#include <asm/unistd.h>
-#include <asm/uaccess.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-#include <linux/malloc.h>
-#else
-#include <linux/slab.h>
-#endif
-
-#include <linux/pci.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
-
-#include <asm/uaccess.h>
-#include <asm/system.h>
-#include <asm/io.h>
-
-#include <linux/mman.h>
-
-#include <linux/fs.h>
-#include <linux/unistd.h>
-
-#ifdef CONFIG_MTRR
-#include <asm/mtrr.h>
-#endif
-#ifdef CONFIG_DEVFS_FS
-#include <linux/devfs_fs_kernel.h>
-#endif
-
-#include "dhahelper.h"
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-#define pte_offset(p,a) pte_offset_kernel(p,a)
-#define LockPage(p) SetPageLocked(p)
-#define UnlockPage(p) ClearPageLocked(p)
-#define irqreturn(n) return(n)
-#else
-#define irqreturn_t void
-#define irqreturn(n) return
-#endif
-
-MODULE_AUTHOR("Alex Beregszaszi <alex@naxine.org>, Nick Kurshev <nickols_k@mail.ru>, \
Måns Rullgård <mru@users.sf.net>");
-MODULE_DESCRIPTION("Provides userspace access to hardware");
-#ifdef MODULE_LICENSE
-MODULE_LICENSE("GPL");
-#endif
-
-static int dhahelper_major = DEFAULT_MAJOR;
-MODULE_PARM(dhahelper_major, "i");
-MODULE_PARM_DESC(dhahelper_major, "Major number of dhahelper characterdevice");
-
-/* 0 = silent */
-/* 1 = report errors (default) */
-/* 2 = debug */
[... 987 lines omitted ...]
- return 0;
-}
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-static struct file_operations dhahelper_fops =
-{
- /*llseek*/ dhahelper_lseek,
- /*read*/ dhahelper_read,
- /*write*/ dhahelper_write,
- /*readdir*/ NULL,
- /*poll*/ NULL,
- /*ioctl*/ dhahelper_ioctl,
- /*mmap*/ dhahelper_mmap,
- /*open*/ dhahelper_open,
- /*flush*/ NULL,
- /*release*/ dhahelper_release,
- /* zero out the last 5 entries too ? */
-};
-#else
-static struct file_operations dhahelper_fops =
-{
- owner: THIS_MODULE,
- ioctl: dhahelper_ioctl,
- open: dhahelper_open,
- release: dhahelper_release,
- llseek: dhahelper_lseek,
- read: dhahelper_read,
- write: dhahelper_write,
- mmap: dhahelper_mmap,
-};
-#endif
-
-#ifdef CONFIG_DEVFS_FS
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-devfs_handle_t dha_devfsh;
-
-static int
-register_dev(void)
-{
- dha_devfsh = devfs_register(NULL, "dhahelper", DEVFS_FL_NONE,
- dhahelper_major, 0,
- S_IFCHR | S_IRUSR | S_IWUSR,
- &dhahelper_fops, NULL);
- if(!dha_devfsh)
- return -EIO;
- return 0;
-}
-
-static void
-unregister_dev(void)
-{
- devfs_unregister(dha_devfsh);
-}
-#else /* VERSION < 2.6.0 */
-static int
-register_dev(void)
-{
- devfs_mk_cdev(MKDEV(dhahelper_major, 0), S_IFCHR | S_IRUSR | S_IWUSR,
- "dhahelper");
- if(register_chrdev(dhahelper_major, "dhahelper", &dhahelper_fops))
- return -EIO;
- return 0;
-}
-
-static void
-unregister_dev(void)
-{
- devfs_remove("dhahelper");
- unregister_chrdev(dhahelper_major, "dhahelper");
-}
-#endif /* VERSION < 2.6.0 */
-#else
-static int
-register_dev(void)
-{
- return register_chrdev(dhahelper_major, "dhahelper", &dhahelper_fops);
-}
-
-static void
-unregister_dev(void)
-{
- unregister_chrdev(dhahelper_major, "dhahelper");
-}
-#endif /* defined CONFIG_DEVFS_FS */
-
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-int init_module(void)
-#else
-static int __init init_dhahelper(void)
-#endif
-{
- int err = 0;
- printk(KERN_INFO "Direct Hardware Access kernel helper (C) Alex Beregszaszi\n");
-
- err = register_dev();
- if(err){
- if (dhahelper_verbosity > 0)
- printk(KERN_ERR "dhahelper: unable to register character device (major: %d)\n",
- dhahelper_major);
- return err;
- }
- memset(dha_irqs, 0, sizeof(dha_irqs));
- return 0;
-}
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-void cleanup_module(void)
-#else
-static void __exit exit_dhahelper(void)
-#endif
-{
- unsigned i;
- for(i=0;i<256;i++)
- if(dha_irqs[i].handled)
- free_irq(i, dha_irqs[i].dev);
-
- unregister_dev();
-}
-
-#ifdef EXPORT_NO_SYMBOLS
-EXPORT_NO_SYMBOLS;
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-module_init(init_dhahelper);
-module_exit(exit_dhahelper);
-#endif
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/kernelhelper/dhahelper.h
--- a/src/video_out/libdha/kernelhelper/dhahelper.h Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
- Direct Hardware Access kernel helper
-
- (C) 2002 Alex Beregszaszi <alex@naxine.org>
- (C) 2002-2003 Nick Kurshev <nickols_k@mail.ru>
-*/
-
-#ifndef DHAHELPER_H
-#define DHAHELPER_H
-
-/* #include <linux/ioctl.h> */
-
-/* feel free to change */
-#define DEFAULT_MAJOR 252 /* 240-254 LOCAL/EXPERIMENTAL USE */
-
-#define API_VERSION 0x30 /* 3.0*/
-
-typedef struct dhahelper_port_s
-{
-#define PORT_OP_READ 1
-#define PORT_OP_WRITE 2
- int operation;
- int size;
- int addr; // FIXME - switch to void* (64bit)
- int value;
-} dhahelper_port_t;
-
-typedef struct dhahelper_mtrr_s
-{
-#define MTRR_OP_ADD 1
-#define MTRR_OP_DEL 2
- int operation;
- long start;
- long size;
- int type;
- int privat;
-} dhahelper_mtrr_t;
-
-typedef struct dhahelper_pci_config_s
-{
-#define PCI_OP_READ 0
-#define PCI_OP_WRITE 1
- int operation;
- int bus;
- int dev;
- int func;
- int cmd;
- int size;
- long ret;
-} dhahelper_pci_config_t;
-
-typedef struct dhahelper_vmi_s
-{
- void * virtaddr;
- unsigned long length;
- unsigned long *realaddr;
-}dhahelper_vmi_t;
-
-typedef struct dhahelper_mem_s
-{
- void * addr;
- unsigned long length;
-}dhahelper_mem_t;
-
-typedef struct dhahelper_irq_s
-{
- unsigned num;
- int bus, dev, func;
- int ack_region;
- unsigned long ack_offset;
- unsigned int ack_data;
-}dhahelper_irq_t;
-
-typedef struct dhahelper_cpu_flush_s
-{
- void *va;
- unsigned long length;
-}dhahelper_cpu_flush_t;
-
-typedef struct dhahelper_pci_device_s
-{
- int bus,card,func; /* PCI/AGP bus:card:func */
- unsigned short vendor,device; /* Card vendor+device ID */
- unsigned long base0,base1,base2,baserom; /* Memory and I/O base addresses */
- unsigned long base3,base4,base5; /* Memory and I/O base addresses */
- unsigned char irq,ipin,gnt,lat; /* assigned IRQ parameters for this card */
-}dhahelper_pci_device_t;
-
-#define DHAHELPER_GET_VERSION _IOW('D', 0, int)
-#define DHAHELPER_PORT _IOWR('D', 1, dhahelper_port_t)
-#define DHAHELPER_MTRR _IOWR('D', 2, dhahelper_mtrr_t)
-#define DHAHELPER_PCI_CONFIG _IOWR('D', 3, dhahelper_pci_config_t)
-#define DHAHELPER_VIRT_TO_PHYS _IOWR('D', 4, dhahelper_vmi_t)
-#define DHAHELPER_VIRT_TO_BUS _IOWR('D', 5, dhahelper_vmi_t)
-#define DHAHELPER_ALLOC_PA _IOWR('D', 6, dhahelper_mem_t)
-#define DHAHELPER_FREE_PA _IOWR('D', 7, dhahelper_mem_t)
-#define DHAHELPER_LOCK_MEM _IOWR('D', 8, dhahelper_mem_t)
-#define DHAHELPER_UNLOCK_MEM _IOWR('D', 9, dhahelper_mem_t)
-#define DHAHELPER_INSTALL_IRQ _IOWR('D', 10, dhahelper_irq_t)
-#define DHAHELPER_ACK_IRQ _IOWR('D', 11, dhahelper_irq_t)
-#define DHAHELPER_FREE_IRQ _IOWR('D', 12, dhahelper_irq_t)
-#define DHAHELPER_CPU_FLUSH _IOWR('D', 13, dhahelper_cpu_flush_t)
-#define DHAHELPER_PCI_FIND _IOWR('D', 14, dhahelper_pci_device_t)
-
-#endif /* DHAHELPER_H */
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/kernelhelper/test.c
--- a/src/video_out/libdha/kernelhelper/test.c Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-#include <string.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <stdlib.h>
-
-#include "dhahelper.h"
-
-int main(int argc, char *argv[])
-{
- int fd;
- int ret;
-
- fd = open("/dev/dhahelper", O_RDWR);
- if(fd < 0){
- perror("dev/dhahelper");
- exit(1);
- }
-
- ioctl(fd, DHAHELPER_GET_VERSION, &ret);
-
- printf("api version: %d\n", ret);
- if (ret != API_VERSION)
- printf("incompatible api!\n");
-
- {
- void *mem;
- unsigned long size=256;
- mem = mmap(0,size,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0);
- printf("allocated to %p\n", mem);
-
- if (argc > 1)
- if (mem != 0)
- {
- int i;
-
- for (i = 0; i < 256; i++)
- printf("[%x] ", *(int *)(mem+i));
- printf("\n");
- }
-
- munmap((void *)mem, size);
- }
-
- return(0);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/libdha.c
--- a/src/video_out/libdha/libdha.c Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
- libgha.c - Library for direct hardware access
- Copyrights:
- 1996/10/27 - Robin Cutshaw (robin@xfree86.org)
- XFree86 3.3.3 implementation
- 1999 - Øyvind Aabling.
- Modified for GATOS/win/gfxdump.
-
- 2002 - library implementation by Nick Kurshev
- - dhahelper and some changes by Alex Beregszaszi
-
- supported O/S's: SVR4, UnixWare, SCO, Solaris,
- FreeBSD, NetBSD, 386BSD, BSDI BSD/386,
- Linux, Mach/386, ISC
- DOS (WATCOM 9.5 compiler), Win9x (with mapdev.vxd)
- Licence: GPL
- Original location: www.linuxvideo.org/gatos
-*/
-
-#include "config.h"
-
-#include "libdha.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#ifdef ARCH_ALPHA
-#include <sys/io.h>
-#endif
-#include <unistd.h>
-
-/* instead exit() use libdha_exit, and do the 'mother-application' deinit
- only in this code */
-void libdha_exit(const char *message, int level)
-{
- printf("libdha: FATAL: %s\n", message);
- exit(level); /* FIXME */
-}
-
-#if defined(_WIN32)
-#include "sysdep/libdha_win32.c"
-#elif defined (__EMX__)
-#include "sysdep/libdha_os2.c"
-#else
-
-#if defined(SVR4) || defined(SCO325)
-# if !(defined(sun) && defined (i386) && defined (SVR4))
-# define DEV_MEM "/dev/pmem"
-# elif defined(PowerMAX_OS)
-# define DEV_MEM "/dev/iomem"
-# endif
-# ifdef SCO325
-# undef DEV_MEM
-# define DEV_MEM "/dev/mem"
-# endif
-# endif /* SVR4 */
-
-/* Generic version */
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#ifndef DEV_MEM
-#define DEV_MEM "/dev/mem"
-#endif
-
-#include "kernelhelper/dhahelper.h"
-
-static int devmem_fd=-1;
-static unsigned devmem_locks=0;
-void *map_phys_mem(unsigned long base, unsigned long size)
-{
-#ifdef ARCH_ALPHA
-/* TODO: move it into sysdep */
- base += bus_base();
-#endif
- if( devmem_fd == -1)
- {
- if ( (devmem_fd = open("/dev/dhahelper",O_RDWR)) < 0)
- {
- if ( (devmem_fd = open(DEV_MEM,O_RDWR)) == -1)
- {
- perror("libdha: open(/dev/mem) failed");
- exit(1);
- }
- }
- }
- devmem_locks++;
- return mmap(0,size,PROT_READ|PROT_WRITE,MAP_SHARED,devmem_fd,base) ;
-}
-
-void unmap_phys_mem(void *ptr, unsigned long size)
-{
- int res=munmap(ptr,size) ;
- if (res == -1) { perror("libdha: munmap() failed") ; exit(1) ; }
- devmem_locks--;
- if(!devmem_locks) { close(devmem_fd); devmem_fd=-1; }
-}
-#endif
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/libdha.h
--- a/src/video_out/libdha/libdha.h Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
- libgha.h - Library for direct hardware access
- Copyrights:
- 1996/10/27 - Robin Cutshaw (robin@xfree86.org)
- XFree86 3.3.3 implementation
- 1999 - Øyvind Aabling.
- Modified for GATOS/win/gfxdump.
- 2002 - library implementation by Nick Kurshev
-
- supported O/S's: SVR4, UnixWare, SCO, Solaris,
- FreeBSD, NetBSD, 386BSD, BSDI BSD/386,
- Linux, Mach/386, ISC
- DOS (WATCOM 9.5 compiler), Win9x (with mapdev.vxd)
- Licence: GPL
-*/
-#ifndef LIBDHA_H
-#define LIBDHA_H
-
-#if defined (__FreeBSD__)
-# include <inttypes.h>
-#else
-# include <stdint.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MAX_DEV_PER_VENDOR_CFG1 64
-#define MAX_PCI_DEVICES_PER_BUS 32
-#define MAX_PCI_DEVICES 64
-#define PCI_MULTIFUNC_DEV 0x80
-
-typedef struct pciinfo_s
-{
- int bus,card,func; /* PCI/AGP bus:card:func */
- unsigned short vendor,device; /* Card vendor+device ID */
- unsigned long base0,base1,base2,baserom; /* Memory and I/O base addresses */
- unsigned long base3,base4,base5; /* Memory and I/O base addresses */
- unsigned char irq,ipin,gnt,lat; /* assigned IRQ parameters for this card */
-// unsigned base0_limit, base1_limit, base2_limit, baserom_limit;
-}pciinfo_t;
-
-extern int pci_config_read(unsigned char bus, unsigned char dev, unsigned char func,
- unsigned char cmd, int len, unsigned long *val);
-extern int pci_config_write(unsigned char bus, unsigned char dev, unsigned char \
func,
- unsigned char cmd, int len, unsigned long val);
- /* Fill array pci_list which must have size MAX_PCI_DEVICES
- and return 0 if sucessful */
-extern int pci_scan(pciinfo_t *pci_list,unsigned *num_card);
-
- /* Enables/disables accessing to IO space from application side.
- Should return 0 if o'k or errno on error. */
-extern int enable_app_io( void );
-extern int disable_app_io( void );
-
-extern unsigned char INPORT8(unsigned idx);
-extern unsigned short INPORT16(unsigned idx);
-extern unsigned INPORT32(unsigned idx);
-#define INPORT(idx) INPORT32(idx)
-extern void OUTPORT8(unsigned idx,unsigned char val);
-extern void OUTPORT16(unsigned idx,unsigned short val);
-extern void OUTPORT32(unsigned idx,unsigned val);
-#define OUTPORT(idx,val) OUTPORT32(idx,val)
-
-extern void * map_phys_mem(unsigned long base, unsigned long size);
-extern void unmap_phys_mem(void *ptr, unsigned long size);
-
-/* These are the region types */
-#define MTRR_TYPE_UNCACHABLE 0
-#define MTRR_TYPE_WRCOMB 1
-#define MTRR_TYPE_WRTHROUGH 4
-#define MTRR_TYPE_WRPROT 5
-#define MTRR_TYPE_WRBACK 6
-extern int mtrr_set_type(unsigned base,unsigned size,int type);
-
-/* Busmastering support */
- /* returns 0 if support exists else errno */
-extern int bm_open( void );
-extern void bm_close( void );
- /* Converts virtual memory addresses into physical
- returns 0 if OK else - errno
- parray should have enough length to accept length/page_size
- elements. virt_addr can be located in non-continious memory
- block and can be allocated by malloc(). (kmalloc() is not
- needed). Note: if you have some very old card which requires
- continous memory block then you need to implement bm_kmalloc
- bm_kfree functions here. NOTE2: to be sure that every page of
- region is present in physical memory (is not swapped out) use
- m(un)lock functions. Note3: Probably your card will want to
- have page-aligned block for DMA transfer so use
- memalign(PAGE_SIZE,mem_size) function to alloc such memory. */
-extern int bm_virt_to_phys( void * virt_addr, unsigned long length,
- unsigned long * parray );
- /* Converts virtual memory addresses into bus address
- Works in the same way as bm_virt_to_phys.
- WARNING: This function will be die after implementing
- bm_alloc_pci_shmem() because we really can't pass
- any memory address to card. Example: 64-bit linear address
- can't be passed into 32-bit card. Even more - some old
- cards can access 24-bit address space only */
-extern int bm_virt_to_bus( void * virt_addr, unsigned long length,
- unsigned long * barray );
-
- /* NOTE: bm_alloc_pci_shmem() and bm_free_pci_shmem()
- are still not implemented!
- arguments:
- pciinfo_t - specifies pci card for which memory should be shared
- bitness - can be 16,24,32,64 specifies addressing possibilities
- of the card
- length - specifies size of memory which should allocated
- op - specifies direction as combination flags TO_CARD,FROM_CARD
- Return value - should be tuned
- we need to have something like this:
- struct pci_shmem
- {
- void * handler;
- void * virt_addr
- void * array_of_bus_addr[];
- unsigned long length;
- }
- NOTE2: After finalizing of these functions bm_virt_to_bus() will be die */
-extern void * bm_alloc_pci_shmem(pciinfo_t *, unsigned mem_bitness, unsigned long \
length,int op );
-extern void bm_free_pci_shmem(void * pci_shmem);
-
-extern int bm_lock_mem( const void * addr, unsigned long length );
-extern int bm_unlock_mem( const void * addr, unsigned long length );
-
-/* HWIRQ support */
-
-extern int hwirq_install(int bus, int dev, int func,
- int areg, unsigned long aoff, uint32_t adata);
-extern int hwirq_wait(unsigned irqnum);
-extern int hwirq_uninstall(int bus, int dev, int func);
-
-/* CPU flushing support */
-extern void cpu_flush(void *va,unsigned long length);
-
-extern void libdha_exit(const char *message, int level);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 src/video_out/libdha/mmi.c
--- a/src/video_out/libdha/mmi.c Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/* Memory manager interface */
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/mman.h> /* mlock */
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include "libdha.h"
-#include "kernelhelper/dhahelper.h"
-
-static int libdha_fd=-1;
-
-#define ALLOWED_VER 0x10
-int bm_open( void )
-{
- int retv;
- libdha_fd = open("/dev/dhahelper",O_RDWR);
- retv = libdha_fd > 0 ? 0 : ENXIO;
- if(!retv)
- {
- int ver;
- ioctl(libdha_fd,DHAHELPER_GET_VERSION,&ver);
- if(ver < ALLOWED_VER)
- {
- printf("libdha: You have wrong version (%i) of /dev/dhahelper\n"
- "libdha: Please upgrade your driver up to ver=%i\n",ver,ALLOWED_VER);
- retv = EINVAL;
- close(libdha_fd);
- }
- }
- else printf("libdha: Can't open /dev/dhahelper\n");
- return retv;
-}
-
-void bm_close( void )
-{
- close(libdha_fd);
-}
-
-int bm_virt_to_phys( void * virt_addr, unsigned long length, unsigned long * parray \
)
-{
- dhahelper_vmi_t vmi;
- vmi.virtaddr = virt_addr;
- vmi.length = length;
- vmi.realaddr = parray;
- if(libdha_fd > 0) return ioctl(libdha_fd,DHAHELPER_VIRT_TO_PHYS,&vmi);
- return ENXIO;
-}
-
-int bm_virt_to_bus( void * virt_addr, unsigned long length, unsigned long * barray )
-{
- dhahelper_vmi_t vmi;
- vmi.virtaddr = virt_addr;
- vmi.length = length;
- vmi.realaddr = barray;
- if(libdha_fd > 0) return ioctl(libdha_fd,DHAHELPER_VIRT_TO_BUS,&vmi);
- return ENXIO;
-}
-
-void * bm_alloc_pci_shmem(pciinfo_t *pi, unsigned mem_bitness, unsigned long \
length,int op )
-{
- printf("libdha: Pure virtual function call - bm_alloc_pci_shmem()\n");
-#if 0
- dhahelper_mem_t vmi;
- vmi.length = length;
- if(libdha_fd > 0)
- {
- if(ioctl(libdha_fd,DHAHELPER_ALLOC_PA,&vmi) == 0)
- return vmi.addr;
- }
-#endif
- return NULL;
-}
-
-void bm_free_pci_shmem(void * pci_shmem)
-{
- printf("libdha: Pure virtual function call - bm_free_pci_shmem()\n");
-#if 0
- dhahelper_mem_t vmi;
- vmi.addr = virt_addr;
- vmi.length = length;
- if(libdha_fd > 0)
- {
- ioctl(libdha_fd,DHAHELPER_FREE_PA,&vmi);
- }
-#endif
-}
-
-int bm_lock_mem( const void *addr, unsigned long length )
-{
- dhahelper_mem_t vmi;
- vmi.addr = (void *) addr;
- vmi.length = length;
- if(libdha_fd > 0)
- {
- return ioctl(libdha_fd,DHAHELPER_LOCK_MEM,&vmi);
- }
- return mlock(addr,length);
-}
-
-int bm_unlock_mem( const void * addr, unsigned long length )
-{
- dhahelper_mem_t vmi;
- vmi.addr = (void *) addr;
- vmi.length = length;
- if(libdha_fd > 0)
- {
- return ioctl(libdha_fd,DHAHELPER_UNLOCK_MEM,&vmi);
- }
- return munlock(addr,length);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 src/video_out/libdha/mtrr.c
--- a/src/video_out/libdha/mtrr.c Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- mtrr.c - Stuff for optimizing memory access
- Copyrights:
- 2002 - Linux version by Nick Kurshev
- Licence: GPL
-*/
-
-#include "config.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include "kernelhelper/dhahelper.h"
-#include "libdha.h"
-
-#if defined (__i386__) && defined (__NetBSD__)
-#include <sys/param.h>
-#if __NetBSD_Version__ > 105240000
-#include <stdint.h>
-#include <stdlib.h>
-#include <machine/mtrr.h>
-#include <machine/sysarch.h>
-#endif
-#endif
-
-int mtrr_set_type(unsigned base,unsigned size,int type)
-{
- int dhahelper_fd;
- dhahelper_fd = open("/dev/dhahelper",O_RDWR);
- if(dhahelper_fd > 0)
- {
- int retval;
- dhahelper_mtrr_t mtrrs;
- mtrrs.operation = MTRR_OP_ADD;
- mtrrs.start = base;
- mtrrs.size = size;
- mtrrs.type = type;
- retval = ioctl(dhahelper_fd, DHAHELPER_ACK_IRQ, &mtrrs);
- close(dhahelper_fd);
- return retval;
- }
-#if defined (__NetBSD__) && (__NetBSD_Version__) > 105240000
- {
- struct mtrr *mtrrp;
- int n;
-
- mtrrp = malloc(sizeof (struct mtrr));
- mtrrp->base = base;
- mtrrp->len = size;
- mtrrp->type = type;
- mtrrp->flags = MTRR_VALID | MTRR_PRIVATE;
- n = 1;
-
- if (i386_set_mtrr(mtrrp, &n) < 0) {
- free(mtrrp);
- return errno;
- }
- free(mtrrp);
- return 0;
- }
-#else
- {
- FILE * mtrr_fd;
- char * stype;
- switch(type)
- {
- case MTRR_TYPE_UNCACHABLE: stype = "uncachable"; break;
- case MTRR_TYPE_WRCOMB: stype = "write-combining"; break;
- case MTRR_TYPE_WRTHROUGH: stype = "write-through"; break;
- case MTRR_TYPE_WRPROT: stype = "write-protect"; break;
- case MTRR_TYPE_WRBACK: stype = "write-back"; break;
- default: return EINVAL;
- }
- mtrr_fd = fopen("/proc/mtrr","wt");
- if(mtrr_fd)
- {
- char sout[256];
- unsigned wr_len;
- sprintf(sout,"base=0x%08X size=0x%08X type=%s\n",base,size,stype);
- wr_len = fprintf(mtrr_fd,"%s",sout);
- /*printf("MTRR: %s\n",sout);*/
- fclose(mtrr_fd);
- return wr_len == strlen(sout) ? 0 : EPERM;
- }
- }
-#endif
- return ENOSYS;
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/oth/Makefile.am
--- a/src/video_out/libdha/oth/Makefile.am Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-include $(top_srcdir)/misc/Makefile.common
-
-EXTRA_DIST = pci.db
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/oth/pci.db
--- a/src/video_out/libdha/oth/pci.db Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9471 +0,0 @@
-v 0000 Gammagraphx, Inc. 0
-v 001a Ascend Communications, Inc. 0
-v 0033 Paradyne corp. 0
-v 003d Lockheed Martin-Marietta Corp 0
-v 0059 Tiger Jet Network Inc. (Wrong ID) 0 Real TJN ID is e159, but they got it \
wrong several times --mj
-v 0070 Hauppauge computer works Inc. 0
-d 00704000 WinTV PVR-350 0
-d 00704001 WinTV PVR-250 (v1) 0
-d 00704009 WinTV PVR-250 0
-d 00704801 WinTV PVR-250 MCE 0
-v 0071 Nebula Electronics Ltd. 0
-v 0095 Silicon Image, Inc. (Wrong ID) 0
-d 00950680 Ultra ATA/133 IDE RAID CONTROLLER CARD 0
-v 0100 Ncipher Corp Ltd 0
-v 018a LevelOne 0 018a is not LevelOne but there is a board misprogrammed
-d 018a0106 FPC-0106TX misprogrammed [RTL81xx] 0
-v 021b Compaq Computer Corporation 0 021b is not Compaq but there is a board \
misprogrammed
-d 021b8139 HNE-300 (RealTek RTL8139c) [iPaq Networking] 0
-v 0291 Davicom Semiconductor, Inc. 0 http://www.davicom.com.tw/
-d 02918212 DM9102A(DM9102AE, SM9102AF) Ethernet 100/10 MBit(Rev 40) 0
-v 02ac SpeedStream 0 SpeedStream is Efficient Networks, Inc, a Siemens Company
-d 02ac1012 1012 PCMCIA 10/100 Ethernet Card [RTL81xx] 0
-v 0357 TTTech AG 0
-d 0357000a TTP-Monitoring Card V2.0 0
-v 05e3 CyberDoor 0
-d 05e30701 CBD516 0
-v 0675 Dynalink 0
-d 06751700 IS64PH ISDN Adapter 0
-d 06751702 IS64PH ISDN Adapter 0
-v 0925 VIA Technologies, Inc. (Wrong ID) 0 Wrong ID used in subsystem ID of VIA USB \
controllers.
-v 09c1 Arris 0
-d 09c10704 CM 200E Cable Modem 0
-v 0a89 BREA Technologies Inc 0
-v 0b49 ASCII Corporation 0
-d 0b49064f Trance Vibrator 0 see \
http://homepage1.nifty.com/mcn/lab/machines/trance_vibrator/usbview.vib.txt
-v 0e11 Compaq Computer Corporation 0
-d 0e110001 PCI to EISA Bridge 0
-d 0e110002 PCI to ISA Bridge 0
-d 0e110046 Smart Array 64xx 0
-s 0e1100460e11409a Smart Array 641 0
-s 0e1100460e11409b Smart Array 642 0
-s 0e1100460e11409c Smart Array 6400 0
-s 0e1100460e11409d Smart Array 6400 EM 0
-d 0e110049 NC7132 Gigabit Upgrade Module 0
-d 0e11004a NC6136 Gigabit Server Adapter 0
-d 0e11007c NC7770 1000BaseTX 0
-d 0e11007d NC6770 1000BaseTX 0
-d 0e110085 NC7780 1000BaseTX 0
-d 0e1100bb NC7760 0
-d 0e1100ca NC7771 0
-d 0e1100cb NC7781 0
-d 0e1100cf NC7772 0
-d 0e1100d0 NC7782 0
-d 0e1100d1 NC7783 0
-d 0e1100e3 NC7761 0
-d 0e110508 Netelligent 4/16 Token Ring 0
-d 0e111000 Triflex/Pentium Bridge, Model 1000 0
-d 0e112000 Triflex/Pentium Bridge, Model 2000 0
-d 0e113032 QVision 1280/p 0
-d 0e113033 QVision 1280/p 0
-d 0e113034 QVision 1280/p 0
-d 0e114000 4000 [Triflex] 0
-d 0e114030 SMART-2/P 0
-d 0e114031 SMART-2SL 0
-d 0e114032 Smart Array 3200 0
-d 0e114033 Smart Array 3100ES 0
-d 0e114034 Smart Array 221 0
-d 0e114040 Integrated Array 0
-d 0e114048 Compaq Raid LC2 0
-d 0e114050 Smart Array 4200 0
-d 0e114051 Smart Array 4250ES 0
-d 0e114058 Smart Array 431 0
-d 0e114070 Smart Array 5300 0
-d 0e114080 Smart Array 5i 0
-d 0e114082 Smart Array 532 0
-d 0e114083 Smart Array 5312 0
-d 0e114091 Smart Array 6i 0
-d 0e11409a Smart Array 641 0
-d 0e11409b Smart Array 642 0
-d 0e11409c Smart Array 6400 0
-d 0e11409d Smart Array 6400 EM 0
-d 0e116010 HotPlug PCI Bridge 6010 0
-d 0e117020 USB Controller 0
-d 0e11a0ec Fibre Channel Host Controller 0
-d 0e11a0f0 Advanced System Management Controller 0
-d 0e11a0f3 Triflex PCI to ISA Bridge 0
-d 0e11a0f7 PCI Hotplug Controller 0
-s 0e11a0f78086002a PCI Hotplug Controller A 0
-s 0e11a0f78086002b PCI Hotplug Controller B 0
-d 0e11a0f8 ZFMicro Chipset USB 0
-d 0e11a0fc FibreChannel HBA Tachyon 0
-d 0e11ae10 Smart-2/P RAID Controller 0
-s 0e11ae100e114030 Smart-2/P Array Controller 0
-s 0e11ae100e114031 Smart-2SL Array Controller 0
-s 0e11ae100e114032 Smart Array Controller 0
-s 0e11ae100e114033 Smart 3100ES Array Controller 0
-d 0e11ae29 MIS-L 0
-d 0e11ae2a MPC 0
-d 0e11ae2b MIS-E 0
-d 0e11ae31 System Management Controller 0
-d 0e11ae32 Netelligent 10/100 TX PCI UTP 0
-d 0e11ae33 Triflex Dual EIDE Controller 0
-d 0e11ae34 Netelligent 10 T PCI UTP 0
-d 0e11ae35 Integrated NetFlex-3/P 0
-d 0e11ae40 Netelligent Dual 10/100 TX PCI UTP 0
-d 0e11ae43 Netelligent Integrated 10/100 TX UTP 0
-d 0e11ae69 CETUS-L 0
-d 0e11ae6c Northstar 0
-d 0e11ae6d NorthStar CPU to PCI Bridge 0
-d 0e11b011 Netelligent 10/100 TX Embedded UTP 0
-d 0e11b012 Netelligent 10 T/2 PCI UTP/Coax 0
-d 0e11b01e NC3120 Fast Ethernet NIC 0
-d 0e11b01f NC3122 Fast Ethernet NIC 0
-d 0e11b02f NC1120 Ethernet NIC 0
-d 0e11b030 Netelligent 10/100 TX UTP 0
-d 0e11b04a 10/100 TX PCI Intel WOL UTP Controller 0
-d 0e11b060 Smart Array 5300 Controller 0
-d 0e11b0c6 NC3161 Fast Ethernet NIC 0
-d 0e11b0c7 NC3160 Fast Ethernet NIC 0
-d 0e11b0d7 NC3121 Fast Ethernet NIC 0
-d 0e11b0dd NC3131 Fast Ethernet NIC 0
-d 0e11b0de NC3132 Fast Ethernet Module 0
-d 0e11b0df NC6132 Gigabit Module 0
-d 0e11b0e0 NC6133 Gigabit Module 0
[... 9219 lines omitted ...]
-d 9005801c ASC-39320D U320 0
-d 9005801d AIC-7902B U320 0
-d 9005801e AIC-7901A U320 0
-d 9005801f AIC-7902 U320 0
-d 90058080 ASC-29320A U320 w/HostRAID 0
-d 9005808f AIC-7901 U320 w/HostRAID 0
-d 90058090 ASC-39320 U320 w/HostRAID 0
-d 90058091 ASC-39320D U320 w/HostRAID 0
-d 90058092 ASC-29320 U320 w/HostRAID 0
-d 90058093 ASC-29320B U320 w/HostRAID 0
-d 90058094 ASC-29320LP U320 w/HostRAID 0
-d 90058095 ASC-39320(B) U320 w/HostRAID 0
-d 90058096 ASC-39320A U320 w/HostRAID 0
-d 90058097 ASC-29320ALP U320 w/HostRAID 0
-d 9005809c ASC-39320D(B) U320 w/HostRAID 0
-d 9005809d AIC-7902(B) U320 w/HostRAID 0
-d 9005809e AIC-7901A U320 w/HostRAID 0
-d 9005809f AIC-7902 U320 w/HostRAID 0
-v 907f Atronics 0
-d 907f2015 IDE-2015PL 0
-v 919a Gigapixel Corp 0
-v 9412 Holtek 0
-d 94126565 6565 0
-v 9699 Omni Media Technology Inc 0
-d 96996565 6565 0
-v 9710 NetMos Technology 0
-d 97107780 USB IRDA-port 0
-d 97109815 PCI 9815 Multi-I/O Controller 0
-s 9710981510000020 2P0S (2 port parallel adaptor) 0
-d 97109835 PCI 9835 Multi-I/O Controller 0
-s 9710983510000002 2S (16C550 UART) 0
-s 9710983510000012 1P2S 0
-d 97109845 PCI 9845 Multi-I/O Controller 0
-s 9710984510000004 0P4S (4 port 16550A serial card) 0
-s 9710984510000006 0P6S (6 port 16550a serial card) 0
-d 97109855 PCI 9855 Multi-I/O Controller 0
-s 9710985510000014 1P4S 0
-v 9902 Stargen Inc. 0
-d 99020001 SG2010 PCI over Starfabric Bridge 0
-d 99020002 SG2010 PCI to Starfabric Gateway 0
-d 99020003 SG1010 Starfabric Switch and PCI Bridge 0
-v a0a0 AOPEN Inc. 0
-v a0f1 UNISYS Corporation 0
-v a200 NEC Corporation 0
-v a259 Hewlett Packard 0
-v a25b Hewlett Packard GmbH PL24-MKT 0
-v a304 Sony 0
-v a727 3Com Corporation 0
-d a7270013 3CRPAG175 Wireless PC Card 0
-v aa42 Scitex Digital Video 0
-v ac1e Digital Receiver Technology Inc 0
-v ac3d Actuality Systems 0
-v aecb Adrienne Electronics Corporation 0
-v b1b3 Shiva Europe Limited 0
-v bd11 Pinnacle Systems, Inc. (Wrong ID) 0 Pinnacle should be 11bd, but they got it \
wrong several times --mj
-v c001 TSI Telsys 0
-v c0a9 Micron/Crucial Technology 0
-v c0de Motorola 0
-v c0fe Motion Engineering, Inc. 0
-v ca50 Varian Australia Pty Ltd 0
-v cafe Chrysalis-ITS 0
-v cccc Catapult Communications 0
-v cddd Tyzx, Inc. 0
-d cddd0101 DeepSea 1 High Speed Stereo Vision Frame Grabber 0
-d cddd0200 DeepSea 2 High Speed Stereo Vision Frame Grabber 0
-v d4d4 Dy4 Systems Inc 0
-d d4d40601 PCI Mezzanine Card 0
-v d531 I+ME ACTIA GmbH 0
-v d84d Exsys 0
-v dead Indigita Corporation 0
-v e000 Winbond 0
-d e000e000 W89C940 0
-v e159 Tiger Jet Network Inc. 0 see also : \
http://www.schoenfeld.de/inside/Inside_CWMK3.txt maybe a misuse of TJN id or it use \
the TJN 3XX chip for other applic
-d e1590001 Tiger3XX Modem/ISDN interface 0
-s e159000100590001 128k ISDN-S/T Adapter 0
-s e159000100590003 128k ISDN-U Adapter 0
-d e1590002 Tiger100APC ISDN chipset 0
-v e4bf EKF Elektronik GmbH 0
-v e55e Essence Technology, Inc. 0 Innovative and scalable network IC vendor
-v ea01 Eagle Technology 0
-v ea60 RME 0 The main chip of all these devices is by Xilinx -> It could also be a \
Xilinx ID.
-d ea609896 Digi32 0
-d ea609897 Digi32 Pro 0
-d ea609898 Digi32/8 0
-v eabb Aashima Technology B.V. 0
-v eace Endace Measurement Systems, Ltd 0
-d eace3100 DAG 3.10 OC-3/OC-12 0
-d eace3200 DAG 3.2x OC-3/OC-12 0
-d eace320e DAG 3.2E Fast Ethernet 0
-d eace340e DAG 3.4E Fast Ethernet 0
-d eace341e DAG 3.41E Fast Ethernet 0
-d eace3500 DAG 3.5 OC-3/OC-12 0
-d eace351c DAG 3.5ECM Fast Ethernet 0
-d eace4100 DAG 4.10 OC-48 0
-d eace4110 DAG 4.11 OC-48 0
-d eace4220 DAG 4.2 OC-48 0
-d eace422e DAG 4.2E Dual Gigabit Ethernet 0
-v ec80 Belkin Corporation 0
-d ec80ec00 F5D6000 0
-v ecc0 Echo Digital Audio Corporation 0
-d ecc00050 Gina24_301 0
-d ecc00051 Gina24_361 0
-d ecc00060 Layla24 0
-d ecc00070 Mona_301_80 0
-d ecc00071 Mona_301_66 0
-d ecc00072 Mona_361 0
-d ecc00080 Mia 0
-v edd8 ARK Logic Inc 0
-d edd8a091 1000PV [Stingray] 0
-d edd8a099 2000PV [Stingray] 0
-d edd8a0a1 2000MT 0
-d edd8a0a9 2000MI 0
-v f1d0 AJA Video 0
-d f1d0cafe KONA SD SMPTE 259M I/O 0 All boards I have seen have this ID not efac, \
though all docs say efac...
-d f1d0efac KONA SD SMPTE 259M I/O 0
-d f1d0facd KONA HD SMPTE 292M I/O 0
-v fa57 Interagon AS 0
-d fa570001 PMC [Pattern Matching Chip] 0
-v febd Ultraview Corp. 0
-v feda Broadcom Inc (nee Epigram) 0
-d fedaa0fa BCM4210 iLine10 HomePNA 2.0 0
-d fedaa10e BCM4230 iLine10 HomePNA 2.0 0
-v fede Fedetec Inc. 0 IT & Telecom company, develops PCI Trunk cards \
<www.fedetec.es>
-d fede0003 TABIC PCI v3 0
-v fffe VMWare Inc 0
-d fffe0405 Virtual SVGA 4.0 0
-d fffe0710 Virtual SVGA 0
-v ffff Illegal Vendor ID 0
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 src/video_out/libdha/pci.c
--- a/src/video_out/libdha/pci.c Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,834 +0,0 @@
-/*
- (C) 2002 - library implementation by Nick Kyrshev
- XFree86 3.3.3 scanpci.c, modified for GATOS/win/gfxdump by Øyvind Aabling.
- */
-/* $XConsortium: scanpci.c /main/25 1996/10/27 11:48:40 kaleb $ */
-/*
- * name: scanpci.c
- *
- * purpose: This program will scan for and print details of
- * devices on the PCI bus.
-
- * author: Robin Cutshaw (robin@xfree86.org)
- *
- * supported O/S's: SVR4, UnixWare, SCO, Solaris,
- * FreeBSD, NetBSD, 386BSD, BSDI BSD/386,
- * Linux, Mach/386, ISC
- * DOS (WATCOM 9.5 compiler)
- *
- * compiling: [g]cc scanpci.c -o scanpci
- * for SVR4 (not Solaris), UnixWare use:
- * [g]cc -DSVR4 scanpci.c -o scanpci
- * for DOS, watcom 9.5:
- * wcc386p -zq -omaxet -7 -4s -s -w3 -d2 name.c
- * and link with PharLap or other dos extender for exe
- *
- */
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
11:55:40 dawes Exp $ */
-
-/*
- * Copyright 1995 by Robin Cutshaw <robin@XFree86.Org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the names of the above listed copyright holder(s)
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. The above listed
- * copyright holder(s) make(s) no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
- * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#include "libdha.h"
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include "kernelhelper/dhahelper.h"
-
-#ifdef __unix__
-#include <unistd.h>
-#endif
-
-#if 0
-#if defined(__SUNPRO_C) || defined(sun) || defined(__sun)
-#include <sys/psw.h>
-#else
-#include <sys/seg.h>
-#endif
-#include <sys/v86.h>
-#endif
-
-#if defined(Lynx) && defined(__powerpc__)
-/* let's mimick the Linux Alpha stuff for LynxOS so we don't have
- * to change too much code
- */
-#include <smem.h>
-
-static unsigned char *pciConfBase;
-
-static __inline__ unsigned long
-static swapl(unsigned long val)
-{
- unsigned char *p = (unsigned char *)&val;
- return ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | (p[0] << 0));
-}
-
-
-#define BUS(tag) (((tag)>>16)&0xff)
-#define DFN(tag) (((tag)>>8)&0xff)
-
-#define PCIBIOS_DEVICE_NOT_FOUND 0x86
-#define PCIBIOS_SUCCESSFUL 0x00
-
-int pciconfig_read(
- unsigned char bus,
- unsigned char dev,
- unsigned char offset,
- int len, /* unused, alway 4 */
- unsigned long *val)
-{
- unsigned long _val;
- unsigned long *ptr;
-
- dev >>= 3;
- if (bus || dev >= 16) {
- *val = 0xFFFFFFFF;
- return PCIBIOS_DEVICE_NOT_FOUND;
- } else {
- ptr = (unsigned long *)(pciConfBase + ((1<<dev) | offset));
- _val = swapl(*ptr);
- }
- *val = _val;
- return PCIBIOS_SUCCESSFUL;
-}
-
-int pciconfig_write(
- unsigned char bus,
- unsigned char dev,
- unsigned char offset,
- int len, /* unused, alway 4 */
[... 582 lines omitted ...]
-#else
-#warning "ENOTSUP nor EOPNOTSUPP defined!"
-#endif
-#endif
-
-int pci_scan(pciinfo_t *pci_list,unsigned *num_pci)
-{
- int libdha_fd;
- if ( (libdha_fd = open("/dev/dhahelper",O_RDWR)) < 0)
- {
- return __pci_scan(pci_list,num_pci);
- }
- else
- {
- dhahelper_pci_device_t pci_dev;
- unsigned idx;
- idx = 0;
- while(ioctl(libdha_fd, DHAHELPER_PCI_FIND, &pci_dev)==0)
- {
- pci_list[idx].bus = pci_dev.bus;
- pci_list[idx].card = pci_dev.card;
- pci_list[idx].func = pci_dev.func;
- pci_list[idx].vendor = pci_dev.vendor;
- pci_list[idx].device = pci_dev.device;
- pci_list[idx].base0 = pci_dev.base0?pci_dev.base0:0xFFFFFFFF;
- pci_list[idx].base1 = pci_dev.base1?pci_dev.base1:0xFFFFFFFF;
- pci_list[idx].base2 = pci_dev.base2?pci_dev.base2:0xFFFFFFFF;
- pci_list[idx].baserom = pci_dev.baserom?pci_dev.baserom:0x000C0000;
- pci_list[idx].base3 = pci_dev.base3?pci_dev.base3:0xFFFFFFFF;
- pci_list[idx].base4 = pci_dev.base4?pci_dev.base4:0xFFFFFFFF;
- pci_list[idx].base5 = pci_dev.base5?pci_dev.base5:0xFFFFFFFF;
- pci_list[idx].irq = pci_dev.irq;
- pci_list[idx].ipin = pci_dev.ipin;
- pci_list[idx].gnt = pci_dev.gnt;
- pci_list[idx].lat = pci_dev.lat;
- idx++;
- }
- *num_pci=idx;
- close(libdha_fd);
- }
- return 0;
-}
-
-int pci_config_read(unsigned char bus, unsigned char dev, unsigned char func,
- unsigned char cmd, int len, unsigned long *val)
-{
- int ret;
- int dhahelper_fd;
- if ( (dhahelper_fd = open("/dev/dhahelper",O_RDWR)) > 0)
- {
- int retval;
- dhahelper_pci_config_t pcic;
- pcic.operation = PCI_OP_READ;
- pcic.bus = bus;
- pcic.dev = dev;
- pcic.func = func;
- pcic.cmd = cmd;
- pcic.size = len;
- retval = ioctl(dhahelper_fd, DHAHELPER_PCI_CONFIG, &pcic);
- close(dhahelper_fd);
- *val = pcic.ret;
- return retval;
- }
- ret = enable_app_io();
- if (ret != 0)
- return(ret);
- switch(len)
- {
- case 4:
- ret = pci_config_read_long(bus, dev, func, cmd);
- break;
- case 2:
- ret = pci_config_read_word(bus, dev, func, cmd);
- break;
- case 1:
- ret = pci_config_read_byte(bus, dev, func, cmd);
- break;
- default:
- printf("libdha_pci: wrong length to read: %u\n",len);
- }
- disable_app_io();
-
- *val = ret;
- return(0);
-}
-
-int pci_config_write(unsigned char bus, unsigned char dev, unsigned char func,
- unsigned char cmd, int len, unsigned long val)
-{
- int ret;
-
- int dhahelper_fd;
- if ( (dhahelper_fd = open("/dev/dhahelper",O_RDWR)) > 0)
- {
- int retval;
- dhahelper_pci_config_t pcic;
- pcic.operation = PCI_OP_WRITE;
- pcic.bus = bus;
- pcic.dev = dev;
- pcic.func = func;
- pcic.cmd = cmd;
- pcic.size = len;
- pcic.ret = val;
- retval = ioctl(dhahelper_fd, DHAHELPER_PCI_CONFIG, &pcic);
- close(dhahelper_fd);
- return retval;
- }
- ret = enable_app_io();
- if (ret != 0)
- return ret;
- switch(len)
- {
- case 4:
- pci_config_write_long(bus, dev, func, cmd, val);
- break;
- case 2:
- pci_config_write_word(bus, dev, func, cmd, val);
- break;
- case 1:
- pci_config_write_byte(bus, dev, func, cmd, val);
- break;
- default:
- printf("libdha_pci: wrong length to read: %u\n",len);
- }
- disable_app_io();
-
- return 0;
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/pci_db2c.awk
--- a/src/video_out/libdha/pci_db2c.awk Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,267 +0,0 @@
-# This file converts given pci.db to "C" source and header files
-# For latest version of pci ids see: http://pciids.sf.net
-# Copyright 2002 Nick Kurshev
-#
-# Usage: awk -f pci_db2c.awk pci.db
-#
-# Tested with Gawk v 3.0.x and Mawk 1.3.3
-# But it should work with standard Awk implementations (hopefully).
-# (Nobody tested it with Nawk, but it should work, too).
-#
-
-BEGIN {
-
- if(ARGC != 2) {
-# check for arguments:
- print "Usage awk -f pci_db2c.awk pci.db (and make sure pci.db file exists first)";
- exit(1);
- }
- in_file = ARGV[1];
- vendor_file = "pci_vendors.h";
- ids_file = "pci_ids.h"
- name_file = "pci_names.c"
- name_h_file = "pci_names.h"
- dev_ids_file = "pci_dev_ids.c"
- line=0;
-# print out head lines
- print_head(vendor_file);
- print_head(ids_file);
- print_head(name_file);
- print_head(name_h_file);
- print_head(dev_ids_file);
- print "#ifndef PCI_VENDORS_INCLUDED" >vendor_file
- print "#define PCI_VENDORS_INCLUDED 1">vendor_file
- print "" >vendor_file
- print "#ifndef PCI_IDS_INCLUDED" >ids_file
- print "#define PCI_IDS_INCLUDED 1">ids_file
- print "" >ids_file
- print "#include \"pci_vendors.h\"">ids_file
- print "" >ids_file
-
- print "#ifndef PCI_NAMES_INCLUDED" >name_h_file
- print "#define PCI_NAMES_INCLUDED 1">name_h_file
- print "" >name_h_file
- print_name_struct(name_h_file);
- print "#include <stddef.h>">name_file
- print "#include \"pci_names.h\"">name_file
- print "#include \"pci_dev_ids.c\"">name_file
- print "">name_file
- print "static struct vendor_id_s vendor_ids[] = {">name_file
- first_pass=1;
- init_name_db();
- while(getline <in_file)
- {
-# count up lines
- line++;
- n=split($0, field, "[\t]");
- name_field = kill_double_quoting(field[3])
- if(field[1] == "v" && length(field[3])>0 && field[4] == "0")
- {
- init_device_db()
- svend_name = get_short_vendor_name(field[3])
- printf("#define VENDOR_%s\t", svend_name) >vendor_file;
- if(length(svend_name) < 9) printf("\t") >vendor_file;
- printf("0x%s /*%s*/\n",field[2], name_field) >vendor_file;
- printf("{ 0x%s, \"%s\", dev_lst_%s },\n",field[2], name_field, field[2]) \
>name_file;
- printf("/* Vendor: %s: %s */\n", field[2], name_field) > ids_file
- if(first_pass == 1) { first_pass=0; }
- else { print "{ 0xFFFF, NULL }\n};" >dev_ids_file; }
- printf("static const struct device_id_s dev_lst_%s[]={\n", field[2])>dev_ids_file
- }
- if(field[1] == "d" && length(field[3])>0 && field[4] == "0")
- {
- sdev_name = get_short_device_name(field[3])
- full_name = sprintf("#define DEVICE_%s_%s", svend_name, sdev_name);
- printf("%s\t", full_name) >ids_file
- if(length(full_name) < 9) printf("\t") >ids_file;
- if(length(full_name) < 17) printf("\t") >ids_file;
- if(length(full_name) < 25) printf("\t") >ids_file;
- if(length(full_name) < 32) printf("\t") >ids_file;
- if(length(full_name) < 40) printf("\t") >ids_file;
- if(length(full_name) < 48) printf("\t") >ids_file;
- printf("0x%s /*%s*/\n", substr(field[2], 5), name_field) >ids_file
- printf("{ 0x%s, \"%s\" },\n", substr(field[2], 5), name_field) >dev_ids_file
- }
- if(field[1] == "s" && length(field[3])>0 && field[4] == "0")
- {
- subdev_name = get_short_subdevice_name(field[3])
- full_name = sprintf("#define SUBDEVICE_%s_%s", svend_name, subdev_name)
- printf("\t%s\t", full_name) >ids_file
- if(length(full_name) < 9) printf("\t") >ids_file;
- if(length(full_name) < 17) printf("\t") >ids_file;
- if(length(full_name) < 25) printf("\t") >ids_file;
- if(length(full_name) < 32) printf("\t") >ids_file;
- if(length(full_name) < 40) printf("\t") >ids_file;
- printf("0x%s /*%s*/\n", substr(field[2], 9), name_field) >ids_file
- }
- }
- print "Total lines parsed:", line;
- print "">vendor_file
- print "#endif/*PCI_VENDORS_INCLUDED*/">vendor_file
- print "">ids_file
- print "#endif/*PCI_IDS_INCLUDED*/">ids_file
- print "">name_h_file
- print "#endif/*PCI_NAMES_INCLUDED*/">name_h_file
- print "};">name_file
- print "{ 0xFFFF, NULL }" >dev_ids_file;
- print "};">dev_ids_file
- print_func_bodies(name_file);
-}
-
-function print_head( out_file)
-{
- print "/*" >out_file;
- printf(" * File: %s\n", out_file) >out_file;
- printf(" * This file was generated automatically. Don't modify it.\n") \
>out_file;
- print "*/" >out_file;
- return;
-}
-
-function print_name_struct(out_file)
-{
- print "#ifdef __cplusplus" >out_file
- print "extern \"C\" {" >out_file
- print "#endif" >out_file
[... 15 lines omitted ...]
- print "">out_file
- print "#ifdef __cplusplus" >out_file
- print "}" >out_file
- print "#endif" >out_file
- return
-}
-
-function print_func_bodies(out_file)
-{
- print "">out_file
- print "const char *pci_vendor_name(unsigned short id)" >out_file
- print "{" >out_file
- print " unsigned i;" >out_file
- print " for(i=0;i<sizeof(vendor_ids)/sizeof(struct vendor_id_s);i++)">out_file
- print " {" >out_file
- print "\tif(vendor_ids[i].id == id) return vendor_ids[i].name;" >out_file
- print " }" >out_file
- print " return NULL;" >out_file
- print "}">out_file
- print "" >out_file
- print "const char *pci_device_name(unsigned short vendor_id, unsigned short \
device_id)" >out_file
- print "{" >out_file
- print " unsigned i, j;" >out_file
- print " for(i=0;i<sizeof(vendor_ids)/sizeof(struct vendor_id_s);i++)">out_file
- print " {" >out_file
- print "\tif(vendor_ids[i].id == vendor_id)" >out_file
- print "\t{" >out_file
- print "\t j=0;" >out_file
- print "\t while(vendor_ids[i].dev_list[j].id != 0xFFFF)" >out_file
- print "\t {">out_file
- print "\t\tif(vendor_ids[i].dev_list[j].id == device_id) return \
vendor_ids[i].dev_list[j].name;">out_file
- print "\t\tj++;">out_file
- print "\t };">out_file
- print "\t break;" >out_file
- print "\t}" >out_file
- print " }" >out_file
- print " return NULL;">out_file
- print "}">out_file
- return
-}
-
-function kill_double_quoting(fld)
-{
- n=split(fld,phrases, "[\"]");
- new_fld = phrases[1]
- for(i=2;i<=n;i++) new_fld = sprintf("%s\\\"%s", new_fld, phrases[i])
- return new_fld
-}
-
-function init_name_db()
-{
- vendor_names[1]=""
-}
-
-function init_device_db()
-{
-# delete device_names
- for( i in device_names ) delete device_names[i];
- device_names[1]=""
-# delete subdevice_names
- for( i in subdevice_names ) delete subdevice_names[i];
- subdevice_names[1] = ""
-}
-
-function get_short_vendor_name(from)
-{
- n=split(from, name, "[ ]");
- new_name = toupper(name[1]);
- if(length(new_name)<3) new_name = sprintf("%s_%s", new_name, toupper(name[2]));
- n=split(new_name, name, "[^0-9A-Za-z]");
- svendor = name[1];
- for(i=2;i<=n;i++) svendor=sprintf("%s%s%s", svendor, length(name[i])?"_":"", \
name[i]);
- new_name = svendor;
- vend_suffix = 2;
-# check for unique
- while(new_name in vendor_names)
- {
- new_name = sprintf("%s%u", svendor, vend_suffix)
- vend_suffix = vend_suffix + 1;
- }
-# Add new name in array of vendor's names
- vendor_names[new_name] = new_name
- return new_name;
-}
-
-function get_short_device_name(from_name)
-{
- n=split(from_name, name, "[ ]");
- new_name = toupper(name[1]);
- if(length(name[2])) new_name = sprintf("%s_%s", new_name, toupper(name[2]));
- if(length(name[3])) new_name = sprintf("%s_%s", new_name, toupper(name[3]));
- n=split(new_name, name, "[^0-9A-Za-z]");
- sdevice = name[1];
- for(i=2;i<=n;i++) sdevice=sprintf("%s%s%s", sdevice, length(name[i])?"_":"", \
name[i]);
- new_name = sdevice;
- dev_suffix = 2;
-# check for unique
- while(new_name in device_names)
- {
- new_name = sprintf("%s%u", sdevice, dev_suffix)
- dev_suffix = dev_suffix + 1;
- }
-# Add new name in array of device names
- device_names[new_name] = new_name
- return new_name;
-}
-
-function get_short_subdevice_name(from_name)
-{
- n=split(from_name, name, "[ ]");
- new_name = toupper(name[1]);
- if(length(name[2])) new_name = sprintf("%s_%s", new_name, toupper(name[2]));
- if(length(name[3])) new_name = sprintf("%s_%s", new_name, toupper(name[3]));
- n=split(new_name, name, "[^0-9A-Za-z]");
- ssdevice = name[1];
- for(i=2;i<=n;i++) ssdevice=sprintf("%s%s%s", ssdevice, length(name[i])?"_":"", \
name[i]);
- new_name = ssdevice;
- sdev_suffix = 2;
-# check for unique
- while(new_name in subdevice_names)
- {
- new_name = sprintf("%s%u", ssdevice, sdev_suffix)
- sdev_suffix = sdev_suffix + 1;
- }
-# Add new name in array of subdevice names
- subdevice_names[new_name] = new_name
- return new_name;
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 src/video_out/libdha/ports.c
--- a/src/video_out/libdha/ports.c Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,219 +0,0 @@
-/*
- (C) 2002 - library implementation by Nick Kyrshev
- XFree86 3.3.3 scanpci.c, modified for GATOS/win/gfxdump by Øyvind Aabling.
- */
-/* $XConsortium: scanpci.c /main/25 1996/10/27 11:48:40 kaleb $ */
-/*
- * name: scanpci.c
- *
- * purpose: This program will scan for and print details of
- * devices on the PCI bus.
-
- * author: Robin Cutshaw (robin@xfree86.org)
- *
- * supported O/S's: SVR4, UnixWare, SCO, Solaris,
- * FreeBSD, NetBSD, 386BSD, BSDI BSD/386,
- * Linux, Mach/386, ISC
- * DOS (WATCOM 9.5 compiler)
- *
- * compiling: [g]cc scanpci.c -o scanpci
- * for SVR4 (not Solaris), UnixWare use:
- * [g]cc -DSVR4 scanpci.c -o scanpci
- * for DOS, watcom 9.5:
- * wcc386p -zq -omaxet -7 -4s -s -w3 -d2 name.c
- * and link with PharLap or other dos extender for exe
- *
- */
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
11:55:40 dawes Exp $ */
-
-/*
- * Copyright 1995 by Robin Cutshaw <robin@XFree86.Org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the names of the above listed copyright holder(s)
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. The above listed
- * copyright holder(s) make(s) no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
- * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
- * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-#include <sys/ioctl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#ifdef ARCH_ALPHA
-#include <sys/io.h>
-#endif
-#include <unistd.h>
-
-#include "libdha.h"
-#include "AsmMacros.h"
-#include "kernelhelper/dhahelper.h"
-
-/* OS depended stuff */
-#if defined (linux)
-#include "sysdep/pci_linux.c"
-#elif defined (__FreeBSD__)
-#include "sysdep/pci_freebsd.c"
-#elif defined (__386BSD__)
-#include "sysdep/pci_386bsd.c"
-#elif defined (__NetBSD__)
-#include "sysdep/pci_netbsd.c"
-#elif defined (__OpenBSD__)
-#include "sysdep/pci_openbsd.c"
-#elif defined (__bsdi__)
-#include "sysdep/pci_bsdi.c"
-#elif defined (Lynx)
-#include "sysdep/pci_lynx.c"
-#elif defined (MACH386)
-#include "sysdep/pci_mach386.c"
-#elif defined (__SVR4)
-#if !defined(SVR4)
-#define SVR4
-#endif
-#include "sysdep/pci_svr4.c"
-#elif defined (SCO)
-#include "sysdep/pci_sco.c"
-#elif defined (ISC)
-#include "sysdep/pci_isc.c"
-#elif defined (__EMX__)
-#include "sysdep/pci_os2.c"
-#elif defined (_WIN32) || defined(__CYGWIN__)
-#include "sysdep/pci_win32.c"
-#else
-#include "sysdep/pci_generic_os.c"
-#endif
-
-static int dhahelper_fd=-1;
-static unsigned dhahelper_counter=0;
-int enable_app_io( void )
-{
- if((dhahelper_fd=open("/dev/dhahelper",O_RDWR)) < 0) return enable_os_io();
- dhahelper_counter++;
- return 0;
-}
-
-int disable_app_io( void )
-{
- dhahelper_counter--;
- if(dhahelper_fd > 0)
- {
- if(!dhahelper_counter)
- {
- close(dhahelper_fd);
- dhahelper_fd = -1;
- }
- }
- else return disable_os_io();
- return 0;
-}
-
-unsigned char INPORT8(unsigned idx)
-{
- if (dhahelper_fd > 0)
- {
- dhahelper_port_t _port;
-
- _port.operation = PORT_OP_READ;
- _port.addr = idx;
- _port.size = 1;
- if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0)
- return _port.value;
- }
- return inb(idx);
-}
-
-unsigned short INPORT16(unsigned idx)
-{
- if (dhahelper_fd > 0)
- {
- dhahelper_port_t _port;
-
- _port.operation = PORT_OP_READ;
- _port.addr = idx;
- _port.size = 2;
- if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0)
- return _port.value;
- }
- return inw(idx);
-}
-
-unsigned INPORT32(unsigned idx)
-{
- if (dhahelper_fd > 0)
- {
- dhahelper_port_t _port;
-
- _port.operation = PORT_OP_READ;
- _port.addr = idx;
- _port.size = 4;
- if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0)
- return _port.value;
- }
- return inl(idx);
-}
-
-void OUTPORT8(unsigned idx,unsigned char val)
-{
- if (dhahelper_fd > 0)
- {
- dhahelper_port_t _port;
-
- _port.operation = PORT_OP_WRITE;
- _port.addr = idx;
- _port.size = 1;
- _port.value = val;
- if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0)
- return;
- }
- else outb(idx,val);
-}
-
-void OUTPORT16(unsigned idx,unsigned short val)
-{
- if (dhahelper_fd > 0)
- {
- dhahelper_port_t _port;
-
- _port.operation = PORT_OP_WRITE;
- _port.addr = idx;
- _port.size = 2;
- _port.value = val;
- if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0)
- return;
- }
- else outw(idx,val);
-}
-
-void OUTPORT32(unsigned idx,unsigned val)
-{
- if (dhahelper_fd > 0)
- {
- dhahelper_port_t _port;
-
- _port.operation = PORT_OP_WRITE;
- _port.addr = idx;
- _port.size = 4;
- _port.value = val;
- if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0)
- return;
- }
- else outl(idx,val);
-}
-
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/sysdep/AsmMacros_alpha.h
--- a/src/video_out/libdha/sysdep/AsmMacros_alpha.h Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- This file is based on:
- $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 \
2001/11/16 21:13:34 tsi Exp $
- Modified for readability by Nick Kurshev
-*/
-
-#ifndef __ASM_MACROS_ALPHA_H
-#define __ASM_MACROS_ALPHA_H
-#if defined (linux)
-#include <sys/io.h>
-#elif defined (__FreeBSD__)
-#include <sys/types.h>
-extern void outb(u_int32_t port, u_int8_t val);
-extern void outw(u_int32_t port, u_int16_t val);
-extern void outl(u_int32_t port, u_int32_t val);
-extern u_int8_t inb(u_int32_t port);
-extern u_int16_t inw(u_int32_t port);
-extern u_int32_t inl(u_int32_t port);
-#else
-#include "sysdep/AsmMacros_generic.h"
-#endif
-
-#define intr_disable()
-#define intr_enable()
-
-#endif
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/sysdep/AsmMacros_arm32.h
--- a/src/video_out/libdha/sysdep/AsmMacros_arm32.h Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- This file is based on:
- $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 \
2001/11/16 21:13:34 tsi Exp $
- Modified for readability by Nick Kurshev
-*/
-
-#ifndef __ASM_MACROS_ARM32_H
-#define __ASM_MACROS_ARM32_H
-unsigned int IOPortBase; /* Memory mapped I/O port area */
-
-static __inline__ void outb(short port,char val)
-{
- if ((unsigned short)port >= 0x400) return;
- *(volatile unsigned char*)(((unsigned short)(port))+IOPortBase) = val;
-}
-
-static __inline__ void outw(short port,short val)
-{
- if ((unsigned short)port >= 0x400) return;
- *(volatile unsigned short*)(((unsigned short)(port))+IOPortBase) = val;
-}
-
-static __inline__ void outl(short port,int val)
-{
- if ((unsigned short)port >= 0x400) return;
- *(volatile unsigned long*)(((unsigned short)(port))+IOPortBase) = val;
-}
-
-static __inline__ unsigned int inb(short port)
-{
- if ((unsigned short)port >= 0x400) return((unsigned int)-1);
- return(*(volatile unsigned char*)(((unsigned short)(port))+IOPortBase));
-}
-
-static __inline__ unsigned int inw(short port)
-{
- if ((unsigned short)port >= 0x400) return((unsigned int)-1);
- return(*(volatile unsigned short*)(((unsigned short)(port))+IOPortBase));
-}
-
-static __inline__ unsigned int inl(short port)
-{
- if ((unsigned short)port >= 0x400) return((unsigned int)-1);
- return(*(volatile unsigned long*)(((unsigned short)(port))+IOPortBase));
-}
-
-#define intr_disable()
-#define intr_enable()
-
-#endif
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/sysdep/AsmMacros_generic.h
--- a/src/video_out/libdha/sysdep/AsmMacros_generic.h Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- Generic stuff to compile VIDIX only on any system (SCRATCH)
-*/
-
-#ifndef __ASM_MACROS_GENERIC_H
-#define __ASM_MACROS_GENERIC_H
-
-#warning This stuff is not ported on your system
-
-static __inline__ void outb(short port,char val)
-{
- printf("outb: generic function call\n");
- return;
-}
-
-static __inline__ void outw(short port,short val)
-{
- printf("outw: generic function call\n");
- return;
-}
-
-static __inline__ void outl(short port,unsigned int val)
-{
- printf("outl: generic function call\n");
- return;
-}
-
-static __inline__ unsigned int inb(short port)
-{
- printf("inb: generic function call\n");
- return 0;
-}
-
-static __inline__ unsigned int inw(short port)
-{
- printf("inw: generic function call\n");
- return 0;
-}
-
-static __inline__ unsigned int inl(short port)
-{
- printf("inl: generic function call\n");
- return 0;
-}
-
-static __inline__ void intr_disable()
-{
- printf("intr_disable: generic function call\n");
-}
-
-static __inline__ void intr_enable()
-{
- printf("intr_enable: generic function call\n");
-}
-
-#endif
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/sysdep/AsmMacros_ia64.h
--- a/src/video_out/libdha/sysdep/AsmMacros_ia64.h Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-/*
- This file is based on:
- $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 \
2001/11/16 21:13:34 tsi Exp $
- Modified for readability by Nick Kurshev
-*/
-
-#ifndef __ASM_MACROS_IA64_H
-#define __ASM_MACROS_IA64_H
-
-#if defined(linux)
-#include <sys/io.h>
-#else
-#include "sysdep/AsmMacros_generic.h"
-#endif
-
-#endif
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/sysdep/AsmMacros_powerpc.h
--- a/src/video_out/libdha/sysdep/AsmMacros_powerpc.h Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- This file is based on:
- $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 \
2001/11/16 21:13:34 tsi Exp $
- Modified for readability by Nick Kurshev
-*/
-
-#ifndef __ASM_MACROS_POWERPC_H
-#define __ASM_MACROS_POWERPC_H
-
-#if defined(Lynx) || defined(__OpenBSD__)
-
-extern unsigned char *ioBase;
-
-static __inline__ volatile void eieio()
-{
- __asm__ __volatile__ ("eieio");
-}
-
-static __inline__ void outb(short port, unsigned char value)
-{
- *(unsigned char *)(ioBase + port) = value; eieio();
-}
-
-static __inline__ void outw(short port, unsigned short value)
-{
- *(unsigned short *)(ioBase + port) = value; eieio();
-}
-
-static __inline__ void outl(short port, unsigned short value)
-{
- *(unsigned long *)(ioBase + port) = value; eieio();
-}
-
-static __inline__ unsigned char inb(short port)
-{
- unsigned char val;
- val = *((unsigned char *)(ioBase + port)); eieio();
- return(val);
-}
-
-static __inline__ unsigned short inw(short port)
-{
- unsigned short val;
- val = *((unsigned short *)(ioBase + port)); eieio();
- return(val);
-}
-
-static __inline__ unsigned long inl(short port)
-{
- unsigned long val;
- val = *((unsigned long *)(ioBase + port)); eieio();
- return(val);
-}
-
-#define intr_disable()
-#define intr_enable()
-
-#else
- #ifdef linux
- /*nothing*/
- #else
- #include "sysdep/AsmMacros_generic.h"
- #endif
-#endif
-
-#endif
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/sysdep/AsmMacros_sparc.h
--- a/src/video_out/libdha/sysdep/AsmMacros_sparc.h Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- This file is based on:
- $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 \
2001/11/16 21:13:34 tsi Exp $
- Modified for readability by Nick Kurshev
-*/
-
-#ifndef __ASM_MACROS_SPARC_H
-#define __ASM_MACROS_SPARC_H
-
-#ifndef ASI_PL
-#define ASI_PL 0x88
-#endif
-
-static __inline__ void outb(unsigned long port, char val)
-{
- __asm__ __volatile__("stba %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL));
-}
-
-static __inline__ void outw(unsigned long port, char val)
-{
- __asm__ __volatile__("stha %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL));
-}
-
-static __inline__ void outl(unsigned long port, char val)
-{
- __asm__ __volatile__("sta %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL));
-}
-
-static __inline__ unsigned int inb(unsigned long port)
-{
- unsigned char ret;
- __asm__ __volatile__("lduba [%1] %2, %0" : "=r" (ret) : "r" (port), "i" \
(ASI_PL));
- return ret;
-}
-
-static __inline__ unsigned int inw(unsigned long port)
-{
- unsigned char ret;
- __asm__ __volatile__("lduha [%1] %2, %0" : "=r" (ret) : "r" (port), "i" \
(ASI_PL));
- return ret;
-}
-
-static __inline__ unsigned int inl(unsigned long port)
-{
- unsigned char ret;
- __asm__ __volatile__("lda [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL));
- return ret;
-}
-
-#define intr_disable()
-#define intr_enable()
-
-#endif
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/sysdep/AsmMacros_x86.h
--- a/src/video_out/libdha/sysdep/AsmMacros_x86.h Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
- This file is based on:
- $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 \
2001/11/16 21:13:34 tsi Exp $
- Modified for readability by Nick Kurshev
-*/
-
-#ifndef __ASM_MACROS_X86_H
-#define __ASM_MACROS_X86_H
-
-#if defined (WINNT)
-#include "sysdep/AsmMacros_generic.h"
-#else
-
-#include "config.h"
-
-static __inline__ void outb(short port,char val)
-{
- __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port));
- return;
-}
-
-static __inline__ void outw(short port,short val)
-{
- __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port));
- return;
-}
-
-static __inline__ void outl(short port,unsigned int val)
-{
- __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port));
- return;
-}
-
-static __inline__ unsigned int inb(short port)
-{
- unsigned char ret;
- __asm__ __volatile__("inb %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
-}
-
-static __inline__ unsigned int inw(short port)
-{
- unsigned short ret;
- __asm__ __volatile__("inw %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
-}
-
-static __inline__ unsigned int inl(short port)
-{
- unsigned int ret;
- __asm__ __volatile__("inl %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
-}
-
-static __inline__ void intr_disable()
-{
- __asm__ __volatile__("cli");
-}
-
-static __inline__ void intr_enable()
-{
- __asm__ __volatile__("sti");
-}
-
-#endif
-#endif
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/sysdep/Makefile.am
--- a/src/video_out/libdha/sysdep/Makefile.am Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-include $(top_srcdir)/misc/Makefile.common
-
-EXTRA_DIST = \
- libdha_os2.c \
- libdha_win32.c \
- pci_386bsd.c \
- pci_alpha.c \
- pci_arm32.c \
- pci_bsdi.c \
- pci_freebsd.c \
- pci_generic_cpu.c \
- pci_generic_os.c \
- pci_ia64.c \
- pci_isc.c \
- pci_linux.c \
- pci_lynx.c \
- pci_mach386.c \
- pci_netbsd.c \
- pci_openbsd.c \
- pci_os2.c \
- pci_powerpc.c \
- pci_sco.c \
- pci_sparc.c \
- pci_svr4.c \
- pci_win32.c \
- pci_x86.c
-
-noinst_HEADERS = \
- AsmMacros_alpha.h \
- AsmMacros_arm32.h \
- AsmMacros_generic.h \
- AsmMacros_ia64.h \
- AsmMacros_powerpc.h \
- AsmMacros_sparc.h \
- AsmMacros_x86.h
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
src/video_out/libdha/sysdep/libdha_os2.c
--- a/src/video_out/libdha/sysdep/libdha_os2.c Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/os2_video.c,v 3.14 \
2000/10/28 01:42:28 mvojkovi Exp $ */
-/* Modified for libdha by Nick Kurshev. */
-/*
- * (c) Copyright 1994,1999 by Holger Veit
- * <Holger.Veit@gmd.de>
- * Modified 1996 by Sebastien Marineau <marineau@genie.uottawa.ca>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * HOLGER VEIT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Holger Veit shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Holger Veit.
- *
- */
-/* $XConsortium: os2_video.c /main/8 1996/10/27 11:49:02 kaleb $ */
-
-#define INCL_DOSFILEMGR
-#include "os2.h"
-
-/***************************************************************************/
-/* Video Memory Mapping helper functions */
-/***************************************************************************/
-
-/* This section uses the xf86sup.sys driver developed for xfree86.
- * The driver allows mapping of physical memory
- * You must install it with a line DEVICE=path\xf86sup.sys in config.sys.
- */
-
-static HFILE mapdev = -1;
-static ULONG stored_virt_addr;
-static char* mappath = "\\DEV\\PMAP$";
-static HFILE open_mmap()
-{
- APIRET rc;
- ULONG action;
-
- if (mapdev != -1)
- return mapdev;
-
- rc = DosOpen((PSZ)mappath, (PHFILE)&mapdev, (PULONG)&action,
- (ULONG)0, FILE_SYSTEM, FILE_OPEN,
- OPEN_SHARE_DENYNONE|OPEN_FLAGS_NOINHERIT|OPEN_ACCESS_READONLY,
- (ULONG)0);
- if (rc!=0)
- mapdev = -1;
- return mapdev;
-}
-
-static void close_mmap()
-{
- if (mapdev != -1)
- DosClose(mapdev);
- mapdev = -1;
-}
-
-/* this structure is used as a parameter packet for the direct access
- * ioctl of pmap$
- */
-
-/* Changed here for structure of driver PMAP$ */
-
-typedef struct{
- ULONG addr;
- ULONG size;
-} DIOParPkt;
-
-/* This is the data packet for the mapping function */
-
-typedef struct {
- ULONG addr;
- USHORT sel;
-} DIODtaPkt;
-
-/***************************************************************************/
-/* Video Memory Mapping section */
-/***************************************************************************/
-
-static long callcount = 0L;
-
-/* ARGSUSED */
-void * map_phys_mem(unsigned long base, unsigned long size)
-{
- DIOParPkt par;
- ULONG plen;
- DIODtaPkt dta;
- ULONG dlen;
- static BOOL ErrRedir = FALSE;
- APIRET rc;
-
- par.addr = (ULONG)base;
- par.size = (ULONG)size;
- plen = sizeof(par);
- dlen = sizeof(dta);
-
- open_mmap();
- if (mapdev == -1)
- {
- perror("libdha: device xf86sup.sys is not installed");
- exit(1);
- }
- if ((rc=DosDevIOCtl(mapdev, (ULONG)0x76, (ULONG)0x44,
- (PVOID)&par, (ULONG)plen, (PULONG)&plen,
- (PVOID)&dta, (ULONG)dlen, (PULONG)&dlen)) == 0) {
- if (dlen==sizeof(dta)) {
- callcount++;
- return (void *)dta.addr;
- }
- /*else fail*/
- }
- return (void *)-1;
-}
-
-/* ARGSUSED */
-void unmap_phys_mem(void * base, unsigned long size)
-{
- DIOParPkt par;
- ULONG plen,vmaddr;
-
-/* We need here the VIRTADDR for unmapping, not the physical address */
-/* This should be taken care of either here by keeping track of allocated */
-/* pointers, but this is also already done in the driver... Thus it would */
-/* be a waste to do this tracking twice. Can this be changed when the fn. */
-/* is called? This would require tracking this function in all servers, */
-/* and changing it appropriately to call this with the virtual adress */
-/* If the above mapping function is only called once, then we can store */
-/* the virtual adress and use it here.... */
-
- par.addr = (ULONG)base;
- par.size = 0xffffffff; /* This is the virtual address parameter. Set this to ignore \
*/
- plen = sizeof(par);
-
- if (mapdev != -1)
- {
- DosDevIOCtl(mapdev, (ULONG)0x76, (ULONG)0x46,
- (PVOID)&par, (ULONG)plen, (PULONG)&plen,
- &vmaddr, sizeof(ULONG), &plen);
- callcount--;
- }
-/* Now if more than one region has been allocated and we close the driver,
- * the other pointers will immediately become invalid. We avoid closing
- * driver for now, but this should be fixed for server exit
- */
-
- if(!callcount) close_mmap();
-}
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Xine-cvslog mailing list
Xine-cvslog@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xine-cvslog
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic