Commit 7345da83 authored by Lucas Russo's avatar Lucas Russo

Merge branch 'epics-ioc-split' into devel

parents 8c7d90cf 5d7e14f5
......@@ -16,157 +16,181 @@ dev_mngr
dev_io
board1
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
board2
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
board3
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
board4
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
board5
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
board6
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
board7
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
board8
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
board9
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
board10
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
board11
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
board12
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = no # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = no # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
......@@ -16,157 +16,182 @@ dev_mngr
dev_io
board1
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
board2
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind = tcp://10.2.117.210:6791
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind = tcp://10.2.117.211:6791
board3
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind = tcp://10.2.117.208:6791
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind = tcp://10.2.117.209:6791
board4
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
afe
bind = tcp://10.2.117.206:6791
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind = tcp://10.2.117.207:6791
board5
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
board6
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
board7
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind = tcp://10.2.117.204:6791
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind = tcp://10.2.117.205:6791
board8
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind = tcp://10.2.117.202:6791
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind = tcp://10.2.117.203:6791
board9
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind = tcp://10.2.117.200:6791
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind = tcp://10.2.117.201:6791
board10
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
board11
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
board12
bpm0
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
bpm1
spawn_epics_ioc = yes # Ask to spawn EPICS IOC (Options are: yes or no)
dbe
spawn_epics_ioc = yes # Ask to spawn DBE EPICS IOC (Options are: yes or no)
fmc_board = fmc250m_4ch
afe
spawn_epics_ioc = yes # Ask to spawn AFE EPICS IOC (Options are: yes or no)
bind =
......@@ -19,6 +19,7 @@ typedef struct {
typedef struct {
int telnet_port;
int telnet_afe_port;
} board_epics_opts_t;
......
......@@ -8,6 +8,7 @@ EPICS_BIN="${EPICS_BASE}/bin/${EPICS_HOST_ARCH}"
#LINUX_HOSTNAME=$(hostname)
EPICS_HOSTNAME="SIDI-BPM-01"
BPM_EPICS_STARTUP="/opt/epics/startup/ioc/bpm-epics-ioc/iocBoot/iocBPM"
BPM_AFE_EPICS_STARTUP="/opt/epics/startup/ioc/bpm-epics-ioc/iocBoot/iocBPMRFFE"
EPICS_EXTENSIONS="/opt/epics/extensions"
EPICS_EXTENSIONS_BIN="/opt/epics/extensions/bin/${EPICS_HOST_ARCH}"
EPICS_CA_MAX_ARRAY_BYTES="50000000"
......
......@@ -8,6 +8,7 @@ EPICS_BIN="${EPICS_BASE}/bin/${EPICS_HOST_ARCH}"
#LINUX_HOSTNAME=$(hostname)
EPICS_HOSTNAME="SIDI-BPM-01"
BPM_EPICS_STARTUP="/opt/epics/startup/ioc/bpm-epics-ioc/iocBoot/iocBPM"
BPM_AFE_EPICS_STARTUP="/opt/epics/startup/ioc/bpm-epics-ioc/iocBoot/iocBPMRFFE"
EPICS_EXTENSIONS="/opt/epics/extensions"
EPICS_EXTENSIONS_BIN="/opt/epics/extensions/bin/${EPICS_HOST_ARCH}"
EPICS_CA_MAX_ARRAY_BYTES="50000000"
......
......@@ -16,6 +16,7 @@ respawn
instance $BOARD
script
set -a
# Source environment variables
. /etc/sysconfig/bpm-sw-board
# My startup script, plain old shell scripting here.
......
......@@ -8,6 +8,7 @@ EPICS_BIN="${EPICS_BASE}/bin/${EPICS_HOST_ARCH}"
#LINUX_HOSTNAME=$(hostname)
EPICS_HOSTNAME="SIDI-BPM-01"
BPM_EPICS_STARTUP="/opt/epics/startup/ioc/bpm-epics-ioc/iocBoot/iocBPM"
BPM_AFE_EPICS_STARTUP="/opt/epics/startup/ioc/bpm-epics-ioc/iocBoot/iocBPMRFFE"
EPICS_EXTENSIONS="/opt/epics/extensions"
EPICS_EXTENSIONS_BIN="/opt/epics/extensions/bin/${EPICS_HOST_ARCH}"
EPICS_CA_MAX_ARRAY_BYTES="50000000"
......
......@@ -46,16 +46,14 @@
/* Arbitrary hard limit for the maximum number of AFE DEVIOs
* for each DBE DEVIO */
#define DEVIO_MAX_FE_DEVIOS 16
#define DEVIO_MAX_FE_DEVIOS 16
#define DEVIO_SERVICE_LEN 50
#define DEVIO_NAME "/usr/local/bin/ebpm"
#define DEVIO_CFG_NAME "/usr/local/bin/ebpm_cfg"
#define DEVIO_CFG_TIMEOUT 5000 /* in ms */
#define EPICS_PROCSERV_NAME "/usr/local/bin/procServ"
#define EPICS_BPM_NAME "BPM"
#define EPICS_BPM_RUN_SCRIPT_NAME "./run.sh"
#define EPICS_BPM_TELNET_BASE_PORT 20000
#define DEVIO_SERVICE_LEN 50
#define DEVIO_NAME "/usr/local/bin/ebpm"
#define DEVIO_CFG_NAME "/usr/local/bin/ebpm_cfg"
#define DEVIO_CFG_TIMEOUT 5000 /* in ms */
#define EPICS_PROCSERV_NAME "/usr/local/bin/procServ"
#define EPICS_BPM_RUN_SCRIPT_NAME "./run.sh"
#define DEVIO_LIBBPMCLIENT_LOG_MODE "a"
#define DEVIO_KILL_CFG_SIGNAL SIGINT
......@@ -178,8 +176,8 @@ int main (int argc, char *argv[])
break;
case 'e':
DBE_DEBUG (DBG_DEV_IO | DBG_LVL_TRACE, "[ebpm] Will set dev_type parameter\n");
dev_type = strdup (optarg);
DBE_DEBUG (DBG_DEV_IO | DBG_LVL_TRACE, "[ebpm] Will set dev_entry parameter\n");
dev_entry = strdup (optarg);
break;
case 'i':
......@@ -632,6 +630,7 @@ static devio_err_e _spawn_epics_iocs (devio_t *devio, uint32_t dev_id,
char *bpm_id_c = NULL;
char *smio_inst_id_c = NULL;
char *telnet_port_c = NULL;
char *telnet_afe_port_c = NULL;
/* For each DEVIO, spawn up to 2 EPICS IOCs. Do a lookup in our
* hints hash to look we we were indeed asked to do that */
......@@ -651,7 +650,8 @@ static devio_err_e _spawn_epics_iocs (devio_t *devio, uint32_t dev_id,
hutils_hints_t *cfg_item = zhashx_lookup (hints, hints_key);
/* If key is not found or we were asked not to spawn EPICS IOC,
* assume we don't have any more DBE to prepare */
if (cfg_item == NULL || cfg_item->spawn_epics_ioc == false) {
if (cfg_item == NULL || (cfg_item->spawn_dbe_epics_ioc == false &&
cfg_item->spawn_afe_epics_ioc == false)) {
continue;
}
......@@ -665,6 +665,10 @@ static devio_err_e _spawn_epics_iocs (devio_t *devio, uint32_t dev_id,
ASSERT_TEST (epics_startup != NULL,
"Could not get EPICS_STARTUP environment variable",
err_cfg_exit, DEVIO_ERR_CFG);
char *epics_afe_startup = getenv("BPM_AFE_EPICS_STARTUP");
ASSERT_TEST (epics_afe_startup != NULL,
"Could not get AFE_EPICS_STARTUP environment variable",
err_cfg_exit, DEVIO_ERR_CFG);
/* Check if we are withing range */
ASSERT_TEST (dev_id < NUM_MAX_SLOTS+1, "Device ID is out of range",
......@@ -679,24 +683,48 @@ static devio_err_e _spawn_epics_iocs (devio_t *devio, uint32_t dev_id,
ASSERT_ALLOC (smio_inst_id_c, err_smio_inst_id_c_alloc, DEVIO_ERR_ALLOC);
telnet_port_c = hutils_stringify_dec_key (board_epics_opts [dev_id][smio_inst_id].telnet_port);
ASSERT_ALLOC (telnet_port_c, err_telnet_port_c_alloc, DEVIO_ERR_ALLOC);
/* Change working directory as EPICS startup files are located in a
* non-default directory */
zsys_dir_change (epics_startup);
telnet_afe_port_c = hutils_stringify_dec_key (board_epics_opts [dev_id][smio_inst_id].telnet_afe_port);
ASSERT_ALLOC (telnet_afe_port_c, err_telnet_afe_port_c_alloc, DEVIO_ERR_ALLOC);
/* Spawn EPICS IOCs */
DBE_DEBUG (DBG_DEV_IO | DBG_LVL_INFO, "[ebpm] Spawing DEVIO EPICS IOC for "
"board %u, bpm %u, telnet port %s\n", dev_id, j, telnet_port_c);
char *argv_exec [] = {EPICS_PROCSERV_NAME, "-n", epics_hostname, "-i",
"^D^C", telnet_port_c, EPICS_BPM_RUN_SCRIPT_NAME, broker_endp, bpm_id_c,
NULL};
/* Spawn Config DEVIO */
int child_devio_cfg_pid = devio_spawn_chld (devio, EPICS_PROCSERV_NAME, argv_exec);
/* Check if we want DBE EPICS IOC */
if (cfg_item->spawn_dbe_epics_ioc == true) {
/* Change working directory as EPICS startup files are located in a
* non-default directory */
zsys_dir_change (epics_startup);
DBE_DEBUG (DBG_DEV_IO | DBG_LVL_INFO, "[ebpm] Spawing DEVIO DBE EPICS IOC for "
"board %u, bpm %u, telnet port %s\n", dev_id, j, telnet_port_c);
char *argv_exec [] = {EPICS_PROCSERV_NAME, "-n", epics_hostname, "-i",
"^D^C", telnet_port_c, EPICS_BPM_RUN_SCRIPT_NAME, broker_endp, bpm_id_c,
NULL};
int child_devio_cfg_pid = devio_spawn_chld (devio, EPICS_PROCSERV_NAME, argv_exec);
if (child_devio_cfg_pid < 0) {
DBE_DEBUG (DBG_DEV_IO | DBG_LVL_FATAL, "[ebpm] Could not create "
"DBE EPICS instance for board %u, bpm %u\n", dev_id, j);
goto err_spawn_dbe_epics;
}
}
if (child_devio_cfg_pid < 0) {
DBE_DEBUG (DBG_DEV_IO | DBG_LVL_FATAL, "[ebpm] Could not create "
"EPICS instance for board %u, bpm %u\n", dev_id, j);
goto err_spawn;
/* Check if we want DBE EPICS IOC */
if (cfg_item->spawn_afe_epics_ioc == true) {
/* Change working directory as EPICS startup files are located in a
* non-default directory */
zsys_dir_change (epics_afe_startup);
DBE_DEBUG (DBG_DEV_IO | DBG_LVL_INFO, "[ebpm] Spawing DEVIO AFE EPICS IOC for "
"board %u, bpm %u, telnet port %s\n", dev_id, j, telnet_afe_port_c);
char *argv_exec [] = {EPICS_PROCSERV_NAME, "-n", epics_hostname, "-i",
"^D^C", telnet_afe_port_c, EPICS_BPM_RUN_SCRIPT_NAME, broker_endp, bpm_id_c,
NULL};
int child_devio_cfg_pid = devio_spawn_chld (devio, EPICS_PROCSERV_NAME, argv_exec);
if (child_devio_cfg_pid < 0) {
DBE_DEBUG (DBG_DEV_IO | DBG_LVL_FATAL, "[ebpm] Could not create "
"AFE EPICS instance for board %u, bpm %u\n", dev_id, j);
goto err_spawn_afe_epics;
}
}
free (bpm_id_c);
......@@ -705,9 +733,14 @@ static devio_err_e _spawn_epics_iocs (devio_t *devio, uint32_t dev_id,
smio_inst_id_c = NULL;
free (telnet_port_c);
telnet_port_c = NULL;
free (telnet_afe_port_c);
telnet_afe_port_c = NULL;
}
err_spawn:
err_spawn_afe_epics:
err_spawn_dbe_epics:
free (telnet_afe_port_c);
err_telnet_afe_port_c_alloc:
free (telnet_port_c);
err_telnet_port_c_alloc:
free (smio_inst_id_c);
......
......@@ -106,7 +106,7 @@ int main (int argc, char *argv[])
case 'e':
DBE_DEBUG (DBG_DEV_IO | DBG_LVL_TRACE, "[ebpm_cfg] Will set dev_type parameter\n");
dev_type = strdup (optarg);
dev_entry = strdup (optarg);
break;
case 'i':
......
......@@ -62,31 +62,57 @@ const board_epics_rev_map_t board_epics_rev_map[NUM_MAX_SLOTS+1][NUM_MAX_BPM_PER
};
const board_epics_opts_t board_epics_opts[NUM_MAX_SLOTS+1][NUM_MAX_BPM_PER_SLOT] = {
/* board, bpm */ /* bpm_id */
/* 0, 0 (INVALID) */ {{-1},
/* 0, 1 (INVALID) */ {-1}},
/* 1, 0 */ {{20000 + 0},
/* 1, 1 */ {20000 + 1}},
/* 2, 0 */ {{20000 + 2},
/* 2, 1 */ {20000 + 3}},
/* 3, 0 */ {{20000 + 4},
/* 3, 1 */ {20000 + 5}},
/* 4, 0 */ {{20000 + 6},
/* 4, 1 */ {20000 + 7}},
/* 5, 0 */ {{20000 + 8},
/* 5, 1 */ {20000 + 9}},
/* 6, 0 */ {{20000 + 10},
/* 6, 1 */ {20000 + 11}},
/* 7, 0 */ {{20000 + 12},
/* 7, 1 */ {20000 + 13}},
/* 8, 0 */ {{20000 + 14},
/* 8, 1 */ {20000 + 15}},
/* 9, 0 */ {{20000 + 16},
/* 9, 1 */ {20000 + 17}},
/* 10, 0 */ {{20000 + 18},
/* 10, 1 */ {20000 + 19}},
/* 11, 0 */ {{20000 + 20},
/* 11, 1 */ {20000 + 21}},
/* 12, 0 */ {{20000 + 22},
/* 12, 1 */ {20000 + 23}}
/* board, bpm */ /* bpm_id */
/* 0, 0 (INVALID) */ {{.telnet_port = -1,
.telnet_afe_port = -1},
/* 0, 1 (INVALID) */ {.telnet_port = -1,
.telnet_afe_port = -1}},
/* 1, 0 */ {{.telnet_port = 20000 + 0,
.telnet_afe_port = 20100 + 0},
/* 1, 1 */ {.telnet_port = 20000 + 1,
.telnet_afe_port = 20100 + 1}},
/* 2, 0 */ {{.telnet_port = 20000 + 2,
.telnet_afe_port = 20100 + 2},
/* 2, 1 */ {.telnet_port = 20000 + 3,
.telnet_afe_port = 20100 + 3}},
/* 3, 0 */ {{.telnet_port = 20000 + 4,
.telnet_afe_port = 20100 + 4},
/* 3, 1 */ {.telnet_port = 20000 + 5,
.telnet_afe_port = 20100 + 5}},
/* 4, 0 */ {{.telnet_port = 20000 + 6,
.telnet_afe_port = 20100 + 6},
/* 4, 1 */ {.telnet_port = 20000 + 7,
.telnet_afe_port = 20100 + 7}},
/* 5, 0 */ {{.telnet_port = 20000 + 8,
.telnet_afe_port = 20100 + 8},
/* 5, 1 */ {.telnet_port = 20000 + 9,
.telnet_afe_port = 20100 + 9}},
/* 6, 0 */ {{.telnet_port = 20000 + 10,
.telnet_afe_port = 20100 + 10},
/* 6, 1 */ {.telnet_port = 20000 + 11,
.telnet_afe_port = 20100 + 11}},
/* 7, 0 */ {{.telnet_port = 20000 + 12,
.telnet_afe_port = 20100 + 12},
/* 7, 1 */ {.telnet_port = 20000 + 13,
.telnet_afe_port = 20100 + 13}},
/* 8, 0 */ {{.telnet_port = 20000 + 14,
.telnet_afe_port = 20100 + 14},
/* 8, 1 */ {.telnet_port = 20000 + 15,
.telnet_afe_port = 20100 + 15}},
/* 9, 0 */ {{.telnet_port = 20000 + 16,
.telnet_afe_port = 20100 + 16},
/* 9, 1 */ {.telnet_port = 20000 + 17,
.telnet_afe_port = 20100 + 17}},
/* 10, 0 */ {{.telnet_port = 20000 + 18,
.telnet_afe_port = 20100 + 18},
/* 10, 1 */ {.telnet_port = 20000 + 19,
.telnet_afe_port = 20100 + 19}},
/* 11, 0 */ {{.telnet_port = 20000 + 20,
.telnet_afe_port = 20100 + 20},
/* 11, 1 */ {.telnet_port = 20000 + 21,
.telnet_afe_port = 20100 + 21}},
/* 12, 0 */ {{.telnet_port = 20000 + 22,
.telnet_afe_port = 20100 + 22},
/* 12, 1 */ {.telnet_port = 20000 + 23,
.telnet_afe_port = 20100 + 23}},
};
......@@ -62,31 +62,57 @@ const board_epics_rev_map_t board_epics_rev_map[NUM_MAX_SLOTS+1][NUM_MAX_BPM_PER
};
const board_epics_opts_t board_epics_opts[NUM_MAX_SLOTS+1][NUM_MAX_BPM_PER_SLOT] = {
/* board, bpm */ /* bpm_id */
/* 0, 0 (INVALID) */ {{-1},
/* 0, 1 (INVALID) */ {-1}},
/* 1, 0 */ {{20000 + 0},
/* 1, 1 */ {20000 + 1}},
/* 2, 0 */ {{20000 + 2},
/* 2, 1 */ {20000 + 3}},
/* 3, 0 */ {{20000 + 4},
/* 3, 1 */ {20000 + 5}},
/* 4, 0 */ {{20000 + 6},
/* 4, 1 */ {20000 + 7}},
/* 5, 0 */ {{20000 + 8},
/* 5, 1 */ {20000 + 9}},
/* 6, 0 */ {{20000 + 10},
/* 6, 1 */ {20000 + 11}},
/* 7, 0 */ {{20000 + 12},
/* 7, 1 */ {20000 + 13}},
/* 8, 0 */ {{20000 + 14},
/* 8, 1 */ {20000 + 15}},
/* 9, 0 */ {{20000 + 16},
/* 9, 1 */ {20000 + 17}},
/* 10, 0 */ {{20000 + 18},
/* 10, 1 */ {20000 + 19}},
/* 11, 0 */ {{20000 + 20},
/* 11, 1 */ {20000 + 21}},
/* 12, 0 */ {{20000 + 22},
/* 12, 1 */ {20000 + 23}}
/* board, bpm */ /* bpm_id */
/* 0, 0 (INVALID) */ {{.telnet_port = -1,
.telnet_afe_port = -1},
/* 0, 1 (INVALID) */ {.telnet_port = -1,
.telnet_afe_port = -1}},
/* 1, 0 */ {{.telnet_port = 20000 + 0,
.telnet_afe_port = 20100 + 0},
/* 1, 1 */ {.telnet_port = 20000 + 1,
.telnet_afe_port = 20100 + 1}},
/* 2, 0 */ {{.telnet_port = 20000 + 2,
.telnet_afe_port = 20100 + 2},
/* 2, 1 */ {.telnet_port = 20000 + 3,
.telnet_afe_port = 20100 + 3}},
/* 3, 0 */ {{.telnet_port = 20000 + 4,
.telnet_afe_port = 20100 + 4},
/* 3, 1 */ {.telnet_port = 20000 + 5,
.telnet_afe_port = 20100 + 5}},
/* 4, 0 */ {{.telnet_port = 20000 + 6,
.telnet_afe_port = 20100 + 6},
/* 4, 1 */ {.telnet_port = 20000 + 7,
.telnet_afe_port = 20100 + 7}},
/* 5, 0 */ {{.telnet_port = 20000 + 8,
.telnet_afe_port = 20100 + 8},
/* 5, 1 */ {.telnet_port = 20000 + 9,
.telnet_afe_port = 20100 + 9}},
/* 6, 0 */ {{.telnet_port = 20000 + 10,
.telnet_afe_port = 20100 + 10},
/* 6, 1 */ {.telnet_port = 20000 + 11,
.telnet_afe_port = 20100 + 11}},
/* 7, 0 */ {{.telnet_port = 20000 + 12,
.telnet_afe_port = 20100 + 12},
/* 7, 1 */ {.telnet_port = 20000 + 13,
.telnet_afe_port = 20100 + 13}},
/* 8, 0 */ {{.telnet_port = 20000 + 14,
.telnet_afe_port = 20100 + 14},
/* 8, 1 */ {.telnet_port = 20000 + 15,
.telnet_afe_port = 20100 + 15}},
/* 9, 0 */ {{.telnet_port = 20000 + 16,
.telnet_afe_port = 20100 + 16},
/* 9, 1 */ {.telnet_port = 20000 + 17,
.telnet_afe_port = 20100 + 17}},
/* 10, 0 */ {{.telnet_port = 20000 + 18,
.telnet_afe_port = 20100 + 18},
/* 10, 1 */ {.telnet_port = 20000 + 19,
.telnet_afe_port = 20100 + 19}},
/* 11, 0 */ {{.telnet_port = 20000 + 20,
.telnet_afe_port = 20100 + 20},
/* 11, 1 */ {.telnet_port = 20000 + 21,
.telnet_afe_port = 20100 + 21}},
/* 12, 0 */ {{.telnet_port = 20000 + 22,
.telnet_afe_port = 20100 + 22},
/* 12, 1 */ {.telnet_port = 20000 + 23,
.telnet_afe_port = 20100 + 23}},
};
......@@ -40,9 +40,13 @@ const board_epics_rev_map_t board_epics_rev_map[NUM_MAX_SLOTS+1][NUM_MAX_BPM_PER
};
const board_epics_opts_t board_epics_opts[NUM_MAX_SLOTS+1][NUM_MAX_BPM_PER_SLOT] = {
/* board, bpm */ /* bpm_id */
/* 0, 0 (INVALID) */ {{-1},
/* 0, 1 (INVALID) */ {-1}},
/* 1, 0 */ {{20000 + 0},
/* 1, 1 */ {20000 + 1}}
/* board, bpm */ /* bpm_id */
/* 0, 0 (INVALID) */ {{.telnet_port = -1,
.telnet_afe_port = -1},
/* 0, 1 (INVALID) */ {.telnet_port = -1,
.telnet_afe_port = -1}},
/* 1, 0 */ {{.telnet_port = 20000 + 0,
.telnet_afe_port = 20100 + 0},
/* 1, 1 */ {.telnet_port = 20000 + 1,
.telnet_afe_port = 20100 + 1}},
};
......@@ -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 *****************************/
......
......@@ -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 (spwan_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 (spawn_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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment