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
cd96b655
Commit
cd96b655
authored
Aug 27, 2019
by
Maciej Lipinski
Committed by
Jean-Claude BAU
Oct 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[HAL] add LED blinking when LPDC tx_calibration
parent
102ddddc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
2 deletions
+32
-2
hal_port_fsm_tx.c
userspace/wrsw_hal/hal_port_fsm_tx.c
+6
-1
hal_port_leds.c
userspace/wrsw_hal/hal_port_leds.c
+24
-1
hal_port_leds.h
userspace/wrsw_hal/hal_port_leds.h
+2
-0
No files found.
userspace/wrsw_hal/hal_port_fsm_tx.c
View file @
cd96b655
...
...
@@ -15,6 +15,7 @@
#include "hal_exports.h"
#include "hal_port_gen_fsm.h"
#include "driver_stuff.h"
#include "hal_port_leds.h"
#include "hal_main.h"
#include "hal_ports.h"
#include "hal_port_fsm_txP.h"
...
...
@@ -115,7 +116,6 @@ static int _within_range(int x, int minval, int maxval, int wrap);
static
int
_hal_port_tx_setup_state_start
(
void
*
vpfg
,
int
eventMsk
,
int
isNewState
)
{
struct
hal_port_state
*
ps
=
((
halPortFsmGen_t
*
)
vpfg
)
->
ps
;
if
(
!
ps
->
lpdc
.
isSupported
)
{
// NO LPDC support
_fireState
(
vpfg
,
HAL_PORT_TX_SETUP_STATE_DONE
);
...
...
@@ -141,6 +141,9 @@ static int _hal_port_tx_setup_state_start(void *vpfg, int eventMsk, int isNewSta
pcs_writel
(
ps
,
MDIO_LPC_CTRL_RESET_RX
|
MDIO_LPC_CTRL_DMTD_SOURCE_TXOUTCLK
,
MDIO_LPC_CTRL
);
led_set_wrmode
(
ps
->
hw_index
,
SFP_LED_WRMODE_TX_CALIB
);
_fireState
(
vpfg
,
HAL_PORT_TX_SETUP_STATE_RESET_PCS
);
}
return
0
;
...
...
@@ -275,6 +278,8 @@ static int _hal_port_tx_setup_state_validate(void *vpfg, int eventMsk, int isNew
MDIO_LPC_CTRL_DMTD_SOURCE_RXRECCLK
,
MDIO_LPC_CTRL
);
led_set_wrmode
(
ps
->
hw_index
,
SFP_LED_WRMODE_OFF
);
_fireState
(
vpfg
,
HAL_PORT_TX_SETUP_STATE_DONE
);
_update_tx_calibration_file
();
...
...
userspace/wrsw_hal/hal_port_leds.c
View file @
cd96b655
...
...
@@ -19,6 +19,17 @@ static struct Leds {
unsigned
char
link_leds_map
[
HAL_MAX_PORTS
];
}
_leds
;
static
int
led_blink_state
=
0
;
/* flip state of the leds to blink */
void
led_blink_state_change
(
void
)
{
led_blink_state
=
1
-
led_blink_state
;
}
/* state of blinking led (on/off) */
int
led_get_blink_state
(
void
)
{
return
led_blink_state
;
}
void
led_init_all_ports
(
struct
hal_port_state
*
ps
)
{
int
i
;
...
...
@@ -49,7 +60,8 @@ void led_link_update(struct hal_port_state *ps) {
for
(
i
=
0
;
i
<
HAL_MAX_PORTS
;
i
++
)
{
unsigned
char
value
=
_leds
.
link_leds_map_to_update
[
i
];
if
(
value
!=
_leds
.
link_leds_map
[
i
])
{
if
(
value
!=
_leds
.
link_leds_map
[
i
]
||
value
==
SFP_LED_WRMODE_TX_CALIB
/* always update to blink*/
)
{
_leds
.
link_leds_map
[
i
]
=
value
;
/* update the LED, don't forget to turn off LEDs if needed */
...
...
@@ -67,6 +79,16 @@ void led_link_update(struct hal_port_state *ps) {
case
SFP_LED_WRMODE_MASTER
:
shw_sfp_set_generic
(
i
,
1
,
SFP_LED_WRMODE1
|
SFP_LED_WRMODE2
);
break
;
case
SFP_LED_WRMODE_TX_CALIB
:
if
(
led_get_blink_state
()){
// SFP_LED_WRMODE_OTHER
shw_sfp_set_generic
(
i
,
0
,
SFP_LED_WRMODE1
);
shw_sfp_set_generic
(
i
,
1
,
SFP_LED_WRMODE2
);
}
else
{
// SFP_LED_WRMODE_OFF
shw_sfp_set_generic
(
i
,
0
,
SFP_LED_WRMODE1
|
SFP_LED_WRMODE2
);
}
break
;
case
SFP_LED_WRMODE_OFF
:
shw_sfp_set_generic
(
i
,
0
,
SFP_LED_WRMODE1
|
SFP_LED_WRMODE2
);
...
...
@@ -87,6 +109,7 @@ void led_link_update(struct hal_port_state *ps) {
port++;
#endif
}
led_blink_state_change
();
}
/* to avoid i2c transfers to set the synced LEDs, cache their state */
...
...
userspace/wrsw_hal/hal_port_leds.h
View file @
cd96b655
...
...
@@ -14,9 +14,11 @@
#define SFP_LED_WRMODE_OTHER (2)
/* orange */
#define SFP_LED_WRMODE_MASTER (3)
/* yellow */
#define SFP_LED_WRMODE_OFF (4)
/* to off entire WRMODE LED */
#define SFP_LED_WRMODE_TX_CALIB (5)
/* LPDC Tx calibration */
/* Prototypes */
extern
void
led_blink_state_change
(
void
);
extern
void
led_init_all_ports
(
struct
hal_port_state
*
ps
);
extern
void
led_set_wrmode
(
int
portIndex
,
int
val
);
extern
void
led_link_update
(
struct
hal_port_state
*
port
);
...
...
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