
// MOTION TYPE
#define   ACCMODE  0
#define   CONST2   1
#define   CONST3   2

#define SERVO_ON_flag  1
#define SERVO_OFF_flag 0

//add for MF function by star========================================
#define Sqrt2			1.414213
#define Sqrt3			1.732050
#define Sqrt2_over_One		0.707107
#define Sqrt3_over_One		0.577351
#define Sprt2_over_Sprt3	0.816497
//===================================================================



#define SUCCESS_NO_ERROR                          0

// indicate the unsuccessful routine-execution
#define ERROR_ROUTINE_FAIL_BASE                   -100
#define ERROR_GET_CARD_ID                         -101
#define ERROR_DEVICE_OPEN                         -102
#define ERROR_DEVICE_CLOSE                        -103
#define ERROR_CARD_RESET                          -104
#define ERROR_RANGE_CHANGE                        -105
#define ERROR_PULSE_MODE_SET                      -106
#define ERROR_ENCODER_MODE_SET                    -107
#define ERROR_LIMIT_SENSOR_SET                    -108
#define ERROR_INP_SIGNAL_SET                      -109
#define ERROR_ALARM_SIGNAL_SET                    -110
#define ERROR_SERVO_ON_SET                        -111
#define ERROR_IN3_SET                             -112
#define ERROR_IN3_GET                             -113
#define ERROR_FILTER_SET                          -114
#define ERROR_SW_LIMIT_SET                        -115
#define ERROR_HOME_CFG_SET                        -116
#define ERROR_HOME_LIMIT_SET                      -117
#define ERROR_START_HOME                          -118
#define ERROR_DI_STATUS_GET                       -119
#define ERROR_ERROR_STATUS_GET                    -120
#define ERROR_CMD_COUNTER_SET                     -121
#define ERROR_CMD_COUNTER_GET                     -122
#define ERROR_POS_COUNTER_SET                     -123
#define ERROR_POS_COUNTER_GET                     -124
#define ERROR_MOTION_DONE_GET                     -125
#define ERROR_SPEED_GET                           -126
#define ERROR_ACCELERATION_GET                    -127
#define ERROR_LATCH_GET                           -128
#define ERROR_MOTION_STOP_SET                     -129
#define ERROR_MOTION_STOP_ALL_SET                 -130
#define ERROR_DRIVE_START                         -131
#define ERROR_DRIVE_HOLD                          -132
#define ERROR_VRING_SET                           -133
#define ERROR_MPG_SET                             -134
#define ERROR_CMPTRIG_SET                         -135
#define ERROR_SYNCH_SET                           -136
#define ERROR_INT_FACTOR_SET                      -137
#define ERROR_INT_STATUS_GET                      -138
#define ERROR_CONTI_MOVE_START                    -139
#define ERROR_CONST_MOVE_START                    -140
#define ERROR_T_MOVE_START                        -141
#define ERROR_S_MOVE_START                        -142
#define ERROR_T_LINE2_START                       -143
#define ERROR_T_LINE3_START                       -144
#define ERROR_S_LINE2_START                       -145
#define ERROR_S_LINE3_START                       -146
#define ERROR_T_ARC2_START                        -147
#define ERROR_CONTI_INTERP_SET                    -148
#define ERROR_CONTI_INTERP_CLEAR                  -149
#define ERROR_CONTI_INTERP_NEXT_READY             -150
#define ERROR_CONTI_INTERP_LINE2_MOVE             -151
#define ERROR_CONTI_INTERP_LINE3_MOVE             -152
#define ERROR_CONTI_INTERP_ARC2_MOVE              -153
#define ERROR_T_DRIVING_SPEED_CHANGE              -154
#define ERROR_T_AVOID_TRIANGLE_SET                -155
#define ERROR_OUTPUT_PULSE_CHANGE                 -156
#define ERROR_OUT1_GET                            -157
#define ERROR_FRNET_DI_MODULE_GET                 -158
#define ERROR_FRNET_FREQUENCY_SET                 -159
#define ERROR_FRNET_INPUT                         -160
#define ERROR_FRNET_OUTPUT                        -161
#define ERROR_FRNET_RESET                         -162

// for internal-use functions
#define ERROR_CPLD_VERSION_GET                    -191
#define ERROR_DIP_SW_GET                          -192

// Parameters Error
#define ERROR_INVALID_PARAMETER_BASE              -200
#define ERROR_INVALID_CARD_ID                     -201
#define ERROR_INVALID_SCANNED_INDEX               -202
#define ERROR_CARD_ID_DUPLICATED                  -203
#define ERROR_INVALID_RANGE                       -204
#define ERROR_INVALID_PULSE_MODE                  -205
#define ERROR_INVALID_PULSE_LEVEL                 -206
#define ERROR_INVALID_PULSE_DIRECTION             -207
#define ERROR_INVALID_ENCODER_MODE                -208
#define ERROR_INVALID_LIMIT_LOGIC                 -209
#define ERROR_INVALID_STOP_MODE                   -210
#define ERROR_INVALID_INP_ENABLE                  -211
#define ERROR_INVALID_INP_LOGIC_LEVEL             -212
#define ERROR_INVALID_ALARM_ENABLE                -213
#define ERROR_INVALID_ALARM_LOGIC_LEVEL           -214
#define ERROR_INVALID_SERVO_SETTING               -215
#define ERROR_INVALID_IN3_ENABLE                  -216
#define ERROR_INVALID_IN3_LOGIC_LEVEL             -217
#define ERROR_INVALID_FILTER_ENABLE               -218
#define ERROR_INVALID_FILTER_CONFIGURATION        -219
#define ERROR_INVALID_FILTER_DELAY_TIME           -220
#define ERROR_INVALID_SOFTWARE_LIMIT_ENABLE       -221
#define ERROR_INVALID_SOFTWARE_LIMIT_COMPARATOR_SOURCE	-222
#define ERROR_INVALID_MOVE_DIRECTION              -223
#define ERROR_INVALID_HOME_LOGIC_LEVEL            -224
#define ERROR_INVALID_NEAR_HOME_LOGIC_LEVEL       -225
#define ERROR_INVALID_INDEX_LOGIC_LEVEL           -226
#define ERROR_INVALID_AUTO_HOME_STEP              -227
#define ERROR_INVALID_BLOCK_OPEARTION_MODE        -228
#define ERROR_INVALID_AVOID_TRIANGLE_CONFIG       -229
#define ERROR_INVALID_MPG_EXP_CONFIG              -230
#define ERROR_INVALID_NHOME_SEARCH_SPEED          -231
#define ERROR_INVALID_HOME_SEARCH_SPEED           -232
#define ERROR_INVALID_ACCELERATION                -233
#define ERROR_INVALID_DECELERATION                -234
#define ERROR_INVALID_JERK                        -235
#define ERROR_INVALID_DECELERATION_RATE           -236
#define ERROR_INVALID_RING_COUNTER                -237
#define ERROR_INVALID_RING_ENABLE				          -238
#define ERROR_INVALID_AXIS                        -239
#define ERROR_INVALID_CONST_PITCH                 -240
#define ERROR_INVALID_OFFSET_BUFFER               -241
#define ERROR_INVALID_OFFSET_LEN                  -242
#define ERROR_INVALID_OFFSET_DATA                 -243
#define ERROR_INVALID_START_SPEED                 -244
#define ERROR_INVALID_DRIVING_SPEED               -245
#define ERROR_INVALID_MANUAL_DECELERATION_POINT   -246
#define ERROR_START_SPEED_EXCEED_DRIVING_SPEED    -247
#define ERROR_MULTI_AXES_ASSIGNED                 -248
#define ERROR_NO_VALID_AXIS_ASSIGNED              -249
#define ERROR_INVALID_INTERPOLATION_SLAVE_AXES    -250
#define ERROR_INTERPOLATION_SLAVE_AXES_DUPLICATED -251
#define ERROR_INVALID_SYNCHRONOUS_AXES            -252
#define ERROR_INVALID_INTERPOLATION_ARC_DIRECTION	-253
#define ERROR_INVALID_CONTINUE_INTERPOLATION_MOTION	-254
#define ERROR_INVALID_FRNET_PERIODIC_ENABLE       -255
#define ERROR_INVALID_FRNET_PERIODIC_FACTOR       -256
#define ERROR_INVALID_FRNET_SA_GROUP_ADDRESS      -257
#define ERROR_INVALID_FRNET_RA_GROUP_ADDRESS      -258
#define ERROR_INVALID_FRNET_ACCESS_MODE			      -259
#define ERROR_INVALID_COMPARE_SOURCE			        -260
#define ERROR_INVALID_MPG_SPEED                   -261
#define ERROR_INVALID_CMPTRIG_ENABLE			        -262
#define ERROR_INVALID_CMPTRIG_TRIGGER_MODE		    -263
#define ERROR_INVALID_CMPTRIG_LOGIC_LEVEL		      -264
#define ERROR_INVALID_CMPTRIG_PULSE_WIDTH		      -265
#define ERROR_INVALID_SYNCH_ENABLE				        -266
#define ERROR_INVALID_SYNCH_CONDITION			        -267
#define ERROR_INVALID_SYNCH_ACTION				        -268
#define ERROR_INVALID_EVENT_ENABLE				        -269
#define ERORR_INVALID_INT_FACTOR                  -270
#define ERORR_INVALID_FEEDBACK_SOURCE             -271

// RunTime Error
#define ERROR_RUNTIME_BASE                        -300
#define ERROR_OCCURS_IN_AXIS_X                    -301
#define ERROR_OCCURS_IN_AXIS_Y                    -302
#define ERROR_OCCURS_IN_AXIS_XY                   -303
#define ERROR_OCCURS_IN_AXIS_Z                    -304
#define ERROR_OCCURS_IN_AXIS_XZ                   -305
#define ERROR_OCCURS_IN_AXIS_YZ                   -306
#define ERROR_OCCURS_IN_AXIS_XYZ                  -307
#define ERROR_OCCURS_IN_AXIS_U                    -308
#define ERROR_OCCURS_IN_AXIS_XU                   -309
#define ERROR_OCCURS_IN_AXIS_YU                   -310
#define ERROR_OCCURS_IN_AXIS_XYU                  -311
#define ERROR_OCCURS_IN_AXIS_ZU                   -312
#define ERROR_OCCURS_IN_AXIS_XZU                  -313
#define ERROR_OCCURS_IN_AXIS_YZU                  -314
#define ERROR_OCCURS_IN_AXIS_XYZU                 -315

#define	ERROR_NO_CARD_FOUND                       -316
#define ERROR_MEMORY_MAP                          -317
#define ERROR_MEMORY_UNMAP                        -318
#define ERROR_ACCESS_VIOLATION_DATA_COPY          -319
#define ERROR_VARIABLE_PITCH_SET                  -320
#define	ERROR_INT_EVENT_ATTACH                    -321
#define ERROR_INT_EVENT_DETTACH                   -322
#define ERROR_INT_EVENT_CREATE                    -323
#define ERROR_CONFIG_IS_NEEDED                    -324
#define ERROR_MOTION_NOT_COMPLETE                 -325
#define ERROR_CONFLICT_WITH_SOFTLIMIT             -326
#define ERROR_CONFLICT_WITH_CMPTRIG               -327
#define ERROR_CONFLICT_WITH_VRING                 -328
#define ERROR_CONFLICT_WITH_SYNCH_ACTION          -329
#define ERROR_ARC_DECELERATION_POINT_CALCULATE    -330
#define ERROR_REASSIGN_SYNCH_MODE_COMMAND         -331
#define ERROR_OVERLAP_EVENT_CREATE                -332
#define ERROR_INTERPOLATION_NOT_COMPLETE          -333
#define ERROR_CONTI_INTERP_INTERRUPTED            -334
#define ERROR_CONTI_INTERP_INCORRECT_CONFIG       -335
#define ERROR_CONTI_INTERP_NEXT_NOT_READY         -336
#define ERROR_SPEED_CHANGE_FAIL_IN_ACC_DEC        -337
#define ERROR_INVALID_OPERATION_IN_S_CURVE        -338
#define ERROR_NOT_CONSTANT_SPEED_IN_T_MOVE        -339
#define ERROR_MOTION_IS_COMPLETED                 -340
#define ERROR_CONFLICT_WITH_INTERPOLATION_MOVE    -341
#define ERROR_HOLD_AXES_NOT_MATCH                 -342
#define ERROR_BLOCK_OP_CONFLICT_WITH_CMPTRIG      -343
#define ERROR_CONFLICT_WITH_MPG					  -344
#define ERROR_HOLD_AXES_NOT_RELEASE               -345
#define ERROR_ZPHASE_ACTIVE_AT_STEP3              -346
#define ERROR_BLOCK_OP_CONFLICT_WITH_DRV_HOLD     -347

#define ERROR_AXES_MOVE_CHECK                     -360
#define ERROR_IOCTL_FAILED                        -361
#define ERROR_UNDEFINED_EXCEPTION                 -362

#define ERROR_CONFIG_FILE_LOAD                    -370
#define ERROR_CONFLICT_IN_CONFIG_FILE             -371
#define ERROR_INVALID_FILE_HANDLE                 -372

#define ERROR_ACCESS_REGISTRY_ACTIVE_ROOT         -375
#define ERROR_ACCESS_REGISTRY_ACTIVE_NUMBER       -376

#define ERROR_UNSUPPORTED_FUNCTION                -380

#ifdef _ABSOLUTE_POSITION_SUPPORT_
#define ERROR_INVALID_ABS_ADDRESS_RECORD          -390
#endif
