Compare commits
4 Commits
2024-v2
...
SINQSW-107
Author | SHA1 | Date | |
---|---|---|---|
d44dbaaf0f | |||
501c5badea | |||
39098fd0d1 | |||
1539bfc66a |
246
.clang-format
Normal file
246
.clang-format
Normal file
@ -0,0 +1,246 @@
|
|||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
# BasedOnStyle: LLVM
|
||||||
|
AccessModifierOffset: -2
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
AlignArrayOfStructures: None
|
||||||
|
AlignConsecutiveAssignments:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
AlignFunctionPointers: false
|
||||||
|
PadOperators: true
|
||||||
|
AlignConsecutiveBitFields:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
AlignFunctionPointers: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignConsecutiveDeclarations:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
AlignFunctionPointers: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignConsecutiveMacros:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
AlignFunctionPointers: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignConsecutiveShortCaseStatements:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCaseColons: false
|
||||||
|
AlignEscapedNewlines: Right
|
||||||
|
AlignOperands: Align
|
||||||
|
AlignTrailingComments:
|
||||||
|
Kind: Always
|
||||||
|
OverEmptyLines: 0
|
||||||
|
AllowAllArgumentsOnNextLine: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
AllowBreakBeforeNoexceptSpecifier: Never
|
||||||
|
AllowShortBlocksOnASingleLine: Never
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortCompoundRequirementOnASingleLine: true
|
||||||
|
AllowShortEnumsOnASingleLine: true
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
AllowShortIfStatementsOnASingleLine: Never
|
||||||
|
AllowShortLambdasOnASingleLine: All
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
AlwaysBreakTemplateDeclarations: MultiLine
|
||||||
|
AttributeMacros:
|
||||||
|
- __capability
|
||||||
|
BinPackArguments: true
|
||||||
|
BinPackParameters: true
|
||||||
|
BitFieldColonSpacing: Both
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: false
|
||||||
|
AfterClass: false
|
||||||
|
AfterControlStatement: Never
|
||||||
|
AfterEnum: false
|
||||||
|
AfterExternBlock: false
|
||||||
|
AfterFunction: false
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterObjCDeclaration: false
|
||||||
|
AfterStruct: false
|
||||||
|
AfterUnion: false
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: false
|
||||||
|
BeforeLambdaBody: false
|
||||||
|
BeforeWhile: false
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: true
|
||||||
|
SplitEmptyRecord: true
|
||||||
|
SplitEmptyNamespace: true
|
||||||
|
BreakAdjacentStringLiterals: true
|
||||||
|
BreakAfterAttributes: Leave
|
||||||
|
BreakAfterJavaFieldAnnotations: false
|
||||||
|
BreakArrays: true
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeConceptDeclarations: Always
|
||||||
|
BreakBeforeBraces: Attach
|
||||||
|
BreakBeforeInlineASMColon: OnlyMultiline
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializers: BeforeColon
|
||||||
|
BreakInheritanceList: BeforeColon
|
||||||
|
BreakStringLiterals: true
|
||||||
|
ColumnLimit: 80
|
||||||
|
CommentPragmas: '^ IWYU pragma:'
|
||||||
|
CompactNamespaces: false
|
||||||
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
DisableFormat: false
|
||||||
|
EmptyLineAfterAccessModifier: Never
|
||||||
|
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
FixNamespaceComments: true
|
||||||
|
ForEachMacros:
|
||||||
|
- foreach
|
||||||
|
- Q_FOREACH
|
||||||
|
- BOOST_FOREACH
|
||||||
|
IfMacros:
|
||||||
|
- KJ_IF_MAYBE
|
||||||
|
IncludeBlocks: Preserve
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||||
|
Priority: 2
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||||
|
Priority: 3
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 1
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
IncludeIsMainRegex: '(Test)?$'
|
||||||
|
IncludeIsMainSourceRegex: ''
|
||||||
|
IndentAccessModifiers: false
|
||||||
|
IndentCaseBlocks: false
|
||||||
|
IndentCaseLabels: false
|
||||||
|
IndentExternBlock: AfterExternBlock
|
||||||
|
IndentGotoLabels: true
|
||||||
|
IndentPPDirectives: None
|
||||||
|
IndentRequiresClause: true
|
||||||
|
IndentWidth: 4
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
InsertBraces: false
|
||||||
|
InsertNewlineAtEOF: false
|
||||||
|
InsertTrailingCommas: None
|
||||||
|
IntegerLiteralSeparator:
|
||||||
|
Binary: 0
|
||||||
|
BinaryMinDigits: 0
|
||||||
|
Decimal: 0
|
||||||
|
DecimalMinDigits: 0
|
||||||
|
Hex: 0
|
||||||
|
HexMinDigits: 0
|
||||||
|
JavaScriptQuotes: Leave
|
||||||
|
JavaScriptWrapImports: true
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
|
KeepEmptyLinesAtEOF: false
|
||||||
|
LambdaBodyIndentation: Signature
|
||||||
|
LineEnding: DeriveLF
|
||||||
|
MacroBlockBegin: ''
|
||||||
|
MacroBlockEnd: ''
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
NamespaceIndentation: None
|
||||||
|
ObjCBinPackProtocolList: Auto
|
||||||
|
ObjCBlockIndentWidth: 2
|
||||||
|
ObjCBreakBeforeNestedBlockParam: true
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
PackConstructorInitializers: BinPack
|
||||||
|
PenaltyBreakAssignment: 2
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 19
|
||||||
|
PenaltyBreakComment: 300
|
||||||
|
PenaltyBreakFirstLessLess: 120
|
||||||
|
PenaltyBreakOpenParenthesis: 0
|
||||||
|
PenaltyBreakScopeResolution: 500
|
||||||
|
PenaltyBreakString: 1000
|
||||||
|
PenaltyBreakTemplateDeclaration: 10
|
||||||
|
PenaltyExcessCharacter: 1000000
|
||||||
|
PenaltyIndentedWhitespace: 0
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
|
PointerAlignment: Right
|
||||||
|
PPIndentWidth: -1
|
||||||
|
QualifierAlignment: Leave
|
||||||
|
ReferenceAlignment: Pointer
|
||||||
|
ReflowComments: true
|
||||||
|
RemoveBracesLLVM: false
|
||||||
|
RemoveParentheses: Leave
|
||||||
|
RemoveSemicolon: false
|
||||||
|
RequiresClausePosition: OwnLine
|
||||||
|
RequiresExpressionIndentation: OuterScope
|
||||||
|
SeparateDefinitionBlocks: Leave
|
||||||
|
ShortNamespaceLines: 1
|
||||||
|
SkipMacroDefinitionBody: false
|
||||||
|
SortIncludes: CaseSensitive
|
||||||
|
SortJavaStaticImport: Before
|
||||||
|
SortUsingDeclarations: LexicographicNumeric
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceAfterLogicalNot: false
|
||||||
|
SpaceAfterTemplateKeyword: true
|
||||||
|
SpaceAroundPointerQualifiers: Default
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeCaseColon: false
|
||||||
|
SpaceBeforeCpp11BracedList: false
|
||||||
|
SpaceBeforeCtorInitializerColon: true
|
||||||
|
SpaceBeforeInheritanceColon: true
|
||||||
|
SpaceBeforeJsonColon: false
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceBeforeParensOptions:
|
||||||
|
AfterControlStatements: true
|
||||||
|
AfterForeachMacros: true
|
||||||
|
AfterFunctionDefinitionName: false
|
||||||
|
AfterFunctionDeclarationName: false
|
||||||
|
AfterIfMacros: true
|
||||||
|
AfterOverloadedOperator: false
|
||||||
|
AfterPlacementOperator: true
|
||||||
|
AfterRequiresInClause: false
|
||||||
|
AfterRequiresInExpression: false
|
||||||
|
BeforeNonEmptyParentheses: false
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: true
|
||||||
|
SpaceBeforeSquareBrackets: false
|
||||||
|
SpaceInEmptyBlock: false
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
SpacesInAngles: Never
|
||||||
|
SpacesInContainerLiterals: true
|
||||||
|
SpacesInLineCommentPrefix:
|
||||||
|
Minimum: 1
|
||||||
|
Maximum: -1
|
||||||
|
SpacesInParens: Never
|
||||||
|
SpacesInParensOptions:
|
||||||
|
InCStyleCasts: false
|
||||||
|
InConditionalStatements: false
|
||||||
|
InEmptyParentheses: false
|
||||||
|
Other: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
Standard: Latest
|
||||||
|
StatementAttributeLikeMacros:
|
||||||
|
- Q_EMIT
|
||||||
|
StatementMacros:
|
||||||
|
- Q_UNUSED
|
||||||
|
- QT_REQUIRE_VERSION
|
||||||
|
TabWidth: 8
|
||||||
|
UseTab: Never
|
||||||
|
VerilogBreakBetweenInstancePorts: true
|
||||||
|
WhitespaceSensitiveMacros:
|
||||||
|
- BOOST_PP_STRINGIZE
|
||||||
|
- CF_SWIFT_NAME
|
||||||
|
- NS_SWIFT_NAME
|
||||||
|
- PP_STRINGIZE
|
||||||
|
- STRINGIZE
|
||||||
|
...
|
||||||
|
|
@ -13,7 +13,7 @@ REQUIRED+=scaler
|
|||||||
REQUIRED+=asynMotor
|
REQUIRED+=asynMotor
|
||||||
|
|
||||||
# Release version
|
# Release version
|
||||||
LIBVERSION=2024-v2
|
LIBVERSION=2024-ed-dev2
|
||||||
|
|
||||||
# DB files to include in the release
|
# DB files to include in the release
|
||||||
TEMPLATES += sinqEPICSApp/Db/dimetix.db
|
TEMPLATES += sinqEPICSApp/Db/dimetix.db
|
||||||
|
@ -38,3 +38,12 @@ Those political problems require a special development model:
|
|||||||
Take care of the sinqEPICsApp/src/sinq.dbd file. This is the one which differs mostly between
|
Take care of the sinqEPICsApp/src/sinq.dbd file. This is the one which differs mostly between
|
||||||
amorsim and master branches.
|
amorsim and master branches.
|
||||||
|
|
||||||
|
# Formatting
|
||||||
|
|
||||||
|
Formatting is done via the [`.clang-format`](./.clang-format) file checked into
|
||||||
|
the repository. One option to apply the formatting to a given file is via the
|
||||||
|
command below.
|
||||||
|
|
||||||
|
```
|
||||||
|
clang-format -i -style=file <file>
|
||||||
|
```
|
||||||
|
@ -50,14 +50,5 @@ record(longin, "$(P)$(M):Enable_RBV") {
|
|||||||
record(longout, "$(P)$(M):Reread_Encoder") {
|
record(longout, "$(P)$(M):Reread_Encoder") {
|
||||||
field(DTYP, "asynInt32")
|
field(DTYP, "asynInt32")
|
||||||
field(OUT, "@asyn($(PORT),$(N),1) REREAD_ENCODER_POSITION")
|
field(OUT, "@asyn($(PORT),$(N),1) REREAD_ENCODER_POSITION")
|
||||||
field(PINI, "YES")
|
|
||||||
}
|
|
||||||
|
|
||||||
# reread encoder
|
|
||||||
record(longin, "$(P)$(M):Reread_Encoder_RBV") {
|
|
||||||
field(DTYP, "asynInt32")
|
|
||||||
field(INP, "@asyn($(PORT),$(N),1) REREAD_ENCODER_POSITION_RBV")
|
|
||||||
field(PINI, "NO")
|
field(PINI, "NO")
|
||||||
field(SCAN, "1 second")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,59 +14,59 @@
|
|||||||
* 2 = threshold monitor
|
* 2 = threshold monitor
|
||||||
* 3 = threshold monitor count
|
* 3 = threshold monitor count
|
||||||
*
|
*
|
||||||
* This is less then ideal. But it is a workaround for the fact that the scalar record
|
* This is less then ideal. But it is a workaround for the fact that the scalar
|
||||||
* does not do all the tricks the EL737 knows:
|
* record does not do all the tricks the EL737 knows:
|
||||||
* - Thresholding
|
* - Thresholding
|
||||||
* - two count modes
|
* - two count modes
|
||||||
* A better solution would be to extend the scalar record to have a proper status and count
|
* A better solution would be to extend the scalar record to have a proper
|
||||||
* mode field. And threshold control fields too. But this is much more work, breaks
|
* status and count mode field. And threshold control fields too. But this is
|
||||||
* compatability with the scalar record completely and thus was not done for now.
|
* much more work, breaks compatability with the scalar record completely and
|
||||||
|
* thus was not done for now.
|
||||||
*
|
*
|
||||||
* The driver will run a separate thread which does all the
|
* The driver will run a separate thread which does all the
|
||||||
* communication.
|
* communication.
|
||||||
*
|
*
|
||||||
* Mark Koennecke, February 2013
|
* Mark Koennecke, February 2013
|
||||||
*
|
*
|
||||||
* Enhanced by adding an addtional external pause and status flag in the database and code in here
|
* Enhanced by adding an addtional external pause and status flag in the
|
||||||
* to handle this. Moreover an external MsgTxt field in the DB can be filled with an error message.
|
* database and code in here to handle this. Moreover an external MsgTxt field
|
||||||
|
* in the DB can be filled with an error message.
|
||||||
*
|
*
|
||||||
* Mark Koennecke, July 2017
|
* Mark Koennecke, July 2017
|
||||||
*
|
*
|
||||||
* Enhanced with a separate thresholdCounter and threshold field in order to replace the
|
* Enhanced with a separate thresholdCounter and threshold field in order to
|
||||||
* hack for threshold handling. If these fields are present, the hack with presets 2 and
|
* replace the hack for threshold handling. If these fields are present, the
|
||||||
* 3 as described above is ignored.
|
* hack with presets 2 and 3 as described above is ignored.
|
||||||
*
|
*
|
||||||
* Mark Koennecke, August 2017
|
* Mark Koennecke, August 2017
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <asynEpicsUtils.h>
|
||||||
#include <errno.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <asynOctetSyncIO.h>
|
#include <asynOctetSyncIO.h>
|
||||||
#include <epicsEvent.h>
|
|
||||||
#include <epicsThread.h>
|
|
||||||
#include <epicsTime.h>
|
|
||||||
#include <epicsExport.h>
|
|
||||||
#include <errlog.h>
|
|
||||||
#include <callback.h>
|
#include <callback.h>
|
||||||
#include <recSup.h>
|
|
||||||
#include <devSup.h>
|
|
||||||
#include <cantProceed.h>
|
#include <cantProceed.h>
|
||||||
|
#include <dbAccess.h>
|
||||||
#include <dbDefs.h>
|
#include <dbDefs.h>
|
||||||
#include <dbFldTypes.h>
|
#include <dbFldTypes.h>
|
||||||
#include <dbAccess.h>
|
|
||||||
#include <errlog.h>
|
|
||||||
|
|
||||||
#include <scalerRecord.h>
|
|
||||||
#include <devScaler.h>
|
#include <devScaler.h>
|
||||||
#include <asynEpicsUtils.h>
|
#include <devSup.h>
|
||||||
|
#include <epicsEvent.h>
|
||||||
|
#include <epicsExport.h>
|
||||||
|
#include <epicsThread.h>
|
||||||
|
#include <epicsTime.h>
|
||||||
|
#include <errlog.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <recSup.h>
|
||||||
|
#include <scalerRecord.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
/* dset functions */
|
/* dset functions */
|
||||||
static long el737_init_record(struct scalerRecord *psr, CALLBACK *pcallback);
|
static long el737_init_record(struct scalerRecord *psr, CALLBACK *pcallback);
|
||||||
static long el737_reset(scalerRecord *psr);
|
static long el737_reset(scalerRecord *psr);
|
||||||
static long el737_read(scalerRecord *psr, epicsUInt32 *val);
|
static long el737_read(scalerRecord *psr, epicsUInt32 *val);
|
||||||
static long el737_write_preset(scalerRecord *psr, int signal, unsigned long val);
|
static long el737_write_preset(scalerRecord *psr, int signal,
|
||||||
|
unsigned long val);
|
||||||
static long el737_arm(scalerRecord *psr, int val);
|
static long el737_arm(scalerRecord *psr, int val);
|
||||||
static long el737_done(scalerRecord *psr);
|
static long el737_done(scalerRecord *psr);
|
||||||
|
|
||||||
@ -82,17 +82,9 @@ static void el737Thread(void *param);
|
|||||||
#define COMLEN 132
|
#define COMLEN 132
|
||||||
|
|
||||||
SCALERDSET devScalerEL737 = {
|
SCALERDSET devScalerEL737 = {
|
||||||
7,
|
7, NULL, NULL, el737_init_record,
|
||||||
NULL,
|
NULL, el737_reset, el737_read, el737_write_preset,
|
||||||
NULL,
|
el737_arm, el737_done};
|
||||||
el737_init_record,
|
|
||||||
NULL,
|
|
||||||
el737_reset,
|
|
||||||
el737_read,
|
|
||||||
el737_write_preset,
|
|
||||||
el737_arm,
|
|
||||||
el737_done
|
|
||||||
};
|
|
||||||
epicsExportAddress(dset, devScalerEL737);
|
epicsExportAddress(dset, devScalerEL737);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -114,12 +106,9 @@ typedef struct {
|
|||||||
unsigned int dbInit;
|
unsigned int dbInit;
|
||||||
} EL737priv;
|
} EL737priv;
|
||||||
|
|
||||||
static void dummyAsynCallback([[maybe_unused]] asynUser *pasynUser)
|
static void dummyAsynCallback(asynUser *pasynUser) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void connectSlaveRecords(EL737priv *priv)
|
static void connectSlaveRecords(EL737priv *priv) {
|
||||||
{
|
|
||||||
char slaveName[PVNAME_SZ + 18], errName[256];
|
char slaveName[PVNAME_SZ + 18], errName[256];
|
||||||
long status;
|
long status;
|
||||||
|
|
||||||
@ -129,10 +118,12 @@ static void connectSlaveRecords(EL737priv *priv)
|
|||||||
status = dbNameToAddr(slaveName, &priv->pause);
|
status = dbNameToAddr(slaveName, &priv->pause);
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
errSymLookup(status, errName, sizeof(errName));
|
errSymLookup(status, errName, sizeof(errName));
|
||||||
errlogPrintf("dbNameToAddr failed for %s with %s\n", slaveName, errName);
|
errlogPrintf("dbNameToAddr failed for %s with %s\n", slaveName,
|
||||||
|
errName);
|
||||||
priv->dbInit = 0;
|
priv->dbInit = 0;
|
||||||
} else {
|
} else {
|
||||||
errlogPrintf("dbNameToAddr succeded for %s, record access %s\n",slaveName, priv->pause.precord->name);
|
errlogPrintf("dbNameToAddr succeded for %s, record access %s\n",
|
||||||
|
slaveName, priv->pause.precord->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(slaveName, sizeof(slaveName), "%s:MsgTxt", priv->psr->name);
|
snprintf(slaveName, sizeof(slaveName), "%s:MsgTxt", priv->psr->name);
|
||||||
@ -140,10 +131,12 @@ static void connectSlaveRecords(EL737priv *priv)
|
|||||||
status = dbNameToAddr(slaveName, &priv->msgTxt);
|
status = dbNameToAddr(slaveName, &priv->msgTxt);
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
errSymLookup(status, errName, sizeof(errName));
|
errSymLookup(status, errName, sizeof(errName));
|
||||||
errlogPrintf("dbNameToAddr failed for %s with %s\n", slaveName, errName);
|
errlogPrintf("dbNameToAddr failed for %s with %s\n", slaveName,
|
||||||
|
errName);
|
||||||
priv->dbInit = 0;
|
priv->dbInit = 0;
|
||||||
} else {
|
} else {
|
||||||
errlogPrintf("dbNameToAddr succeded for %s, record access %s\n",slaveName, priv->msgTxt.precord->name);
|
errlogPrintf("dbNameToAddr succeded for %s, record access %s\n",
|
||||||
|
slaveName, priv->msgTxt.precord->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(slaveName, sizeof(slaveName), "%s:Status", priv->psr->name);
|
snprintf(slaveName, sizeof(slaveName), "%s:Status", priv->psr->name);
|
||||||
@ -151,21 +144,26 @@ static void connectSlaveRecords(EL737priv *priv)
|
|||||||
status = dbNameToAddr(slaveName, &priv->status);
|
status = dbNameToAddr(slaveName, &priv->status);
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
errSymLookup(status, errName, sizeof(errName));
|
errSymLookup(status, errName, sizeof(errName));
|
||||||
errlogPrintf("dbNameToAddr failed for %s with %s\n", slaveName, errName);
|
errlogPrintf("dbNameToAddr failed for %s with %s\n", slaveName,
|
||||||
|
errName);
|
||||||
priv->dbInit = 0;
|
priv->dbInit = 0;
|
||||||
} else {
|
} else {
|
||||||
errlogPrintf("dbNameToAddr succeded for %s, record access %s\n",slaveName, priv->status.precord->name);
|
errlogPrintf("dbNameToAddr succeded for %s, record access %s\n",
|
||||||
|
slaveName, priv->status.precord->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(slaveName,sizeof(slaveName),"%s:ThresholdCounter", priv->psr->name);
|
snprintf(slaveName, sizeof(slaveName), "%s:ThresholdCounter",
|
||||||
|
priv->psr->name);
|
||||||
errlogPrintf("Name of thresholdCounter variable: %s\n", slaveName);
|
errlogPrintf("Name of thresholdCounter variable: %s\n", slaveName);
|
||||||
status = dbNameToAddr(slaveName, &priv->threshCounter);
|
status = dbNameToAddr(slaveName, &priv->threshCounter);
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
errSymLookup(status, errName, sizeof(errName));
|
errSymLookup(status, errName, sizeof(errName));
|
||||||
errlogPrintf("dbNameToAddr failed for %s with %s\n", slaveName, errName);
|
errlogPrintf("dbNameToAddr failed for %s with %s\n", slaveName,
|
||||||
|
errName);
|
||||||
priv->dbInit = 0;
|
priv->dbInit = 0;
|
||||||
} else {
|
} else {
|
||||||
errlogPrintf("dbNameToAddr succeded for %s, record access %s\n",slaveName, priv->threshCounter.precord->name);
|
errlogPrintf("dbNameToAddr succeded for %s, record access %s\n",
|
||||||
|
slaveName, priv->threshCounter.precord->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(slaveName, sizeof(slaveName), "%s:Threshold", priv->psr->name);
|
snprintf(slaveName, sizeof(slaveName), "%s:Threshold", priv->psr->name);
|
||||||
@ -173,16 +171,17 @@ static void connectSlaveRecords(EL737priv *priv)
|
|||||||
status = dbNameToAddr(slaveName, &priv->threshold);
|
status = dbNameToAddr(slaveName, &priv->threshold);
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
errSymLookup(status, errName, sizeof(errName));
|
errSymLookup(status, errName, sizeof(errName));
|
||||||
errlogPrintf("dbNameToAddr failed for %s with %s\n", slaveName, errName);
|
errlogPrintf("dbNameToAddr failed for %s with %s\n", slaveName,
|
||||||
|
errName);
|
||||||
priv->dbInit = 0;
|
priv->dbInit = 0;
|
||||||
} else {
|
} else {
|
||||||
errlogPrintf("dbNameToAddr succeded for %s, record access %s\n",slaveName, priv->threshold.precord->name);
|
errlogPrintf("dbNameToAddr succeded for %s, record access %s\n",
|
||||||
|
slaveName, priv->threshold.precord->name);
|
||||||
}
|
}
|
||||||
priv->thresholdValue = -999;
|
priv->thresholdValue = -999;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long el737_init_record(scalerRecord *psr, CALLBACK *pcallback)
|
static long el737_init_record(scalerRecord *psr, CALLBACK *pcallback) {
|
||||||
{
|
|
||||||
EL737priv *priv = NULL;
|
EL737priv *priv = NULL;
|
||||||
char *port, *userParam;
|
char *port, *userParam;
|
||||||
int signal, status, reason;
|
int signal, status, reason;
|
||||||
@ -204,23 +203,23 @@ static long el737_init_record(scalerRecord *psr, CALLBACK *pcallback)
|
|||||||
/*
|
/*
|
||||||
* private data structure
|
* private data structure
|
||||||
*/
|
*/
|
||||||
priv = callocMustSucceed(1,sizeof(EL737priv), "devScalerEL737 init_record()");
|
priv =
|
||||||
|
callocMustSucceed(1, sizeof(EL737priv), "devScalerEL737 init_record()");
|
||||||
priv->psr = psr;
|
priv->psr = psr;
|
||||||
priv->wakeUp = epicsEventCreate(epicsEventEmpty);
|
priv->wakeUp = epicsEventCreate(epicsEventEmpty);
|
||||||
priv->pcallback = pcallback;
|
priv->pcallback = pcallback;
|
||||||
priv->dbInit = 0;
|
priv->dbInit = 0;
|
||||||
psr->dpvt = priv;
|
psr->dpvt = priv;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hook up with device
|
* Hook up with device
|
||||||
*/
|
*/
|
||||||
dummyUser = pasynManager->createAsynUser(dummyAsynCallback, 0);
|
dummyUser = pasynManager->createAsynUser(dummyAsynCallback, 0);
|
||||||
status = pasynEpicsUtils->parseLink(dummyUser, &psr->out,
|
status = pasynEpicsUtils->parseLink(dummyUser, &psr->out, &port, &signal,
|
||||||
&port, &signal, &userParam);
|
&userParam);
|
||||||
if (status != asynSuccess) {
|
if (status != asynSuccess) {
|
||||||
errlogPrintf("devScalerEL737::init_record %s bad link %s\n",
|
errlogPrintf("devScalerEL737::init_record %s bad link %s\n", psr->name,
|
||||||
psr->name, dummyUser->errorMessage);
|
dummyUser->errorMessage);
|
||||||
psr->pact = 1;
|
psr->pact = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -251,18 +250,14 @@ static long el737_init_record(scalerRecord *psr, CALLBACK *pcallback)
|
|||||||
/*
|
/*
|
||||||
start the thread which actually runs the device
|
start the thread which actually runs the device
|
||||||
*/
|
*/
|
||||||
epicsThreadCreate("EL737",
|
epicsThreadCreate("EL737", epicsThreadPriorityMedium,
|
||||||
epicsThreadPriorityMedium,
|
epicsThreadStackMedium, el737Thread, priv);
|
||||||
epicsThreadStackMedium,
|
|
||||||
el737Thread,
|
|
||||||
priv);
|
|
||||||
|
|
||||||
// errlogPrintf("EL7373 thread started \n");
|
// errlogPrintf("EL7373 thread started \n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long el737_reset(scalerRecord *psr)
|
static long el737_reset(scalerRecord *psr) {
|
||||||
{
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
EL737priv *priv;
|
EL737priv *priv;
|
||||||
|
|
||||||
@ -273,8 +268,7 @@ static long el737_reset(scalerRecord *psr)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long el737_read(scalerRecord *psr, epicsUInt32 *val)
|
static long el737_read(scalerRecord *psr, epicsUInt32 *val) {
|
||||||
{
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
EL737priv *priv;
|
EL737priv *priv;
|
||||||
|
|
||||||
@ -286,8 +280,8 @@ static long el737_read(scalerRecord *psr, epicsUInt32 *val)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long el737_write_preset(scalerRecord *psr, int signal, unsigned long val)
|
static long el737_write_preset(scalerRecord *psr, int signal,
|
||||||
{
|
unsigned long val) {
|
||||||
EL737priv *priv;
|
EL737priv *priv;
|
||||||
|
|
||||||
// errlogPrintf("EL737: Setting preset %d to %ld\n", signal, val);
|
// errlogPrintf("EL737: Setting preset %d to %ld\n", signal, val);
|
||||||
@ -300,13 +294,11 @@ static long el737_write_preset(scalerRecord *psr, int signal, unsigned long val)
|
|||||||
priv->sendThreshold = 1;
|
priv->sendThreshold = 1;
|
||||||
epicsEventSignal(priv->wakeUp);
|
epicsEventSignal(priv->wakeUp);
|
||||||
// errlogPrintf("EL737: Setting threshold \n");
|
// errlogPrintf("EL737: Setting threshold \n");
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long el737_arm(scalerRecord *psr, int val)
|
static long el737_arm(scalerRecord *psr, int val) {
|
||||||
{
|
|
||||||
EL737priv *priv;
|
EL737priv *priv;
|
||||||
|
|
||||||
priv = (EL737priv *)psr->dpvt;
|
priv = (EL737priv *)psr->dpvt;
|
||||||
@ -319,8 +311,7 @@ static long el737_arm(scalerRecord *psr, int val)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long el737_done(scalerRecord *psr)
|
static long el737_done(scalerRecord *psr) {
|
||||||
{
|
|
||||||
EL737priv *priv;
|
EL737priv *priv;
|
||||||
priv = (EL737priv *)psr->dpvt;
|
priv = (EL737priv *)psr->dpvt;
|
||||||
|
|
||||||
@ -337,8 +328,8 @@ static long el737_done(scalerRecord *psr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static asynStatus el737_transactCommand(EL737priv *priv,char command[COMLEN],char reply[COMLEN])
|
static asynStatus el737_transactCommand(EL737priv *priv, char command[COMLEN],
|
||||||
{
|
char reply[COMLEN]) {
|
||||||
asynStatus status;
|
asynStatus status;
|
||||||
size_t in, out;
|
size_t in, out;
|
||||||
int reason, dbStatus;
|
int reason, dbStatus;
|
||||||
@ -349,18 +340,22 @@ static asynStatus el737_transactCommand(EL737priv *priv,char command[COMLEN],cha
|
|||||||
// errlogPrintf("EL737: sending command %s\n", command);
|
// errlogPrintf("EL737: sending command %s\n", command);
|
||||||
|
|
||||||
strcpy(message, "");
|
strcpy(message, "");
|
||||||
status = pasynOctetSyncIO->writeRead(priv->asynContext, command, strlen(command),
|
status =
|
||||||
|
pasynOctetSyncIO->writeRead(priv->asynContext, command, strlen(command),
|
||||||
reply, COMLEN, 1., &out, &in, &reason);
|
reply, COMLEN, 1., &out, &in, &reason);
|
||||||
if (status == asynSuccess) {
|
if (status == asynSuccess) {
|
||||||
if (strstr(reply, "?OF") != NULL) {
|
if (strstr(reply, "?OF") != NULL) {
|
||||||
strcpy(myCommand, "RMT 1");
|
strcpy(myCommand, "RMT 1");
|
||||||
status = pasynOctetSyncIO->writeRead(priv->asynContext, myCommand, strlen(myCommand),
|
status = pasynOctetSyncIO->writeRead(
|
||||||
reply,COMLEN, 1.,&out,&in,&reason);
|
priv->asynContext, myCommand, strlen(myCommand), reply, COMLEN,
|
||||||
|
1., &out, &in, &reason);
|
||||||
strcpy(myCommand, "ECHO 2");
|
strcpy(myCommand, "ECHO 2");
|
||||||
status = pasynOctetSyncIO->writeRead(priv->asynContext, myCommand, strlen(myCommand),
|
status = pasynOctetSyncIO->writeRead(
|
||||||
reply,COMLEN, 1.,&out,&in,&reason);
|
priv->asynContext, myCommand, strlen(myCommand), reply, COMLEN,
|
||||||
return pasynOctetSyncIO->writeRead(priv->asynContext, command, strlen(command),
|
1., &out, &in, &reason);
|
||||||
reply,COMLEN, 1.,&out,&in,&reason);
|
return pasynOctetSyncIO->writeRead(priv->asynContext, command,
|
||||||
|
strlen(command), reply, COMLEN,
|
||||||
|
1., &out, &in, &reason);
|
||||||
} else {
|
} else {
|
||||||
if (strstr(reply, "?OV") != NULL) {
|
if (strstr(reply, "?OV") != NULL) {
|
||||||
strncpy(message, "Overflow", sizeof(message));
|
strncpy(message, "Overflow", sizeof(message));
|
||||||
@ -392,7 +387,8 @@ static asynStatus el737_transactCommand(EL737priv *priv,char command[COMLEN],cha
|
|||||||
if (errno == EAGAIN) {
|
if (errno == EAGAIN) {
|
||||||
errlogPrintf("Lost response to %s with EAGAIN\n", command);
|
errlogPrintf("Lost response to %s with EAGAIN\n", command);
|
||||||
} else {
|
} else {
|
||||||
snprintf(message,sizeof(message), "Lost communication with errno %d", errno);
|
snprintf(message, sizeof(message),
|
||||||
|
"Lost communication with errno %d", errno);
|
||||||
/* force a reconnect */
|
/* force a reconnect */
|
||||||
pasynOctetSyncIO->disconnect(priv->asynContext);
|
pasynOctetSyncIO->disconnect(priv->asynContext);
|
||||||
}
|
}
|
||||||
@ -401,33 +397,33 @@ static asynStatus el737_transactCommand(EL737priv *priv,char command[COMLEN],cha
|
|||||||
dbStatus = dbPutField(&priv->msgTxt, DBR_STRING, message, 1);
|
dbStatus = dbPutField(&priv->msgTxt, DBR_STRING, message, 1);
|
||||||
if (dbStatus != 0) {
|
if (dbStatus != 0) {
|
||||||
errSymLookup(dbStatus, message, sizeof(message));
|
errSymLookup(dbStatus, message, sizeof(message));
|
||||||
errlogPrintf("Setting external count message failed with %s\n", message);
|
errlogPrintf("Setting external count message failed with %s\n",
|
||||||
|
message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static asynStatus sendStop(EL737priv *priv)
|
static asynStatus sendStop(EL737priv *priv) {
|
||||||
{
|
|
||||||
char command[COMLEN], reply[COMLEN];
|
char command[COMLEN], reply[COMLEN];
|
||||||
// errlogPrintf("EL737: Sending stop\n");
|
// errlogPrintf("EL737: Sending stop\n");
|
||||||
strcpy(command, "S");
|
strcpy(command, "S");
|
||||||
return el737_transactCommand(priv, command, reply);
|
return el737_transactCommand(priv, command, reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void runEvents(EL737priv *priv)
|
static void runEvents(EL737priv *priv) {
|
||||||
{
|
|
||||||
char command[COMLEN], reply[COMLEN], errName[256];
|
char command[COMLEN], reply[COMLEN], errName[256];
|
||||||
int status;
|
int status;
|
||||||
long dbStatus, nElements = 1, options = 0, threshCounter;
|
long dbStatus, nElements = 1, options = 0, threshCounter;
|
||||||
long unsigned int myThreshold;
|
long unsigned int myThreshold;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is the better way to set the threshold rather then the old way below which uses
|
This is the better way to set the threshold rather then the old way below
|
||||||
presets for that function. This one uses separate fields.
|
which uses presets for that function. This one uses separate fields.
|
||||||
*/
|
*/
|
||||||
if (priv->dbInit == 1 && priv->sendThreshold) {
|
if (priv->dbInit == 1 && priv->sendThreshold) {
|
||||||
dbStatus = dbGetField(&priv->threshold,DBR_LONG,&myThreshold,&options, &nElements,NULL);
|
dbStatus = dbGetField(&priv->threshold, DBR_LONG, &myThreshold,
|
||||||
|
&options, &nElements, NULL);
|
||||||
if (dbStatus != 0) {
|
if (dbStatus != 0) {
|
||||||
errSymLookup(dbStatus, errName, sizeof(errName));
|
errSymLookup(dbStatus, errName, sizeof(errName));
|
||||||
errlogPrintf("Reading threshold failed with %s\n", errName);
|
errlogPrintf("Reading threshold failed with %s\n", errName);
|
||||||
@ -436,10 +432,13 @@ static void runEvents(EL737priv *priv)
|
|||||||
/*
|
/*
|
||||||
we have to set the threshold
|
we have to set the threshold
|
||||||
*/
|
*/
|
||||||
dbStatus = dbGetField(&priv->threshCounter,DBR_LONG,&threshCounter, &options, &nElements,NULL);
|
dbStatus =
|
||||||
|
dbGetField(&priv->threshCounter, DBR_LONG, &threshCounter,
|
||||||
|
&options, &nElements, NULL);
|
||||||
if (dbStatus != 0) {
|
if (dbStatus != 0) {
|
||||||
errSymLookup(dbStatus, errName, sizeof(errName));
|
errSymLookup(dbStatus, errName, sizeof(errName));
|
||||||
errlogPrintf("Reading thresholdCounter failed with %s\n", errName);
|
errlogPrintf("Reading thresholdCounter failed with %s\n",
|
||||||
|
errName);
|
||||||
} else {
|
} else {
|
||||||
if (threshCounter == 0) {
|
if (threshCounter == 0) {
|
||||||
threshCounter = 1;
|
threshCounter = 1;
|
||||||
@ -460,11 +459,13 @@ static void runEvents(EL737priv *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (priv->sendThreshold == 1) {
|
if (priv->sendThreshold == 1) {
|
||||||
// fallback when we do not have the DB fields or threshCounter is invalid
|
// fallback when we do not have the DB fields or threshCounter is
|
||||||
|
// invalid
|
||||||
if (priv->presets[THRESHMON] > 0) {
|
if (priv->presets[THRESHMON] > 0) {
|
||||||
sprintf(command, "DL %d %d", (int)priv->presets[THRESHMON],
|
sprintf(command, "DL %d %d", (int)priv->presets[THRESHMON],
|
||||||
(int)priv->presets[THRESHVAL]);
|
(int)priv->presets[THRESHVAL]);
|
||||||
// errlogPrintf("Sending threshold from presets, command %s\n", command);
|
// errlogPrintf("Sending threshold from presets, command %s\n",
|
||||||
|
// command);
|
||||||
status = el737_transactCommand(priv, command, reply);
|
status = el737_transactCommand(priv, command, reply);
|
||||||
sprintf(command, "DR %d", (int)priv->presets[THRESHMON]);
|
sprintf(command, "DR %d", (int)priv->presets[THRESHMON]);
|
||||||
status = el737_transactCommand(priv, command, reply);
|
status = el737_transactCommand(priv, command, reply);
|
||||||
@ -496,15 +497,14 @@ static void runEvents(EL737priv *priv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (status != asynSuccess) {
|
if (status != asynSuccess) {
|
||||||
errlogPrintf("devScalerEL737::el737Thread communication problem %s\n, errno =%d",
|
errlogPrintf(
|
||||||
|
"devScalerEL737::el737Thread communication problem %s\n, errno =%d",
|
||||||
priv->asynContext->errorMessage, errno);
|
priv->asynContext->errorMessage, errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void updateValues(EL737priv *priv)
|
static void updateValues(EL737priv *priv) {
|
||||||
{
|
|
||||||
char command[COMLEN], reply[COMLEN];
|
char command[COMLEN], reply[COMLEN];
|
||||||
int status;
|
int status;
|
||||||
float fTime;
|
float fTime;
|
||||||
@ -514,20 +514,24 @@ static void updateValues(EL737priv *priv)
|
|||||||
status = el737_transactCommand(priv, command, reply);
|
status = el737_transactCommand(priv, command, reply);
|
||||||
if (status != asynSuccess) {
|
if (status != asynSuccess) {
|
||||||
if (errno == EAGAIN) {
|
if (errno == EAGAIN) {
|
||||||
errlogPrintf("devScalerEL737::el737Thread lost response to %s with EAGAIN\n", command);
|
errlogPrintf(
|
||||||
|
"devScalerEL737::el737Thread lost response to %s with EAGAIN\n",
|
||||||
|
command);
|
||||||
} else {
|
} else {
|
||||||
errlogPrintf("devScalerEL737::el737Thread communication problem %s, errno = %d\n",
|
errlogPrintf("devScalerEL737::el737Thread communication problem "
|
||||||
|
"%s, errno = %d\n",
|
||||||
priv->asynContext->errorMessage, errno);
|
priv->asynContext->errorMessage, errno);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
status = sscanf(reply, "%f %ld %ld %ld %ld %ld %ld %ld %ld",
|
status = sscanf(reply, "%f %ld %ld %ld %ld %ld %ld %ld %ld", &fTime, &m1,
|
||||||
&fTime, &m1, &m2, &m3, &m4, &m5, &m6, &m7, &m8);
|
&m2, &m3, &m4, &m5, &m6, &m7, &m8);
|
||||||
if (status != 9) {
|
if (status != 9) {
|
||||||
/*
|
/*
|
||||||
old form with 4 monitors
|
old form with 4 monitors
|
||||||
*/
|
*/
|
||||||
status = sscanf(reply, "%ld %ld %ld %ld %f", &m1, &m2, &m3, &m4, &fTime);
|
status =
|
||||||
|
sscanf(reply, "%ld %ld %ld %ld %f", &m1, &m2, &m3, &m4, &fTime);
|
||||||
if (status != 5) {
|
if (status != 5) {
|
||||||
errlogPrintf("devScalerEL737::el737Thread bad RA reply %s\n",
|
errlogPrintf("devScalerEL737::el737Thread bad RA reply %s\n",
|
||||||
reply);
|
reply);
|
||||||
@ -543,11 +547,9 @@ static void updateValues(EL737priv *priv)
|
|||||||
priv->values[6] = m6;
|
priv->values[6] = m6;
|
||||||
priv->values[7] = m7;
|
priv->values[7] = m7;
|
||||||
priv->values[8] = m8;
|
priv->values[8] = m8;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void el737Thread(void *param)
|
static void el737Thread(void *param) {
|
||||||
{
|
|
||||||
EL737priv *priv = (EL737priv *)param;
|
EL737priv *priv = (EL737priv *)param;
|
||||||
epicsEventWaitStatus evStatus;
|
epicsEventWaitStatus evStatus;
|
||||||
double timeout = 60.;
|
double timeout = 60.;
|
||||||
@ -581,12 +583,12 @@ static void el737Thread(void *param)
|
|||||||
status = sendStop(priv);
|
status = sendStop(priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (priv->counting) {
|
if (priv->counting) {
|
||||||
strcpy(command, "RS");
|
strcpy(command, "RS");
|
||||||
status = el737_transactCommand(priv, command, reply);
|
status = el737_transactCommand(priv, command, reply);
|
||||||
if (status != asynSuccess) {
|
if (status != asynSuccess) {
|
||||||
errlogPrintf("devScalerEL737::el737Thread communication problem %s\n",
|
errlogPrintf("devScalerEL737::el737Thread communication "
|
||||||
|
"problem %s\n",
|
||||||
priv->asynContext->errorMessage);
|
priv->asynContext->errorMessage);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -619,23 +621,28 @@ static void el737Thread(void *param)
|
|||||||
dbStatus = dbPutField(&priv->status, DBR_LONG, &ctStatus, 1);
|
dbStatus = dbPutField(&priv->status, DBR_LONG, &ctStatus, 1);
|
||||||
if (dbStatus != 0) {
|
if (dbStatus != 0) {
|
||||||
errSymLookup(dbStatus, errName, sizeof(errName));
|
errSymLookup(dbStatus, errName, sizeof(errName));
|
||||||
errlogPrintf("Setting external count status failed with %s\n", errName);
|
errlogPrintf(
|
||||||
|
"Setting external count status failed with %s\n",
|
||||||
|
errName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
check and handle pause flag
|
check and handle pause flag
|
||||||
*/
|
*/
|
||||||
dbStatus = dbGetField(&priv->pause, DBR_LONG,&pauseFlag,&options, &nElements, NULL);
|
dbStatus = dbGetField(&priv->pause, DBR_LONG, &pauseFlag,
|
||||||
|
&options, &nElements, NULL);
|
||||||
if (dbStatus != 0) {
|
if (dbStatus != 0) {
|
||||||
errSymLookup(dbStatus, errName, sizeof(errName));
|
errSymLookup(dbStatus, errName, sizeof(errName));
|
||||||
errlogPrintf("Reading pauseFlag failed with %s\n", errName);
|
errlogPrintf("Reading pauseFlag failed with %s\n", errName);
|
||||||
}
|
}
|
||||||
/* errlogPrintf("Successfully read %ld pause flags as %d\n",nElements, pauseFlag); */
|
/* errlogPrintf("Successfully read %ld pause flags as
|
||||||
|
* %d\n",nElements, pauseFlag); */
|
||||||
if (pauseFlag == 1 && ctStatus == 1) {
|
if (pauseFlag == 1 && ctStatus == 1) {
|
||||||
strcpy(command, "PS");
|
strcpy(command, "PS");
|
||||||
status = el737_transactCommand(priv, command, reply);
|
status = el737_transactCommand(priv, command, reply);
|
||||||
if (status != asynSuccess) {
|
if (status != asynSuccess) {
|
||||||
errlogPrintf("devScalerEL737::el737Thread communication problem %s\n",
|
errlogPrintf("devScalerEL737::el737Thread "
|
||||||
|
"communication problem %s\n",
|
||||||
priv->asynContext->errorMessage);
|
priv->asynContext->errorMessage);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -643,7 +650,8 @@ static void el737Thread(void *param)
|
|||||||
strcpy(command, "CO");
|
strcpy(command, "CO");
|
||||||
status = el737_transactCommand(priv, command, reply);
|
status = el737_transactCommand(priv, command, reply);
|
||||||
if (status != asynSuccess) {
|
if (status != asynSuccess) {
|
||||||
errlogPrintf("devScalerEL737::el737Thread communication problem %s\n",
|
errlogPrintf("devScalerEL737::el737Thread "
|
||||||
|
"communication problem %s\n",
|
||||||
priv->asynContext->errorMessage);
|
priv->asynContext->errorMessage);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -658,4 +666,3 @@ static void el737Thread(void *param)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
|
|
||||||
record(bo,"$(P):Pause")
|
record(bo,"$(P):Pause")
|
||||||
{
|
{
|
||||||
field(DTYP,"Soft Channel")
|
field(DTYP,"Soft Channel")
|
||||||
}
|
}
|
||||||
|
|
||||||
record(longin,"$(P):Status")
|
record(longin,"$(P):Status")
|
||||||
{
|
{
|
||||||
field(DTYP,"Soft Channel")
|
field(DTYP,"Soft Channel")
|
||||||
}
|
}
|
||||||
|
|
||||||
record(stringin,"$(P):MsgTxt")
|
record(stringin,"$(P):MsgTxt")
|
||||||
{
|
{
|
||||||
field(DTYP,"Soft Channel")
|
field(DTYP,"Soft Channel")
|
||||||
}
|
}
|
||||||
|
|
||||||
record(scaler,"$(P)")
|
record(scaler,"$(P)")
|
||||||
{
|
{
|
||||||
field(DESC,"$(DESC)")
|
field(DESC,"$(DESC)")
|
||||||
|
Reference in New Issue
Block a user