#ifdef __cplusplus
extern "C" {
#endif

enum {
    ERR_NoError,
    ERR_BoardNoInit,
    ERR_InvalidBoardNumber,
    ERR_InitializedBoardNumber,
    ERR_BaseAddressError,
    ERR_BaseAddressConflict,
    ERR_DuplicateBoardSetting,
    ERR_DuplicateIrqSetting,
    ERR_PortError,
    ERR_ChannelError,
    ERR_InvalidADChannel,
    ERR_InvalidDAChannel,
    ERR_InvalidDIChannel,
    ERR_InvalidDOChannel,
    ERR_InvalidDIOChannel,
    ERR_InvalidIRQChannel,
    ERR_InvalidDMAChannel,
    ERR_InvalidChangeValue,
    ERR_InvalidTimerValue,
    ERR_InvalidTimerMode,
    ERR_InvalidCounterValue,
    ERR_InvalidCounterMode,
    ERR_InvalidADMode,
    ERR_InvalidMode,
    ERR_NotOutputPort,
    ERR_NotInputPort,
    ERR_AD_DMANotSet,
    ERR_AD_INTNotSet,
    ERR_AD_AquireTimeOut,
    ERR_AD_InvalidGain,
    ERR_INTNotSet,
    ERR_TotalErrorCount,
    ERR_PCIBiosNotExist,
    ERR_PCIIrqNotExist,
    ERR_PCICardNotExist
};

typedef unsigned char   U8;
typedef short           I16;
typedef unsigned short  U16;
typedef long            I32;
typedef unsigned long   U32;
typedef float           F32;
typedef double          F64;
typedef char            Boolean;

#define MAX_PCI_CARDS   10

/****************************************************************************/
/*      Function  Declerations                                              */
/****************************************************************************/

 U16  PASCAL W_8133_Initial(int card_number);
 U16  PASCAL W_8133_Close(int card_number);
void PASCAL W_8133_Software_Reset(U16 cardNo);

/*-------------------------------------------------------------------------*/
 U16  PASCAL W_8133_DO( U16 cardNo, U16  doData);
 U16  PASCAL W_8133_DI( U16 cardNo, U16 *diData);
 U16  PASCAL W_8133_Read_Cnt( U16 cardNo, U16 CntNo, U16 *CntData);
 U16  PASCAL W_8133_Read_Index( U16 cardNo, U16 IndexNo, U16 *IndexData);
 U16  PASCAL W_8133_Read_Status( U16 cardNo, U16 *Status);
 U16  PASCAL W_8133_CLR_IdxLah( U16 cardNo, U16 IndexNo);
 U16  PASCAL W_8133_ModeSelect( U16 cardNo, U16 Mode);
 U16  PASCAL W_8133_Set_Int0Perd( U16 cardNo, U16 Int0Perd);
 U16  PASCAL W_8133_Set_Int1Perd( U16 cardNo, U16 Int1Perd);
 U16  PASCAL W_8133_Set_PWMPerd( U16 cardNo, U16 PWMNo, U16 PWMPerd);

/*-------------------------------------------------------------------------*/
 void PASCAL W_8133_Set_INT_Control(U16 cardNo, U16 int1Flag, U16 int2Flag);
 void PASCAL W_8133_Set_INT_Polarity( U16 cardNo, U16 int1pol, U16 int2pol );
 void PASCAL W_8133_Get_IRQ_Status(U16 cardNo,U16 *int1Status, U16 *int2Status);
 void PASCAL W_8133_Get_IRQ_Channel(U16 cardNo, U16 *irq_no );
 void PASCAL W_8133_CLR_IRQ0( U16 cardNo );
 void PASCAL W_8133_CLR_IRQ1( U16 cardNo );

 U16  PASCAL W_8133_INT_Enable(U16 cardNo,HANDLE *hEvent);
 U16  PASCAL W_8133_INT_Disable(U16 cardNo);

#ifdef __cplusplus
}
#endif
