{************************************************************************
* MV1UNIT.PAS
* Delphi Pascal Unit Interface for the Mutech MV-1000 imaging board
* Rev. 1 for SDK 2.14
* Written by Peter Dirsa and Matt Carnevale
*
*      Permission is granted to anyone to use this example program for
*      any purpose on any computer system, subject to the following
*      restrictions:
*
*      1. The source is provided on an "as is" basis, without warranty.
*         You indemnify, hold harmless and defend MuTech from and against
*         any claims or lawsuits, including attorney's, that arise or
*         result from the use or distribution of this example, or any
*         modification thereof.
*
*      2. You may not remove, alter or suppress this notice from this
*         program or any modification thereof.
*
*
*
*************************************************************************}
unit MV1UNIT;

interface
uses
wintypes;

type
 plongint = ^longint;

const

{MV1_SDKVersion = $0214 ;}
MV1_SDKVersion = $0221 ;

MV1_Stop_Grab      = 0;
MV1_Grab           = 1;

MV1_Max_LUTbank    = 8;

 MV1_LUTJUMPERS_TOP     = 0;
 MV1_LUTJUMPERS_BOTTOM  = 1;


{********************************************
    MV1 library error return code
*********************************************}

{* Range [1..100] are reserved for SDK internal use only *}

 MV1_OK             = 0;
 MV1_ERROR          = -100;
 MV1_PARAM_ERR      = -101;
 MV1_OPEN_ERR       = -102;
 MV1_COMPATIBLE_ERR = -103;
 MV1_HARDWARE_ERR   = -104;
 MV1_1100_ABSENCE   = -105;
 MV1_MODULE_ABSENCE = MV1_1100_ABSENCE;
 MV1_CABLE_CONFLICT = -106;
 MV1_MEM_ALLOC_ERR  = -107;
 MV1_NOT_INIT       = -108;
 MV1_FILE_NOT_EXIST = -109;

 MV1_NOT_SUPPORTED  = -200;


{********************************************
    Constant for MV1 Mid and High Level
    functions Parameters
*********************************************
 }
 MV1_8bit_Mode          = 0;
 MV1_10bit_Mode         = 1;
 MV1_12bit_Mode         = 3;
 MV1_16bit_Mode         = 4;
 MV1_32bit_Mode         = 5;
 MV1_YUV16bit_Mode      = 6;   { YUYVYUYV ... }
 MV1_RGB24bit_Mode      = 7;   { BGRBGR ...   }
 MV1_RGB32bit_Mode      = 8;   { BGRxBGRx ... }

 MV1_Board0             = 0;
 MV1_Board1             = 1;
 MV1_Board2             = 2;

 MV1_Video0             = 0;
 MV1_Video1             = 1;
 MV1_Video2             = 2;
 MV1_Video3             = 3;

 MV1_Sync0              = 0;
 MV1_Sync1              = 1;
 MV1_Sync2              = 2;
 MV1_Sync3              = 3;

 MV1_CSyncClock         = 0;
 MV1_ExtHSyncClock      = 1;
 MV1_ExtClock           = 2;
 MV1_14MHz              = 3;

 MV1_SyncStrip0         = 0;
 MV1_SyncStrip1         = 1;
 MV1_SyncStrip2         = 2;
 MV1_SyncStrip3         = 3;

 MV1_8bit_AD            = 0;
 MV1_10bit_AD           = 1;

 MV1_No_Clamp           = 0;
 MV1_BackPorch_Clamp    = 1;
 MV1_SyncTip_Clamp      = 2;

 MV1_XTrig_Disable      = 0;
 MV1_XTrig_Enable       = 1;

 MV1_XTrig_Low          = 0;
 MV1_XTrig_High         = 1;

 MV1_Mem_Mask           = 0;
 MV1_Grab_Mask          = 1;

 MV1_Mask_Disable       = 0;
 MV1_Mask_Enable        = 1;

 MV1_Grab_Int           = 1;
 MV1_MXfer_Int          = 2;

 MV1_Grab_Int_Reset     = 0;
 MV1_MXfer_Int_Reset    = 1;

 MV1_Grab_Int_Status    = 0;
 MV1_MXfer_Int_Status   = 1;

 MV1_Grab_Even          = 0;
 MV1_Grab_Odd           = 1;
 MV1_Grab_Next          = 2;

 MV1_Single_Grab        = 0;
 MV1_Cont_Grab          = 1;

 MV1_Sync_Out_Disable   = 0;
 MV1_CSync_Out          = 1;
 MV1_HVSync_Out         = 2;

 MV1_RS170_Cam          = 0;
 MV1_CCIR_Cam           = 1;

 MV1_CLOSE              = 0;
 MV1_OPEN               = 1;

 MV1_ExtSync_No         = 0;
 MV1_ExtSync_Yes        = 1;

 MV1_1MB_MEM            = 0;
 MV1_4MB_MEM            = 1;
 MV1_MAX_MEM            = 2;

 MV1_Slave_Mode               =  0;   {      bit0 : master/slave}
 MV1_Master_Mode              =  1;   {      bit1 : master loop}
 MV1_Master_Loop_Mode         =  2;   {      bit2 : master frame end}
 MV1_Master_FrameEnd_Mode     =  4;   {             transfer}
 MV1_NOAUTO_MASTER            =  8;   {  bit3 : if set, MV1StartGrab()
                                                 will not automatically
                                                 enable master mode transfer}

 MV1_NonInterlace      =  0;
 MV1_Interlace         =  1;

 MV1_GP_Bit0           =  0;
 MV1_GP_Bit1           =  1;


{*************************************************
    Digital Camera function code definitions
**************************************************}

 MV1_Dig_Clock_Select    = 0;
 MV1_Dig_Trig_Polarity   = 1;
 MV1_Dig_Trig_Enable     = 2;
 MV1_Dig_Mode_Control    = 3;
 MV1_Dig_Timing_Source   = 4;
 MV1_Dig_Timing_Polarity = 5;
 MV1_Dig_Counter         = 6;
 MV1_Dig_Soft_Trig       = 7;
 MV1_Dig_Pulse_Mode      = 8;
 MV1_Dig_Select_INTEG    = 9;
 MV1_Dig_Select_MC1      = 10;
 MV1_Dig_Partial_Frame_Remove =   11;
 MV1_Dig_Bypass_Counter  = 12;

 MV1_COLOR_ENABLE_SAA7110  =  0;
 MV1_COLOR_DISABLE_SAA7110 =  1;
 MV1_COLOR_ENABLE_BT254    =  2;
 MV1_COLOR_DISABLE_BT254   =  3;
 MV1_COLOR_MV1350          =  4;

{*************************************************
 Symbols for Mv-1300 module control
**************************************************}
 MV1_RGB_Clamp             =  20;
 MV1_RGB_Channel           =  21;
 MV1_RGB_Ext_CSync         =  22;
 MV1_RGB_HSync_Polarity    =  23;
 MV1_RGB_VSync_Polarity    =  24;
 MV1_RGB_Sync_On_Green     =  25;
 MV1_RGB_ADTop_R           =  26;
 MV1_RGB_ADBottom_R        =  27;
 MV1_RGB_ADTop_G           =  28;
 MV1_RGB_ADBottom_G        =  29;
 MV1_RGB_ADTop_B           =  30;
 MV1_RGB_ADBottom_B        =  31;
 MV1_RGB_PixelMode         =  32;      { internal use only }


{*************************************************
 Symbols for Mv-1350 module control
**************************************************}
 MV1_CS_Channel           =   50;
 MV1_CS_Saturation        =   51;
 MV1_CS_Hue               =   52;
 MV1_CS_AGC_Off           =   53;
 MV1_CS_Gain              =   54;
 MV1_CS_Flag_PAL          =   55;
 MV1_CS_VCR_Mode          =   56;


 MV1_INTEG_CONTROL       = 0;
 MV1_MC1_CONTROL         = 1;

{*************************************************
    Line Scan Camera function code definitions
**************************************************}

 MV1_MEMORY_WRAP        = 0;

 MV1_MEMORY_WRAP_ON     = 0;
 MV1_MEMORY_WRAP_OFF    = 1;


{*************************************************
    Other symbols definitions
**************************************************}

 MV1_BoardChipAccess    = 0;
 MV1_PLLChipAccess      = 1;
 MV1_TGenChipAccess     = 2;
 MV1_DACChipAccess      = 3;
 MV1_DigCtlAccess       = 4;
 MV1_FilterAccess       = 5;


{ addresses for MV1_BoardChipAccess}
 MV1_H_START            = 0;
 MV1_H_END              = 1;
 MV1_V_START            = 2;
 MV1_V_END              = 3;
 MV1_CUR_LINE           = 4;
 MV1_EQ_REMOVE          = 5;
 MV1_GRAB_START_ADDR    = 6;
 MV1_GRAB_CONTROL       = 7;
 MV1_MISC_CONT_STATUS   = 8;
 MV1_LUT_ADDR           = 9;
 MV1_LUT_DATA           = 10;
 MV1_LUT_CTL            = 11;
 MV1_VIDEO_CTL          = 12;


{ addresses for MV1_FilterAccess}
 MV1_FREQ_CUTOFF        = 0;
 MV1_BOOST              = 1;


{*************************************************
    Camera control structures
**************************************************}

{ Structure for Video inputs selection                        }
type

MV1VideoSel = packed record
                 videoChannel: byte;   { video input channel:     0 - 3}
                 syncChannel : byte;    { Sync input selection:    0 - 3}
              end;


{ Structure for Phase Lock Loop and Sync. control              }
{ VCO - Voltage Control Oscillator.                            }
 pMV1PLLSyncCtl =^MV1PLLSyncCtl;
 MV1PLLSyncCtl = packed record
                   PixelPerLine   :dword;
                   hPeriod        :real;
                   PhaseTriming   :byte;
                   clockReference :byte;   {Default should be :: 2 ;    4 different sources}
                   reserved1      :byte;   {Default should be :: 6 ;    space reserved}
                   LeadLag        :byte;   {Default should be :: 3 ;                   }
                   reserved2      :byte;   {Default should be :: 4 ;    space reserved }
                   forceEQRemove  :byte;   {Default should be :: 1 ;                   }
                   PixelClockFreq :real;
                 end;


{ Video conditionning control }
MV1VideoCondCtl = packed record
                     ClampControl :byte;  { can only be 0, 1, or 2}
                     ADTop        :byte;  { top reference of AD converter}
                     ADBottom     :byte;  { bottom reference of AD converter}
                     ClampLevel   :byte;  { Clamp level}
                     DCOffset     :byte;  { DC shift to the clamping level}
                  end;

{ filter register definitions. }
MV1FilterOp = packed record
                Cutoff :byte;       {cutoff frequency}
                Boost  :shortInt ;  {scale factor for high frequency boost}
              end;


{ Parameters to drive a camera. }
pMV1CameraDrive=^MV1CameraDrive;
MV1CameraDrive = packed record
        cameraMasterClock       : dword; {Defaut shoud be :: 1 }
        cameraInterlace         : dword; {Defaut shoud be :: 1 }
        cameraDriveVPolarity    : dword; {Defaut shoud be :: 1 }
        cameraDriveHPolarity    : dword; {Defaut shoud be :: 1 }
        cameraSyncOutput        : dword; {Defaut shoud be :: 1 }
        cameraCSyncOutput       : dword; {Defaut shoud be :: 1 }
        cameraClockDivideBy4    : dword; {Defaut shoud be :: 1 }
        cameraDriveThroughModule: dword; {Defaut shoud be :: 1 }
        cameraHGatePolarity     : dword; {Defaut shoud be :: 1 }
        reserved                : dword; {Defaut shoud be :: 7 { place holder}
        cameraDriveWidth        : dword;
        cameraPixelPerLine      : dword;
        cameraClockFrequency    : real;        { obsolete}
        cameraDriveHeight       : dword;
        cameraLinePerFrame      : dword;
        cameraFlag_EquSerr      : dword;
        cameraEq_Start          : dword;
        cameraEq_End            : dword;
     end;

pMV1DigitalCamera = ^MV1DigitalCamera;
MV1DigitalCamera = packed record

    Flag_LDVInversion    : dword; {Defaut is  ::1  {1: inverse Line Date Valid signal}
    Flag_FDVInversion    : dword; {Defaut is  ::1;  { 1: inverse Field Data Valid signal}
    Flag_PCLKInversion   : dword; {Defaut is  ::1;  { 1: inverse pixel clock signal}
    CounterExtTrigger    : dword; {Defaut is  ::1;  { 1 - external trigger}
                                      { 0 -- Software trigger}
    CounterSource        : dword; {Defaut is  ::4;  { select clock source}
                                     {   0 - LDV              }
                                     {   1 - Linversed LDV    }
                                     {   2 - Horizontal Drive }
                                     {   3 - Vertical Drive   }
    CounterTrigPolarity  : dword; {Defaut is  ::1;  { 0 - falling edge      }
                                     { 1 - raising edge      }
    WorkingMode          : dword; {Defaut is  ::3;  {                       }
    Flag_LS_ExpEnable    : dword; {Defaut is  ::1;  { 1 - enable PRIN signal}
                                     { 0 - disable, PRIN stays high}
    Flag_DCI_Integ       : dword; {Defaut is  ::1;  { reserved}
    Flag_DCI_Double_Pulse: dword; {Defaut is  ::1;  { reserved.}
    Flag_Part_Frame_Rmv  : dword; {Defaut is  ::1;  { remove partial frame from ill cameras}
    CounterValue         : byte;                   { counter value}
    LS_Exp_Start         : dword;     { # pixels, relative to front edge}
                                     {y of H.D., to start PRIN low}
    LS_Exp_End           : dword;     { # pixels, relative to front edge}
                                     { of H.D., to end PRIN low}
    DataPacking          : dword;     { 1:  8-bit per pixel}
                                     { 2: 16-bit per pixel}
                                     { 4: 32-bit per pixel}
    Flag_Bypass_Counter  : dword; {Defaut is  ::1;  { 0: normal}
                                     { 1: the selected counter}
                                     {    clock source signal is}
                                     {    bypassed to EXTSHUTTER}
    Flag_ExSync_Auto     : dword; {Defaut is  ::1;  { reserved}
    dummy                : dword; {Defaut is  ::14; { reserved}
end;

MV1ColorCamera = packed record        { using MV-1300 or MV-1350 module}

    { The following fields are defined for RGB cameras}
    RGB_Clamp_Control  : dword; {Defaut is  ::1;    { 0: Back porch}
                                     { 1: Sync tip}
    RGB_Channel        : dword; {Defaut is  ::1;    { 0 or 1, select both video and sync}
    RGB_External_CSync : dword; {Defaut is  ::1;    { 0: Separate H + V Sync}
                                     { 1: CSync input}
    RGB_HSync_Polarity : dword; {Defaut is  ::1;
    RGB_VSync_Polarity : dword; {Defaut is  ::1;
    RGB_Sync_On_Green  : dword; {Defaut is  ::1;    { 0: C.Sync from GRAY cable}
                                     { 1: C.Sync is combined in video signal}
                                     {    on GREEN cable}
    reserved           : dword; {Defaut is  ::10;   { space holder}
    RGB_R_Top          :byte;
    RGB_R_Bottom       :byte;
    RGB_G_Top          :byte;
    RGB_G_Bottom       :byte;
    RGB_B_Top          :byte;
    RGB_B_Bottom       :byte;

    { The following fields are defined for Composite or S-Video color cameras}
    CS_Channel         : dword; {Defaut is  ::2;    { select video channels between 0-3.}
                                     { 3 for S-Video}
    CS_AGC_Off         : dword; {Defaut is  ::1;    { 0: AGC ON}
                                     { 1: AGC OFF}
    CS_Flag_PAL        : dword; {Defaut is  ::1;    { 0: NTSC input}
                                     { 1: PAL input}
    CS_VCR_Mode        : dword; {Defaut is  ::1;    { 0: normal}
                                     { 1: VCR fast tracking}
    CS_Saturation      : byte;            { 127: Max. sauration}
                                     { 1  : Min sat.}
                                     { 0  : color off}
    CS_Hue             : shortint;
    CS_Gain            : shortint;
end;


{*************************************************
  The composite camera configuration structure.
**************************************************}
pMV1CamConfig = ^MV1CamConfig;
MV1CamConfig = packed record
    version : dword;                { camera config file version (format)}
    videoSel: MV1VideoSel;          { video selection}

                                    { grab windows}
    hOffset:dword;                { horizontal starting point}
    vOffset:dword;                { horizontal ending point}

    videoCondCtl :MV1VideoCondCtl;  { video conditioning}

    filter :MV1FilterOp ;            { filter operation}

    pll : MV1PLLSyncCtl ;           { PLL control}

    cameraDrive :MV1CameraDrive;   { Camera drive control}

    stripRange:byte;             { Sync Strip}

                                    { misc. control}
    externalTrigger         : dword; {Defaut is  :: 1 }
    externalTriggerPolarity : dword; {Defaut is  :: 1 }
    flagInterlace           : dword; {Defaut is  :: 1 }
    externalClock           : dword; {Defaut is  :: 1 }
                                            { Digital Camera definitions}
    Flag_DigitalCamera      : dword; {Defaut is  :: 1 ;   { 1: digital camera in use}
                                            { Cable settings}
    Flag_Video_AC_Couple    : dword; {Defaut is  :: 1 }
    Flag_Sync_DC_Couple     : dword; {Defaut is  :: 1 }
    Flag_Sync_Termination   : dword; {Defaut is  :: 1 }
    Flag_White_Cable        : dword; {Defaut is  :: 1 }
    Flag_MiniBNC_Cable      : dword; {Defaut is  :: 1 }
{   bitPerPixel             : 6 ; { space holder}
    reserved                : dword; {Defaut is  :: 6 }
    bitMode                 : dword; {Defaut is  :: 1 }   { shift down 2 bits}
    lineScanCamera          : dword; {Defaut is  :: 1 }   { 1 if it is a line scan cam}
    External_Sync_Input     : dword; {Defaut is  :: 1 }   {}
    External_CSync_Input    : dword; {Defaut is  :: 1 }
    HSync_Polarity          : dword; {Defaut is  :: 1 }   { reserved}
    UseModuleSyncClock      : dword; {Defaut is  :: 1 }   { 0 = use sync clock from mv-1000}
                                            { 1 = use sync clock from mv-1100}
                                            { this field is used only for}
                                            { special analog cameras}
    pixelMode               : dword; {Defaut is  :: 8 }   { pixel format
    dummy2                  : dword; {Defaut is  :: 2 }   { place holder}
    DigCamera               : MV1DigitalCamera;
    MaxCaptureSizeH         : dword;       { maximum size of the images that}
    MaxCaptureSizeV         : dword;       { the camera can offer}
    ColorCamera             : MV1ColorCamera;
end;



{*************************************************
    Board Init structure
    Note: This structure is not completely
          defined, more element will be added
          in the future when the hardware is
          better defined. (dated 10-4-94)
**************************************************}
{ General Control structure}
pMV1InitCFG =^MV1InitCFG ;
MV1InitCFG = packed record
    pmode   :dword;              { pixel mode}
    msmode  :dword;              { master/slave mode}
    lut     :pointer;           { Look Up Table pointer}
    LutBank :dword;                  { bank = 0 - 7 for 8 bits}
                                    {      = 0 - 1 for 10 bits}
                                    {      ignore for 12 bits}
             end;


{*************************************************
    Frame Grab control structure
**************************************************}

{ Frame grabbing and memory address control }
 pMV1GrabWindow= ^MV1GrabWindow;
 MV1GrabWindow = packed record
    FGH_Start:longInt;  { Start grabbing at X (horizontal pixel position).}
    FGH_End:longInt;    { Start grabbing at X (horizontal pixel position).}
                            { X has to be: multiple of 4 for 8-bits image}
                            {            : multiple of 2 for 10/12 bits image}
    FGV_Start:longInt;  { Start grabbing at Y (vertical line position).}
    FGV_End:longInt;   { Start grabbing at Y (vertical line position).}
    Addr_Start:dword; { Starting Address of the video memory for}
                        {  grabbing (32 bit).}
    Reserved:longInt;   { Reserved.}
{    a1: array[1..100] of dword;}
    end;


{*************************************************
    MV1 Frame structure
    This structure is required for all the
    MV1000 memory access functions.
**************************************************}
 pMV1Frame=^MV1Frame;
 MV1Frame= packed record

    f_1st_addr:dword;         { offset of first field starting address.}
    f_2nd_addr:dword;         { offset of second field starting address.}
                                { this pointer is only used for interlace}
                                { mode.}
    f_width:dword;            { width of the frame}
    f_height:dword;           { height of the frame}
    f_pixel_size :byte;       { 8, 10 , 12 pixel size}
    reserved1:byte;{Defaut is  :: 8 ;               { space reserved}
    f_interlace :byte;{Defaut is  :: 1;    { the frame is a interlace/non-interlace}
    f_mem_wrap:byte;{Defaut is  :: 2;      { 0: memory wrap not used}
                                { 1: memory wrap at 1 MBytes}
                                { 2: memory wrap at 4 MBytes}
    reserved2:byte;{Defaut is  :: 5;                { space reserved}
    f_color_format :byte;    { space reserved}
    f_field_order:byte;      { even file first or odd field first}
                                { this field will be ignored if f_interlace}
                                { is non-interlace.}
    reserved3:byte;{Defaut is  :: 8 ;               { space reserved}
    f_line_inc : dword;        { distance of two lines in this frame,}
                                { with the reference of the new frame}
                                { address.}
{    a1: array[1..100] of dword;}


               end;


{*************************************************
    MV1 board information structure
**************************************************}
pmv1info= ^MV1Info;
MV1Info = packed record

    MemBase    : longint;      { VRAM linear memory starting address}
    MemSize    : dword;      { frame buffer size in MByte (1 or 4 MB)}
    ADMode     : dword;      { 8/10 bits A/D}
    IRQ        : dword;      { IRQ assigned to the MV-1000}
    MasterMode : byte;      { master/slave mode (reserved for future)}
                            {    0=currently in slave mode}
                            {    1=currently in master mode, do one transfer}
                            {    3=currently in master mode, do continuous}
                            {      transfer.}
                            {    5=currently in master mode, transfering}
                            {      starts at the end of each frame, do one}
                            {      transfer.}
                            {    7=currently in master mode, transfering}
                            {      starts at the end of each frame, do}
                            {      continuous transfer.}
    MasterResource: byte;   { Number of master mode transfer control}
                            { available}
    GrabMode: dword;         { grab mode (reserved for future)}
                            {    1=currently grabbing}
                            {    0=currently not grabbing}
    MaskMode: dword;         { mask mode  (reserved for future)}
    GrabInt : byte;         {Defaut is  :: 1;    { Grab Interrupt enable/disable}
    LUTJumpers: byte;       {Defaut is  :: 1;  { 0: JP7, JP8, JP19 and JP20 are at UPPER position}
                            { 1: JP7, JP8, JP19 and JP20 are at LOWER position}
    reserved1 : byte;       {Defaut is  :: 6;            { space reserved}
    reserved2: byte;        {Defaut is  :: 8;            { space reserved}
    XferInt : byte;         {Defaut is  :: 1;    { Master Xfer Interrupt enable/disable}
    reserved3: byte;        {Defaut is  :: 7;            { space reserved}
    Jumpers: byte;          {Defaut is  :: 3;     { Position of JP23, JP22, JP21}
                            { 0: jumper is IN}
                            { 1: jumper is OUT}
    reserved4: byte;      {Defaut is  :: 5;            { space reserved}
    DigCamFlg :dword;        { Daughter module options}
                            {   0: no daughter module detected}
                            {   1: MV-1100 module detected}
                            {   2: MV-1300 module detected}
                            {   3: MV-1350 module detected}
    Revision : dword;        { MV-1000 board revision}
end;

{*************************************************
    Structures similar to those defined for DCI
**************************************************}

MTRECTL = packed record                   { display area in unit of pixel}
      left   :longint;
      top    :longint;
      right  :longint;
      bottom :longint;
 end;

MTRGNDATAHEADER = packed record
        dwSize :longint ;
         iType :longint;
        nCount :longint;                 { only field we care about}
      nRgnSize :longint;
       rcBound :MTRECTL   ;
                 end;


 MTRGNDATA  = packed record
      rdh :MTRGNDATAHEADER ;
    Buffer: array[1..1] of char;      { array of MTRECTL for each rectangle to}
                                      { be displayed.}
               end;


 pfloat  = ^real;
 psingle = ^single;
 pulong  = ^longint;
 pbyte   = ^byte;
 puword  = ^dword;

{**********************************************************
    Board Init. Function prototypes
***********************************************************}

Function   MV1Open:longint; stdcall;
Function   _MV1Open( P1: DWORD):longint; stdcall;

Function   MV1Close:longint; stdcall;
Function   MV1Init(MV1CamConfig:pointer; MV1InitCFG:pointer):longint; stdcall;
Function   MV1SDKVersion:INTEGER; stdcall;
Procedure  MV1GetMV1000RootPath( P:Pchar;p2:integer); stdcall;

{*********************************************************
    Board control Function prototypes
**********************************************************}
Function   MV1SetCurrentBoard(p : dword):longint; stdcall;
Function   MV1GetCurrentBoard:INTEGER; stdcall;
Function   MV1SetCurrentCamera(p : dword):INTEGER;stdcall;
Function   MV1SelectPixelMode(p : dword):INTEGER; stdcall;
Function   MV1InquirePixelBits :INTEGER;stdcall;
Function   MV1SelectTransferMode(p : dword):INTEGER;stdcall;
Function   MV1InquireBoard(p:pMV1Info  ):INTEGER;stdcall;
Function   MV1InquirePixelMode:INTEGER;stdcall;
Function   MV1MemWrapEnable(p : BYTE):INTEGER;stdcall;
Function   MV1MemWrapDisable:INTEGER;stdcall;

(********************************************************
    Camera control Function prototype
**********************************************************)
Function   MV1SelectSTDCameraConfig(p : dword):INTEGER; stdcall;
Function   MV1SetCameraConfig(p:pMV1CamConfig  ):INTEGER;stdcall;
Function   MV1InquireCameraConfig(p:pMV1CamConfig ):INTEGER;stdcall;
Function   MV1LoadCameraConfigFile(p1:Pchar; p2:pchar):INTEGER;stdcall;
Function   MV1SetPLLControl(p1 :integer; p2: pMV1PLLSyncCtl ):INTEGER;stdcall;
Function   MV1GetPLLControl(p:pMV1PLLSyncCtl ):INTEGER;stdcall;
Function   MV1SetTimGen(p:pMV1CameraDrive ):INTEGER;stdcall;
Function   MV1GetTimGen(p:pMV1CameraDrive ):INTEGER;stdcall;
Procedure  MV1ParseCamConfig(p1:pMV1CamConfig; p2 :pchar ; p3:pchar; p4 :pointer) ;stdcall;
Function   MV1SaveCameraConfigFile(p1:pMV1CamConfig ;p2:pchar; p3:pchar):INTEGER;stdcall;
Function   MV1SetCVideoSource(p:dword):INTEGER;stdcall;
Function   MV1SetCSyncSource(p:dword):INTEGER;stdcall;
Function   MV1SelectClockSource(p:dword):INTEGER;stdcall;
Function   MV1SelectSyncStripRange(p:dword):INTEGER;stdcall;
Function   MV1SelectADConvertor(p:dword):INTEGER;stdcall;
Function   MV1SetPLLphaseTrim(p:dword):INTEGER;stdcall;
Function   MV1SetPLLPhaseDetector(p:dword):INTEGER;stdcall;
Function   MV1SetDigitizeLevel(p1:dword; p2:dword):INTEGER;stdcall;
Function   MV1SelectClamping(p:dword):INTEGER;stdcall;
Function   MV1SetClampLevel(p:dword):INTEGER;stdcall;
Function   MV1SetDCCoupledOffsetLevel(p:dword):INTEGER;stdcall;
Function   MV1GetOffset: single;stdcall;
Function   MV1GetOffsetRange(p1:psingle ; p2:psingle ):INTEGER;stdcall;
Function   MV1SetOffset(p : single):INTEGER;stdcall;
Function   MV1GetGain: single;stdcall;
Function   MV1GetGainRange(p1:psingle ; p2:psingle ):INTEGER;stdcall;
Function   MV1SetGain(p : single):INTEGER; stdcall;
Function   MV1SetExtTriggerMode(p :dword; p2:dword):INTEGER;stdcall;
Function   MV1WaitExtTrigger:INTEGER;stdcall;
Function   MV1SelectSyncOutput(p : dword):INTEGER;stdcall;
Function   MV1RdVSyncInfo:INTEGER;stdcall;
Function   MV1SetHighFreqBoost(bscale:dword):INTEGER;stdcall;
Function   MV1SetFilterCutoff(p : dword):INTEGER;stdcall;
Function   MV1GeneralAccessOut(p1 : dword; p2 : dword; p3 : Pointer ):INTEGER;stdcall;
Function   MV1GeneralAccessIn(p1 : dword;p2 : dword; p3 : Pointer):INTEGER;stdcall;
Function   MV1CheckCableConflicts(p:pMV1CamConfig):INTEGER;stdcall;

{*********************************************************
    Video control Function prototype
**********************************************************}
Function   MV1SetScaleFactor(p : dword):INTEGER;stdcall;
Function   MV1SetVScaleFactor(p : dword):INTEGER;stdcall;
Function   MV1SetHScaleFactor(p : dword):INTEGER;stdcall;
Function   MV1SetGeneralPurposeBit(p :BYTE) :INTEGER;stdcall;
Function   MV1ResetGeneralPurposeBit(p:BYTE) :INTEGER;stdcall;
Function   MV1EnableEQRemove:INTEGER;stdcall;
Function   MV1DisableEQRemove:INTEGER;stdcall;


{**********************************************************
    Grab Function prototypes
***********************************************************}
Function   MV1SetGrabWindow(p1:longint; p2:longint; p3:longint; p4:longint; p5:longint; p6: pMV1GrabWindow ):LONGINT; stdcall;
Function   MV1StartGrab(p1 : dword; p2 : dword):longint;stdcall;
Function   MV1StartGrabField(p1 : dword; p2 : dword):INTEGER;stdcall;
Function   MV1StopGrab:INTEGER;stdcall;
Function   MV1GrabField(frame :pMV1Frame; p2:dword; p3:pointer ):INTEGER;stdcall;
Function   MV1GrabField2DIBitmap(frame :pMV1Frame; p2:dword; p3:pointer ):INTEGER;stdcall;
Function   MV1InquireGrabWindowSize(p1: pULONG ; p2: pULONG ):INTEGER;stdcall;
Function   MV1InquireMaxGrabWindowSize(p1:pULONG ; p2: pULONG ):INTEGER;stdcall;
Function   MV1InquireCVideoSource:INTEGER;stdcall;
Function   MV1GetCurrentGrabLineCounter: Longint ;stdcall;


{**********************************************************
    Master Mode Transfer Function prototypes
***********************************************************}
Function   MV1SetMasterModeTransfer(p1:pMV1Frame; p2 : pointer; p3:longint; p4: BYTE):INTEGER;stdcall;
Function   MV1SetMasterModeTransferField(p1:pMV1Frame; p2 : pointer; p3:longint; p4: BYTE):INTEGER;stdcall;
Function   MV1SetMasterModeTransfer2Peripheral(p1:pMV1Frame; p2 : pointer; p3:longint; p4: BYTE):INTEGER;stdcall;
Function   MV1SetMasterCtlId(p : integer):INTEGER;stdcall;
Function   MV1StartMasterModeTransfer:INTEGER;stdcall;
Function   MV1StopMasterModeTransfer:INTEGER;stdcall;
Function   MV1LockMasterBuffer(p1 : pointer; p2:longint):INTEGER;stdcall;
Function   MV1UnlockMasterBuffer(p1 : pointer; p2:longint):INTEGER;stdcall;
Function   MV1SetMasterModeTransfer2Screen(p1 :pMV1Frame ; p2:dword; p3:longint;
                           p4:longint; p5:longint; p6:longint; p7:longint; p8:longint; p9:BYTE; p10 :pointer ):INTEGER;stdcall;

{**********************************************************
    Memory access control Function prototypes
***********************************************************}
Function   MV1SetMask(p1 : dword; p2 : dword):INTEGER;stdcall;
Function   MV1EnableMask(p : dword):INTEGER;stdcall;
Function   MV1DisableMask(p : dword):INTEGER;stdcall;

{**********************************************************
    Hardware Interrupt control Function prototypes
***********************************************************}
Function   MV1IRQEnable (p : dword):INTEGER;stdcall;
Function   MV1IRQDisable(p : dword):INTEGER;stdcall;
Function   MV1IRQReset  (p : dword):INTEGER;stdcall;
Function   MV1IRQStatus (p : dword):INTEGER;stdcall;

{**********************************************************
    user Interrupt control Function prototypes         (for NT)
***********************************************************}

Function  MV1ConnectInterruptToCallback(p1 : integer; callbackfunction:pointer; o3: integer):INTEGER;stdcall;
Function  MV1DisconnectInterruptCallback(p:integer):INTEGER;stdcall;
Procedure MV1InterruptProcessed( p:dword);stdcall;


{**********************************************************
    Frame access Function prototypes
***********************************************************}
Function   MV1CreateFrame(p1:pMV1Frame; p2:longint; p3:longint; p4:longint; p5:longint; p6:pMV1GrabWindow ):longint; stdcall;
Function   MV1FrameFill(p1:pMV1Frame; p2:longint; p3:longint; p4:longint; p5:longint; P6:dword):INTEGER;stdcall;
Function   MV1FrameLineRead(p1:pMV1Frame; p2:longint; p3:longint; p4:longint; P5:POINTER):INTEGER;stdcall;
Function   MV1FrameLineWrite(p1:pMV1Frame; p2:longint; p3:longint; p4:longint; P5:POINTER ):INTEGER;stdcall;
Function   MV1FrameRead(p1:pMV1Frame; p2:longint; p3:longint; p4:longint;P5:LONGINT; P6:POINTER ):INTEGER;stdcall;
Function   MV1FrameWrite(p1:pMV1Frame; p2:longint; p3:longint; p4:longint;P5:LONGINT; P6:POINTER ):INTEGER;stdcall;
Function   MV1FrameReadField(p1:pMV1Frame; p2:dword; p3:pointer):INTEGER;stdcall;

{#if defined(_WINDOWS) || defined(_OS2)}

Function   MV1FrameRead2DIBitmap(p1:pMV1Frame ; p2:pointer ):INTEGER;stdcall;
Function   MV1FrameRead2DDBHandle(p1:pMV1Frame ; p2: THandle):INTEGER;stdcall;
Function   MV1FrameLineRead2DCI(p1:MV1Frame ; p2:longint;
                                p3:longint; p4:longint; p5:dword; p6:longint):INTEGER;stdcall;
Function   MV1SetMasterModeTransfer2DIBitmap(p1:pMV1Frame; p2:pointer; p3:longint; p4:BYTE):INTEGER;stdcall;
{ for backward compatability}
Function   MV1SetMasterModeTransfer2DIB(p1:MV1Frame; p2:pointer; p3:longint; p4:BYTE):INTEGER;stdcall;
{#endif}

{*********************************************************
    LUT control Function prototypes
**********************************************************}
Function MV1SetLUTMode(lmodeL :dword):INTEGER;stdcall;
Function MV1SelectLUTBank(lbank:dword):INTEGER;stdcall;
Function MV1LUTWrite(p1:dword; p2:dword; p3:pULONG ):INTEGER;stdcall;
Function MV1LUTRead(p1:dword; p2:dword; p3:pULONG ):INTEGER;stdcall;
Function MV1LoadLUTDefault(p : dword):INTEGER;stdcall;
Function MV1LoadLUTDefault8Bit(p : dword):INTEGER;stdcall;
Function MV1LoadLUTPassThrough(p : dword):INTEGER;stdcall;
Function MV1LoadLUTDefault10Bit(p : dword):INTEGER;stdcall;
Function MV1LoadLUTDefault10to8Bit(p : dword):INTEGER;stdcall;

{*********************************************************
    color conversion Function prototype
**********************************************************}
{

 not for now

void MTPROCALL MV1Yuv2RgbCCIR601_422(ULONG *, ULONG *, ULONG);
 MV1Yuv2Rgb32bitCCIR601_422 MV1Yuv2RgbCCIR601_422

void MTPROCALL MV1Yuv2RgbCCIR601_YYUV(ULONG *, ULONG *, ULONG);
 MV1Yuv2Rgb32bitCCIR601_YYUV MV1Yuv2RgbCCIR601_YYUV

}

Procedure  MV1Rgb2YCCIR601(p1:pULONG; p2:pULONG ; p3:pULONG; p4:BYTE);stdcall;
Procedure  MV1Rgb2YuvCCIR601_422(p1:pULONG ; p2:pULONG ; p3:longint);stdcall;
Procedure  MV1Yuv2Rgb24bitCCIR601_422(p1:pULONG ; p2:pULONG ; p3:longint);stdcall;
Procedure  MV1Yuv2Rgb24bitDIBCCIR601_422(p1:pULONG ; p2:pULONG ; p3:dword; p4:dword);stdcall;

{*********************************************************
    Capture synchronization control function prototypes
**********************************************************}
Function   MV1WaitVSync:INTEGER; stdcall;
Function   MV1WaitFrameEnd:longint; stdcall;
Function   MV1IsFrameEnd:INTEGER;stdcall;
Function   MV1WaitGrabDone:INTEGER;stdcall;
Function   MV1SkipFrames(p1:integer; p2 :dword) :INTEGER;stdcall;
Function   MV1InquireField :INTEGER;stdcall;
Function   MV1ReadFieldLineCounter: dword;stdcall;


{*********************************************************
    MV-1100/MV-1300/MV-1350 general control Function prototypes
**********************************************************}
Function   MV1SetDigCameraDataPacking(p:BYTE):INTEGER;stdcall;
Function   MV1GetDigCameraDataPacking(p:pBYTE ):INTEGER;stdcall;


{*********************************************************
    MV-1100 control Function prototypes
**********************************************************}
Function   MV1SetDigCameraConfig(p:pMV1CamConfig  ):INTEGER;stdcall;
Function   MV1SetDigCameraControl(p1 :dword; p2:BYTE):INTEGER;stdcall;
Function   MV11SetPulseGenerator(P:BYTE):INTEGER;stdcall;
Function   MV11TriggerPulseGen:INTEGER;stdcall;
Function   MV11SetCameraWorkingMode(p:BYTE):INTEGER;stdcall;
Function   MV11SetPulseGenMode(p:BYTE):INTEGER;stdcall;
Function   MV11SetLSExpReduction(p1 : longint;p2:longint) :INTEGER;stdcall;
Function   MV1SelectTimGenHGatePolarity(p:integer):INTEGER;stdcall;
Function   MV1SetExSyncAuto:INTEGER;stdcall;

{*********************************************************
    MV-13x0 control Function prototypes
**********************************************************}
Function   MV1SetColorModuleConfig(p:pMV1CamConfig  ):INTEGER;stdcall;
Function   MV1SetColorModuleControl(p1:dword; p2:BYTE):INTEGER;stdcall;
Function   MV1GetColorModuleControl(p1:dword; p2:pBYTE ):INTEGER;stdcall;


{*************************************************
    Line Scan Camera function code definitions
**************************************************}

Function MV1SetLineScanCameraControl(p1:dword; p2: BYTE) :INTEGER;stdcall;


{*********************************************************
    Image file access function prototypes
**********************************************************}

Function      MV1InquireBMPVals(p1:pchar; p2:pUword; p3:pUWORD ; p4:pUWORD ):INTEGER;stdcall;
Function      MV1BMPLoad(p1:pchar; p2:pMV1Frame ):INTEGER;stdcall;
Function      MV1BMPSave(p1:pchar; p2:pMV1Frame ):INTEGER;stdcall;
Function      MV1BMPfile2Memory(p1:pchar; p2:LONGINT ; p3:LONGINT ; p4:LONGINT ; p5:LONGINT ;
                            p6:LONGINT ; P7:POINTER ):INTEGER;stdcall;
Function      MV1Memory2BMPfile(p1:pchar; p2:LONGINT ; p3:LONGINT ; p4:LONGINT ; p5:LONGINT ;
                            p6:LONGINT; P7:BYTE; P8 : POINTER ) :INTEGER;stdcall;
Function      MV1InquireTGAVals(p1:pchar; P2:PUWORD ; p3:pUWORD ; p4:pUWORD ):INTEGER;stdcall;
Function      MV1TGALoad(p1:pchar; p2:pMV1Frame ):INTEGER;stdcall;
Function      MV1TGASave(p1:pchar; p2:pMV1Frame ):INTEGER;stdcall;
Function      MV1TGAfile2Memory(p1:pchar; p2:LONGINT ;p3:LONGINT ; p4:LONGINT ; p5:LONGINT ;
                            p6:LONGINT ; P7:POINTER) :INTEGER;stdcall;
Function      MV1Memory2TGAfile(p1:pchar; p2:LONGINT ; p3:LONGINT ; p4:LONGINT ; p5:LONGINT ;
                            p6:LONGINT ; P7:BYTE; p8:pointer ):INTEGER;stdcall;
Function      MV1InquireTIFFVals(p1:pchar; P2:PUWORD ; p3:pUWORD ; p4:pUWORD ):INTEGER;stdcall;
{Function      MV1InquireTIFFHeaderInfo( p1:pchar; p2:pMV1TIFFHeaderInfo ):INTEGER;stdcall;}
Function      MV1TIFFLoad(p1:pchar; p2:pMV1Frame  ):INTEGER; stdcall;
Function      MV1TIFFSave(p1:pchar; p2:pMV1Frame ):LongInt; stdcall;
Function      MV1TIFFfile2Memory(p1:pchar; p2:LONGINT; p3:LONGINT; p4:LONGINT; p5:LONGINT;
                            p6:LONGINT; p7:pointer):INTEGER;stdcall;
Function      MV1Memory2TIFFfile(p1:pchar; p2:LONGINT; p3:LONGINT; p4:LONGINT; p5:LONGINT;
                            p6:LONGINT; p7:byte; p8:pointer):INTEGER;stdcall;




implementation

const
 MV1FIL_DLL = 'MV1APP95';

Function   MV1Open:longint; EXTERNAL MV1FIL_DLL;
Function   _MV1Open( P1: dWORD):longint; EXTERNAL MV1FIL_DLL;


Function   MV1Close:longint; EXTERNAL MV1FIL_DLL;
Function   MV1Init(MV1CamConfig:pointer; MV1InitCFG:pointer):longint; EXTERNAL MV1FIL_DLL;
Function   MV1SDKVersion:INTEGER; EXTERNAL MV1FIL_DLL;
Procedure  MV1GetMV1000RootPath( P:Pchar;p2:integer) ; EXTERNAL MV1FIL_DLL;

{*********************************************************
    Board control Function prototypes
**********************************************************}
Function   MV1SetCurrentBoard( p : dword):longint; EXTERNAL MV1FIL_DLL;
Function   MV1GetCurrentBoard:INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetCurrentCamera(p : dword):INTEGER; EXTERNAL MV1FIL_DLL;
Function   MV1SelectPixelMode(p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1InquirePixelBits :INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SelectTransferMode(p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1InquireBoard(p:pMV1Info  ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1InquirePixelMode:INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1MemWrapEnable(p : BYTE):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1MemWrapDisable:INTEGER;  EXTERNAL MV1FIL_DLL;

{********************************************************
    Camera control Function prototype
**********************************************************}
Function   MV1SelectSTDCameraConfig(p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetCameraConfig(p:pMV1CamConfig  ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1InquireCameraConfig(p:pMV1CamConfig ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1LoadCameraConfigFile(p1:Pchar; p2:pchar):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetPLLControl(p1 :integer; p2: pMV1PLLSyncCtl ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1GetPLLControl(p:pMV1PLLSyncCtl ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetTimGen(p:pMV1CameraDrive ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1GetTimGen(p:pMV1CameraDrive ):INTEGER;  EXTERNAL MV1FIL_DLL;
Procedure  MV1ParseCamConfig(p1:pMV1CamConfig; p2 :pchar ; p3:pchar; p4 :pointer) ;  EXTERNAL MV1FIL_DLL;
Function   MV1SaveCameraConfigFile(p1:pMV1CamConfig ;p2:pchar; p3:pchar):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetCVideoSource(p:dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetCSyncSource(p:dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SelectClockSource(p:dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SelectSyncStripRange(p:dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SelectADConvertor(p:dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetPLLphaseTrim(p:dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetPLLPhaseDetector(p:dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetDigitizeLevel(p1:dword; p2:dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SelectClamping(p:dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetClampLevel(p:dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetDCCoupledOffsetLevel(p:dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1GetOffset: single;  EXTERNAL MV1FIL_DLL;
Function   MV1GetOffsetRange(p1:psingle ; p2:psingle ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetOffset(p : single):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1GetGain: single;  EXTERNAL MV1FIL_DLL;
Function   MV1GetGainRange(p1:psingle ; p2:psingle ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetGain(p : single):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetExtTriggerMode(p :dword; p2:dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1WaitExtTrigger:INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SelectSyncOutput(p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1RdVSyncInfo:INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetHighFreqBoost(bscale:dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetFilterCutoff(p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1GeneralAccessOut(p1 : dword; p2 : dword; p3 : Pointer ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1GeneralAccessIn(p1 : dword;p2 : dword; p3 : Pointer):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1CheckCableConflicts(p:pMV1CamConfig):INTEGER;  EXTERNAL MV1FIL_DLL;

{*********************************************************
    Video control Function prototype
**********************************************************}
Function   MV1SetScaleFactor(p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetVScaleFactor(p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetHScaleFactor(p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetGeneralPurposeBit(p :BYTE) :INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1ResetGeneralPurposeBit(p:BYTE) :INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1EnableEQRemove:INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1DisableEQRemove:INTEGER;  EXTERNAL MV1FIL_DLL;


{**********************************************************
    Grab Function prototypes
***********************************************************}
Function   MV1SetGrabWindow(p1:longint; p2:longint; p3:longint; p4:longint; p5:longint; p6: pMV1GrabWindow ):longint;   EXTERNAL MV1FIL_DLL;
Function   MV1StartGrab(p1 : dword; p2 : dword):longint;  EXTERNAL MV1FIL_DLL;
Function   MV1StartGrabField(p1 : dword; p2 : dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1StopGrab:INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1GrabField(frame :pMV1Frame; p2:dword; p3:pointer ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1GrabField2DIBitmap(frame :pMV1Frame; p2:dword; p3:pointer ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1InquireGrabWindowSize(p1: pULONG ; p2: pULONG ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1InquireMaxGrabWindowSize(p1:pULONG ; p2: pULONG ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1InquireCVideoSource:INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1GetCurrentGrabLineCounter: Longint ;  EXTERNAL MV1FIL_DLL;


{**********************************************************
    Master Mode Transfer Function prototypes
***********************************************************}
Function   MV1SetMasterModeTransfer(p1:pMV1Frame; p2 : pointer; p3:longint; p4: BYTE):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetMasterModeTransferField(p1:pMV1Frame; p2 : pointer; p3:longint; p4: BYTE):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetMasterModeTransfer2Peripheral(p1:pMV1Frame; p2 : pointer; p3:longint; p4: BYTE):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetMasterCtlId(p : integer):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1StartMasterModeTransfer:INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1StopMasterModeTransfer:INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1LockMasterBuffer(p1 : pointer; p2:longint):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1UnlockMasterBuffer(p1 : pointer; p2:longint):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetMasterModeTransfer2Screen(p1 :pMV1Frame ; p2:dword; p3:longint;
                           p4:longint; p5:longint; p6:longint; p7:longint; p8:longint; p9:BYTE; p10 :pointer ):INTEGER;  EXTERNAL MV1FIL_DLL;




{**********************************************************
    Memory access control Function prototypes
***********************************************************}
Function   MV1SetMask(p1 : dword; p2 : dword):INTEGER;   EXTERNAL MV1FIL_DLL;
Function   MV1EnableMask(p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1DisableMask(p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;

{**********************************************************
    Hardware Interrupt control Function prototypes
***********************************************************}
Function   MV1IRQEnable (p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1IRQDisable(p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1IRQReset  (p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1IRQStatus (p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;

{**********************************************************
    user Interrupt control Function prototypes         (for NT)
***********************************************************}

Function  MV1ConnectInterruptToCallback(p1 : integer; callbackfunction:pointer; o3: integer):INTEGER;  EXTERNAL MV1FIL_DLL;
Function  MV1DisconnectInterruptCallback(p:integer):INTEGER;  EXTERNAL MV1FIL_DLL;
Procedure MV1InterruptProcessed( p:dword);  EXTERNAL MV1FIL_DLL;

{**********************************************************
    Frame access Function prototypes
***********************************************************}
Function   MV1CreateFrame(p1:pMV1Frame; p2:longint; p3:longint; p4:longint; p5:longint; p6:pMV1GrabWindow ):longint;  EXTERNAL MV1FIL_DLL;
Function   MV1FrameFill(p1:pMV1Frame; p2:longint; p3:longint; p4:longint; p5:longint; P6:dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1FrameLineRead(p1:pMV1Frame; p2:longint; p3:longint; p4:longint; P5:POINTER):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1FrameLineWrite(p1:pMV1Frame; p2:longint; p3:longint; p4:longint; P5:POINTER ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1FrameRead(p1:pMV1Frame; p2:longint; p3:longint; p4:longint;P5:LONGINT; P6:POINTER ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1FrameWrite(p1:pMV1Frame; p2:longint; p3:longint; p4:longint;P5:LONGINT; P6:POINTER ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1FrameReadField(p1:pMV1Frame; p2:dword; p3:pointer):INTEGER;  EXTERNAL MV1FIL_DLL;


Function   MV1FrameRead2DIBitmap(p1:pMV1Frame ; p2:pointer ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1FrameRead2DDBHandle(p1:pMV1Frame ; p2: THandle):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1FrameLineRead2DCI(p1:MV1Frame ; p2:longint;
                                p3:longint; p4:longint; p5:dword; p6:longint):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetMasterModeTransfer2DIBitmap(p1:pMV1Frame; p2:pointer; p3:longint; p4:BYTE):INTEGER;  EXTERNAL MV1FIL_DLL;
{ for backward compatability}
Function   MV1SetMasterModeTransfer2DIB(p1:MV1Frame; p2:pointer; p3:longint; p4:BYTE):INTEGER;  EXTERNAL MV1FIL_DLL;

{*********************************************************
    LUT control Function prototypes
**********************************************************}
Function MV1SetLUTMode(lmodeL :dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function MV1SelectLUTBank(lbank:dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function MV1LUTWrite(p1:dword; p2:dword; p3:pULONG ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function MV1LUTRead(p1:dword; p2:dword; p3:pULONG ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function MV1LoadLUTDefault(p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function MV1LoadLUTDefault8Bit(p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function MV1LoadLUTPassThrough(p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function MV1LoadLUTDefault10Bit(p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;
Function MV1LoadLUTDefault10to8Bit(p : dword):INTEGER;  EXTERNAL MV1FIL_DLL;

{*********************************************************
    color conversion Function prototype
**********************************************************}
{

 not or now

void MTPROCALL MV1Yuv2RgbCCIR601_422(ULONG *, ULONG *, ULONG);
 MV1Yuv2Rgb32bitCCIR601_422 MV1Yuv2RgbCCIR601_422

void MTPROCALL MV1Yuv2RgbCCIR601_YYUV(ULONG *, ULONG *, ULONG);
 MV1Yuv2Rgb32bitCCIR601_YYUV MV1Yuv2RgbCCIR601_YYUV

}

Procedure  MV1Rgb2YCCIR601(p1:pULONG; p2:pULONG ; p3:pULONG; p4:BYTE);  EXTERNAL MV1FIL_DLL;
Procedure  MV1Rgb2YuvCCIR601_422(p1:pULONG ; p2:pULONG ; p3:longint);  EXTERNAL MV1FIL_DLL;
Procedure  MV1Yuv2Rgb24bitCCIR601_422(p1:pULONG ; p2:pULONG ; p3:longint);  EXTERNAL MV1FIL_DLL;
Procedure  MV1Yuv2Rgb24bitDIBCCIR601_422(p1:pULONG ; p2:pULONG ; p3:dword; p4:dword);  EXTERNAL MV1FIL_DLL;

{*********************************************************
    Capture synchronization control function prototypes
**********************************************************}
Function   MV1WaitVSync:INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1WaitFrameEnd:longint;  EXTERNAL MV1FIL_DLL;
Function   MV1IsFrameEnd:INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1WaitGrabDone:INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SkipFrames(p1:integer; p2 :dword) :INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1InquireField :INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1ReadFieldLineCounter: dword;  EXTERNAL MV1FIL_DLL;


{*********************************************************
    MV-1100/MV-1300/MV-1350 general control Function prototypes
**********************************************************}
Function   MV1SetDigCameraDataPacking(p:BYTE):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1GetDigCameraDataPacking(p:pBYTE ):INTEGER;  EXTERNAL MV1FIL_DLL;


{*********************************************************
    MV-1100 control Function prototypes
**********************************************************}
Function   MV1SetDigCameraConfig(p:pMV1CamConfig  ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetDigCameraControl(p1 :dword; p2:BYTE):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV11SetPulseGenerator(P:BYTE):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV11TriggerPulseGen:INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV11SetCameraWorkingMode(p:BYTE):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV11SetPulseGenMode(p:BYTE):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV11SetLSExpReduction(p1 : longint;p2:longint) :INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SelectTimGenHGatePolarity(p:integer):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetExSyncAuto:INTEGER;  EXTERNAL MV1FIL_DLL;

{*********************************************************
    MV-13x0 control Function prototypes
**********************************************************}
Function   MV1SetColorModuleConfig(p:pMV1CamConfig  ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1SetColorModuleControl(p1:dword; p2:BYTE):INTEGER;  EXTERNAL MV1FIL_DLL;
Function   MV1GetColorModuleControl(p1:dword; p2:pBYTE ):INTEGER;  EXTERNAL MV1FIL_DLL;


{*************************************************
    Line Scan Camera function code definitions
**************************************************}

Function MV1SetLineScanCameraControl(p1:dword; p2: BYTE) :INTEGER;  EXTERNAL MV1FIL_DLL;


{*********************************************************
    Image file access function prototypes
**********************************************************}

Function      MV1InquireBMPVals(p1:pchar; p2:pUWORD; p3:pUWORD ; p4:pUWORD ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function      MV1BMPLoad(p1:pchar; p2:pMV1Frame ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function      MV1BMPSave(p1:pchar; p2:pMV1Frame ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function      MV1BMPfile2Memory(p1:pchar; p2:LONGINT ; p3:LONGINT ; p4:LONGINT ; p5:LONGINT ;
                            p6:LONGINT ; P7:POINTER ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function      MV1Memory2BMPfile(p1:pchar; p2:LONGINT ; p3:LONGINT ; p4:LONGINT ; p5:LONGINT ;
                            p6:LONGINT; P7:BYTE; P8 : POINTER ) :INTEGER;  EXTERNAL MV1FIL_DLL;

Function      MV1InquireTGAVals(p1:pchar; P2:PUWORD ; p3:pUWORD ; p4:pUWORD ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function      MV1TGALoad(p1:pchar; p2:pMV1Frame ):INTEGER;  EXTERNAL MV1FIL_DLL;

Function      MV1TGASave(p1:pchar; p2:pMV1Frame ):INTEGER;  EXTERNAL MV1FIL_DLL;

Function      MV1TGAfile2Memory(p1:pchar; p2:LONGINT ;p3:LONGINT ; p4:LONGINT ; p5:LONGINT ;
                            p6:LONGINT ; P7:POINTER) :INTEGER;  EXTERNAL MV1FIL_DLL;

Function      MV1Memory2TGAfile(p1:pchar; p2:LONGINT ; p3:LONGINT ; p4:LONGINT ; p5:LONGINT ;
                            p6:LONGINT ; P7:BYTE; p8:pointer ):INTEGER;  EXTERNAL MV1FIL_DLL;

Function      MV1InquireTIFFVals(p1:pchar; P2:PUWORD ; p3:pUWORD ; p4:pUWORD ):INTEGER;  EXTERNAL MV1FIL_DLL;

{Function      MV1InquireTIFFHeaderInfo( p1:pchar; p2:pMV1TIFFHeaderInfo ):INTEGER;  EXTERNAL MV1FIL_DLL;}
Function      MV1TIFFLoad(p1:pchar; p2:pMV1Frame  ):INTEGER;  EXTERNAL MV1FIL_DLL;
Function      MV1TIFFSave(p1:pchar; p2:pMV1Frame ):longint;  EXTERNAL MV1FIL_DLL;
Function      MV1TIFFfile2Memory(p1:pchar; p2:LONGINT; p3:LONGINT; p4:LONGINT; p5:LONGINT;
                            p6:LONGINT; p7:pointer):INTEGER;  EXTERNAL MV1FIL_DLL;

Function      MV1Memory2TIFFfile(p1:pchar; p2:LONGINT; p3:LONGINT; p4:LONGINT; p5:LONGINT;
                            p6:LONGINT; p7:byte; p8:pointer):INTEGER;  EXTERNAL MV1FIL_DLL;


end.;
Function   MV1GetDigCameraDataPacking(p:pBYTE ):INTEGER;  EXTERNAL MV1FIL_DLL;


{***********************************************************************}
