Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fe-vmm-tbl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nice
dev-epics-modules
fe-vmm-tbl
Commits
1796e5fa
Commit
1796e5fa
authored
2 months ago
by
Marco Filho
Browse files
Options
Downloads
Patches
Plain Diff
Improve status checking
Now if API returns a bad status, asyn knows about it.
parent
b959f593
Loading
Loading
1 merge request
!7
Major refactor
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vmmTblApp/src/vmm_tbl.cpp
+31
-24
31 additions, 24 deletions
vmmTblApp/src/vmm_tbl.cpp
with
31 additions
and
24 deletions
vmmTblApp/src/vmm_tbl.cpp
+
31
−
24
View file @
1796e5fa
...
@@ -29,6 +29,7 @@ asynStatus VMMTbl::readInt32(asynUser *pasynUser, epicsInt32 *value) {
...
@@ -29,6 +29,7 @@ asynStatus VMMTbl::readInt32(asynUser *pasynUser, epicsInt32 *value) {
int
tmp_val
;
int
tmp_val
;
bool
tmp_val_bool
;
bool
tmp_val_bool
;
uint8_t
tmp_val_uint8
;
uint8_t
tmp_val_uint8
;
vmmStatus
result
=
vmmSuccess
;
int
param_index
=
0
,
hyb_index
,
vmm_index
;
int
param_index
=
0
,
hyb_index
,
vmm_index
;
if
(
function
<
FIRST_VMM_PARAM
)
{
if
(
function
<
FIRST_VMM_PARAM
)
{
...
@@ -36,16 +37,14 @@ asynStatus VMMTbl::readInt32(asynUser *pasynUser, epicsInt32 *value) {
...
@@ -36,16 +37,14 @@ asynStatus VMMTbl::readInt32(asynUser *pasynUser, epicsInt32 *value) {
}
}
if
(
function
==
vmmRegBankVersion
)
{
if
(
function
==
vmmRegBankVersion
)
{
vmmStatus
result
=
this
->
pVmmAPI
->
getRegBankVersion
(
val
);
result
=
this
->
pVmmAPI
->
getRegBankVersion
(
val
);
if
(
result
!=
vmmSuccess
)
status
=
asynError
;
*
value
=
val
;
*
value
=
val
;
goto
endOfReadInt32
;
goto
endOfReadInt32
;
}
}
if
(
function
==
vmmIsAcquiring_
)
{
if
(
function
==
vmmIsAcquiring_
)
{
vmmStatus
result
=
this
->
pVmmAPI
->
isAcquiring
(
tmp_val_bool
);
result
=
this
->
pVmmAPI
->
isAcquiring
(
tmp_val_bool
);
printf
(
"Is acquiring: %d
\n
"
,
tmp_val_bool
);
printf
(
"Is acquiring: %d
\n
"
,
tmp_val_bool
);
if
(
result
!=
vmmSuccess
)
status
=
asynError
;
*
value
=
tmp_val_bool
;
*
value
=
tmp_val_bool
;
goto
endOfReadInt32
;
goto
endOfReadInt32
;
}
}
...
@@ -53,42 +52,42 @@ asynStatus VMMTbl::readInt32(asynUser *pasynUser, epicsInt32 *value) {
...
@@ -53,42 +52,42 @@ asynStatus VMMTbl::readInt32(asynUser *pasynUser, epicsInt32 *value) {
//Search for parameter in all parameter vectors. If found, execute correct function for specific hybrid.
//Search for parameter in all parameter vectors. If found, execute correct function for specific hybrid.
param_index
=
VecUtils
::
getIndex
(
vmmHybSkew_
,
function
);
param_index
=
VecUtils
::
getIndex
(
vmmHybSkew_
,
function
);
if
(
param_index
>=
0
)
{
if
(
param_index
>=
0
)
{
this
->
pVmmAPI
->
getSkew
(
param_index
,
tmp_val_uint8
);
result
=
this
->
pVmmAPI
->
getSkew
(
param_index
,
tmp_val_uint8
);
*
value
=
tmp_val_uint8
;
*
value
=
tmp_val_uint8
;
goto
endOfReadInt32
;
goto
endOfReadInt32
;
}
}
param_index
=
VecUtils
::
getIndex
(
vmmHybLinkStatus_
,
function
);
param_index
=
VecUtils
::
getIndex
(
vmmHybLinkStatus_
,
function
);
if
(
param_index
>=
0
)
{
if
(
param_index
>=
0
)
{
this
->
pVmmAPI
->
checkLinkStatus
(
param_index
,
tmp_val
);
result
=
this
->
pVmmAPI
->
checkLinkStatus
(
param_index
,
tmp_val
);
*
value
=
tmp_val
;
*
value
=
tmp_val
;
goto
endOfReadInt32
;
goto
endOfReadInt32
;
}
}
param_index
=
VecUtils
::
getIndex
(
vmmHybWidth_
,
function
);
param_index
=
VecUtils
::
getIndex
(
vmmHybWidth_
,
function
);
if
(
param_index
>=
0
)
{
if
(
param_index
>=
0
)
{
this
->
pVmmAPI
->
getWidth
(
param_index
,
tmp_val_uint8
);
result
=
this
->
pVmmAPI
->
getWidth
(
param_index
,
tmp_val_uint8
);
*
value
=
tmp_val_uint8
;
*
value
=
tmp_val_uint8
;
goto
endOfReadInt32
;
goto
endOfReadInt32
;
}
}
param_index
=
VecUtils
::
getIndex
(
vmmHybPolarity_
,
function
);
param_index
=
VecUtils
::
getIndex
(
vmmHybPolarity_
,
function
);
if
(
param_index
>=
0
)
{
if
(
param_index
>=
0
)
{
this
->
pVmmAPI
->
getHybPolarity
(
param_index
,
tmp_val_bool
);
result
=
this
->
pVmmAPI
->
getHybPolarity
(
param_index
,
tmp_val_bool
);
*
value
=
tmp_val_bool
;
*
value
=
tmp_val_bool
;
goto
endOfReadInt32
;
goto
endOfReadInt32
;
}
}
param_index
=
VecUtils
::
getIndex
(
vmmADCIDX_
,
function
,
hyb_index
,
vmm_index
);
param_index
=
VecUtils
::
getIndex
(
vmmADCIDX_
,
function
,
hyb_index
,
vmm_index
);
if
(
param_index
==
0
)
{
if
(
param_index
==
0
)
{
this
->
pVmmAPI
->
getADCIdx
(
hyb_index
,
vmm_index
,
tmp_val
);
result
=
this
->
pVmmAPI
->
getADCIdx
(
hyb_index
,
vmm_index
,
tmp_val
);
*
value
=
tmp_val
;
*
value
=
tmp_val
;
goto
endOfReadInt32
;
goto
endOfReadInt32
;
}
}
param_index
=
VecUtils
::
getIndex
(
vmmADCVAL_
,
function
,
hyb_index
,
vmm_index
);
param_index
=
VecUtils
::
getIndex
(
vmmADCVAL_
,
function
,
hyb_index
,
vmm_index
);
if
(
param_index
==
0
)
{
if
(
param_index
==
0
)
{
this
->
pVmmAPI
->
readADC
(
hyb_index
,
vmm_index
,
tmp_val
);
result
=
this
->
pVmmAPI
->
readADC
(
hyb_index
,
vmm_index
,
tmp_val
);
*
value
=
tmp_val
;
*
value
=
tmp_val
;
goto
endOfReadInt32
;
goto
endOfReadInt32
;
}
}
...
@@ -101,11 +100,17 @@ asynStatus VMMTbl::readInt32(asynUser *pasynUser, epicsInt32 *value) {
...
@@ -101,11 +100,17 @@ asynStatus VMMTbl::readInt32(asynUser *pasynUser, epicsInt32 *value) {
*
value
=
0
;
*
value
=
0
;
return
asynError
;
return
asynError
;
}
}
if
(
result
!=
vmmSuccess
)
{
asynPrint
(
pasynUserSelf
,
ASYN_TRACE_ERROR
,
"%s:%s: Failed to adequately read parameter: %d.
\n
"
,
driverName
,
__FUNCTION__
,
function
);
status
=
asynError
;
}
setIntegerParam
(
function
,
*
value
);
setIntegerParam
(
function
,
*
value
);
callParamCallbacks
();
callParamCallbacks
();
return
asynSucces
s
;
return
statu
s
;
}
}
...
@@ -114,33 +119,32 @@ asynStatus VMMTbl::readOctet(asynUser *pasynUser, char *value,
...
@@ -114,33 +119,32 @@ asynStatus VMMTbl::readOctet(asynUser *pasynUser, char *value,
int
*
eomReason
)
int
*
eomReason
)
{
{
int
status
=
asynSuccess
;
asynStatus
status
=
asynSuccess
;
vmmStatus
result
;
int
function
=
pasynUser
->
reason
;
int
function
=
pasynUser
->
reason
;
std
::
string
read
=
""
;
std
::
string
read
=
""
;
/* If this parameter belongs to a base class call its method */
/* If this parameter belongs to a base class call its method */
if
(
function
<
FIRST_VMM_PARAM
)
{
if
(
function
<
FIRST_VMM_PARAM
)
{
status
=
asynPortDriver
::
readOctet
(
pasynUser
,
value
,
nChars
,
nActual
,
return
asynPortDriver
::
readOctet
(
pasynUser
,
value
,
nChars
,
nActual
,
eomReason
);
eomReason
);
return
(
asynStatus
)
status
;
}
}
//Search for parameter in all parameter vectors. If found, execute correct function for specific hybrid.
//Search for parameter in all parameter vectors. If found, execute correct function for specific hybrid.
int
param_index
=
VecUtils
::
getIndex
(
vmmHybFwVersion_
,
function
);
int
param_index
=
VecUtils
::
getIndex
(
vmmHybFwVersion_
,
function
);
if
(
param_index
>=
0
)
{
if
(
param_index
>=
0
)
{
this
->
pVmmAPI
->
readFwVersion
(
param_index
,
read
);
result
=
this
->
pVmmAPI
->
readFwVersion
(
param_index
,
read
);
goto
endOfReadOctet
;
goto
endOfReadOctet
;
}
}
param_index
=
VecUtils
::
getIndex
(
vmmHybId_
,
function
);
param_index
=
VecUtils
::
getIndex
(
vmmHybId_
,
function
);
if
(
param_index
>=
0
)
{
if
(
param_index
>=
0
)
{
this
->
pVmmAPI
->
readIDChip
(
param_index
,
read
);
result
=
this
->
pVmmAPI
->
readIDChip
(
param_index
,
read
);
goto
endOfReadOctet
;
goto
endOfReadOctet
;
}
}
param_index
=
VecUtils
::
getIndex
(
vmmHybGeoPos_
,
function
);
param_index
=
VecUtils
::
getIndex
(
vmmHybGeoPos_
,
function
);
if
(
param_index
>=
0
)
{
if
(
param_index
>=
0
)
{
this
->
pVmmAPI
->
readGeoPos
(
param_index
,
read
);
result
=
this
->
pVmmAPI
->
readGeoPos
(
param_index
,
read
);
goto
endOfReadOctet
;
goto
endOfReadOctet
;
}
}
...
@@ -150,6 +154,12 @@ asynStatus VMMTbl::readOctet(asynUser *pasynUser, char *value,
...
@@ -150,6 +154,12 @@ asynStatus VMMTbl::readOctet(asynUser *pasynUser, char *value,
*
nActual
=
1
;
*
nActual
=
1
;
return
asynError
;
return
asynError
;
}
}
if
(
result
!=
vmmSuccess
)
{
asynPrint
(
pasynUserSelf
,
ASYN_TRACE_ERROR
,
"%s:%s: Failed to adequately read parameter: %d.
\n
"
,
driverName
,
__FUNCTION__
,
function
);
status
=
asynError
;
}
size_t
copy_size
=
std
::
min
(
read
.
size
(),
nChars
);
size_t
copy_size
=
std
::
min
(
read
.
size
(),
nChars
);
strncpy
(
value
,
read
.
c_str
(),
copy_size
);
strncpy
(
value
,
read
.
c_str
(),
copy_size
);
setStringParam
(
function
,
value
);
setStringParam
(
function
,
value
);
...
@@ -158,7 +168,7 @@ asynStatus VMMTbl::readOctet(asynUser *pasynUser, char *value,
...
@@ -158,7 +168,7 @@ asynStatus VMMTbl::readOctet(asynUser *pasynUser, char *value,
*
eomReason
=
ASYN_EOM_END
;
*
eomReason
=
ASYN_EOM_END
;
callParamCallbacks
();
callParamCallbacks
();
return
asynSucces
s
;
return
statu
s
;
}
}
...
@@ -266,7 +276,7 @@ asynStatus VMMTbl::createEpicsParams() {
...
@@ -266,7 +276,7 @@ asynStatus VMMTbl::createEpicsParams() {
asynStatus
VMMTbl
::
writeInt32
(
asynUser
*
pasynUser
,
epicsInt32
value
)
{
asynStatus
VMMTbl
::
writeInt32
(
asynUser
*
pasynUser
,
epicsInt32
value
)
{
asynStatus
status
=
asynSuccess
;
asynStatus
status
=
asynSuccess
;
vmmStatus
vmm_stat
;
vmmStatus
vmm_stat
=
vmmSuccess
;
bool
is_acquiring
;
bool
is_acquiring
;
int
function
=
pasynUser
->
reason
;
int
function
=
pasynUser
->
reason
;
int
param_index
=
0
,
hyb_index
,
vmm_index
;
int
param_index
=
0
,
hyb_index
,
vmm_index
;
...
@@ -293,28 +303,24 @@ asynStatus VMMTbl::writeInt32(asynUser *pasynUser, epicsInt32 value) {
...
@@ -293,28 +303,24 @@ asynStatus VMMTbl::writeInt32(asynUser *pasynUser, epicsInt32 value) {
param_index
=
VecUtils
::
getIndex
(
vmmHybSkew_
,
function
);
param_index
=
VecUtils
::
getIndex
(
vmmHybSkew_
,
function
);
if
(
param_index
>=
0
)
{
if
(
param_index
>=
0
)
{
vmm_stat
=
this
->
pVmmAPI
->
setSkew
(
param_index
,
value
);
vmm_stat
=
this
->
pVmmAPI
->
setSkew
(
param_index
,
value
);
if
(
vmm_stat
!=
vmmSuccess
)
status
=
asynError
;
goto
endOfWriteInt32
;
goto
endOfWriteInt32
;
}
}
param_index
=
VecUtils
::
getIndex
(
vmmHybWidth_
,
function
);
param_index
=
VecUtils
::
getIndex
(
vmmHybWidth_
,
function
);
if
(
param_index
>=
0
)
{
if
(
param_index
>=
0
)
{
vmm_stat
=
this
->
pVmmAPI
->
setWidth
(
param_index
,
value
);
vmm_stat
=
this
->
pVmmAPI
->
setWidth
(
param_index
,
value
);
if
(
vmm_stat
!=
vmmSuccess
)
status
=
asynError
;
goto
endOfWriteInt32
;
goto
endOfWriteInt32
;
}
}
param_index
=
VecUtils
::
getIndex
(
vmmHybPolarity_
,
function
);
param_index
=
VecUtils
::
getIndex
(
vmmHybPolarity_
,
function
);
if
(
param_index
>=
0
)
{
if
(
param_index
>=
0
)
{
vmm_stat
=
this
->
pVmmAPI
->
setHybPolarity
(
param_index
,
value
);
vmm_stat
=
this
->
pVmmAPI
->
setHybPolarity
(
param_index
,
value
);
if
(
vmm_stat
!=
vmmSuccess
)
status
=
asynError
;
goto
endOfWriteInt32
;
goto
endOfWriteInt32
;
}
}
param_index
=
VecUtils
::
getIndex
(
vmmADCIDX_
,
function
,
hyb_index
,
vmm_index
);
param_index
=
VecUtils
::
getIndex
(
vmmADCIDX_
,
function
,
hyb_index
,
vmm_index
);
if
(
param_index
==
0
)
{
if
(
param_index
==
0
)
{
vmm_stat
=
this
->
pVmmAPI
->
setADCIdx
(
hyb_index
,
vmm_index
,
value
);
vmm_stat
=
this
->
pVmmAPI
->
setADCIdx
(
hyb_index
,
vmm_index
,
value
);
if
(
vmm_stat
!=
vmmSuccess
)
status
=
asynError
;
goto
endOfWriteInt32
;
goto
endOfWriteInt32
;
}
}
...
@@ -322,6 +328,7 @@ asynStatus VMMTbl::writeInt32(asynUser *pasynUser, epicsInt32 value) {
...
@@ -322,6 +328,7 @@ asynStatus VMMTbl::writeInt32(asynUser *pasynUser, epicsInt32 value) {
if
(
param_index
<
0
)
{
if
(
param_index
<
0
)
{
status
=
asynError
;
status
=
asynError
;
}
}
if
(
vmm_stat
!=
vmmSuccess
)
status
=
asynError
;
setIntegerParam
(
function
,
value
);
setIntegerParam
(
function
,
value
);
callParamCallbacks
();
callParamCallbacks
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment