Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
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
White Rabbit Switch - Software
Commits
5a99d777
Commit
5a99d777
authored
Sep 11, 2019
by
Jean-Claude BAU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Manage the field 'shmemState' in HAL
parent
6c4378f9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
hal_main.c
userspace/wrsw_hal/hal_main.c
+6
-0
hal_ports.c
userspace/wrsw_hal/hal_ports.c
+21
-1
hal_ports.h
userspace/wrsw_hal/hal_ports.h
+1
-0
No files found.
userspace/wrsw_hal/hal_main.c
View file @
5a99d777
...
@@ -310,6 +310,12 @@ int main(int argc, char *argv[])
...
@@ -310,6 +310,12 @@ int main(int argc, char *argv[])
// Check main timers and call callback if timeout expires
// Check main timers and call callback if timeout expires
timer_scan
(
_timerParameters
,
MAIN_TIMER_COUNT
);
timer_scan
(
_timerParameters
,
MAIN_TIMER_COUNT
);
if
(
hal_shmem
->
shmemState
==
HAL_SHMEM_STATE_INITITALIZING
)
{
// Check if all ports have been initialized
if
(
hal_port_all_ports_initialized
())
hal_shmem
->
shmemState
=
HAL_SHMEM_STATE_INITITALIZED
;
}
}
}
hal_shutdown
();
hal_shutdown
();
...
...
userspace/wrsw_hal/hal_ports.c
View file @
5a99d777
...
@@ -244,7 +244,9 @@ int hal_port_shmem_init(char *logfilename)
...
@@ -244,7 +244,9 @@ int hal_port_shmem_init(char *logfilename)
return
-
1
;
return
-
1
;
}
}
hal_shmem
=
wrs_shm_alloc
(
hal_shmem_hdr
,
sizeof
(
*
hal_shmem
));
hal_shmem
=
wrs_shm_alloc
(
hal_shmem_hdr
,
sizeof
(
*
hal_shmem
));
halPorts
.
ports
=
wrs_shm_alloc
(
hal_shmem_hdr
,
hal_shmem
->
shmemState
=
HAL_SHMEM_STATE_NOT_INITITALIZED
;
halPorts
.
ports
=
wrs_shm_alloc
(
hal_shmem_hdr
,
sizeof
(
struct
hal_port_state
)
sizeof
(
struct
hal_port_state
)
*
HAL_MAX_PORTS
);
*
HAL_MAX_PORTS
);
if
(
!
hal_shmem
||
!
halPorts
.
ports
)
{
if
(
!
hal_shmem
||
!
halPorts
.
ports
)
{
...
@@ -276,6 +278,9 @@ int hal_port_shmem_init(char *logfilename)
...
@@ -276,6 +278,9 @@ int hal_port_shmem_init(char *logfilename)
}
else
}
else
hal_shmem
->
read_sfp_diag
=
READ_SFP_DIAG_DISABLE
;
hal_shmem
->
read_sfp_diag
=
READ_SFP_DIAG_DISABLE
;
hal_shmem
->
shmemState
=
HAL_SHMEM_STATE_INITITALIZING
;
hal_shmem_hdr
->
version
=
HAL_SHMEM_VERSION
;
hal_shmem_hdr
->
version
=
HAL_SHMEM_VERSION
;
/* Release processes waiting for HAL's to fill shm with correct data
/* Release processes waiting for HAL's to fill shm with correct data
When shm is opened successfully data in shm is still not populated!
When shm is opened successfully data in shm is still not populated!
...
@@ -704,6 +709,21 @@ int hal_port_reset(const char *port_name)
...
@@ -704,6 +709,21 @@ int hal_port_reset(const char *port_name)
return
0
;
return
0
;
}
}
// Check if all ports are initialized
int
hal_port_all_ports_initialized
(
void
)
{
struct
hal_port_state
*
ps
=
halPorts
.
ports
;
int
i
;
for
(
i
=
0
;
i
<
HAL_MAX_PORTS
;
i
++
)
{
if
(
ps
->
in_use
&&
ps
->
portStates
.
state
==
HAL_PORT_STATE_INIT
)
{
// This port has not finished its initialization state
return
0
;
}
ps
++
;
}
return
1
;
}
void
hal_port_update_info
(
char
*
iface_name
,
int
mode
,
int
synchronized
){
void
hal_port_update_info
(
char
*
iface_name
,
int
mode
,
int
synchronized
){
int
i
;
int
i
;
...
...
userspace/wrsw_hal/hal_ports.h
View file @
5a99d777
...
@@ -43,6 +43,7 @@ extern int hal_port_start_lock(const char *port_name, int priority);
...
@@ -43,6 +43,7 @@ extern int hal_port_start_lock(const char *port_name, int priority);
extern
int
hal_port_enable_tracking
(
const
char
*
port_name
);
extern
int
hal_port_enable_tracking
(
const
char
*
port_name
);
extern
int
hal_port_check_lock
(
const
struct
hal_port_state
*
ps
);
extern
int
hal_port_check_lock
(
const
struct
hal_port_state
*
ps
);
extern
int
hal_port_check_lock_by_name
(
const
char
*
port_name
);
extern
int
hal_port_check_lock_by_name
(
const
char
*
port_name
);
extern
int
hal_port_all_ports_initialized
(
void
);
extern
int
hal_port_reset
(
const
char
*
port_name
);
extern
int
hal_port_reset
(
const
char
*
port_name
);
extern
int
hal_port_pshifter_busy
(
void
);
extern
int
hal_port_pshifter_busy
(
void
);
extern
void
hal_port_update_info
(
char
*
iface_name
,
int
mode
,
int
synchronized
);
extern
void
hal_port_update_info
(
char
*
iface_name
,
int
mode
,
int
synchronized
);
...
...
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