#ifndef _IMC_API_H_
#define _IMC_API_H_

#ifndef _DLL_API  
#define _DLL_API extern "C" _declspec(dllexport)  
#else  
#define _DLL_API _declspec(dllimport)  
#endif 

#define MAX_CARD_NUM    4

/*==========================================================================*/
/*----             DATA TYPE DEFINE                                      ---*/
/*==========================================================================*/ 
typedef unsigned char        UINT8;
typedef short                INT16;
typedef unsigned short       UINT16;
typedef int                  INT32;
typedef unsigned int         UINT32;
typedef long long            INT64;
typedef unsigned long long   UINT64;

/*==========================================================================*/
/*----             DATA STRUCT DEFINE                                    ---*/
/*==========================================================================*/
typedef struct
{
  INT16 terminalexist;  // 端子板是否连接
  INT16 axNum;          // ECAT 总线的所有轴数
  INT16 diNum;          // ECAT 总线上DI 资源
  INT16 doNum;          // ECAT 总线上DO 资源
  INT16 adNum;          // ECAT 总线上AD 资源
  INT16 daNum;          // ECAT 总线上DA 资源
  INT16 encNum;         // ECAT 总线上ENC资源
} TRsouresNum;

typedef struct
{
  double bgVel;       // 起始速度值   指令单位/s
  double maxVel;      // 最大速度     指令单位/s
  double maxAcc;      // 最大加速度   指令单位/s^2
  double maxDec;      // 最大减速度   指令单位/s^2
  double maxJerk;     // 最大加加速度   指令单位/s^3
  double stopDec;     // 平滑停止减速度 指令单位/s^2
  double eStopDec;    // 急停减速度   指令单位/s^2
}TMtPara;

typedef struct
{
  INT16 arrivalBand;      // 到位误差 pulse
  INT16 arrivalTime;      // 到位保持时间 ms
  INT32 errorLmt;         // 最大跟随误差 pulse
  INT32 softPosLimitPos;  // 软正限位 pulse
  INT32 softNegLimitPos;  // 软负限位 pulse
}TAxAttriPara;

typedef struct
{
  INT16 alarmEn;    // 报警是否有效标志
  INT16 softLmtEn;  // 软限位是否有效标志
  INT16 hwLmtEn;    // 硬限位是否有效标志
  INT16 errorLmtEn; // 跟随误差是否检查标志
}TAxCheckEn;


// 采集数据类型
// 单轴数据类型
#define SAMPLE_ADDRESS_TYPE_AX_PRF_POS			(0x01)
#define SAMPLE_ADDRESS_TYPE_AX_ENC_POS			(0x02)
#define SAMPLE_ADDRESS_TYPE_AX_PRF_VEL			(0x03)
#define SAMPLE_ADDRESS_TYPE_AX_ENC_VEL			(0x04)
#define SAMPLE_ADDRESS_TYPE_AX_PRF_ACC			(0x05)
#define SAMPLE_ADDRESS_TYPE_AX_ENC_ACC			(0x06)

#define SAMPLE_ADDRESS_TYPE_PRF_POS				(0x07)
#define SAMPLE_ADDRESS_TYPE_PRF_POS1			(0x08)
#define SAMPLE_ADDRESS_TYPE_PRF_POS2			(0x09)

#define SAMPLE_ADDRESS_TYPE_AX_TORQ             (0x0a)

// 0x100 - 0x1FF (插补选项)
#define SAMPLE_ADDRESS_TYPE_CRD1_POSX			(0x100)
#define SAMPLE_ADDRESS_TYPE_CRD1_POSY			(0x101)
#define SAMPLE_ADDRESS_TYPE_CRD1_POSZ			(0x102)
#define SAMPLE_ADDRESS_TYPE_CRD1_VEL			(0x103)

#define SAMPLE_ADDRESS_TYPE_CRD2_POSX			(0x150)
#define SAMPLE_ADDRESS_TYPE_CRD2_POSY			(0x151)
#define SAMPLE_ADDRESS_TYPE_CRD2_POSZ			(0x152)
#define SAMPLE_ADDRESS_TYPE_CRD2_VEL			(0x153)

#define SAMPLE_ADDRESS_TYPE_CRD3_POSX           (0x200)
#define SAMPLE_ADDRESS_TYPE_CRD3_POSY           (0x201)
#define SAMPLE_ADDRESS_TYPE_CRD3_POSZ           (0x202)
#define SAMPLE_ADDRESS_TYPE_CRD3_VEL            (0x203)

#define SAMPLE_ADDRESS_TYPE_CRD4_POSX           (0x250)
#define SAMPLE_ADDRESS_TYPE_CRD4_POSY           (0x251)
#define SAMPLE_ADDRESS_TYPE_CRD4_POSZ           (0x252)
#define SAMPLE_ADDRESS_TYPE_CRD4_VEL            (0x253)


#define SAMPLE_TRIG_IMMEDIATE   (0) // 立即采集
#define SAMPLE_TRIG_DELAY       (1) // 延时采集
#define SAMPLE_TRIG_LOCAL_DI    (2) // 本地DI触发
#define SAMPLE_TRIG_ECAT_DI     (3) // ECAT 的DI 触发
typedef struct
{
  INT16 interval;       // 采样时间间隔
  INT16 trigType;       // 触发采样类型：0 立即 1 延时 2 本地di 3 ECAT di
  INT16 delay;          // 延时时间 ms
  INT16 diNo;           // di输入号
  INT16 diLevel;        // di的触发输入值 0或1
}TSamplePara;

typedef struct
{
  INT16 homeMethod;     // 回原点方法
  INT32 offset;         // 回原点后的零点偏执 pulse
  UINT32 highVel;       // 高速搜索减速点速度 pulse/s
  UINT32 lowVel;        // 搜索原点低 pulse/s
  UINT32 acc;           // 加速度 pulse/s^2
  UINT32 overtime;      // 超时时间 ms
  INT16  posSrc;        // 仅对端子板轴回零有效，ECAT 轴无效
}THomingPara;

typedef struct
{
	INT16 homeMethod;     // 回原点方法
	double offset;         // 回原点后的零点偏执 unit
	double highVel;       // 高速搜索减速点速度 unit/s
	double lowVel;        // 搜索原点低 unit/s
	double acc;           // 加速度 unit/s^2
	UINT32 overtime;      // 超时时间 ms
	INT16  posSrc;        // 仅对端子板轴回零有效，ECAT 轴无效
}THomingParaInUint;

#define HOME_IN_PROGRESS              (0)     // 正在回零中
#define HOME_INTERRUPTED_OR_NOT_START (1)     // 回零中断或者没有开始启动
#define HOME_ATTAINED_BUT_NOT_REACH   (2)     // 回零结束，但没有到设定的目标位置
#define HOME_SUCESS                   (3)     // 回零成功
#define HOME_ERR_VEL_NOT_ZERO         (4)     // 回零中发生错误，同时速度不为0 
#define HOME_ERR_VEL_ZERO             (5)     // 回零中发生错误，同时速度为0


//crd高级参数结构体
typedef struct
{
  INT16 userVelMode;          // 用户速度规划模式：0 系统前瞻速度规划，1 用户设定速度规划(默认：0)
  INT16 transMode;            // 过渡模式 0：无过渡 1：圆弧过渡 （默认:1）
  INT16 noDataProtect;        // 数据断流保护：0不保护，1保护 （默认：1）
  INT16 circAccChangeEn;      // 圆弧变加速使能：0不变加速，1变加速 （默认：0） 
  INT16 noCoplaneCircOptm;    // 异面圆弧优化：0不开启，1开启
  double turnCoef;            // 拐弯系数: [0.01~50]（默认：1.0）
  double tol;                 // 插补精度: 大于0的值（默认：0 ，单位取决于设置的当量）
}TCrdAdvParam;

typedef struct
{
  double masterScale;		// 主轴齿数
  double slaveScale;		// 从轴齿数
  INT16 masterNo;			// 主轴轴号
  INT16 masterType;			// 主轴类型
  INT16 dirMode;			// 方向模式
  INT32 masterSlopeDis;		// 主轴离合区
}TGearParam;

typedef struct
{
	INT16 inType[2];		// 输入的类型：0表示物理输入 1表示虚拟输入
	INT16 inPortNo[2];		// 输入的端口号
	INT16 inInvert[2];		// 输入是否取反：0表示不取反 1表示取反
	INT16 inOperator;		// 输入操作符：0与操作 1或操作  2异或操作 3 单输入
	INT16 outType;			// 输出类型：0表示物理输出 1表示虚拟输出（虚拟输出一般作为其他单元的输入源）
	INT16 outPortNo;		// 输出端口
	INT16 outInvert;		// 输出取反：0表示不取反 1表示取反
	INT16 activeType;		// 生效的类型：0单次生效 1持续生效
    INT16 triggerType;      // 触发类型：0:电平触发 1：上升沿触发 2：下降沿触发
	INT16 delayTime;		// 延时输出的时间:ms
}TEventIO;


typedef struct
{
	INT16 inType;  				// 输入的类型：0表示物理输入 1表示虚拟输入
	INT16 inPortNo;				// 输入的端口号
	INT16 motionAxNo;			// 触发的运动轴号
	INT16 delay;				// 单位：ms
    INT16 motionType;           // 启停类型 0:PTP启动  1：Jog启动  2：平滑停止  3：急停  4：更新参数
    INT16 triggerType;          // 触发类型 0:电平触发（高电平） 1:上升沿触发 2：下降沿触发
    INT16 invertBit;			// 取反位，输入取反
	double tgtPos;				// 目标位置
	double tgtVel;				// 目标速度
	double acc;					// 加速度
	double dec;					// 减速度
}TEventDiMotion;


typedef struct
{
	INT16 inType;  				// 输入类型：0编码器 1规划位置
	INT16 portNo;				// 端口号
	INT16 outPortNo;			// DO输出端口号
	INT16 outVal;				// 输出电平值
	INT16 outType;				// 输出类型：0电平 1脉宽 2虚拟值（虚拟输出一般作为其他单元的输入源）
	INT16 cmpType;				// 比较的方式：0大于等于  1小于
	INT16 pulseWidth;			// 脉冲宽度
	double comparePos;			// 比较的位置
}TEventCompareOut;


typedef struct
{
    INT32 compareData[3];
}TMultiCmpData;

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      ECAT板卡主站状态 定义      
 说明：以下枚举针对IMC_GetECATMasterSts函数
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#define EC_MASTER_IDLE                  (0) // EtherCat主站尚未初始化
#define EC_MASTER_INIT                  (1) // EtherCat主站初始化
#define EC_MASTER_SCAN_SLAVE            (2) // EtherCat主站正在扫描从站设备
#define EC_MASTER_SCAN_SLAVE_END        (3) // EtherCat主站扫描从站设备结束
#define EC_MASTER_SCAN_MODULES          (4) // EtherCat主站正在扫描从站设备MODULES
#define EC_MASTER_SCAN_MODULES_END      (5) // EtherCat主站扫描从站设备MODULES结束
#define EC_MASTER_OP                    (6) // EtherCat主站进入OP状态
#define EC_MASTER_ERR                   (7) // EtherCat主站链路状态有错误


/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      ECAT板卡从站状态 定义      
 说明：以下枚举针对IMC_GetSlaveCurSts， IMC_GetSlaveReqSts函数
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#define EC_SLAVE_STATE_UNKNOWN          (0x00) // EtherCat从站在未知状态
#define EC_SLAVE_STATE_INIT             (0x01) // EtherCat从站在初始状态
#define EC_SLAVE_STATE_PREOP            (0x02) // EtherCat从站在PREOP状态
#define EC_SLAVE_STATE_BOOT             (0x03) // EtherCat从站在BOOT状态
#define EC_SLAVE_STATE_SAFEOP           (0x04) // EtherCat从站在SAVEOP状态
#define EC_SLAVE_STATE_OP               (0x08) // EtherCat从站在OP状态
#define EC_SLAVE_STATE_ACK_ERR          (0x10) // EtherCat从站有错误

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      ecat Error code 定义      
 说明：以下宏定义针对IMC_GetEcatErrCode函数,其他为内部错误
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#define ERROR_CODE_NO_SUCH_SLAVE                    (0x0003)      //配置阶段，没有这个从站,处理方法：检查从站是否掉线，重新扫描配置
#define ERROR_CODE_INVALID_PDO                      (0x0004)      //配置阶段，非法PDO,处理方法：检查从站厂家是否更新xml配置文件，与汇川默认配置不一致
#define ERROR_CODE_INVALID_SDO                      (0x0005)      //配置阶段，非法SDO,处理方法：检查从站厂家是否更新xml配置文件，与汇川默认配置不一致
#define ERROR_CODE_INVALID_ENTRY                    (0x0006)      //配置阶段，非法ENTRY,处理方法：检查从站厂家是否更新xml配置文件，与汇川默认配置不一致   
#define ERROR_CODE_PASECFGFAIL                      (0x000D)      //解析XML设备配置失败,处理方法：设备配置文件已经被破坏，重新扫描配置
#define ERROR_CODE_CFGREGISTFAIL                    (0x0015)      //配置reg失败,处理方法：检查从站厂家是否更新xml配置文件，与汇川默认配置不一致
#define ERROR_CODE_CFGDIFFONLINE                    (0x0016)      //在线从站与配置不一致,处理方法：检查从站是否掉线，重新扫描配置
#define ERROR_CODE_SLAVE_OFFLINE                    (0x001a)      //从站掉线错误，高8位为从站号，即bit[15:8]-轴号,处理方法：检查从高8位数字开始从站是否掉线，或者重新扫描配置  
#define ERROR_CODE_SDOBF_NONECAT                    (0x001b)      //SDO缓冲区收到非ECAT帧错误,处理方法：检查线路是否接错，是否有其他非Ethercat设备接入
#define ERROR_CODE_PORT0_NOTLINK                    (0x001c)      //端口未接ECAT设备错误,处理方法：检查板卡端线路是否正常接线，是否接线不可靠
#define ERROR_CODE_SET_CYCLETIME_PARA_ERR           (0x001e)      //设置周期时间参数错误,处理方法：错误的DC时钟配置，只支持125us,250us,500us,125us,1000us,2000us,4000us,8000us周期
#define ERROR_CODE_COE_SDO_INIT_ERR                 (0x001f)      //在初始化阶段coe配置错误,处理方法：检查从站厂家是否更新xml配置文件，与汇川默认配置不一致；或者可能例如RTU模块配置错误
#define ERROR_CODE_SLAVE_STATE_ERR                  (0x0020)      //从站状态错误，高8位为轴号，即bit[15:8]-轴号,处理方法：检查从高8位数字从站状态，检查从站设备异常原因。      
#define ERROR_CODE_SLAVE_SII_ERR                    (0x0037)      //E2ROM 信息有误,处理方法：一般为从站保存的e2rom信息有误，可以使用twincat确认并联系厂家。

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     abort code 定义      
 说明：以下宏定义针对IIMC_GetEcatSdo\IMC_SetEcatSdo函数      
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#define ABORT_CODE1			(0x05030000) //从站Toggle bit 没有变化
#define ABORT_CODE2			(0x05040000) //SDO 访问超时
#define ABORT_CODE3			(0x05040001) //客户端/服务器 命令非法或未知
#define ABORT_CODE4			(0x05040005) //内存溢出
#define ABORT_CODE5			(0x06010000) //不支持访问该对象
#define ABORT_CODE6			(0x06010001) //尝试去读一个只写对象
#define ABORT_CODE7			(0x06010002) //尝试去写一个只读对象
#define ABORT_CODE8			(0x06020000) //对象字典中不存在该对象
#define ABORT_CODE9			(0x06040041) //该对象不能映射成PDO
#define ABORT_CODE10		(0x06040042) //对象映射成PDO超出 PDO长度
#define ABORT_CODE11		(0x06040043) //通用参数非法
#define ABORT_CODE12		(0x06040047) //设备内不兼容
#define ABORT_CODE13		(0x06060000) //由于硬件原因访问失败
#define ABORT_CODE14		(0x06070010) //数据类型不匹配，长度参数
#define ABORT_CODE15		(0x06070012) //数据类型不匹配，长度太大
#define ABORT_CODE16		(0x06070013) //数据类型不匹配，长度太小
#define ABORT_CODE17		(0x06090011) //该对象子索引不存在
#define ABORT_CODE18		(0x06090030) //参数超出范围
#define ABORT_CODE19		(0x06090031) //参数超出范围太大
#define ABORT_CODE20		(0x06090032) //参数超出范围太小
#define ABORT_CODE21		(0x06090036) //最大值小于最小值
#define ABORT_CODE22		(0x08000000) //一般错误
#define ABORT_CODE23		(0x08000020) //数据不能被传输或被保存
#define ABORT_CODE24		(0x08000021) //数据不能被传输或被保存由于本地控制
#define ABORT_CODE25		(0x08000022) //数据不能被传输或被保存由于当前状态
#define ABORT_CODE26		(0x08000023) //缺乏对象字典或者对象字典创建失败

//-----------------------------------------------------------------------------
// 伺服操作模式
//-----------------------------------------------------------------------------
#define TQ_OP_MODE						(4)
#define HM_OP_MODE						(6)
#define CSP_OP_MODE						(8)
#define CSV_OP_MODE						(9)
#define CST_OP_MODE						(10)

//-----------------------------------------------------------------------------
// 回零模式
//-----------------------------------------------------------------------------
#define HOMING_MODE_CIA                 (0)
#define HOMING_MODE_TORQ                (1)
#define HOMING_MODE_ECAT_CSP            (2)

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     端子板专用IO的宏定义      
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#define SPECIAL_IO_RDY          (0)   // 准备完成信号
#define SPECIAL_IO_ARRIV        (1)   // 到位信号
#define SPECIAL_IO_ALARM        (2)   // 报警信号
#define SPECIAL_IO_POSLMT       (3)   // 正限位信号
#define SPECIAL_IO_NEGLMT       (4)   // 负限位信号
#define SPECIAL_IO_CLR          (5)   // 清除报警信号
#define SPECIAL_IO_SV         	(6)   // 伺服使能信号
#define SPECIAL_IO_HOME         (7)   // 回零输入信号
#define SPECIAL_IO_INDEX        (8)   // 电机Z相信号


/*==========================================================================*/
/*----             FUNCTION DEFINE                                       ---*/
/*==========================================================================*/

/*==========================================================================*/
/*----1.1 板卡的操作以及资源的获取接口                                   ---*/
/*==========================================================================*/

_DLL_API UINT32 IMC_GetCardsNum(INT32 *pCardsNum);
_DLL_API UINT32 IMC_OpenCard(INT32 cardNo, UINT64 *pCardHandle, INT32 blockFlag);
_DLL_API UINT32 IMC_CloseCard(UINT64 cardHandle);

_DLL_API UINT32 IMC_OpenCardHandle(INT32 cardNo, UINT64 *pCardHandle);
_DLL_API UINT32 IMC_ScanCardECAT(UINT64 cardHandle, INT32 blockFlag);
_DLL_API UINT32 IMC_GetECATMasterSts(UINT64 cardHandle,UINT32 *pStatus);
_DLL_API UINT32 IMC_ScanCard(UINT64 cardHandle, INT32 blockFlag);
_DLL_API UINT32 IMC_GetCardSts(UINT64 cardHandle,UINT32 *pStatus);
_DLL_API UINT32 IMC_CloseCardHandle(UINT64 cardHandle);

_DLL_API UINT32 IMC_GetCardResource(UINT64 cardHandle, TRsouresNum *pRsouresNum);

_DLL_API UINT32 IMC_UpLoadDeviceConfig(UINT64 cardHandle,const char *pathName);
_DLL_API UINT32 IMC_DownLoadDeviceConfig(UINT64 cardHandle,const char *pathName);
_DLL_API UINT32 IMC_DownLoadSystemConfig(UINT64 cardHandle, const char *pathName);
_DLL_API UINT32 IMC_GetIMC30G_VER(UINT64 cardHandle, const char *pathName);
_DLL_API UINT32 IMC_GetHwVer(UINT64 cardHandle, INT16 *pVer);

/*==========================================================================*/
/*----1.2 板卡的操作以及资源的获取接口                                   ---*/
/*==========================================================================*/

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----1.2.1 ECAT资源设置接口                                             ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_SetEcatGrpDiInverse(UINT64 cardHandle, INT16 groupNo, INT16 inverse);
_DLL_API UINT32 IMC_GetEcatGrpDiInverse(UINT64 cardHandle, INT16 groupNo, INT16 *pInverse);
_DLL_API UINT32 IMC_SetEcatGrpDoInverse(UINT64 cardHandle, INT16 groupNo, INT16 inverse);
_DLL_API UINT32 IMC_GetEcatGrpDoInverse(UINT64 cardHandle, INT16 groupNo, INT16 *pInverse);

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----1.2.2 端子板资源设置接口                                           ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_GetBoardWorkSts(UINT64 cardHandle, INT16 *pValue);
_DLL_API UINT32 IMC_SetLocalDiFilterTime(UINT64 cardHandle, INT16 diIndex, UINT16 *pFilterTime, INT16 count=1);
_DLL_API UINT32 IMC_GetLocalDiFilterTime(UINT64 cardHandle, INT16 diIndex, UINT16 *pFilterTime, INT16 count=1);
_DLL_API UINT32 IMC_SetLocalHmLmtPrbFilterTime(UINT64 cardHandle, INT16 homeFltTime, INT16 limitFltTime, INT16 probeFltTime);
_DLL_API UINT32 IMC_GetLocalHmLmtPrbFilterTime(UINT64 cardHandle, INT16 *pHomeFltTime, INT16 *pLimitFltTime, INT16 *pProbeFltTime);

#define SPECIAL_IO_RDY          (0)   // 准备完成信号
#define SPECIAL_IO_ARRIV        (1)   // 到位信号
#define SPECIAL_IO_ALARM        (2)   // 报警信号
#define SPECIAL_IO_POSLMT       (3)   // 正限位信号
#define SPECIAL_IO_NEGLMT       (4)   // 负限位信号
#define SPECIAL_IO_CLR          (5)   // 清除报警信号
#define SPECIAL_IO_SV         	(6)   // 伺服使能信号
#define SPECIAL_IO_HOME         (7)   // 原点信号
_DLL_API UINT32 IMC_SetLocalSpecialIOInverse(UINT64 cardHandle, INT16 type, INT16 inverse);
_DLL_API UINT32 IMC_GetLocalSpecialIOInverse(UINT64 cardHandle, INT16 type, INT16 *pInverse);

_DLL_API UINT32 IMC_SetLocalDiInverse(UINT64 cardHandle, INT16 inverse);
_DLL_API UINT32 IMC_GetLocalDiInverse(UINT64 cardHandle, INT16 *pInverse);
_DLL_API UINT32 IMC_SetLocalDoInverse(UINT64 cardHandle, INT16 inverse);
_DLL_API UINT32 IMC_GetLocalDoInverse(UINT64 cardHandle, INT16 *pInverse);
_DLL_API UINT32 IMC_SetLocalEncDir(UINT64 cardHandle, INT16 index, INT16 *pDirArray, INT16 count=1);
_DLL_API UINT32 IMC_GetLocalEncDir(UINT64 cardHandle, INT16 index, INT16 *pDirArray, INT16 count=1);
_DLL_API UINT32 IMC_SetLocalPulseMode(UINT64 cardHandle, INT16 plsIndex, INT16 mode, INT16 dirInverse);
_DLL_API UINT32 IMC_GetLocalPulseMode(UINT64 cardHandle, INT16 plsIndex, INT16 *pMode, INT16 *pDirInverse);

_DLL_API UINT32 IMC_SetLocalGpoUseType(UINT64 cardHandle, INT16 index, INT16 type);
_DLL_API UINT32 IMC_GetLocalGpoUseType(UINT64 cardHandle, INT16 index, INT16 *pType);
_DLL_API UINT32 IMC_SetEncFilterPara(UINT64 cardHandle, INT16 index, INT16 filterDepth, INT16 filterCoef);
_DLL_API UINT32 IMC_GetEncFilterPara(UINT64 cardHandle, INT16 index, INT16 *pFilterDepth, INT16 *pFilterCoef);

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----1.2.3 系统参数设置接口                                             ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_GetHwSysPara(UINT64 cardHandle, INT16 *pCycleTime, INT16 *pHwType);
_DLL_API UINT32 IMC_ResetSysPara(UINT64 cardHandle);
_DLL_API UINT32 IMC_GetCalcLoadRatio(UINT64 cardHandle,double *pLoadRatio);
_DLL_API UINT32 IMC_GetVersion (UINT64 cardHandle, INT16 *pVersion);

_DLL_API UINT32 IMC_WriteUserCode(UINT64 cardHandle, char *pCodeArray, INT16 len);
_DLL_API UINT32 IMC_CheckUserCode(UINT64 cardHandle, char *pCodeArray, INT16 len);

_DLL_API UINT32 IMC_SetEmgStopMode(UINT64 cardHandle,INT16 stopMode);
_DLL_API UINT32 IMC_GetEmgStopMode(UINT64 cardHandle,INT16 *pStopMode);
_DLL_API UINT32 IMC_SetEmgFilter(UINT64 cardHandle,INT16 filter);
_DLL_API UINT32 IMC_GetEmgFilter(UINT64 cardHandle,INT16 *pFilter);
_DLL_API UINT32 IMC_SetEmgTrigLevelInv(UINT64 cardHandle, INT16 inverse);
_DLL_API UINT32 IMC_GetEmgTrigLevelInv(UINT64 cardHandle, INT16 *pInverse);
_DLL_API UINT32 IMC_GetEmgDiLevel (UINT64 cardHandle,INT16 * pLevel);
_DLL_API UINT32 IMC_SetEmgDoResetFlag(UINT64 cardHandle,INT16 enable);
_DLL_API UINT32 IMC_GetEmgDoResetFlag(UINT64 cardHandle,INT16 *pEnFlag);
_DLL_API UINT32 IMC_SetEmgSvOffVelThreshold(UINT64 cardHandle,INT16 axNo,INT32 thrVel);
_DLL_API UINT32 IMC_GetEmgSvOffVelThreshold(UINT64 cardHandle,INT16 axNo,INT32 *pThrVel);

_DLL_API UINT32 IMC_OpenWatchDog(UINT64 cardHandle,INT32 feedTime);
_DLL_API UINT32 IMC_FeedWatchDog(UINT64 cardHandle);
_DLL_API UINT32 IMC_CloseWatchDog(UINT64 cardHandle);

_DLL_API UINT32 IMC_EnableCheckEcatErrCode(UINT64 cardHandle,INT16 flag);

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----1.2.4 轴参数设置接口                                               ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_SetAxActive(UINT64 cardHandle, INT16 axNo, INT16 active);
_DLL_API UINT32 IMC_GetAxActive(UINT64 cardHandle, INT16 axNo, INT16 *pActive);
_DLL_API UINT32 IMC_SetAxMaxMtPara(UINT64 cardHandle, INT16 axNo, TMtPara *pMtPara);
_DLL_API UINT32 IMC_GetAxMaxMtPara(UINT64 cardHandle, INT16 axNo, TMtPara *pMtPara);
_DLL_API UINT32 IMC_SetAxEquiv(UINT64 cardHandle, INT16 axNo, double *pAxEquArray,INT16 count=1);
_DLL_API UINT32 IMC_GetAxEquiv(UINT64 cardHandle, INT16 axNo, double *pAxEquArray,INT16 count=1);
_DLL_API UINT32 IMC_SetAxBondCfg(UINT64 cardHandle, INT16 axNo, INT16 axType, INT16 outputChn, INT16 loaclEncSrc);
_DLL_API UINT32 IMC_GetAxBondCfg(UINT64 cardHandle, INT16 axNo, INT16 *pAxType, INT16 *pOutputChn, INT16 *pLoaclEncSrc);
_DLL_API UINT32 IMC_ResetAxBondCfg(UINT64 cardHandle);
_DLL_API UINT32 IMC_SetAxAttriPara(UINT64 cardHandle, INT16 axNo, TAxAttriPara *pAxAttriPara);
_DLL_API UINT32 IMC_GetAxAttriPara(UINT64 cardHandle, INT16 axNo, TAxAttriPara *pAxAttriPara);
_DLL_API UINT32 IMC_SetAxSoftLimit(UINT64 cardHandle, INT16 axNo, INT32 softPosLimitPos, INT32 softNegLimitPos);
_DLL_API UINT32 IMC_GetAxSoftLimit(UINT64 cardHandle, INT16 axNo, INT32 *pSoftPosLimitPos, INT32 *pSoftNegLimitPos);
_DLL_API UINT32 IMC_SetAxArrivalBand(UINT64 cardHandle, INT16 axNo, INT16 arrivalBand, INT16 arrivalTime);
_DLL_API UINT32 IMC_GetAxArrivalBand(UINT64 cardHandle, INT16 axNo, INT16 *pArrivalBand, INT16 *pArrivalTime);
_DLL_API UINT32 IMC_SetAxErrorPos(UINT64 cardHandle, INT16 axNo, INT32 errorPos);
_DLL_API UINT32 IMC_GetAxErrorPos(UINT64 cardHandle, INT16 axNo, INT32 *pErrorPos);
_DLL_API UINT32 IMC_SetAxBacklash (UINT64 cardHandle,INT16 axNo, INT32 wholeCmpVal, INT32 cmpVel, INT16 cmpDir);
_DLL_API UINT32 IMC_GetAxBacklash (UINT64 cardHandle,INT16 axNo, INT32 *pWholeCmpVal, INT32 *pCmpVel, INT16 *pCmpDir);
_DLL_API UINT32 IMC_AxSafeCheckEnable(UINT64 cardHandle, INT16 axNo, TAxCheckEn *pAxCheckEn);
_DLL_API UINT32 IMC_AxSafeCheckSts(UINT64 cardHandle, INT16 axNo, TAxCheckEn *pAxCheckEn);
_DLL_API UINT32 IMC_AxAlarmEnable(UINT64 cardHandle, INT16 axNo, INT16 count=1);
_DLL_API UINT32 IMC_AxAlarmDisable(UINT64 cardHandle, INT16 axNo, INT16 count=1);
_DLL_API UINT32 IMC_AxSoftLmtsEnable(UINT64 cardHandle, INT16 axNo, INT16 count=1);
_DLL_API UINT32 IMC_AxSoftLmtsDisable(UINT64 cardHandle, INT16 axNo, INT16 count=1);
_DLL_API UINT32 IMC_AxHwLmtsEnable(UINT64 cardHandle, INT16 axNo, INT16 count=1);
_DLL_API UINT32 IMC_AxHwLmtsDisable(UINT64 cardHandle, INT16 axNo, INT16 count=1);
_DLL_API UINT32 IMC_AxErrPosEnable(UINT64 cardHandle, INT16 axNo, INT16 count=1);
_DLL_API UINT32 IMC_AxErrPosDisable(UINT64 cardHandle, INT16 axNo, INT16 count=1);

_DLL_API UINT32 IMC_SetEcatAxProbeMaskBit(UINT64 cardHandle, INT16 axNo, INT16 prbDiBitNo);
_DLL_API UINT32 IMC_GetEcatAxProbeMaskBit(UINT64 cardHandle, INT16 axNo, INT16 *pPrbDiBitNo);
_DLL_API UINT32 IMC_SetupAxGantry(UINT64 cardHandle,INT16 groupNo,INT16 masterAxNo,INT16 slaveAxNo,INT32 errorLmt);
_DLL_API UINT32 IMC_AbortAxGantry(UINT64 cardHandle,INT16 groupNo);
_DLL_API UINT32 IMC_GetAxGantrySts(UINT64 cardHandle,INT16 groupNo,INT16 *pMasterAxNo,INT16 *pSlaveAxNo,INT32 *pErrorLmt,INT16 *pSts);
_DLL_API UINT32 IMC_ClrAxGantrySts(UINT64 cardHandle,INT16 groupNo);
// 轴螺距误差补偿
_DLL_API UINT32 IMC_AxSetScrewCompTable(UINT64 cardHandle, INT16 axNo , INT16 dir ,INT16 paraNum,INT32 *pCompValArray);
_DLL_API UINT32 IMC_AxGetScrewCompTable(UINT64 cardHandle, INT16 axNo , INT16 dir , INT16 *pParaNum,INT32 *pCompValArray);
_DLL_API UINT32 IMC_AxEnableScrewComp(UINT64 cardHandle,INT16 axNo, INT32 posStartPos, INT32 posEndPos ,INT16 pointNum);
_DLL_API UINT32 IMC_AxDisableScrewComp(UINT64 cardHandle,INT16 axNo);
_DLL_API UINT32 IMC_AxGetScrewCompStatus(UINT64 cardHandle,INT16 axNo,INT16 *pSts);
_DLL_API UINT32 IMC_AxGetScrewCompValue(UINT64 cardHandle,INT16 axNo,INT32 *pCompVal);

/*==========================================================================*/
/*----2.1 ECAT硬件操作接口                                               ---*/
/*==========================================================================*/

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----2.1.1ECAT总线 SDO操作以及状态查询                                  ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_GetSlaveCurSts(UINT64 cardHandle, UINT16 Station_id, UINT16 cnt, INT16 *pStatusArray);
_DLL_API UINT32 IMC_GetSlaveReqSts(UINT64 cardHandle, UINT16 Station_id, UINT16 cnt, INT16 *pStatusArray);
_DLL_API UINT32 IMC_GetEcatErrCode(UINT64 cardHandle, UINT32 *pErrCode);
_DLL_API UINT32 IMC_GetAxEcatStation(UINT64 cardHandle, UINT16 virAxNo, INT16 *pPhyStation_id, INT16 *pPhySlot_id);
_DLL_API UINT32 IMC_GetAxEcatPidVid(UINT64 cardHandle, UINT16 virAxNo, UINT32 *pPid, UINT32 *pVid);
_DLL_API UINT32 IMC_GetEcatStationPidVid(UINT64 cardHandle, UINT16 Station_id, UINT32 *pPid, UINT32 *pVid);
_DLL_API UINT32 IMC_GetEcatSdo(UINT64 cardHandle, INT16 station_id, UINT16 index,  UINT16 subindex, UINT8 *target, UINT32 target_size, UINT32 *result_size, UINT32 *abort_code);
_DLL_API UINT32 IMC_SetEcatSdo(UINT64 cardHandle, INT16 station_id, UINT16 index,  UINT16 subindex, UINT8 *data,UINT32 data_size, UINT32 *abort_code);
_DLL_API UINT32 IMC_GetAxSdo(UINT64 cardHandle, INT16 virAxNo, UINT16 index,  UINT16 subindex, UINT8 *target, UINT32 target_size, UINT32 *result_size, UINT32 *abort_code);
_DLL_API UINT32 IMC_SetAxSdo(UINT64 cardHandle, INT16 virAxNo, UINT16 index,  UINT16 subindex, UINT8 *data,UINT32 data_size, UINT32 *abort_code);

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----2.1.2 ECAT总线 DI/DO  AI/AO操作                       ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_SetEcatDoBit(UINT64 cardHandle, INT16 doNo, INT16 Value);
_DLL_API UINT32 IMC_GetEcatDoBit(UINT64 cardHandle, INT16 doNo, INT16 *pValue);
_DLL_API UINT32 IMC_SetEcatGrpDo(UINT64 cardHandle, INT16 groupNo, INT16 Value);
_DLL_API UINT32 IMC_GetEcatGrpDo(UINT64 cardHandle, INT16 groupNo, INT16 *pValue);
_DLL_API UINT32 IMC_GetEcatDiBit(UINT64 cardHandle, INT16 diNo, INT16 *pValue);
_DLL_API UINT32 IMC_GetEcatGrpDi(UINT64 cardHandle, INT16 groupNo, INT16 *pValue);

_DLL_API UINT32 IMC_GetEcatAdVal(UINT64 cardHandle, INT16 adNo, INT16 *pValue);
_DLL_API UINT32 IMC_SetEcatDaVal(UINT64 cardHandle, INT16 daNo, INT16 Value);
_DLL_API UINT32 IMC_GetEcatDaVal(UINT64 cardHandle, INT16 daNo, INT16 *pValue);

_DLL_API UINT32 IMC_GetEcatPtVal(UINT64 cardHandle, INT16 ptNo, double *pValue);

/*==========================================================================*/
/*----2.2 端子板硬件操作接口                                             ---*/
/*==========================================================================*/
// 获取端子板版本信息
_DLL_API UINT32 IMC_GetBoardVersion(UINT64 cardHandle, INT16 *pVersion, INT16 *pMonth,INT16 *pYear);

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----2.2.1 端子板DIO操作接口                                            ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_SetLocalDoBit(UINT64 cardHandle, INT16 doNo, INT16 value);
_DLL_API UINT32 IMC_GetLocalDoBit(UINT64 cardHandle, INT16 doNo, INT16 *pValue);
_DLL_API UINT32 IMC_SetLocalDo(UINT64 cardHandle, INT16 value);
_DLL_API UINT32 IMC_GetLocalDo(UINT64 cardHandle, INT16 *pValue);
_DLL_API UINT32 IMC_GetLocalDiBit(UINT64 cardHandle, INT16 diNo, INT16 *pValue);
_DLL_API UINT32 IMC_GetLocalDi(UINT64 cardHandle, INT16 *pValue);
_DLL_API UINT32 IMC_GetLocalADVal(UINT64 cardHandle, INT16 *pValue);

#define SPECIAL_IO_RDY          (0)   // 准备完成信号
#define SPECIAL_IO_ARRIV        (1)   // 到位信号
#define SPECIAL_IO_ALARM        (2)   // 报警信号
#define SPECIAL_IO_POSLMT       (3)   // 正限位信号
#define SPECIAL_IO_NEGLMT       (4)   // 负限位信号
#define SPECIAL_IO_HOME         (7)   // 回零输入信号
#define SPECIAL_IO_INDEX        (8)   // 电机Z相信号
_DLL_API UINT32 IMC_GetLocalSpecialDi(UINT64 cardHandle, INT16 type, INT16 *pValue);
_DLL_API UINT32 IMC_GetLocalSpecialDiBit(UINT64 cardHandle, INT16 index, INT16 type, INT16 *pValue);

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----2.2.2 端子板编码器操作接口                                         ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_GetLocalCntPos(UINT64 cardHandle, INT16 index, INT32 *pCntPosArray, INT16 count=1);
_DLL_API UINT32 IMC_GetLocalCntVel (UINT64 cardHandle, INT16 index,INT32 *pCntVelArray,INT16 count=1);
_DLL_API UINT32 IMC_GetLocalEncPos(UINT64 cardHandle,INT16 index,INT32 *pEncPosArray,INT16 count=1);
_DLL_API UINT32 IMC_GetLocalEncVel (UINT64 cardHandle, INT16 index,INT32 *pEncVelArray,INT16 count=1);
_DLL_API UINT32 IMC_SetLocalEncPos (UINT64 cardHandle, INT16 index,INT32 encPos);


/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----2.2.3 端子板位置比较输出操作接口                                   ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_CompareSrcConfig(UINT64 cardHandle, INT16 portNo, INT16 dimension, INT16 *pCompSrcArray, INT16 *pCmpTypeArray);
_DLL_API UINT32 IMC_CompareOutputConfig(UINT64 cardHandle, INT16 portNo,  INT16 ctrlMode,INT16 stLevel, INT16 outputType, INT16 pulseWidth);
_DLL_API UINT32 IMC_GetCompareStatus(UINT64 cardHandle, INT16 portNo, INT16 *pCmpSts, INT32 *pCmpCount);
_DLL_API UINT32 IMC_StopCompareOut(UINT64 cardHandle, INT16 portNo);
_DLL_API UINT32 IMC_StartCompareOut(UINT64 cardHandle, INT16 portNo);
_DLL_API UINT32 IMC_CompareManualOutput(UINT64 cardHandle, INT16 portNo, INT16 outVal);
_DLL_API UINT32 IMC_LinearCompare(UINT64 cardHandle, INT16 portNo,INT32 intervalLen, INT32 compTimes);
_DLL_API UINT32 IMC_SetCompareData(UINT64 cardHandle, INT16 portNo, INT16 compCount, INT32 *pPosBufArray);
_DLL_API UINT32 IMC_SetCompareDataType(UINT64 cardHandle, INT16 portNo, INT16 type);
_DLL_API UINT32 IMC_GetCompareDataType(UINT64 cardHandle, INT16 portNo, INT16 *pType);
_DLL_API UINT32 IMC_SetComparePosType(UINT64 cardHandle, INT16 portNo, INT16 type);
_DLL_API UINT32 IMC_GetComparePosType(UINT64 cardHandle, INT16 portNo, INT16 *pType);

_DLL_API UINT32 IMC_SetMultiDimensComparePara(UINT64 cardHandle,INT16 portNo,INT16 error,INT16 outpinType);
_DLL_API UINT32 IMC_GetMultiDimensComparePara(UINT64 cardHandle,INT16 portNo,INT16 *pError,INT16 *pOutPinTyp);
_DLL_API UINT32 IMC_SetMultiDimensCompareData(UINT64 cardHandle,INT16 portNo,TMultiCmpData *pComparaDataArray,INT16 count);

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----2.2.5 端子板PWM输出控制                                            ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_SetPwmPara (UINT64 cardHandle, INT16 chn,INT16 pwmMode, INT32 frequency,double dutyRatio);
_DLL_API UINT32 IMC_GetPwmPara (UINT64 cardHandle, INT16 chn,INT16 *pPwmMode, INT32 *pFrequency,double *pDutyRatio);
_DLL_API UINT32 IMC_SetPwmFrq (UINT64 cardHandle, INT16 chn, INT32 frequency);
_DLL_API UINT32 IMC_SetPwmDuty (UINT64 cardHandle, INT16 chn, double dutyRatio);
_DLL_API UINT32 IMC_SetPwmOnOff (UINT64 cardHandle, INT16 chn, INT16 onOff);
_DLL_API UINT32 IMC_SetPwmOnDelay (UINT64 cardHandle, INT16 chn, UINT16 onDelay);
_DLL_API UINT32 IMC_SetPwmOffDelay (UINT64 cardHandle, INT16 chn, UINT16 offDelay);

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----2.2.6 PSO控制                                            ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_SetPSOMode0Para(UINT64 cardHandle, INT16 portNo, INT16 dimension,INT16 posType,INT16 pinType,INT16 *pPsoPosIndexArray,double outPlsWidth,INT32 syncDeltaPos);
_DLL_API UINT32 IMC_GetPSOMode0Para(UINT64 cardHandle, INT16 portNo, INT16 *pDimension,INT16 *pPosType,INT16 *pPinType,INT16 *pPsoPosIndexArray,double *pOutPlsWidth,INT32 *pSyncDeltaPos);
_DLL_API UINT32 IMC_StartPSO(UINT64 cardHandle, INT16 portNo);
_DLL_API UINT32 IMC_StopPSO(UINT64 cardHandle, INT16 portNo);

/*==========================================================================*/
/*----3 回零操作接口                                                     ---*/
/*==========================================================================*/
_DLL_API UINT32 IMC_StartHomingInUnit(UINT64 cardHandle, INT16 axNo, THomingParaInUint *pHomingPara);
_DLL_API UINT32 IMC_StartHoming(UINT64 cardHandle, INT16 axNo, THomingPara *pHomingPara);
_DLL_API UINT32 IMC_StopHoming(UINT64 cardHandle, INT16 axNo, INT16 stopType);
_DLL_API UINT32 IMC_GetHomingStatus(UINT64 cardHandle, INT16 axNo, INT16 *pStatus);
_DLL_API UINT32 IMC_FinishHoming(UINT64 cardHandle, INT16 axNo);

_DLL_API UINT32 IMC_StartEcatAxCSPHoming(UINT64 cardHandle, INT16 axNo,INT16 method,INT16 dir,INT16 level,double hVel,double lVel,double acc,double offset);
_DLL_API UINT32 IMC_StopEcatAxCSPHoming(UINT64 cardHandle, INT16 axNo,INT16 stopMode);
_DLL_API UINT32 IMC_GetEcatAxCSPHomingSts(UINT64 cardHandle, INT16 axNo,INT16 *pHomingMethod,INT16 *pSts);
_DLL_API UINT32 IMC_FinishEcatAxCSPHoming(UINT64 cardHandle, INT16 axNo);

_DLL_API UINT32 IMC_CloseAutoHomingFinish(UINT64 cardHandle);

/*==========================================================================*/
/*----4 状态管理接口                                                     ---*/
/*==========================================================================*/

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----4.2 轴状态管理接口                                                 ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_GetAxPrfMode(UINT64 cardHandle, INT16 axNo, INT16 *pPrfModeArray, INT16 count=1);

// 轴状态位
#define AX_ALARM_BIT					(0x00000001)		// 轴驱动报警
#define AX_SVON_BIT						(0x00000002)		// 伺服使能
#define AX_BUSY_BIT						(0x00000004)		// 轴忙状态
#define AX_ARRIVE_BIT					(0x00000008)		// 轴到位状态
#define AX_POSLMT_BIT					(0x00000010)		// 正硬限位报警
#define AX_NEGLMT_BIT					(0x00000020)		// 负硬限位报警
#define AX_SOFT_POSLMT_BIT				(0x00000040)		// 正软限位报警
#define AX_SOFT_NEGLMT_BIT				(0x00000080)		// 负软限位报警
#define AX_ERRPOS_BIT					(0x00000100)		// 轴位置误差越限标志
#define AX_EMG_STOP_BIT					(0x00000200)		// 运动急停标志
#define AX_ECAT_BIT						(0x00000400)		// 总线轴标志
_DLL_API UINT32 IMC_GetAxSts(UINT64 cardHandle, INT16 axNo, INT32 *pAxStsArray, INT16 count=1);
_DLL_API UINT32 IMC_ClrAxSts(UINT64 cardHandle, INT16 axNo, INT16 count=1);
_DLL_API UINT32 IMC_GetAxPrfPos(UINT64 cardHandle, INT16 axNo, double *pPrfPosArray, INT16 count=1);
_DLL_API UINT32 IMC_GetAxPrfVel(UINT64 cardHandle, INT16 axNo, double *pPrfVelArray, INT16 count=1);
_DLL_API UINT32 IMC_GetAxPrfAcc(UINT64 cardHandle, INT16 axNo, double *pPrfAccArray, INT16 count=1);
_DLL_API UINT32 IMC_GetAxEncPos(UINT64 cardHandle, INT16 axNo, double *pEncPosArray, INT16 count=1);
_DLL_API UINT32 IMC_GetAxOrgEncPos(UINT64 cardHandle, INT16 axNo, INT32 *pOrgEncPosArray, INT16 count=1);
_DLL_API UINT32 IMC_GetAxEncVel(UINT64 cardHandle, INT16 axNo, double *pEncVelArray, INT16 count=1);
_DLL_API UINT32 IMC_GetAxEncAcc(UINT64 cardHandle, INT16 axNo, double *pEncAccArray, INT16 count=1);
_DLL_API UINT32 IMC_GetPrfPos(UINT64 cardHandle, INT16 axNo, double *pPrfPosArray, INT16 count=1);
_DLL_API UINT32 IMC_GetAxType(UINT64 cardHandle, INT16 axNo, INT16 *pAxType, INT16 *pOutChn);
_DLL_API UINT32 IMC_GetMultiAxArrivalSts(UINT64 cardHandle, INT32 axMask,INT16 *pSts);

_DLL_API UINT32 IMC_AxServoOn(UINT64 cardHandle, INT16 axNo, INT16 count=1);
_DLL_API UINT32 IMC_AxServoOff(UINT64 cardHandle, INT16 axNo, INT16 count=1);
_DLL_API UINT32 IMC_AxMoveStop(UINT64 cardHandle, INT16 axNo, INT16 stopType);
_DLL_API UINT32 IMC_AxStopInBits(UINT64 cardHandle, INT32 axMask, INT32 stopTypeBits);
_DLL_API UINT32 IMC_SetAxCurPos(UINT64 cardHandle, INT16 axNo, double setPos);

_DLL_API UINT32 IMC_SetAxCompenPos(UINT64 cardHandle, INT16 axNo, double cmpPos,double cmpTime,INT16 posType);
_DLL_API UINT32 IMC_GetAxCompenPos(UINT64 cardHandle, INT16 axNo,double *pCmpPos);

_DLL_API UINT32 IMC_SetAxCtrlMode(UINT64 cardHandle,INT16 axNo,INT16 ctrlMode);
_DLL_API UINT32 IMC_GetAxCtrlMode(UINT64 cardHandle,INT16 axNo,INT16 *pCtrlMode);
_DLL_API UINT32 IMC_PrfAxTorq(UINT64 cardHandle,INT16 axNo,INT16 tgtTrq,INT16 time);
_DLL_API UINT32 IMC_GetAxActTorq(UINT64 cardHandle,INT16 axNo,INT16 *pActTrq);

_DLL_API UINT32 IMC_SetAxTorqSlope(UINT64 cardHandle,INT16 axNo,INT32 trqSlope);
_DLL_API UINT32 IMC_GetAxTorqSlope(UINT64 cardHandle,INT16 axNo,INT32 *pTrqSlope);
_DLL_API UINT32 IMC_SetAxTgtTorq(UINT64 cardHandle,INT16 axNo,INT16 tgtTrq);
_DLL_API UINT32 IMC_GetAxTgtTorq(UINT64 cardHandle,INT16 axNo,INT16 *pTgtTrq);

_DLL_API UINT32 IMC_GetAxErrCode(UINT64 cardHandle,INT16 axNo,INT16 *pErrorCode);
_DLL_API UINT32 IMC_GetAxEcatDigitalInput(UINT64 cardHandle, INT16 axNo, INT32 *pDigitalInput);
_DLL_API UINT32 IMC_GetAxBacklashCmpVal(UINT64 cardHandle, INT16 axNo, INT32 *pCmpVal);

_DLL_API UINT32 IMC_SetEcatAxMaxVelLmt(UINT64 cardHandle,INT16 axNo,INT32 maxVel);
_DLL_API UINT32 IMC_GetEcatAxMaxVelLmt(UINT64 cardHandle,INT16 axNo,INT32 *pMaxVel);
_DLL_API UINT32 IMC_SetEcatAxPosTorqLmt(UINT64 cardHandle,INT16 axNo,INT16 posTorqLmt);
_DLL_API UINT32 IMC_GetEcatAxPosTorqLmt(UINT64 cardHandle,INT16 axNo,INT16 *pPosTorqLmt);
_DLL_API UINT32 IMC_SetEcatAxNegTorqLmt(UINT64 cardHandle,INT16 axNo,INT16 negTorqLmt);
_DLL_API UINT32 IMC_GetEcatAxNegTorqLmt(UINT64 cardHandle,INT16 axNo,INT16 *pNegTorqLmt);
_DLL_API UINT32 IMC_SetEcatAxMaxTorqLmt(UINT64 cardHandle,INT16 axNo,INT16 maxTorqLmt);
_DLL_API UINT32 IMC_GetEcatAxMaxTorqLmt(UINT64 cardHandle,INT16 axNo,INT16 *pMaxTorqLmt);

_DLL_API UINT32 IMC_SyncAxPos(UINT64 cardHandle, INT16 axNo);

// 非标510
_DLL_API UINT32 IMC_SetAxPressFitCtrlWord(UINT64 cardHandle,INT16 axNo,UINT16 ctrlword);
_DLL_API UINT32 IMC_SetAxPressTgtVal(UINT64 cardHandle,INT16 axNo,INT16 pressVal);
_DLL_API UINT32 IMC_GetAxPressFitSts(UINT64 cardHandle, INT16 axNo, UINT16 *pSts);
_DLL_API UINT32 IMC_GetAxAIInputVal(UINT64 cardHandle, INT16 axNo, INT16 *pA1Volt,INT16 *pA2Volt);
_DLL_API UINT32 IMC_GetAxPressFeedback(UINT64 cardHandle, INT16 axNo, INT16 *pPressVal);

// 转矩回零
_DLL_API UINT32 IMC_StartAxTorqHoming(UINT64 cardHandle,INT16 axNo,INT16 tgtTorq,INT16 torqSlopeTime,UINT32 maxVel);
_DLL_API UINT32 IMC_StopAxTorqHoming(UINT64 cardHandle,INT16 axNo,INT16 stopTime);
_DLL_API UINT32 IMC_GetAxTorqHomingSts(UINT64 cardHandle,INT16 axNo,INT16 *pStatus);
_DLL_API UINT32 IMC_FinishAxTorqHoming(UINT64 cardHandle,INT16 axNo);

// 轴在CSV模式下的规划
_DLL_API UINT32 IMC_StartAxCsvPrf(UINT64 cardHandle,INT16 axNo,INT32 tgtVel,INT32 acc,INT16 prfType);
_DLL_API UINT32 IMC_StopAxCsvPrf(UINT64 cardHandle,INT16 axNo,INT32 dec);
_DLL_API UINT32 IMC_EstopAxCsvPrf(UINT64 cardHandle,INT16 axNo);
_DLL_API UINT32 IMC_UpdateAxCsvPrf(UINT64 cardHandle,INT16 axNo,INT32 tgtVel);
_DLL_API UINT32 IMC_GetAxCsvPrfStatus(UINT64 cardHandle,INT16 axNo,INT16 *pStatus);


/*==========================================================================*/
/*----5 数据采集接口                                                     ---*/
/*==========================================================================*/
_DLL_API UINT32 IMC_ConfigSamplePara(UINT64 cardHandle, TSamplePara *pSamplePara);
_DLL_API UINT32 IMC_ConfigSampleData(UINT64 cardHandle, INT16 count, INT16 *pDataTypeArray, INT16 *pDataIndexArray);
_DLL_API UINT32 IMC_ConfigSampleEnable(UINT64 cardHandle, INT16 enable);
_DLL_API UINT32 IMC_GetSampleStatus(UINT64 cardHandle, INT16 *pStatus, INT32 *pLen, INT32 *pLeakageCount);
_DLL_API UINT32 IMC_GetSampleData(UINT64 cardHandle, INT16 *pPackNum, INT16 *pDataArray);

/*==========================================================================*/
/*----6 轴位置捕获接口                                                     ---*/
/*==========================================================================*/
_DLL_API UINT32 IMC_SetAxCaptMode (UINT64 cardHandle,INT16 axNo,INT16 trigType,INT16 captSrc,INT16 sns);
_DLL_API UINT32 IMC_GetAxCaptMode (UINT64 cardHandle,INT16 axNo,INT16 *pTrigType,INT16 *pCaptSrc,INT16 *pSns);
_DLL_API UINT32 IMC_GetAxCaptStatus (UINT64 cardHandle,INT16 axNo,INT16 *pSts,INT32 *pCaptPos);
_DLL_API UINT32 IMC_GetAxDbEdgCaptStatus (UINT64 cardHandle,INT16 axNo,INT16 *pSts,INT32 *pCaptPosArray);

/*==========================================================================*/
/*----7 运动模式接口                                                     ---*/
/*==========================================================================*/
_DLL_API UINT32 IMC_SetSingleAxMvPara(UINT64 cardHandle, INT16 axNo, double vel, double acc, double dec);
_DLL_API UINT32 IMC_GetSingleAxMvPara(UINT64 cardHandle, INT16 axNo, double *pVel, double *pAcc, double *pDec);
_DLL_API UINT32 IMC_SetSingleAxVelType(UINT64 cardHandle, INT16 axNo, INT16 velType, double ratio);
_DLL_API UINT32 IMC_GetSingleAxVelType(UINT64 cardHandle, INT16 axNo, INT16 *pVelType, double *pRatio);
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----7.1 PTP点位模式接口                                                ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_StartPtpMove(UINT64 cardHandle, INT16 axNo, double tgtPos, INT16 posType=0);
_DLL_API  UINT32 IMC_StartMultiPtpMove(UINT64 cardHandle, INT16 axNum, INT16 *pAxNoArray, double *pTgtPosArray, INT16 *pPosTypeArray);
_DLL_API UINT32 IMC_UpdatePtpTgtPos(UINT64 cardHandle, INT16 axNo, double tgtPos);
_DLL_API UINT32 IMC_UpdatePtpMvPara(UINT64 cardHandle, INT16 axNo, double tgtVel, double acc, double dec);
_DLL_API UINT32 IMC_UpdatePtpTgtVel(UINT64 cardHandle, INT16 axNo, double tgtVel);
_DLL_API UINT32 IMC_PauseMove(UINT64 cardHandle, INT16 axNo);
_DLL_API UINT32 IMC_ResumeMove(UINT64 cardHandle, INT16 axNo);

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----7.2 Jog运动模式接口                                                ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_StartJogMove(UINT64 cardHandle, INT16 axNo,  double tgVel);
_DLL_API UINT32 IMC_StartMultiJogMove(UINT64 cardHandle, INT16 axNum, INT16 *pAxNoArray,  double *pTgtVelArray);
_DLL_API UINT32 IMC_UpdateJogTgtVel(UINT64 cardHandle, INT16 axNo, double tgVel);
_DLL_API UINT32 IMC_UpdateJogMvPara(UINT64 cardHandle, INT16 axNo, double tgVel, double acc, double dec);

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----7.3 手轮跟随运动模式接口                                           ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_EnterHandWheelMode(UINT64 cardHandle, INT16 axNo, INT16 masterType, INT16 masterIndex, double ratio, double acc, double vel);
_DLL_API UINT32 IMC_ExitHandWheelMode(UINT64 cardHandle);
_DLL_API UINT32 IMC_SwitchHandWheelRatio(UINT64 cardHandle,double ratio);

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----7.4 电子齿轮                                          ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// 设置跟随参数
_DLL_API UINT32 IMC_GearSetParam(UINT64 cardHandle,INT16 axNo,TGearParam *pGearParam);
// 读取跟随参数
_DLL_API UINT32 IMC_GearGetParam(UINT64 cardHandle,INT16 axNo,TGearParam *pGearParam);
// 更新主轴齿数和设置离合区
_DLL_API UINT32 IMC_GearUpdateScale(UINT64 cardHandle,INT16 axNo,double masterScale,double slaveScale,INT32 masterDis);
//电子齿轮模式启动
_DLL_API UINT32 IMC_GearStart(UINT64 cardHandle, INT16 axNo);
//电子齿轮模式停止
_DLL_API UINT32 IMC_GearStop(UINT64 cardHandle, INT16 axNo,INT16 type);
//电子齿轮错误获取状态
_DLL_API UINT32 IMC_GearGetStatus(UINT64 cardHandle,INT16 axNo,INT16 *pStatus);
//电子齿轮关系销毁
_DLL_API UINT32 IMC_GearDestroy(UINT64 cardHandle,INT16 axNo);

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----7.5 直角坐标系插补运动模式接口                                     ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_CrdSetMtSys(UINT64 cardHandle, INT16 crdNo,INT16 *pMaskAxNoArray,INT16 lookAheadLen,double estopDec);
_DLL_API UINT32 IMC_CrdGetMtSysParam(UINT64 cardHandle, INT16 crdNo,INT16 *pMaskAxNoArray,INT16 *pLookAheadLen,double *pEstopDec);
_DLL_API UINT32 IMC_CrdDeleteMtSys(UINT64 cardHandle, INT16 crdNo);
_DLL_API UINT32 IMC_CrdSetAdvParam(UINT64 cardHandle, INT16 crdNo,TCrdAdvParam *pCrdAdvParam);
_DLL_API UINT32 IMC_CrdGetAdvParam(UINT64 cardHandle, INT16 crdNo,TCrdAdvParam *pCrdAdvParam);
_DLL_API UINT32 IMC_CrdSetSmoothParam(UINT64 cardHandle, INT16 crdNo, INT32 smoothLevel, double smoothTol);
_DLL_API UINT32 IMC_CrdGetSmoothParam(UINT64 cardHandle, INT16 crdNo, INT32 *pSmoothLevel, double *pSmoothTol);

_DLL_API UINT32 IMC_CrdSetTrajVel(UINT64 cardHandle, INT16 crdNo,double tgtVel);
_DLL_API UINT32 IMC_CrdSetTrajAcc(UINT64 cardHandle, INT16 crdNo,double tgtAcc);
_DLL_API UINT32 IMC_CrdSetTrajAccAndDec(UINT64 cardHandle, INT16 crdNo,double tgtAcc,double tgtdec);
_DLL_API UINT32 IMC_CrdSetZeroFlag(UINT64 cardHandle, INT16 crdNo,INT16 ZeroFlag);
_DLL_API UINT32 IMC_CrdSetIncMode(UINT64 cardHandle, INT16 crdNo,INT16 mode);
_DLL_API UINT32 IMC_CrdUserVelPlan(UINT64 cardHandle, INT16 crdNo, double uStartVel, double uEndVel);

_DLL_API UINT32 IMC_CrdSetFolVelMode(UINT64 cardHandle,INT16 crdNo,INT16 mode);
_DLL_API UINT32 IMC_CrdGetFolVelMode(UINT64 cardHandle,INT16 crdNo,INT16 *pMode);
_DLL_API UINT32 IMC_CrdGetTrajVel(UINT64 cardHandle, INT16 crdNo,double *pTgtVel);
_DLL_API UINT32 IMC_CrdGetTrajAccAndDec(UINT64 cardHandle, INT16 crdNo,double *pTgtAcc,double *pTgtdec);
_DLL_API UINT32 IMC_CrdGetZeroFlag(UINT64 cardHandle, INT16 crdNo,INT16 *pZeroFlag);
_DLL_API UINT32 IMC_CrdGetIncMode(UINT64 cardHandle, INT16 crdNo,INT16 *pMode);
_DLL_API UINT32 IMC_CrdGetUserVelPlan(UINT64 cardHandle, INT16 crdNo, double *pUStartVel, double *pUEndVel);
_DLL_API UINT32 IMC_CrdSetTrajTol(UINT64 cardHandle, INT16 crdNo,double tol);
_DLL_API UINT32 IMC_CrdSetTrajTurnCoef(UINT64 cardHandle, INT16 crdNo,double turnCoef);

_DLL_API UINT32 IMC_CrdLineXYZ(UINT64 cardHandle, INT16 crdNo,double *pEndPosArray, INT32 userID=0);
_DLL_API UINT32 IMC_CrdLineXY(UINT64 cardHandle, INT16 crdNo,double *pEndPosArray, INT32 userID=0);
_DLL_API UINT32 IMC_CrdLineZX(UINT64 cardHandle, INT16 crdNo,double *pEndPosArray, INT32 userID=0);
_DLL_API UINT32 IMC_CrdLineYZ(UINT64 cardHandle, INT16 crdNo,double *pEndPosArray, INT32 userID=0);

_DLL_API UINT32 IMC_CrdArcThreePoint(UINT64 cardHandle, INT16 crdNo,double *pMidPosArray,double *pEndPosArray, INT32 userID);

//空间arc插补
_DLL_API UINT32 IMC_Crd3DArcCenterNormal(UINT64 cardHandle, INT16 crdNo,double *pCenterArray,double *pEndPosArray,double *pNormalArray,double height=0,INT32 turn=0,INT32 userID=0);
_DLL_API UINT32 IMC_Crd3DArcRadiusNormal(UINT64 cardHandle, INT16 crdNo,double radius,double *pEndPosArray,double *pNormalArray,double height=0,INT32 turn=0,INT32 userID=0);
_DLL_API UINT32 IMC_Crd3DArcAngleNormal(UINT64 cardHandle, INT16 crdNo,double *pCenterArray,double angle,double *pNormalArray,double height=0,INT32 userID=0);
//平面arc插补
//圆心终点编程
_DLL_API UINT32 IMC_CrdArcCenterXYPlane(UINT64 cardHandle, INT16 crdNo,double *pCenterArray,double *pEndPosArray,INT16 dir,double height=0,INT32 turn=0,INT32 userID=0);
_DLL_API UINT32 IMC_CrdArcCenterYZPlane(UINT64 cardHandle, INT16 crdNo,double *pCenterArray,double *pEndPosArray,INT16 dir,double height=0,INT32 turn=0,INT32 userID=0);
_DLL_API UINT32 IMC_CrdArcCenterZXPlane(UINT64 cardHandle, INT16 crdNo,double *pCenterArray,double *pEndPosArray,INT16 dir,double height=0,INT32 turn=0,INT32 userID=0);
//半径终点编程
_DLL_API UINT32 IMC_CrdArcRadiusXYPlane(UINT64 cardHandle, INT16 crdNo,double radius,double *pEndPosArray,INT16 dir,double height=0,INT32 turn=0,INT32 userID=0);
_DLL_API UINT32 IMC_CrdArcRadiusYZPlane(UINT64 cardHandle, INT16 crdNo,double radius,double *pEndPosArray,INT16 dir,double height=0,INT32 turn=0,INT32 userID=0);
_DLL_API UINT32 IMC_CrdArcRadiusZXPlane(UINT64 cardHandle, INT16 crdNo,double radius,double *pEndPosArray,INT16 dir,double height=0,INT32 turn=0,INT32 userID=0);
//圆心角度编程
_DLL_API UINT32 IMC_CrdArcAngleXYPlane(UINT64 cardHandle, INT16 crdNo,double *pCenterArray,double angle,double height=0,INT32 userID=0);
_DLL_API UINT32 IMC_CrdArcAngleYZPlane(UINT64 cardHandle, INT16 crdNo,double *pCenterArray,double angle,double height=0,INT32 userID=0);
_DLL_API UINT32 IMC_CrdArcAngleZXPlane(UINT64 cardHandle, INT16 crdNo,double *pCenterArray,double angle,double height=0,INT32 userID=0);

//涡旋线插补
_DLL_API UINT32 IMC_CrdSpiralAngleXYPlane(UINT64 cardHandle, INT16 crdNo,double *pCenterArray,double angle,double height,double m,INT32 userID);
_DLL_API UINT32 IMC_CrdSpiralAngleYZPlane(UINT64 cardHandle, INT16 crdNo,double *pCenterArray,double angle,double height,double m,INT32 userID);
_DLL_API UINT32 IMC_CrdSpiralAngleZXPlane(UINT64 cardHandle, INT16 crdNo,double *pCenterArray,double angle,double height,double m,INT32 userID);

//椭圆插补
/*起点作为椭圆的一个顶点,给定圆心，以及另一个顶点到圆心的距离b，给定方向，走整椭圆*/
_DLL_API UINT32 IMC_CrdEllipseFullXYPlane(UINT64 cardHandle, INT16 crdNo,double *pCenterArray,double b,INT16 dir,INT32 userID);
_DLL_API UINT32 IMC_CrdEllipseFullYZPlane(UINT64 cardHandle, INT16 crdNo,double *pCenterArray,double b,INT16 dir,INT32 userID);
_DLL_API UINT32 IMC_CrdEllipseFullZXPlane(UINT64 cardHandle, INT16 crdNo,double *pCenterArray,double b,INT16 dir,INT32 userID);

//FIFO事件
_DLL_API UINT32 IMC_CrdWaitTime(UINT64 cardHandle, INT16 crdNo,INT32 waitPeriod,INT32 userID=0);
_DLL_API UINT32 IMC_CrdWaitDI(UINT64 cardHandle, INT16 crdNo,INT16 diNO,INT16 diType,INT16 diLevel,INT32 userID=0);
_DLL_API UINT32 IMC_CrdSetDO(UINT64 cardHandle, INT16 crdNo,INT16 doNO,INT16 doType,INT16 doLevel,INT32 userID=0);
_DLL_API UINT32 IMC_CrdSetDistanceDO(UINT64 cardHandle, INT16 crdNo,double waitPos,INT16 doNO,INT16 doType,INT16 doLevel,INT32 userID=0);
_DLL_API UINT32 IMC_CrdSetTimeDO(UINT64 cardHandle, INT16 crdNo,INT32 waitPeriod,INT16 doNO,INT16 doType,INT16 doLevel,INT32 userID=0);
_DLL_API UINT32 IMC_CrdPTPMove(UINT64 cardHandle, INT16 crdNo,INT16 axNo,double tgtPos,double tgtVel,double acc, INT16 mvType,INT16 waitFlag,INT32 userID=0);
_DLL_API UINT32 IMC_CrdSyncMove(UINT64 cardHandle, INT16 crdNo,INT16 axNo,double syncPos,INT32 userID=0);
_DLL_API UINT32 IMC_CrdWaitInPos(UINT64 cardHandle, INT16 crdNo,INT32 userID=0);
_DLL_API UINT32 IMC_CrdEndData(UINT64 cardHandle, INT16 crdNo,INT16 *pIsFinished);

_DLL_API UINT32 IMC_CrdStart(UINT64 cardHandle, INT16 crdNo);
_DLL_API UINT32 IMC_CrdStop(UINT64 cardHandle, INT16 crdNo,INT16 stopType);
_DLL_API UINT32 IMC_CrdGetStatus(UINT64 cardHandle, INT16 crdNo,INT16 *pStatus);
_DLL_API UINT32 IMC_CrdSetRatio(UINT64 cardHandle, INT16 crdNo,double ratio);
_DLL_API UINT32 IMC_CrdGetRatio(UINT64 cardHandle, INT16 crdNo,double *pRatio);
_DLL_API UINT32 IMC_CrdGetPos(UINT64 cardHandle, INT16 crdNo,double *pCrdPosArray);
_DLL_API UINT32 IMC_CrdGetVel(UINT64 cardHandle, INT16 crdNo,double *pCrdVel);
_DLL_API UINT32 IMC_CrdGetUserID(UINT64 cardHandle, INT16 crdNo,INT32 *pUserID);
_DLL_API UINT32 IMC_CrdGetSpace(UINT64 cardHandle, INT16 crdNo,INT32 *pSpace);
_DLL_API UINT32 IMC_CrdClrData(UINT64 cardHandle, INT16 crdNo);
_DLL_API UINT32 IMC_CrdClrError(UINT64 cardHandle, INT16 crdNo);
_DLL_API UINT32 IMC_CrdGetTargetPos(UINT64 cardHandle, INT16 crdNo,double *pPosArray);
_DLL_API UINT32 IMC_CrdGetPausePos(UINT64 cardHandle, INT16 crdNo,double *pPosArray);
_DLL_API UINT32 IMC_CrdGetArrivalSts(UINT64 cardHandle, INT16 crdNo,INT16 *pSts);

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----7.6 多轴直线插补运动模式接口                                     ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//多轴直线插补映射建立
_DLL_API UINT32 IMC_SetupMutiSyncSys(UINT64 cardHandle,INT16 groupNo,INT16 *pMaskAxNoArray,INT16 maxAxNum);

//获取多轴直线插补的坐标系信息
_DLL_API UINT32 IMC_GetMutiSyncSysInfo(UINT64 cardHandle,INT16 groupNo,INT16 *pMaskAxNoArray,INT16 *pMaxAxNum);

//删除多轴直线插补映射
_DLL_API UINT32 IMC_DeleteMutiSyncSys(UINT64 cardHandle, INT16 groupNo);

// 以最大速度、最大加减速度的比例参数形式进行的多轴线段输入
_DLL_API UINT32 IMC_MutiSyncMotion(UINT64 cardHandle,INT16 groupNo,double *pEndPosArray,short *pVelRatioArray,short *pAccRatioArray,double blendRatio,INT32 userID);
_DLL_API UINT32 IMC_MutiSyncMotionInRatio(UINT64 cardHandle,INT16 groupNo,double *pEndPosArray,short *pVelRatioArray,short *pAccRatioArray,double blendRatio,INT32 userID);
_DLL_API UINT32 IMC_MutiSyncMotionLookaheadInRatio(UINT64 cardHandle,INT16 groupNo,double *pEndPosArray,short *pVelRatioArray,short *pAccRatioArray,double cornerRatio,INT32 userID);

// 以各轴的实际速度、加速度参数的形式进行的多轴线段输入
_DLL_API UINT32 IMC_MutiSyncMotionInAxVelAcc(UINT64 cardHandle,INT16 groupNo,double *pEndPosArray,double *pTrajVelArray,double *pTrajAccArray,double *pTrajdecArray,double blendRatio,INT32 userID);
_DLL_API UINT32 IMC_MutiSyncMotionLookaheadInAxVelAcc(UINT64 cardHandle,INT16 groupNo,double *pEndPosArray,double *pTrajVelArray,double *pTrajAccArray,double *pTrajdecArray,double cornerRatio,INT32 userID);

// 以所有轴的合成速度、加速度的参数形式进行的多轴线段输入
_DLL_API UINT32 IMC_MutiSyncMotionInSynVelAcc(UINT64 cardHandle,INT16 groupNo,double *pEndPosArray,double trajVel,double trajAcc,double trajdec,double blendRatio,INT32 userID);
_DLL_API UINT32 IMC_MutiSyncMotionLookaheadInSynVelAcc(UINT64 cardHandle,INT16 groupNo,double *pEndPosArray,double trajVel,double trajAcc,double trajdec,double cornerRatio,INT32 userID);

// 以各轴的速度、加减速时间的参数形式进行的多轴线段输入：accTime，decTime单位为ms
_DLL_API UINT32 IMC_MutiSyncMotionInAccDecTime(UINT64 cardHandle,INT16 groupNo,double *pEndPosArray,double *pTrajVelArray,double accTime,double decTime,double blendRatio,INT32 userID);

// 以运动总执行时间、加减速时间的参数形式进行的多轴线段输入：runTime，accTime，decTime单位为ms
_DLL_API UINT32 IMC_MutiSyncMotionInRunTime(UINT64 cardHandle,INT16 groupNo,double *pEndPosArray,double runTime,double accTime,double decTime,double blendRatio,INT32 userID);

//多轴插补启停
_DLL_API UINT32 IMC_MutiSyncStart(UINT64 cardHandle, INT16 groupNo);
_DLL_API UINT32 IMC_MutiSyncStop(UINT64 cardHandle, INT16 groupNo,INT16 stopType);

//多轴插补状态获取
_DLL_API UINT32 IMC_MutiSyncGetStatus(UINT64 cardHandle, INT16 groupNo,INT16 *pStatus);

//多轴插补倍率读写
_DLL_API UINT32 IMC_MutiSyncSetRatio(UINT64 cardHandle, INT16 groupNo,double ratio);
_DLL_API UINT32 IMC_MutiSyncGetRatio(UINT64 cardHandle, INT16 groupNo,double *pRatio);

//多轴插补用户ID读取
_DLL_API UINT32 IMC_MutiSyncGetUserID(UINT64 cardHandle, INT16 groupNo,INT32 *pUserID);

//获取多轴插补空间余量
_DLL_API UINT32 IMC_MutiSyncGetSpace(UINT64 cardHandle, INT16 groupNo,INT32 *pSpace);

//清除多轴插补缓存区数据
_DLL_API UINT32 IMC_MutiSyncClrData(UINT64 cardHandle, INT16 groupNo);

//多轴插补故障清除
_DLL_API UINT32 IMC_MutiSyncClrError(UINT64 cardHandle, INT16 groupNo);

//多轴插补编程模式设定
_DLL_API UINT32 IMC_MutiSyncSetType(UINT64 cardHandle, INT16 groupNo,INT16 type);

//多轴插补编程模式读取
_DLL_API UINT32 IMC_MutiSyncGetType(UINT64 cardHandle, INT16 groupNo,INT16 *type);

//多轴当前合成速度读取
_DLL_API UINT32 IMC_MutiSyncGetTrajVel(UINT64 cardHandle, INT16 groupNo,double *pVel);

//多轴获取到位状态
_DLL_API UINT32 IMC_MutiSyncGetArrivalSts(UINT64 cardHandle, INT16 groupNo,INT16 *pSts);


/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----7.6 捆绑PT运动模式接口                                     ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_SetupPtPackSys(UINT64 cardHandle,INT16 sysNo,INT16 *pMaskAxNoArray,INT16 maxAxNum);

_DLL_API UINT32 IMC_AddMotionPointPtPack(UINT64 cardHandle,INT16 sysNo,INT32 *pPosArray,INT16 *pTypeArray,double T,INT16 dataNum);

_DLL_API UINT32 IMC_AddDoPointPtPack(UINT64 cardHandle,INT16 sysNo,INT16 doNo,INT16 doType,INT16 doLevel);

_DLL_API UINT32 IMC_StartPtPack(UINT64 cardHandle,INT16 sysNo);

_DLL_API UINT32 IMC_StopPtPack(UINT64 cardHandle,INT16 sysNo,INT16 type);

_DLL_API UINT32 IMC_GetPtPackRestSpace(UINT64 cardHandle,INT16 sysNo,INT16 *pSpace);

_DLL_API UINT32 IMC_GetPtPackStatus(UINT64 cardHandle,INT16 sysNo,INT16 *pStatus);

_DLL_API UINT32 IMC_DeletePtPackSys(UINT64 cardHandle,INT16 sysNo);

_DLL_API UINT32 IMC_ClrPtPackData(UINT64 cardHandle,INT16 sysNo);

_DLL_API UINT32 IMC_SetPtPackIncMode(UINT64 cardHandle,INT16 sysNo,INT16 incMode);

_DLL_API UINT32 IMC_GetPtPackIncMode(UINT64 cardHandle,INT16 sysNo,INT16 *pIncMode);

_DLL_API UINT32 IMC_EnablePtPackNoDataProtect(UINT64 cardHandle,INT16 sysNo,double *pThresholdVel);

_DLL_API UINT32 IMC_DisablePtPackNoDataProtect(UINT64 cardHandle,INT16 sysNo);

_DLL_API UINT32 IMC_GetPtPackNoDataProtectStatus(UINT64 cardHandle,INT16 sysNo,INT16 *pEnSts,double *pThresholdVel);

_DLL_API UINT32 IMC_ClrPtPackError(UINT64 cardHandle,INT16 sysNo);

_DLL_API UINT32 IMC_GetPtPackError(UINT64 cardHandle,INT16 sysNo,INT16 *pErr);

_DLL_API UINT32 IMC_PtPackGetArrivalSts(UINT64 cardHandle, INT16 sysNo,INT16 *pSts);


/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----7.7 PTP连续运动模式接口                                     ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_PTPCAddFixTData(UINT64 cardHandle,INT16 axNo,double tgtPos,double acc,double dec,double T,double finalVel,INT16 posType);
_DLL_API UINT32 IMC_PTPCAddFixVmData(UINT64 cardHandle,INT16 axNo,double tgtPos,double acc,double dec,double tgtVel,double finalVel,INT16 posType);
_DLL_API UINT32 IMC_PTPCInterruptData(UINT64 cardHandle,INT16 axNo,double tgtPos,double acc,double dec,double tgtVel,double finalVel,INT16 posType);
_DLL_API UINT32 IMC_PTPCStart(UINT64 cardHandle,INT16 axNo);
_DLL_API UINT32 IMC_PTPCGetSpace(UINT64 cardHandle,INT16 axNo,INT32 *pSpace);
_DLL_API UINT32 IMC_PTPCClrData(UINT64 cardHandle,INT16 axNo);

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----7.8 多轴插补立即运动模式接口                                   ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_ImmediateLineMoveInSynVelAcc(UINT64 cardHandle, INT16 *pMaskAxNoArray,INT16 axNum,double *pEndPosArray,double trajVel,double trajAcc,double trajDec,double smoothCoef,INT16 type);
_DLL_API UINT32 IMC_ImmediateLineMoveInAxisVelAcc(UINT64 cardHandle, INT16 *pMaskAxNoArray,INT16 axNum,double *pEndPosArray,double *pAxVelArray,double *pAxAccArray,double *pAxDecArray,double smoothCoef,INT16 type);
_DLL_API UINT32 IMC_ImmediateArcThreePointMove(UINT64 cardHandle, INT16 *pMaskAxNoArray,INT16 axNum,double *pMidPosArray,double *pEndPosArray,double trajVel,double trajAcc,double trajDec,double smoothCoef,INT16 type);
_DLL_API UINT32 IMC_ImmediateArcCenterMove(UINT64 cardHandle, INT16 *pMaskAxNoArray,INT16 axNum,double *pCenterArray,double *pEndPosArray,INT16 dir,double height,int turn,double trajVel,double trajAcc,double trajDec,double smoothCoef,INT16 type);
_DLL_API UINT32 IMC_ImmediateArcRadiusMove(UINT64 cardHandle, INT16 *pMaskAxNoArray,INT16 axNum,double radius,double *pEndPosArray,INT16 dir,double height,int turn,double trajVel,double trajAcc,double trajDec,double smoothCoef,INT16 type);
_DLL_API UINT32 IMC_ImmediateArcAngleMove(UINT64 cardHandle, INT16 *pMaskAxNoArray,INT16 axNum,double *pCenterArray,double angle,double height,double trajVel,double trajAcc,double trajDec,double smoothCoef);
_DLL_API UINT32 IMC_ImmediateMoveGetVel(UINT64 cardHandle,INT16 axNo,double *pTrajVel);
_DLL_API UINT32 IMC_ImmediateMoveStop(UINT64 cardHandle,INT16 axNo);
_DLL_API UINT32 IMC_ImmediateMoveEStop(UINT64 cardHandle,INT16 axNo,double estopDec);


/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----7.9 周期运动模式接口                                   ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_SetCycleMovePara(UINT64 cardHandle, INT16 axNo,INT32 cycleDis);
_DLL_API UINT32 IMC_GetCycleMovePara(UINT64 cardHandle, INT16 axNo,INT32 *pCycleDis);
_DLL_API UINT32 IMC_StartCycleMove(UINT64 cardHandle, INT16 axNo,INT32 tgtPos,INT16 posType);
_DLL_API UINT32 IMC_StopCycleMove(UINT64 cardHandle, INT16 axNo,INT16 stopType);
_DLL_API UINT32 IMC_GetCycleMovePrfPos(UINT64 cardHandle, INT16 axNo,INT32 *pPrfPos);
_DLL_API UINT32 IMC_GetCycleMoveEncPos(UINT64 cardHandle, INT16 axNo,INT32 *pEncPos);
_DLL_API UINT32 IMC_SetCycleMoveCurPos(UINT64 cardHandle, INT16 axNo,INT32 setPos);


/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*----8.0 事件管理                                             ---*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
_DLL_API UINT32 IMC_SetEventIO(UINT64 cardHandle,INT16 group,TEventIO *pEventIOPara);
_DLL_API UINT32 IMC_GetEventIO(UINT64 cardHandle,INT16 group,TEventIO *pEventIOPara);
_DLL_API UINT32 IMC_EnableEventIO(UINT64 cardHandle,INT16 group);
_DLL_API UINT32 IMC_DisableEventIO(UINT64 cardHandle,INT16 group);
_DLL_API UINT32 IMC_GetEventIOEnSts(UINT64 cardHandle,INT16 group,INT16 *enSts);
_DLL_API UINT32 IMC_DestroyEventIO(UINT64 cardHandle,INT16 group);
_DLL_API UINT32 IMC_GetEventIOSetupSts(UINT64 cardHandle,INT16 group,INT16 *pSts);

_DLL_API UINT32 IMC_SetEventDiMotion(UINT64 cardHandle,INT16 group,TEventDiMotion *pEventDiMotionPara);
_DLL_API UINT32 IMC_GetEventDiMotion(UINT64 cardHandle,INT16 group,TEventDiMotion *pEventDiMotionPara);
_DLL_API UINT32 IMC_EnableEventDiMotion(UINT64 cardHandle,INT16 group);
_DLL_API UINT32 IMC_DisableEventDiMotion(UINT64 cardHandle,INT16 group);
_DLL_API UINT32 IMC_GetEventDiMotionSts(UINT64 cardHandle,INT16 group,INT16 *pSts);
_DLL_API UINT32 IMC_ClearEventDiMotionSts(UINT64 cardHandle,INT16 group);
_DLL_API UINT32 IMC_GetEventDiMotionEnSts(UINT64 cardHandle,INT16 group,INT16 *enSts);
_DLL_API UINT32 IMC_DestroyEventDiMotion(UINT64 cardHandle,INT16 group);
_DLL_API UINT32 IMC_GetEventDiMotionSetupSts(UINT64 cardHandle,INT16 group,INT16 *pSts);

_DLL_API UINT32 IMC_SetEventCompareOut(UINT64 cardHandle,INT16 group,TEventCompareOut *pEventCompareOutPara);
_DLL_API UINT32 IMC_GetEventCompareOut(UINT64 cardHandle,INT16 group,TEventCompareOut *pEventCompareOutPara);
_DLL_API UINT32 IMC_EnableEventCompareOut(UINT64 cardHandle,INT16 group);
_DLL_API UINT32 IMC_DisableEventCompareOut(UINT64 cardHandle,INT16 group);
_DLL_API UINT32 IMC_GetEventCompareOutEnSts(UINT64 cardHandle,INT16 group,INT16 *enSts);
_DLL_API UINT32 IMC_DestroyEventCompareOut(UINT64 cardHandle,INT16 group);
_DLL_API UINT32 IMC_GetEventCompareOutSetupSts(UINT64 cardHandle,INT16 group,INT16 *pSts);

_DLL_API UINT32 IMC_SetEventVirtualIOVal(UINT64 cardHandle,INT16 port,INT16 val);
_DLL_API UINT32 IMC_GetEventVirtualIOVal(UINT64 cardHandle,INT16 port,INT16 *pVal);
_DLL_API UINT32 IMC_GetEventVirtualIOUseSts(UINT64 cardHandle,INT16 port,INT16 *pSts);
_DLL_API UINT32 IMC_EnableEventVirtualIO(UINT64 cardHandle,INT16 port,INT16 en);
_DLL_API UINT32 IMC_GetEventVirtualIOEnableSts(UINT64 cardHandle,INT16 port,INT16 *pSts);

#endif


