Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
White Rabbit Switch - Software
Manage
Activity
Members
Labels
Plan
Issues
87
Issue boards
Milestones
Wiki
Code
Merge requests
4
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
White Rabbit Switch - Software
Commits
d145adb5
Commit
d145adb5
authored
9 years ago
by
Adam Wujek
Browse files
Options
Downloads
Patches
Plain Diff
userspace/wrsw_hal: make hal support wriX interfaces
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
177e1b76
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
userspace/wrsw_hal/hal_ports.c
+26
-18
26 additions, 18 deletions
userspace/wrsw_hal/hal_ports.c
with
26 additions
and
18 deletions
userspace/wrsw_hal/hal_ports.c
+
26
−
18
View file @
d145adb5
...
...
@@ -92,13 +92,17 @@ static int hal_port_init(int index)
struct
hal_port_state
*
p
=
&
ports
[
index
];
char
name
[
128
],
s
[
128
];
int
val
,
error
;
int
port_i
;
/* index is 0..17, port_i 1..18 */
port_i
=
index
+
1
;
/* make sure the states and other variables are in their init state */
hal_port_reset_state
(
p
);
/* read dot-config values for this index, starting from name */
error
=
libwr_cfg_convert2
(
"PORT%02i_PARAMS"
,
"name"
,
LIBWR_STRING
,
name
,
index
);
name
,
port_i
);
if
(
error
)
return
-
1
;
strncpy
(
p
->
name
,
name
,
16
);
...
...
@@ -112,23 +116,26 @@ static int hal_port_init(int index)
val
=
18
*
800
;
/* magic default from previous code */
error
=
libwr_cfg_convert2
(
"PORT%02i_PARAMS"
,
"tx"
,
LIBWR_INT
,
&
val
,
index
);
&
val
,
port_i
);
if
(
error
)
pr_error
(
"port
index
%i (%s): no
\"
tx=
\"
specified
\n
"
,
index
,
name
);
pr_error
(
"port %i (%s): no
\"
tx=
\"
specified
\n
"
,
port_i
,
name
);
p
->
calib
.
phy_tx_min
=
val
;
val
=
18
*
800
;
/* magic default from previous code */
error
=
libwr_cfg_convert2
(
"PORT%02i_PARAMS"
,
"rx"
,
LIBWR_INT
,
&
val
,
index
);
&
val
,
port_i
);
if
(
error
)
pr_error
(
"port
index
%i (%s): no
\"
rx=
\"
specified
\n
"
,
index
,
name
);
pr_error
(
"port %i (%s): no
\"
rx=
\"
specified
\n
"
,
port_i
,
name
);
p
->
calib
.
phy_rx_min
=
val
;
p
->
calib
.
delta_tx_board
=
0
;
/* never set */
p
->
calib
.
delta_rx_board
=
0
;
/* never set */
sscanf
(
p
->
name
+
2
,
"%d"
,
&
p
->
hw_index
);
/* get the number of a port from notation wriX */
sscanf
(
p
->
name
+
3
,
"%d"
,
&
p
->
hw_index
);
/* hw_index is 0..17, p->name wri1..18 */
p
->
hw_index
--
;
p
->
t2_phase_transition
=
DEFAULT_T2_PHASE_TRANS
;
p
->
t4_phase_transition
=
DEFAULT_T4_PHASE_TRANS
;
...
...
@@ -148,36 +155,36 @@ static int hal_port_init(int index)
strcpy
(
s
,
"non-wr"
);
/* default if no string passed */
p
->
mode
=
HEXP_PORT_MODE_NON_WR
;
error
=
libwr_cfg_convert2
(
"PORT%02i_PARAMS"
,
"role"
,
LIBWR_STRING
,
s
,
index
);
LIBWR_STRING
,
s
,
port_i
);
if
(
error
)
pr_error
(
"port
index
%i (%s): "
"no
\"
role=
\"
specified
\n
"
,
index
,
name
);
pr_error
(
"port %i (%s): "
"no
\"
role=
\"
specified
\n
"
,
port_i
,
name
);
for
(
rp
=
rt
;
rp
->
name
;
rp
++
)
if
(
!
strcasecmp
(
s
,
rp
->
name
))
break
;
p
->
mode
=
rp
->
value
;
if
(
!
rp
->
name
)
pr_error
(
"port
index
%i (%s): invalid role "
"
\"
%s
\"
specified
\n
"
,
index
,
name
,
s
);
pr_error
(
"port %i (%s): invalid role "
"
\"
%s
\"
specified
\n
"
,
port_i
,
name
,
s
);
pr_debug
(
"Port %s: mode %i
\n
"
,
p
->
name
,
val
);
}
/* Get fiber type */
error
=
libwr_cfg_convert2
(
"PORT%02i_PARAMS"
,
"fiber"
,
LIBWR_INT
,
&
p
->
fiber_index
,
index
);
LIBWR_INT
,
&
p
->
fiber_index
,
port_i
);
if
(
error
)
{
pr_error
(
"port
index
%i (%s): "
pr_error
(
"port %i (%s): "
"no
\"
fiber=
\"
specified, default fiber to 0
\n
"
,
index
,
name
);
port_i
,
name
);
p
->
fiber_index
=
0
;
}
if
(
p
->
fiber_index
>
3
)
{
pr_error
(
"port
index
%i (%s): "
pr_error
(
"port %i (%s): "
"not supported
\"
fiber=
\"
value, default to 0
\n
"
,
index
,
name
);
port_i
,
name
);
p
->
fiber_index
=
0
;
}
...
...
@@ -230,6 +237,7 @@ int hal_port_init_all(char *logfilename)
for
(
index
=
0
;
index
<
HAL_MAX_PORTS
;
index
++
)
if
(
hal_port_init
(
index
)
<
0
)
break
;
hal_port_nports
=
index
;
pr_info
(
"Number of physical ports supported in HW: %d
\n
"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment