changeset 3995:0d9de811e312

minor interface changing
author nick
date Sat, 05 Jan 2002 18:16:19 +0000
parents 80c88056563d
children 872781fef1b3
files libdha/libdha.c libdha/libdha.h vidix/vidix.h vidix/vidixlib.c vidix/vidixlib.h
diffstat 5 files changed, 39 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/libdha/libdha.c	Sat Jan 05 13:57:49 2002 +0000
+++ b/libdha/libdha.c	Sat Jan 05 18:16:19 2002 +0000
@@ -117,32 +117,32 @@
 }
 #endif
 
-unsigned char  INREG8(unsigned idx)
+unsigned char  INPORT8(unsigned idx)
 {
   return inb(idx);
 }
 
-unsigned short INREG16(unsigned idx)
+unsigned short INPORT16(unsigned idx)
 {
   return inw(idx);
 }
 
-unsigned       INREG32(unsigned idx)
+unsigned       INPORT32(unsigned idx)
 {
   return inl(idx);
 }
 
-void          OUTREG8(unsigned idx,unsigned char val)
+void          OUTPORT8(unsigned idx,unsigned char val)
 {
   outb(idx,val);
 }
 
-void          OUTREG16(unsigned idx,unsigned short val)
+void          OUTPORT16(unsigned idx,unsigned short val)
 {
   outw(idx,val);
 }
 
-void          OUTREG32(unsigned idx,unsigned val)
+void          OUTPORT32(unsigned idx,unsigned val)
 {
   outl(idx,val);
 }
--- a/libdha/libdha.h	Sat Jan 05 13:57:49 2002 +0000
+++ b/libdha/libdha.h	Sat Jan 05 18:16:19 2002 +0000
@@ -38,14 +38,14 @@
 
 
 
-extern unsigned char  INREG8(unsigned idx);
-extern unsigned short INREG16(unsigned idx);
-extern unsigned       INREG32(unsigned idx);
-#define INREG(idx) INREG32(idx)
-extern void          OUTREG8(unsigned idx,unsigned char val);
-extern void          OUTREG16(unsigned idx,unsigned short val);
-extern void          OUTREG32(unsigned idx,unsigned val);
-#define OUTREG(idx,val) OUTREG32(idx,val)
+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 base, unsigned size);
 extern void    unmap_phys_mem(void *ptr, unsigned size);
--- a/vidix/vidix.h	Sat Jan 05 13:57:49 2002 +0000
+++ b/vidix/vidix.h	Sat Jan 05 18:16:19 2002 +0000
@@ -26,7 +26,7 @@
 extern unsigned vixGetVersion( void );
 
 			/* Probes video hw. Returns 0 if ok else errno */
-extern int	vixProbe( void );
+extern int	vixProbe( int verbose );
 			/* Initializes driver. Returns 0 if ok else errno */
 extern int	vixInit( void );
 			/* Destroys driver */
@@ -144,23 +144,17 @@
 #define KEYS_OR		2
 #define KEYS_XOR	3
 	unsigned	key_op;		/* app -> driver: keys operations */
-}vidix_playback_t;
-
-			/* Returns 0 if ok else errno */
-extern int	vixConfigPlayback(const vidix_playback_t *);
-
-typedef struct vidix_dga_s
-{
+	/* memory model */
 	unsigned	frame_size;		/* app -> driver */
 	unsigned	num_frames;		/* app -> driver; after call: driver -> app */
 #define LVO_MAXFRAMES 32
 	unsigned	offsets[LVO_MAXFRAMES];	/* driver -> app */
 	vidix_yuv_t	offset;			/* driver -> app: relative offsets within frame for yuv planes */
 	void*		dga_addr;		/* driver -> app: linear address */
-}vidix_dga_t;
+}vidix_playback_t;
 
 			/* Returns 0 if ok else errno */
-extern int	vixMapPlayback(vidix_dga_t *);
+extern int	vixConfigPlayback(vidix_playback_t *);
 
 			/* Returns 0 if ok else errno */
 extern int 	vixPlaybackOn( void );
--- a/vidix/vidixlib.c	Sat Jan 05 13:57:49 2002 +0000
+++ b/vidix/vidixlib.c	Sat Jan 05 18:16:19 2002 +0000
@@ -32,8 +32,7 @@
 	void *  handle;
 	int	(*get_caps)(vidix_capability_t *);
 	int	(*query_fourcc)(vidix_fourcc_t *);
-	int	(*config_playback)(const vidix_playback_t *);
-	int	(*map_playback)(vidix_dga_t *);
+	int	(*config_playback)(vidix_playback_t *);
 	int 	(*playback_on)( void );
 	int 	(*playback_off)( void );
         /* Functions below can be missed in driver ;) */
@@ -59,7 +58,6 @@
   t_vdl(stream)->get_caps	= dlsym(t_vdl(stream)->handle,"vixGetCapability");
   t_vdl(stream)->query_fourcc	= dlsym(t_vdl(stream)->handle,"vixQueryFourcc");
   t_vdl(stream)->config_playback= dlsym(t_vdl(stream)->handle,"vixConfigPlayback");
-  t_vdl(stream)->map_playback	= dlsym(t_vdl(stream)->handle,"vixMapPlayback");
   t_vdl(stream)->playback_on	= dlsym(t_vdl(stream)->handle,"vixPlaybackOn");
   t_vdl(stream)->playback_off	= dlsym(t_vdl(stream)->handle,"vixPlaybackOff");
   t_vdl(stream)->frame_sel	= dlsym(t_vdl(stream)->handle,"vixPlaybackFrameSelect");
@@ -67,18 +65,19 @@
   t_vdl(stream)->set_eq	= dlsym(t_vdl(stream)->handle,"vixPlaybackSetEq");
   t_vdl(stream)->copy_frame	= dlsym(t_vdl(stream)->handle,"vixPlaybackCopyFrame");
   /* check driver viability */
-  if(!( t_vdl(stream)->get_caps && t_vdl(stream)->query_fourcc && t_vdl(stream)->config_playback &&
-	t_vdl(stream)->map_playback && t_vdl(stream)->playback_on && t_vdl(stream)->playback_off))
+  if(!( t_vdl(stream)->get_caps && t_vdl(stream)->query_fourcc &&
+	t_vdl(stream)->config_playback && t_vdl(stream)->playback_on &&
+	t_vdl(stream)->playback_off))
 			return 0;
   return 1;
 }
 
-static int vdl_probe_driver(VDL_HANDLE stream,const char *path,const char *name,unsigned cap)
+static int vdl_probe_driver(VDL_HANDLE stream,const char *path,const char *name,unsigned cap,int verbose)
 {
   char drv_name[FILENAME_MAX];
   vidix_capability_t vid_cap;
   unsigned (*_ver)(void);
-  int      (*_probe)(void);
+  int      (*_probe)(int);
   int      (*_cap)(vidix_capability_t*);
   strcpy(drv_name,path);
   strcat(drv_name,name);
@@ -88,7 +87,7 @@
   _cap = dlsym(t_vdl(stream)->handle,"vixGetCapability");
   if(_ver) { if((*_ver)() != VIDIX_VERSION) { err: dlclose(t_vdl(stream)->handle); t_vdl(stream)->handle = 0; return 0; } }
   else goto err;
-  if(_probe) { if((*_probe)() != 0) goto err; }
+  if(_probe) { if((*_probe)(verbose) != 0) goto err; }
   else goto err;
   if(_cap) { if((*_cap)(&vid_cap) != 0) goto err; }
   else goto err;
@@ -96,7 +95,7 @@
   return 1;
 }
 
-static int vdl_find_driver(VDL_HANDLE stream,const char *path,unsigned cap)
+static int vdl_find_driver(VDL_HANDLE stream,const char *path,unsigned cap,int verbose)
 {
   DIR *dstream;
   struct dirent *name;
@@ -105,14 +104,14 @@
   while(!done)
   {
     name = readdir(dstream);
-    if(name) { if(vdl_probe_driver(stream,path,name->d_name,cap)) break; }
+    if(name) { if(vdl_probe_driver(stream,path,name->d_name,cap,verbose)) break; }
     else done = 1;
   }
   closedir(dstream);
   return done?0:1;
 }
 
-VDL_HANDLE vdlOpen(const char *path,const char *name,unsigned cap)
+VDL_HANDLE vdlOpen(const char *path,const char *name,unsigned cap,int verbose)
 {
   vdl_stream_t *stream;
   char drv_name[FILENAME_MAX];
@@ -121,6 +120,7 @@
   if(name)
   {
     unsigned (*ver)(void);
+    int (*probe)(int);
     unsigned version = 0;
     strcpy(drv_name,path);
     strcat(drv_name,name);
@@ -138,13 +138,16 @@
       if(t_vdl(stream)->handle) dlclose(t_vdl(stream)->handle);
       goto err;
     }
+    probe = dlsym(t_vdl(stream)->handle,"vixProbe");
+    if(probe) { if((*probe)(verbose)!=0) goto drv_err; }
+    else goto drv_err;
     fill:
     if(!vdl_fill_driver(stream)) goto drv_err;
   }
   else
-    if(vdl_find_driver(stream,path,cap))	goto fill;
-    else					goto err;
-  if(t_vdl(stream)->init) t_vdl(stream)->init();
+    if(vdl_find_driver(stream,path,cap,verbose))	goto fill;
+    else						goto err;
+  if(t_vdl(stream)->init) if(t_vdl(stream)->init())	goto drv_err;
   return stream;
 }
 
@@ -166,16 +169,11 @@
   return t_vdl(handle)->query_fourcc(f);
 }
 
-int  vdlConfigPlayback(VDL_HANDLE handle,const vidix_playback_t *p)
+int  vdlConfigPlayback(VDL_HANDLE handle,vidix_playback_t *p)
 {
   return t_vdl(handle)->config_playback(p);
 }
 
-int  vdlMapPlayback(VDL_HANDLE handle,vidix_dga_t *m)
-{
-  return t_vdl(handle)->map_playback(m);
-}
-
 int  vdlPlaybackOn(VDL_HANDLE handle)
 {
   return t_vdl(handle)->playback_on();
--- a/vidix/vidixlib.h	Sat Jan 05 13:57:49 2002 +0000
+++ b/vidix/vidixlib.h	Sat Jan 05 18:16:19 2002 +0000
@@ -35,9 +35,10 @@
 			   path - specifies path where drivers are located.
 			   name - specifies prefered driver name (can be NULL).
 			   cap  - specifies driver capability (TYPE_* constants).
+			   verbose - specifies verbose level
 			   returns !0 if ok else NULL.
 			   */
-extern VDL_HANDLE vdlOpen(const char *path,const char *name,unsigned cap);
+extern VDL_HANDLE vdlOpen(const char *path,const char *name,unsigned cap,int verbose);
 			/* Closes stream and corresponded driver. */
 extern void	  vdlClose(VDL_HANDLE stream);
 
@@ -48,10 +49,7 @@
 extern int	  vdlQueryFourcc(VDL_HANDLE,vidix_fourcc_t *);
 
 			/* Returns 0 if ok else errno */
-extern int	  vdlConfigPlayback(VDL_HANDLE,const vidix_playback_t *);
-
-			/* Returns 0 if ok else errno */
-extern int	  vdlMapPlayback(VDL_HANDLE,vidix_dga_t *);
+extern int	  vdlConfigPlayback(VDL_HANDLE, vidix_playback_t *);
 
 			/* Returns 0 if ok else errno */
 extern int 	  vdlPlaybackOn(VDL_HANDLE);