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
d145adb5
Commit
d145adb5
authored
Feb 05, 2016
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/wrsw_hal: make hal support wriX interfaces
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
177e1b76
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
18 deletions
+26
-18
hal_ports.c
userspace/wrsw_hal/hal_ports.c
+26
-18
No files found.
userspace/wrsw_hal/hal_ports.c
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
"
,
...
...
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