
#ifdef __cplusplus
extern "C" {
#endif

typedef int (CALLBACK * PAC_CALLBACK_FUNC)();

#define NoError			0
#define ID_ERROR		-1
#define SLOT_ERROR		-2
#define CHANNEL_ERROR		-3
#define GAIN_ERROR		-4
#define FIFO_EMPTY		-5
#define FIFO_LATCHED		-6
#define FIFO_OVERFLOW		-7
#define TX_NOTREADY		-8
#define FIFO_ISR_ERROR		-9
#define REG_SLOT_ISR_ERROR	-100
#define MAX_FIFO		4096


#define i9014_Init                   i8014W_Init
#define i9014_GetLibVersion          i8014W_GetLibVersion
#define i9014_GetFirmwareVer_L1      i8014W_GetFirmwareVer_L1
#define i9014_GetFirmwareVer_L2      i8014W_GetFirmwareVer_L2
#define i9014_GetSingleEndJumper     i8014W_GetSingleEndJumper
#define i9014_ReadGainOffset         i8014W_ReadGainOffset
#define i9014_Calibrate_CH_mA_Hex    i8014W_Calibrate_CH_mA_Hex 
#define i9014_Calibrate_CH_mA        i8014W_Calibrate_CH_mA
#define i9014_CalibrateDataHex       i8014W_CalibrateDataHex
#define i9014_CalibrateData          i8014W_CalibrateData
#define i9014_ReadAIHex              i8014W_ReadAIHex
#define i9014_ReadAI                 i8014W_ReadAI
#define i9014_ClearFIFO              i8014W_ClearFIFO
#define i9014_UnLockFIFO             i8014W_UnLockFIFO
#define i9014_ConfigMagicScan        i8014W_ConfigMagicScan
#define i9014_StartMagicScan         i8014W_StartMagicScan
#define i9014_StopMagicScan          i8014W_StopMagicScan
#define i9014_Set_FIFO_Limit         i8014W_Set_FIFO_Limit  
#define i9014_ReadFIFO               i8014W_ReadFIFO
#define i9014_ReadFIFO_BlockMode     i8014W_ReadFIFO_BlockMode 
#define i9014_ReadFIFO_InISR         i8014W_ReadFIFO_InISR
#define i9014_InstallMagicScanISR    i8014W_InstallMagicScanISR 
#define i9014_UnInstallMagicScanISR  i8014W_UnInstallMagicScanISR
#define i9014_ClearInt               i8014W_ClearInt 


short i8014W_Init(int slot);
short i8014W_GetLibVersion(void);
//void i8014W_GetLibDate(char libDate[]);
short i8014W_GetFirmwareVer_L1(int slot);
short i8014W_GetFirmwareVer_L2(int slot);
short i8014W_GetSingleEndJumper(int slot);
void i8014W_ReadGainOffset(int slot,int gain,unsigned short* gainValue, short* offsetValue);

// for I-8014CW only
void i8014W_Read_mA_GainOffset(int slot,int ch ,unsigned short* GainValue, short* offsetValue);
void i8014W_Calibrate_CH_mA_Hex(int slot, int ch ,short dataFromFIFO, short* calibratedAI);
void i8014W_Calibrate_CH_mA(int slot, int ch ,short dataFromFIFO, float* calibratedAI);

// for I-8014
//void i8014W_CalibrateDataHex(int slot, short iGain,short dataFromFIFO, short* calibratedAI);
void i8014W_CalibrateDataHex(int slot, int iGain,short dataFromFIFO, short* calibratedAI);
void i8014W_CalibrateData(int slot, int iGain,short dataFromFIFO, float* calibratedAI);

short i8014W_ReadAIHex(int slot,int ch,int gain, short* hVal);
short i8014W_ReadAI(int slot,int ch,int gain, float* fVal);
void i8014W_ClearFIFO(int slot);
void i8014W_UnLockFIFO(int slot);
void i8014W_ConfigMagicScan(int slot,int chArr[],int gainArr[],int scanChCount, float sampleRate,int scanMode,int triggerSource,int triggerState, float* realSampleRate);

short i8014W_StartMagicScan(int slot);
short i8014W_StopMagicScan(int slot);
short i8014W_Set_FIFO_Limit(int slot, short limit);
short i8014W_ReadFIFO(int slot, short hexData[], short readCount,short* dataCountFromFIFO);// <=== get data from FIFO ,long* dataCnt
short i8014W_ReadFIFO_BlockMode(int slot, short hexData[], long readCount ,long* dataCountFromFIFO);
short i8014W_ReadFIFO_InISR(int slot, int hexData[], short triggerLevel,int* dataCountFromFIFO);


// API for magic scan isr function
short i8014W_InstallMagicScanISR(int slot,void (*isr)(int slot),short triggerLevel); //<=== give a callback function for interrupt
short i8014W_UnInstallMagicScanISR(int slot); //<=== give a callback function for interrupt 
void i8014W_ClearInt(int slot);

#ifdef __cplusplus
}
#endif

