Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
Beam Positoning Monitor - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Beam Positoning Monitor - Software
Commits
bc55ed0d
Commit
bc55ed0d
authored
Mar 02, 2016
by
Lucas Russo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libhutils: add independent parsing of spawn_epics_ioc for DBE and AFE
parent
ded53f81
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
15 deletions
+38
-15
hutils_utils.h
src/libs/libhutils/include/hutils_utils.h
+2
-1
hutils_utils.c
src/libs/libhutils/src/hutils_utils.c
+36
-14
No files found.
src/libs/libhutils/include/hutils_utils.h
View file @
bc55ed0d
...
...
@@ -35,7 +35,8 @@ extern "C" {
typedef
struct
{
char
*
bind
;
/* AFE Endpoint address to bind to */
char
*
fmc_board
;
/* FMC board type */
bool
spawn_epics_ioc
;
/* DBE IOC spawn selection */
bool
spawn_dbe_epics_ioc
;
/* DBE IOC spawn selection */
bool
spawn_afe_epics_ioc
;
/* AFE IOC spawn selection */
}
hutils_hints_t
;
/************************ Our methods *****************************/
...
...
src/libs/libhutils/src/hutils_utils.c
View file @
bc55ed0d
...
...
@@ -415,23 +415,42 @@ hutils_err_e hutils_get_hints (zconfig_t *root_cfg, zhashx_t *hints_h)
/* Read if the user ask us to spawn the EPICS IOC in the
* configuration file */
char
*
spawn_
epics_ioc
=
zconfig_resolve
(
bpm_cfg
,
"
/spawn_epics_ioc"
,
char
*
spawn_
dbe_epics_ioc
=
zconfig_resolve
(
bpm_cfg
,
"/dbe
/spawn_epics_ioc"
,
NULL
);
ASSERT_TEST
(
spawn_epics_ioc
!=
NULL
,
"[hutils:utils] Could not find "
"
EPICS IOC (spwa
n_epics_ioc = <value>) in configuration file"
,
err_spawn_epics_ioc
,
HUTILS_ERR_CFG
);
ASSERT_TEST
(
spawn_
dbe_
epics_ioc
!=
NULL
,
"[hutils:utils] Could not find "
"
DBE EPICS IOC (spaw
n_epics_ioc = <value>) in configuration file"
,
err_spawn_
dbe_
epics_ioc
,
HUTILS_ERR_CFG
);
/* Convert yes/no to bool */
if
(
streq
(
spawn_epics_ioc
,
"yes"
))
{
item
->
spawn_epics_ioc
=
1
;
if
(
streq
(
spawn_
dbe_
epics_ioc
,
"yes"
))
{
item
->
spawn_
dbe_
epics_ioc
=
1
;
}
else
if
(
streq
(
spawn_epics_ioc
,
"no"
))
{
item
->
spawn_epics_ioc
=
0
;
else
if
(
streq
(
spawn_
dbe_
epics_ioc
,
"no"
))
{
item
->
spawn_
dbe_
epics_ioc
=
0
;
}
else
{
DBE_DEBUG
(
DBG_HAL_UTILS
|
DBG_LVL_FATAL
,
"[dev_mngr] Invalid option "
"for spawn_epics_ioc configuration variable
\n
"
);
goto
err_inv_spawn_epics_ioc
;
"for spawn_dbe_epics_ioc configuration variable
\n
"
);
goto
err_inv_spawn_dbe_epics_ioc
;
}
char
*
spawn_afe_epics_ioc
=
zconfig_resolve
(
bpm_cfg
,
"/afe/spawn_epics_ioc"
,
NULL
);
ASSERT_TEST
(
spawn_afe_epics_ioc
!=
NULL
,
"[hutils:utils] Could not find "
"AFE EPICS IOC (spawn_epics_ioc = <value>) in configuration file"
,
err_spawn_afe_epics_ioc
,
HUTILS_ERR_CFG
);
/* Convert yes/no to bool */
if
(
streq
(
spawn_afe_epics_ioc
,
"yes"
))
{
item
->
spawn_afe_epics_ioc
=
1
;
}
else
if
(
streq
(
spawn_afe_epics_ioc
,
"no"
))
{
item
->
spawn_afe_epics_ioc
=
0
;
}
else
{
DBE_DEBUG
(
DBG_HAL_UTILS
|
DBG_LVL_FATAL
,
"[dev_mngr] Invalid option "
"for spawn_afe_epics_ioc configuration variable
\n
"
);
goto
err_inv_spawn_afe_epics_ioc
;
}
/* Now, we only need to generate a valid key to insert in the hash.
...
...
@@ -450,8 +469,9 @@ hutils_err_e hutils_get_hints (zconfig_t *root_cfg, zhashx_t *hints_h)
DBE_DEBUG
(
DBG_HAL_UTILS
|
DBG_LVL_INFO
,
"[hutils:utils] CFG hints "
"hash key:
\"
%s
\"
, fmc_board:
\"
%s
\"
, bind:
\"
%s
\"
, "
"spawn_epics_ioc: %s
\n
"
,
hints_key
,
fmc_board
,
afe_bind
,
spawn_epics_ioc
);
"spawn_dbe_epics_ioc: %s, spwan_afe_epics_ioc: %s
\n
"
,
hints_key
,
fmc_board
,
afe_bind
,
spawn_dbe_epics_ioc
,
spawn_afe_epics_ioc
);
/* Insert this value in the hash table */
errs
=
zhashx_insert
(
hints_h
,
hints_key
,
item
);
...
...
@@ -464,8 +484,10 @@ hutils_err_e hutils_get_hints (zconfig_t *root_cfg, zhashx_t *hints_h)
/* Free only the last item on error. The other ones will be freed by the hash table,
* on destruction */
err_inv_spawn_epics_ioc:
err_spawn_epics_ioc:
err_inv_spawn_afe_epics_ioc:
err_spawn_afe_epics_ioc:
err_inv_spawn_dbe_epics_ioc:
err_spawn_dbe_epics_ioc:
free
(
item
->
bind
);
err_hash_bind_alloc:
err_afe_bind:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment