home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / videotlk.zip / SAMPLES / DIAG / DIAG.C < prev    next >
Text File  |  1999-05-18  |  6KB  |  161 lines

  1. #include    <stdio.h>
  2. #include    <stdlib.h>
  3. #include    <string.h>
  4. #include    <vcadd.h>
  5. #include    <vcai.h>
  6. #include    "oem.h"
  7.  
  8. static unsigned char *copyright =
  9.           "TV Diagnostic for Hauppauge Video Capture Hardware\n"
  10.           "%s Copyright (c) Abbotsbury Software Ltd. UK 1995-99\n";
  11. static unsigned char *vers = "Version 3.1";
  12.  
  13. static char *Drvr_name;
  14. static USHORT Connect;
  15. main(int argc, char *argv[], char *envp[])
  16. {
  17. unsigned short arr[10], version;
  18. VCADEVINFO      dev_info;
  19. PVCADEVINFO     info = &dev_info;
  20. unsigned long   region, channel, freq, fine, input, colours;
  21. ULONG           temp, temp1, temp2, temp3, model;
  22. USHORT          x, lv, rv, lb, rb, lt, rt, m;
  23. OEM             oem;
  24.  
  25.     if (argc > 2)
  26.     {
  27.         Connect = atoi (argv[2]);
  28.         Drvr_name = argv[1];
  29.     }
  30.     else
  31.     {
  32.         printf ("This program requires 2 parameters :\n");
  33.         printf ("  The name of the driver\n");
  34.         printf ("  The driver connection number\n");
  35.         printf ("   I.E. diag celeb 2\n");
  36.         exit (1);
  37.     }
  38.  
  39.     printf (copyright, vers);
  40. /*
  41.     DosGetVersion (&version);
  42.     printf ("OS/2 Version %d.%d", (version >> 8)/10, version & 0xff);
  43.     DosGetDateTime (&dt);
  44.     printf (" Date %d/%d/%d\n", dt.day, dt.month, dt.year);
  45. */
  46.     oem_info (&oem);
  47.     printf ("Video Controller Oem %s\n", oem.oem_name);
  48.     printf ("Video Controller Adaptor %s\n", oem.oem_hw);
  49.     printf ("Video Controller RAM = 0x%lx\n", oem.oem_ram);
  50.  
  51.     if (VcaiDeviceOpen (Drvr_name, Connect) == FALSE)
  52.     {
  53.         printf ("Cannot open device %s %d$\n", Drvr_name, Connect);
  54.         exit (1);
  55.     }
  56.  
  57.     version = VcaiDllVersionQuery ();
  58.     printf ("VCAI DLL version = %x.%x\n", version >> 8, version & 0xFF);
  59.  
  60.     info->Length = sizeof (VCADEVINFO);
  61.     VcaiDeviceInfoGet (info);
  62.  
  63.     x = strlen (dev_info.ProdInfo);
  64.     if (!x)
  65.     {
  66.             printf ("No Driver Present\n");
  67.             exit (0);
  68.     }
  69.     printf ("Product Name   = %30.30s \n", dev_info.ProdInfo);
  70.     printf ("Manufacturer   = %30.30s \n", dev_info.ManInfo);
  71.     printf ("Version Number = %10.10s \n", dev_info.Version);
  72.  
  73.     if (strncmp (dev_info.ProdInfo, "WarpTV - WinCast VCA", 20) == 0)
  74.     {
  75.         (void)VcaiVarRead ("PCI_device_id",  VCA_VARIABLE_HW, &temp1);
  76.         printf ("Hardware Chipset   =  Bt%ld\n", temp1);
  77.         (void)VcaiVarRead ("Model_no",       VCA_VARIABLE_HW, &model);
  78.         printf ("Hauppauge Card Id  =  %ld ", model);
  79.         (void)VcaiVarRead ("Revision_high", VCA_VARIABLE_HW, &temp1);
  80.         (void)VcaiVarRead ("Revision_low",  VCA_VARIABLE_HW, &temp2);
  81. //        printf ("Revision No.       =  ");
  82.         printf ("%c", (UCHAR)((temp1 >> 8) & 0xFF));
  83.         printf ("%c", (UCHAR)(temp1 & 0xFF));
  84.         printf ("%c", (UCHAR)((temp2 >> 8) & 0xFF));
  85.         printf ("%c", (UCHAR)(temp2 & 0xFF));
  86.  
  87.         (void)VcaiVarRead ("Serial_no_high",  VCA_VARIABLE_HW, &temp1);
  88.         (void)VcaiVarRead ("Serial_no_low",   VCA_VARIABLE_HW, &temp2);
  89.         temp  = (temp1 << 16);
  90.         temp |= temp2;
  91.         printf (" (Serial No. %ld)\n", temp);
  92.  
  93.  
  94.         (void)VcaiVarRead ("Tuner_manufacturer", VCA_VARIABLE_HW, &temp);
  95.         printf ("Tuner Manufacturer =  %ld\n", temp);
  96.         (void)VcaiVarRead ("Tuner_type", VCA_VARIABLE_HW, &temp);
  97.         printf ("Tuner Type         =  %ld\n", temp);
  98.  
  99.         (void)VcaiVarRead ("Teletext_support", VCA_VARIABLE_HW, &temp);
  100.         (void)VcaiVarRead ("Ext_support", VCA_VARIABLE_HW, &temp1);
  101.         (void)VcaiVarRead ("SVHS_support", VCA_VARIABLE_HW, &temp2);
  102.         (void)VcaiVarRead ("FM_support", VCA_VARIABLE_HW, &temp3);
  103.  
  104.         if (temp || temp1 || temp2 || temp3)
  105.         {
  106.             printf ("Options            =  ");
  107.             if (temp)
  108.                 printf ("Teletext ");
  109.             if (temp1)
  110.                 printf ("External ");
  111.             if (temp2)
  112.                 printf ("SVHS ");
  113.             if (temp3)
  114.                 printf ("FM tuner");
  115.             printf ("\r\n");
  116.         }
  117.     }
  118.     else
  119.     {
  120.         VcaiInfoGet (arr);
  121.         printf ("Tuner Type = %d, with %s Clock, running at %s MHz\n",
  122.              arr[0],
  123.             (arr[1] == 0) ? "Crystal" :
  124.             (arr[1] == 1) ? "Oscillator" : "Unknown",
  125.             (arr[2] == 0) ? "24.5454" :
  126.             (arr[2] == 1) ?  "27" :
  127.             (arr[2] == 2) ?  "29" : "Unknown");
  128.         printf ("IO address set to 0x%3.3x\n", arr[3]);
  129.         printf ("Board memory address set to 0x%3.3x000\n", arr[4]);
  130.     }
  131.  
  132.     if (VcaiVarRead ("NumColours", VCA_VARIABLE_GENERIC, &colours))
  133.     {
  134.         printf ("Colours = %ld Resolution = %d by %d Pixels\n",
  135.                 colours, arr[6], arr[7]);
  136.     }
  137.     printf ("Image Format = %lx\n", dev_info.ImgFormat);
  138.     printf ("BitsPerPel = %d\n", dev_info.BitsPerPEL);
  139.     printf ("Overlay support = %d\n", dev_info.Overlay);
  140.     printf ("Video Brightness %lx ", dev_info.Brightness);
  141.     printf ("Hue %lx ", dev_info.hue);
  142.     printf ("Saturation %lx ", dev_info.saturation);
  143.     printf ("Contrast %lx\n", dev_info.contrast);
  144.     printf ("Colour Key currently set to %ld\n", VcaiColourkeyGet ());
  145.     input = VcaiVideoInputQuery ();
  146.     printf ("Video Input source %s\n", (input == 0) ? "Ext Composite 1" :
  147.                                        (input == 1) ? "Ext Composite 2" :
  148.                                        (input == 2) ? "TV Tuner" : "SVHS");
  149.  
  150.  
  151.     VcaiAudioGet (&lv, &rv, &lb, &rb, <, &rt, &m);
  152.     printf ("Sound %s Volume %x/%x Bass %x/%x Treble %x/%x\n",
  153.             (m) ? "Muted" : "On", lv, rv, lb, rb, lt, rt);
  154.  
  155.     VcaiTunerGet (®ion, &channel, &freq, &fine);
  156.     printf ("Tuner Region %ld, Channel %ld Frequency %ld, FineTune %ld\n",
  157.               region, channel, freq, fine);
  158.     return 0;
  159. }
  160.  
  161.