Skip to content
Snippets Groups Projects
Commit b1efe61c authored by Adam Wujek's avatar Adam Wujek :speech_balloon:
Browse files

[BUG: 1349] userspace/wrsw_hal: create shmem before locking the SoftPLL


Hal creates shmem before waiting for SoftPLL to lock. By this other programs
waiting for HAL's shmem can start.
Please note that after this fix PPSi does not create shmem before lock.
It waits for HALs minipc server to be ready.

Before shmem is created, read hal mode first.

Signed-off-by: default avatarAdam Wujek <adam.wujek@cern.ch>
parent 23737c78
No related merge requests found
......@@ -110,10 +110,16 @@ static int hal_init(void)
/* Low-level hw init, init non-kernel drivers */
assert_init(shw_init());
/* read timing mode from dot-config */
assert_init(hal_init_timing_mode());
/* Initialize HAL's shmem - see hal_ports.c */
assert_init(hal_port_init_shmem(logfilename));
assert_init(hal_init_timing(logfilename));
/* Initialize port FSMs and IPC/RPC - see hal_ports.c */
assert_init(hal_port_init_all(logfilename));
/* Initialize IPC/RPC - see hal_ports.c */
assert_init(hal_port_init_wripc(logfilename));
//everything is fine up to here, we can blink green LED
shw_io_write(shw_io_led_state_o, 0);
......
......@@ -198,7 +198,7 @@ static int hal_port_init(int index)
/* Interates via all the ports defined in the config file and
* intializes them one after another. */
int hal_port_init_all(char *logfilename)
int hal_port_init_shmem(char *logfilename)
{
int index;
struct wrs_shm_head *hal_shmem_hdr;
......@@ -253,10 +253,13 @@ int hal_port_init_all(char *logfilename)
Especially for nports it is important */
wrs_shm_write(hal_shmem_hdr, WRS_SHM_WRITE_END);
return 0;
}
int hal_port_init_wripc(char *logfilename)
{
/* Create a WRIPC server for HAL public API */
return hal_init_wripc(ports, logfilename);
return 0;
}
/* Checks if the link is up on inteface (if_name). Returns non-zero if yes. */
......
......@@ -20,9 +20,8 @@ static int timing_mode;
#define LOCK_TIMEOUT_EXT 60000
#define LOCK_TIMEOUT_INT 10000
int hal_init_timing(char *filename)
int hal_init_timing_mode(void)
{
timeout_t lock_tmo;
static struct {
char *cfgname;
int modevalue;
......@@ -39,6 +38,7 @@ int hal_init_timing(char *filename)
return -1;
}
/* Read the mode from dot-config */
for (m = modes; m->cfgname; m++)
if (libwr_cfg_get(m->cfgname))
break;
......@@ -47,7 +47,12 @@ int hal_init_timing(char *filename)
if (!m->cfgname)
pr_error("%s: no config variable set, defaults used\n",
__func__);
return 0;
}
int hal_init_timing(char *filename)
{
timeout_t lock_tmo;
/* initialize the RT Subsys */
switch (timing_mode) {
case HAL_TIMING_MODE_GRAND_MASTER:
......
......@@ -16,7 +16,8 @@ int hal_config_get_string(const char *name, char *value, int max_len);
int hal_config_iterate(const char *section, int index,
char *subsection, int max_len);
int hal_port_init_all(char *logfilename);
int hal_port_init_shmem(char *logfilename);
int hal_port_init_wripc(char *logfilename);
void hal_port_update_all(void);
struct hexp_port_state;
struct hal_port_state;
......@@ -30,6 +31,7 @@ int hal_port_start_lock(const char *port_name, int priority);
int hal_port_check_lock(const char *port_name);
int hal_port_enable_tracking(const char *port_name);
int hal_init_timing_mode(void);
int hal_init_timing(char *filename);
int hal_get_timing_mode(void);
int hal_port_pshifter_busy(void);
......
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