Datasheet

cop->OutPolyCoef0;
op->Status = USBIO_WriteAO( &local->USB_Handle, 2, fvalue);
if ( op->Status) op->Super.ErrorCount++;
}
// Check Error Soft and Hard Limit
// Write warning message if soft limit is reached
if ( op->Super.ErrorCount >= op->Super.ErrorSoftLimit &&
error_count < op->Super.ErrorSoftLimit)
errh_Warning( "IO Card ErrorSoftLimit reached, '%s'", cp->Name);
// Stop I/O if hard limit is reached
if ( op->Super.ErrorCount >= op->Super.ErrorHardLimit) {
errh_Error( "IO Card ErrorHardLimit reached '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
return IO__ERRDEVICE;
}
return IO__SUCCESS;
}
// Every method should be registred here
pwr_dExport pwr_BindIoUserMethods(MotionControl_USBIO) = {
pwr_BindIoUserMethod(IoCardInit),
pwr_BindIoUserMethod(IoCardClose),
pwr_BindIoUserMethod(IoCardRead),
pwr_BindIoUserMethod(IoCardWrite),
pwr_NullMethod
};
Class registration
To make it possible for the I/O framework to find the methods of the class, the class has to be
registered. This is done by creating the file $pwrp_src/rt_io_user.c. You use the macros
pwr_BindIoUserMethods and pwr_BindIoUserClass for each class that contains methods.
rt_io_user.c
#include "pwr.h"
#include "rt_io_base.h"
pwr_dImport pwr_BindIoUserMethods(MotionControl_USBIO);
pwr_BindIoUserClasses(User) = {
pwr_BindIoUserClass(MotionControl_USBIO),
pwr_NullClass
};
Makefile
To compile the c-files we create a make-file on $pwrp_src, $pwrp_src/makefile. This will
compile ra_io_m_motioncontro_usbio.c and rt_io_user.c, and place the object
modules on the directory $pwrp_obj.
makefile
mars2_top : mars2
include $(pwr_exe)/pwrp_rules.mk