/* File: asynDrvChassis.cpp * Author: Hovanes Egiyan, Jefferson Lab * Date: 09-Feb-2015 * * Purpose: * This module provides the driver support for the asyn device support layer * for the VME chassis scaler information to interface with software developed * by Paul Mattione. * * */ #include "asynDrvChassis.hh" #include "chassisVAsynPar.hh" #include "chassisAsynPar.hh" // Driver name template string asynDrvChassis::adcDriverName = "asynDrvChassis"; // Maximum length for values that are of scalar, string or waveform type template unsigned asynDrvChassis::adcMaxValueBufferLength = (2<<16); // Map of all instances of this class object. The key is the port name, the value is // the pointer to the asyn port driver. template map*> asynDrvChassis::adcChassisMap; // This function simply calls the member function of the driver whose pointer // is passed as the argument. This function is to be called from a separate // thread and is specified in the argument when launching that thread template void asynDrvChassis::threadFunction( void *drvPvt ) { asynDrvChassis* pPvt = (asynDrvChassis *)drvPvt; pPvt->readSharedMemory(); } template class asynDrvChassis; template class asynDrvChassis; template class asynDrvChassis; template class asynDrvChassis; /***************/ /* Definitions */ /***************/ extern "C" { /* iocsh config function */ static const iocshArg asynDrvChassisConfigArg0 = { "Asyn port name", iocshArgString }; static const iocshArg * const asynDrvChassisConfigArgs[] = { &asynDrvChassisConfigArg0 }; char* asynDrvDiscChassisConfig( const char *portName ) { // First create the vector of parameters for the driver to be started cout << "Creating vector of ASYN parameters " << endl; vector*> parVec = asynDrvChassis::createParVector(); // Now create the asyn driver cout << "Creating the driver for discriminator chassis at port " << portName << endl; asynDrvChassis* pChassis = new asynDrvChassis( portName, parVec ); cout << "asynPortDriver has been created at address " << hex << pChassis << dec << endl; return reinterpret_cast( pChassis ); } static const iocshFuncDef asynDrvDiscChassisConfigFuncDef = {"asynDrvDiscChassisConfig", 1, asynDrvChassisConfigArgs}; static void asynDrvDiscChassisConfigCallFunc(const iocshArgBuf *args) { asynDrvDiscChassisConfig( args[0].sval ); } void asynDrvDiscChassisRegister(void) { iocshRegister( &asynDrvDiscChassisConfigFuncDef,asynDrvDiscChassisConfigCallFunc ); } epicsExportRegistrar( asynDrvDiscChassisRegister ); char* asynDrvFADCChassisConfig( const char *portName ) { // First create the vector of parameters for the driver to be started cout << "Creating vector of ASYN parameters " << endl; vector* > parVec = asynDrvChassis::createParVector(); // Now create the asyn driver cout << "Creating the driver for FADC250 chassis at port " << portName << endl; asynDrvChassis* pChassis = new asynDrvChassis( portName, parVec ); cout << "asynPortDriver has been created at address " << hex << pChassis << dec << endl; return reinterpret_cast( pChassis ); } static const iocshFuncDef asynDrvFADCChassisConfigFuncDef = {"asynDrvFADCChassisConfig", 1, asynDrvChassisConfigArgs}; static void asynDrvFADCChassisConfigCallFunc(const iocshArgBuf *args) { asynDrvFADCChassisConfig( args[0].sval ); } void asynDrvFADCChassisRegister(void) { iocshRegister( &asynDrvFADCChassisConfigFuncDef,asynDrvFADCChassisConfigCallFunc ); } epicsExportRegistrar( asynDrvFADCChassisRegister ); char* asynDrvSSPDIRCChassisConfig( const char *portName ) { // First create the vector of parameters for the driver to be started cout << "Creating vector of ASYN parameters " << endl; vector* > parVec = asynDrvChassis::createParVector(); // Now create the asyn driver cout << "Creating the driver for SSPD DIRC chassis at port " << portName << endl; asynDrvChassis* pChassis = new asynDrvChassis( portName, parVec ); cout << "asynPortDriver has been created at address " << hex << pChassis << dec << endl; return reinterpret_cast( pChassis ); } static const iocshFuncDef asynDrvSSPDIRCChassisConfigFuncDef = {"asynDrvSSPDIRCChassisConfig", 1, asynDrvChassisConfigArgs}; static void asynDrvSSPDIRCChassisConfigCallFunc(const iocshArgBuf *args) { asynDrvSSPDIRCChassisConfig( args[0].sval ); } void asynDrvSSPDIRCChassisRegister(void) { iocshRegister( &asynDrvSSPDIRCChassisConfigFuncDef,asynDrvSSPDIRCChassisConfigCallFunc ); } epicsExportRegistrar( asynDrvSSPDIRCChassisRegister ); } // extern "C"