Commit c552ec92 authored by Adam Wujek's avatar Adam Wujek 💬

userspace/wrsw_rtud: Don't inform about waiting for HAL for 5 seconds

It may take few seconds to start hal, rtud shouln't complain about it during
5 seconds.
Additionally change fprintf into pr_error.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 59122563
...@@ -75,12 +75,19 @@ void init_shm(void) ...@@ -75,12 +75,19 @@ void init_shm(void)
{ {
struct hal_shmem_header *h; struct hal_shmem_header *h;
int ii; int ii;
int n_wait = 0;
/* wait forever for HAL */ /* wait forever for HAL */
while ((hal_head = wrs_shm_get(wrs_shm_hal, "", while ((hal_head = wrs_shm_get(wrs_shm_hal, "",
WRS_SHM_READ | WRS_SHM_LOCKED)) WRS_SHM_READ | WRS_SHM_LOCKED))) {
== NULL) { if (n_wait > 5) {
pr_info("unable to open shm for HAL!\n"); /* print if waiting more than 5 seconds, some waiting
* is expected since hal requires few seconds to start
*/
pr_error("unable to open shm for HAL!\n");
}
n_wait++;
sleep(1);
} }
h = (void *)hal_head + hal_head->data_off; h = (void *)hal_head + hal_head->data_off;
...@@ -91,13 +98,19 @@ void init_shm(void) ...@@ -91,13 +98,19 @@ void init_shm(void)
hal_nports_local = h->nports; hal_nports_local = h->nports;
if (!wrs_shm_seqretry(hal_head, ii)) if (!wrs_shm_seqretry(hal_head, ii))
break; break;
pr_error("Wait for HAL.\n"); if (n_wait > 5) {
/* print if waiting more than 10 seconds, some wait
* is expected since hal requires few seconds to start
*/
pr_error("Wait for HAL.\n");
}
n_wait++;
sleep(1); sleep(1);
} }
/* check hal's shm version */ /* check hal's shm version */
if (hal_head->version != HAL_SHMEM_VERSION) { if (hal_head->version != HAL_SHMEM_VERSION) {
fprintf(stderr, "rtu_drv: unknown hal's shm version %i " pr_error("unknown hal's shm version %i "
"(known is %i)\n", "(known is %i)\n",
hal_head->version, HAL_SHMEM_VERSION); hal_head->version, HAL_SHMEM_VERSION);
exit(-1); exit(-1);
......
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