asynDrvr::asynDrvr( const char *portName, int index )
:EWBAsynPortDrvr( portName, MAX_NUM_SCOPE_PARAMS )
{
EWBBridge *pBgd;
pBgd = (EWBBridge*)new EWBBgdAXICon( WB2_ROOT_PERIPH_OFFSET, WB2_PERIPH_MAPPING_SIZE,
WB2_PM_SLW_PERIPH_OFFSET, (uint32_t)WB2_PM_SLW_PERIPH_LAST, WB2_PM_SLW_BLOCKSIZE,
WB2_PM_RAW_PERIPH_OFFSET, (uint32_t)WB2_PM_RAW_PERIPH_LAST, WB2_PM_RAW_BLOCKSIZE);
//Then define the root of the bus
pRoot = new EWBBus( pBgd, 0x0, NULL );
if(pRoot->isValid()==false){
printf("ERROR while creating pRoot!");
}
pPrhCtl = NULL;
#ifdef _DEBUG
EWBTrace::getInstance().setLevel(EWBTrace::DEBUG);
#else
EWBTrace::getInstance().setLevel(EWBTrace::ERROR);
#endif
EWBTrace::getInstance().setLevel(EWBTrace::ERROR);
}
asynDrvr::~asynDrvr()
{
}
// Setup
//
// Setup for all the params needed in the driver. Create all the params included in each periph
//
asynStatus asynDrvr::setup()
{
AsynStatusObj status = asynSuccess;
setupEWBPeriphCtl();
syncTimeReg();
return status;
}
{
EWBReg *lastreg;
AsynStatusObj status = asynSuccess;
pPrhCtl = new EWBPeriph(this->pRoot,WB2_PRH_ARGS( CTL ));
lastreg = new EWBReg( pPrhCtl, WB2_REG_ARGS( CTL, CTRL ));
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, RSTSW )));
pPosMes = new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, POSMESENA ),0);
createParam( pPosMes );
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, ALARM ), 1), &idxAlarm , EWB_SYNC_FLG_POST | EWB_SYNC_FLG_DEV); // TS3
pAcqst = new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, ACQST ),0);
createParam( pAcqst );
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, USERBUFDUMP )), &idxDumpBuffer, EWB_SYNC_FLG_POST | EWB_SYNC_FLG_DEV);
pChannelCalib = new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, SELFCLBENA ));
createParam(pChannelCalib, &idxChannelCalib, EWB_SYNC_FLG_POST | EWB_SYNC_FLG_DEV | EWB_SYNC_FLG_PRE);
// createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, CABLECLBENA )), &idxCableCalib, EWB_SYNC_FLG_POST | EWB_SYNC_FLG_DEV);
pCableCalib = new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, CABLECLBENA ));
createParam( pCableCalib, &idxCableCalib, EWB_SYNC_FLG_POST | EWB_SYNC_FLG_DEV);
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, CNF_RDY )));
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, BPM_RDY )));
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, ALARM_X )), &idxAlarmX, EWB_SYNC_FLG_POST | EWB_SYNC_FLG_DEV);
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, ALARM_Y )), &idxAlarmY, EWB_SYNC_FLG_POST | EWB_SYNC_FLG_DEV);
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, ALARM_I )), &idxAlarmI, EWB_SYNC_FLG_POST | EWB_SYNC_FLG_DEV);
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, ALARM_P )), &idxAlarmP, EWB_SYNC_FLG_POST | EWB_SYNC_FLG_DEV);
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, ALARM_X_ACK )));
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, ALARM_Y_ACK )));
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, ALARM_I_ACK )));
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, ALARM_P_ACK )));
pIdle = new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, GET_IDLE ));
createParam( pIdle, &idxIdle );
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, CTRL, BPMSTATE )), &idxBpmState, EWB_SYNC_FLG_PRE | EWB_SYNC_FLG_POST | EWB_SYNC_FLG_DEV);
// Code to set the machine in Startup mode in each driver reboot
setIdle();
lastreg = new EWBReg( pPrhCtl, WB2_REG_ARGS( CTL, OVERAGE ));
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, OVERAGE, ADC_TOP )));
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, OVERAGE, ADC_BOTTOM )));
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, OVERAGE, ADC_RIGHT )));
createParam( new EWBField( lastreg, WB2_FIELD_ARGS( CTL, OVERAGE, ADC_LEFT )));
createParam( "calibration_msg", asynParamOctet, &idxCalibrationMsg );
setStringParam( idxCalibrationMsg, "Please, select calibration to calibrate the system" );
createParam( "reset_calibration", asynParamInt32, &idxResetCalibration);
setIntegerParam( idxResetCalibration, 1 );
createParam( "Cavity_present", asynParamInt32, &idxCavityPresent);
setIntegerParam( idxCavityPresent, 0 );
createParam( "disable_calibration", asynParamInt32, &idxDisableCalibration);
setIntegerParam( idxDisableCalibration, 1);
createParam( "nfs_status", asynParamInt32);
// This PV allow to enable-disable the coupling compensation, using caput command
createParam( "enable_compensation", asynParamInt32, &idxEnableCompensation);
setIntegerParam( idxEnableCompensation, 0 );
createParam( "ntp_status", asynParamInt32 );
return status;
}