Skip to content

Commit

Permalink
Add support for UNIV and RF mTCA EVR models #63
Browse files Browse the repository at this point in the history
Merge pull request #63 from ZanMaticPratnemer/mtca-rf-and-mtca-univ
  • Loading branch information
jerzyjamroz authored Dec 27, 2023
2 parents 277abf2 + 4c5f21f commit b66485f
Show file tree
Hide file tree
Showing 10 changed files with 805 additions and 231 deletions.
2 changes: 2 additions & 0 deletions evrMrmApp/Db/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ DB += evr-vmerf-230.db
DB += evr-tg-300.db
DB += evr-mtca-300.db
DB += evr-pcie-300dc.db
DB += evr-mtca-300rf.db
DB += evr-mtca-300u.db

ifdef BASE_3_15
DB += evr-mtca-300u.db
Expand Down
333 changes: 333 additions & 0 deletions evrMrmApp/Db/evr-mtca-300rf.substitutions

Large diffs are not rendered by default.

380 changes: 226 additions & 154 deletions evrMrmApp/Db/evr-mtca-300u.substitutions

Large diffs are not rendered by default.

179 changes: 121 additions & 58 deletions evrMrmApp/Db/mrmevrout.db
Original file line number Diff line number Diff line change
Expand Up @@ -190,31 +190,60 @@ record(mbbo, "$(ON)Src$(s=:)Scale-SP") {
field( ZRST, "Prescaler 0")
field( ONST, "Prescaler 1")
field( TWST, "Prescaler 2")
field( THST, "Flip-flop 0")
field( FRST, "Flip-flop 1")
field( FVST, "Flip-flop 2")
field( SXST, "Flip-flop 3")
field( SVST, "Flip-flop 4")
field( EIST, "Flip-flop 5")
field( NIST, "Flip-flop 6")
field( TEST, "Flip-flop 7")
field( ELST, "Tri-state")
field( TVST, "Force High")
field( TTST, "Force Low")
field( THST, "Prescaler 3")
field( FRST, "Prescaler 4")
field( FVST, "Prescaler 5")
field( SXST, "Prescaler 6")
field( SVST, "Prescaler 7")
field( ZRVL, "40")
field( ONVL, "41")
field( TWVL, "42")
field( THVL, "48")
field( FRVL, "49")
field( FVVL, "50")
field( SXVL, "51")
field( SVVL, "52")
field( EIVL, "53")
field( NIVL, "54")
field( TEVL, "55")
field( ELVL, "61")
field( TVVL, "62")
field( TTVL, "63")
field( THVL, "43")
field( FRVL, "44")
field( FVVL, "45")
field( SXVL, "46")
field( SVVL, "47")
field( EISV, "INVALID")
field( NISV, "INVALID")
field( TESV, "INVALID")
field( ELSV, "INVALID")
field( TVSV, "INVALID")
field( TTSV, "INVALID")
field( FTSV, "INVALID")
field( FFSV, "INVALID")
field( UNSV, "INVALID")
field( IVOA, "Don't drive outputs")
info(autosaveFields_pass0, "VAL")
}

record(mbbo, "$(ON)Src$(s=:)Gate-SP") {
field( DTYP, "Raw Soft Channel")
field( OUT , "$(ON)Src-SP PP")
field( ZRST, "Flip-flop 0")
field( ONST, "Flip-flop 1")
field( TWST, "Flip-flop 2")
field( THST, "Flip-flop 3")
field( FRST, "Flip-flop 4")
field( FVST, "Flip-flop 5")
field( SXST, "Flip-flop 6")
field( SVST, "Flip-flop 7")
field( EIST, "Tri-state")
field( NIST, "Force High")
field( TEST, "Force Low")
field( ZRVL, "48")
field( ONVL, "49")
field( TWVL, "50")
field( THVL, "51")
field( FRVL, "52")
field( FVVL, "53")
field( SXVL, "54")
field( SVVL, "55")
field( EIVL, "61")
field( NIVL, "62")
field( TEVL, "63")
field( ELSV, "INVALID")
field( TVSV, "INVALID")
field( TTSV, "INVALID")
field( FTSV, "INVALID")
field( FFSV, "INVALID")
field( UNSV, "INVALID")
Expand Down Expand Up @@ -288,28 +317,41 @@ record(stringin, "$(ON)Src-RB")
info(lutD , " 13 = Pulser 13")
info(lutE , " 14 = Pulser 14")
info(lutF , " 15 = Pulser 15")
info(lutG , " 32 = DBus 0")
info(lutH , " 33 = DBus 1")
info(lutI , " 34 = DBus 2")
info(lutJ , " 35 = DBus 3")
info(lutK , " 36 = DBus 4")
info(lutL , " 37 = DBus 5")
info(lutM , " 38 = DBus 6")
info(lutN , " 39 = DBus 7")
info(lutO , " 40 = Prescaler 0")
info(lutP , " 41 = Prescaler 1")
info(lutQ , " 42 = Prescaler 2")
info(lutR , " 48 = Flip-flop 0")
info(lutS , " 49 = Flip-flop 1")
info(lutT , " 50 = Flip-flop 2")
info(lutU , " 51 = Flip-flop 3")
info(lutV , " 52 = Flip-flop 4")
info(lutW , " 53 = Flip-flop 5")
info(lutX , " 54 = Flip-flop 6")
info(lutY , " 55 = Flip-flop 7")
info(lutZ , " 61 = Tri-state")
info(lutAA, " 62 = Force high")
info(lutAB, " 63 = Force low")
info(lutG , " 16 = Pulser 16")
info(lutH , " 17 = Pulser 17")
info(lutI , " 18 = Pulser 18")
info(lutJ , " 19 = Pulser 19")
info(lutK , " 20 = Pulser 20")
info(lutL , " 21 = Pulser 21")
info(lutM , " 22 = Pulser 22")
info(lutN , " 23 = Pulser 23")
info(lutO , " 32 = DBus 0")
info(lutP , " 33 = DBus 1")
info(lutQ , " 34 = DBus 2")
info(lutR , " 35 = DBus 3")
info(lutS , " 36 = DBus 4")
info(lutT , " 37 = DBus 5")
info(lutU , " 38 = DBus 6")
info(lutV , " 39 = DBus 7")
info(lutW , " 40 = Prescaler 0")
info(lutX , " 41 = Prescaler 1")
info(lutY , " 42 = Prescaler 2")
info(lutZ , " 43 = Prescaler 3")
info(lutAA, " 44 = Prescaler 4")
info(lutAB, " 45 = Prescaler 5")
info(lutAC, " 46 = Prescaler 6")
info(lutAD, " 47 = Prescaler 7")
info(lutAE, " 48 = Flip-flop 0")
info(lutAF, " 49 = Flip-flop 1")
info(lutAG, " 50 = Flip-flop 2")
info(lutAH, " 51 = Flip-flop 3")
info(lutAI, " 52 = Flip-flop 4")
info(lutAJ, " 53 = Flip-flop 5")
info(lutAK, " 54 = Flip-flop 6")
info(lutAL, " 55 = Flip-flop 7")
info(lutAM, " 61 = Tri-state")
info(lutAN, " 62 = Force high")
info(lutAO, " 63 = Force low")
}

record(stringin, "$(ON)Src2-RB")
Expand All @@ -332,20 +374,41 @@ record(stringin, "$(ON)Src2-RB")
info(lutD , " 13 = Pulser 13")
info(lutE , " 14 = Pulser 14")
info(lutF , " 15 = Pulser 15")
info(lutG , " 32 = DBus 0")
info(lutH , " 33 = DBus 1")
info(lutI , " 34 = DBus 2")
info(lutJ , " 35 = DBus 3")
info(lutK , " 36 = DBus 4")
info(lutL , " 37 = DBus 5")
info(lutM , " 38 = DBus 6")
info(lutN , " 39 = DBus 7")
info(lutO , " 40 = Prescaler 0")
info(lutP , " 41 = Prescaler 1")
info(lutQ , " 42 = Prescaler 2")
info(lutR , " 61 = Tri-state")
info(lutS , " 62 = Force high")
info(lutT , " 63 = Force low")
info(lutG , " 16 = Pulser 16")
info(lutH , " 17 = Pulser 17")
info(lutI , " 18 = Pulser 18")
info(lutJ , " 19 = Pulser 19")
info(lutK , " 20 = Pulser 20")
info(lutL , " 21 = Pulser 21")
info(lutM , " 22 = Pulser 22")
info(lutN , " 23 = Pulser 23")
info(lutO , " 32 = DBus 0")
info(lutP , " 33 = DBus 1")
info(lutQ , " 34 = DBus 2")
info(lutR , " 35 = DBus 3")
info(lutS , " 36 = DBus 4")
info(lutT , " 37 = DBus 5")
info(lutU , " 38 = DBus 6")
info(lutV , " 39 = DBus 7")
info(lutW , " 40 = Prescaler 0")
info(lutX , " 41 = Prescaler 1")
info(lutY , " 42 = Prescaler 2")
info(lutZ , " 43 = Prescaler 3")
info(lutAA, " 44 = Prescaler 4")
info(lutAB, " 45 = Prescaler 5")
info(lutAC, " 46 = Prescaler 6")
info(lutAD, " 47 = Prescaler 7")
info(lutAE, " 48 = Flip-flop 0")
info(lutAF, " 49 = Flip-flop 1")
info(lutAG, " 50 = Flip-flop 2")
info(lutAH, " 51 = Flip-flop 3")
info(lutAI, " 52 = Flip-flop 4")
info(lutAJ, " 53 = Flip-flop 5")
info(lutAK, " 54 = Flip-flop 6")
info(lutAL, " 55 = Flip-flop 7")
info(lutAM, " 61 = Tri-state")
info(lutAN, " 62 = Force high")
info(lutAO, " 63 = Force low")
}

# Select which is displayed
Expand Down
29 changes: 27 additions & 2 deletions evrMrmApp/src/drvem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,35 @@ try{

} else if(formfactor==formFactor_mTCA) {

// map TCLKA/B as UNIV16/17
for (unsigned int i = 16; i <= 17; ++i) {
outputs[std::make_pair(OutputFPUniv, i)]
= new MRMOutput(SB() << n << ":FrontUnivOut" << i, this, OutputFPUniv, i);
}

// CMLs for TCLKA/B
shortcmls.resize(2);
shortcmls[0]=new MRMCML(n+":CML0", 0,*this,MRMCML::typeCML,form);
shortcmls[1]=new MRMCML(n+":CML1", 1,*this,MRMCML::typeCML,form);
shortcmls[0] = new MRMCML(n+":CML0", 0,*this,MRMCML::typeCML,form);
shortcmls[1] = new MRMCML(n+":CML1", 1,*this,MRMCML::typeCML,form);

// additional setup specific to mTCA-EVR-300RF
if(model().compare("mTCA-EVR-300RF") == 0) {
// map FPUV2/3 as UNIV18/19 and FPSFP/FPCML as UNIV20/21
for (unsigned int i = 18; i <= 21; ++i) {
outputs[std::make_pair(OutputFPUniv, i)]
= new MRMOutput(SB() << n << ":FrontUnivOut" << i, this, OutputFPUniv, i);
}

// append CML2 to CML5 to existing CMLs
shortcmls.resize(6);
// Univ2 and Univ3
shortcmls[2] = new MRMCML(n+":CML2", 2,*this, MRMCML::typeCML,form);
shortcmls[3] = new MRMCML(n+":CML3", 3,*this, MRMCML::typeCML,form);
// SFP
shortcmls[4] = new MRMCML(n+":CML4", 4,*this, MRMCML::typeTG300,form);
// CML
shortcmls[5] = new MRMCML(n+":CML5", 5,*this, MRMCML::typeCML,form);
}
} else if(conf->nCML && ver>=MRFVersion(0,4)){
shortcmls.resize(conf->nCML);
for(size_t i=0; i<conf->nCML; i++){
Expand Down
3 changes: 2 additions & 1 deletion evrMrmApp/src/drvemCML.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*************************************************************************\
* Copyright (c) 2010 Brookhaven Science Associates, as Operator of
* Brookhaven National Laboratory.
* Copyright (c) 2022 Cosylab d.d.
* mrfioc2 is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
Expand Down Expand Up @@ -390,7 +391,7 @@ MRMCML::setPattern(pattern p, const unsigned char *buf, epicsUInt32 blen)
// If we are given a length that is not a multiple of CML word size
// then truncate.
if(blen%mult){
printf("Given length is not a multiple of %u (CML word size). Truncating...\n", mult);
printf("Given length %u is not a multiple of %u (CML word size). Truncating...\n", blen, mult);
blen-=blen%mult;
}

Expand Down
10 changes: 6 additions & 4 deletions evrMrmApp/src/drvemIocsh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright (c) 2010 Brookhaven Science Associates, as Operator of
* Brookhaven National Laboratory.
* Copyright (c) 2015 Paul Scherrer Institute (PSI), Villigen, Switzerland
* Copyright (c) 2022 Cosylab d.d.
* mrfioc2 is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
Expand Down Expand Up @@ -56,13 +57,14 @@

static const iocshArg mrmEvrSetupPCIArg0 = { "name",iocshArgString};
static const iocshArg mrmEvrSetupPCIArg1 = { "PCI id or slot=#",iocshArgString};
static const iocshArg * const mrmEvrSetupPCIArgs[2] =
{&mrmEvrSetupPCIArg0,&mrmEvrSetupPCIArg1};
static const iocshArg mrmEvrSetupPCIArg2 = { "[uTCA model: no param (default) or 'UNIV' or 'IFP' or 'RF]",iocshArgString};
static const iocshArg * const mrmEvrSetupPCIArgs[3] =
{&mrmEvrSetupPCIArg0,&mrmEvrSetupPCIArg1,&mrmEvrSetupPCIArg2};
static const iocshFuncDef mrmEvrSetupPCIFuncDef =
{"mrmEvrSetupPCI",2,mrmEvrSetupPCIArgs};
{"mrmEvrSetupPCI",3,mrmEvrSetupPCIArgs};
static void mrmEvrSetupPCICallFunc(const iocshArgBuf *args)
{
mrmEvrSetupPCI(args[0].sval,args[1].sval);
mrmEvrSetupPCI(args[0].sval,args[1].sval,args[2].sval);
}

static const iocshArg mrmEvrSetupVMEArg0 = { "name",iocshArgString};
Expand Down
3 changes: 2 additions & 1 deletion evrMrmApp/src/drvemIocsh.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*************************************************************************\
* Copyright (c) 2010 Brookhaven Science Associates, as Operator of
* Brookhaven National Laboratory.
* Copyright (c) 2022 Cosylab d.d.
* mrfioc2 is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
Expand Down Expand Up @@ -34,7 +35,7 @@ epicsShareExtern int evrmrmVerb;


void epicsShareFunc
mrmEvrSetupPCI(const char* id, const char* pcispec);
mrmEvrSetupPCI(const char* id, const char* pcispec, const char* mtca_evr_model);
void epicsShareFunc
mrmEvrSetupVME(const char* id,int slot,int base,int level, int vector);

Expand Down
11 changes: 5 additions & 6 deletions evrMrmApp/src/drvemOutput.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*************************************************************************\
* Copyright (c) 2013 Brookhaven Science Associates, as Operator of
* Brookhaven National Laboratory.
* Copyright (c) 2022 Cosylab d.d.
* mrfioc2 is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
Expand Down Expand Up @@ -50,9 +51,8 @@ void
MRMOutput::setSource(epicsUInt32 v)
{
if( ! ( (v<=63 && v>=61) ||
(v<=55 && v>=48) ||
(v<=42 && v>=32) ||
(v<=15) )
(v<=55 && v>=32) ||
(v<=23) )
)
throw std::out_of_range("Mapping code is out of range");

Expand All @@ -67,9 +67,8 @@ void
MRMOutput::setSource2(epicsUInt32 v)
{
if( ! ( (v<=63 && v>=61) ||
(v<=55 && v>=48) ||
(v<=42 && v>=32) ||
(v<=15) )
(v<=55 && v>=32) ||
(v<=23) )
)
throw std::out_of_range("Mapping code is out of range");

Expand Down
Loading

0 comments on commit b66485f

Please sign in to comment.