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
6da51eaf
Commit
6da51eaf
authored
Apr 25, 2012
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/wrsw_hal: use single HAL_MAX_PORTS macro
parent
97f30bb3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
hal_ports.c
userspace/wrsw_hal/hal_ports.c
+11
-8
No files found.
userspace/wrsw_hal/hal_ports.c
View file @
6da51eaf
...
...
@@ -31,7 +31,6 @@
#include "hal_exports.h"
#include "driver_stuff.h"
#define MAX_PORTS 64
/* Port modes - WR Uplink/Downlink/Non-WR-at-all */
#define HAL_PORT_MODE_WR_UPLINK 1
...
...
@@ -104,7 +103,7 @@ typedef struct {
/* Port table */
static
hal_port_state_t
ports
[
MAX_PORTS
];
static
hal_port_state_t
ports
[
HAL_
MAX_PORTS
];
/* An fd of always opened raw sockets for ioctl()-ing Ethernet devices */
static
int
fd_raw
;
...
...
@@ -461,6 +460,7 @@ static void port_fsm(hal_port_state_t *p)
p
->
calib
.
tx_calibrated
=
1
;
p
->
calib
.
rx_calibrated
=
1
;
/* FIXME: use proper register names */
TRACE
(
TRACE_INFO
,
"Bitslide: %d"
,
((
pcs_readl
(
p
,
16
)
>>
4
)
&
0x1f
));
p
->
calib
.
delta_rx_phy
=
p
->
calib
.
phy_rx_min
+
((
pcs_readl
(
p
,
16
)
>>
4
)
&
0x1f
)
*
800
;
p
->
calib
.
delta_tx_phy
=
p
->
calib
.
phy_tx_min
;
...
...
@@ -482,7 +482,8 @@ static void port_fsm(hal_port_state_t *p)
{
p
->
phase_val
=
rts_state
.
channels
[
p
->
hw_index
].
phase_loopback
;
p
->
phase_val_valid
=
rts_state
.
channels
[
p
->
hw_index
].
flags
&
CHAN_PMEAS_READY
?
1
:
0
;
p
->
locked
=
hal_port_check_lock
(
p
->
name
);
//hal_port_check_lock(p->name);
//p->locked =
}
break
;
...
...
@@ -561,7 +562,7 @@ static void poll_sfps()
if
(
mask
!=
old_mask
)
{
int
i
,
hw_index
;
for
(
i
=
0
;
i
<
MAX_PORTS
;
i
++
)
for
(
i
=
0
;
i
<
HAL_
MAX_PORTS
;
i
++
)
{
hw_index
=
ports
[
i
].
hw_index
;
...
...
@@ -588,7 +589,7 @@ void hal_update_ports()
poll_rts_state
();
poll_sfps
();
for
(
i
=
0
;
i
<
MAX_PORTS
;
i
++
)
for
(
i
=
0
;
i
<
HAL_
MAX_PORTS
;
i
++
)
if
(
ports
[
i
].
in_use
)
port_fsm
(
&
ports
[
i
]);
}
...
...
@@ -597,7 +598,7 @@ void hal_update_ports()
static
hal_port_state_t
*
lookup_port
(
const
char
*
name
)
{
int
i
;
for
(
i
=
0
;
i
<
MAX_PORTS
;
i
++
)
for
(
i
=
0
;
i
<
HAL_
MAX_PORTS
;
i
++
)
if
(
ports
[
i
].
in_use
&&
!
strcmp
(
name
,
ports
[
i
].
name
))
return
&
ports
[
i
];
...
...
@@ -646,6 +647,8 @@ int halexp_get_port_state(hexp_port_state_t *state, const char *port_name)
{
hal_port_state_t
*
p
=
lookup_port
(
port_name
);
TRACE
(
TRACE_INFO
,
"GetPorttState %s
\n
"
,
port_name
);
if
(
!
p
)
return
-
1
;
...
...
@@ -683,7 +686,7 @@ int halexp_get_port_state(hexp_port_state_t *state, const char *port_name)
static
int
any_port_calibrating
()
{
int
i
;
for
(
i
=
0
;
i
<
MAX_PORTS
;
i
++
)
for
(
i
=
0
;
i
<
HAL_
MAX_PORTS
;
i
++
)
if
(
ports
[
i
].
state
==
HAL_PORT_STATE_CALIBRATION
&&
ports
[
i
].
in_use
)
return
1
;
...
...
@@ -700,7 +703,7 @@ int halexp_query_ports(hexp_port_list_t *list)
int
i
;
int
n
=
0
;
for
(
i
=
0
;
i
<
MAX_PORTS
;
i
++
)
for
(
i
=
0
;
i
<
HAL_
MAX_PORTS
;
i
++
)
{
if
(
ports
[
i
].
in_use
)
strcpy
(
list
->
port_names
[
n
++
],
ports
[
i
].
name
);
...
...
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